Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

olsr::sys::UnixSocket Class Reference

Unix socket (SOCK_DGRAM only) implementation. More...

#include <unixsocket.hh>

List of all members.

Public Types

typedef ::sockaddr_un sockaddr_t
typedef std::string path_t

Public Member Functions

 UnixSocket ()
 UnixSocket (const path_t &fname)
virtual ~UnixSocket ()
void bind (const path_t &fname)
void listen ()
void connect (const path_t &fname)
This accept (path_t &fname)
void close ()
utl::Data receive () const
bool send (const utl::ConstData &d, int flags=0) const
sch::IOEvent::p_t read_p () const
sch::IOEvent::p_t write_p () const
bool operator< (const This &rhs) const

Static Public Member Functions

static const Thisdummy ()
static void lock ()

Private Types

typedef UnixSocket This
enum  _dummy_values { _dummy_val }

Private Member Functions

 UnixSocket (_dummy_values)
 UnixSocket (int fd)
void init ()

Private Attributes

int _fd
 the socket file descriptor
bool _bound

Static Private Attributes

static bool _locked = 0
static This _dummy
 a static dummy object


Detailed Description

Unix socket (SOCK_DGRAM only) implementation.

Here's an high-level implementation of unix sockets, for Qolyester's needs; only UDP is allowed (SOCK_DGRAM), and some special socket options may be not available. Anyway, migrating to TCP sockets is a piece of cake (c) : all TCP-only primitives are already here.


Member Typedef Documentation

typedef std::string olsr::sys::UnixSocket::path_t
 

type for filenames

typedef struct ::sockaddr_un olsr::sys::UnixSocket::sockaddr_t
 

socket address type (sockaddr structure)

typedef UnixSocket olsr::sys::UnixSocket::This [private]
 


Member Enumeration Documentation

enum olsr::sys::UnixSocket::_dummy_values [private]
 

Enumeration values:
_dummy_val 


Constructor & Destructor Documentation

olsr::sys::UnixSocket::UnixSocket _dummy_values   )  [private]
 

A dummy constructor for a dummy static object

olsr::sys::UnixSocket::UnixSocket int  fd  )  [explicit, private]
 

olsr::sys::UnixSocket::UnixSocket  ) 
 

The default constructor, opens only a socket

olsr::sys::UnixSocket::UnixSocket const path_t fname  ) 
 

The normal constructor

  • fname filename to bind to

olsr::sys::UnixSocket::~UnixSocket  )  [virtual]
 


Member Function Documentation

UnixSocket olsr::sys::UnixSocket::accept path_t fname  ) 
 

void olsr::sys::UnixSocket::bind const path_t fname  ) 
 

bind primitive

  • fname the filename to bind to

void olsr::sys::UnixSocket::close  ) 
 

void olsr::sys::UnixSocket::connect const path_t fname  ) 
 

connect primitive

  • fname the filename to connect to

static const This& olsr::sys::UnixSocket::dummy  )  [inline, static]
 

accessor to dummy static object

Returns:
a dummy socket

void olsr::sys::UnixSocket::init  )  [private]
 

Internal utility function used by constructors.

void olsr::sys::UnixSocket::listen  ) 
 

static void olsr::sys::UnixSocket::lock  )  [inline, static]
 

bool olsr::sys::UnixSocket::operator< const This rhs  )  const
 

comparating operator, needed for creating a socket set

  • rhs the other operand
    Returns:
    if rhs > this object

sch::IOEvent::p_t olsr::sys::UnixSocket::read_p  )  const
 

utl::Data olsr::sys::UnixSocket::receive  )  const
 

receive primitive, receives a packet

  • sender returned parameter : source address (filename)
    Returns:
    all the data received

bool olsr::sys::UnixSocket::send const utl::ConstData d,
int  flags = 0
const
 

send primitive, sends a packet, deprected because of using SOCK_DGRAM

  • d the data to send

sch::IOEvent::p_t olsr::sys::UnixSocket::write_p  )  const
 


Member Data Documentation

bool olsr::sys::UnixSocket::_bound [private]
 

This olsr::sys::UnixSocket::_dummy [static, private]
 

a static dummy object

int olsr::sys::UnixSocket::_fd [private]
 

the socket file descriptor

bool olsr::sys::UnixSocket::_locked = 0 [static, private]
 


The documentation for this class was generated from the following files:
Generated on Thu Jul 28 21:21:51 2005 for Qolyester daemon by  doxygen 1.4.1