The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
andna_cache.h File Reference
#include "inet.h"
#include "crypto.h"
#include "endianness.h"
#include "llist.c"
#include "snsd_cache.h"
Include dependency graph for andna_cache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  andna_cache_queue
 
struct  andna_cache
 
struct  counter_c_hashes
 
struct  counter_c
 
struct  lcl_cache_keyring
 
struct  lcl_cache
 
struct  resolved_hnames_cache
 
struct  lcl_keyring_pkt_hdr
 
struct  lcl_cache_pkt_hdr
 
struct  andna_cache_pkt_hdr
 
struct  counter_c_pkt_hdr
 
struct  rh_cache_pkt_hdr
 

Macros

#define ANDNA_MAX_BACKUP_GNODES   2
 
#define ANDNA_MAX_QUEUE   5
 
#define ANDNA_MAX_HNAME_LEN   512 /* (null terminator included) */
 
#define ANDNA_MAX_HOSTNAMES   256 /* Max number of hnames per node */
 
#define ANDNA_MAX_RHC_HNAMES
 
#define ANDNA_EXPIRATION_TIME   259200 /* 3 days (in seconds)*/
 
#define ANDNA_MIN_UPDATE_TIME
 
#define ANDNA_PRIVKEY_BITS   1024
 
#define ANDNA_SKEY_MAX_LEN   900
 
#define ANDNA_PKEY_LEN   140
 
#define ANDNA_HASH_SZ   (MAX_IP_SZ)
 
#define ANDNA_SIGNATURE_LEN   128
 
#define ANDNA_BACKUP_NODES(seeds)
 
#define ANDNA_BACKUP   1 /* We are a backup_node */
 
#define ANDNA_COUNTER   (1<<1) /* We are a counter_node */
 
#define ANDNA_ROUNDED   (1<<2) /* We are a rounded_hash_node */
 
#define ANDNA_FULL   (1<<3) /* Queue full */
 
#define ANDNA_UPDATING
 
#define LCL_KEYRING_HDR_PACK_SZ(khdr)
 
#define LCL_CACHE_HDR_PACK_SZ   (sizeof(struct lcl_cache_pkt_hdr))
 
#define LCL_CACHE_BODY_PACK_SZ(hname_len)
 
#define ACQ_BODY_PACK_SZ
 
#define ACQ_PACK_SZ(snsd_pack_sz)   (ACQ_BODY_PACK_SZ + (snsd_pack_sz))
 
#define ACACHE_BODY_PACK_SZ
 
#define ACACHE_PACK_SZ(acq_pack_sz)   ((acq_pack_sz) + ACACHE_BODY_PACK_SZ)
 
#define ACACHE_PACK_FILE   1
 
#define ACACHE_PACK_PKT   2
 
#define COUNTER_CACHE_HASHES_PACK_SZ
 
#define COUNTER_CACHE_BODY_PACK_SZ
 
#define COUNTER_CACHE_PACK_SZ(hashes)
 
#define RH_CACHE_BODY_PACK_SZ(snsd_pack_sz)
 

Typedefs

typedef struct andna_cache_queue andna_cache_queue
 
typedef struct andna_cache andna_cache
 
typedef struct counter_c_hashes counter_c_hashes
 
typedef struct counter_c counter_c
 
typedef struct lcl_cache lcl_cache
 
typedef struct
resolved_hnames_cache 
rh_cache
 

Functions

void andna_caches_init (int family)
 
void lcl_new_keyring (lcl_cache_keyring *keyring)
 
void lcl_destroy_keyring (lcl_cache_keyring *keyring)
 
lcl_cachelcl_cache_new (char *hname)
 
void lcl_cache_free (lcl_cache *alcl)
 
void lcl_cache_destroy (lcl_cache *head, int *counter)
 
lcl_cachelcl_cache_find_hname (lcl_cache *head, char *hname)
 
lcl_cachelcl_cache_find_hash (lcl_cache *alcl, u_int hash)
 
lcl_cachelcl_get_registered_hnames (lcl_cache *alcl)
 
