The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CAddress Class Reference
[Addresses]

Inheritance diagram for CAddress:
Collaboration diagram for CAddress:

List of all members.


Detailed Description

Essentially a smart pointer to a CAddressImpl instance.

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
CAddressoperator= (const CAddress &rhs)
CAddressoperator= (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.
IAddressRefGetAddressRef () 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()).
IWritableAddressRefGetWritableAddressRef () 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)

Constructor & Destructor Documentation

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  )  [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 ( const CAddress rhs  ) 

CAddress ( const IAddress rhs  ) 

~CAddress (  )  [override]


Member Function Documentation

CAddress & operator= ( const CAddress rhs  ) 

CAddress & operator= ( const IAddress rhs  ) 

Reimplemented from IAddress.

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]

Returns the address family of the address.

Implements IAddress.

const sockaddr & AsSockAddr (  )  const [override, virtual]

Returns the address as a reference to a sockaddr structure.

Implements IAddress.

int Size (  )  const [override, virtual]

Returns the size of the sockaddr structure required to store the address.

Implements IAddress.

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.

bool IsWildcardAddress (  )  const [override, virtual]

Implements IAddress.

bool IsValid ( const IAddress address  )  [static, inherited]

bool IsSameAddress ( const IAddress lhs,
const IAddress rhs 
) [static, inherited]


Generated on Sun Sep 12 19:10:01 2021 for The Server Framework - v7.4 by doxygen 1.5.3