libassa  3.5.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes
ASSA::UNIXAddress Class Reference

#include <UNIXAddress.h>

Inheritance diagram for ASSA::UNIXAddress:
ASSA::Address

List of all members.

Public Member Functions

 UNIXAddress (const char *socket_name_)
 Constructor.
 UNIXAddress (SA *socket_address_)
 Copy constructor.
virtual ~UNIXAddress ()
 Destructor.
const int getLength () const
 Retrieve address length.
SAgetAddress () const
 Retrieve underlying address structure.
- Public Member Functions inherited from ASSA::Address
 Address ()
 Constructor.
virtual ~Address ()
 Destructor.
bool good () const
 Valid address is constructed.
bool bad () const
 Indicates whether there was error during address construction process i.e.
 operator void * () const
 Conversion to void * (or bool) for testing where bool is required (in conditional statements).
bool operator! () const
 Alias to bad ().
virtual void dump ()
 Dump object state to the log file.

Private Attributes

SA_UN m_address
 UNIX socket address structure.

Additional Inherited Members

- Public Types inherited from ASSA::Address
enum  addr_state_t { goodbit = 0, badbit = 1 }
 State bits. More...
typedef int addrstate
- Protected Member Functions inherited from ASSA::Address
void setstate (addrstate flag_)
 Set state of the Address object.

Detailed Description

Definition at line 28 of file UNIXAddress.h.


Constructor & Destructor Documentation

UNIXAddress::UNIXAddress ( const char *  socket_name_)

Constructor.

Parameters:
socket_name_UNIX path name

Definition at line 22 of file UNIXAddress.cpp.

References ASSA::ASSAERR, ASSA::Address::badbit, EL, m_address, ASSA::Address::setstate(), and trace.

{
trace("UNIXAddress::UNIXAddress(char* name_)");
size_t len;
m_address.sun_family = AF_UNIX;
if ( (len = strlen(socket_name_)) > sizeof(m_address.sun_path) ) {
EL((ASSAERR,"Socket path name is too long (%d bytes)\n", len));
}
strcpy (m_address.sun_path, socket_name_);
}
UNIXAddress::UNIXAddress ( SA socket_address_)

Copy constructor.

Parameters:
socket_address_address to copy from

Definition at line 37 of file UNIXAddress.cpp.

References ASSA::ASSAERR, ASSA::Address::badbit, EL, m_address, ASSA::Address::setstate(), and trace.

{
trace("UNIXAddress::UNIXAddress(SA_UN*)");
SA_UN* sa_un = (SA_UN*) saddr_;
m_address.sun_family = AF_UNIX;
size_t len = strlen(sa_un->sun_path);
if ( len > sizeof (m_address.sun_path) - 1 ) {
EL((ASSAERR,"Socket path name is too long (%d bytes)\n", len));
}
strcpy(m_address.sun_path, sa_un->sun_path);
}
ASSA::UNIXAddress::~UNIXAddress ( )
inlinevirtual

Destructor.

Definition at line 56 of file UNIXAddress.h.

References trace.

{ trace("UNIXAddress::~UNIXAddress"); }

Member Function Documentation

SA * ASSA::UNIXAddress::getAddress ( ) const
inlinevirtual

Retrieve underlying address structure.

Implements ASSA::Address.

Definition at line 64 of file UNIXAddress.h.

References m_address.

Referenced by ASSA::ConUDPSocket::unconnect().

{ return (SA*) &m_address; }
const int ASSA::UNIXAddress::getLength ( ) const
inlinevirtual

Retrieve address length.

Implements ASSA::Address.

Definition at line 60 of file UNIXAddress.h.

References m_address.

{ return sizeof (m_address); }

Member Data Documentation

SA_UN ASSA::UNIXAddress::m_address
private

UNIX socket address structure.

Definition at line 51 of file UNIXAddress.h.

Referenced by getAddress(), getLength(), and UNIXAddress().


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