Data Structures - mwarning/KadNode GitHub Wiki
DHT data structures
- bucket => node
- search => search_node
- storage => peer
- blocklist
KadNode data structures
values
Stores identifiers that need to be announced once or multiple times (depending on lifetime).
struct value_t {
UCHAR id[SHA1_BIN_LENGTH];
#ifdef AUTH
UCHAR *skey;
#endif
int port;
time_t lifetime; /* Keep entry refreshed until the lifetime expires */
time_t refresh; /* Next time the entry need to be refreshed */
struct value_t *next;
};
results
Stores addresses from searches.
struct result_t {
IP addr;
#ifdef AUTH
UCHAR *challenge;
int challenges_send;
#endif
struct result_t *next;
};
Authentication Extension data structures
Two lists for storing public/secret key including patterns.
struct key_t {
char* pattern;
UCHAR* keybytes;
size_t keysize;
struct key_t *next;
};
Forwarding Extension data structures
A list that represents all port that KadNode will try to establish a port forwarding for (via UPnP/NAT-PMP).
struct forwarding_t {
int port; /* the port to be forwarded on the router */
time_t lifetime; /* keep entry until lifetime expires */
time_t refreshed; /* last time the entry was refreshed */
struct forwarding_t *next;
};