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 |
| 12 | #define MULTI_PATH_FACE_NUM 0 |
| 13 | |
| 14 | #define LINK_METRIC 10 |
| 15 | |
| 16 | #define NAME_LSA_VALID 1 |
| 17 | #define NAME_LSA_INVALID 0 |
| 18 | |
| 19 | #define API_PORT 9696 |
| 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; |
| 32 | char *lsdb_version; |
| 33 | }; |
| 34 | |
| 35 | struct pending_interest |
| 36 | { |
| 37 | char *int_name; |
| 38 | int timed_out; |
| 39 | }; |
| 40 | |
| 41 | struct nlsr |
| 42 | { |
| 43 | |
| 44 | struct ccn_closure in_interest; |
| 45 | struct ccn_closure in_content; |
| 46 | |
| 47 | struct ccns_name_closure *closure; |
| 48 | |
| 49 | struct ccns_slice *slice; |
| 50 | struct ccns_handle *ccns; |
| 51 | |
| 52 | struct ccn_schedule *sched; |
| 53 | struct ccn_scheduled_event *event; |
| 54 | struct ccn_scheduled_event *event_send_lsdb_interest; |
| 55 | struct ccn_scheduled_event *event_send_info_interest; |
| 56 | struct ccn_scheduled_event *event_build_name_lsa; |
| 57 | struct ccn_scheduled_event *event_build_adj_lsa; |
| 58 | struct ccn_scheduled_event *event_calculate_route; |
| 59 | |
| 60 | struct hashtb *adl; |
| 61 | struct hashtb *npl; |
| 62 | struct hashtb *pit_alsa; |
| 63 | struct hashtb *map; |
| 64 | struct hashtb *rev_map; |
| 65 | struct hashtb *npt; |
| 66 | struct hashtb *routing_table; |
| 67 | |
akmhoque | 09c0afa | 2012-12-14 09:27:00 -0600 | [diff] [blame^] | 68 | |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 69 | struct linkStateDatabase *lsdb; |
| 70 | |
| 71 | struct ccn *ccn; |
| 72 | char *router_name; |
| 73 | |
| 74 | |
| 75 | |
| 76 | int is_synch_init; |
| 77 | long int nlsa_id; |
| 78 | int adj_build_flag; |
| 79 | long int adj_build_count; |
| 80 | int is_build_adj_lsa_sheduled; |
| 81 | int is_send_lsdb_interest_scheduled; |
| 82 | int is_route_calculation_scheduled; |
| 83 | |
| 84 | long int lsdb_synch_interval; |
| 85 | int interest_retry; |
| 86 | long int interest_resend_time; |
| 87 | long int lsa_refresh_time; |
| 88 | long int router_dead_interval; |
| 89 | long int multi_path_face_num; |
| 90 | char *logDir; |
| 91 | int detailed_logging; |
| 92 | int debugging; |
| 93 | |
| 94 | int semaphor; |
| 95 | |
| 96 | int nlsr_api_server_sock_fd; |
| 97 | fd_set readfds; |
| 98 | int api_port; |
| 99 | |
| 100 | char *topo_prefix; |
| 101 | char *slice_prefix; |
akmhoque | 09c0afa | 2012-12-14 09:27:00 -0600 | [diff] [blame^] | 102 | |
| 103 | int is_hyperbolic_calc; |
akmhoque | 8fdd641 | 2012-12-04 15:05:33 -0600 | [diff] [blame] | 104 | |
| 105 | }; |
| 106 | |
| 107 | struct nlsr *nlsr; |
| 108 | |
| 109 | void process_command_ccnneighbor(char *command); |
| 110 | void process_command_ccnname(char *command); |
| 111 | void process_command_lsdb_synch_interval(char *command); |
| 112 | void process_command_interest_retry(char *command); |
| 113 | void process_command_interest_resend_time(char *command); |
| 114 | void process_conf_command(char *command); |
| 115 | int readConfigFile(const char *filename); |
| 116 | |
| 117 | void nlsr_lock(void); |
| 118 | void nlsr_unlock(void); |
| 119 | |
| 120 | int init_nlsr(void); |
| 121 | void nlsr_destroy( void ); |
| 122 | void nlsr_stop_signal_handler(int sig); |
| 123 | |
| 124 | #endif |