YAZ  5.23.1
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

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

Definition at line 98 of file comstack.h.

Referenced by ir_session(), listener(), and xml_config_bend_stop().

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

Definition at line 108 of file comstack.h.

Referenced by assoc_init_reset(), inetd_connection(), listener(), and new_session().

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

Definition at line 95 of file comstack.h.

Referenced by add_listener().

#define CS_CLIENT   0

Definition at line 77 of file comstack.h.

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

Definition at line 66 of file comstack.h.

Referenced by tcpip_connect(), tcpip_rcvconnect(), unix_connect(), and ZOOM_connection_do_io().

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

Definition at line 93 of file comstack.h.

Referenced by do_connect_host(), and yaz_url_exec().

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

Definition at line 100 of file comstack.h.

Referenced by cs_create_host2().

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

Definition at line 101 of file comstack.h.

Referenced by inetd_connection().

#define CS_DATA   4
#define CS_DISCON   2

Definition at line 67 of file comstack.h.

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

Definition at line 106 of file comstack.h.

Referenced by add_listener(), and ir_read().

#define cs_fileno (   handle)    ((handle)->iofile)
#define CS_FLAGS_BLOCKING   1
#define CS_FLAGS_DNS_NO_BLOCK   4

Definition at line 167 of file comstack.h.

Referenced by do_connect_host(), and tcpip_straddr().

#define CS_FLAGS_NUMERICHOST   2

Definition at line 166 of file comstack.h.

Referenced by tcpip_addrstr().

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

Definition at line 91 of file comstack.h.

Referenced by do_read(), ir_read(), and yaz_url_exec().

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

Definition at line 107 of file comstack.h.

Referenced by create_association().

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

Definition at line 105 of file comstack.h.

#define CS_LISTEN   3

Definition at line 68 of file comstack.h.

Referenced by tcpip_bind(), and unix_bind().

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

Definition at line 96 of file comstack.h.

Referenced by xml_config_bend_stop().

#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.

Referenced by listener().

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

Definition at line 92 of file comstack.h.

Referenced by do_read(), and ir_read().

#define CS_NONE   0

Definition at line 65 of file comstack.h.

Referenced by tcpip_type(), unix_accept(), unix_type(), and ZOOM_connection_do_io().

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

Definition at line 90 of file comstack.h.

Referenced by do_write_ex(), ir_session(), and yaz_url_exec().

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

Definition at line 94 of file comstack.h.

Referenced by yaz_url_exec(), and ZOOM_connection_do_io().

#define CS_SERVER   1

Definition at line 78 of file comstack.h.

Referenced by add_listener(), tcpip_bind(), and unix_bind().

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

Definition at line 112 of file comstack.h.

#define CS_ST_ACCEPT   5

Definition at line 59 of file comstack.h.

Referenced by tcpip_accept(), and unix_accept().

#define CS_ST_CONNECTING   6

Definition at line 60 of file comstack.h.

Referenced by tcpip_connect(), tcpip_rcvconnect(), unix_connect(), and unix_rcvconnect().

#define CS_ST_DATAXFER   4

Definition at line 58 of file comstack.h.

Referenced by tcpip_accept(), tcpip_rcvconnect(), unix_accept(), and unix_rcvconnect().

#define CS_ST_IDLE   1
#define CS_ST_INCON   2

Definition at line 56 of file comstack.h.

Referenced by cs_set_head_only(), tcpip_accept(), tcpip_listen(), unix_accept(), and unix_listen().

#define CS_ST_OUTCON   3

Definition at line 57 of file comstack.h.

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

Definition at line 109 of file comstack.h.

Referenced by cs_create_host2().

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

Definition at line 103 of file comstack.h.

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

Definition at line 110 of file comstack.h.

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

Definition at line 111 of file comstack.h.

#define CS_WANT_WRITE   2
#define CSBUFSIZE   7

Definition at line 162 of file comstack.h.

Referenced by ir_read(), and tcpip_get().

#define CSDENY   5

Definition at line 160 of file comstack.h.

Referenced by tcpip_listen().

#define CSERRORSSL   6

Definition at line 161 of file comstack.h.

Referenced by tcpip_bind(), and yaz_ssl_create().

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

Definition at line 163 of file comstack.h.

Referenced by cs_errmsg().

#define CSNODATA   3

Definition at line 158 of file comstack.h.

Referenced by tcpip_listen(), and unix_listen().

#define CSNONE   0

Definition at line 155 of file comstack.h.

Referenced by cs_errmsg().

#define CSOUTSTATE   2
#define CSWRONGBUF   4

Definition at line 159 of file comstack.h.

Referenced by tcpip_put(), and unix_put().

#define CSYSERR   1

Typedef Documentation

typedef struct comstack* COMSTACK

Definition at line 43 of file comstack.h.

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

Definition at line 44 of file comstack.h.

Function Documentation

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

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

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

COMSTACK cs_create_host2 ( const char *  vhost,
int  blocking,
void **  vp,
const char *  proxy_host,
int *  proxy_mode 
)
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().

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

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

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

Definition at line 1655 of file tcpip.c.

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

Referenced by get_cert().

void* cs_get_ssl ( COMSTACK  cs)

Definition at line 1623 of file tcpip.c.

int cs_look ( COMSTACK  )

Definition at line 257 of file comstack.c.

References comstack::event.

Referenced by ZOOM_connection_do_io().

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

void cs_print_session_info ( COMSTACK  cs)

Definition at line 1581 of file tcpip.c.

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

int cs_set_head_only ( COMSTACK  cs,
int  head_only 
)
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().

int cs_set_ssl_certificate_file ( COMSTACK  cs,
const char *  fname 
)

Definition at line 1641 of file tcpip.c.

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

Referenced by add_listener().

int cs_set_ssl_ctx ( COMSTACK  cs,
void *  ctx 
)

Definition at line 1629 of file tcpip.c.

References ssl_type(), and comstack::type.

const char* cs_strerror ( COMSTACK  h)

Definition at line 43 of file comstack.c.

References comstack::cerrno, and cs_errmsg().

Referenced by add_listener().