akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 1 | #ifndef _NLSR_LSDB_H_ |
| 2 | #define _NLSR_LSDB_H_ |
| 3 | |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 4 | |
| 5 | #define LS_TYPE_ADJ 1 |
| 6 | #define LS_TYPE_NAME 2 |
| 7 | |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 8 | struct link |
| 9 | { |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 10 | struct name_prefix *nbr; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 11 | int face; |
| 12 | int metric; |
| 13 | }; |
| 14 | |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 15 | |
| 16 | struct alsa_header |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 17 | { |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 18 | unsigned int ls_type; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 19 | char *orig_time; |
| 20 | struct name_prefix *orig_router; |
| 21 | |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 22 | }; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 23 | |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 24 | struct alsa |
| 25 | { |
| 26 | struct alsa_header *header; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 27 | int no_link; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 28 | char *body; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 29 | }; |
| 30 | |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 31 | struct nlsa_header |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 32 | { |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 33 | unsigned int ls_type; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 34 | char *orig_time; |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 35 | long int ls_id; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 36 | struct name_prefix *orig_router; |
akmhoque | 8c1cdbf | 2012-08-26 21:09:11 -0500 | [diff] [blame] | 37 | unsigned int isValid; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 38 | |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 39 | }; |
| 40 | |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 41 | struct nlsa |
| 42 | { |
| 43 | struct nlsa_header *header; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 44 | struct name_prefix *name_prefix; |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 45 | }; |
| 46 | |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 47 | void set_new_lsdb_version(void); |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 48 | |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 49 | void build_and_install_name_lsas(void); |
| 50 | void build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,int isValid,char *np); |
| 51 | void build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np); |
| 52 | void build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id,int isValid,char *np); |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 53 | void print_name_lsa(struct nlsa *name_lsa); |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 54 | void install_name_lsa(struct nlsa *name_lsa); |
| 55 | char * make_name_lsa_key(char *orig_router, int ls_type, long int ls_id); |
| 56 | void print_name_lsdb(void); |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 57 | |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 58 | int build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags); |
| 59 | void build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data); |
| 60 | void build_adj_lsa(struct alsa * adj_lsa); |
| 61 | void build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data); |
| 62 | void install_adj_lsa(struct alsa * adj_lsa); |
| 63 | void make_adj_lsa_key(char *key,struct alsa *adj_lsa); |
| 64 | void print_adj_lsa_body(const char *body, int no_link); |
| 65 | void print_adj_lsa(struct alsa * adj_lsa); |
| 66 | void print_adj_lsdb(void); |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 67 | |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 68 | char * get_name_lsdb_summary(void); |
| 69 | char * get_adj_lsdb_summary(void); |
| 70 | void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId); |
| 71 | void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId); |
| 72 | |
| 73 | long int get_name_lsdb_num_element(void); |
| 74 | long int get_adj_lsdb_num_element(void); |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 75 | |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 76 | #endif |