2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1995-04-20 15:12:44 quinn
10 * Revision 1.2 1995/04/17 11:28:17 quinn
13 * Revision 1.1 1995/03/30 09:39:40 quinn
14 * Moved .h files to include directory
16 * Revision 1.11 1995/03/27 08:36:05 quinn
17 * Some work on nonblocking operation in xmosi.c and rfct.c.
18 * Added protocol parameter to cs_create()
20 * Revision 1.10 1995/03/20 09:47:12 quinn
21 * Added server-side support to xmosi.c
22 * Fixed possible problems in rfct
25 * Revision 1.9 1995/03/15 15:36:27 quinn
26 * Mods to support nonblocking I/O
28 * Revision 1.8 1995/03/14 17:00:07 quinn
29 * Bug-fixes - added tracing info to tcpip.c
31 * Revision 1.7 1995/03/14 10:28:35 quinn
32 * Adding server-side support to tcpip.c and fixing bugs in nonblocking I/O
34 * Revision 1.6 1995/03/07 16:29:45 quinn
37 * Revision 1.5 1995/03/07 10:39:31 quinn
40 * Revision 1.4 1995/03/06 16:49:29 adam
41 * COMSTACK type inspection possible with cs_type.
43 * Revision 1.3 1995/02/14 11:54:48 quinn
44 * Beginning to add full CCL.
46 * Revision 1.2 1995/02/10 18:58:10 quinn
47 * Fixed tcpip_get (formerly tcpip_read).
48 * Turned tst (cli) into a proper, event-driven thing.
50 * Revision 1.1 1995/02/09 15:51:51 quinn
60 #define COMSTACK_DEFAULT_TIMEOUT -1
63 typedef struct comstack *COMSTACK;
64 typedef COMSTACK (*CS_TYPE)(int blocking, int protocol);
69 int errno; /* current error code of this stack */
70 char *stackerr;/* current lower-layer error string, or null if none */
71 int iofile; /* UNIX file descriptor for iochannel */
72 int timeout; /* how long to wait for trailing blocks */
73 void *private; /* state info for lower stack */
74 int more; /* connection has extra data in buffer */
75 int state; /* current state */
81 int newfd; /* storing new descriptor between listen and accept */
82 int blocking; /* is this link (supposed to be) blocking? */
83 int event; /* current event */
89 int protocol; /* what application protocol are we talking? */
92 int (*f_look)(COMSTACK handle);
93 int (*f_put)(COMSTACK handle, char *buf, int size);
94 int (*f_get)(COMSTACK handle, char **buf, int *bufsize);
95 int (*f_more)(COMSTACK handle);
96 int (*f_connect)(COMSTACK handle, void *address);
97 int (*f_rcvconnect)(COMSTACK handle);
98 int (*f_bind)(COMSTACK handle, void *address, int mode);
101 int (*f_listen)(COMSTACK handle, char *addrp, int *addrlen);
102 COMSTACK (*f_accept)(COMSTACK handle);
103 int (*f_close)(COMSTACK handle);
106 #define cs_put(handle, buf, size) ((*(handle)->f_put)(handle, buf, size))
107 #define cs_get(handle, buf, size) ((*(handle)->f_get)(handle, buf, size))
108 #define cs_more(handle) ((*(handle)->f_more)(handle))
109 #define cs_connect(handle, address) ((*(handle)->f_connect)(handle, address))
110 #define cs_rcvconnect(handle) ((*(handle)->f_rcvconnect)(handle))
111 #define cs_bind(handle, ad, mo) ((*(handle)->f_bind)(handle, ad, mo))
112 #define cs_listen(handle, ap, al) ((*(handle)->f_listen)(handle, ap, al))
113 #define cs_accept(handle) ((*(handle)->f_accept)(handle))
114 #define cs_close(handle) ((*(handle)->f_close)(handle))
115 #define cs_create(type, blocking, proto) ((*type)(blocking, proto))
116 #define cs_type(handle) ((handle)->type)
117 #define cs_fileno(handle) ((handle)->iofile)
118 #define cs_stackerr(handle) ((handle)->stackerr)
119 #define cs_getstate(handle) ((handle)->getstate)
120 #define cs_errno(handle) ((handle)->errno)
121 #define cs_getproto(handle) ((handle)->protocol)
123 const char *cs_strerror(COMSTACK h);
135 extern char *cs_errlist[];