blob: 4e8a8d1fcd6d514e95aed6013b29640737ab48f1 [file] [log] [blame]
akmhoque8fdd6412012-12-04 15:05:33 -06001#ifndef _NLSR_LSDB_H_
2#define _NLSR_LSDB_H_
3
4#define LS_TYPE_ADJ 1
5#define LS_TYPE_NAME 2
6
7struct link
8{
9 struct name_prefix *nbr;
10 int face;
11 int metric;
12};
13
14
15struct alsa_header
16{
17 unsigned int ls_type;
18 char *orig_time;
19 struct name_prefix *orig_router;
20
21};
22
23struct alsa
24{
25 struct alsa_header *header;
26 int no_link;
27 struct link *links;
28 char * body;
29};
30
31struct nlsa_header
32{
33 unsigned int ls_type;
34 char *orig_time;
35 long int ls_id;
36 struct name_prefix *orig_router;
37 unsigned int isValid;
38
39};
40
41struct nlsa
42{
43 struct nlsa_header *header;
44 struct name_prefix *name_prefix;
45};
46
47
48void set_new_lsdb_version(void);
49void build_and_install_name_lsas(void);
50void build_and_install_single_name_lsa(struct name_prefix *np);
51void build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np);
52void install_name_lsa(struct nlsa *name_lsa);
53void print_name_lsa(struct nlsa *name_lsa);
54void write_log_for_name_lsa(struct nlsa *name_lsa);
55void print_name_lsdb(void);
56void build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np);
57void build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id, char *orig_time, int isValid, char *np);
58void make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id);
59int refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
60
61int build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
62void build_adj_lsa(struct alsa * adj_lsa);
63void install_adj_lsa(struct alsa * adj_lsa);
64void print_adj_lsa_body(const char *body, int no_link);
65void print_adj_lsa(struct alsa * adj_lsa);
66void write_log_for_adj_lsa(struct alsa * adj_lsa);
67void print_adj_lsdb(void);
68void make_adj_lsa_key(char *key,struct alsa *adj_lsa);
69void build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data);
70void build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data);
71
72long int get_name_lsdb_num_element(void);
73long int get_adj_lsdb_num_element(void);
74
75void get_name_lsdb_summary(struct ccn_charbuf *name_lsdb_data);
76void get_adj_lsdb_summary(struct ccn_charbuf *adj_lsdb_data);
77void get_lsdb_summary(struct ccn_charbuf *lsdb_data);
78
79int check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time);
80int check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time);
81
82void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
83void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
84
85void make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id);
86
87void write_name_lsdb_to_repo(char *slice_prefix);
88void write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
89void make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix);
90
91#endif