Native representation of an IP Address. More...
#include <Socket.h>
Public Types | |
| using | AsciiBuffer = char[MAX_ASCII_STRING_LENGTH] |
| Buffer for storing the ASCII representation of an IP Address. | |
Public Member Functions | |
| SocketIPAddress (SocketFlags::AddressFamily addressFamily=SocketFlags::AddressFamilyIPV4) | |
| Constructs an ip address from a given family (IPV4 or IPV6) | |
| SocketFlags::AddressFamily | getAddressFamily () const |
| Get Address family of this ip address (IPV4 or IPV6) | |
| uint16_t | getPort () const |
| Get port of this ip address. | |
| Result | fromAddressPort (StringSpan interfaceAddress, uint16_t port) |
| Builds this SocketIPAddress parsing given address string and port. | |
| uint32_t | sizeOfHandle () const |
| Size of the native IP Address representation. | |
| bool | isValid () const |
| Checks if this is a valid IPV4 or IPV6 address. | |
| bool | toString (Span< char > inputSpan, StringSpan &outputSpan) const |
| Returns the text representation of this SocketIPAddress. | |
Public Attributes | |
| AlignedStorage< 28 > | handle = {} |
| Handle to native OS representation of the IP Address. | |
Static Public Attributes | |
| static constexpr int | MAX_ASCII_STRING_LENGTH = 46 |
| Maximum length of the ASCII representation of an IP Address. | |
Friends | |
| struct | SocketServer |
| struct | SocketClient |
Native representation of an IP Address.
Example:
| using SC::SocketIPAddress::AsciiBuffer = char[MAX_ASCII_STRING_LENGTH] |
Buffer for storing the ASCII representation of an IP Address.
| SC::SocketIPAddress::SocketIPAddress | ( | SocketFlags::AddressFamily | addressFamily = SocketFlags::AddressFamilyIPV4 | ) |
Constructs an ip address from a given family (IPV4 or IPV6)
| addressFamily | The address family |
| Result SC::SocketIPAddress::fromAddressPort | ( | StringSpan | interfaceAddress, |
| uint16_t | port ) |
Builds this SocketIPAddress parsing given address string and port.
| interfaceAddress | A valid IPV4 or IPV6 address expressed as an ASCII string |
| port | The port to connect to |
|
nodiscard |
Get Address family of this ip address (IPV4 or IPV6)
|
nodiscard |
Get port of this ip address.
|
nodiscard |
Checks if this is a valid IPV4 or IPV6 address.
|
nodiscard |
Size of the native IP Address representation.
|
nodiscard |
Returns the text representation of this SocketIPAddress.
| inputSpan | Buffer to store the ASCII representation of the IP Address |
| outputSpan | A sub-Span of inputSpan that has the length of actually written bytes |
MAX_ASCII_STRING_LENGTH bytes long | AlignedStorage<28> SC::SocketIPAddress::handle = {} |
Handle to native OS representation of the IP Address.
|
staticconstexpr |
Maximum length of the ASCII representation of an IP Address.