blob: 1a3d70d99f55a9e61813ce5306b3270b21a5e718 [file] [log] [blame]
akmhoque29c1db52012-09-07 14:47:43 -05001#ifndef _NLSR_ROUTE_H_
2#define _NLSR_ROUTE_H_
3
4#define EMPTY_PARENT -12345
5#define INF_DISTANCE 2147483647
6
akmhoque810a5b52012-09-09 16:53:14 -05007#define NO_NEXT_HOP -12345
8#define NO_MAPPING_NUM -1
akmhoque3560cb62012-09-09 10:52:30 -05009
akmhoque29c1db52012-09-07 14:47:43 -050010struct map_entry
11{
12 char *router;
13 int mapping;
14};
15
akmhoque3560cb62012-09-09 10:52:30 -050016
17struct routing_table_entry
18{
19 char *dest_router;
akmhoquede61ba92012-09-20 22:19:12 -050020 struct hashtb *face_list;
21};
22
23struct face_list_entry
24{
akmhoque3560cb62012-09-09 10:52:30 -050025 int next_hop_face;
akmhoqueb77b95f2013-02-08 12:28:47 -060026 double route_cost;
akmhoquede61ba92012-09-20 22:19:12 -050027};
akmhoque3560cb62012-09-09 10:52:30 -050028
akmhoque29c1db52012-09-07 14:47:43 -050029int route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
30void make_map(void);
31void add_map_entry(char *router);
32void add_adj_data_to_map(char *orig_router, char *body, int no_link);
33void print_map(void);
34void assign_mapping_number(void);
35void make_adj_matrix(int **adj_matrix,int map_element);
36void init_adj_matrix(int **adj_matrix,int map_element);
37void print_adj_matrix(int **adj_matrix, int map_element);
38int get_mapping_no(char *router);
akmhoquede61ba92012-09-20 22:19:12 -050039void calculate_path(int **adj_matrix, long int *parent,long int *dist, long int V, long int S);
akmhoque29c1db52012-09-07 14:47:43 -050040void sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element);
41int is_not_explored(long int *Q, long int u,long int start, long int element);
42void print_path(long int *parent, long int dest);
43void print_all_path_from_source(long int *parent,long int source);
akmhoquefbfd0982012-09-09 20:59:03 -050044void add_rev_map_entry(long int mapping_number, char *router);
45void print_rev_map(void);
46char * get_router_from_rev_map(long int mapping_number);
akmhoque9fe296b2012-09-24 09:52:08 -050047int get_no_link_from_adj_matrix(int **adj_matrix,long int V, long int S);
48void get_links_from_adj_matrix(int **adj_matrix, long int V ,long int *links, long int *link_costs,long int S);
49void adjust_adj_matrix(int **adj_matrix, long int V, long int S, long int link,long int link_cost);
akmhoque29c1db52012-09-07 14:47:43 -050050
akmhoque3560cb62012-09-09 10:52:30 -050051/* Routing Table Relates function */
52
akmhoquede61ba92012-09-20 22:19:12 -050053int get_next_hop(char *dest_router,int *faces, int *route_costs);
54int get_number_of_next_hop(char *dest_router);
akmhoque3560cb62012-09-09 10:52:30 -050055void add_next_hop_router(char *dest_router);
56void add_next_hop_from_lsa_adj_body(char *body, int no_link);
57void print_routing_table(void);
akmhoque3cced642012-09-24 16:20:20 -050058void do_old_routing_table_updates(void);
59void clear_old_routing_table(void);
akmhoquede61ba92012-09-20 22:19:12 -050060void update_routing_table_with_new_route(long int *parent,long int *dist, long int source);
akmhoquefbfd0982012-09-09 20:59:03 -050061
62long int get_next_hop_from_calculation(long int *parent, long int dest,long int source);
63void print_all_next_hop(long int *parent,long int source);
akmhoquede61ba92012-09-20 22:19:12 -050064int does_face_exist_for_router(char *dest_router, int face_id);
akmhoque3560cb62012-09-09 10:52:30 -050065
akmhoqueb77b95f2013-02-08 12:28:47 -060066double get_hyperbolic_distance(long int source, long int dest);
67void sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element);
68void update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist);
69
akmhoque54a14f42013-02-24 06:16:20 -060070void destroy_routing_table_entry_comp(struct routing_table_entry *rte);
71void destroy_routing_table_entry(struct routing_table_entry *rte);
72void destroy_routing_table(void);
73void destroy_map(void);
74void destroy_rev_map(void);
75
akmhoque29c1db52012-09-07 14:47:43 -050076#endif