akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 1 | #ifndef _NLSR_H_ |
2 | #define _NLSR_H_ | ||||
3 | |||||
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 4 | |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 5 | #define LSDB_SYNCH_INTERVAL 300 |
6 | #define INTEREST_RETRY 3 | ||||
7 | #define INTEREST_RESEND_TIME 15 | ||||
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 8 | #define NLSR_LOCKED 1 |
9 | #define NLSR_UNLOCKED 0 | ||||
akmhoque | d515212 | 2012-09-19 06:44:23 -0500 | [diff] [blame^] | 10 | #define LSA_REFRESH_TIME 1800 |
11 | #define ROUTER_DEAD_INTERVAL 3600 | ||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 12 | |
akmhoque | 14b3f34 | 2012-09-14 10:39:02 -0500 | [diff] [blame] | 13 | #define LINK_METRIC 10 |
14 | |||||
15 | #define NAME_LSA_VALID 1 | ||||
16 | #define NAME_LSA_INVALID 0 | ||||
17 | |||||
akmhoque | 1ce7105 | 2012-09-13 22:51:32 -0500 | [diff] [blame] | 18 | |
akmhoque | 8c50d0d | 2012-08-09 13:38:03 -0500 | [diff] [blame] | 19 | struct name_prefix |
20 | { | ||||
21 | char *name; | ||||
22 | int length; | ||||
23 | }; | ||||
24 | |||||
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 25 | struct linkStateDatabase |
26 | { | ||||
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 27 | struct hashtb *name_lsdb; |
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 28 | struct hashtb *adj_lsdb; |
29 | char *lsdb_version; | ||||
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 30 | }; |
31 | |||||
akmhoque | 1ce7105 | 2012-09-13 22:51:32 -0500 | [diff] [blame] | 32 | struct pending_interest |
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 33 | { |
34 | char *int_name; | ||||
35 | int timed_out; | ||||
36 | }; | ||||
37 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 38 | struct nlsr |
39 | { | ||||
40 | |||||
41 | struct ccn_closure in_interest; | ||||
42 | struct ccn_closure in_content; | ||||
43 | struct ccn_schedule *sched; | ||||
44 | struct ccn_scheduled_event *event; | ||||
akmhoque | 1c9b92f | 2012-08-13 10:57:50 -0500 | [diff] [blame] | 45 | struct ccn_scheduled_event *event_send_lsdb_interest; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 46 | struct ccn_scheduled_event *event_send_info_interest; |
47 | struct ccn_scheduled_event *event_build_name_lsa; | ||||
48 | struct ccn_scheduled_event *event_build_adj_lsa; | ||||
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 49 | struct ccn_scheduled_event *event_calculate_route; |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 50 | |
51 | struct hashtb *adl; | ||||
52 | struct hashtb *npl; | ||||
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 53 | struct hashtb *pit_alsa; |
54 | struct hashtb *map; | ||||
akmhoque | fbfd098 | 2012-09-09 20:59:03 -0500 | [diff] [blame] | 55 | struct hashtb *rev_map; |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 56 | struct hashtb *npt; |
57 | struct hashtb *routing_table; | ||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 58 | |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 59 | struct linkStateDatabase *lsdb; |
60 | |||||
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 61 | struct ccn *ccn; |
62 | char *router_name; | ||||
63 | |||||
64 | |||||
65 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 66 | int is_synch_init; |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 67 | long int nlsa_id; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 68 | int adj_build_flag; |
69 | long int adj_build_count; | ||||
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 70 | int is_build_adj_lsa_sheduled; |
71 | int is_send_lsdb_interest_scheduled; | ||||
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 72 | int is_route_calculation_scheduled; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 73 | |
74 | long int lsdb_synch_interval; | ||||
75 | int interest_retry; | ||||
76 | long int interest_resend_time; | ||||
akmhoque | da5b683 | 2012-09-13 22:33:55 -0500 | [diff] [blame] | 77 | long int lsa_refresh_time; |
78 | long int router_dead_interval; | ||||
akmhoque | 42098b1 | 2012-08-27 22:54:23 -0500 | [diff] [blame] | 79 | |
80 | int semaphor; | ||||
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 81 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 82 | }; |
83 | |||||
84 | struct nlsr *nlsr; | ||||
85 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 86 | void process_command_ccnneighbor(char *command); |
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 87 | void process_command_ccnname(char *command); |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 88 | void process_command_lsdb_synch_interval(char *command); |
89 | void process_command_interest_retry(char *command); | ||||
90 | void process_command_interest_resend_time(char *command); | ||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 91 | void process_conf_command(char *command); |
92 | int readConfigFile(const char *filename); | ||||
93 | |||||
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 94 | void nlsr_lock(void); |
95 | void nlsr_unlock(void); | ||||
96 | |||||
akmhoque | 81c25e0 | 2012-09-10 14:50:33 -0500 | [diff] [blame] | 97 | int init_nlsr(void); |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 98 | void nlsr_destroy( void ); |
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 99 | void nlsr_stop_signal_handler(int sig); |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 100 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 101 | #endif |