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