2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
5 * $Id: comstack.c,v 1.11 2003-02-14 18:49:23 adam Exp $
9 #include <yaz/comstack.h>
10 #include <yaz/tcpip.h>
13 static const char *cs_errlist[] =
15 "No error or unspecified error",
16 "System (lower-layer) error",
17 "Operation out of state",
18 "No data (operation would block)",
19 "New data while half of old buffer is on the line (flow control)",
24 const char *cs_errmsg(int n)
31 const char *cs_strerror(COMSTACK h)
33 return cs_errmsg(h->cerrno);
36 COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp)
42 if (strncmp (type_and_host, "tcp:", 4) == 0)
45 host = type_and_host + 4;
47 else if (strncmp (type_and_host, "ssl:", 4) == 0)
49 #if HAVE_OPENSSL_SSL_H
51 host = type_and_host + 4;
56 else if (strncmp (type_and_host, "unix:", 5) == 0)
60 host = type_and_host + 5;
71 cs = cs_create (t, blocking, PROTO_Z3950);
75 if (!(*vp = cs_straddr(cs, host)))
83 int cs_look (COMSTACK cs)