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