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