push
[NextIRCd.git] / src / struct_servermsg.h
1 /* struct_servermsg.h - NextIRCd
2  * Copyright (C) 2012-2013  Philipp Kreil (pk910)
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License 
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
16  */
17
18 #ifndef _struct_servermsg_h
19 #define _struct_servermsg_h
20
21 #define MAXSERVERTOKENLEN 5
22
23 #define SERVERMSG_TYPE_UNICAST   0x01
24 #define SERVERMSG_TYPE_MULTICAST 0x02
25 #define SERVERMSG_TYPE_BROADCAST 0x03
26 #define SERVERMSG_TYPEMASK       0x07
27 #define SERVERMSG_FLAG_ENCRYPTED 0x08
28 #define SERVERMSG_FLAGMASK       0xF8
29
30 struct ServerMsgDestination {
31         union {
32                 struct Server *server;
33                 unsigned int srvnum;
34         } destination;
35         unsigned int resolved_destination : 1;
36 };
37
38 struct ServerMsgDstMap {
39         unsigned int dstcount : 8;
40         struct ServerMsgDestination dst[1];
41 };
42
43 struct ServerMsg {
44         union {
45                 struct Server *server;
46                 unsigned int srvnum;
47         } source;
48         unsigned int resolved_source : 1;
49         
50         unsigned int msgtype      : 3;
51         unsigned int msgflags     : 8;
52         unsigned int msglen       : 16;
53         unsigned int arglen       : 16;
54         unsigned int msgttl       : 8;
55         
56         char token[MAXSERVERTOKENLEN+1];
57         
58         struct ServerMsgDstMap *destinations;
59         
60         
61         unsigned char *args;
62 };
63
64 #endif