|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Combined IPv4Address and PortNumber. More...
#include <GREM/networking/Endpoint.hpp>
Public Member Functions | |
| constexpr | IPv4Endpoint (IPv4Address address, PortNumber port=0) noexcept |
| Construct an IPv4 endpoint from an IPv4 address and port number. | |
| constexpr | IPv4Endpoint (const sockaddr_in &addr) noexcept |
| Construct an IPv4 endpoint from a native sockaddr_in structure. | |
| constexpr void | setAddress (IPv4Address newAddress) noexcept |
| Set the address of the endpoint. | |
| constexpr void | setPortNumber (PortNumber newPortNumber) noexcept |
| Set the port number of the endpoint. | |
| constexpr IPv4Address | getAddress () const noexcept |
| Get the address of the endpoint. | |
| constexpr PortNumber | getPortNumber () const noexcept |
| Get the port number of the endpoint. | |
| constexpr bool | isAddressAny () const noexcept |
| Check if the value of this endpoint's IPv4 address is equal to the ANY address (0.0.0.0). | |
| constexpr bool | isAddressLoopback () const noexcept |
| Check if this endpoint's IPv4 address is a loopback address (starts with 127). | |
| constexpr bool | isAddressPrivate () const noexcept |
| Check if this endpoint's IPv4 address is in a private address range. | |
| constexpr sockaddr_in * | get () noexcept |
| Get a pointer to the underlying native sockaddr_in structure of the IPv4 endpoint. | |
| constexpr const sockaddr_in * | get () const noexcept |
| Get a pointer to the underlying native sockaddr_in structure of the IPv4 endpoint. | |
| constexpr bool | operator== (IPv4Endpoint other) const noexcept |
| Compare this endpoint to another for equality. | |
| constexpr std::strong_ordering | operator<=> (IPv4Endpoint other) const noexcept |
| Compare this endpoint to another. | |
Static Public Member Functions | |
| static Optional< IPv4Endpoint > | parse (CStringView addressString, CStringView portNumberString, std::error_code &errorCode) noexcept |
| Parse an IPv4 address from an ASCII string in dot-decimal notation, and a port number from a decimal ASCII string. | |
| static IPv4Endpoint | parse (CStringView addressString, CStringView portNumberString) |
| Parse an IPv4 address from an ASCII string in dot-decimal notation, and a port number from a decimal ASCII string, throwing an exception on failure. | |
| static Optional< IPv4Endpoint > | parse (CStringView string, std::error_code &errorCode) noexcept |
| Parse an IPv4 address from an ASCII string in dot-decimal notation with an optional decimal port number. | |
| static IPv4Endpoint | parse (CStringView string) |
| Parse an IPv4 address from an ASCII string in dot-decimal notation with an optional decimal port number, throwing an exception on failure. | |
| static Optional< IPv4Endpoint > | resolve (const char *hostName, const char *service, std::error_code &errorCode) |
| Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup. | |
| static IPv4Endpoint | resolve (const char *hostName, const char *service) |
| Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup, throwing an exception on failure. | |
| static Optional< IPv4Endpoint > | resolve (CStringView host, std::error_code &errorCode) |
| Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup. | |
| static IPv4Endpoint | resolve (CStringView host) |
| Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup, throwing an exception on failure. | |
| static Optional< IPv4Endpoint > | getLocalEndpoint (std::error_code &errorCode) |
| Get the IPv4 address and port of the local host on the local network by calling connect() on a temporary connectionless socket to the loopback address on port 9 (the "Discard" service) and querying its local address with getsockname(). | |
| static IPv4Endpoint | getLocalEndpoint () |
| Get the IPv4 address and port of the local host on the local network by calling connect() on a temporary connectionless socket to the loopback address on port 9 (the "Discard" service) and querying its local address with getsockname(), throwing an exception on failure. | |
Combined IPv4Address and PortNumber.
|
inlineexplicitconstexprnoexcept |
Construct an IPv4 endpoint from an IPv4 address and port number.
| address | IPv4 address of the endpoint. |
| port | port number of the endpoint. |
|
inlineexplicitconstexprnoexcept |
Construct an IPv4 endpoint from a native sockaddr_in structure.
| addr | sockaddr_in structure to construct the IPv4 endpoint from. |
|
staticnodiscardnoexcept |
Parse an IPv4 address from an ASCII string in dot-decimal notation, and a port number from a decimal ASCII string.
| addressString | string containing the four-decimal address to parse. |
| portNumberString | string containing the decimal port number to parse. |
| errorCode | error code that is filled in on failure to parse a valid IPv4 address or port number, or cleared on success. |
|
staticnodiscard |
Parse an IPv4 address from an ASCII string in dot-decimal notation, and a port number from a decimal ASCII string, throwing an exception on failure.
| addressString | string containing the four-decimal address to parse. |
| portNumberString | string containing the decimal port number to parse. |
| networking::Error | on failure to parse a valid IPv4 address or port number. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscardnoexcept |
Parse an IPv4 address from an ASCII string in dot-decimal notation with an optional decimal port number.
| string | string containing the four-decimal address to parse, and potentially a decimal port number separated by a colon. |
| errorCode | error code that is filled in on failure to parse a valid IPv4 address or port number, or cleared on success. |
|
staticnodiscard |
Parse an IPv4 address from an ASCII string in dot-decimal notation with an optional decimal port number, throwing an exception on failure.
| string | string containing the four-decimal address to parse, and potentially a decimal port number separated by a colon. |
| networking::Error | on failure to parse a valid IPv4 address or port number. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup.
| hostName | null-terminated domain name or address string of the host to look up, e.g. "example.com" or "127.0.0.1", or nullptr to look up by service only. Must not be nullptr if service is nullptr. |
| service | null-terminated service or port string of the host to look up, e.g. "http" or "80", or nullptr to look up by host name only. Must not be nullptr if hostName is nullptr. |
| errorCode | error code that is filled in on failure to resolve the host, or cleared on success. |
|
staticnodiscard |
Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup, throwing an exception on failure.
| hostName | null-terminated domain name or address string of the host to look up, e.g. "example.com" or "127.0.0.1", or nullptr to look up by service only. Must not be nullptr if service is nullptr. |
| service | null-terminated service or port string of the host to look up, e.g. "http" or "80", or nullptr to look up by host name only. Must not be nullptr if hostName is nullptr. |
| networking::Error | on failure to resolve the host. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup.
| host | combined host name and service string separated by a colon, e.g. "example.com:http" or "127.0.0.1:80", or a host name-only string with no colon, e.g. "example.com" or "127.0.0.1". |
| errorCode | error code that is filled in on failure to resolve the host, or cleared on success. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Resolve the IPv4 address and port number of a host through the Domain Name System (DNS) using a getaddrinfo() lookup, throwing an exception on failure.
| host | combined host name and service string separated by a colon, e.g. "example.com:http" or "127.0.0.1:80", or a host name-only string with no colon, e.g. "example.com" or "127.0.0.1". |
| networking::Error | on failure to resolve the host. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Get the IPv4 address and port of the local host on the local network by calling connect() on a temporary connectionless socket to the loopback address on port 9 (the "Discard" service) and querying its local address with getsockname().
| errorCode | error code that is filled in on failure to get the local address, or cleared on success. |
|
staticnodiscard |
Get the IPv4 address and port of the local host on the local network by calling connect() on a temporary connectionless socket to the loopback address on port 9 (the "Discard" service) and querying its local address with getsockname(), throwing an exception on failure.
| networking::Error | on failure to get the local address. |
| std::bad_alloc | on allocation failure. |
|
inlineconstexprnoexcept |
Set the address of the endpoint.
| newAddress | new address to set. |
|
inlineconstexprnoexcept |
Set the port number of the endpoint.
| newPortNumber | new port number to set. |
|
inlinenodiscardconstexprnoexcept |
Get the address of the endpoint.
|
inlinenodiscardconstexprnoexcept |
Get the port number of the endpoint.
|
inlinenodiscardconstexprnoexcept |
Check if the value of this endpoint's IPv4 address is equal to the ANY address (0.0.0.0).
|
inlinenodiscardconstexprnoexcept |
Check if this endpoint's IPv4 address is a loopback address (starts with 127).
|
inlinenodiscardconstexprnoexcept |
Check if this endpoint's IPv4 address is in a private address range.
The address ranges reserved for private networks are:
|
inlinenodiscardconstexprnoexcept |
Get a pointer to the underlying native sockaddr_in structure of the IPv4 endpoint.
|
inlinenodiscardconstexprnoexcept |
Get a pointer to the underlying native sockaddr_in structure of the IPv4 endpoint.
|
inlinenodiscardconstexprnoexcept |
Compare this endpoint to another for equality.
| other | the endpoint to compare this one to. |
|
inlinenodiscardconstexprnoexcept |
Compare this endpoint to another.
| other | the endpoint to compare this one to. |