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

CAddressImpl Class Reference
[Addresses]

Inheritance diagram for CAddressImpl:
Collaboration diagram for CAddressImpl:

List of all members.


Detailed Description

A reference counted wrapper around a SOCKADDR_STORAGE structure that knows how big the address that's stored is.


Public Member Functions

 CAddressImpl (const CAddressImpl &rhs)
CAddressImploperator= (const CAddressImpl &rhs)
void CopyFrom (const sockaddr &address, int size)
 Copies from the supplied address into this CAddressImpl's storage.
bool WeOwnOnlyReference () const
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
void AddRef () override
void Release () override
 When the last reference is released the CAddressImpl will delete itself.

Static Public Member Functions

static CAddressImplCreateAddress ()
 Creates an empty instance of a CAddressImpl object that doesn't contain any address. Remember to Release() the object when done.
static CAddressImplCreateAddress (const sockaddr &address, int size)
 Creates a CAddressImpl that represents the supplied address. Remember to Release() the object when done.
static bool IsValid (const IAddress &address)
static bool IsSameAddress (const IAddress &lhs, const IAddress &rhs)
static bool IsValid (const IAddress &address)
static bool IsSameAddress (const IAddress &lhs, const IAddress &rhs)


Constructor & Destructor Documentation

CAddressImpl ( const CAddressImpl rhs  ) 


Member Function Documentation

CAddressImpl& operator= ( const CAddressImpl rhs  ) 

CAddressImpl * CreateAddress (  )  [static]

Creates an empty instance of a CAddressImpl object that doesn't contain any address. Remember to Release() the object when done.

CAddressImpl * CreateAddress ( const sockaddr &  address,
int  size 
) [static]

Creates a CAddressImpl that represents the supplied address. Remember to Release() the object when done.

void CopyFrom ( const sockaddr &  address,
int  size 
)

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

bool WeOwnOnlyReference (  )  const

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.

void AddRef (  )  [override, virtual]

Implements IAddressRef.

void Release (  )  [override, virtual]

When the last reference is released the CAddressImpl will delete itself.

Implements IAddressRef.

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

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

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