Merge branch 'newpc92timings' of /scm/spider into newpc92timings
[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.2  2000-07-20 14:16:00  minima
12  * can use Sourceforge now!
13  * added user->qra cleaning
14  * added 4 digit qra to user broadcast dxspots if available
15  *
16  * Revision 1.1  2000/03/26 00:03:30  djk
17  * first cut of client
18  *
19  * Revision 1.7  1998/01/02 19:39:57  djk
20  * made various changes to cope with glibc
21  * fixed problem with extended status in etsi_router
22  *
23  * Revision 1.6  1997/03/25 18:12:45  djk
24  * dunno
25  *
26  * Revision 1.5  1997/03/19 09:57:54  djk
27  * added a count to check for leaks
28  *
29  * Revision 1.4  1997/02/13 17:01:55  djk
30  * forgotten?
31  *
32  * Revision 1.3  1997/01/20 22:29:23  djk
33  * added status back
34  *
35  * Revision 1.2  1997/01/13 23:34:22  djk
36  * The first working test version of smsd
37  *
38  * Revision 1.1  1997/01/03 23:41:27  djk
39  * added a general message handling module (still developing)
40  * added dump (a general debugging routine)
41  *
42  *
43  */
44
45 #ifndef _CMSG_H
46 #define _CMSG_H
47 static char _cmsg_h_rcsid[] = "$Id$";
48
49 #include <time.h>
50
51 typedef struct {
52         reft  head;                                     /* the chain on which this message is going */
53         short size;                                     /* the length of the data part of the message */
54         short sort;                                     /* the type of message (ie text, rmip, etsi) (may have reply bit set) */
55         short state;                            /* the current state of this message */
56         short reply;                            /* the (standard) reply field */
57         time_t t;                                       /* the time of arrival */
58         void (*callback)();                     /* the callback address if any */
59         void *portp;                            /* the pointer to the port it came from */
60         unsigned char *inp;                     /* the current character pointer for input */
61     unsigned char data[1];              /* the actual data of the message */
62 } cmsg_t;
63
64 #define CMSG_REPLY 0x8000
65 #define CMSG_SORTMASK (~CMSG_REPLY)
66
67 extern long cmsg_count;
68
69 cmsg_t *cmsg_new(int, int, void *);
70 void cmsg_send(reft *, cmsg_t *, void (*)());
71 void cmsg_priority_send(reft *, cmsg_t *, void (*)());
72 void cmsg_callback(cmsg_t *, int);
73 void cmsg_flush(reft *, int);
74 void cmsg_free(cmsg_t *);
75 cmsg_t *cmsg_next(reft *);
76 cmsg_t *cmsg_prev(reft *);
77 #endif