blob: 5b37c602b6e4ea5d7fa27143e812f431b42ba66a [file] [log] [blame]
akmhoque902d57e2012-08-17 09:24:38 -05001#ifndef _NLSR_LSDB_H_
2#define _NLSR_LSDB_H_
3
akmhoquef71d9082012-08-22 12:51:53 -04004
5#define LS_TYPE_ADJ 1
6#define LS_TYPE_NAME 2
7
akmhoque902d57e2012-08-17 09:24:38 -05008struct link
9{
akmhoque53f64222012-09-05 13:57:51 -050010 struct name_prefix *nbr;
akmhoque902d57e2012-08-17 09:24:38 -050011 int face;
12 int metric;
13};
14
akmhoquef71d9082012-08-22 12:51:53 -040015
16struct alsa_header
akmhoque902d57e2012-08-17 09:24:38 -050017{
akmhoquef71d9082012-08-22 12:51:53 -040018 unsigned int ls_type;
akmhoque53f64222012-09-05 13:57:51 -050019 char *orig_time;
20 struct name_prefix *orig_router;
21
akmhoquef71d9082012-08-22 12:51:53 -040022};
akmhoque902d57e2012-08-17 09:24:38 -050023
akmhoquef71d9082012-08-22 12:51:53 -040024struct alsa
25{
26 struct alsa_header *header;
akmhoque902d57e2012-08-17 09:24:38 -050027 int no_link;
akmhoque53f64222012-09-05 13:57:51 -050028 char *body;
akmhoque902d57e2012-08-17 09:24:38 -050029};
30
akmhoquef71d9082012-08-22 12:51:53 -040031struct nlsa_header
akmhoque902d57e2012-08-17 09:24:38 -050032{
akmhoquef71d9082012-08-22 12:51:53 -040033 unsigned int ls_type;
akmhoque53f64222012-09-05 13:57:51 -050034 char *orig_time;
akmhoquef71d9082012-08-22 12:51:53 -040035 long int ls_id;
akmhoque53f64222012-09-05 13:57:51 -050036 struct name_prefix *orig_router;
akmhoque8c1cdbf2012-08-26 21:09:11 -050037 unsigned int isValid;
akmhoque902d57e2012-08-17 09:24:38 -050038
akmhoque902d57e2012-08-17 09:24:38 -050039};
40
akmhoquef71d9082012-08-22 12:51:53 -040041struct nlsa
42{
43 struct nlsa_header *header;
akmhoque53f64222012-09-05 13:57:51 -050044 struct name_prefix *name_prefix;
akmhoquef71d9082012-08-22 12:51:53 -040045};
46
akmhoque53f64222012-09-05 13:57:51 -050047void set_new_lsdb_version(void);
akmhoquef71d9082012-08-22 12:51:53 -040048
akmhoque53f64222012-09-05 13:57:51 -050049void build_and_install_name_lsas(void);
50void build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,int isValid,char *np);
51void build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np);
52void build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id,int isValid,char *np);
akmhoquef71d9082012-08-22 12:51:53 -040053void print_name_lsa(struct nlsa *name_lsa);
akmhoque53f64222012-09-05 13:57:51 -050054void install_name_lsa(struct nlsa *name_lsa);
55char * make_name_lsa_key(char *orig_router, int ls_type, long int ls_id);
56void print_name_lsdb(void);
akmhoquef71d9082012-08-22 12:51:53 -040057
akmhoque53f64222012-09-05 13:57:51 -050058int build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
59void build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data);
60void build_adj_lsa(struct alsa * adj_lsa);
61void build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data);
62void install_adj_lsa(struct alsa * adj_lsa);
63void make_adj_lsa_key(char *key,struct alsa *adj_lsa);
64void print_adj_lsa_body(const char *body, int no_link);
65void print_adj_lsa(struct alsa * adj_lsa);
66void print_adj_lsdb(void);
akmhoqued79438d2012-08-27 13:31:42 -050067
akmhoque53f64222012-09-05 13:57:51 -050068char * get_name_lsdb_summary(void);
69char * get_adj_lsdb_summary(void);
70void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
71void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
72
73long int get_name_lsdb_num_element(void);
74long int get_adj_lsdb_num_element(void);
akmhoqued79438d2012-08-27 13:31:42 -050075
akmhoque902d57e2012-08-17 09:24:38 -050076#endif