Loading...
Searching...
No Matches
ASSA::UNIXAddress Class Reference

`#include <UNIXAddress.h>`

Inheritance diagram for ASSA::UNIXAddress:

## 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.
SA * | getAddress () 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() [1/2]

UNIXAddress::UNIXAddress | ( | const char * | socket_name_ | ) |

Constructor.

Parameters

  socket_name_ | UNIX path name

Definition at line 21 of file UNIXAddress.cpp.

{
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));
setstate (Address::badbit);
}
strcpy (m_address.sun_path, socket_name_);
}
trace
#define trace(s)
trace() is used to trace function call chain in C++ program.
Definition Logger.h:429
EL
#define EL(X)
A macro for writing error message to the Logger.
Definition Logger.h:285
ASSA::Address::setstate
void setstate(addrstate flag_)
Set state of the Address object.
Definition Address.h:111
ASSA::Address::badbit
@ badbit
bad state
Definition Address.h:56
ASSA::UNIXAddress::m_address
SA_UN m_address
UNIX socket address structure.
Definition UNIXAddress.h:51
ASSA::ASSAERR
@ ASSAERR
ASSA and system errors.
Definition LogMask.h:34

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

## UNIXAddress() [2/2]

UNIXAddress::UNIXAddress | ( | SA * | socket_address_ | ) |

Copy constructor.

Parameters

  socket_address_ | address to copy from

Definition at line 36 of file UNIXAddress.cpp.

{
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));
setstate (Address::badbit);
}
strcpy(m_address.sun_path, sa_un->sun_path);
}
ASSA::SA_UN
struct sockaddr_un SA_UN
Definition Address.h:44

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

## ~UNIXAddress()

ASSA::UNIXAddress::~UNIXAddress | ( |  | ) |

inline virtual

Destructor.

Definition at line 55 of file UNIXAddress.h.

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

References trace.

## Member Function Documentation

## getAddress()

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

inline virtual

Retrieve underlying address structure.

Implements ASSA::Address.

Definition at line 63 of file UNIXAddress.h.

{ return (SA*) &m_address; }
ASSA::SA
struct sockaddr SA
Definition Address.h:33

References m_address.

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

## getLength()

const int ASSA::UNIXAddress::getLength | ( |  | ) | const

inline virtual

Retrieve address length.

Implements ASSA::Address.

Definition at line 59 of file UNIXAddress.h.

{ return sizeof (m_address); }

References m_address.

## Member Data Documentation

## m_address

SA_UN ASSA::UNIXAddress::m_address

private

UNIX socket address structure.

Definition at line 51 of file UNIXAddress.h.

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

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

- UNIXAddress.h
- UNIXAddress.cpp