]>
Commit | Line | Data |
---|---|---|
ca10883e DS |
1 | /* |
2 | Copyright (c) 2007, 2008 by Juliusz Chroboczek | |
3 | ||
4 | Permission is hereby granted, free of charge, to any person obtaining a copy | |
5 | of this software and associated documentation files (the "Software"), to deal | |
6 | in the Software without restriction, including without limitation the rights | |
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
8 | copies of the Software, and to permit persons to whom the Software is | |
9 | furnished to do so, subject to the following conditions: | |
10 | ||
11 | The above copyright notice and this permission notice shall be included in | |
12 | all copies or substantial portions of the Software. | |
13 | ||
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
20 | THE SOFTWARE. | |
21 | */ | |
22 | ||
23 | #ifndef BABEL_MESSAGE_H | |
24 | #define BABEL_MESSAGE_H | |
25 | ||
26 | #include "babel_interface.h" | |
27 | ||
28 | #define MAX_BUFFERED_UPDATES 200 | |
29 | ||
30 | #define BUCKET_TOKENS_MAX 200 | |
31 | #define BUCKET_TOKENS_PER_SEC 40 | |
32 | ||
33 | /* A registry of assigned TLV and sub-TLV types is available at | |
34 | http://www.pps.univ-paris-diderot.fr/~jch/software/babel/babel-tlv-registry.text | |
35 | */ | |
36 | #define MESSAGE_PAD1 0 | |
37 | #define MESSAGE_PADN 1 | |
38 | #define MESSAGE_ACK_REQ 2 | |
39 | #define MESSAGE_ACK 3 | |
40 | #define MESSAGE_HELLO 4 | |
41 | #define MESSAGE_IHU 5 | |
42 | #define MESSAGE_ROUTER_ID 6 | |
43 | #define MESSAGE_NH 7 | |
44 | #define MESSAGE_UPDATE 8 | |
45 | #define MESSAGE_REQUEST 9 | |
46 | #define MESSAGE_MH_REQUEST 10 | |
47 | #define MESSAGE_MAX 10 | |
48 | ||
49 | /* Protocol extension through sub-TLVs. */ | |
50 | #define SUBTLV_PAD1 0 | |
51 | #define SUBTLV_PADN 1 | |
52 | #define SUBTLV_DIVERSITY 2 /* Also known as babelz. */ | |
53 | #define SUBTLV_TIMESTAMP 3 /* Used to compute RTT. */ | |
54 | ||
55 | extern unsigned short myseqno; | |
56 | ||
57 | extern int broadcast_ihu; | |
58 | extern int split_horizon; | |
59 | ||
60 | extern struct neighbour *unicast_neighbour; | |
61 | extern struct timeval unicast_flush_timeout; | |
62 | ||
63 | void parse_packet(const unsigned char *from, struct interface *ifp, | |
64 | const unsigned char *packet, int packetlen); | |
65 | void flushbuf(struct interface *ifp); | |
66 | void flushupdates(struct interface *ifp); | |
67 | void send_ack(struct neighbour *neigh, unsigned short nonce, | |
68 | unsigned short interval); | |
69 | void send_hello_noupdate(struct interface *ifp, unsigned interval); | |
70 | void send_hello(struct interface *ifp); | |
71 | void flush_unicast(int dofree); | |
72 | void send_update(struct interface *ifp, int urgent, | |
73 | const unsigned char *prefix, unsigned char plen); | |
74 | void send_update_resend(struct interface *ifp, | |
75 | const unsigned char *prefix, unsigned char plen); | |
76 | void send_wildcard_retraction(struct interface *ifp); | |
77 | void update_myseqno(void); | |
78 | void send_self_update(struct interface *ifp); | |
79 | void send_ihu(struct neighbour *neigh, struct interface *ifp); | |
80 | void send_marginal_ihu(struct interface *ifp); | |
81 | void send_request(struct interface *ifp, | |
82 | const unsigned char *prefix, unsigned char plen); | |
83 | void send_unicast_request(struct neighbour *neigh, | |
84 | const unsigned char *prefix, unsigned char plen); | |
85 | void send_multihop_request(struct interface *ifp, | |
86 | const unsigned char *prefix, unsigned char plen, | |
87 | unsigned short seqno, const unsigned char *id, | |
88 | unsigned short hop_count); | |
89 | void | |
90 | send_unicast_multihop_request(struct neighbour *neigh, | |
91 | const unsigned char *prefix, unsigned char plen, | |
92 | unsigned short seqno, const unsigned char *id, | |
93 | unsigned short hop_count); | |
94 | void send_request_resend(struct neighbour *neigh, | |
95 | const unsigned char *prefix, unsigned char plen, | |
96 | unsigned short seqno, unsigned char *id); | |
97 | void handle_request(struct neighbour *neigh, const unsigned char *prefix, | |
98 | unsigned char plen, unsigned char hop_count, | |
99 | unsigned short seqno, const unsigned char *id); | |
100 | ||
101 | #endif |