blob: 5c98f13355e2d1fc5620c120ed4caa5f498ca61e (
plain)
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
|
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include <stdio.h>
struct addr {
uint32_t ip;
uint16_t port;
};
struct nodeid {
union {
uint32_t inner[5];
char inner_b[20];
};
};
struct entry {
bool set;
struct nodeid id;
time_t last;
struct addr addr;
};
void routing_init(struct nodeid* myid);
void routing_flush();
bool routing_interested(struct nodeid* id);
bool routing_offer(struct nodeid* id, struct entry **dest);
size_t routing_closest(struct nodeid* needle, size_t n, struct entry** res);
|