summaryrefslogtreecommitdiff
path: root/src/tools/irm
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/irm')
-rw-r--r--src/tools/irm/irm.c2
-rw-r--r--src/tools/irm/irm_bootstrap_ipcp.c11
-rw-r--r--src/tools/irm/irm_create_ipcp.c12
-rw-r--r--src/tools/irm/irm_destroy_ipcp.c11
-rw-r--r--src/tools/irm/irm_enroll_ipcp.c11
-rw-r--r--src/tools/irm/irm_register_ipcp.c11
-rw-r--r--src/tools/irm/irm_unregister_ipcp.c11
-rw-r--r--src/tools/irm/irm_utils.h4
8 files changed, 32 insertions, 41 deletions
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 0843083d..c7b82c4a 100644
--- a/src/tools/irm/irm_bootstrap_ipcp.c
+++ b/src/tools/irm/irm_bootstrap_ipcp.c
@@ -39,17 +39,16 @@ static void usage()
int do_bootstrap_ipcp(int argc, char ** argv)
{
- char * ap_name = NULL;
- int api_id = 0;
+ instance_name_t api = {NULL, 0};
struct dif_config conf;
conf.qosspecs = NULL;
while (argc > 0) {
if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
+ api.name = *(argv + 1);
} else if (matches(*argv, "api") == 0) {
- api_id = atoi(*(argv + 1));
+ api.id = atoi(*(argv + 1));
} else {
printf("\"%s\" is unknown, try \"irm "
"destroy_ipcp\".\n", *argv);
@@ -61,10 +60,10 @@ int do_bootstrap_ipcp(int argc, char ** argv)
argv += 2;
}
- if (ap_name == NULL) {
+ if (api.name == NULL) {
usage();
return -1;
}
- return irm_bootstrap_ipcp(ap_name, api_id, &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 3262bd5c..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>
@@ -41,16 +42,15 @@ static void usage()
int do_create_ipcp(int argc, char ** argv)
{
char * ipcp_type = NULL;
- char * ap_name = NULL;
- int api_id = 0;
+ instance_name_t api = {NULL, 0};
while (argc > 0) {
if (matches(*argv, "type") == 0) {
ipcp_type = *(argv + 1);
} else if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
+ api.name = *(argv + 1);
} else if (matches(*argv, "api") == 0) {
- api_id = atoi(*(argv + 1));
+ api.id = atoi(*(argv + 1));
} else {
printf("\"%s\" is unknown, try \"irm "
"create_ipcp\".\n", *argv);
@@ -61,10 +61,10 @@ int do_create_ipcp(int argc, char ** argv)
argv += 2;
}
- if (ipcp_type == NULL || ap_name == NULL) {
+ if (ipcp_type == NULL || api.name == NULL) {
usage();
return -1;
}
- return irm_create_ipcp(ap_name, api_id, 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 fbbeb5bd..fe6ef57e 100644
--- a/src/tools/irm/irm_destroy_ipcp.c
+++ b/src/tools/irm/irm_destroy_ipcp.c
@@ -37,14 +37,13 @@ static void usage()
int do_destroy_ipcp(int argc, char ** argv)
{
- char * ap_name = NULL;
- int api_id = 0;
+ instance_name_t api = {NULL, 0};
while (argc > 0) {
if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
+ api.name = *(argv + 1);
} else if (matches(*argv, "api") == 0) {
- api_id = atoi(*(argv + 1));
+ api.id = atoi(*(argv + 1));
} else {
printf("\"%s\" is unknown, try \"irm "
"destroy_ipcp\".\n", *argv);
@@ -55,10 +54,10 @@ int do_destroy_ipcp(int argc, char ** argv)
argv += 2;
}
- if (ap_name == NULL) {
+ if (api.name == NULL) {
usage();
return -1;
}
- return irm_destroy_ipcp(ap_name, api_id);
+ return irm_destroy_ipcp(&api);
}
diff --git a/src/tools/irm/irm_enroll_ipcp.c b/src/tools/irm/irm_enroll_ipcp.c
index 70798821..5c9572bf 100644
--- a/src/tools/irm/irm_enroll_ipcp.c
+++ b/src/tools/irm/irm_enroll_ipcp.c
@@ -38,15 +38,14 @@ static void usage()
int do_enroll_ipcp(int argc, char ** argv)
{
- char * ap_name = NULL;
- int api_id = 0;
+ instance_name_t api = {NULL, 0};
char * dif_name = NULL;
while (argc > 0) {
if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
+ api.name = *(argv + 1);
} else if (matches(*argv, "api") == 0) {
- api_id = atoi(*(argv + 1));
+ api.id = atoi(*(argv + 1));
} else if (matches(*argv, "dif") == 0) {
dif_name = *(argv + 1);
} else {
@@ -59,10 +58,10 @@ int do_enroll_ipcp(int argc, char ** argv)
argv += 2;
}
- if (dif_name == NULL || ap_name == NULL) {
+ if (dif_name == NULL || api.name == NULL) {
usage();
return -1;
}
- return irm_enroll_ipcp(ap_name, api_id, 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 b8808ecd..f0c1ccff 100644
--- a/src/tools/irm/irm_register_ipcp.c
+++ b/src/tools/irm/irm_register_ipcp.c
@@ -47,14 +47,13 @@ int do_register_ipcp(int argc, char ** argv)
{
char * difs[MAX_DIFS];
size_t difs_size = 0;
- char * ap_name = NULL;
- int api_id = 0;
+ instance_name_t api = {NULL, 0};
while (argc > 0) {
if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
+ api.name = *(argv + 1);
} else if (matches(*argv, "api") == 0) {
- api_id = atoi(*(argv + 1));
+ api.id = atoi(*(argv + 1));
} else if (matches(*argv, "dif") == 0) {
difs[difs_size++] = *(argv + 1);
if (difs_size > MAX_DIFS) {
@@ -71,10 +70,10 @@ int do_register_ipcp(int argc, char ** argv)
argv += 2;
}
- if (difs_size == 0 || ap_name == NULL) {
+ if (difs_size == 0 || api.name == NULL) {
usage();
return -1;
}
- return irm_reg_ipcp(ap_name, api_id, 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 1321c263..3fd6f148 100644
--- a/src/tools/irm/irm_unregister_ipcp.c
+++ b/src/tools/irm/irm_unregister_ipcp.c
@@ -45,17 +45,16 @@ static void usage()
int do_unregister_ipcp(int argc, char ** argv)
{
- char * ap_name = NULL;
- int api_id = 0;
+ instance_name_t api = {NULL, 0};
char * difs[MAX_DIFS];
size_t difs_size = 0;
while (argc > 0) {
if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
+ api.name = *(argv + 1);
} else if (matches(*argv, "api") == 0) {
- api_id = atoi(*(argv + 1));
+ api.id = atoi(*(argv + 1));
} else if (matches(*argv, "dif") == 0) {
difs[difs_size++] = *(argv + 1);
if (difs_size > MAX_DIFS) {
@@ -72,10 +71,10 @@ int do_unregister_ipcp(int argc, char ** argv)
argv += 2;
}
- if (difs_size == 0 || ap_name == NULL) {
+ if (difs_size == 0 || api.name == NULL) {
usage();
return -1;
}
- return irm_unreg_ipcp(ap_name, api_id, difs, difs_size);
+ return irm_unreg_ipcp(&api, difs, difs_size);
}
diff --git a/src/tools/irm/irm_utils.h b/src/tools/irm/irm_utils.h
index 3d328d95..da2259c6 100644
--- a/src/tools/irm/irm_utils.h
+++ b/src/tools/irm/irm_utils.h
@@ -20,8 +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);