YAZ  5.34.0
Data Structures | Macros | Typedefs | Functions
comstack.h File Reference

Header for COMSTACK. More...

#include <yaz/yconfig.h>
#include <yaz/oid_util.h>
#include <yaz/xmalloc.h>

Go to the source code of this file.

Data Structures

struct  comstack
 

Macros

#define CS_ST_UNBND   0
 
#define CS_ST_IDLE   1
 
#define CS_ST_INCON   2
 
#define CS_ST_OUTCON   3
 
#define CS_ST_DATAXFER   4
 
#define CS_ST_ACCEPT   5
 
#define CS_ST_CONNECTING   6
 
#define CS_NONE   0
 
#define CS_CONNECT   1
 
#define CS_DISCON   2
 
#define CS_LISTEN   3
 
#define CS_DATA   4
 
#define CS_CLIENT   0
 
#define CS_SERVER   1
 
#define cs_put(handle, buf, size)   ((*(handle)->f_put)(handle, buf, size))
 
#define cs_get(handle, buf, size)   ((*(handle)->f_get)(handle, buf, size))
 
#define cs_more(handle)   ((*(handle)->f_more)(handle))
 
#define cs_connect(handle, address)   ((*(handle)->f_connect)(handle, address))
 
#define cs_rcvconnect(handle)   ((*(handle)->f_rcvconnect)(handle))
 
#define cs_bind(handle, ad, mo)   ((*(handle)->f_bind)(handle, ad, mo))
 
#define cs_listen(handle, ap, al)   ((*(handle)->f_listen)(handle, ap, al, 0, 0))
 
#define cs_listen_check(handle, ap, al, cf, cd)   ((*(handle)->f_listen)(handle, ap, al, cf, cd))
 
#define cs_accept(handle)   ((*(handle)->f_accept)(handle))
 
#define cs_close(handle)   ((*(handle)->f_close)(handle))
 
#define cs_create(type, blocking, proto)   ((*type)(-1, blocking, proto, 0))
 
#define cs_createbysocket(sock, type, blocking, proto)    ((*type)(sock, blocking, proto, 0))
 
#define cs_type(handle)   ((handle)->type)
 
#define cs_fileno(handle)   ((handle)->iofile)
 
#define cs_getstate(handle)   ((handle)->getstate)
 
#define cs_errno(handle)   ((handle)->cerrno)
 
#define cs_getproto(handle)   ((handle)->protocol)
 
#define cs_addrstr(handle)   ((*(handle)->f_addrstr)(handle))
 
#define cs_straddr(handle, str)   ((*(handle)->f_straddr)(handle, str))
 
#define cs_want_read(handle)   ((handle)->io_pending & CS_WANT_READ)
 
#define cs_want_write(handle)   ((handle)->io_pending & CS_WANT_WRITE)
 
#define cs_set_blocking(handle, blocking)   ((handle)->f_set_blocking(handle, blocking))
 
#define CS_WANT_READ   1
 
#define CS_WANT_WRITE   2
 
#define CSNONE   0
 
#define CSYSERR   1
 
#define CSOUTSTATE   2
 
#define CSNODATA   3
 
#define CSWRONGBUF   4
 
#define CSDENY   5
 
#define CSERRORSSL   6
 
#define CSBUFSIZE   7
 
#define CSLASTERROR   CSBUFSIZE /* must be the value of last CS error */
 
#define CS_FLAGS_BLOCKING   1
 
#define CS_FLAGS_NUMERICHOST   2
 
#define CS_FLAGS_DNS_NO_BLOCK   4
 

Typedefs

typedef struct comstackCOMSTACK
 
typedef COMSTACK(* CS_TYPE) (int s, int flags, int protocol, void *vp)
 

Functions

int cs_look (COMSTACK)
 
const char * cs_strerror (COMSTACK h)
 
const char * cs_errmsg (int n)
 
COMSTACK cs_create_host (const char *type_and_host, int blocking, void **vp)
 
COMSTACK cs_create_host_proxy (const char *vhost, int blocking, void **vp, const char *proxy_host)
 
