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

Implements UNIX domain socket COMSTACK. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <grp.h>
#include <yaz/unix.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 TRC(X)
 
#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 int 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)
 

Detailed Description

Implements UNIX domain socket COMSTACK.

Definition in file unix.c.

Macro Definition Documentation

#define CS_UNIX_BUFCHUNK   4096

Definition at line 552 of file unix.c.

Referenced by unix_get().

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

Definition at line 75 of file unix.c.

Referenced by unix_bind(), and unix_connect().

#define TRC (   X)
#define YAZ_SOCKLEN_T   int

Definition at line 47 of file unix.c.

Referenced by unix_listen().

Typedef Documentation

typedef struct unix_state unix_state

Function Documentation

static COMSTACK unix_accept ( COMSTACK  h)
static
static const char * unix_addrstr ( COMSTACK  h)
static

Definition at line 717 of file unix.c.

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

Referenced by unix_type().

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

Definition at line 702 of file unix.c.

References unix_state::altbuf, comstack::cprivate, comstack::iofile, TRC, and xfree.

Referenced by unix_type().

static int unix_connect ( COMSTACK  h,
void *  address 
)
static
static int unix_get ( COMSTACK  h,
char **  buf,
int *  bufsize 
)
static
static int unix_init ( void  )
static

Definition at line 101 of file unix.c.

Referenced by unix_strtoaddr_ex(), and unix_type().

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().

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
static int unix_more ( COMSTACK  h)
static

Definition at line 303 of file unix.c.

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

Referenced by unix_type().

static int unix_put ( COMSTACK  h,
char *  buf,
int  size 
)
static
static int unix_rcvconnect ( COMSTACK  h)
static
static int unix_set_blocking ( COMSTACK  p,
int  blocking 
)
static

Definition at line 725 of file unix.c.

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

Referenced by unix_type().

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

Definition at line 284 of file unix.c.

References unix_straddr1(), xfree, and xstrdup.

Referenced by unix_type().

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

Definition at line 292 of file unix.c.

References TRC, and unix_strtoaddr_ex().

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

Definition at line 176 of file unix.c.

References TRC, and unix_init().

Referenced by unix_straddr1(), and unix_strtoaddr().

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