summaryrefslogtreecommitdiff
path: root/src/tools/irm/irm_utils.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-03-03 14:09:57 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-03-03 14:09:57 +0100
commitbd2dc6141b59d8fe67e7765b5dfce5b819ed7e33 (patch)
treea4dbd276895813f49c40d06ebb35111e25e8e874 /src/tools/irm/irm_utils.c
parentccbfc46ada3317b0f3655b751d473643d4dcab72 (diff)
downloadouroboros-bd2dc6141b59d8fe67e7765b5dfce5b819ed7e33.tar.gz
ouroboros-bd2dc6141b59d8fe67e7765b5dfce5b819ed7e33.zip
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.
Diffstat (limited to 'src/tools/irm/irm_utils.c')
-rw-r--r--src/tools/irm/irm_utils.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c
index 34bec18c..021227fd 100644
--- a/src/tools/irm/irm_utils.c
+++ b/src/tools/irm/irm_utils.c
@@ -21,6 +21,11 @@
*/
#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <ouroboros/common.h>
+
+#include "irm_utils.h"
int matches(const char * cmd, const char * pattern)
{
@@ -31,3 +36,23 @@ 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 if (matches(*argv, "ae") == 0)
+ name->ae_name = *(argv + 1);
+ else if (matches(*argv, "aei") == 0)
+ name->aei_id = atoi(*(argv + 1));
+ else
+ found = false;
+
+ return found;
+}