aboutsummaryrefslogtreecommitdiff
path: root/src/or/routers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/routers.c')
-rw-r--r--src/or/routers.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/or/routers.c b/src/or/routers.c
index 5d6492a51..a1b8289b6 100644
--- a/src/or/routers.c
+++ b/src/or/routers.c
@@ -111,6 +111,24 @@ routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port) {
return NULL;
}
+routerinfo_t *router_get_by_pk(crypto_pk_env_t *pk)
+{
+ int i;
+ routerinfo_t *router;
+
+ assert(directory);
+
+ for(i=0;i<directory->n_routers;i++) {
+ router = directory->routers[i];
+ /* XXX Should this really be a separate link key? */
+ if (0 == crypto_pk_cmp_keys(router->pkey, pk))
+ return router;
+ }
+
+ return NULL;
+}
+
+
void router_get_directory(directory_t **pdirectory) {
*pdirectory = directory;
}