blob: f113d52fe3452e51b05827b660a78d5af2b96eca [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
akmhoque3cced642012-09-24 16:20:20 -050012#define MULTI_PATH_FACE_NUM 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
akmhoque1ce71052012-09-13 22:51:32 -050019
akmhoque8c50d0d2012-08-09 13:38:03 -050020struct name_prefix
21{
22 char *name;
23 int length;
24};
25
akmhoque07dd8cc2012-08-16 10:23:01 -050026struct linkStateDatabase
27{
akmhoque902d57e2012-08-17 09:24:38 -050028 struct hashtb *name_lsdb;
akmhoque03004e62012-09-06 01:12:28 -050029 struct hashtb *adj_lsdb;
30 char *lsdb_version;
akmhoque07dd8cc2012-08-16 10:23:01 -050031};
32
akmhoque1ce71052012-09-13 22:51:32 -050033struct pending_interest
akmhoque29c1db52012-09-07 14:47:43 -050034{
35 char *int_name;
36 int timed_out;
37};
38
akmhoque59980a52012-08-09 12:36:09 -050039struct nlsr
40{
41
42 struct ccn_closure in_interest;
43 struct ccn_closure in_content;
44 struct ccn_schedule *sched;
45 struct ccn_scheduled_event *event;
akmhoque1c9b92f2012-08-13 10:57:50 -050046 struct ccn_scheduled_event *event_send_lsdb_interest;
akmhoqued79438d2012-08-27 13:31:42 -050047 struct ccn_scheduled_event *event_send_info_interest;
48 struct ccn_scheduled_event *event_build_name_lsa;
49 struct ccn_scheduled_event *event_build_adj_lsa;
akmhoque29c1db52012-09-07 14:47:43 -050050 struct ccn_scheduled_event *event_calculate_route;
akmhoque59980a52012-08-09 12:36:09 -050051
52 struct hashtb *adl;
53 struct hashtb *npl;
akmhoque29c1db52012-09-07 14:47:43 -050054 struct hashtb *pit_alsa;
55 struct hashtb *map;
akmhoquefbfd0982012-09-09 20:59:03 -050056 struct hashtb *rev_map;
akmhoque3560cb62012-09-09 10:52:30 -050057 struct hashtb *npt;
58 struct hashtb *routing_table;
akmhoque59980a52012-08-09 12:36:09 -050059
akmhoque07dd8cc2012-08-16 10:23:01 -050060 struct linkStateDatabase *lsdb;
61
akmhoque03004e62012-09-06 01:12:28 -050062 struct ccn *ccn;
63 char *router_name;
64
65
66
akmhoque59980a52012-08-09 12:36:09 -050067 int is_synch_init;
akmhoquef71d9082012-08-22 12:51:53 -040068 long int nlsa_id;
akmhoqued79438d2012-08-27 13:31:42 -050069 int adj_build_flag;
70 long int adj_build_count;
akmhoque53f64222012-09-05 13:57:51 -050071 int is_build_adj_lsa_sheduled;
72 int is_send_lsdb_interest_scheduled;
akmhoque29c1db52012-09-07 14:47:43 -050073 int is_route_calculation_scheduled;
akmhoqued79438d2012-08-27 13:31:42 -050074
75 long int lsdb_synch_interval;
76 int interest_retry;
77 long int interest_resend_time;
akmhoqueda5b6832012-09-13 22:33:55 -050078 long int lsa_refresh_time;
79 long int router_dead_interval;
akmhoque3cced642012-09-24 16:20:20 -050080 long int multi_path_face_num;
akmhoquebfefef22012-09-26 10:09:34 -050081 char *logDir;
akmhoque7b791452012-10-30 11:24:56 -050082 int detailed_logging;
83 int debugging;
akmhoque42098b12012-08-27 22:54:23 -050084
85 int semaphor;
akmhoqued79438d2012-08-27 13:31:42 -050086
akmhoque59980a52012-08-09 12:36:09 -050087};
88
89struct nlsr *nlsr;
90
akmhoque59980a52012-08-09 12:36:09 -050091void process_command_ccnneighbor(char *command);
akmhoque03004e62012-09-06 01:12:28 -050092void process_command_ccnname(char *command);
akmhoqued79438d2012-08-27 13:31:42 -050093void process_command_lsdb_synch_interval(char *command);
94void process_command_interest_retry(char *command);
95void process_command_interest_resend_time(char *command);
akmhoque59980a52012-08-09 12:36:09 -050096void process_conf_command(char *command);
97int readConfigFile(const char *filename);
98
akmhoqueffacaa82012-09-13 17:48:30 -050099void nlsr_lock(void);
100void nlsr_unlock(void);
101
akmhoque81c25e02012-09-10 14:50:33 -0500102int init_nlsr(void);
akmhoque386081b2012-08-10 10:53:21 -0500103void nlsr_destroy( void );
akmhoque03004e62012-09-06 01:12:28 -0500104void nlsr_stop_signal_handler(int sig);
akmhoque386081b2012-08-10 10:53:21 -0500105
akmhoque59980a52012-08-09 12:36:09 -0500106#endif