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