COMSTACK cs_create_host2 (const char *vhost, int blocking, void **vp, const char *proxy_host, int *proxy_mode)
 
void cs_get_host_args (const char *type_and_host, const char **args)
 
int cs_complete_auto_head (const char *buf, int len)
 
int cs_complete_auto (const char *buf, int len)
 
void * cs_get_ssl (COMSTACK cs)
 
int cs_set_ssl_ctx (COMSTACK cs, void *ctx)
 
int cs_set_ssl_certificate_file (COMSTACK cs, const char *fname)
 
int cs_get_peer_certificate_x509 (COMSTACK cs, char **buf, int *len)
 
void cs_set_max_recv_bytes (COMSTACK cs, int max_recv_bytes)
 
void cs_print_session_info (COMSTACK cs)
 
int cs_parse_host (const char *uri, const char **host, CS_TYPE *t, enum oid_proto *proto, char **connect_host)
 
int cs_set_head_only (COMSTACK cs, int head_only)
 

Detailed Description

Header for COMSTACK.

Definition in file comstack.h.

Macro Definition Documentation

◆ cs_accept

#define cs_accept (   handle)    ((*(handle)->f_accept)(handle))

Definition at line 98 of file comstack.h.

◆ cs_addrstr

#define cs_addrstr (   handle)    ((*(handle)->f_addrstr)(handle))

Definition at line 108 of file comstack.h.

◆ cs_bind

#define cs_bind (   handle,
  ad,
  mo 
)    ((*(handle)->f_bind)(handle, ad, mo))

Definition at line 95 of file comstack.h.

◆ CS_CLIENT

#define CS_CLIENT   0

Definition at line 77 of file comstack.h.

◆ cs_close

#define cs_close (   handle)    ((*(handle)->f_close)(handle))

Definition at line 99 of file comstack.h.

◆ CS_CONNECT

#define CS_CONNECT   1

Definition at line 66 of file comstack.h.

◆ cs_connect

#define cs_connect (   handle,
  address 
)    ((*(handle)->f_connect)(handle, address))

Definition at line 93 of file comstack.h.

◆ cs_create

#define cs_create (   type,
  blocking,
  proto 
)    ((*type)(-1, blocking, proto, 0))

Definition at line 100 of file comstack.h.

◆ cs_createbysocket

#define cs_createbysocket (   sock,
  type,
  blocking,
  proto 
)     ((*type)(sock, blocking, proto, 0))

Definition at line 101 of file comstack.h.

◆ CS_DATA

#define CS_DATA   4

Definition at line 69 of file comstack.h.

◆ CS_DISCON

#define CS_DISCON   2

Definition at line 67 of file comstack.h.

◆ cs_errno

#define cs_errno (   handle)    ((handle)->cerrno)

Definition at line 106 of file comstack.h.

◆ cs_fileno

#define cs_fileno (   handle)    ((handle)->iofile)

Definition at line 104 of file comstack.h.

◆ CS_FLAGS_BLOCKING

#define CS_FLAGS_BLOCKING   1

Definition at line 165 of file comstack.h.

◆ CS_FLAGS_DNS_NO_BLOCK

#define CS_FLAGS_DNS_NO_BLOCK   4

Definition at line 167 of file comstack.h.

◆ CS_FLAGS_NUMERICHOST

#define CS_FLAGS_NUMERICHOST   2

Definition at line 166 of file comstack.h.

◆ cs_get

#define cs_get (   handle,
  buf,
  size 
)    ((*(handle)->f_get)(handle, buf, size))

Definition at line 91 of file comstack.h.

◆ cs_getproto

#define cs_getproto (   handle)    ((handle)->protocol)

Definition at line 107 of file comstack.h.

◆ cs_getstate

#define cs_getstate (   handle)    ((handle)->getstate)

Definition at line 105 of file comstack.h.

◆ CS_LISTEN

#define CS_LISTEN   3

Definition at line 68 of file comstack.h.

◆ cs_listen

#define cs_listen (   handle,
  ap,
  al 
)    ((*(handle)->f_listen)(handle, ap, al, 0, 0))

