|
YAZ 5.38.1
|
Implements UNIX domain socket COMSTACK. More...
#include <yaz/yconfig.h>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <errno.h>#include <time.h>#include <fcntl.h>#include <signal.h>#include <grp.h>#include <yaz/unix.h>#include <yaz/log.h>#include <yaz/snprintf.h>#include "comstack-p.h"Go to the source code of this file.
Data Structures | |
| struct | unix_state |
Macros | |
| #define | YAZ_SOCKLEN_T int |
| #define | SUN_LEN(ptr) |
| #define | CS_UNIX_BUFCHUNK 4096 |
Typedefs | |
| typedef struct unix_state | unix_state |
Functions | |
| static void | unix_close (COMSTACK h) |
| static int | unix_put (COMSTACK h, char *buf, int size) |
| static int | unix_get (COMSTACK h, char **buf, int *bufsize) |
| static int | unix_connect (COMSTACK h, void *address) |
| static int | unix_more (COMSTACK h) |
| static int | unix_rcvconnect (COMSTACK h) |
| static int | unix_bind (COMSTACK h, void *address, int mode) |
| static int | unix_listen (COMSTACK h, char *raddr, int *addrlen, int(*check_ip)(void *cd, const char *a, int len, int type), void *cd) |
| static int | unix_set_blocking (COMSTACK p, int blocking) |
| static COMSTACK | unix_accept (COMSTACK h) |
| static const char * | unix_addrstr (COMSTACK h) |
| static void * | unix_straddr (COMSTACK h, const char *str) |
| static void | unix_init (void) |
| static void | cs_set_error (COMSTACK cs, int error) |
| COMSTACK | unix_type (int s, int flags, int protocol, void *vp) |
| static int | unix_strtoaddr_ex (const char *str, struct sockaddr_un *add) |
| static void * | unix_straddr1 (COMSTACK h, const char *str, char *f) |
| struct sockaddr_un * | unix_strtoaddr (const char *str) |
| int | yaz_unix_set_head_only (COMSTACK cs, int head_only) |
Variables | |
| static int | log_level = 0 |
| #define CS_UNIX_BUFCHUNK 4096 |
Definition at line 585 of file unix.c.
Referenced by unix_get().
| #define SUN_LEN | ( | ptr | ) |
Definition at line 73 of file unix.c.
Referenced by unix_bind(), and unix_connect().
| typedef struct unix_state unix_state |
|
static |
Definition at line 106 of file unix.c.
References comstack::cerrno, and cs_set_error().
Definition at line 515 of file unix.c.
References unix_state::addr, unix_state::altbuf, unix_state::altlen, unix_state::altsize, unix_state::complete, comstack::cprivate, CS_DATA, CS_FLAGS_BLOCKING, CS_NONE, cs_set_error(), CS_ST_ACCEPT, CS_ST_DATAXFER, CS_ST_IDLE, CS_ST_INCON, CSOUTSTATE, CSYSERR, comstack::event, comstack::flags, comstack::io_pending, comstack::iofile, log_level, comstack::newfd, comstack::state, unix_state::towrite, unix_accept(), unix_state::written, xfree, xmalloc, and yaz_log().
Referenced by unix_accept(), and unix_type().
|
static |
Definition at line 775 of file unix.c.
References unix_state::addr, unix_state::buf, comstack::cprivate, unix_addrstr(), and yaz_snprintf().
Referenced by unix_addrstr(), and unix_type().
|
static |
Definition at line 405 of file unix.c.
References comstack::cprivate, CS_LISTEN, CS_SERVER, cs_set_error(), CS_ST_IDLE, CSYSERR, comstack::event, unix_state::gid, comstack::iofile, log_level, comstack::state, SUN_LEN, unix_state::uid, unix_state::umask, unix_bind(), yaz_errno(), yaz_log(), and yaz_set_errno().
Referenced by unix_bind(), and unix_type().
|
static |
Definition at line 760 of file unix.c.
References unix_state::altbuf, comstack::cprivate, comstack::iofile, log_level, unix_close(), xfree, and yaz_log().
Referenced by unix_close(), and unix_type().
|
static |
Definition at line 337 of file unix.c.
References CS_CONNECT, cs_set_error(), CS_ST_CONNECTING, CS_ST_UNBND, CS_WANT_WRITE, CSOUTSTATE, CSYSERR, comstack::event, comstack::io_pending, comstack::iofile, log_level, comstack::state, SUN_LEN, unix_connect(), unix_rcvconnect(), yaz_errno(), and yaz_log().
Referenced by unix_connect(), and unix_type().
|
static |
Definition at line 591 of file unix.c.
References unix_state::altbuf, unix_state::altlen, unix_state::altsize, unix_state::complete, comstack::cprivate, cs_set_error(), CS_UNIX_BUFCHUNK, CS_WANT_READ, CSBUFSIZE, CSPROTERR, CSYSERR, comstack::io_pending, comstack::iofile, log_level, comstack::max_recv_bytes, unix_get(), xmalloc, xrealloc, yaz_errno(), and yaz_log().
Referenced by unix_get(), and unix_type().
|
static |
Definition at line 96 of file unix.c.
References log_level, unix_init(), and yaz_log_module_level().
Referenced by unix_init(), unix_strtoaddr_ex(), and unix_type().
|
static |
Definition at line 478 of file unix.c.
References cs_set_error(), CS_ST_IDLE, CS_ST_INCON, CSNODATA, CSOUTSTATE, CSYSERR, comstack::iofile, log_level, comstack::newfd, comstack::state, unix_listen(), yaz_errno(), yaz_log(), and YAZ_SOCKLEN_T.
Referenced by unix_listen(), and unix_type().
|
static |
Definition at line 325 of file unix.c.
References unix_state::altbuf, unix_state::altlen, unix_state::complete, comstack::cprivate, and unix_more().
Referenced by unix_more(), and unix_type().
|
static |
Definition at line 705 of file unix.c.
References unix_state::buf, comstack::cprivate, CS_DATA, cs_set_error(), CS_WANT_WRITE, CSWRONGBUF, CSYSERR, comstack::event, comstack::io_pending, comstack::iofile, log_level, unix_state::towrite, unix_put(), unix_state::written, yaz_errno(), and yaz_log().
Referenced by unix_put(), and unix_type().
|
static |
Definition at line 389 of file unix.c.
References CS_DATA, cs_set_error(), CS_ST_CONNECTING, CS_ST_DATAXFER, CSOUTSTATE, comstack::event, log_level, comstack::state, unix_rcvconnect(), and yaz_log().
Referenced by unix_connect(), unix_rcvconnect(), and unix_type().
|
static |
Definition at line 782 of file unix.c.
References CS_FLAGS_BLOCKING, comstack::flags, comstack::iofile, and unix_set_blocking().
Referenced by unix_set_blocking(), and unix_type().
|
static |
Definition at line 294 of file unix.c.
References unix_straddr(), unix_straddr1(), xfree, and xstrdup.
Referenced by unix_straddr(), and unix_type().
|
static |
Definition at line 197 of file unix.c.
References unix_state::addr, comstack::cprivate, unix_state::gid, log_level, unix_state::uid, unix_state::umask, unix_straddr1(), unix_strtoaddr_ex(), and yaz_log().
Referenced by unix_straddr(), and unix_straddr1().
| struct sockaddr_un * unix_strtoaddr | ( | const char * | str | ) |
Definition at line 302 of file unix.c.
References log_level, unix_strtoaddr(), unix_strtoaddr_ex(), and yaz_log().
Referenced by unix_strtoaddr().
|
static |
Definition at line 182 of file unix.c.
References log_level, unix_init(), unix_strtoaddr_ex(), and yaz_log().
Referenced by unix_straddr1(), unix_strtoaddr(), and unix_strtoaddr_ex().
| COMSTACK unix_type | ( | int | s, |
| int | flags, | ||
| int | protocol, | ||
| void * | vp ) |
Definition at line 115 of file unix.c.
References unix_state::altbuf, unix_state::altlen, unix_state::altsize, comstack::cerrno, unix_state::complete, comstack::cprivate, cs_complete_auto(), CS_FLAGS_BLOCKING, CS_NONE, CS_ST_IDLE, CS_ST_UNBND, comstack::event, comstack::f_accept, comstack::f_addrstr, comstack::f_bind, comstack::f_close, comstack::f_connect, comstack::f_get, comstack::f_listen, comstack::f_more, comstack::f_put, comstack::f_rcvconnect, comstack::f_set_blocking, comstack::f_straddr, comstack::flags, comstack::io_pending, comstack::iofile, log_level, comstack::max_recv_bytes, comstack::protocol, comstack::state, unix_state::towrite, comstack::type, unix_accept(), unix_addrstr(), unix_bind(), unix_close(), unix_connect(), unix_get(), unix_init(), unix_listen(), unix_more(), unix_put(), unix_rcvconnect(), unix_set_blocking(), unix_straddr(), unix_type(), comstack::user, unix_state::written, xmalloc, and yaz_log().
Referenced by cs_parse_host(), cs_set_head_only(), unix_type(), and yaz_unix_set_head_only().
| int yaz_unix_set_head_only | ( | COMSTACK | cs, |
| int | head_only ) |
Definition at line 313 of file unix.c.
References comstack::cerrno, unix_state::complete, comstack::cprivate, cs_complete_auto(), cs_complete_auto_head(), CSOUTSTATE, comstack::type, unix_type(), and yaz_unix_set_head_only().
Referenced by cs_set_head_only(), and yaz_unix_set_head_only().