The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
andna_cache.h
Go to the documentation of this file.
1 /* This file is part of Netsukuku
2  * (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
3  *
4  * This source code is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * This source code is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * Please refer to the GNU Public License for more details.
13  *
14  * You should have received a copy of the GNU Public License along with
15  * this source code; if not, write to:
16  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef ANDNA_CACHE_H
20 #define ANDNA_CACHE_H
21 
22 #include "inet.h"
23 #include "crypto.h"
24 #include "endianness.h"
25 #include "llist.c"
26 #include "snsd_cache.h"
27 
28 /*
29  * ANDNA definitions
30  */
31 
32 #define ANDNA_MAX_BACKUP_GNODES 2
33 #define ANDNA_MAX_QUEUE 5
34 #define ANDNA_MAX_HNAME_LEN 512 /* (null terminator included) */
35 #define ANDNA_MAX_HOSTNAMES 256 /* Max number of hnames per node */
36 #define ANDNA_MAX_RHC_HNAMES 512 /* Max number of hnames kept in
37  the resolved_hnames cache* */
38 #define ANDNA_EXPIRATION_TIME 259200 /* 3 days (in seconds)*/
39 #define ANDNA_MIN_UPDATE_TIME 3600 /* The minum amount of time to
40  be waited before sending an
41  update of the hname. */
42 
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
48 
49 /* Returns the number of nodes to be used in a backup_gnode */
50 #define ANDNA_BACKUP_NODES(seeds) ({(seeds) > 8 ? \
51  ((seeds)*32)/MAXGROUPNODE : (seeds);})
52 
53 #ifdef DEBUG
54  #undef ANDNA_EXPIRATION_TIME
55  #define ANDNA_EXPIRATION_TIME 100
56  #undef ANDNA_MIN_UPDATE_TIME
57  #define ANDNA_MIN_UPDATE_TIME 2
58 #endif
59 
60 /*
61  * * * Cache stuff * * *
62  */
63 
64 /* * andna_cache flags * */
65 #define ANDNA_BACKUP 1 /* We are a backup_node */
66 #define ANDNA_COUNTER (1<<1) /* We are a counter_node */
67 #define ANDNA_ROUNDED (1<<2) /* We are a rounded_hash_node */
68 #define ANDNA_FULL (1<<3) /* Queue full */
69 #define ANDNA_UPDATING (1<<4) /* The hname is being updated
70  right now */
71 
72 /*
73  * andna_cache_queue
74  *
75  * The queue of the andna_cache. (see below).
76  */
78 {
80 
81  time_t timestamp;
82  u_short hname_updates; /* numbers of hname's updates */
84 
85  u_short snsd_counter; /* # of `snsd' nodes */
87 };
89 
90 /*
91  * andna_cache
92  *
93  * It keeps the entries of the hostnames registered by other nodes.
94  */
96 {
98 
99  u_int hash[MAX_IP_INT]; /* hostname's hash */
100  char flags;
101 
102  u_short queue_counter;
103  andna_cache_queue *acq; /* The queue of the registration.
104  The first is the active one */
105 };
106 typedef struct andna_cache andna_cache;
107 
108 /* part of the counter cache, see below */
110 {
112 
113  time_t timestamp;
114  u_short hname_updates;
116 };
120  { 0, sizeof(time_t) },
121  { 1, 1 }
122  };
123 
124 /*
125  * counter_c
126  * Counter node's cache.
127  *
128  * All the infos regarding a particular register_node are stored here. For
129  * example, we need to know how many hostnames he already registered.
130  */
131 struct counter_c
132 {
134 
136  char flags;
137 
138  u_short hashes; /* The number of hashes in cch */
139  counter_c_hashes *cch; /* The hashes of the hnames */
140 };
141 typedef struct counter_c counter_c;
143  { INT_TYPE_16BIT },
144  { ANDNA_PKEY_LEN+sizeof(char) },
145  { 1 }
146  };
147 
148 /*
149  * lcl_cache_keyring
150  *
151  * The lcl keyring is used to store the RSA keys used to complete some of the
152  * ANDNA requests, (f.e. registering or updating a hname).
153  */
154 typedef struct
155 {
156  u_int skey_len;
157  u_int pkey_len;
158 
159  u_char *privkey; /* secret key packed */
160  u_char *pubkey; /* pubkey packed */
161 
162  RSA *priv_rsa; /* key pair unpacked */
164 
165 
166 /*
167  * lcl_cache
168  *
169  * The Local Andna Cache keeps all the hostnames which have been register by
170  * localhost (ourself).
171  */
172 struct lcl_cache
173 {
175 
176  char *hostname; /* The registered hostname */
177  u_int hash; /* 32bit hash of the md5 hash
178  of the hname */
179  u_short hname_updates; /* How many updates we've done
180  for this hostname */
181  time_t timestamp; /* the last time when the hname
182  was updated. If it is 0, the
183  hname has still to be
184  registered */
185 
186  u_short snsd_counter; /* # of `snsds' */
188 
189  char flags;
190 };
191 typedef struct lcl_cache lcl_cache;
192 
193 
194 /*
195  * resolved_hnames_cache
196  *
197  * This cache keeps info on the already resolved hostnames, so we won't have
198  * to resolve them soon again.
199  * In order to optimize the search we order the linked list by the time
200  * of hname resolution. The last hname which has been searched/resolved is
201  * always moved at the head of the llist, in this way, at the end of the llist
202  * there is the hname which has been searched for the first time but has been
203  * ignored until now.
204  * When the cache is full, the hname which is at the end of the llist is
205  * removed to empty new space.
206  * The hname which have the `timestamp' expired are removed too.
207  */
209 {
211 
212  u_int hash; /* 32bit hash of the md5 hash of the
213  hname */
214  char flags;
215 
216  time_t timestamp; /* the last time when the hname
217  was updated. With this we know that
218  at timestamp+ANDNA_EXPIRATION_TIME
219  this cache will expire. */
220 
221  u_short snsd_counter;
223 };
225 
226 
227 /*
228  * * * * Global vars * * *
229  */
232 
235 
239 
242 
243 
244 /*
245  *
246  * * * * Package stuff * * *
247  *
248  */
249 
250 
251 /*
252  * * * * lcl cache package * * *
253  */
254 
256 {
257  u_int skey_len;
258  u_int pkey_len;
259 }_PACKED_;
260 /*
261  * the rest of the pkt is:
262  *
263  * char privkey[hdr.skey_len];
264  * char pubkey[hdr.pkey_len];
265  */
268  { 0, sizeof(u_int) },
269  { 1, 1 }
270  };
271 #define LCL_KEYRING_HDR_PACK_SZ(khdr) (sizeof(struct lcl_keyring_pkt_hdr) + \
272  (khdr)->skey_len + (khdr)->pkey_len)
273 
274 /*
275  * The local cache pkt is used to pack the entire local cache to save it in a
276  * file or to send it to a node.
277  */
279 {
280  u_short tot_caches; /* How many lcl structs there
281  are in the pkt's body */
282 }_PACKED_;
284 #define LCL_CACHE_HDR_PACK_SZ (sizeof(struct lcl_cache_pkt_hdr))
285 
286 /*
287  * The body is:
288  *
289  * struct lcl_cache_pkt_body {
290  * u_short hname_updates;
291  * time_t timestamp;
292  * char hostname[strlen(hostname)+1]; * null terminated *
293  * } body[ hdr.tot_caches ];
294  *
295  */
296 #define LCL_CACHE_BODY_PACK_SZ(hname_len) ((hname_len) + sizeof(u_short) \
297  + sizeof(time_t))
299  { 0, sizeof(u_short) },
300  { 1, 1 }
301  };
302 
303 /*
304  * * * * andna cache package * * *
305  */
306 
307 /*
308  * the body of the acq_pkt is:
309  * struct acq_pkt_body {
310  * time_t timestamp;
311  * u_short hname_updates;
312  * char pubkey[ANDNA_PKEY_LEN];
313  *
314  * u_short snsd_counter;
315  * char snsd_service_pack[SNSD_SERVICE_PACK_SZ];
316  * };
317  */
319  { INT_TYPE_32BIT, INT_TYPE_16BIT, INT_TYPE_16BIT },
320  { 0, sizeof(time_t),
321  sizeof(time_t) + sizeof(u_short) + ANDNA_PKEY_LEN },
322  { 1, 1, 1 }
323  };
324 #define ACQ_BODY_PACK_SZ (sizeof(time_t) + sizeof(u_short)*2 + \
325  ANDNA_PKEY_LEN)
326 #define ACQ_PACK_SZ(snsd_pack_sz) (ACQ_BODY_PACK_SZ + (snsd_pack_sz))
327 
329 {
330  u_short tot_caches;
331 }_PACKED_;
333 /*
334  * The body is:
335  * struct andna_cache_pack {
336  * u_int hash[MAX_IP_INT];
337  * char flags;
338  * u_short queue_counter;
339  * char acq_pack[ACQ_PACK_SZ*queue_counter];
340  * } acache_pack[hdr.tot_caches];
341  */
343  { INT_TYPE_16BIT },
344  { MAX_IP_SZ+sizeof(char) },
345  { 1 }
346  };
347 #define ACACHE_BODY_PACK_SZ (ANDNA_HASH_SZ + sizeof(char) + \
348  sizeof(u_short))
349 #define ACACHE_PACK_SZ(acq_pack_sz) ((acq_pack_sz) + ACACHE_BODY_PACK_SZ)
350 
351 /*
352  * If the acache pack will be sent on a network packet, the `acq->timestamp'
353  * will be the difference of the current time with the same `acq->timestamp',
354  * in this way the node which receives the packet will add its current time to
355  * `acq->timestamp'. This is necessary because the sending and receiving node
356  * don't have the clock synced. Note that the rtt isn't considered because it
357  * is generally very small and the ANDNA times don't need an accurate
358  * precision, f.e. the expiration time is three days long.
359  * If the pack is saved on a file, then `acq->timestamp' remains the same.
360  * Problem: if the clock is changed, acq->timestamp will refer to the old
361  * clock.
362  */
363 #define ACACHE_PACK_FILE 1
364 #define ACACHE_PACK_PKT 2
365 
366 
367 /*
368  * The counter cache pkt is similar to the andna_cache_pkt, it is completely
369  * arranged in the same way.
370  */
372 {
373  u_short tot_caches;
374 }_PACKED_;
376 #define COUNTER_CACHE_HASHES_PACK_SZ (sizeof(time_t) + sizeof(u_short) + \
377  ANDNA_HASH_SZ)
378 #define COUNTER_CACHE_BODY_PACK_SZ (ANDNA_PKEY_LEN + sizeof(char) + \
379  sizeof(u_short))
380 #define COUNTER_CACHE_PACK_SZ(hashes) ((COUNTER_CACHE_HASHES_PACK_SZ*(hashes))\
381  + COUNTER_CACHE_BODY_PACK_SZ)
382 
383 /*
384  * * * * Resolved hostnames cache pkt. * * *
385  */
386 
388 {
389  u_short tot_caches; /* How many lcl structs there
390  are in the pkt's hdr */
391 }_PACKED_;
392 INT_INFO rh_cache_pkt_hdr_iinfo = { 1, { INT_TYPE_16BIT }, { 0 }, { 1 } };
393 /*
394  * The body is:
395  * struct rh_cache_pkt_body {
396  * u_int hash;
397  * char flags;
398  * time_t timestamp;
399  *
400  * u_short snsd_counter;
401  * char snsd_service_pack[SNSD_SERVICE_PACK_SZ];
402  * } body[ hdr.tot_caches ];
403  */
404 #define RH_CACHE_BODY_PACK_SZ(snsd_pack_sz) (sizeof(u_int)+sizeof(char)+ \
405  sizeof(time_t)+sizeof(u_short)+\
406  (snsd_pack_sz))
409  { 0, sizeof(u_int)+sizeof(char),
410  sizeof(u_int)+sizeof(char)+sizeof(time_t) },
411  { 1, 1, 1 }
412  };
413 
414 
415 /*
416  * * * Functions' declaration * * *
417  */
418 
419 void andna_caches_init(int family);
420 
421 void lcl_new_keyring(lcl_cache_keyring *keyring);
423 lcl_cache *lcl_cache_new(char *hname);
424 void lcl_cache_free(lcl_cache *alcl);
425 void lcl_cache_destroy(lcl_cache *head, int *counter);
426 lcl_cache *lcl_cache_find_hname(lcl_cache *head, char *hname);
427 lcl_cache *lcl_cache_find_hash(lcl_cache *alcl, u_int hash);
429 
431 andna_cache_queue *ac_queue_add(andna_cache *ac, char *pubkey);
434 void ac_queue_destroy(andna_cache *ac);
436 andna_cache *andna_cache_gethash(int hash[MAX_IP_INT]);
437 andna_cache *andna_cache_addhash(int hash[MAX_IP_INT]);
439 void andna_cache_del_expired(void);
440 void andna_cache_destroy(void);
441 
442 counter_c_hashes *cc_hashes_add(counter_c *cc, int hash[MAX_IP_INT]);
446 void cc_hashes_destroy(counter_c *cc);
447 counter_c_hashes *cc_findhash(counter_c *cc, int hash[MAX_IP_INT]);
448 counter_c *counter_c_findpubk(char *pubk);
449 counter_c *counter_c_add(inet_prefix *rip, char *pubkey);
450 void counter_c_del_expired(void);
451 void counter_c_destroy(void);
452 
453 rh_cache *rh_cache_new(char *hname, time_t timestamp);
454 rh_cache *rh_cache_add_hash(u_int hash, time_t timestamp);
455 rh_cache *rh_cache_add(char *hname, time_t timestamp);
456 rh_cache *rh_cache_find_hash(u_int hash);
457 rh_cache *rh_cache_find_hname(char *hname);
458 void rh_cache_del(rh_cache *rhc);
459 void rh_cache_del_expired(void);
460 void rh_cache_flush(void);
461 
462 char *pack_lcl_keyring(lcl_cache_keyring *keyring, size_t *pack_sz);
463 int unpack_lcl_keyring(lcl_cache_keyring *keyring, char *pack, size_t pack_sz);
464 
465 char *pack_lcl_cache(lcl_cache *local_cache, size_t *pack_sz);
466 lcl_cache *unpack_lcl_cache(char *pack, size_t pack_sz, int *counter);
467 
468 char *pack_andna_cache(andna_cache *acache, size_t *pack_sz, int pack_type);
469 andna_cache *unpack_andna_cache(char *pack, size_t pack_sz, int *counter,
470  int pack_type);
471 
472 char *pack_counter_cache(counter_c *countercache, size_t *pack_sz);
473 counter_c *unpack_counter_cache(char *pack, size_t pack_sz, int *counter);
474 
475 char *pack_rh_cache(rh_cache *rhcache, size_t *pack_sz);
476 rh_cache *unpack_rh_cache(char *pack, size_t pack_sz, int *counter);
477 
478 int save_lcl_keyring(lcl_cache_keyring *keyring, char *file);
479 int load_lcl_keyring(lcl_cache_keyring *keyring, char *file);
480 
481 int save_lcl_cache(lcl_cache *lcl, char *file);
482 lcl_cache *load_lcl_cache(char *file, int *counter);
483 
484 int save_andna_cache(andna_cache *acache, char *file);
485 andna_cache *load_andna_cache(char *file, int *counter);
486 
487 int save_counter_c(counter_c *countercache, char *file);
488 counter_c *load_counter_c(char *file, int *counter);
489 
490 int save_rh_cache(rh_cache *rh, char *file);
491 rh_cache *load_rh_cache(char *file, int *counter);
492 
493 int load_hostnames(char *file, lcl_cache **old_alcl_head, int *old_alcl_counter);
494 int load_snsd(char *file, lcl_cache *alcl_head);
495 
496 int add_resolv_conf(char *hname, char *file);
497 int del_resolv_conf(char *hname, char *file);
498 
499 #endif /*ANDNA_CACHE_H*/
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
Definition: inet.h:73
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