-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathneighbors.h
54 lines (40 loc) · 1.15 KB
/
neighbors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef _ROOT_STORAGE_0_NEIGHBORS_H_
#define _ROOT_STORAGE_0_NEIGHBORS_H_
#include <inttypes.h>
#include <stddef.h>
#include "packets.h"
#include "ranges.h"
#include "traffic.h"
#include "root.h"
#include "../ext/uthash.h"
#include "../address.h"
// for detecting connection breaks
typedef struct {
Address address;
// needed?
//uint64_t packets_send_count;
//uint64_t packets_send_time;
uint8_t pinged;
uint64_t time_created;
uint64_t time_updated;
//uint64_t root_store_to_others_received_time;
bool is_child;
uint64_t root_store_received_time;
bool root_set;
Root root;
bool ranges_set;
Ranges ranges;
// neighbor is a child only if we received ranges recently and have not seen this node sending it do a different node
//uint64_t ranges_updated;
//uint64_t ranges_updated_next;
// we should have the same for the root....
// TODO: use
Traffic unicast_traffic;
Traffic broadcast_traffic;
UT_hash_handle hh;
} Neighbor;
Neighbor *neighbors_all();
Neighbor *neighbors_find(const Address *addr);
Neighbor *neighbors_get(const Address *addr);
void neighbors_periodic();
#endif