andna_cache_queueac_queue_findpubk (andna_cache *ac, char *pubk)
 
andna_cache_queueac_queue_add (andna_cache *ac, char *pubkey)
 
void ac_queue_del (andna_cache *ac, andna_cache_queue *acq)
 
void ac_queue_del_expired (andna_cache *ac)
 
void ac_queue_destroy (andna_cache *ac)
 
andna_cacheandna_cache_findhash (int hash[4])
 
andna_cacheandna_cache_gethash (int hash[4])
 
andna_cacheandna_cache_addhash (int hash[4])
 
int andna_cache_del_ifexpired (andna_cache *ac)
 
void andna_cache_del_expired (void)
 
void andna_cache_destroy (void)
 
counter_c_hashescc_hashes_add (counter_c *cc, int hash[4])
 
void cc_hashes_del (counter_c *cc, counter_c_hashes *cch)
 
int counter_c_del_ifexpired (counter_c *cc)
 
void cc_hashes_del_expired (counter_c *cc)
 
void cc_hashes_destroy (counter_c *cc)
 
counter_c_hashescc_findhash (counter_c *cc, int hash[4])
 
counter_ccounter_c_findpubk (char *pubk)
 
counter_ccounter_c_add (inet_prefix *rip, char *pubkey)
 
void counter_c_del_expired (void)
 
void counter_c_destroy (void)
 
rh_cacherh_cache_new (char *hname, time_t timestamp)
 
rh_cacherh_cache_add_hash (u_int hash, time_t timestamp)
 
rh_cacherh_cache_add (char *hname, time_t timestamp)
 
rh_cacherh_cache_find_hash (u_int hash)
 
rh_cacherh_cache_find_hname (char *hname)
 
void rh_cache_del (rh_cache *rhc)
 
void rh_cache_del_expired (void)
 
void rh_cache_flush (void)
 
char * pack_lcl_keyring (lcl_cache_keyring *keyring, size_t *pack_sz)
 
int unpack_lcl_keyring (lcl_cache_keyring *keyring, char *pack, size_t pack_sz)
 
char * pack_lcl_cache (lcl_cache *local_cache, size_t *pack_sz)
 
lcl_cacheunpack_lcl_cache (char *pack, size_t pack_sz, int *counter)
 
char * pack_andna_cache (andna_cache *acache, size_t *pack_sz, int pack_type)
 
andna_cacheunpack_andna_cache (char *pack, size_t pack_sz, int *counter, int pack_type)
 
char * pack_counter_cache (counter_c *countercache, size_t *pack_sz)
 
counter_cunpack_counter_cache (char *pack, size_t pack_sz, int *counter)
 
char * pack_rh_cache (rh_cache *rhcache, size_t *pack_sz)
 
rh_cacheunpack_rh_cache (char *pack, size_t pack_sz, int *counter)
 
int save_lcl_keyring (lcl_cache_keyring *keyring, char *file)
 
int load_lcl_keyring (lcl_cache_keyring *keyring, char *file)
 
int save_lcl_cache (lcl_cache *lcl, char *file)
 
lcl_cacheload_lcl_cache (char *file, int *counter)
 
int save_andna_cache (andna_cache *acache, char *file)
 
andna_cacheload_andna_cache (char *file, int *counter)
 
int save_counter_c (counter_c *countercache, char *file)
 
counter_cload_counter_c (char *file, int *counter)
 
int save_rh_cache (rh_cache *rh, char *file)
 
rh_cacheload_rh_cache (char *file, int *counter)
 
int load_hostnames (char *file, lcl_cache **old_alcl_head, int *old_alcl_counter)
 
int load_snsd (char *file, lcl_cache *alcl_head)
 
int add_resolv_conf (char *hname, char *file)
 
int del_resolv_conf (char *hname, char *file)
 

Variables

static const int_info counter_c_hashes_body_iinfo
 
static const int_info counter_c_body_iinfo
 
andna_cacheandna_c
 
int andna_c_counter
 
counter_candna_counter_c
 
int cc_counter
 
lcl_cache_keyring lcl_keyring
 
lcl_cacheandna_lcl
 
