AsyncBerkeley
Asynchronous Berkeley sockets. Simple.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
io::socket::socket_address< Addr > Struct Template Reference

Represents a platform-independent socket address. More...

#include <io/socket/socket_address.hpp>

Inheritance diagram for io::socket::socket_address< Addr >:
io::socket::socket_option< T >

Public Types

using Base = socket_option< Addr >
 The base class for the socket address.
 
- Public Types inherited from io::socket::socket_option< T >
using value_type = std::decay_t< T >
 The type of the socket option value.
 
using size_type = std::size_t
 The size type for the socket option.
 

Public Member Functions

template<socklen_type Size = sizeof(Addr)>
requires (Size <= sizeof(Addr))
 socket_address (const sockaddr_type *addr, socklen_type size=Size) noexcept
 Constructs a socket_address from a raw socket address structure.
 
template<SocketAddress OtherAddr>
 socket_address (const socket_address< OtherAddr > &other) noexcept
 Constructs a socket_address from another socket_address.
 
- Public Member Functions inherited from io::socket::socket_option< T >
template<size_type Size = sizeof(value_type)>
requires (Size <= sizeof(value_type))
constexpr socket_option (size_type size=Size) noexcept
 Constructs a socket_option with a given size.
 
 socket_option (const socket_option &)=default
 Default copy constructor.
 
 socket_option (socket_option &&)=default
 Default move constructor.
 
 socket_option (const value_type &val) noexcept
 Constructs a socket_option from a value.
 
template<size_type Size>
requires (Size <= sizeof(value_type) || Size == std::dynamic_extent)
 socket_option (std::span< const std::byte, Size > option) noexcept
 Constructs a socket_option from a span of bytes.
 
template<size_type Size>
requires (Size <= sizeof(value_type) || Size == std::dynamic_extent)
 socket_option (std::span< std::byte, Size > option) noexcept
 Constructs a socket_option from a span of bytes.
 
auto operator= (const socket_option &) -> socket_option &=default
 Default copy assignment operator.
 
auto operator= (socket_option &&) -> socket_option &=default
 Default move assignment operator.
 
 ~socket_option ()=default
 Default destructor.
 
constexpr auto operator* () noexcept -> value_type &
 Dereferences the socket option to its value.
 
constexpr auto operator-> () noexcept -> value_type *
 Accesses the socket option's value.
 
constexpr auto begin () noexcept -> std::byte *
 Gets an iterator to the beginning of the option's byte representation.
 
constexpr auto begin () const noexcept -> const std::byte *
 Gets a const iterator to the beginning of the option's byte representation.
 
constexpr auto end () noexcept -> std::byte *
 Gets an iterator to the end of the option's byte representation.
 
constexpr auto end () const noexcept -> const std::byte *
 Gets a const iterator to the end of the option's byte representation.
 
auto operator<=> (const socket_option &other) const noexcept -> bool
 Compares this socket_option with another for ordering.
 
auto operator== (const socket_option &other) const noexcept -> bool
 Compares two socket_option objects for equality.
 

Detailed Description

template<SocketAddress Addr = sockaddr_storage_type>
struct io::socket::socket_address< Addr >

Represents a platform-independent socket address.

This class inherits from socket_option to provide a generic way to handle different socket address types.

Constructor & Destructor Documentation

◆ socket_address() [1/2]

template<SocketAddress Addr = sockaddr_storage_type>
template<socklen_type Size = sizeof(Addr)>
requires (Size <= sizeof(Addr))
io::socket::socket_address< Addr >::socket_address ( const sockaddr_type *  addr,
socklen_type  size = Size 
)
inlinenoexcept

Constructs a socket_address from a raw socket address structure.

Template Parameters
SizeThe size of the socket address structure.
Parameters
addrA pointer to the raw socket address structure.
sizeThe size of the socket address structure.

◆ socket_address() [2/2]

template<SocketAddress Addr = sockaddr_storage_type>
template<SocketAddress OtherAddr>
io::socket::socket_address< Addr >::socket_address ( const socket_address< OtherAddr > &  other)
inlinenoexcept

Constructs a socket_address from another socket_address.

Template Parameters
OtherAddrThe type of the other socket address.
Parameters
otherThe other socket_address to construct from.

The documentation for this struct was generated from the following file: