#include <unixsocket.hh>
Public Types | |
| typedef struct::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 This & | dummy () |
| static void | lock () |
Private Types | |
| enum | _dummy_values { _dummy_val } |
| typedef UnixSocket | This |
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 | |
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.
typedef UnixSocket olsr::sys::UnixSocket::This [private] |
typedef struct ::sockaddr_un olsr::sys::UnixSocket::sockaddr_t [read] |
socket address type (sockaddr structure)
| typedef std::string olsr::sys::UnixSocket::path_t |
type for filenames
enum olsr::sys::UnixSocket::_dummy_values [private] |
| olsr::sys::UnixSocket::UnixSocket | ( | _dummy_values | ) | [private] |
A dummy constructor for a dummy static object
| olsr::sys::UnixSocket::UnixSocket | ( | int | fd | ) | [inline, explicit, private] |
| olsr::sys::UnixSocket::UnixSocket | ( | ) | [inline] |
The default constructor, opens only a socket
References init().
| olsr::sys::UnixSocket::UnixSocket | ( | const path_t & | fname | ) | [inline] |
| olsr::sys::UnixSocket::~UnixSocket | ( | ) | [inline, virtual] |
| void olsr::sys::UnixSocket::bind | ( | const path_t & | fname | ) | [inline] |
bind primitive
References _bound, _fd, and UNIX_PATH_MAX.
Referenced by UnixSocket().
| void olsr::sys::UnixSocket::listen | ( | ) | [inline] |
References _fd, and UNIX_BACKLOG.
| void olsr::sys::UnixSocket::connect | ( | const path_t & | fname | ) | [inline] |
| UnixSocket olsr::sys::UnixSocket::accept | ( | path_t & | fname | ) | [inline] |
References _fd.
| utl::Data olsr::sys::UnixSocket::receive | ( | ) | const [inline] |
receive primitive, receives a packet
References _fd, olsr::utl::Data::raw(), olsr::utl::Data_< Self >::shrink_to(), olsr::utl::Data_< Self >::size(), and VIRTUAL_MTU.
| bool olsr::sys::UnixSocket::send | ( | const utl::ConstData & | d, | |
| int | flags = 0 | |||
| ) | const [inline] |
send primitive, sends a packet, deprected because of using SOCK_DGRAM
References _fd, olsr::utl::Data_< Self >::raw(), and olsr::utl::Data_< Self >::size().
| sch::IOEvent::p_t olsr::sys::UnixSocket::read_p | ( | ) | const [inline] |
References _fd.
| sch::IOEvent::p_t olsr::sys::UnixSocket::write_p | ( | ) | const [inline] |
References _fd.
| bool olsr::sys::UnixSocket::operator< | ( | const This & | rhs | ) | const [inline] |
| static const This& olsr::sys::UnixSocket::dummy | ( | ) | [inline, static] |
| static void olsr::sys::UnixSocket::lock | ( | ) | [inline, static] |
References _locked.
| void olsr::sys::UnixSocket::init | ( | ) | [inline, private] |
Internal utility function used by constructors.
Referenced by UnixSocket().
int olsr::sys::UnixSocket::_fd [private] |
bool olsr::sys::UnixSocket::_bound [private] |
bool olsr::sys::UnixSocket::_locked = 0 [static, private] |
This olsr::sys::UnixSocket::_dummy [static, private] |
1.5.6