Public Member Functions | |
CAddress () | |
Creates an empty instance of a CAddress object that doesn't contain any address. | |
CAddress (const sockaddr &address, int size) | |
Creates a CAddress object that represents the supplied address. | |
CAddress (const JetByteTools::Core::_tstring &hexOrDottedIPorName, IIPAddress::Port port) | |
Creates a CAddress object for an IP address from the supplied address in IPv4 dotted IP format "xxx.xxx.xxx.xxx" or IPv6 hex IP format: "ffff:ffff:ffff:ffff:ffff" or from a host name, and a port. | |
CAddress (const JetByteTools::Core::_tstring &hexOrDottedIPorName, IIPAddress::Port port, const IAddressType &addressTypePreference) | |
Creates a CAddress object for an IP address from the supplied address in IPv4 dotted IP format "xxx.xxx.xxx.xxx" or IPv6 hex IP format: "ffff:ffff:ffff:ffff:ffff" or from a host name, and a port. Where a host name is supplied the address selection preference can be specified if it's important to you. | |
CAddress (const JetByteTools::Core::_tstring &addressAsString) | |
Creates a CAddress object for an IP address from the supplied address either IPv4 format: "xxx.xxx.xxx.xxx:port" or in IPv6 format: "[ffff:ffff:ffff:ffff:ffff]:port". | |
CAddress (const CAddress &rhs) | |
CAddress (const IAddress &rhs) | |
~CAddress () override | |
CAddress & | operator= (const CAddress &rhs) |
CAddress & | operator= (const IAddress &rhs) |
void | Reset () |
void | CopyFrom (const sockaddr &address, int size) |
Copies from the supplied address into this CAddress's storage. | |
unsigned short | Family () const override |
Returns the address family of the address. | |
const sockaddr & | AsSockAddr () const override |
Returns the address as a reference to a sockaddr structure. | |
int | Size () const override |
Returns the size of the sockaddr structure required to store the address. | |
IAddressRef * | GetAddressRef () const override |
Returns a reference counted view on this address, be sure to call Release() on the IAdressRef when you're done with it. | |
sockaddr * | GetStorage () override |
Returns a pointer to a writable area of memory, represented as a socaddr structure, that is GetSize() bytes long. | |
int * | GetSize () override |
Returns a writable integer that contains the size of storage (in bytes) available for the address. You can then use the writable pointer to update this value to the amount of storage actually used. Typically one would copy the address into the memory returned by GetStorage() and then update the size used to the correct value by writing to the value returned from this function. Note that GetSize() will always return the maximum available storage, if you need to know the storage used then call IAddress.Size(). Calling GetSize() resets the size used to the maximum size available. Bleugh, but written so that this works: getsockname(socket, address.GetStorage(), address.GetSize()) . | |
IWritableAddressRef * | GetWritableAddressRef () const override |
Returns a reference counted view on this address, be sure to call Release() on the IWritableAddressRef when you're done with it. | |
bool | IsWildcardAddress () const override |
Static Public Member Functions | |
static bool | IsValid (const IAddress &address) |
static bool | IsSameAddress (const IAddress &lhs, const IAddress &rhs) |
CAddress | ( | const sockaddr & | address, | |
int | size | |||
) |
Creates a CAddress object that represents the supplied address.
CAddress | ( | const JetByteTools::Core::_tstring & | hexOrDottedIPorName, | |
IIPAddress::Port | port | |||
) |
Creates a CAddress object for an IP address from the supplied address in IPv4 dotted IP format "xxx.xxx.xxx.xxx" or IPv6 hex IP format: "ffff:ffff:ffff:ffff:ffff" or from a host name, and a port.
CAddress | ( | const JetByteTools::Core::_tstring & | hexOrDottedIPorName, | |
IIPAddress::Port | port, | |||
const IAddressType & | addressTypePreference | |||
) |
Creates a CAddress object for an IP address from the supplied address in IPv4 dotted IP format "xxx.xxx.xxx.xxx" or IPv6 hex IP format: "ffff:ffff:ffff:ffff:ffff" or from a host name, and a port. Where a host name is supplied the address selection preference can be specified if it's important to you.
CAddress | ( | const JetByteTools::Core::_tstring & | addressAsString | ) | [explicit] |
Creates a CAddress object for an IP address from the supplied address either IPv4 format: "xxx.xxx.xxx.xxx:port" or in IPv6 format: "[ffff:ffff:ffff:ffff:ffff]:port".
~CAddress | ( | ) | [override] |
void Reset | ( | ) |
void CopyFrom | ( | const sockaddr & | address, | |
int | size | |||
) |
Copies from the supplied address into this CAddress's storage.
unsigned short Family | ( | ) | const [override, virtual] |
const sockaddr & AsSockAddr | ( | ) | const [override, virtual] |
int Size | ( | ) | const [override, virtual] |
IAddressRef * GetAddressRef | ( | ) | const [override, virtual] |
Returns a reference counted view on this address, be sure to call Release() on the IAdressRef when you're done with it.
Implements IAddress.
sockaddr * GetStorage | ( | ) | [override, virtual] |
Returns a pointer to a writable area of memory, represented as a socaddr structure, that is GetSize() bytes long.
Implements IWritableAddress.
int * GetSize | ( | ) | [override, virtual] |
Returns a writable integer that contains the size of storage (in bytes) available for the address. You can then use the writable pointer to update this value to the amount of storage actually used. Typically one would copy the address into the memory returned by GetStorage() and then update the size used to the correct value by writing to the value returned from this function. Note that GetSize() will always return the maximum available storage, if you need to know the storage used then call IAddress.Size(). Calling GetSize() resets the size used to the maximum size available. Bleugh, but written so that this works: getsockname(socket, address.GetStorage(), address.GetSize())
.
Implements IWritableAddress.
IWritableAddressRef * GetWritableAddressRef | ( | ) | const [override, virtual] |
Returns a reference counted view on this address, be sure to call Release() on the IWritableAddressRef when you're done with it.
Implements IWritableAddress.