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 | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 10 | #define NBR_DOWN 0 |
| 11 | #define NBR_ACTIVE 1 |
| 12 | |
akmhoque | 8c50d0d | 2012-08-09 13:38:03 -0500 | [diff] [blame] | 13 | struct name_prefix |
| 14 | { |
| 15 | char *name; |
| 16 | int length; |
| 17 | }; |
| 18 | |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 19 | struct ndn_neighbor |
| 20 | { |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 21 | struct name_prefix *neighbor; |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 22 | int face; |
| 23 | int status; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 24 | char * last_lsdb_version; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 25 | int info_interest_timed_out; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 26 | long int lsdb_synch_interval; |
| 27 | long int last_lsdb_requested; |
| 28 | int is_lsdb_send_interest_scheduled; |
| 29 | int metric; |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 30 | }; |
| 31 | |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 32 | struct linkStateDatabase |
| 33 | { |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 34 | char * version; |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 35 | struct hashtb *adj_lsdb; |
| 36 | struct hashtb *name_lsdb; |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 37 | }; |
| 38 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 39 | struct nlsr |
| 40 | { |
| 41 | |
| 42 | struct ccn_closure in_interest; |
| 43 | struct ccn_closure in_content; |
| 44 | struct ccn_schedule *sched; |
| 45 | struct ccn_scheduled_event *event; |
akmhoque | 1c9b92f | 2012-08-13 10:57:50 -0500 | [diff] [blame] | 46 | struct ccn_scheduled_event *event_send_lsdb_interest; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 47 | struct ccn_scheduled_event *event_send_info_interest; |
| 48 | struct ccn_scheduled_event *event_build_name_lsa; |
| 49 | struct ccn_scheduled_event *event_build_adj_lsa; |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 50 | |
| 51 | struct hashtb *adl; |
| 52 | struct hashtb *npl; |
| 53 | |
| 54 | struct ccn *ccn; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 55 | struct name_prefix *router_name; |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 56 | |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 57 | struct linkStateDatabase *lsdb; |
| 58 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 59 | int is_synch_init; |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 60 | long int nlsa_id; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 61 | int adj_build_flag; |
| 62 | long int adj_build_count; |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 63 | int is_build_adj_lsa_sheduled; |
| 64 | int is_send_lsdb_interest_scheduled; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 65 | |
| 66 | long int lsdb_synch_interval; |
| 67 | int interest_retry; |
| 68 | long int interest_resend_time; |
akmhoque | 42098b1 | 2012-08-27 22:54:23 -0500 | [diff] [blame] | 69 | |
| 70 | int semaphor; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 71 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | struct nlsr *nlsr; |
| 75 | |
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 76 | void init_nlsr(void); |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 77 | |
| 78 | void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result); |
| 79 | void process_command_router_name(char *command); |
| 80 | void process_command_ccnname(char *command); |
| 81 | void process_command_ccnneighbor(char *command); |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 82 | void process_command_lsdb_synch_interval(char *command); |
| 83 | void process_command_interest_retry(char *command); |
| 84 | void process_command_interest_resend_time(char *command); |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 85 | void process_conf_command(char *command); |
| 86 | int readConfigFile(const char *filename); |
| 87 | |
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame^] | 88 | void add_name_prefix_to_npl(struct name_prefix *np); |
akmhoque | 28c4502 | 2012-08-09 15:38:02 -0500 | [diff] [blame] | 89 | void print_name_prefix_from_npl(void); |
| 90 | |
akmhoque | 42098b1 | 2012-08-27 22:54:23 -0500 | [diff] [blame] | 91 | void my_lock(void); |
| 92 | void my_unlock(void); |
akmhoque | 8a5babe | 2012-08-16 17:39:33 -0500 | [diff] [blame] | 93 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 94 | |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 95 | |
| 96 | void nlsr_destroy( void ); |
| 97 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 98 | #endif |