Start working on routing table
This commit is contained in:
parent
4aced9e9c1
commit
94b9a9d481
3 changed files with 15 additions and 1 deletions
|
@ -24,6 +24,8 @@ int patty_ax25_route_add_hop(patty_ax25_route *route,
|
|||
|
||||
patty_ax25_route_table *patty_ax25_route_table_new();
|
||||
|
||||
void patty_ax25_route_table_destroy(patty_ax25_route_table *table);
|
||||
|
||||
patty_ax25_route *patty_ax25_route_table_find(patty_ax25_route_table *table,
|
||||
patty_ax25_addr *dest);
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ patty_ax25_route_table *patty_ax25_route_table_new() {
|
|||
return patty_dict_new();
|
||||
}
|
||||
|
||||
void patty_ax25_route_table_destroy(patty_ax25_route_table *table) {
|
||||
patty_dict_destroy(table);
|
||||
}
|
||||
|
||||
patty_ax25_route *patty_ax25_route_table_find(patty_ax25_route_table *table,
|
||||
patty_ax25_addr *dest) {
|
||||
uint32_t hash;
|
||||
|
|
10
src/server.c
10
src/server.c
|
@ -27,7 +27,7 @@ struct _patty_ax25_server {
|
|||
fds_w; /* fds select()ed for writing */
|
||||
|
||||
patty_list *ifaces;
|
||||
patty_dict *routes;
|
||||
patty_ax25_route_table *routes;
|
||||
|
||||
patty_dict *socks_by_fd,
|
||||
*socks_pending_accept,
|
||||
|
@ -51,6 +51,10 @@ patty_ax25_server *patty_ax25_server_new() {
|
|||
goto error_list_new_ifaces;
|
||||
}
|
||||
|
||||
if ((server->routes = patty_ax25_route_table_new()) == NULL) {
|
||||
goto error_route_table_new;
|
||||
}
|
||||
|
||||
if ((server->socks_by_fd = patty_dict_new()) == NULL) {
|
||||
goto error_dict_new_socks_by_fd;
|
||||
}
|
||||
|
@ -93,6 +97,9 @@ error_dict_new_socks_pending_accept:
|
|||
patty_dict_destroy(server->socks_by_fd);
|
||||
|
||||
error_dict_new_socks_by_fd:
|
||||
patty_ax25_route_table_destroy(server->routes);
|
||||
|
||||
error_route_table_new:
|
||||
patty_list_destroy(server->ifaces);
|
||||
|
||||
error_list_new_ifaces:
|
||||
|
@ -1144,6 +1151,7 @@ void patty_ax25_server_destroy(patty_ax25_server *server) {
|
|||
patty_dict_destroy(server->socks_by_fd);
|
||||
|
||||
patty_ax25_server_each_if(server, destroy_if, NULL);
|
||||
patty_ax25_route_table_destroy(server->routes);
|
||||
patty_list_destroy(server->ifaces);
|
||||
|
||||
free(server);
|
||||
|
|
Loading…
Add table
Reference in a new issue