Definition at line 96 of file comstack.h.

◆ cs_listen_check

#define cs_listen_check (   handle,
  ap,
  al,
  cf,
  cd 
)    ((*(handle)->f_listen)(handle, ap, al, cf, cd))

Definition at line 97 of file comstack.h.

◆ cs_more

#define cs_more (   handle)    ((*(handle)->f_more)(handle))

Definition at line 92 of file comstack.h.

◆ CS_NONE

#define CS_NONE   0

Definition at line 65 of file comstack.h.

◆ cs_put

#define cs_put (   handle,
  buf,
  size 
)    ((*(handle)->f_put)(handle, buf, size))

Definition at line 90 of file comstack.h.

◆ cs_rcvconnect

#define cs_rcvconnect (   handle)    ((*(handle)->f_rcvconnect)(handle))

Definition at line 94 of file comstack.h.

◆ CS_SERVER

#define CS_SERVER   1

Definition at line 78 of file comstack.h.

◆ cs_set_blocking

#define cs_set_blocking (   handle,
  blocking 
)    ((handle)->f_set_blocking(handle, blocking))

Definition at line 112 of file comstack.h.

◆ CS_ST_ACCEPT

#define CS_ST_ACCEPT   5

Definition at line 59 of file comstack.h.

◆ CS_ST_CONNECTING

#define CS_ST_CONNECTING   6

Definition at line 60 of file comstack.h.

◆ CS_ST_DATAXFER

#define CS_ST_DATAXFER   4

Definition at line 58 of file comstack.h.

◆ CS_ST_IDLE

#define CS_ST_IDLE   1

Definition at line 55 of file comstack.h.

◆ CS_ST_INCON

#define CS_ST_INCON   2

Definition at line 56 of file comstack.h.

◆ CS_ST_OUTCON

#define CS_ST_OUTCON   3

Definition at line 57 of file comstack.h.

◆ CS_ST_UNBND

#define CS_ST_UNBND   0

Definition at line 54 of file comstack.h.

◆ cs_straddr

#define cs_straddr (   handle,
  str 
)    ((*(handle)->f_straddr)(handle, str))

Definition at line 109 of file comstack.h.

◆ cs_type

#define cs_type (   handle)    ((handle)->type)

Definition at line 103 of file comstack.h.

◆ cs_want_read

#define cs_want_read (   handle)    ((handle)->io_pending & CS_WANT_READ)

Definition at line 110 of file comstack.h.

◆ CS_WANT_READ

#define CS_WANT_READ   1

Definition at line 114 of file comstack.h.

◆ cs_want_write

#define cs_want_write (   handle)    ((handle)->io_pending & CS_WANT_WRITE)

Definition at line 111 of file comstack.h.

◆ CS_WANT_WRITE

#define CS_WANT_WRITE   2

Definition at line 115 of file comstack.h.

◆ CSBUFSIZE

#define CSBUFSIZE   7

Definition at line 162 of file comstack.h.

◆ CSDENY

#define CSDENY   5

Definition at line 160 of file comstack.h.

◆ CSERRORSSL

#define CSERRORSSL   6

Definition at line 161 of file comstack.h.

◆ CSLASTERROR

#define CSLASTERROR   CSBUFSIZE /* must be the value of last CS error */

Definition at line 163 of file comstack.h.

◆ CSNODATA

#define CSNODATA   3

Definition at line 158 of file comstack.h.

◆ CSNONE

#define CSNONE   0

Definition at line 155 of file comstack.h.

◆ CSOUTSTATE

#define CSOUTSTATE   2

Definition at line 157 of file comstack.h.

◆ CSWRONGBUF

#define CSWRONGBUF   4

Definition at line 159 of file comstack.h.

◆ CSYSERR

#define CSYSERR   1

Definition at line 156 of file comstack.h.

Typedef Documentation

◆ COMSTACK

typedef struct comstack* COMSTACK

Definition at line 43 of file comstack.h.

◆ CS_TYPE

typedef COMSTACK(* CS_TYPE) (int s, int flags, int protocol, void *vp)

