akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 1 | #ifndef _NLSR_H_ |
| 2 | #define _NLSR_H_ |
| 3 | |
| 4 | |
| 5 | #define LSDB_SYNCH_INTERVAL 300 |
| 6 | #define INTEREST_RETRY 3 |
| 7 | #define INTEREST_RESEND_TIME 15 |
| 8 | #define NLSR_LOCKED 1 |
| 9 | #define NLSR_UNLOCKED 0 |
| 10 | #define LSA_REFRESH_TIME 1800 |
| 11 | #define ROUTER_DEAD_INTERVAL 3600 |
akmhoque | 496c88f | 2013-02-08 05:24:18 -0600 | [diff] [blame^] | 12 | #define MAX_FACES_PER_PREFIX 0 |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 13 | |
| 14 | #define LINK_METRIC 10 |
| 15 | |
| 16 | #define NAME_LSA_VALID 1 |
| 17 | #define NAME_LSA_INVALID 0 |
| 18 | |
akmhoque | a37b52c | 2012-12-14 11:16:36 -0600 | [diff] [blame] | 19 | #define API_PORT 9999 |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 20 | |
| 21 | |
| 22 | struct name_prefix |
| 23 | { |
| 24 | char *name; |
| 25 | int length; |
| 26 | }; |
| 27 | |
| 28 | struct linkStateDatabase |
| 29 | { |
| 30 | struct hashtb *name_lsdb; |
| 31 | struct hashtb *adj_lsdb; |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 32 | struct hashtb *cor_lsdb; |
| 33 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 34 | char *lsdb_version; |
| 35 | }; |
| 36 | |
| 37 | struct pending_interest |
| 38 | { |
| 39 | char *int_name; |
| 40 | int timed_out; |
| 41 | }; |
| 42 | |
| 43 | struct nlsr |
| 44 | { |
| 45 | |
| 46 | struct ccn_closure in_interest; |
| 47 | struct ccn_closure in_content; |
| 48 | |
| 49 | struct ccns_name_closure *closure; |
| 50 | |
| 51 | struct ccns_slice *slice; |
| 52 | struct ccns_handle *ccns; |
| 53 | |
| 54 | struct ccn_schedule *sched; |
| 55 | struct ccn_scheduled_event *event; |
| 56 | struct ccn_scheduled_event *event_send_lsdb_interest; |
| 57 | struct ccn_scheduled_event *event_send_info_interest; |
| 58 | struct ccn_scheduled_event *event_build_name_lsa; |
| 59 | struct ccn_scheduled_event *event_build_adj_lsa; |
| 60 | struct ccn_scheduled_event *event_calculate_route; |
| 61 | |
| 62 | struct hashtb *adl; |
| 63 | struct hashtb *npl; |
| 64 | struct hashtb *pit_alsa; |
| 65 | struct hashtb *map; |
| 66 | struct hashtb *rev_map; |
| 67 | struct hashtb *npt; |
| 68 | struct hashtb *routing_table; |
| 69 | |
akmhoque | 09c0afa | 2012-12-14 09:27:00 -0600 | [diff] [blame] | 70 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 71 | struct linkStateDatabase *lsdb; |
| 72 | |
| 73 | struct ccn *ccn; |
| 74 | char *router_name; |
| 75 | |
| 76 | |
| 77 | |
| 78 | int is_synch_init; |
| 79 | long int nlsa_id; |
| 80 | int adj_build_flag; |
| 81 | long int adj_build_count; |
| 82 | int is_build_adj_lsa_sheduled; |
| 83 | int is_send_lsdb_interest_scheduled; |
| 84 | int is_route_calculation_scheduled; |
| 85 | |
| 86 | long int lsdb_synch_interval; |
| 87 | int interest_retry; |
| 88 | long int interest_resend_time; |
| 89 | long int lsa_refresh_time; |
| 90 | long int router_dead_interval; |
akmhoque | 496c88f | 2013-02-08 05:24:18 -0600 | [diff] [blame^] | 91 | //long int multi_path_face_num; |
| 92 | long int max_faces_per_prefix; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 93 | char *logDir; |
| 94 | int detailed_logging; |
| 95 | int debugging; |
| 96 | |
| 97 | int semaphor; |
| 98 | |
| 99 | int nlsr_api_server_sock_fd; |
| 100 | fd_set readfds; |
| 101 | int api_port; |
| 102 | |
| 103 | char *topo_prefix; |
| 104 | char *slice_prefix; |
akmhoque | 09c0afa | 2012-12-14 09:27:00 -0600 | [diff] [blame] | 105 | |
| 106 | int is_hyperbolic_calc; |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 107 | double cor_r; |
| 108 | double cor_theta; |
akmhoque | 596f708 | 2013-02-04 13:34:13 -0600 | [diff] [blame] | 109 | |
| 110 | int tunnel_type; |
akmhoque | ed418f3 | 2013-01-30 12:25:04 -0600 | [diff] [blame] | 111 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 112 | |
| 113 | }; |
| 114 | |
| 115 | struct nlsr *nlsr; |
| 116 | |
| 117 | void process_command_ccnneighbor(char *command); |
| 118 | void process_command_ccnname(char *command); |
| 119 | void process_command_lsdb_synch_interval(char *command); |
| 120 | void process_command_interest_retry(char *command); |
| 121 | void process_command_interest_resend_time(char *command); |
| 122 | void process_conf_command(char *command); |
| 123 | int readConfigFile(const char *filename); |
| 124 | |
| 125 | void nlsr_lock(void); |
| 126 | void nlsr_unlock(void); |
| 127 | |
| 128 | int init_nlsr(void); |
| 129 | void nlsr_destroy( void ); |
| 130 | void nlsr_stop_signal_handler(int sig); |
| 131 | |
| 132 | #endif |