YAZ  5.34.0
Data Structures | Macros | Typedefs | Functions | Variables
unix.c File Reference

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>

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)
 
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)
 
static int unix_listen (COMSTACK h, char *raddr, int *addrlen, int(*check_ip)(void *cd, const char *a, int len, int t), void *cd)
 

Variables

static int log_level = 0
 

Detailed Description

Implements UNIX domain socket COMSTACK.

Definition in file unix.c.

Macro Definition Documentation

◆ CS_UNIX_BUFCHUNK

#define CS_UNIX_BUFCHUNK   4096

Definition at line 556 of file unix.c.

◆ SUN_LEN

#define SUN_LEN (   ptr)
Value:
((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+ strlen ((ptr)->sun_path))

Definition at line 71 of file unix.c.

◆ YAZ_SOCKLEN_T

#define YAZ_SOCKLEN_T   int

Definition at line 51 of file unix.c.

Typedef Documentation

◆ unix_state

typedef struct unix_state unix_state

Function Documentation

◆ unix_accept()

static COMSTACK unix_accept ( COMSTACK  h)
static

◆ unix_addrstr()

static const char * unix_addrstr ( COMSTACK  h)
static

Definition at line 721 of file unix.c.

References unix_state::addr, unix_state::buf, and comstack::cprivate.

Referenced by unix_type().

◆ unix_bind()

static int unix_bind ( COMSTACK  h,
void *  address,
int  mode 
)
static

◆ unix_close()

static void unix_close ( COMSTACK  h)
static

Definition at line 706 of file unix.c.

References unix_state::altbuf, comstack::cprivate, comstack::iofile, log_level, xfree, and yaz_log().

Referenced by unix_type().

◆ unix_connect()

static int unix_connect ( COMSTACK  h,
void *  address 
)
static

◆ unix_get()

static int unix_get ( COMSTACK  h,
char **  buf,
int *  bufsize 
)
static

◆ unix_init()

static void unix_init ( void  )
static

Definition at line 94 of file unix.c.

References log_level, log_level_set, and yaz_log_module_level().

Referenced by unix_strtoaddr_ex(), and unix_type().

◆ unix_listen() [1/2]

static int unix_listen ( COMSTACK  h,
char *  raddr,
int *  addrlen,
int(*)(void *cd, const char *a, int len, int t)  check_ip,
void *  cd 
)
static

◆ unix_listen() [2/2]

static int unix_listen ( COMSTACK  h,
char *  raddr,
int *  addrlen,
int(*)(void *cd, const char *a, int len, int type check_ip,
void *  cd 
)
static

Referenced by unix_type().

◆ unix_more()

static int unix_more ( COMSTACK  h)
static

Definition at line 304 of file unix.c.

References unix_state::altbuf, unix_state::altlen, unix_state::complete, and comstack::cprivate.

Referenced by unix_type().

◆ unix_put()

static int unix_put ( COMSTACK  h,
char *  buf,
int  size 
)
static

◆ unix_rcvconnect()

static int unix_rcvconnect ( COMSTACK  h)
static

◆ unix_set_blocking()

static int unix_set_blocking ( COMSTACK  p,
int  blocking 
)
static

Definition at line 729 of file unix.c.

References CS_FLAGS_BLOCKING, comstack::flags, and comstack::iofile.

Referenced by unix_type().

◆ unix_straddr()

static void * unix_straddr ( COMSTACK  h,
const char *  str 
)
static

Definition at line 285 of file unix.c.

References unix_straddr1(), xfree, and xstrdup.

Referenced by unix_type().

◆ unix_straddr1()

static void* unix_straddr1 ( COMSTACK  h,
const char *  str,
char *  f 
)
static

◆ unix_strtoaddr()

struct sockaddr_un* unix_strtoaddr ( const char *  str)

Definition at line 293 of file unix.c.

References log_level, unix_strtoaddr_ex(), and yaz_log().

◆ unix_strtoaddr_ex()

static int unix_strtoaddr_ex ( const char *  str,
struct sockaddr_un *  add 
)
static

Definition at line 173 of file unix.c.

References log_level, unix_init(), and yaz_log().

Referenced by unix_straddr1(), and unix_strtoaddr().

◆ unix_type()

COMSTACK unix_type ( int  s,
int  flags,
int  protocol,
void *  vp 
)

Variable Documentation

◆ log_level

int log_level = 0
static