81#define CS_ST_DATAXFER 4
85#define CS_ST_CONNECTING 6
119 int (*check_ip)(
void *cd,
const char *a,
int len,
int type),
128 void *(*f_straddr)(
COMSTACK handle,
const char *str);
143#define cs_put(handle, buf, size) ((*(handle)->f_put)(handle, buf, size))
155#define cs_get(handle, buf, size) ((*(handle)->f_get)(handle, buf, size))
162#define cs_more(handle) ((*(handle)->f_more)(handle))
171#define cs_connect(handle, address) ((*(handle)->f_connect)(handle, address))
176#define cs_rcvconnect(handle) ((*(handle)->f_rcvconnect)(handle))
183#define cs_bind(handle, ad, mo) ((*(handle)->f_bind)(handle, ad, mo))
194#define cs_listen(handle, ap, al) ((*(handle)->f_listen)(handle, ap, al, 0, 0))
207#define cs_listen_check(handle, ap, al, cf, cd) ((*(handle)->f_listen)(handle, ap, al, cf, cd))
217#define cs_accept(handle) ((*(handle)->f_accept)(handle))
223#define cs_close(handle) ((*(handle)->f_close)(handle))
230#define cs_create(type, flags, proto) ((*type)(-1, flags, proto, 0))
238#define cs_createbysocket(sock, type, flags, proto) \
239 ((*type)(sock, flags, proto, 0))
243#define cs_type(handle) ((handle)->type)
247#define cs_fileno(handle) ((handle)->iofile)
253#define cs_getstate(handle) ((handle)->getstate)
258#define cs_errno(handle) ((handle)->cerrno)
262#define cs_getproto(handle) ((handle)->protocol)
270#define cs_addrstr(handle) ((*(handle)->f_addrstr)(handle))
280#define cs_straddr(handle, str) ((*(handle)->f_straddr)(handle, str))
285#define cs_want_read(handle) ((handle)->io_pending & CS_WANT_READ)
290#define cs_want_write(handle) ((handle)->io_pending & CS_WANT_WRITE)
299#define cs_set_blocking(handle,blocking) ((handle)->f_set_blocking(handle, blocking))
302#define CS_WANT_READ 1
304#define CS_WANT_WRITE 2
344 int flags,
void **vp);
358 int flags,
void **vp,
359 const char *proxy_host);
421 const char *proxy_host,
int *proxy_mode);
433YAZ_EXPORT
void cs_get_host_args(
const char *type_and_host,
const char **args);
457 __attribute__ ((deprecated))
468 __attribute__ ((deprecated))
523YAZ_EXPORT
int cs_parse_host(
const char *uri,
const char **host,
525 char **connect_host);
557#define CSLASTERROR CSPROTERR
560#define CS_FLAGS_BLOCKING 1
562#define CS_FLAGS_NUMERICHOST 2
564#define CS_FLAGS_DNS_NO_BLOCK 4
566#define CS_FLAGS_CHECK_CERT 8
int cs_get_error(COMSTACK cs, const char **details)
Returns the last COMSTACK error and optional transport details.
void cs_set_max_recv_bytes(COMSTACK cs, int max_recv_bytes)
Sets the maximum incoming message size.
COMSTACK cs_create_host2(const char *vhost, int flags, void **vp, const char *proxy_host, int *proxy_mode)
Creates an endpoint and selects direct or proxy connection handling.
int cs_complete_auto(const char *buf, int len)
Finds the length of a complete BER or HTTP message.
int cs_parse_host(const char *uri, const char **host, CS_TYPE *t, enum oid_proto *proto, char **connect_host)
Parses transport and protocol prefixes without resolving an address.
void cs_get_host_args(const char *type_and_host, const char **args)
Extracts application arguments from a host or URI specification.
int cs_look(COMSTACK cs)
Returns the last recorded event (CS_NONE, CS_CONNECT, etc.).
int cs_complete_auto_head(const char *buf, int len)
Finds the length of a BER message or HTTP headers.
const char * cs_errmsg(int n)
Returns a static message for a COMSTACK error code.
int cs_set_head_only(COMSTACK cs, int head_only)
Selects HTTP header-only framing for TCP/IP, SSL or UNIX transports.
COMSTACK cs_create_host(const char *vhost, int flags, void **vp)
Creates an endpoint from a host or URI specification.
COMSTACK cs_create_host_proxy(const char *vhost, int flags, void **vp, const char *proxy_host)
Creates an endpoint with an optional proxy.
const char * cs_strerror(COMSTACK h)
Returns a static message for the endpoint's last error.
struct comstack * COMSTACK
Communication endpoint; release with cs_close.
COMSTACK(*) CS_TYPE(int s, int flags, int protocol, void *vp)
Transport constructor and transport identity.
Header for OID basic functions.
Public endpoint state and transport dispatch table.
COMSTACK(*) f_accept(COMSTACK handle)
int(*) f_rcvconnect(COMSTACK handle)
int(*) f_bind(COMSTACK handle, void *address, int mode)
int(*) f_put(COMSTACK handle, char *buf, int size)
int(*) f_listen(COMSTACK h, char *raddr, int *addrlen, int(*check_ip)(void *cd, const char *a, int len, int type), void *cd)
int(*) f_connect(COMSTACK handle, void *address)
int(*) f_more(COMSTACK handle)
int(*) f_get(COMSTACK handle, char **buf, int *bufsize)
int(*) f_set_blocking(COMSTACK handle, int blocking)
void(*) f_close(COMSTACK handle)
int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname)
Selects certificate and private key files for a TLS endpoint.
void cs_print_session_info(COMSTACK cs)
Prints TLS peer certificate information to standard output.
int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len)
Gets a human-readable description of the first peer X.509 certificate.
int cs_set_ssl_ctx(COMSTACK cs, void *ctx)
Legacy OpenSSL context setter.
void * cs_get_ssl(COMSTACK cs)
Legacy OpenSSL session accessor.
Header for memory handling functions.
Header with fundamental macros.