blob: cd023e5710e78ed8dacaa95de5c0141ca49caa79 [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 //int next_hop_face;
21 struct hashtb *face_list;
22};
23
24struct face_list_entry
25{
akmhoque3560cb62012-09-09 10:52:30 -050026 int next_hop_face;
akmhoquede61ba92012-09-20 22:19:12 -050027 int route_cost;
28};
akmhoque3560cb62012-09-09 10:52:30 -050029
akmhoque29c1db52012-09-07 14:47:43 -050030int 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);
akmhoquede61ba92012-09-20 22:19:12 -050040void calculate_path(int **adj_matrix, long int *parent,long int *dist, long int V, long int S);
akmhoque29c1db52012-09-07 14:47:43 -050041void 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);
akmhoquefbfd0982012-09-09 20:59:03 -050045void 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);
akmhoque9fe296b2012-09-24 09:52:08 -050048int 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);
akmhoque29c1db52012-09-07 14:47:43 -050051
akmhoque3560cb62012-09-09 10:52:30 -050052/* Routing Table Relates function */
53
akmhoquede61ba92012-09-20 22:19:12 -050054int get_next_hop(char *dest_router,int *faces, int *route_costs);
55int get_number_of_next_hop(char *dest_router);
akmhoque3560cb62012-09-09 10:52:30 -050056void 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();
akmhoquede61ba92012-09-20 22:19:12 -050060void clear_old_routing_table();
61void update_routing_table_with_new_route(long int *parent,long int *dist, long int source);
akmhoquefbfd0982012-09-09 20:59:03 -050062
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);
akmhoquede61ba92012-09-20 22:19:12 -050065int does_face_exist_for_router(char *dest_router, int face_id);
akmhoque3560cb62012-09-09 10:52:30 -050066
akmhoque29c1db52012-09-07 14:47:43 -050067#endif