1 // SPDX-License-Identifier: MIT
3 Copyright (c) 2007, 2008 by Juliusz Chroboczek
6 #ifndef BABEL_NEIGHBOUR_H
7 #define BABEL_NEIGHBOUR_H
10 struct neighbour
*next
;
11 /* This is -1 when unknown, so don't make it unsigned */
13 unsigned char address
[16];
15 unsigned short txcost
;
16 struct timeval hello_time
;
17 struct timeval ihu_time
;
18 unsigned short hello_interval
; /* in centiseconds */
19 unsigned short ihu_interval
; /* in centiseconds */
20 /* Used for RTT estimation. */
21 /* Absolute time (modulo 2^32) at which the Hello was sent,
22 according to remote clock. */
23 unsigned int hello_send_us
;
24 struct timeval hello_rtt_receive_time
;
26 struct timeval rtt_time
;
27 struct interface
*ifp
;
30 extern struct neighbour
*neighs
;
32 #define FOR_ALL_NEIGHBOURS(_neigh) \
33 for(_neigh = neighs; _neigh; _neigh = _neigh->next)
35 int neighbour_valid(struct neighbour
*neigh
);
36 void flush_neighbour(struct neighbour
*neigh
);
37 struct neighbour
*find_neighbour(const unsigned char *address
,
38 struct interface
*ifp
);
39 int update_neighbour(struct neighbour
*neigh
, int hello
, int hello_interval
);
40 unsigned check_neighbours(void);
41 unsigned neighbour_txcost(struct neighbour
*neigh
);
42 unsigned neighbour_rxcost(struct neighbour
*neigh
);
43 unsigned neighbour_rttcost(struct neighbour
*neigh
);
44 unsigned neighbour_cost(struct neighbour
*neigh
);
45 int valid_rtt(struct neighbour
*neigh
);
47 #endif /* BABEL_NEIGHBOUR_H */