blob: 95087d33b9560e038a6e8e3792e85520ac0ef1ce [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
akmhoque59980a52012-08-09 12:36:09 -050010
akmhoque8c50d0d2012-08-09 13:38:03 -050011struct name_prefix
12{
13 char *name;
14 int length;
15};
16
akmhoque07dd8cc2012-08-16 10:23:01 -050017struct linkStateDatabase
18{
akmhoque902d57e2012-08-17 09:24:38 -050019 struct hashtb *name_lsdb;
akmhoque03004e62012-09-06 01:12:28 -050020 struct hashtb *adj_lsdb;
21 char *lsdb_version;
akmhoque07dd8cc2012-08-16 10:23:01 -050022};
23
akmhoque29c1db52012-09-07 14:47:43 -050024struct pneding_interest
25{
26 char *int_name;
27 int timed_out;
28};
29
akmhoque59980a52012-08-09 12:36:09 -050030struct nlsr
31{
32
33 struct ccn_closure in_interest;
34 struct ccn_closure in_content;
35 struct ccn_schedule *sched;
36 struct ccn_scheduled_event *event;
akmhoque1c9b92f2012-08-13 10:57:50 -050037 struct ccn_scheduled_event *event_send_lsdb_interest;
akmhoqued79438d2012-08-27 13:31:42 -050038 struct ccn_scheduled_event *event_send_info_interest;
39 struct ccn_scheduled_event *event_build_name_lsa;
40 struct ccn_scheduled_event *event_build_adj_lsa;
akmhoque29c1db52012-09-07 14:47:43 -050041 struct ccn_scheduled_event *event_calculate_route;
akmhoque59980a52012-08-09 12:36:09 -050042
43 struct hashtb *adl;
44 struct hashtb *npl;
akmhoque29c1db52012-09-07 14:47:43 -050045 struct hashtb *pit_alsa;
46 struct hashtb *map;
akmhoquefbfd0982012-09-09 20:59:03 -050047 struct hashtb *rev_map;
akmhoque3560cb62012-09-09 10:52:30 -050048 struct hashtb *npt;
49 struct hashtb *routing_table;
akmhoque59980a52012-08-09 12:36:09 -050050
akmhoque07dd8cc2012-08-16 10:23:01 -050051 struct linkStateDatabase *lsdb;
52
akmhoque03004e62012-09-06 01:12:28 -050053 struct ccn *ccn;
54 char *router_name;
55
56
57
akmhoque59980a52012-08-09 12:36:09 -050058 int is_synch_init;
akmhoquef71d9082012-08-22 12:51:53 -040059 long int nlsa_id;
akmhoqued79438d2012-08-27 13:31:42 -050060 int adj_build_flag;
61 long int adj_build_count;
akmhoque53f64222012-09-05 13:57:51 -050062 int is_build_adj_lsa_sheduled;
63 int is_send_lsdb_interest_scheduled;
akmhoque29c1db52012-09-07 14:47:43 -050064 int is_route_calculation_scheduled;
akmhoqued79438d2012-08-27 13:31:42 -050065
66 long int lsdb_synch_interval;
67 int interest_retry;
68 long int interest_resend_time;
akmhoque42098b12012-08-27 22:54:23 -050069
70 int semaphor;
akmhoqued79438d2012-08-27 13:31:42 -050071
akmhoque59980a52012-08-09 12:36:09 -050072};
73
74struct nlsr *nlsr;
75
akmhoque59980a52012-08-09 12:36:09 -050076void process_command_ccnneighbor(char *command);
akmhoque03004e62012-09-06 01:12:28 -050077void process_command_ccnname(char *command);
akmhoqued79438d2012-08-27 13:31:42 -050078void process_command_lsdb_synch_interval(char *command);
79void process_command_interest_retry(char *command);
80void process_command_interest_resend_time(char *command);
akmhoque59980a52012-08-09 12:36:09 -050081void process_conf_command(char *command);
82int readConfigFile(const char *filename);
83
akmhoqueffacaa82012-09-13 17:48:30 -050084void nlsr_lock(void);
85void nlsr_unlock(void);
86
akmhoque81c25e02012-09-10 14:50:33 -050087int init_nlsr(void);
akmhoque386081b2012-08-10 10:53:21 -050088void nlsr_destroy( void );
akmhoque03004e62012-09-06 01:12:28 -050089void nlsr_stop_signal_handler(int sig);
akmhoque386081b2012-08-10 10:53:21 -050090
akmhoque59980a52012-08-09 12:36:09 -050091#endif