1 // SPDX-License-Identifier: MIT
3 Copyright (c) 2007, 2008 by Juliusz Chroboczek
6 #ifndef BABEL_MESSAGE_H
7 #define BABEL_MESSAGE_H
9 #include "babel_interface.h"
11 #define MAX_BUFFERED_UPDATES 200
13 #define BUCKET_TOKENS_MAX 200
14 #define BUCKET_TOKENS_PER_SEC 40
16 /* A registry of assigned TLV and sub-TLV types is available at
17 http://www.pps.univ-paris-diderot.fr/~jch/software/babel/babel-tlv-registry.text
19 #define MESSAGE_PAD1 0
20 #define MESSAGE_PADN 1
21 #define MESSAGE_ACK_REQ 2
23 #define MESSAGE_HELLO 4
25 #define MESSAGE_ROUTER_ID 6
27 #define MESSAGE_UPDATE 8
28 #define MESSAGE_REQUEST 9
29 #define MESSAGE_MH_REQUEST 10
30 #define MESSAGE_MAX 10
32 /* Protocol extension through sub-TLVs. */
35 #define SUBTLV_DIVERSITY 2 /* Also known as babelz. */
36 #define SUBTLV_TIMESTAMP 3 /* Used to compute RTT. */
37 #define SUBTLV_SOURCE_PREFIX 128 /* Source-specific routing. */
38 #define SUBTLV_MANDATORY 0x80
40 extern unsigned short myseqno
;
42 extern int broadcast_ihu
;
43 extern int split_horizon
;
45 extern struct neighbour
*unicast_neighbour
;
46 extern struct timeval unicast_flush_timeout
;
48 void parse_packet(const unsigned char *from
, struct interface
*ifp
,
49 const unsigned char *packet
, int packetlen
);
50 void flushbuf(struct interface
*ifp
);
51 void flushupdates(struct interface
*ifp
);
52 void send_ack(struct neighbour
*neigh
, unsigned short nonce
,
53 unsigned short interval
);
54 void send_hello_noupdate(struct interface
*ifp
, unsigned interval
);
55 void send_hello(struct interface
*ifp
);
56 void flush_unicast(int dofree
);
57 void send_update(struct interface
*ifp
, int urgent
,
58 const unsigned char *prefix
, unsigned char plen
);
59 void send_update_resend(struct interface
*ifp
,
60 const unsigned char *prefix
, unsigned char plen
);
61 void send_wildcard_retraction(struct interface
*ifp
);
62 void update_myseqno(void);
63 void send_self_update(struct interface
*ifp
);
64 void send_ihu(struct neighbour
*neigh
, struct interface
*ifp
);
65 void send_marginal_ihu(struct interface
*ifp
);
66 void send_request(struct interface
*ifp
,
67 const unsigned char *prefix
, unsigned char plen
);
68 void send_unicast_request(struct neighbour
*neigh
,
69 const unsigned char *prefix
, unsigned char plen
);
70 void send_multihop_request(struct interface
*ifp
,
71 const unsigned char *prefix
, unsigned char plen
,
72 unsigned short seqno
, const unsigned char *id
,
73 unsigned short hop_count
);
75 send_unicast_multihop_request(struct neighbour
*neigh
,
76 const unsigned char *prefix
, unsigned char plen
,
77 unsigned short seqno
, const unsigned char *id
,
78 unsigned short hop_count
);
79 void send_request_resend(struct neighbour
*neigh
,
80 const unsigned char *prefix
, unsigned char plen
,
81 unsigned short seqno
, unsigned char *id
);
82 void handle_request(struct neighbour
*neigh
, const unsigned char *prefix
,
83 unsigned char plen
, unsigned char hop_count
,
84 unsigned short seqno
, const unsigned char *id
);