blob: 144742c0b9a5afe181ed96deb67c2b494d90f230 [file] [log] [blame]
akmhoque59980a52012-08-09 12:36:09 -05001#ifndef _NLSR_H_
2#define _NLSR_H_
3
4#define LSA_ADJ_TYPE 1
5#define LSA_NAME_TYPE 2
akmhoqued79438d2012-08-27 13:31:42 -05006#define LSDB_SYNCH_INTERVAL 300
7#define INTEREST_RETRY 3
8#define INTEREST_RESEND_TIME 15
akmhoque59980a52012-08-09 12:36:09 -05009
akmhoque8c50d0d2012-08-09 13:38:03 -050010struct name_prefix
11{
12 char *name;
13 int length;
14};
15
akmhoque28c45022012-08-09 15:38:02 -050016struct ndn_neighbor
17{
akmhoquea6817692012-08-21 13:50:01 -040018 struct ccn_charbuf *neighbor;
akmhoque28c45022012-08-09 15:38:02 -050019 int face;
20 int status;
akmhoquef6432c22012-08-21 13:18:05 -040021 long int last_lsdb_version;
akmhoqued79438d2012-08-27 13:31:42 -050022 int info_interest_timed_out;
akmhoque386081b2012-08-10 10:53:21 -050023 struct hashtb *lsa_update_queue;
akmhoque28c45022012-08-09 15:38:02 -050024};
25
akmhoque07dd8cc2012-08-16 10:23:01 -050026struct linkStateDatabase
27{
akmhoquef6432c22012-08-21 13:18:05 -040028 long int version;
akmhoque902d57e2012-08-17 09:24:38 -050029 struct hashtb *adj_lsdb;
30 struct hashtb *name_lsdb;
akmhoque07dd8cc2012-08-16 10:23:01 -050031};
32
akmhoque59980a52012-08-09 12:36:09 -050033struct nlsr
34{
35
36 struct ccn_closure in_interest;
37 struct ccn_closure in_content;
38 struct ccn_schedule *sched;
39 struct ccn_scheduled_event *event;
akmhoque1c9b92f2012-08-13 10:57:50 -050040 struct ccn_scheduled_event *event_send_lsdb_interest;
akmhoqued79438d2012-08-27 13:31:42 -050041 struct ccn_scheduled_event *event_send_info_interest;
42 struct ccn_scheduled_event *event_build_name_lsa;
43 struct ccn_scheduled_event *event_build_adj_lsa;
akmhoque59980a52012-08-09 12:36:09 -050044
45 struct hashtb *adl;
46 struct hashtb *npl;
47
48 struct ccn *ccn;
49 char *router_name;
50
akmhoque07dd8cc2012-08-16 10:23:01 -050051 struct linkStateDatabase *lsdb;
52
akmhoque59980a52012-08-09 12:36:09 -050053 int is_synch_init;
akmhoquef71d9082012-08-22 12:51:53 -040054 long int nlsa_id;
akmhoqued79438d2012-08-27 13:31:42 -050055 int adj_build_flag;
56 long int adj_build_count;
57
58 long int lsdb_synch_interval;
59 int interest_retry;
60 long int interest_resend_time;
akmhoque42098b12012-08-27 22:54:23 -050061
62 int semaphor;
akmhoqued79438d2012-08-27 13:31:42 -050063
akmhoque59980a52012-08-09 12:36:09 -050064};
65
66struct nlsr *nlsr;
67
akmhoque902d57e2012-08-17 09:24:38 -050068void init_nlsr(void);
akmhoque59980a52012-08-09 12:36:09 -050069
70void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result);
71void process_command_router_name(char *command);
72void process_command_ccnname(char *command);
73void process_command_ccnneighbor(char *command);
akmhoqued79438d2012-08-27 13:31:42 -050074void process_command_lsdb_synch_interval(char *command);
75void process_command_interest_retry(char *command);
76void process_command_interest_resend_time(char *command);
akmhoque59980a52012-08-09 12:36:09 -050077void process_conf_command(char *command);
78int readConfigFile(const char *filename);
79
akmhoque28c45022012-08-09 15:38:02 -050080void add_name_prefix_to_npl(struct name_prefix *name_prefix);
81void print_name_prefix_from_npl(void);
82
akmhoque42098b12012-08-27 22:54:23 -050083void my_lock(void);
84void my_unlock(void);
akmhoque8a5babe2012-08-16 17:39:33 -050085
akmhoque59980a52012-08-09 12:36:09 -050086
akmhoque386081b2012-08-10 10:53:21 -050087
88void nlsr_destroy( void );
89
akmhoque59980a52012-08-09 12:36:09 -050090#endif