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