YAZ  5.34.0
Macros | Functions | Variables
comstack.c File Reference

Implements Generic COMSTACK functions. More...

#include <string.h>
#include <errno.h>
#include <yaz/yaz-iconv.h>
#include <yaz/log.h>
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
#include <yaz/unix.h>
#include <yaz/odr.h>
#include <yaz/matchstr.h>

Go to the source code of this file.

Macros

#define CHUNK_DEBUG   0
 

Functions

const char * cs_errmsg (int n)
 
const char * cs_strerror (COMSTACK h)
 
void cs_get_host_args (const char *type_and_host, const char **args)
 
int cs_parse_host (const char *uri, const char **host, CS_TYPE *t, enum oid_proto *proto, char **connect_host)
 
COMSTACK cs_create_host (const char *vhost, 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)
 
int cs_look (COMSTACK cs)
 
static int skip_crlf (const char *buf, int len, int *i)
 
static int cs_read_chunk (const char *buf, int i, int len)
 
static int cs_complete_http (const char *buf, int len, int head_only)
 
static int cs_complete_auto_x (const char *buf, int len, int head_only)
 
int cs_complete_auto (const char *buf, int len)
 
int cs_complete_auto_head (const char *buf, int len)
 
void cs_set_max_recv_bytes (COMSTACK cs, int max_recv_bytes)
 

Variables

static const char * cs_errlist []
 

Detailed Description

Implements Generic COMSTACK functions.

Definition in file comstack.c.

Macro Definition Documentation

◆ CHUNK_DEBUG

#define CHUNK_DEBUG   0

Definition at line 280 of file comstack.c.

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

static int cs_complete_auto_x ( const char *  buf,
int  len,
int  head_only 
)
static

Definition at line 453 of file comstack.c.

References completeBER(), and cs_complete_http().

Referenced by cs_complete_auto(), and cs_complete_auto_head().

◆ cs_complete_http()

static int cs_complete_http ( const char *  buf,
int  len,
int  head_only 
)
static

Definition at line 358 of file comstack.c.

References cs_read_chunk(), skip_crlf(), yaz_isdigit, and yaz_strncasecmp().

Referenced by cs_complete_auto_x().

◆ cs_create_host()

COMSTACK cs_create_host ( const char *  vhost,
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_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_read_chunk()

static int cs_read_chunk ( const char *  buf,
int  i,
int  len 
)
static

Definition at line 282 of file comstack.c.

References skip_crlf(), yaz_isdigit, yaz_islower, and yaz_isupper.

Referenced by cs_complete_http().

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

◆ skip_crlf()

static int skip_crlf ( const char *  buf,
int  len,
int *  i 
)
static

Definition at line 262 of file comstack.c.

Referenced by cs_complete_http(), and cs_read_chunk().

Variable Documentation

◆ cs_errlist

const char* cs_errlist[]
static
Initial value:
=
{
"No error or unspecified error",
"System (lower-layer) error",
"Operation out of state",
"No data (operation would block)",
"New data while half of old buffer is on the line (flow control)",
"Permission denied",
"SSL error",
"Too large incoming buffer"
}

Definition at line 24 of file comstack.c.

Referenced by cs_errmsg().