X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fcomstack.h;h=3aa3abd622a77bffa99591de9f0f9624da7d5aa8;hp=3307a912ef1765dd11b18981d62cd540061566ee;hb=90636015fbde45fc0c2d35368ab7a32b23041cd5;hpb=019eca69c2a438db0aea7b8760685c618cb5f552 diff --git a/include/yaz/comstack.h b/include/yaz/comstack.h index 3307a91..3aa3abd 100644 --- a/include/yaz/comstack.h +++ b/include/yaz/comstack.h @@ -1,5 +1,5 @@ -/* - * Copyright (c) 1995-2007, Index Data +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2013 Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -24,9 +24,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: comstack.h,v 1.28 2007-10-05 16:46:55 adam Exp $ */ -/** +/** * \file comstack.h * \brief Header for COMSTACK */ @@ -40,8 +39,6 @@ YAZ_BEGIN_CDECL -#define COMSTACK_DEFAULT_TIMEOUT -1 /* not used yet */ - struct comstack; typedef struct comstack *COMSTACK; typedef COMSTACK (*CS_TYPE)(int s, int flags, int protocol, void *vp); @@ -50,9 +47,7 @@ struct comstack { CS_TYPE type; int cerrno; /* current error code of this stack */ - char *stackerr;/* current lower-layer error string, or null if none */ int iofile; /* UNIX file descriptor for iochannel */ - int timeout; /* how long to wait for trailing blocks (ignored for now) */ void *cprivate;/* state info for lower stack */ int max_recv_bytes; /* max size of incoming package */ int state; /* current state */ @@ -85,8 +80,8 @@ struct comstack int (*check_ip)(void *cd, const char *a, int len, int type), void *cd); COMSTACK (*f_accept)(COMSTACK handle); - int (*f_close)(COMSTACK handle); - char *(*f_addrstr)(COMSTACK handle); + void (*f_close)(COMSTACK handle); + const char *(*f_addrstr)(COMSTACK handle); void *(*f_straddr)(COMSTACK handle, const char *str); int (*f_set_blocking)(COMSTACK handle, int blocking); void *user; /* user defined data associated with COMSTACK */ @@ -107,7 +102,6 @@ struct comstack ((*type)(sock, blocking, proto, 0)) #define cs_type(handle) ((handle)->type) #define cs_fileno(handle) ((handle)->iofile) -#define cs_stackerr(handle) ((handle)->stackerr) #define cs_getstate(handle) ((handle)->getstate) #define cs_errno(handle) ((handle)->cerrno) #define cs_getproto(handle) ((handle)->protocol) @@ -116,30 +110,37 @@ struct comstack #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 YAZ_EXPORT int cs_look (COMSTACK); YAZ_EXPORT const char *cs_strerror(COMSTACK h); YAZ_EXPORT const char *cs_errmsg(int n); -YAZ_EXPORT COMSTACK cs_create_host(const char *type_and_host, +YAZ_EXPORT COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp); + +YAZ_EXPORT COMSTACK cs_create_host_proxy(const char *vhost, + int blocking, void **vp, + const char *proxy_host); YAZ_EXPORT void cs_get_host_args(const char *type_and_host, const char **args); -YAZ_EXPORT int cs_complete_auto(const unsigned char *buf, int len); +YAZ_EXPORT int cs_complete_auto_head(const char *buf, int len); +YAZ_EXPORT int cs_complete_auto(const char *buf, int len); YAZ_EXPORT void *cs_get_ssl(COMSTACK cs); YAZ_EXPORT int cs_set_ssl_ctx(COMSTACK cs, void *ctx); YAZ_EXPORT int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname); YAZ_EXPORT int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len); YAZ_EXPORT void cs_set_max_recv_bytes(COMSTACK cs, int max_recv_bytes); -YAZ_EXPORT int cs_complete_http(const char *buf, int len); +YAZ_EXPORT void cs_print_session_info(COMSTACK cs); + YAZ_EXPORT int cs_parse_host(const char *uri, const char **host, - CS_TYPE *t, enum oid_proto *proto); - + CS_TYPE *t, enum oid_proto *proto, + char **connect_host); + /* * error management. */ - + #define CSNONE 0 #define CSYSERR 1 #define CSOUTSTATE 2 @@ -150,10 +151,6 @@ YAZ_EXPORT int cs_parse_host(const char *uri, const char **host, #define CSBUFSIZE 7 #define CSLASTERROR CSBUFSIZE /* must be the value of last CS error */ -/* backwards compatibility */ -#define CS_SR PROTO_SR -#define CS_Z3950 PROTO_Z3950 - #define CS_FLAGS_BLOCKING 1 #define CS_FLAGS_NUMERICHOST 2 @@ -163,6 +160,7 @@ YAZ_END_CDECL /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab