]> git.proxmox.com Git - mirror_frr.git/blame - babeld/message.h
Merge pull request #3502 from donaldsharp/socket_to_me_baby
[mirror_frr.git] / babeld / message.h
CommitLineData
ca10883e
DS
1/*
2Copyright (c) 2007, 2008 by Juliusz Chroboczek
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE 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
55extern unsigned short myseqno;
56
57extern int broadcast_ihu;
58extern int split_horizon;
59
60extern struct neighbour *unicast_neighbour;
61extern struct timeval unicast_flush_timeout;
62
63void parse_packet(const unsigned char *from, struct interface *ifp,
64 const unsigned char *packet, int packetlen);
65void flushbuf(struct interface *ifp);
66void flushupdates(struct interface *ifp);
67void send_ack(struct neighbour *neigh, unsigned short nonce,
68 unsigned short interval);
69void send_hello_noupdate(struct interface *ifp, unsigned interval);
70void send_hello(struct interface *ifp);
71void flush_unicast(int dofree);
72void send_update(struct interface *ifp, int urgent,
73 const unsigned char *prefix, unsigned char plen);
74void send_update_resend(struct interface *ifp,
75 const unsigned char *prefix, unsigned char plen);
76void send_wildcard_retraction(struct interface *ifp);
77void update_myseqno(void);
78void send_self_update(struct interface *ifp);
79void send_ihu(struct neighbour *neigh, struct interface *ifp);
80void send_marginal_ihu(struct interface *ifp);
81void send_request(struct interface *ifp,
82 const unsigned char *prefix, unsigned char plen);
83void send_unicast_request(struct neighbour *neigh,
84 const unsigned char *prefix, unsigned char plen);
85void 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);
89void
90send_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);
94void send_request_resend(struct neighbour *neigh,
95 const unsigned char *prefix, unsigned char plen,
96 unsigned short seqno, unsigned char *id);
97void 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