blob: b6dff031082ee716e4ac2f76b6b22d9cace2039a [file] [log] [blame]
akmhoque8fdd6412012-12-04 15:05:33 -06001#ifndef _NLSR_ROUTE_H_
2#define _NLSR_ROUTE_H_
3
4#define EMPTY_PARENT -12345
5#define INF_DISTANCE 2147483647
6
7#define NO_NEXT_HOP -12345
8#define NO_MAPPING_NUM -1
9
10struct map_entry
11{
12 char *router;
13 int mapping;
14};
15
16
17struct routing_table_entry
18{
19 char *dest_router;
20 //int next_hop_face;
21 struct hashtb *face_list;
22};
23
24struct face_list_entry
25{
26 int next_hop_face;
akmhoquef06586e2013-02-05 12:09:38 -060027 double route_cost;
akmhoque8fdd6412012-12-04 15:05:33 -060028};
29
30int route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
31void make_map(void);
32void add_map_entry(char *router);
33void add_adj_data_to_map(char *orig_router, char *body, int no_link);
34void print_map(void);
35void assign_mapping_number(void);
36void make_adj_matrix(int **adj_matrix,int map_element);
37void init_adj_matrix(int **adj_matrix,int map_element);
38void print_adj_matrix(int **adj_matrix, int map_element);
39int get_mapping_no(char *router);
40void calculate_path(int **adj_matrix, long int *parent,long int *dist, long int V, long int S);
41void sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element);
42int is_not_explored(long int *Q, long int u,long int start, long int element);
43void print_path(long int *parent, long int dest);
44void print_all_path_from_source(long int *parent,long int source);
45void add_rev_map_entry(long int mapping_number, char *router);
46void print_rev_map(void);
47char * get_router_from_rev_map(long int mapping_number);
48int get_no_link_from_adj_matrix(int **adj_matrix,long int V, long int S);
49void get_links_from_adj_matrix(int **adj_matrix, long int V ,long int *links, long int *link_costs,long int S);
50void adjust_adj_matrix(int **adj_matrix, long int V, long int S, long int link,long int link_cost);
51
52/* Routing Table Relates function */
53
54int get_next_hop(char *dest_router,int *faces, int *route_costs);
55int get_number_of_next_hop(char *dest_router);
56void add_next_hop_router(char *dest_router);
57void add_next_hop_from_lsa_adj_body(char *body, int no_link);
58void print_routing_table(void);
59void do_old_routing_table_updates(void);
60void clear_old_routing_table(void);
61void update_routing_table_with_new_route(long int *parent,long int *dist, long int source);
62
63long int get_next_hop_from_calculation(long int *parent, long int dest,long int source);
64void print_all_next_hop(long int *parent,long int source);
65int does_face_exist_for_router(char *dest_router, int face_id);
66
akmhoquef06586e2013-02-05 12:09:38 -060067double get_hyperbolic_distance(long int source, long int dest);
68void sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element);
69void update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist);
70
akmhoque8fdd6412012-12-04 15:05:33 -060071#endif