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 | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 12 | #define MAX_FACES_PER_PREFIX 0 |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 13 | |
akmhoque | 14b3f34 | 2012-09-14 10:39:02 -0500 | [diff] [blame] | 14 | #define LINK_METRIC 10 |
15 | |||||
16 | #define NAME_LSA_VALID 1 | ||||
17 | #define NAME_LSA_INVALID 0 | ||||
18 | |||||
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 19 | #define API_PORT 9999 |
akmhoque | 9504180 | 2012-11-16 09:18:02 -0600 | [diff] [blame] | 20 | |
akmhoque | 1ce7105 | 2012-09-13 22:51:32 -0500 | [diff] [blame] | 21 | |
akmhoque | 8c50d0d | 2012-08-09 13:38:03 -0500 | [diff] [blame] | 22 | struct name_prefix |
23 | { | ||||
24 | char *name; | ||||
25 | int length; | ||||
26 | }; | ||||
27 | |||||
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 28 | struct linkStateDatabase |
29 | { | ||||
akmhoque | 902d57e | 2012-08-17 09:24:38 -0500 | [diff] [blame] | 30 | struct hashtb *name_lsdb; |
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 31 | struct hashtb *adj_lsdb; |
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 32 | struct hashtb *cor_lsdb; |
33 | |||||
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 34 | char *lsdb_version; |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 35 | }; |
36 | |||||
akmhoque | 1ce7105 | 2012-09-13 22:51:32 -0500 | [diff] [blame] | 37 | struct pending_interest |
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 38 | { |
39 | char *int_name; | ||||
40 | int timed_out; | ||||
41 | }; | ||||
42 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 43 | struct nlsr |
44 | { | ||||
45 | |||||
46 | struct ccn_closure in_interest; | ||||
47 | struct ccn_closure in_content; | ||||
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 48 | |
49 | struct ccns_name_closure *closure; | ||||
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 50 | struct ccns_slice *slice; |
51 | struct ccns_handle *ccns; | ||||
52 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 53 | struct ccn_schedule *sched; |
54 | struct ccn_scheduled_event *event; | ||||
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 55 | struct ccn_scheduled_event *event_send_info_interest; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 56 | struct ccn_scheduled_event *event_build_adj_lsa; |
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 57 | struct ccn_scheduled_event *event_calculate_route; |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 58 | |
59 | struct hashtb *adl; | ||||
60 | struct hashtb *npl; | ||||
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 61 | struct hashtb *map; |
akmhoque | fbfd098 | 2012-09-09 20:59:03 -0500 | [diff] [blame] | 62 | struct hashtb *rev_map; |
akmhoque | 3560cb6 | 2012-09-09 10:52:30 -0500 | [diff] [blame] | 63 | struct hashtb *npt; |
64 | struct hashtb *routing_table; | ||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 65 | |
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 66 | |
akmhoque | 07dd8cc | 2012-08-16 10:23:01 -0500 | [diff] [blame] | 67 | struct linkStateDatabase *lsdb; |
68 | |||||
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 69 | struct ccn *ccn; |
70 | char *router_name; | ||||
71 | |||||
72 | |||||
73 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 74 | int is_synch_init; |
akmhoque | f71d908 | 2012-08-22 12:51:53 -0400 | [diff] [blame] | 75 | long int nlsa_id; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 76 | int adj_build_flag; |
77 | long int adj_build_count; | ||||
akmhoque | 53f6422 | 2012-09-05 13:57:51 -0500 | [diff] [blame] | 78 | int is_build_adj_lsa_sheduled; |
79 | int is_send_lsdb_interest_scheduled; | ||||
akmhoque | 29c1db5 | 2012-09-07 14:47:43 -0500 | [diff] [blame] | 80 | int is_route_calculation_scheduled; |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 81 | |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 82 | int interest_retry; |
83 | long int interest_resend_time; | ||||
akmhoque | da5b683 | 2012-09-13 22:33:55 -0500 | [diff] [blame] | 84 | long int lsa_refresh_time; |
85 | long int router_dead_interval; | ||||
akmhoque | 7adb277 | 2013-03-05 16:30:59 -0600 | [diff] [blame] | 86 | |
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 87 | long int max_faces_per_prefix; |
akmhoque | bfefef2 | 2012-09-26 10:09:34 -0500 | [diff] [blame] | 88 | char *logDir; |
akmhoque | 7b79145 | 2012-10-30 11:24:56 -0500 | [diff] [blame] | 89 | int detailed_logging; |
90 | int debugging; | ||||
akmhoque | 42098b1 | 2012-08-27 22:54:23 -0500 | [diff] [blame] | 91 | |
92 | int semaphor; | ||||
akmhoque | 1771c41 | 2012-11-09 13:06:08 -0600 | [diff] [blame] | 93 | |
94 | int nlsr_api_server_sock_fd; | ||||
95 | fd_set readfds; | ||||
akmhoque | 9504180 | 2012-11-16 09:18:02 -0600 | [diff] [blame] | 96 | int api_port; |
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 97 | |
98 | char *topo_prefix; | ||||
99 | char *slice_prefix; | ||||
100 | |||||
akmhoque | 7adb277 | 2013-03-05 16:30:59 -0600 | [diff] [blame] | 101 | char *root_key_prefix; |
102 | char *keystore_path; | ||||
103 | char *keystore_passphrase; | ||||
104 | char *site_name; | ||||
105 | |||||
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 106 | int is_hyperbolic_calc; |
107 | double cor_r; | ||||
108 | double cor_theta; | ||||
109 | |||||
akmhoque | b8dbba8 | 2013-03-11 11:34:17 -0500 | [diff] [blame] | 110 | int isStrictHierchicalKeyCheck; |
111 | |||||
akmhoque | b77b95f | 2013-02-08 12:28:47 -0600 | [diff] [blame] | 112 | int tunnel_type; |
113 | |||||
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 114 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 115 | }; |
116 | |||||
117 | struct nlsr *nlsr; | ||||
118 | |||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 119 | void process_command_ccnneighbor(char *command); |
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 120 | void process_command_ccnname(char *command); |
akmhoque | d79438d | 2012-08-27 13:31:42 -0500 | [diff] [blame] | 121 | void process_command_lsdb_synch_interval(char *command); |
122 | void process_command_interest_retry(char *command); | ||||
123 | void process_command_interest_resend_time(char *command); | ||||
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 124 | void process_conf_command(char *command); |
125 | int readConfigFile(const char *filename); | ||||
126 | |||||
akmhoque | ffacaa8 | 2012-09-13 17:48:30 -0500 | [diff] [blame] | 127 | void nlsr_lock(void); |
128 | void nlsr_unlock(void); | ||||
129 | |||||
akmhoque | 81c25e0 | 2012-09-10 14:50:33 -0500 | [diff] [blame] | 130 | int init_nlsr(void); |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 131 | void nlsr_destroy( void ); |
akmhoque | 03004e6 | 2012-09-06 01:12:28 -0500 | [diff] [blame] | 132 | void nlsr_stop_signal_handler(int sig); |
akmhoque | 386081b | 2012-08-10 10:53:21 -0500 | [diff] [blame] | 133 | |
akmhoque | 59980a5 | 2012-08-09 12:36:09 -0500 | [diff] [blame] | 134 | #endif |