int lcl_counter
 
rh_cacheandna_rhc
 
int rhc_counter
 
struct lcl_keyring_pkt_hdr _PACKED_
 
static const int_info lcl_keyring_pkt_hdr_iinfo
 
static const int_info lcl_cache_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
 
static const int_info lcl_cache_pkt_body_iinfo
 
static const int_info acq_body_iinfo
 
static const int_info andna_cache_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
 
static const int_info andna_cache_body_iinfo
 
static const int_info counter_c_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
 
static const int_info rh_cache_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
 
static const int_info rh_cache_pkt_body_iinfo
 

Macro Definition Documentation

#define ACACHE_BODY_PACK_SZ
Value:
(ANDNA_HASH_SZ + sizeof(char) + \
sizeof(u_short))
#define ANDNA_HASH_SZ
Definition: andna_cache.h:46
#define ACACHE_PACK_FILE   1
#define ACACHE_PACK_PKT   2
#define ACACHE_PACK_SZ (   acq_pack_sz)    ((acq_pack_sz) + ACACHE_BODY_PACK_SZ)
#define ACQ_BODY_PACK_SZ
Value:
(sizeof(time_t) + sizeof(u_short)*2 + \
#define ANDNA_PKEY_LEN
Definition: andna_cache.h:45
#define ACQ_PACK_SZ (   snsd_pack_sz)    (ACQ_BODY_PACK_SZ + (snsd_pack_sz))
#define ANDNA_BACKUP   1 /* We are a backup_node */
#define ANDNA_BACKUP_NODES (   seeds)
Value:
({(seeds) > 8 ? \
((seeds)*32)/MAXGROUPNODE : (seeds);})
#define MAXGROUPNODE
Definition: map.h:26
#define ANDNA_COUNTER   (1<<1) /* We are a counter_node */
#define ANDNA_EXPIRATION_TIME   259200 /* 3 days (in seconds)*/
#define ANDNA_FULL   (1<<3) /* Queue full */
#define ANDNA_HASH_SZ   (MAX_IP_SZ)
#define ANDNA_MAX_BACKUP_GNODES   2
#define ANDNA_MAX_HNAME_LEN   512 /* (null terminator included) */
#define ANDNA_MAX_HOSTNAMES   256 /* Max number of hnames per node */
#define ANDNA_MAX_QUEUE   5
#define ANDNA_MAX_RHC_HNAMES
Value:
512 /* Max number of hnames kept in
the resolved_hnames cache* */
#define ANDNA_MIN_UPDATE_TIME
Value:
3600 /* The minum amount of time to
be waited before sending an
update of the hname. */
#define ANDNA_PKEY_LEN   140
#define ANDNA_PRIVKEY_BITS   1024
#define ANDNA_ROUNDED   (1<<2) /* We are a rounded_hash_node */
#define ANDNA_SIGNATURE_LEN   128
#define ANDNA_SKEY_MAX_LEN   900
#define ANDNA_UPDATING
Value:
(1<<4) /* The hname is being updated
right now */
#define COUNTER_CACHE_BODY_PACK_SZ
Value:
(ANDNA_PKEY_LEN + sizeof(char) + \
sizeof(u_short))
#define ANDNA_PKEY_LEN
Definition: andna_cache.h:45
#define COUNTER_CACHE_HASHES_PACK_SZ
Value:
(sizeof(time_t) + sizeof(u_short) + \
#define ANDNA_HASH_SZ
Definition: andna_cache.h:46
#define COUNTER_CACHE_PACK_SZ (   hashes)
Value:
#define COUNTER_CACHE_BODY_PACK_SZ
Definition: andna_cache.h:378
#define COUNTER_CACHE_HASHES_PACK_SZ
Definition: andna_cache.h:376
#define LCL_CACHE_BODY_PACK_SZ (   hname_len)
Value:
((hname_len) + sizeof(u_short) \
+ sizeof(time_t))
#define LCL_CACHE_HDR_PACK_SZ   (sizeof(struct lcl_cache_pkt_hdr))
#define LCL_KEYRING_HDR_PACK_SZ (   khdr)
Value:
(sizeof(struct lcl_keyring_pkt_hdr) + \
(khdr)->skey_len + (khdr)->pkey_len)
u_int pkey_len
Definition: andna_cache.h:258
Definition: andna_cache.h:255
u_int skey_len
Definition: andna_cache.h:257
#define RH_CACHE_BODY_PACK_SZ (   snsd_pack_sz)
Value:
(sizeof(u_int)+sizeof(char)+ \
sizeof(time_t)+sizeof(u_short)+\
(snsd_pack_sz))

Typedef Documentation

typedef struct andna_cache andna_cache
typedef struct counter_c counter_c
typedef struct lcl_cache lcl_cache

Function Documentation

andna_cache_queue* ac_queue_add ( andna_cache ac,
char *  pubkey 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void ac_queue_del ( andna_cache ac,
andna_cache_queue acq 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void ac_queue_del_expired ( andna_cache ac)

Here is the call graph for this function:

Here is the caller graph for this function:

void ac_queue_destroy ( andna_cache ac)

Here is the call graph for this function:

Here is the caller graph for this function:

andna_cache_queue* ac_queue_findpubk ( andna_cache ac,
char *  pubk 
)

Here is the caller graph for this function:

int add_resolv_conf ( char *  hname,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

andna_cache* andna_cache_addhash ( int  hash[4])

Here is the call graph for this function:

Here is the caller graph for this function:

void andna_cache_del_expired ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

int andna_cache_del_ifexpired ( andna_cache ac)

Here is the call graph for this function:

Here is the caller graph for this function:

void andna_cache_destroy ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

andna_cache* andna_cache_findhash ( int  hash[4])

Here is the caller graph for this function:

andna_cache* andna_cache_gethash ( int  hash[4])

Here is the call graph for this function:

Here is the caller graph for this function:

void andna_caches_init ( int  family)

Here is the caller graph for this function:

counter_c_hashes* cc_findhash ( counter_c cc,
int  hash[4] 
)

Here is the caller graph for this function:

counter_c_hashes* cc_hashes_add ( counter_c cc,
int  hash[4] 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void cc_hashes_del ( counter_c cc,
counter_c_hashes cch 
)

Here is the caller graph for this function:

void cc_hashes_del_expired ( counter_c cc)

Here is the call graph for this function:

Here is the caller graph for this function:

void cc_hashes_destroy ( counter_c cc)

Here is the call graph for this function:

Here is the caller graph for this function:

counter_c* counter_c_add ( inet_prefix rip,
char *  pubkey 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void counter_c_del_expired ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

int counter_c_del_ifexpired ( counter_c cc)
void counter_c_destroy ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

counter_c* counter_c_findpubk ( char *  pubk)

Here is the caller graph for this function:

int del_resolv_conf ( char *  hname,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void lcl_cache_destroy ( lcl_cache head,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

lcl_cache* lcl_cache_find_hash ( lcl_cache alcl,
u_int  hash 
)

Here is the caller graph for this function:

lcl_cache* lcl_cache_find_hname ( lcl_cache head,
char *  hname 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void lcl_cache_free ( lcl_cache alcl)

Here is the call graph for this function:

Here is the caller graph for this function:

lcl_cache* lcl_cache_new ( char *  hname)

Here is the call graph for this function:

Here is the caller graph for this function:

void lcl_destroy_keyring ( lcl_cache_keyring keyring)

Here is the caller graph for this function:

lcl_cache* lcl_get_registered_hnames ( lcl_cache alcl)

Here is the call graph for this function:

Here is the caller graph for this function:

void lcl_new_keyring ( lcl_cache_keyring keyring)

Here is the call graph for this function:

Here is the caller graph for this function:

andna_cache* load_andna_cache ( char *  file,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

counter_c* load_counter_c ( char *  file,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int load_hostnames ( char *  file,
lcl_cache **  old_alcl_head,
int *  old_alcl_counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

lcl_cache* load_lcl_cache ( char *  file,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int load_lcl_keyring ( lcl_cache_keyring keyring,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

rh_cache* load_rh_cache ( char *  file,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int load_snsd ( char *  file,
lcl_cache alcl_head 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* pack_andna_cache ( andna_cache acache,
size_t *  pack_sz,
int  pack_type 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* pack_counter_cache ( counter_c countercache,
size_t *  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* pack_lcl_cache ( lcl_cache local_cache,
size_t *  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* pack_lcl_keyring ( lcl_cache_keyring keyring,
size_t *  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* pack_rh_cache ( rh_cache rhcache,
size_t *  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

rh_cache* rh_cache_add ( char *  hname,
time_t  timestamp 
)

Here is the call graph for this function:

rh_cache* rh_cache_add_hash ( u_int  hash,
time_t  timestamp 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void rh_cache_del ( rh_cache rhc)

Here is the call graph for this function:

Here is the caller graph for this function:

void rh_cache_del_expired ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

rh_cache* rh_cache_find_hash ( u_int  hash)

Here is the call graph for this function:

Here is the caller graph for this function:

rh_cache* rh_cache_find_hname ( char *  hname)

Here is the call graph for this function:

void rh_cache_flush ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

rh_cache* rh_cache_new ( char *  hname,
time_t  timestamp 
)

Here is the call graph for this function:

int save_andna_cache ( andna_cache acache,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int save_counter_c ( counter_c countercache,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int save_lcl_cache ( lcl_cache lcl,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int save_lcl_keyring ( lcl_cache_keyring keyring,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int save_rh_cache ( rh_cache rh,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

andna_cache* unpack_andna_cache ( char *  pack,
size_t  pack_sz,
int *  counter,
int  pack_type 
)

Here is the call graph for this function:

Here is the caller graph for this function:

counter_c* unpack_counter_cache ( char *  pack,
size_t  pack_sz,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

lcl_cache* unpack_lcl_cache ( char *  pack,
size_t  pack_sz,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int unpack_lcl_keyring ( lcl_cache_keyring keyring,
char *  pack,
size_t  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

rh_cache* unpack_rh_cache ( char *  pack,
size_t  pack_sz,
int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const int_info acq_body_iinfo
static
Initial value:
= { 3,
{ 1 , (1<<1) , (1<<1) },
{ 0, sizeof(time_t),
sizeof(time_t) + sizeof(u_short) + 140 },
{ 1, 1, 1 }
}
andna_cache* andna_c
int andna_c_counter
const int_info andna_cache_body_iinfo
static
Initial value:
= { 1,
{ (1<<1) },
{ ( 4 *sizeof(int)) +sizeof(char) },
{ 1 }
}
const int_info andna_cache_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
static
counter_c* andna_counter_c
lcl_cache* andna_lcl
rh_cache* andna_rhc
int cc_counter
const int_info counter_c_body_iinfo
static
Initial value:
= { 1,
{ (1<<1) },
{ 140 +sizeof(char) },
{ 1 }
}
const int_info counter_c_hashes_body_iinfo
static
Initial value:
= { 2,
{ 1 , (1<<1) },
{ 0, sizeof(time_t) },
{ 1, 1 }
}
const int_info counter_c_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
static
const int_info lcl_cache_pkt_body_iinfo
static
Initial value:
= { 2, { (1<<1) , 1 },
{ 0, sizeof(u_short) },
{ 1, 1 }
}
const int_info lcl_cache_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
static
int lcl_counter
lcl_cache_keyring lcl_keyring
const int_info lcl_keyring_pkt_hdr_iinfo
static
Initial value:
= { 2,
{ 1 , 1 },
{ 0, sizeof(u_int) },
{ 1, 1 }
}
const int_info rh_cache_pkt_body_iinfo
static
Initial value:
= { 3,
{ 1 , 1 , (1<<1) },
{ 0, sizeof(u_int)+sizeof(char),
sizeof(u_int)+sizeof(char)+sizeof(time_t) },
{ 1, 1, 1 }
}
const int_info rh_cache_pkt_hdr_iinfo = { 1, { (1<<1) }, { 0 }, { 1 } }
static
int rhc_counter