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_MANDATORY 0x80
39 extern unsigned short myseqno
;
41 extern int broadcast_ihu
;
42 extern int split_horizon
;
44 extern struct neighbour
*unicast_neighbour
;
45 extern struct timeval unicast_flush_timeout
;
47 void parse_packet(const unsigned char *from
, struct interface
*ifp
,
48 const unsigned char *packet
, int packetlen
);
49 void flushbuf(struct interface
*ifp
);
50 void flushupdates(struct interface
*ifp
);
51 void send_ack(struct neighbour
*neigh
, unsigned short nonce
,
52 unsigned short interval
);
53 void send_hello_noupdate(struct interface
*ifp
, unsigned interval
);
54 void send_hello(struct interface
*ifp
);
55 void flush_unicast(int dofree
);
56 void send_update(struct interface
*ifp
, int urgent
,
57 const unsigned char *prefix
, unsigned char plen
);
58 void send_update_resend(struct interface
*ifp
,
59 const unsigned char *prefix
, unsigned char plen
);
60 void send_wildcard_retraction(struct interface
*ifp
);
61 void update_myseqno(void);
62 void send_self_update(struct interface
*ifp
);
63 void send_ihu(struct neighbour
*neigh
, struct interface
*ifp
);
64 void send_marginal_ihu(struct interface
*ifp
);
65 void send_request(struct interface
*ifp
,
66 const unsigned char *prefix
, unsigned char plen
);
67 void send_unicast_request(struct neighbour
*neigh
,
68 const unsigned char *prefix
, unsigned char plen
);
69 void send_multihop_request(struct interface
*ifp
,
70 const unsigned char *prefix
, unsigned char plen
,
71 unsigned short seqno
, const unsigned char *id
,
72 unsigned short hop_count
);
74 send_unicast_multihop_request(struct neighbour
*neigh
,
75 const unsigned char *prefix
, unsigned char plen
,
76 unsigned short seqno
, const unsigned char *id
,
77 unsigned short hop_count
);
78 void send_request_resend(struct neighbour
*neigh
,
79 const unsigned char *prefix
, unsigned char plen
,
80 unsigned short seqno
, unsigned char *id
);
81 void handle_request(struct neighbour
*neigh
, const unsigned char *prefix
,
82 unsigned char plen
, unsigned char hop_count
,
83 unsigned short seqno
, const unsigned char *id
);