#include <unixsocket.hh>
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 This & | dummy () |
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 |
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.
|
type for filenames |
|
socket address type (sockaddr structure) |
|
|
|
|
|
A dummy constructor for a dummy static object |
|
|
|
The default constructor, opens only a socket |
|
The normal constructor
|
|
|
|
|
|
bind primitive
|
|
|
|
connect primitive
|
|
accessor to dummy static object
|
|
Internal utility function used by constructors. |
|
|
|
|
|
comparating operator, needed for creating a socket set
|
|
|
|
receive primitive, receives a packet
|
|
send primitive, sends a packet, deprected because of using SOCK_DGRAM
|
|
|
|
|
|
a static dummy object
|
|
the socket file descriptor
|
|
|