CAddress Class Reference
[Addresses]

Inheritance diagram for CAddress:

Inheritance graph
[legend]
Collaboration diagram for CAddress:

Collaboration graph
[legend]

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, const int size)
 Creates a CAddress object that represents the supplied address.
 CAddress (const JetByteTools::Win32::_tstring &hexOrDottedIPorName, const 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::Win32::_tstring &hexOrDottedIPorName, const 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::Win32::_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 ()
CAddressoperator= (const CAddress &rhs)
void CopyFrom (const sockaddr &address, const int size)
 Copies from the supplied address into this CAddress's storage.
virtual short Family () const
 Returns the address family of the address.
virtual const sockaddr & AsSockAddr () const
 Returns the address as a reference to a sockaddr structure.
virtual int Size () const
 Returns the size of the sockaddr structure required to store the address.
virtual IAddressRefGetAddressRef () const
 Returns a reference counted view on this address, be sure to call Release() on the IAdressRef when you're done with it.
virtual sockaddr * GetStorage ()
 Returns a pointer to a writable area of memory, represented as a socaddr structure, that is GetSize() bytes long.
virtual int * GetSize ()
 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()).
virtual
IWritableAddressRef
GetWritableAddressRef () const
 Returns a reference counted view on this address, be sure to call Release() on the IWritableAddressRef when you're done with it.

Constructor & Destructor Documentation

CAddress (  ) 

Creates an empty instance of a CAddress object that doesn't contain any address.

CAddress ( const sockaddr &  address,
const int  size 
)

Creates a CAddress object that represents the supplied address.

CAddress ( const JetByteTools::Win32::_tstring hexOrDottedIPorName,
const 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::Win32::_tstring hexOrDottedIPorName,
const 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::Win32::_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 (  ) 


Member Function Documentation

CAddress & operator= ( const CAddress rhs  ) 

void CopyFrom ( const sockaddr &  address,
const int  size 
)

Copies from the supplied address into this CAddress's storage.

short Family (  )  const [virtual]

Returns the address family of the address.

Implements IAddress.

const sockaddr & AsSockAddr (  )  const [virtual]

Returns the address as a reference to a sockaddr structure.

Implements IAddress.

int Size (  )  const [virtual]

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

Implements IAddress.

IAddressRef * GetAddressRef (  )  const [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 (  )  [virtual]

Returns a pointer to a writable area of memory, represented as a socaddr structure, that is GetSize() bytes long.

Implements IWritableAddress.

int * GetSize (  )  [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 [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.


Generated on Mon Sep 7 14:09:16 2009 for JetByte Socket Tools - v6.1 by  doxygen 1.5.3