YAZ 5.37.0
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)
#define cs_get(handle, buf, size)
#define cs_more(handle)
#define cs_connect(handle, address)
#define cs_rcvconnect(handle)
#define cs_bind(handle, ad, mo)
#define cs_listen(handle, ap, al)
#define cs_listen_check(handle, ap, al, cf, cd)
#define cs_accept(handle)
#define cs_close(handle)
#define cs_create(type, blocking, proto)
#define cs_createbysocket(sock, type, blocking, proto)
#define cs_type(handle)
#define cs_fileno(handle)
#define cs_getstate(handle)
#define cs_errno(handle)
#define cs_getproto(handle)
#define cs_addrstr(handle)
#define cs_straddr(handle, str)
#define cs_want_read(handle)
#define cs_want_write(handle)
#define cs_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)
Value:
((*(handle)->f_accept)(handle))

Definition at line 98 of file comstack.h.

Referenced by ir_session(), and listener().

◆ cs_addrstr

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

Definition at line 108 of file comstack.h.

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

◆ cs_bind

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

Definition at line 95 of file comstack.h.

Referenced by add_listener().

◆ CS_CLIENT

#define CS_CLIENT   0

Definition at line 77 of file comstack.h.

◆ cs_close

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

Definition at line 99 of file comstack.h.

Referenced by add_listener(), cs_create_host2(), do_connect_host(), ir_read(), ir_session(), listener(), tcpip_accept(), yaz_url_exec(), and ZOOM_connection_destroy().

◆ CS_CONNECT

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

◆ cs_connect

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

Definition at line 93 of file comstack.h.

Referenced by do_connect_host(), and yaz_url_exec().

◆ cs_create

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

Definition at line 100 of file comstack.h.

Referenced by cs_create_host2().

◆ cs_createbysocket

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

Definition at line 101 of file comstack.h.

Referenced by inetd_connection().

◆ CS_DATA

#define CS_DATA   4

◆ CS_DISCON

#define CS_DISCON   2

Definition at line 67 of file comstack.h.

◆ cs_errno

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

Definition at line 106 of file comstack.h.

Referenced by add_listener(), and ir_read().

◆ cs_fileno

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

Definition at line 104 of file comstack.h.

Referenced by add_listener(), inetd_connection(), new_session(), and yaz_url_exec().

◆ CS_FLAGS_BLOCKING

#define CS_FLAGS_BLOCKING   1

◆ CS_FLAGS_DNS_NO_BLOCK

#define CS_FLAGS_DNS_NO_BLOCK   4

Definition at line 167 of file comstack.h.

Referenced by do_connect_host(), and tcpip_straddr().

◆ CS_FLAGS_NUMERICHOST

#define CS_FLAGS_NUMERICHOST   2

Definition at line 166 of file comstack.h.

Referenced by tcpip_addrstr().

◆ cs_get

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

Definition at line 91 of file comstack.h.

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

◆ cs_getproto

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

Definition at line 107 of file comstack.h.

Referenced by create_association().

◆ cs_getstate

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

Definition at line 105 of file comstack.h.

◆ CS_LISTEN

#define CS_LISTEN   3

Definition at line 68 of file comstack.h.

Referenced by tcpip_bind(), and unix_bind().

◆ cs_listen

#define cs_listen ( handle,
ap,
al )
Value:
((*(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 )
Value:
((*(handle)->f_listen)(handle, ap, al, cf, cd))

Definition at line 97 of file comstack.h.

Referenced by listener().

◆ cs_more

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

Definition at line 92 of file comstack.h.

Referenced by do_read(), and ir_read().

◆ CS_NONE

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

◆ cs_put

#define cs_put ( handle,
buf,
size )
Value:
((*(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().

◆ cs_rcvconnect

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

Definition at line 94 of file comstack.h.

Referenced by yaz_url_exec(), and ZOOM_connection_do_io().

◆ CS_SERVER

#define CS_SERVER   1

Definition at line 78 of file comstack.h.

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

◆ cs_set_blocking

#define cs_set_blocking ( handle,
blocking )
Value:
((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.

Referenced by tcpip_accept(), and unix_accept().

◆ CS_ST_CONNECTING

#define CS_ST_CONNECTING   6

Definition at line 60 of file comstack.h.

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

◆ CS_ST_DATAXFER

#define CS_ST_DATAXFER   4

Definition at line 58 of file comstack.h.

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

◆ CS_ST_IDLE

#define CS_ST_IDLE   1

◆ CS_ST_INCON

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

◆ CS_ST_OUTCON

#define CS_ST_OUTCON   3

Definition at line 57 of file comstack.h.

◆ CS_ST_UNBND

#define CS_ST_UNBND   0

◆ cs_straddr

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

Definition at line 109 of file comstack.h.

Referenced by cs_create_host2().

◆ cs_type

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

Definition at line 103 of file comstack.h.

◆ CS_WANT_READ

#define CS_WANT_READ   1

◆ cs_want_read

#define cs_want_read ( handle)
Value:
((handle)->io_pending & CS_WANT_READ)
#define CS_WANT_READ
Definition comstack.h:114

Definition at line 110 of file comstack.h.

◆ CS_WANT_WRITE

◆ cs_want_write

#define cs_want_write ( handle)
Value:
((handle)->io_pending & CS_WANT_WRITE)
#define CS_WANT_WRITE
Definition comstack.h:115

Definition at line 111 of file comstack.h.

◆ CSBUFSIZE

#define CSBUFSIZE   7

Definition at line 162 of file comstack.h.

Referenced by ir_read(), and tcpip_get().

◆ CSDENY

#define CSDENY   5

Definition at line 160 of file comstack.h.

Referenced by tcpip_listen().

◆ CSERRORSSL

#define CSERRORSSL   6

Definition at line 161 of file comstack.h.

Referenced by tcpip_bind().

◆ CSLASTERROR

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

Definition at line 163 of file comstack.h.

Referenced by cs_errmsg().

◆ CSNODATA

#define CSNODATA   3

Definition at line 158 of file comstack.h.

Referenced by tcpip_listen(), and unix_listen().

◆ CSNONE

#define CSNONE   0

Definition at line 155 of file comstack.h.

Referenced by cs_errmsg().

◆ CSOUTSTATE

#define CSOUTSTATE   2

◆ CSWRONGBUF

#define CSWRONGBUF   4

Definition at line 159 of file comstack.h.

Referenced by tcpip_put(), and unix_put().

◆ CSYSERR

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 1567 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 1535 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 1493 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 1553 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 1541 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().