From patchwork Tue May 17 13:04:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 67968 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2080032qge; Tue, 17 May 2016 06:36:00 -0700 (PDT) X-Received: by 10.55.23.29 with SMTP id i29mr1431009qkh.201.1463492159916; Tue, 17 May 2016 06:35:59 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 22si2269523qkf.45.2016.05.17.06.35.59; Tue, 17 May 2016 06:35:59 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 73A2D61787; Tue, 17 May 2016 13:35:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B4B0E61839; Tue, 17 May 2016 13:16:13 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C98FA617A2; Tue, 17 May 2016 13:15:33 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 45ADC617A3 for ; Tue, 17 May 2016 13:05:30 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id m64so6525185lfd.1 for ; Tue, 17 May 2016 06:05:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=48NxF5BVRzmttHRQCnYjnHsUhZGCyWJ6iaAi6tBb30I=; b=PgmYK+1zJTev6AZD029HrfV/YZ9O8gZpm/UpfDJEIxrVxAKI+KAdY68drBTtzYKln+ uZ5lXG801QDwZAcMFaiZW8xF21hPv5POaDmL7bSW+Gje8zQU/wSOiT+xYBPgv6LrDblI kMyukAhqoprfbqNF+vjWIxyuAgYG1cNDrhy84tsBJfLDiNKUunh4SgvpM3n6gT9SCmay OUqtVpLWPZXNRdm2USkFg/R88bfN7HsfcX94ykRx2I393/Nt3uXGd35uoqaJVjRd+xBr n3E7+Iz3EbYiNVsdunu5i/jUxpXisoCuFL4u6zQt+2Tag6/U7W7qFmJ0pkj0DWufwAuv rQmQ== X-Gm-Message-State: AOPr4FUtetynYNr/kS8k2S8CQQIJkSVkxTe/l55TUm2OoPpfwccYgyG0Vf2FI+QDlom/u0eCmpY= X-Received: by 10.25.160.77 with SMTP id j74mr464437lfe.72.1463490329219; Tue, 17 May 2016 06:05:29 -0700 (PDT) Received: from localhost.localdomain (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id q1sm506536lbo.4.2016.05.17.06.05.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 May 2016 06:05:28 -0700 (PDT) From: Christophe Milard To: lng-odp@lists.linaro.org, brian.brooks@linaro.org, mike.holmes@linaro.org Date: Tue, 17 May 2016 15:04:29 +0200 Message-Id: <1463490282-23277-23-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463490282-23277-1-git-send-email-christophe.milard@linaro.org> References: <1463490282-23277-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv7 22/35] example: ipsec: adding helper cmd line parsing X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" odp_ipsec now calls the helper command line parsing so that helper can collect its options. Hence enabling process mode run. Signed-off-by: Christophe Milard --- example/ipsec/odp_ipsec.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 4d08772..fb4385f 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1381,7 +1381,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) int rc = 0; int i; - static struct option longopts[] = { + static const struct option longopts[] = { {"count", required_argument, NULL, 'c'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ {"mode", required_argument, NULL, 'm'}, /* return 'm' */ @@ -1395,13 +1395,19 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} }; + static const char *shortopts = "+c:i:m:h:r:p:a:e:t:s:"; + + /* let helper collect its own arguments (e.g. --odph_proc) */ + odph_parse_options(argc, argv, shortopts, longopts); + printf("\nParsing command line options\n"); appl_args->mode = 0; /* turn off async crypto API by default */ + opterr = 0; /* do not issue errors on helper options */ + while (!rc) { - opt = getopt_long(argc, argv, "+c:i:m:h:r:p:a:e:t:s:", - longopts, &long_index); + opt = getopt_long(argc, argv, shortopts, longopts, &long_index); if (-1 == opt) break; /* No more options */