akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 1 | #ifndef _NLSR_H_ |
| 2 | #define _NLSR_H_ |
| 3 | |
| 4 | #define LSA_ADJ_TYPE 1 |
| 5 | #define LSA_NAME_TYPE 2 |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 6 | #define LSDB_SYNCH_INTERVAL 300 |
| 7 | #define INTEREST_RETRY 3 |
| 8 | #define INTEREST_RESEND_TIME 15 |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 9 | |
akmhoque | 8c50d0d | 2012-08-09 13:38:03 -0500 | [diff] [blame] | 10 | struct name_prefix |
| 11 | { |
| 12 | char *name; |
| 13 | int length; |
| 14 | }; |
| 15 | |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 16 | struct ndn_neighbor |
| 17 | { |
akmhoque | a681769 | 2012-08-21 13:50:01 -0400 | [diff] [blame] | 18 | struct ccn_charbuf *neighbor; |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 19 | int face; |
| 20 | int status; |
akmhoque | f6432c2 | 2012-08-21 13:18:05 -0400 | [diff] [blame] | 21 | long int last_lsdb_version; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 22 | int info_interest_timed_out; |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 23 | struct hashtb *lsa_update_queue; |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 24 | }; |
| 25 | |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 26 | struct linkStateDatabase |
| 27 | { |
akmhoque | f6432c2 | 2012-08-21 13:18:05 -0400 | [diff] [blame] | 28 | long int version; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 29 | struct hashtb *adj_lsdb; |
| 30 | struct hashtb *name_lsdb; |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 31 | }; |
| 32 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 33 | struct nlsr |
| 34 | { |
| 35 | |
| 36 | struct ccn_closure in_interest; |
| 37 | struct ccn_closure in_content; |
| 38 | struct ccn_schedule *sched; |
| 39 | struct ccn_scheduled_event *event; |
akmhoque | 1c9b92f | 2012-08-13 10:57:50 -0500 | [diff] [blame] | 40 | struct ccn_scheduled_event *event_send_lsdb_interest; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 41 | struct ccn_scheduled_event *event_send_info_interest; |
| 42 | struct ccn_scheduled_event *event_build_name_lsa; |
| 43 | struct ccn_scheduled_event *event_build_adj_lsa; |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 44 | |
| 45 | struct hashtb *adl; |
| 46 | struct hashtb *npl; |
| 47 | |
| 48 | struct ccn *ccn; |
| 49 | char *router_name; |
| 50 | |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 51 | struct linkStateDatabase *lsdb; |
| 52 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 53 | int is_synch_init; |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 54 | long int nlsa_id; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 55 | int adj_build_flag; |
| 56 | long int adj_build_count; |
| 57 | |
| 58 | long int lsdb_synch_interval; |
| 59 | int interest_retry; |
| 60 | long int interest_resend_time; |
| 61 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | struct nlsr *nlsr; |
| 65 | |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 66 | void init_nlsr(void); |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 67 | |
| 68 | void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result); |
| 69 | void process_command_router_name(char *command); |
| 70 | void process_command_ccnname(char *command); |
| 71 | void process_command_ccnneighbor(char *command); |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 72 | void process_command_lsdb_synch_interval(char *command); |
| 73 | void process_command_interest_retry(char *command); |
| 74 | void process_command_interest_resend_time(char *command); |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 75 | void process_conf_command(char *command); |
| 76 | int readConfigFile(const char *filename); |
| 77 | |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 78 | void add_name_prefix_to_npl(struct name_prefix *name_prefix); |
| 79 | void print_name_prefix_from_npl(void); |
| 80 | |
| 81 | |
akmhoque | 8a5babe | 2012-08-16 17:39:33 -0500 | [diff] [blame] | 82 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 83 | |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 84 | |
| 85 | void nlsr_destroy( void ); |
| 86 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 87 | #endif |