blob: ea815ee0ac008610eb2f3068bfce2a710f1e6f2e [file] [log] [blame]
akmhoque59980a52012-08-09 12:36:09 -05001#ifndef _NLSR_H_
2#define _NLSR_H_
3
akmhoque03004e62012-09-06 01:12:28 -05004
akmhoqued79438d2012-08-27 13:31:42 -05005#define LSDB_SYNCH_INTERVAL 300
6#define INTEREST_RETRY 3
7#define INTEREST_RESEND_TIME 15
akmhoqueffacaa82012-09-13 17:48:30 -05008#define NLSR_LOCKED 1
9#define NLSR_UNLOCKED 0
akmhoqued5152122012-09-19 06:44:23 -050010#define LSA_REFRESH_TIME 1800
11#define ROUTER_DEAD_INTERVAL 3600
akmhoqueb77b95f2013-02-08 12:28:47 -060012#define MAX_FACES_PER_PREFIX 0
akmhoque59980a52012-08-09 12:36:09 -050013
akmhoque14b3f342012-09-14 10:39:02 -050014#define LINK_METRIC 10
15
16#define NAME_LSA_VALID 1
17#define NAME_LSA_INVALID 0
18
akmhoqueb77b95f2013-02-08 12:28:47 -060019#define API_PORT 9999
akmhoque95041802012-11-16 09:18:02 -060020
akmhoque1ce71052012-09-13 22:51:32 -050021
akmhoque8c50d0d2012-08-09 13:38:03 -050022struct name_prefix
23{
24 char *name;
25 int length;
26};
27
akmhoque07dd8cc2012-08-16 10:23:01 -050028struct linkStateDatabase
29{
akmhoque902d57e2012-08-17 09:24:38 -050030 struct hashtb *name_lsdb;
akmhoque03004e62012-09-06 01:12:28 -050031 struct hashtb *adj_lsdb;
akmhoqueb77b95f2013-02-08 12:28:47 -060032 struct hashtb *cor_lsdb;
33
akmhoque03004e62012-09-06 01:12:28 -050034 char *lsdb_version;
akmhoque07dd8cc2012-08-16 10:23:01 -050035};
36
akmhoque1ce71052012-09-13 22:51:32 -050037struct pending_interest
akmhoque29c1db52012-09-07 14:47:43 -050038{
39 char *int_name;
40 int timed_out;
41};
42
akmhoque59980a52012-08-09 12:36:09 -050043struct nlsr
44{
45
46 struct ccn_closure in_interest;
47 struct ccn_closure in_content;
akmhoqueb77b95f2013-02-08 12:28:47 -060048
49 struct ccns_name_closure *closure;
akmhoqueb77b95f2013-02-08 12:28:47 -060050 struct ccns_slice *slice;
51 struct ccns_handle *ccns;
52
akmhoque59980a52012-08-09 12:36:09 -050053 struct ccn_schedule *sched;
54 struct ccn_scheduled_event *event;
akmhoqued79438d2012-08-27 13:31:42 -050055 struct ccn_scheduled_event *event_send_info_interest;
akmhoque9635b852013-04-04 23:29:48 -050056 struct ccn_scheduled_event *event_send_lsdb_interest;
akmhoqued79438d2012-08-27 13:31:42 -050057 struct ccn_scheduled_event *event_build_adj_lsa;
akmhoque29c1db52012-09-07 14:47:43 -050058 struct ccn_scheduled_event *event_calculate_route;
akmhoque59980a52012-08-09 12:36:09 -050059
60 struct hashtb *adl;
61 struct hashtb *npl;
akmhoque29c1db52012-09-07 14:47:43 -050062 struct hashtb *map;
akmhoquefbfd0982012-09-09 20:59:03 -050063 struct hashtb *rev_map;
akmhoque3560cb62012-09-09 10:52:30 -050064 struct hashtb *npt;
65 struct hashtb *routing_table;
akmhoque237239c2013-03-18 10:29:26 -050066 struct hashtb *keys;
akmhoque59980a52012-08-09 12:36:09 -050067
akmhoqueb77b95f2013-02-08 12:28:47 -060068
akmhoque07dd8cc2012-08-16 10:23:01 -050069 struct linkStateDatabase *lsdb;
70
akmhoque03004e62012-09-06 01:12:28 -050071 struct ccn *ccn;
72 char *router_name;
73
74
75
akmhoque59980a52012-08-09 12:36:09 -050076 int is_synch_init;
akmhoquef71d9082012-08-22 12:51:53 -040077 long int nlsa_id;
akmhoqued79438d2012-08-27 13:31:42 -050078 int adj_build_flag;
79 long int adj_build_count;
akmhoque53f64222012-09-05 13:57:51 -050080 int is_build_adj_lsa_sheduled;
81 int is_send_lsdb_interest_scheduled;
akmhoque29c1db52012-09-07 14:47:43 -050082 int is_route_calculation_scheduled;
akmhoqued79438d2012-08-27 13:31:42 -050083
akmhoqued79438d2012-08-27 13:31:42 -050084 int interest_retry;
85 long int interest_resend_time;
akmhoqueda5b6832012-09-13 22:33:55 -050086 long int lsa_refresh_time;
87 long int router_dead_interval;
akmhoque7adb2772013-03-05 16:30:59 -060088
akmhoqueb77b95f2013-02-08 12:28:47 -060089 long int max_faces_per_prefix;
akmhoquebfefef22012-09-26 10:09:34 -050090 char *logDir;
akmhoque7b791452012-10-30 11:24:56 -050091 int detailed_logging;
92 int debugging;
akmhoque42098b12012-08-27 22:54:23 -050093
94 int semaphor;
akmhoque1771c412012-11-09 13:06:08 -060095
96 int nlsr_api_server_sock_fd;
97 fd_set readfds;
akmhoque95041802012-11-16 09:18:02 -060098 int api_port;
akmhoqueb77b95f2013-02-08 12:28:47 -060099
100 char *topo_prefix;
101 char *slice_prefix;
102
akmhoque7adb2772013-03-05 16:30:59 -0600103 char *root_key_prefix;
104 char *keystore_path;
105 char *keystore_passphrase;
106 char *site_name;
107
akmhoqueb77b95f2013-02-08 12:28:47 -0600108 int is_hyperbolic_calc;
109 double cor_r;
110 double cor_theta;
111
akmhoqueb8dbba82013-03-11 11:34:17 -0500112 int isStrictHierchicalKeyCheck;
113
akmhoqueb77b95f2013-02-08 12:28:47 -0600114 int tunnel_type;
115
akmhoqued79438d2012-08-27 13:31:42 -0500116
akmhoque59980a52012-08-09 12:36:09 -0500117};
118
119struct nlsr *nlsr;
120
akmhoque59980a52012-08-09 12:36:09 -0500121void process_command_ccnneighbor(char *command);
akmhoque03004e62012-09-06 01:12:28 -0500122void process_command_ccnname(char *command);
akmhoqued79438d2012-08-27 13:31:42 -0500123void process_command_lsdb_synch_interval(char *command);
124void process_command_interest_retry(char *command);
125void process_command_interest_resend_time(char *command);
akmhoque59980a52012-08-09 12:36:09 -0500126void process_conf_command(char *command);
127int readConfigFile(const char *filename);
128
akmhoqueffacaa82012-09-13 17:48:30 -0500129void nlsr_lock(void);
130void nlsr_unlock(void);
131
akmhoque81c25e02012-09-10 14:50:33 -0500132int init_nlsr(void);
akmhoque386081b2012-08-10 10:53:21 -0500133void nlsr_destroy( void );
akmhoque03004e62012-09-06 01:12:28 -0500134void nlsr_stop_signal_handler(int sig);
akmhoque386081b2012-08-10 10:53:21 -0500135
akmhoque59980a52012-08-09 12:36:09 -0500136#endif