X-Git-Url: http://olsr.org/git/?p=olsrd.git;a=blobdiff_plain;f=lib%2Fjsoninfo%2Fsrc%2Folsrd_jsoninfo.c;h=028366b42fb2b6cd1be68ad2e32396bfff844f3d;hp=571b0a2f6e6bb72170abd2f6c267b00a17bd7c18;hb=3851f32806f88e7ee8fc917e4b45abc4a1be039b;hpb=91d40a886a178182f8d4a570897e0a61b8da2d21;ds=sidebyside diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c index 571b0a2f..028366b4 100644 --- a/lib/jsoninfo/src/olsrd_jsoninfo.c +++ b/lib/jsoninfo/src/olsrd_jsoninfo.c @@ -88,6 +88,7 @@ static struct timer_entry *writetimer_entry; static printer_functions_t printer_functions = { // // .init = &plugin_init, // + .is_command = &isCommand, // .determine_mime_type = &determine_mime_type, // .neighbors = &ipc_print_neighbors, // .links = &ipc_print_links, // @@ -105,53 +106,55 @@ static printer_functions_t printer_functions = { // }; static void determine_action(unsigned int *send_what, char *requ) { - if (strstr(requ, "/olsrd.conf")) + if (!printer_functions.is_command) + *send_what = 0; + else if ((*printer_functions.is_command)(requ, SIW_OLSRD_CONF)) *send_what |= SIW_OLSRD_CONF; - else if (strstr(requ, "/all")) + else if ((*printer_functions.is_command)(requ, SIW_ALL)) *send_what = SIW_ALL; else { // these are the two overarching categories - if (strstr(requ, "/runtime")) + if ((*printer_functions.is_command)(requ, SIW_RUNTIME_ALL)) *send_what |= SIW_RUNTIME_ALL; - if (strstr(requ, "/startup")) + if ((*printer_functions.is_command)(requ, SIW_STARTUP_ALL)) *send_what |= SIW_STARTUP_ALL; // these are the individual sections - if (strstr(requ, "/neighbors")) + if ((*printer_functions.is_command)(requ, SIW_NEIGHBORS)) *send_what |= SIW_NEIGHBORS; - if (strstr(requ, "/links")) + if ((*printer_functions.is_command)(requ, SIW_LINKS)) *send_what |= SIW_LINKS; - if (strstr(requ, "/routes")) + if ((*printer_functions.is_command)(requ, SIW_ROUTES)) *send_what |= SIW_ROUTES; - if (strstr(requ, "/hna")) + if ((*printer_functions.is_command)(requ, SIW_HNA)) *send_what |= SIW_HNA; - if (strstr(requ, "/mid")) + if ((*printer_functions.is_command)(requ, SIW_MID)) *send_what |= SIW_MID; - if (strstr(requ, "/topology")) + if ((*printer_functions.is_command)(requ, SIW_TOPOLOGY)) *send_what |= SIW_TOPOLOGY; - if (strstr(requ, "/gateways")) + if ((*printer_functions.is_command)(requ, SIW_GATEWAYS)) *send_what |= SIW_GATEWAYS; - if (strstr(requ, "/interfaces")) + if ((*printer_functions.is_command)(requ, SIW_INTERFACES)) *send_what |= SIW_INTERFACES; - if (strstr(requ, "/2hop")) + if ((*printer_functions.is_command)(requ, SIW_2HOP)) *send_what |= SIW_2HOP; - if (strstr(requ, "/sgw")) + if ((*printer_functions.is_command)(requ, SIW_SGW)) *send_what |= SIW_SGW; // specials - if (strstr(requ, "/version")) + if ((*printer_functions.is_command)(requ, SIW_VERSION)) *send_what |= SIW_VERSION; - if (strstr(requ, "/config")) + if ((*printer_functions.is_command)(requ, SIW_CONFIG)) *send_what |= SIW_CONFIG; - if (strstr(requ, "/plugins")) + if ((*printer_functions.is_command)(requ, SIW_PLUGINS)) *send_what |= SIW_PLUGINS; /* To print out neighbours only on the Freifunk Status * page the normal output is somewhat lengthy. The * header parsing is sufficient for standard wget. */ - if (strstr(requ, "/neighbours")) - *send_what = SIW_NEIGHBORS | SIW_LINKS; + if ((*printer_functions.is_command)(requ, SIW_NEIGHBORS_FREIFUNK)) + *send_what = SIW_NEIGHBORS_FREIFUNK; } }