DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
Support for unixdomain sockets using sockets interface. More...
Files | |
file | unixsock.c |
Attach a thread to a unix socket start a new thread on connect. | |
Data Structures | |
struct | unixserv_sockthread |
Unix socket server data structure. More... | |
struct | unixclient_sockthread |
Unix socket client data structure. More... | |
Functions | |
struct fwsocket * | unixsocket_server (const char *sock, int protocol, int mask, socketrecv read, void *data) |
Create and run UNIX server socket thread. More... | |
struct fwsocket * | unixsocket_client (const char *sock, int protocol, socketrecv read, void *data) |
Create a client thread on the socket. More... | |
Support for unixdomain sockets using sockets interface.
A thread is started on the sockect and will start a new client thread on each connection with the socket and data reference.
struct fwsocket* unixsocket_client | ( | const char * | sock, |
int | protocol, | ||
socketrecv | read, | ||
void * | data | ||
) |
Create a client thread on the socket.
It is not recomended to use SOCK_DGRAM as it requires a socket endpoint [inode] created this is done in /tmp using the basename of the socket and 6 random chars. this file is set to have no permissions as we only need the inode.
sock | Path to UNIX socket |
protocol | Either SOCK_STREAM or SOCK_DGRAM, SOCK_STREAM is recomended. |
read | Call back to call when read is ready. |
data | Reference to data to be returned in read callback. |
Definition at line 310 of file unixsock.c.
References fwsocket::addr, fwsocket::flags, make_socket(), objref(), objunref(), fwsocket::sock, SOCK_FLAG_UNIX, strlenzero(), and sockstruct::un.
Referenced by unixsocktest().
struct fwsocket* unixsocket_server | ( | const char * | sock, |
int | protocol, | ||
int | mask, | ||
socketrecv | read, | ||
void * | data | ||
) |
Create and run UNIX server socket thread.
sock | Path to UNIX socket. |
protocol | Protocol number. |
mask | Umask for the socket. |
read | Callback to call when there is data available. |
data | Data reference to pass to read callback. |
Definition at line 277 of file unixsock.c.
References unixserv_sockthread::data, framework_mkthread(), make_socket(), unixserv_sockthread::mask, objalloc(), objref(), objunref(), unixserv_sockthread::protocol, unixserv_sockthread::read, unixserv_sockthread::sock, and unixserv_sockthread::sockpath.
Referenced by unixsocktest().