From 6ad0fcf2f32f412091d0dfd58da1d8f5dc474809 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 8 Apr 2016 16:32:35 +0200 Subject: 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. --- src/tools/irm/irm_bootstrap_ipcp.c | 4 +--- src/tools/irm/irm_create_ipcp.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src/tools') 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 #include #include -#include +#include #include "irm_ops.h" #include "irm_utils.h" @@ -36,7 +36,6 @@ static void usage() " [api ]\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 #include #include #include + +#include #include #include #include @@ -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 \n" " [api ]\n" - " 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); } -- cgit v1.2.3 From 60e357b819c8f2cf4dd699e67c496b50410872ac Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 11 Apr 2016 16:26:36 +0200 Subject: tools: Update irm bootstrap This updates irm bootstrap so that the parameters from the struct dif_config can be correctly filled in from the command line. --- src/tools/irm/irm_bootstrap_ipcp.c | 110 +++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 4 deletions(-) (limited to 'src/tools') diff --git a/src/tools/irm/irm_bootstrap_ipcp.c b/src/tools/irm/irm_bootstrap_ipcp.c index e7acfccd..7e7b6e05 100644 --- a/src/tools/irm/irm_bootstrap_ipcp.c +++ b/src/tools/irm/irm_bootstrap_ipcp.c @@ -22,30 +22,105 @@ #include #include +#include +#include + #include #include #include "irm_ops.h" #include "irm_utils.h" +#define NORMAL "normal" +#define SHIM_UDP "shim-udp" + +#define DEFAULT_ADDR_SIZE 4 +#define DEFAULT_CEP_ID_SIZE 2 +#define DEFAULT_PDU_LEN_SIZE 2 +#define DEFAULT_QOS_ID_SIZE 1 +#define DEFAULT_SEQ_NO_SIZE 4 +#define DEFAULT_TTL_SIZE 1 +#define DEFAULT_CHK_SIZE 2 +#define DEFAULT_MIN_PDU_SIZE 0 +#define DEFAULT_MAX_PDU_SIZE 9000 + static void usage() { /* FIXME: Add dif_config stuff */ printf("Usage: irm bootstrap_ipcp\n" " ap \n" - " [api ]\n"); + " [api ]\n" + " dif \n" + " type [TYPE]\n\n" + "where TYPE = {" NORMAL " " SHIM_UDP "}\n\n" + "if TYPE == " NORMAL "\n" + " [addr
(default: %d)]\n" + " [cep_id (default: %d)]\n" + " [pdu_len (default: %d)]\n" + " [qos_id (default: %d)]\n" + " [seqno (default: %d)]\n" + " [ttl