From bd2dc6141b59d8fe67e7765b5dfce5b819ed7e33 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 3 Mar 2016 14:09:57 +0100 Subject: tools: irm: Provide all IRM calls This commit makes all IRM calls available to the user of the 'irm' tool. The bootstrap_ipcp call does not yet take the anything except the AP name. This will be added once we stabilize what should be configurable in the IPCP. --- src/tools/irm/irm_create_ipcp.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'src/tools/irm/irm_create_ipcp.c') diff --git a/src/tools/irm/irm_create_ipcp.c b/src/tools/irm/irm_create_ipcp.c index 5a8478e6..5c847988 100644 --- a/src/tools/irm/irm_create_ipcp.c +++ b/src/tools/irm/irm_create_ipcp.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -41,43 +42,33 @@ static void usage() int do_create_ipcp(int argc, char ** argv) { - char * ap_name = NULL; - int api_id = 0; - char * ae_name = ""; - int aei_id = 0; rina_name_t name; char * ipcp_type = NULL; + name.ap_name = NULL; + name.api_id = 0; + name.ae_name = ""; + name.aei_id = 0; + while (argc > 0) { - if (matches(*argv, "ap") == 0) { - ap_name = *(argv + 1); - } else if (matches(*argv, "api") == 0) { - api_id = atoi(*(argv + 1)); - } else if (matches(*argv, "ae") == 0) { - ae_name = *(argv + 1); - } else if (matches(*argv, "aei") == 0) { - aei_id = atoi(*(argv + 1)); - } else if (matches(*argv, "type") == 0) { - ipcp_type = *(argv + 1); - } else { - printf("\"%s\" is unknown, try \"irm " - "create_ipcp\".\n", *argv); - return -1; + if (!parse_name(argv, &name)) { + if (matches(*argv, "type") == 0) { + ipcp_type = *(argv + 1); + } else { + printf("\"%s\" is unknown, try \"irm " + "create_ipcp\".\n", *argv); + return -1; + } } argc -= 2; - argv += 2;; + argv += 2; } - if (ipcp_type == NULL || ap_name == NULL) { + if (ipcp_type == NULL || name.ap_name == NULL) { usage(); return -1; } - name.ap_name = ap_name; - name.api_id = api_id; - name.ae_name = ae_name; - name.aei_id = aei_id; - return irm_create_ipcp(name, ipcp_type); } -- cgit v1.2.3