X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=blobdiff_plain;f=tr%2Ftr_trp_mons.c;h=d11076e5a3d69b7e4abc57d071428d5f629d1998;hp=9c38f0df973f11cf88826770cbda57ebfed1b13e;hb=01415bbcacceae7f2fb1286fe8fe2665f4a755bf;hpb=97a234d0fe9ea93d522501162b9641d9346bdad4 diff --git a/tr/tr_trp_mons.c b/tr/tr_trp_mons.c index 9c38f0d..d11076e 100644 --- a/tr/tr_trp_mons.c +++ b/tr/tr_trp_mons.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -49,9 +50,20 @@ static MON_RC handle_show_routes(void *cookie, json_t **response_ptr) return (*response_ptr == NULL) ? MON_NOMEM : MON_SUCCESS; } +static MON_RC handle_show_peers(void *cookie, json_t **response_ptr) +{ + TRPS_INSTANCE *trps = talloc_get_type_abort(cookie, TRPS_INSTANCE); + + *response_ptr = trp_ptable_to_json(trps->ptable); + return (*response_ptr == NULL) ? MON_NOMEM : MON_SUCCESS; +} + void tr_trp_register_mons_handlers(TRPS_INSTANCE *trps, MONS_INSTANCE *mons) { mons_register_handler(mons, MON_CMD_SHOW, OPT_TYPE_SHOW_ROUTES, handle_show_routes, trps); + mons_register_handler(mons, + MON_CMD_SHOW, OPT_TYPE_SHOW_PEERS, + handle_show_peers, trps); }