network: expose route_{hash,compare}_func()

This commit is contained in:
Yu Watanabe 2020-09-04 10:56:03 +09:00
parent 99a2878457
commit 501b09dbf2
2 changed files with 4 additions and 2 deletions

View File

@ -161,7 +161,7 @@ void route_free(Route *route) {
free(route); free(route);
} }
static void route_hash_func(const Route *route, struct siphash *state) { void route_hash_func(const Route *route, struct siphash *state) {
assert(route); assert(route);
siphash24_compress(&route->family, sizeof(route->family), state); siphash24_compress(&route->family, sizeof(route->family), state);
@ -196,7 +196,7 @@ static void route_hash_func(const Route *route, struct siphash *state) {
} }
} }
static int route_compare_func(const Route *a, const Route *b) { int route_compare_func(const Route *a, const Route *b) {
int r; int r;
r = CMP(a->family, b->family); r = CMP(a->family, b->family);

View File

@ -62,6 +62,8 @@ struct Route {
LIST_FIELDS(Route, routes); LIST_FIELDS(Route, routes);
}; };
void route_hash_func(const Route *route, struct siphash *state);
int route_compare_func(const Route *a, const Route *b);
extern const struct hash_ops route_hash_ops; extern const struct hash_ops route_hash_ops;
int route_new(Route **ret); int route_new(Route **ret);