Definition at line 44 of file comstack.h.

Function Documentation

◆ cs_complete_auto()

int cs_complete_auto ( const char *  buf,
int  len 
)

Definition at line 466 of file comstack.c.

References cs_complete_auto_x().

Referenced by cs_set_head_only(), tcpip_rcvconnect(), tcpip_state_create(), and unix_type().

◆ cs_complete_auto_head()

int cs_complete_auto_head ( const char *  buf,
int  len 
)

Definition at line 471 of file comstack.c.

References cs_complete_auto_x().

Referenced by cs_set_head_only(), and tcpip_rcvconnect().

◆ cs_create_host()

COMSTACK cs_create_host ( const char *  type_and_host,
int  blocking,
void **  vp 
)

Definition at line 167 of file comstack.c.

References cs_create_host_proxy().

Referenced by add_listener().

◆ cs_create_host2()

COMSTACK cs_create_host2 ( const char *  vhost,
int  blocking,
void **  vp,
const char *  proxy_host,
int *  proxy_mode 
)

◆ cs_create_host_proxy()

COMSTACK cs_create_host_proxy ( const char *  vhost,
int  blocking,
void **  vp,
const char *  proxy_host 
)

Definition at line 172 of file comstack.c.

References cs_create_host2().

Referenced by cs_create_host().

◆ cs_errmsg()

const char* cs_errmsg ( int  n)

Definition at line 36 of file comstack.c.

References cs_errlist, CSLASTERROR, and CSNONE.

Referenced by cs_strerror(), and ir_read().

◆ cs_get_host_args()

void cs_get_host_args ( const char *  type_and_host,
const char **  args 
)

Definition at line 48 of file comstack.c.

Referenced by yaz_check_location(), and ZOOM_connection_get_databases().

◆ cs_get_peer_certificate_x509()

int cs_get_peer_certificate_x509 ( COMSTACK  cs,
char **  buf,
int *  len 
)

Definition at line 1563 of file tcpip.c.

References tcpip_state::buf, comstack::cprivate, ssl_type(), comstack::type, and xstrdup.

Referenced by get_cert().

◆ cs_get_ssl()

void* cs_get_ssl ( COMSTACK  cs)

Definition at line 1531 of file tcpip.c.

◆ cs_look()

int cs_look ( COMSTACK  cs)

Definition at line 257 of file comstack.c.

References comstack::event.

Referenced by ZOOM_connection_do_io().

◆ cs_parse_host()

int cs_parse_host ( const char *  uri,
const char **  host,
CS_TYPE t,
enum oid_proto proto,
char **  connect_host 
)

Definition at line 76 of file comstack.c.

References PROTO_HTTP, PROTO_Z3950, ssl_type(), tcpip_type(), unix_type(), xfree, and xmalloc.

Referenced by cs_create_host2().

◆ cs_print_session_info()

void cs_print_session_info ( COMSTACK  cs)

Definition at line 1489 of file tcpip.c.

References comstack::cprivate, ssl_type(), and comstack::type.

◆ cs_set_head_only()

int cs_set_head_only ( COMSTACK  cs,
int  head_only 
)

◆ cs_set_max_recv_bytes()

void cs_set_max_recv_bytes ( COMSTACK  cs,
int  max_recv_bytes 
)

Definition at line 476 of file comstack.c.

References comstack::max_recv_bytes.

Referenced by control_association().

◆ cs_set_ssl_certificate_file()

int cs_set_ssl_certificate_file ( COMSTACK  cs,
const char *  fname 
)

Definition at line 1549 of file tcpip.c.

References comstack::cprivate, ssl_type(), and comstack::type.

Referenced by add_listener().

◆ cs_set_ssl_ctx()

int cs_set_ssl_ctx ( COMSTACK  cs,
void *  ctx 
)

Definition at line 1537 of file tcpip.c.

References ssl_type(), and comstack::type.

◆ cs_strerror()

const char* cs_strerror ( COMSTACK  h)

Definition at line 43 of file comstack.c.

References comstack::cerrno, and cs_errmsg().

Referenced by add_listener().