blob: 0cd71e8ea2837e42a90d9d4c8174a809e8e5a5f3 [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;
61
akmhoque59980a52012-08-09 12:36:09 -050062};
63
64struct nlsr *nlsr;
65
akmhoque902d57e2012-08-17 09:24:38 -050066void init_nlsr(void);
akmhoque59980a52012-08-09 12:36:09 -050067
68void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result);
69void process_command_router_name(char *command);
70void process_command_ccnname(char *command);
71void process_command_ccnneighbor(char *command);
akmhoqued79438d2012-08-27 13:31:42 -050072void process_command_lsdb_synch_interval(char *command);
73void process_command_interest_retry(char *command);
74void process_command_interest_resend_time(char *command);
akmhoque59980a52012-08-09 12:36:09 -050075void process_conf_command(char *command);
76int readConfigFile(const char *filename);
77
akmhoque28c45022012-08-09 15:38:02 -050078void add_name_prefix_to_npl(struct name_prefix *name_prefix);
79void print_name_prefix_from_npl(void);
80
81
akmhoque8a5babe2012-08-16 17:39:33 -050082
akmhoque59980a52012-08-09 12:36:09 -050083
akmhoque386081b2012-08-10 10:53:21 -050084
85void nlsr_destroy( void );
86
akmhoque59980a52012-08-09 12:36:09 -050087#endif