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 | |
| 68 | struct linkStateDatabase *lsdb; |
| 69 | |
| 70 | struct ccn *ccn; |
| 71 | char *router_name; |
| 72 | |
| 73 | |
| 74 | |
| 75 | int is_synch_init; |
| 76 | long int nlsa_id; |
| 77 | int adj_build_flag; |
| 78 | long int adj_build_count; |
| 79 | int is_build_adj_lsa_sheduled; |
| 80 | int is_send_lsdb_interest_scheduled; |
| 81 | int is_route_calculation_scheduled; |
| 82 | |
| 83 | long int lsdb_synch_interval; |
| 84 | int interest_retry; |
| 85 | long int interest_resend_time; |
| 86 | long int lsa_refresh_time; |
| 87 | long int router_dead_interval; |
| 88 | long int multi_path_face_num; |
| 89 | char *logDir; |
| 90 | int detailed_logging; |
| 91 | int debugging; |
| 92 | |
| 93 | int semaphor; |
| 94 | |
| 95 | int nlsr_api_server_sock_fd; |
| 96 | fd_set readfds; |
| 97 | int api_port; |
| 98 | |
| 99 | char *topo_prefix; |
| 100 | char *slice_prefix; |
| 101 | |
| 102 | }; |
| 103 | |
| 104 | struct nlsr *nlsr; |
| 105 | |
| 106 | void process_command_ccnneighbor(char *command); |
| 107 | void process_command_ccnname(char *command); |
| 108 | void process_command_lsdb_synch_interval(char *command); |
| 109 | void process_command_interest_retry(char *command); |
| 110 | void process_command_interest_resend_time(char *command); |
| 111 | void process_conf_command(char *command); |
| 112 | int readConfigFile(const char *filename); |
| 113 | |
| 114 | void nlsr_lock(void); |
| 115 | void nlsr_unlock(void); |
| 116 | |
| 117 | int init_nlsr(void); |
| 118 | void nlsr_destroy( void ); |
| 119 | void nlsr_stop_signal_handler(int sig); |
| 120 | |
| 121 | #endif |