take off any trailing \r with telnet mode
[spider.git] / src / cmsg.h
1 /*
2  * cmsg.h
3  * 
4  * general purpose message format
5  * 
6  * Copyright 1996 (c) D-J Koopman
7  * 
8  * $Header$
9  * 
10  * $Log$
11  * Revision 1.1  2000-03-26 00:03:30  djk
12  * first cut of client
13  *
14  * Revision 1.7  1998/01/02 19:39:57  djk
15  * made various changes to cope with glibc
16  * fixed problem with extended status in etsi_router
17  *
18  * Revision 1.6  1997/03/25 18:12:45  djk
19  * dunno
20  *
21  * Revision 1.5  1997/03/19 09:57:54  djk
22  * added a count to check for leaks
23  *
24  * Revision 1.4  1997/02/13 17:01:55  djk
25  * forgotten?
26  *
27  * Revision 1.3  1997/01/20 22:29:23  djk
28  * added status back
29  *
30  * Revision 1.2  1997/01/13 23:34:22  djk
31  * The first working test version of smsd
32  *
33  * Revision 1.1  1997/01/03 23:41:27  djk
34  * added a general message handling module (still developing)
35  * added dump (a general debugging routine)
36  *
37  *
38  */
39
40 #ifndef _CMSG_H
41 #define _CMSG_H
42 static char _cmsg_h_rcsid[] = "$Id$";
43
44 #include <time.h>
45
46 typedef struct {
47         reft  head;                                     /* the chain on which this message is going */
48         short size;                                     /* the length of the data part of the message */
49         short sort;                                     /* the type of message (ie text, rmip, etsi) (may have reply bit set) */
50         short state;                            /* the current state of this message */
51         short reply;                            /* the (standard) reply field */
52         time_t t;                                       /* the time of arrival */
53         void (*callback)();                     /* the callback address if any */
54         void *portp;                            /* the pointer to the port it came from */
55         unsigned char *inp;                     /* the current character pointer for input */
56     unsigned char data[1];              /* the actual data of the message */
57 } cmsg_t;
58
59 #define CMSG_REPLY 0x8000
60 #define CMSG_SORTMASK (~CMSG_REPLY)
61
62 extern long cmsg_count;
63
64 cmsg_t *cmsg_new(int, int, void *);
65 void cmsg_send(reft *, cmsg_t *, void (*)());
66 void cmsg_priority_send(reft *, cmsg_t *, void (*)());
67 void cmsg_callback(cmsg_t *, int);
68 void cmsg_flush(reft *, int);
69 void cmsg_free(cmsg_t *);
70 cmsg_t *cmsg_next(reft *);
71 cmsg_t *cmsg_prev(reft *);
72 #endif