diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-04-08 16:32:35 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-04-08 16:36:39 +0200 |
commit | 6ad0fcf2f32f412091d0dfd58da1d8f5dc474809 (patch) | |
tree | eb10657a977c7c4c410ae15216d4068535a9f058 /src/tools/irm | |
parent | affea724d1810410186b10c93c64b7a8ddbe7aca (diff) | |
download | ouroboros-6ad0fcf2f32f412091d0dfd58da1d8f5dc474809.tar.gz ouroboros-6ad0fcf2f32f412091d0dfd58da1d8f5dc474809.zip |
lib, irmd, irm: Add dif_config
This adds dif_config to the prototype, in which one is able to specify
the parameters a DIF should have. The bootstrap operation of an IPCP
takes this as parameter and is oblivious to whether it is a shim or a
normal IPCP. The dif_config struct is also correctly serialized and
deserialized and passed opaquely to the correct IPCP. This IPCP is in
charge of deserializing it correctly.
Diffstat (limited to 'src/tools/irm')
-rw-r--r-- | src/tools/irm/irm_bootstrap_ipcp.c | 4 | ||||
-rw-r--r-- | src/tools/irm/irm_create_ipcp.c | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/tools/irm/irm_bootstrap_ipcp.c b/src/tools/irm/irm_bootstrap_ipcp.c index 03a913fb..e7acfccd 100644 --- a/src/tools/irm/irm_bootstrap_ipcp.c +++ b/src/tools/irm/irm_bootstrap_ipcp.c @@ -23,7 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <ouroboros/irm.h> -#include <ouroboros/common.h> +#include <ouroboros/dif_config.h> #include "irm_ops.h" #include "irm_utils.h" @@ -36,7 +36,6 @@ static void usage() " [api <application process instance>]\n"); } - int do_bootstrap_ipcp(int argc, char ** argv) { instance_name_t api = {NULL, 0}; @@ -53,7 +52,6 @@ int do_bootstrap_ipcp(int argc, char ** argv) return -1; } - argc -= 2; argv += 2; } diff --git a/src/tools/irm/irm_create_ipcp.c b/src/tools/irm/irm_create_ipcp.c index 73d20dce..e4a0f22f 100644 --- a/src/tools/irm/irm_create_ipcp.c +++ b/src/tools/irm/irm_create_ipcp.c @@ -20,10 +20,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdio.h> #include <ouroboros/irm.h> #include <ouroboros/common.h> #include <ouroboros/instance_name.h> + +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> @@ -31,18 +32,23 @@ #include "irm_ops.h" #include "irm_utils.h" +#define NORMAL "normal" +#define SHIM_UDP "shim-udp" + static void usage() { printf("Usage: irm create_ipcp\n" " ap <application process name>\n" " [api <application process instance>]\n" - " type <ipc process type>\n"); + " type [TYPE]\n\n" + "where TYPE = {" NORMAL " " SHIM_UDP "}\n"); } int do_create_ipcp(int argc, char ** argv) { char * ipcp_type = NULL; instance_name_t api = {NULL, 0}; + enum ipcp_type type = 0; while (argc > 0) { if (matches(*argv, "type") == 0) { @@ -66,5 +72,14 @@ int do_create_ipcp(int argc, char ** argv) return -1; } - return irm_create_ipcp(&api, ipcp_type); + if (strcmp(ipcp_type, NORMAL) == 0) + type = NORMAL_IPCP; + else if (strcmp(ipcp_type, SHIM_UDP) == 0) + type = SHIM_UDP_IPCP; + else { + usage(); + return -1; + } + + return irm_create_ipcp(&api, type); } |