Open 3D Engine AzNetworking API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::IpAddress Class Reference

Wrapper for dealing with internet Ip addresses. More...

#include <IpAddress.h>

Public Types

using IpString = AZStd::fixed_string< MaxIpStringLength >
 

Public Member Functions

 IpAddress (const char *hostname, const char *service, ProtocolType type)
 
 IpAddress (const char *hostname, uint16_t port, ProtocolType type)
 
 IpAddress (uint8_t quadA, uint8_t quadB, uint8_t quadC, uint8_t quadD, uint16_t port)
 
 IpAddress (ByteOrder byteOrder, uint32_t address, uint16_t port)
 
uint32_t GetAddress (ByteOrder byteOrder) const
 
uint16_t GetPort (ByteOrder byteOrder) const
 
uint8_t GetQuadA () const
 
uint8_t GetQuadB () const
 
uint8_t GetQuadC () const
 
uint8_t GetQuadD () const
 
IpString GetString () const
 
IpString GetIpString () const
 
bool operator== (const IpAddress &rhs) const
 
bool operator!= (const IpAddress &rhs) const
 
bool operator< (const IpAddress &rhs) const
 
bool operator<= (const IpAddress &rhs) const
 
bool operator> (const IpAddress &rhs) const
 
bool operator>= (const IpAddress &rhs) const
 
bool Serialize (ISerializer &serializer)
 

Static Public Attributes

static constexpr uint32_t MaxIpStringLength = 32
 

Detailed Description

Wrapper for dealing with internet Ip addresses.

Constructor & Destructor Documentation

◆ IpAddress() [1/4]

AzNetworking::IpAddress::IpAddress ( const char *  hostname,
const char *  service,
ProtocolType  type 
)

Construct from a string hostname.

Parameters
hostnamehostname to convert to an IpAddress "amazon.com" or "127.0.0.1"
serviceservice or port number "80" or "http"

◆ IpAddress() [2/4]

AzNetworking::IpAddress::IpAddress ( const char *  hostname,
uint16_t  port,
ProtocolType  type 
)

Construct from a string hostname.

Parameters
hostnamehostname to convert to an IpAddress "amazon.com" or "127.0.0.1"
portthe port number

◆ IpAddress() [3/4]

AzNetworking::IpAddress::IpAddress ( uint8_t  quadA,
uint8_t  quadB,
uint8_t  quadC,
uint8_t  quadD,
uint16_t  port 
)

Construct from a set of Ipv4 quads.

Parameters
quadAfirst quad of the address
quadBsecond quad of the address
quadCthird quad of the address
quadDforth quad of the address
portport number given in host byte order

◆ IpAddress() [4/4]

AzNetworking::IpAddress::IpAddress ( ByteOrder  byteOrder,
uint32_t  address,
uint16_t  port 
)

Construct from an IPv4Address and port number given in the provided byte order.

Parameters
byteOrderthe byte order of the provided parameters
addressIPv4Address given in host byte order
portport number given in host byte order

Member Function Documentation

◆ GetAddress()

uint32_t AzNetworking::IpAddress::GetAddress ( ByteOrder  byteOrder) const

Returns the address in requested byte order

Returns
internal IPv4Address in requested byte order

◆ GetIpString()

IpString AzNetworking::IpAddress::GetIpString ( ) const

Returns just the ip address with no port number in a human readable string form.

Returns
just the ip address with no port number in a human readable string form

◆ GetPort()

uint16_t AzNetworking::IpAddress::GetPort ( ByteOrder  byteOrder) const

Returns the port number in requested byte order

Returns
internal port number in requested byte order

◆ GetQuadA()

uint8_t AzNetworking::IpAddress::GetQuadA ( ) const
inline

Return the first dotted quad of the internal Ipv4Address

Returns
first dotted quad of the internal Ipv4Address

◆ GetQuadB()

uint8_t AzNetworking::IpAddress::GetQuadB ( ) const
inline

Return the second dotted quad of the internal Ipv4Address

Returns
second dotted quad of the internal Ipv4Address

◆ GetQuadC()

uint8_t AzNetworking::IpAddress::GetQuadC ( ) const
inline

Return the third dotted quad of the internal Ipv4Address

Returns
third dotted quad of the internal Ipv4Address

◆ GetQuadD()

uint8_t AzNetworking::IpAddress::GetQuadD ( ) const
inline

Return the forth dotted quad of the internal Ipv4Address

Returns
forth dotted quad of the internal Ipv4Address

◆ GetString()

IpString AzNetworking::IpAddress::GetString ( ) const

Returns the address in a human readable string form.

Returns
the address in a human readable string form

◆ operator!=()

bool AzNetworking::IpAddress::operator!= ( const IpAddress rhs) const
inline

Inequality operator

Parameters
rhsbase type value to compare against
Returns
boolean true if this != rhs

◆ operator<()

bool AzNetworking::IpAddress::operator< ( const IpAddress rhs) const
inline

Strictly less than operator.

Parameters
rhsbase type value to compare against
Returns
boolean true if this < rhs

◆ operator<=()

bool AzNetworking::IpAddress::operator<= ( const IpAddress rhs) const
inline

Less than equal to operator.

Parameters
rhsbase type value to compare against
Returns
boolean true if this <= rhs

◆ operator==()

bool AzNetworking::IpAddress::operator== ( const IpAddress rhs) const
inline

Equality operator.

Parameters
rhsbase type value to compare against
Returns
boolean true if this == rhs

◆ operator>()

bool AzNetworking::IpAddress::operator> ( const IpAddress rhs) const
inline

Strictly greater than operator.

Parameters
rhsbase type value to compare against
Returns
boolean true if this > rhs

◆ operator>=()

bool AzNetworking::IpAddress::operator>= ( const IpAddress rhs) const
inline

Greater than equal to operator.

Parameters
rhsbase type value to compare against
Returns
boolean true if this >= rhs

◆ Serialize()

bool AzNetworking::IpAddress::Serialize ( ISerializer serializer)

Serializes the ipAddress using the provided serializer instance.

Parameters
serializerISerializer instance to use for serialization
Returns
boolean true for success, false for serialization failure

The documentation for this class was generated from the following files: