blob: fdde154b9b65b6bd0a6d705e43c1fc9ab5f06bf5 [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
akmhoque53f64222012-09-05 13:57:51 -050010#define NBR_DOWN 0
11#define NBR_ACTIVE 1
12
akmhoque8c50d0d2012-08-09 13:38:03 -050013struct name_prefix
14{
15 char *name;
16 int length;
17};
18
akmhoque28c45022012-08-09 15:38:02 -050019struct ndn_neighbor
20{
akmhoque53f64222012-09-05 13:57:51 -050021 struct name_prefix *neighbor;
akmhoque28c45022012-08-09 15:38:02 -050022 int face;
23 int status;
akmhoque53f64222012-09-05 13:57:51 -050024 char * last_lsdb_version;
akmhoqued79438d2012-08-27 13:31:42 -050025 int info_interest_timed_out;
akmhoque53f64222012-09-05 13:57:51 -050026 long int lsdb_synch_interval;
27 long int last_lsdb_requested;
28 int is_lsdb_send_interest_scheduled;
29 int metric;
akmhoque28c45022012-08-09 15:38:02 -050030};
31
akmhoque07dd8cc2012-08-16 10:23:01 -050032struct linkStateDatabase
33{
akmhoque53f64222012-09-05 13:57:51 -050034 char * version;
akmhoque902d57e2012-08-17 09:24:38 -050035 struct hashtb *adj_lsdb;
36 struct hashtb *name_lsdb;
akmhoque07dd8cc2012-08-16 10:23:01 -050037};
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;
akmhoque59980a52012-08-09 12:36:09 -050050
51 struct hashtb *adl;
52 struct hashtb *npl;
53
54 struct ccn *ccn;
akmhoque53f64222012-09-05 13:57:51 -050055 struct name_prefix *router_name;
akmhoque59980a52012-08-09 12:36:09 -050056
akmhoque07dd8cc2012-08-16 10:23:01 -050057 struct linkStateDatabase *lsdb;
58
akmhoque59980a52012-08-09 12:36:09 -050059 int is_synch_init;
akmhoquef71d9082012-08-22 12:51:53 -040060 long int nlsa_id;
akmhoqued79438d2012-08-27 13:31:42 -050061 int adj_build_flag;
62 long int adj_build_count;
akmhoque53f64222012-09-05 13:57:51 -050063 int is_build_adj_lsa_sheduled;
64 int is_send_lsdb_interest_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
akmhoque902d57e2012-08-17 09:24:38 -050076void init_nlsr(void);
akmhoque59980a52012-08-09 12:36:09 -050077
78void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result);
79void process_command_router_name(char *command);
80void process_command_ccnname(char *command);
81void process_command_ccnneighbor(char *command);
akmhoqued79438d2012-08-27 13:31:42 -050082void process_command_lsdb_synch_interval(char *command);
83void process_command_interest_retry(char *command);
84void process_command_interest_resend_time(char *command);
akmhoque59980a52012-08-09 12:36:09 -050085void process_conf_command(char *command);
86int readConfigFile(const char *filename);
87
akmhoque53f64222012-09-05 13:57:51 -050088void add_name_prefix_to_npl(struct name_prefix *np);
akmhoque28c45022012-08-09 15:38:02 -050089void print_name_prefix_from_npl(void);
90
akmhoque42098b12012-08-27 22:54:23 -050091void my_lock(void);
92void my_unlock(void);
akmhoque8a5babe2012-08-16 17:39:33 -050093
akmhoque59980a52012-08-09 12:36:09 -050094
akmhoque386081b2012-08-10 10:53:21 -050095
96void nlsr_destroy( void );
97
akmhoque59980a52012-08-09 12:36:09 -050098#endif