2 * Copyright (c) 1995-2001, Index Data
3 * See the file LICENSE for details.
6 * Revision 1.9 2001-10-22 13:57:24 adam
7 * Implemented cs_rcvconnect and cs_look as described in the documentation.
9 * Revision 1.8 2001/07/19 19:49:02 adam
10 * Added include of string.h.
12 * Revision 1.7 2001/03/21 12:43:36 adam
13 * Implemented cs_create_host. Better error reporting for SSL comstack.
15 * Revision 1.6 1999/11/30 13:47:11 adam
16 * Improved installation. Moved header files to include/yaz.
18 * Revision 1.5 1998/06/22 11:32:35 adam
19 * Added 'conditional cs_listen' feature.
21 * Revision 1.4 1997/09/29 07:16:14 adam
22 * Array cs_errlist no longer global.
24 * Revision 1.3 1997/09/01 08:49:14 adam
25 * New windows NT/95 port using MSV5.0. Minor changes only.
27 * Revision 1.2 1995/09/29 17:01:48 quinn
30 * Revision 1.1 1995/06/14 09:58:20 quinn
31 * Renamed yazlib to comstack.
33 * Revision 1.2 1995/05/16 08:51:15 quinn
34 * License, documentation, and memory fixes
36 * Revision 1.1 1995/03/14 10:28:34 quinn
37 * Adding server-side support to tcpip.c and fixing bugs in nonblocking I/O
43 #include <yaz/comstack.h>
44 #include <yaz/tcpip.h>
46 static const char *cs_errlist[] =
48 "No error or unspecified error",
49 "System (lower-layer) error",
50 "Operation out of state",
51 "No data (operation would block)",
52 "New data while half of old buffer is on the line (flow control)",
57 const char *cs_errmsg(int n)
64 const char *cs_strerror(COMSTACK h)
66 return cs_errmsg(h->cerrno);
69 COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp)
75 if (strncmp (type_and_host, "tcp:", 4) == 0)
78 host = type_and_host + 4;
80 else if (strncmp (type_and_host, "ssl:", 4) == 0)
82 #if HAVE_OPENSSL_SSL_H
84 host = type_and_host + 4;
95 cs = cs_create (t, blocking, PROTO_Z3950);
99 if (!(*vp = cs_straddr(cs, host)))
107 int cs_look (COMSTACK cs)