32 #define ANDNA_MAX_BACKUP_GNODES 2
33 #define ANDNA_MAX_QUEUE 5
34 #define ANDNA_MAX_HNAME_LEN 512
35 #define ANDNA_MAX_HOSTNAMES 256
36 #define ANDNA_MAX_RHC_HNAMES 512
38 #define ANDNA_EXPIRATION_TIME 259200
39 #define ANDNA_MIN_UPDATE_TIME 3600
43 #define ANDNA_PRIVKEY_BITS 1024
44 #define ANDNA_SKEY_MAX_LEN 900
45 #define ANDNA_PKEY_LEN 140
46 #define ANDNA_HASH_SZ (MAX_IP_SZ)
47 #define ANDNA_SIGNATURE_LEN 128
50 #define ANDNA_BACKUP_NODES(seeds) ({(seeds) > 8 ? \
51 ((seeds)*32)/MAXGROUPNODE : (seeds);})
54 #undef ANDNA_EXPIRATION_TIME
55 #define ANDNA_EXPIRATION_TIME 100
56 #undef ANDNA_MIN_UPDATE_TIME
57 #define ANDNA_MIN_UPDATE_TIME 2
65 #define ANDNA_BACKUP 1
66 #define ANDNA_COUNTER (1<<1)
67 #define ANDNA_ROUNDED (1<<2)
68 #define ANDNA_FULL (1<<3)
69 #define ANDNA_UPDATING (1<<4)
120 { 0,
sizeof(time_t) },
268 { 0,
sizeof(u_int) },
271 #define LCL_KEYRING_HDR_PACK_SZ(khdr) (sizeof(struct lcl_keyring_pkt_hdr) + \
272 (khdr)->skey_len + (khdr)->pkey_len)
284 #define LCL_CACHE_HDR_PACK_SZ (sizeof(struct lcl_cache_pkt_hdr))
296 #define LCL_CACHE_BODY_PACK_SZ(hname_len) ((hname_len) + sizeof(u_short) \
299 { 0,
sizeof(u_short) },
324 #define ACQ_BODY_PACK_SZ (sizeof(time_t) + sizeof(u_short)*2 + \
326 #define ACQ_PACK_SZ(snsd_pack_sz) (ACQ_BODY_PACK_SZ + (snsd_pack_sz))
347 #define ACACHE_BODY_PACK_SZ (ANDNA_HASH_SZ + sizeof(char) + \
349 #define ACACHE_PACK_SZ(acq_pack_sz) ((acq_pack_sz) + ACACHE_BODY_PACK_SZ)
363 #define ACACHE_PACK_FILE 1
364 #define ACACHE_PACK_PKT 2
376 #define COUNTER_CACHE_HASHES_PACK_SZ (sizeof(time_t) + sizeof(u_short) + \
378 #define COUNTER_CACHE_BODY_PACK_SZ (ANDNA_PKEY_LEN + sizeof(char) + \
380 #define COUNTER_CACHE_PACK_SZ(hashes) ((COUNTER_CACHE_HASHES_PACK_SZ*(hashes))\
381 + COUNTER_CACHE_BODY_PACK_SZ)
404 #define RH_CACHE_BODY_PACK_SZ(snsd_pack_sz) (sizeof(u_int)+sizeof(char)+ \
405 sizeof(time_t)+sizeof(u_short)+\
409 { 0,
sizeof(u_int)+
sizeof(
char),
410 sizeof(u_int)+
sizeof(
char)+
sizeof(time_t) },
char flags
Definition: andna_cache.h:136
void rh_cache_del(rh_cache *rhc)
Definition: andna_cache.c:634
u_short snsd_counter
Definition: andna_cache.h:221
static const int_info andna_cache_pkt_hdr_iinfo
Definition: andna_cache.h:332
void andna_caches_init(int family)
Definition: andna_cache.c:34
Definition: andna_cache.h:154
u_int hash
Definition: andna_cache.h:177
Definition: andna_cache.h:95
static const int_info andna_cache_body_iinfo
Definition: andna_cache.h:342
rh_cache * rh_cache_new(char *hname, time_t timestamp)
Definition: andna_cache.c:545
counter_c * unpack_counter_cache(char *pack, size_t pack_sz, int *counter)
Definition: andna_cache.c:1169
char flags
Definition: andna_cache.h:189
andna_cache * andna_c
Definition: andna_cache.h:230
int cc_counter
Definition: andna_cache.h:234
void cc_hashes_del(counter_c *cc, counter_c_hashes *cch)
Definition: andna_cache.c:420
lcl_cache * lcl_cache_find_hash(lcl_cache *alcl, u_int hash)
Definition: andna_cache.c:151
void lcl_cache_free(lcl_cache *alcl)
Definition: andna_cache.c:113
char * pack_counter_cache(counter_c *countercache, size_t *pack_sz)
Definition: andna_cache.c:1103
counter_c * andna_counter_c
Definition: andna_cache.h:233
void ac_queue_del(andna_cache *ac, andna_cache_queue *acq)
Definition: andna_cache.c:246
rh_cache * rh_cache_add(char *hname, time_t timestamp)
Definition: andna_cache.c:595
static const int_info acq_body_iinfo
Definition: andna_cache.h:318
counter_c_hashes * cch
Definition: andna_cache.h:139
Definition: andna_cache.h:387
void ac_queue_destroy(andna_cache *ac)
Definition: andna_cache.c:278
Definition: andna_cache.h:77
u_short queue_counter
Definition: andna_cache.h:102
u_short tot_caches
Definition: andna_cache.h:373
int del_resolv_conf(char *hname, char *file)
Definition: andna_cache.c:2081
#define INT_TYPE_16BIT
Definition: endianness.h:36
char pubkey[140]
Definition: andna_cache.h:135
time_t timestamp
Definition: andna_cache.h:216
static const int_info counter_c_body_iinfo
Definition: andna_cache.h:142
char * pack_lcl_cache(lcl_cache *local_cache, size_t *pack_sz)
Definition: andna_cache.c:746
int load_lcl_keyring(lcl_cache_keyring *keyring, char *file)
Definition: andna_cache.c:1383
andna_cache * andna_cache_gethash(int hash[4])
Definition: andna_cache.c:312
void lcl_cache_destroy(lcl_cache *head, int *counter)
Definition: andna_cache.c:122
void lcl_destroy_keyring(lcl_cache_keyring *keyring)
Definition: andna_cache.c:85
counter_c_hashes * cc_findhash(counter_c *cc, int hash[4])
Definition: andna_cache.c:454
u_int pkey_len
Definition: andna_cache.h:258
andna_cache * load_andna_cache(char *file, int *counter)
Definition: andna_cache.c:1517
RSA * priv_rsa
Definition: andna_cache.h:162
u_short hname_updates
Definition: andna_cache.h:179
int counter_c_del_ifexpired(counter_c *cc)
int hash[4]
Definition: andna_cache.h:115
rh_cache * load_rh_cache(char *file, int *counter)
Definition: andna_cache.c:1654
u_int hash
Definition: andna_cache.h:212
Definition: andna_cache.h:208
int save_lcl_cache(lcl_cache *lcl, char *file)
Definition: andna_cache.c:1421
lcl_cache * lcl_cache_find_hname(lcl_cache *head, char *hname)
Definition: andna_cache.c:136
andna_cache * andna_cache_addhash(int hash[4])
Definition: andna_cache.c:323
void rh_cache_flush(void)
Definition: andna_cache.c:658
Definition: snsd_cache.h:125
#define MAX_IP_SZ
Definition: inet.h:25
struct lcl_keyring_pkt_hdr _PACKED_
int save_lcl_keyring(lcl_cache_keyring *keyring, char *file)
Definition: andna_cache.c:1351
u_short hashes
Definition: andna_cache.h:138
int save_andna_cache(andna_cache *acache, char *file)
Definition: andna_cache.c:1487
void rh_cache_del_expired(void)
Definition: andna_cache.c:643
int load_hostnames(char *file, lcl_cache **old_alcl_head, int *old_alcl_counter)
Definition: andna_cache.c:1707
int andna_cache_del_ifexpired(andna_cache *ac)
Definition: andna_cache.c:344
andna_cache * andna_cache_findhash(int hash[4])
Definition: andna_cache.c:290
Definition: andna_cache.h:255
andna_cache_queue * ac_queue_add(andna_cache *ac, char *pubkey)
Definition: andna_cache.c:220
u_int skey_len
Definition: andna_cache.h:156
snsd_service * service
Definition: andna_cache.h:187
char * hostname
Definition: andna_cache.h:176
rh_cache * andna_rhc
Definition: andna_cache.h:240
void cc_hashes_del_expired(counter_c *cc)
Definition: andna_cache.c:426
#define MAX_IP_INT
Definition: inet.h:24
lcl_cache * lcl_get_registered_hnames(lcl_cache *alcl)
Definition: andna_cache.c:175
int load_snsd(char *file, lcl_cache *alcl_head)
Definition: andna_cache.c:1792
void lcl_new_keyring(lcl_cache_keyring *keyring)
Definition: andna_cache.c:70
void andna_cache_destroy(void)
Definition: andna_cache.c:372
u_int skey_len
Definition: andna_cache.h:257
rh_cache * rh_cache_find_hash(u_int hash)
Definition: andna_cache.c:600
void ac_queue_del_expired(andna_cache *ac)
Definition: andna_cache.c:260
int lcl_counter
Definition: andna_cache.h:238
rh_cache * unpack_rh_cache(char *pack, size_t pack_sz, int *counter)
Definition: andna_cache.c:1297
u_short hname_updates
Definition: andna_cache.h:114
void cc_hashes_destroy(counter_c *cc)
Definition: andna_cache.c:442
counter_c * counter_c_add(inet_prefix *rip, char *pubkey)
Definition: andna_cache.c:480
char * pack_lcl_keyring(lcl_cache_keyring *keyring, size_t *pack_sz)
Definition: andna_cache.c:672
static const int_info rh_cache_pkt_hdr_iinfo
Definition: andna_cache.h:392
snsd_service * service
Definition: andna_cache.h:222
u_short snsd_counter
Definition: andna_cache.h:186
Definition: andna_cache.h:131
Definition: andna_cache.h:328
counter_c * load_counter_c(char *file, int *counter)
Definition: andna_cache.c:1586
static const int_info rh_cache_pkt_body_iinfo
Definition: andna_cache.h:407
lcl_cache * load_lcl_cache(char *file, int *counter)
Definition: andna_cache.c:1451
static const int_info lcl_keyring_pkt_hdr_iinfo
Definition: andna_cache.h:266
Definition: andna_cache.h:371
lcl_cache * unpack_lcl_cache(char *pack, size_t pack_sz, int *counter)
Definition: andna_cache.c:797
char flags
Definition: andna_cache.h:214
u_short hname_updates
Definition: andna_cache.h:82
#define INT_INFO
Definition: endianness.h:90
counter_c_hashes * cc_hashes_add(counter_c *cc, int hash[4])
Definition: andna_cache.c:395
u_int hash[4]
Definition: andna_cache.h:99
time_t timestamp
Definition: andna_cache.h:113
Definition: andna_cache.h:172
rh_cache * rh_cache_add_hash(u_int hash, time_t timestamp)
Definition: andna_cache.c:560
andna_cache_queue * acq
Definition: andna_cache.h:103
snsd_service * service
Definition: andna_cache.h:86
int save_rh_cache(rh_cache *rh, char *file)
Definition: andna_cache.c:1623
int add_resolv_conf(char *hname, char *file)
Definition: andna_cache.c:1954
char * pack_rh_cache(rh_cache *rhcache, size_t *pack_sz)
Definition: andna_cache.c:1240
u_char * privkey
Definition: andna_cache.h:159
static const int_info lcl_cache_pkt_body_iinfo
Definition: andna_cache.h:298
void counter_c_destroy(void)
Definition: andna_cache.c:515
time_t timestamp
Definition: andna_cache.h:81
static const int_info counter_c_pkt_hdr_iinfo
Definition: andna_cache.h:375
u_short tot_caches
Definition: andna_cache.h:389
time_t timestamp
Definition: andna_cache.h:181
int andna_c_counter
Definition: andna_cache.h:231
Definition: andna_cache.h:278
Definition: andna_cache.h:109
char pubkey[140]
Definition: andna_cache.h:83
lcl_cache * andna_lcl
Definition: andna_cache.h:237
rh_cache * rh_cache_find_hname(char *hname)
Definition: andna_cache.c:626
lcl_cache * lcl_cache_new(char *hname)
Definition: andna_cache.c:101
#define LLIST_HDR(_struct)
Definition: llist.c:44
int family
Definition: if.c:34
char flags
Definition: andna_cache.h:100
u_short snsd_counter
Definition: andna_cache.h:85
void andna_cache_del_expired(void)
Definition: andna_cache.c:356
counter_c * counter_c_findpubk(char *pubk)
Definition: andna_cache.c:467
lcl_cache_keyring lcl_keyring
Definition: andna_cache.h:236
u_int pkey_len
Definition: andna_cache.h:157
#define INT_TYPE_32BIT
Definition: endianness.h:35
static const int_info counter_c_hashes_body_iinfo
Definition: andna_cache.h:118
#define ANDNA_PKEY_LEN
Definition: andna_cache.h:45
int save_counter_c(counter_c *countercache, char *file)
Definition: andna_cache.c:1556
int rhc_counter
Definition: andna_cache.h:241
andna_cache_queue * ac_queue_findpubk(andna_cache *ac, char *pubk)
Definition: andna_cache.c:195
static const int_info lcl_cache_pkt_hdr_iinfo
Definition: andna_cache.h:283
u_char * pubkey
Definition: andna_cache.h:160
void counter_c_del_expired(void)
Definition: andna_cache.c:496
andna_cache * unpack_andna_cache(char *pack, size_t pack_sz, int *counter, int pack_type)
Definition: andna_cache.c:1047
char * pack_andna_cache(andna_cache *acache, size_t *pack_sz, int pack_type)
Definition: andna_cache.c:930
u_short tot_caches
Definition: andna_cache.h:280
int unpack_lcl_keyring(lcl_cache_keyring *keyring, char *pack, size_t pack_sz)
Definition: andna_cache.c:697
u_short tot_caches
Definition: andna_cache.h:330