diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/echo/echo_client.c | 1 | ||||
-rw-r--r-- | src/tools/echo/echo_server.c | 1 | ||||
-rw-r--r-- | src/tools/irm/irm.c | 2 | ||||
-rw-r--r-- | src/tools/irm/irm_bootstrap_ipcp.c | 19 | ||||
-rw-r--r-- | src/tools/irm/irm_create_ipcp.c | 28 | ||||
-rw-r--r-- | src/tools/irm/irm_destroy_ipcp.c | 16 | ||||
-rw-r--r-- | src/tools/irm/irm_enroll_ipcp.c | 28 | ||||
-rw-r--r-- | src/tools/irm/irm_register_ipcp.c | 31 | ||||
-rw-r--r-- | src/tools/irm/irm_unregister_ipcp.c | 30 | ||||
-rw-r--r-- | src/tools/irm/irm_utils.c | 16 | ||||
-rw-r--r-- | src/tools/irm/irm_utils.h | 6 |
11 files changed, 79 insertions, 99 deletions
diff --git a/src/tools/echo/echo_client.c b/src/tools/echo/echo_client.c index 196296f2..8d3fc322 100644 --- a/src/tools/echo/echo_client.c +++ b/src/tools/echo/echo_client.c @@ -23,7 +23,6 @@ #define CLIENT_AP_NAME "echo-client" #include <ouroboros/dev.h> -#include <ouroboros/rina_name.h> int client_main() { diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c index 289f537a..b1547d8c 100644 --- a/src/tools/echo/echo_server.c +++ b/src/tools/echo/echo_server.c @@ -26,7 +26,6 @@ #include <stdlib.h> #include <ouroboros/dev.h> -#include <ouroboros/rina_name.h> #define DIF_NAME "*" diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c index 895d52c2..d05e083e 100644 --- a/src/tools/irm/irm.c +++ b/src/tools/irm/irm.c @@ -21,7 +21,7 @@ */ #include <ouroboros/common.h> -#include <ouroboros/rina_name.h> +#include <ouroboros/instance_name.h> #include <ouroboros/irm.h> #include <stdio.h> #include <string.h> diff --git a/src/tools/irm/irm_bootstrap_ipcp.c b/src/tools/irm/irm_bootstrap_ipcp.c index 89950069..c7b82c4a 100644 --- a/src/tools/irm/irm_bootstrap_ipcp.c +++ b/src/tools/irm/irm_bootstrap_ipcp.c @@ -21,6 +21,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <ouroboros/irm.h> #include <ouroboros/common.h> @@ -38,29 +39,31 @@ static void usage() int do_bootstrap_ipcp(int argc, char ** argv) { - rina_name_t name; + instance_name_t api = {NULL, 0}; struct dif_config conf; conf.qosspecs = NULL; - name.ap_name = NULL; - name.api_id = 0; - while (argc > 0) { - if (!parse_name(argv, &name)) { + if (matches(*argv, "ap") == 0) { + api.name = *(argv + 1); + } else if (matches(*argv, "api") == 0) { + api.id = atoi(*(argv + 1)); + } else { printf("\"%s\" is unknown, try \"irm " - "enroll_ipcp\".\n", *argv); + "destroy_ipcp\".\n", *argv); return -1; } + argc -= 2; argv += 2; } - if (name.ap_name == NULL) { + if (api.name == NULL) { usage(); return -1; } - return irm_bootstrap_ipcp(name, conf); + return irm_bootstrap_ipcp(&api, &conf); } diff --git a/src/tools/irm/irm_create_ipcp.c b/src/tools/irm/irm_create_ipcp.c index 854a15f9..73d20dce 100644 --- a/src/tools/irm/irm_create_ipcp.c +++ b/src/tools/irm/irm_create_ipcp.c @@ -23,6 +23,7 @@ #include <stdio.h> #include <ouroboros/irm.h> #include <ouroboros/common.h> +#include <ouroboros/instance_name.h> #include <stdlib.h> #include <string.h> #include <errno.h> @@ -40,31 +41,30 @@ static void usage() int do_create_ipcp(int argc, char ** argv) { - rina_name_t name; char * ipcp_type = NULL; - - name.ap_name = NULL; - name.api_id = 0; + instance_name_t api = {NULL, 0}; while (argc > 0) { - 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; - } + if (matches(*argv, "type") == 0) { + ipcp_type = *(argv + 1); + } else if (matches(*argv, "ap") == 0) { + api.name = *(argv + 1); + } else if (matches(*argv, "api") == 0) { + api.id = atoi(*(argv + 1)); + } else { + printf("\"%s\" is unknown, try \"irm " + "create_ipcp\".\n", *argv); + return -1; } argc -= 2; argv += 2; } - if (ipcp_type == NULL || name.ap_name == NULL) { + if (ipcp_type == NULL || api.name == NULL) { usage(); return -1; } - return irm_create_ipcp(name, ipcp_type); + return irm_create_ipcp(&api, ipcp_type); } diff --git a/src/tools/irm/irm_destroy_ipcp.c b/src/tools/irm/irm_destroy_ipcp.c index 4f02f9cb..fe6ef57e 100644 --- a/src/tools/irm/irm_destroy_ipcp.c +++ b/src/tools/irm/irm_destroy_ipcp.c @@ -21,6 +21,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <ouroboros/irm.h> #include <ouroboros/common.h> @@ -36,13 +37,14 @@ static void usage() int do_destroy_ipcp(int argc, char ** argv) { - rina_name_t name; - - name.ap_name = NULL; - name.api_id = 0; + instance_name_t api = {NULL, 0}; while (argc > 0) { - if (!parse_name(argv, &name)) { + if (matches(*argv, "ap") == 0) { + api.name = *(argv + 1); + } else if (matches(*argv, "api") == 0) { + api.id = atoi(*(argv + 1)); + } else { printf("\"%s\" is unknown, try \"irm " "destroy_ipcp\".\n", *argv); return -1; @@ -52,10 +54,10 @@ int do_destroy_ipcp(int argc, char ** argv) argv += 2; } - if (name.ap_name == NULL) { + if (api.name == NULL) { usage(); return -1; } - return irm_destroy_ipcp(name); + return irm_destroy_ipcp(&api); } diff --git a/src/tools/irm/irm_enroll_ipcp.c b/src/tools/irm/irm_enroll_ipcp.c index 1dcdc919..5c9572bf 100644 --- a/src/tools/irm/irm_enroll_ipcp.c +++ b/src/tools/irm/irm_enroll_ipcp.c @@ -21,6 +21,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <ouroboros/irm.h> #include <ouroboros/common.h> @@ -37,31 +38,30 @@ static void usage() int do_enroll_ipcp(int argc, char ** argv) { - rina_name_t name; + instance_name_t api = {NULL, 0}; char * dif_name = NULL; - name.ap_name = NULL; - name.api_id = 0; - while (argc > 0) { - if (!parse_name(argv, &name)) { - if (matches(*argv, "dif") == 0) { - dif_name = *(argv + 1); - } else { - printf("\"%s\" is unknown, try \"irm " - "enroll_ipcp\".\n", *argv); - return -1; - } + if (matches(*argv, "ap") == 0) { + api.name = *(argv + 1); + } else if (matches(*argv, "api") == 0) { + api.id = atoi(*(argv + 1)); + } else if (matches(*argv, "dif") == 0) { + dif_name = *(argv + 1); + } else { + printf("\"%s\" is unknown, try \"irm " + "enroll_ipcp\".\n", *argv); + return -1; } argc -= 2; argv += 2; } - if (dif_name == NULL || name.ap_name == NULL) { + if (dif_name == NULL || api.name == NULL) { usage(); return -1; } - return irm_enroll_ipcp(name, dif_name); + return irm_enroll_ipcp(&api, dif_name); } diff --git a/src/tools/irm/irm_register_ipcp.c b/src/tools/irm/irm_register_ipcp.c index 468ef28f..f0c1ccff 100644 --- a/src/tools/irm/irm_register_ipcp.c +++ b/src/tools/irm/irm_register_ipcp.c @@ -45,36 +45,35 @@ static void usage() int do_register_ipcp(int argc, char ** argv) { - rina_name_t name; char * difs[MAX_DIFS]; size_t difs_size = 0; - - name.ap_name = NULL; - name.api_id = 0; + instance_name_t api = {NULL, 0}; while (argc > 0) { - if (!parse_name(argv, &name)) { - if (matches(*argv, "dif") == 0) { - difs[difs_size++] = *(argv + 1); - if (difs_size > MAX_DIFS) { - printf("Too many difs specified\n"); - return -1; - } - } else { - printf("\"%s\" is unknown, try \"irm " - "register_ipcp\".\n", *argv); + if (matches(*argv, "ap") == 0) { + api.name = *(argv + 1); + } else if (matches(*argv, "api") == 0) { + api.id = atoi(*(argv + 1)); + } else if (matches(*argv, "dif") == 0) { + difs[difs_size++] = *(argv + 1); + if (difs_size > MAX_DIFS) { + printf("Too many difs specified\n"); return -1; } + } else { + printf("\"%s\" is unknown, try \"irm " + "register_ipcp\".\n", *argv); + return -1; } argc -= 2; argv += 2; } - if (difs_size == 0 || name.ap_name == NULL) { + if (difs_size == 0 || api.name == NULL) { usage(); return -1; } - return irm_reg_ipcp(name, difs, difs_size); + return irm_reg_ipcp(&api, difs, difs_size); } diff --git a/src/tools/irm/irm_unregister_ipcp.c b/src/tools/irm/irm_unregister_ipcp.c index 0b669503..3fd6f148 100644 --- a/src/tools/irm/irm_unregister_ipcp.c +++ b/src/tools/irm/irm_unregister_ipcp.c @@ -45,36 +45,36 @@ static void usage() int do_unregister_ipcp(int argc, char ** argv) { - rina_name_t name; + instance_name_t api = {NULL, 0}; char * difs[MAX_DIFS]; size_t difs_size = 0; - name.ap_name = NULL; - name.api_id = 0; while (argc > 0) { - if (!parse_name(argv, &name)) { - if (matches(*argv, "dif") == 0) { - difs[difs_size++] = *(argv + 1); - if (difs_size > MAX_DIFS) { - printf("Too many difs specified\n"); - return -1; - } - } else { - printf("\"%s\" is unknown, try \"irm " - "unregister_ipcp\".\n", *argv); + if (matches(*argv, "ap") == 0) { + api.name = *(argv + 1); + } else if (matches(*argv, "api") == 0) { + api.id = atoi(*(argv + 1)); + } else if (matches(*argv, "dif") == 0) { + difs[difs_size++] = *(argv + 1); + if (difs_size > MAX_DIFS) { + printf("Too many difs specified\n"); return -1; } + } else { + printf("\"%s\" is unknown, try \"irm " + "unregister_ipcp\".\n", *argv); + return -1; } argc -= 2; argv += 2; } - if (difs_size == 0 || name.ap_name == NULL) { + if (difs_size == 0 || api.name == NULL) { usage(); return -1; } - return irm_unreg_ipcp(name, difs, difs_size); + return irm_unreg_ipcp(&api, difs, difs_size); } diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c index 04cb7242..feb8ac98 100644 --- a/src/tools/irm/irm_utils.c +++ b/src/tools/irm/irm_utils.c @@ -36,19 +36,3 @@ int matches(const char * cmd, const char * pattern) return memcmp(pattern, cmd, len); } - - -bool parse_name(char ** argv, - rina_name_t * name) -{ - bool found = true; - - if (matches(*argv, "ap") == 0) - name->ap_name = *(argv + 1); - else if (matches(*argv, "api") == 0) - name->api_id = atoi(*(argv + 1)); - else - found = false; - - return found; -} diff --git a/src/tools/irm/irm_utils.h b/src/tools/irm/irm_utils.h index 2a478d09..da2259c6 100644 --- a/src/tools/irm/irm_utils.h +++ b/src/tools/irm/irm_utils.h @@ -20,10 +20,4 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ouroboros/rina_name.h> - -#include <stdbool.h> - int matches(const char * cmd, const char * pattern); - -bool parse_name(char ** argv, rina_name_t * name); |