get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/76970/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 76970,
    "url": "http://patches.dpdk.org/api/patches/76970/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200908201830.74206-38-cristian.dumitrescu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200908201830.74206-38-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200908201830.74206-38-cristian.dumitrescu@intel.com",
    "date": "2020-09-08T20:18:26",
    "name": "[v3,37/41] examples/pipeline: add message passing mechanism",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ad4ae7817b6c179830fb551216bb9452e3b7763a",
    "submitter": {
        "id": 19,
        "url": "http://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200908201830.74206-38-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 12034,
            "url": "http://patches.dpdk.org/api/series/12034/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12034",
            "date": "2020-09-08T20:17:52",
            "name": "Pipeline alignment with the P4 language",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/12034/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/76970/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/76970/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B92BDA04B1;\n\tTue,  8 Sep 2020 22:24:59 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 24EDB1C2AC;\n\tTue,  8 Sep 2020 22:19:48 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 88C2B1C13A\n for <dev@dpdk.org>; Tue,  8 Sep 2020 22:19:10 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Sep 2020 13:19:09 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by fmsmga006.fm.intel.com with ESMTP; 08 Sep 2020 13:19:09 -0700"
        ],
        "IronPort-SDR": [
            "\n wJiJhr0V5UrCV6IFJpenxDP6+lA2Bp+iQaqI6wK9vj6p2hbxGUBAOnn0OGLnBPP9Vtc83D7gPc\n bPcgqkXeEOZQ==",
            "\n ft/ZLyKhMkj+vyv9Cs9vruLEOmWz15IjqryTbKh0cB0s0QsKGcoQqFsJigj9CDRjtOmqLbSBy7\n ypR97O0fT61w=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9738\"; a=\"145939458\"",
            "E=Sophos;i=\"5.76,407,1592895600\"; d=\"scan'208\";a=\"145939458\"",
            "E=Sophos;i=\"5.76,406,1592895600\"; d=\"scan'208\";a=\"504493560\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue,  8 Sep 2020 21:18:26 +0100",
        "Message-Id": "<20200908201830.74206-38-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200908201830.74206-1-cristian.dumitrescu@intel.com>",
        "References": "<20200907214032.95052-2-cristian.dumitrescu@intel.com>\n <20200908201830.74206-1-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 37/41] examples/pipeline: add message passing\n\tmechanism",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add network-based connectivity mechanism for the application to allow\nfor the exchange of configuration messages through the network as\nopposed to local CLI only.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n examples/pipeline/Makefile    |   1 +\n examples/pipeline/conn.c      | 331 ++++++++++++++++++++++++++++++++++\n examples/pipeline/conn.h      |  50 +++++\n examples/pipeline/main.c      | 136 +++++++++++++-\n examples/pipeline/meson.build |   1 +\n 5 files changed, 517 insertions(+), 2 deletions(-)\n create mode 100644 examples/pipeline/conn.c\n create mode 100644 examples/pipeline/conn.h",
    "diff": "diff --git a/examples/pipeline/Makefile b/examples/pipeline/Makefile\nindex 8d01fbfed..2cb5edc1a 100644\n--- a/examples/pipeline/Makefile\n+++ b/examples/pipeline/Makefile\n@@ -5,6 +5,7 @@\n APP = pipeline\n \n # all source are stored in SRCS-y\n+SRCS-y += conn.c\n SRCS-y += main.c\n SRCS-y += obj.c\n SRCS-y += thread.c\ndiff --git a/examples/pipeline/conn.c b/examples/pipeline/conn.c\nnew file mode 100644\nindex 000000000..eed87b8ea\n--- /dev/null\n+++ b/examples/pipeline/conn.c\n@@ -0,0 +1,331 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2020 Intel Corporation\n+ */\n+\n+#include <string.h>\n+#include <stdlib.h>\n+#include <stdio.h>\n+#include <unistd.h>\n+#include <sys/types.h>\n+\n+#include <sys/socket.h>\n+\n+#include <sys/epoll.h>\n+#include <netinet/in.h>\n+#include <arpa/inet.h>\n+#include <errno.h>\n+\n+#include \"conn.h\"\n+\n+#define MSG_CMD_TOO_LONG \"Command too long.\"\n+\n+struct conn {\n+\tchar *welcome;\n+\tchar *prompt;\n+\tchar *buf;\n+\tchar *msg_in;\n+\tchar *msg_out;\n+\tsize_t buf_size;\n+\tsize_t msg_in_len_max;\n+\tsize_t msg_out_len_max;\n+\tsize_t msg_in_len;\n+\tint fd_server;\n+\tint fd_client_group;\n+\tconn_msg_handle_t msg_handle;\n+\tvoid *msg_handle_arg;\n+};\n+\n+struct conn *\n+conn_init(struct conn_params *p)\n+{\n+\tstruct sockaddr_in server_address;\n+\tstruct conn *conn;\n+\tint fd_server, fd_client_group, status;\n+\n+\tmemset(&server_address, 0, sizeof(server_address));\n+\n+\t/* Check input arguments */\n+\tif ((p == NULL) ||\n+\t\t(p->welcome == NULL) ||\n+\t\t(p->prompt == NULL) ||\n+\t\t(p->addr == NULL) ||\n+\t\t(p->buf_size == 0) ||\n+\t\t(p->msg_in_len_max == 0) ||\n+\t\t(p->msg_out_len_max == 0) ||\n+\t\t(p->msg_handle == NULL))\n+\t\treturn NULL;\n+\n+\tstatus = inet_aton(p->addr, &server_address.sin_addr);\n+\tif (status == 0)\n+\t\treturn NULL;\n+\n+\t/* Memory allocation */\n+\tconn = calloc(1, sizeof(struct conn));\n+\tif (conn == NULL)\n+\t\treturn NULL;\n+\n+\tconn->welcome = calloc(1, CONN_WELCOME_LEN_MAX + 1);\n+\tconn->prompt = calloc(1, CONN_PROMPT_LEN_MAX + 1);\n+\tconn->buf = calloc(1, p->buf_size);\n+\tconn->msg_in = calloc(1, p->msg_in_len_max + 1);\n+\tconn->msg_out = calloc(1, p->msg_out_len_max + 1);\n+\n+\tif ((conn->welcome == NULL) ||\n+\t\t(conn->prompt == NULL) ||\n+\t\t(conn->buf == NULL) ||\n+\t\t(conn->msg_in == NULL) ||\n+\t\t(conn->msg_out == NULL)) {\n+\t\tconn_free(conn);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Server socket */\n+\tserver_address.sin_family = AF_INET;\n+\tserver_address.sin_port = htons(p->port);\n+\n+\tfd_server = socket(AF_INET,\n+\t\tSOCK_STREAM | SOCK_NONBLOCK,\n+\t\t0);\n+\tif (fd_server == -1) {\n+\t\tconn_free(conn);\n+\t\treturn NULL;\n+\t}\n+\n+\tstatus = bind(fd_server,\n+\t\t(struct sockaddr *) &server_address,\n+\t\tsizeof(server_address));\n+\tif (status == -1) {\n+\t\tconn_free(conn);\n+\t\tclose(fd_server);\n+\t\treturn NULL;\n+\t}\n+\n+\tstatus = listen(fd_server, 16);\n+\tif (status == -1) {\n+\t\tconn_free(conn);\n+\t\tclose(fd_server);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Client group */\n+\tfd_client_group = epoll_create(1);\n+\tif (fd_client_group == -1) {\n+\t\tconn_free(conn);\n+\t\tclose(fd_server);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Fill in */\n+\tstrncpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX);\n+\tstrncpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX);\n+\tconn->buf_size = p->buf_size;\n+\tconn->msg_in_len_max = p->msg_in_len_max;\n+\tconn->msg_out_len_max = p->msg_out_len_max;\n+\tconn->msg_in_len = 0;\n+\tconn->fd_server = fd_server;\n+\tconn->fd_client_group = fd_client_group;\n+\tconn->msg_handle = p->msg_handle;\n+\tconn->msg_handle_arg = p->msg_handle_arg;\n+\n+\treturn conn;\n+}\n+\n+void\n+conn_free(struct conn *conn)\n+{\n+\tif (conn == NULL)\n+\t\treturn;\n+\n+\tif (conn->fd_client_group)\n+\t\tclose(conn->fd_client_group);\n+\n+\tif (conn->fd_server)\n+\t\tclose(conn->fd_server);\n+\n+\tfree(conn->msg_out);\n+\tfree(conn->msg_in);\n+\tfree(conn->prompt);\n+\tfree(conn->welcome);\n+\tfree(conn);\n+}\n+\n+int\n+conn_poll_for_conn(struct conn *conn)\n+{\n+\tstruct sockaddr_in client_address;\n+\tstruct epoll_event event;\n+\tsocklen_t client_address_length;\n+\tint fd_client, status;\n+\n+\t/* Check input arguments */\n+\tif (conn == NULL)\n+\t\treturn -1;\n+\n+\t/* Server socket */\n+\tclient_address_length = sizeof(client_address);\n+\tfd_client = accept4(conn->fd_server,\n+\t\t(struct sockaddr *) &client_address,\n+\t\t&client_address_length,\n+\t\tSOCK_NONBLOCK);\n+\tif (fd_client == -1) {\n+\t\tif ((errno == EAGAIN) || (errno == EWOULDBLOCK))\n+\t\t\treturn 0;\n+\n+\t\treturn -1;\n+\t}\n+\n+\t/* Client group */\n+\tevent.events = EPOLLIN | EPOLLRDHUP | EPOLLHUP;\n+\tevent.data.fd = fd_client;\n+\n+\tstatus = epoll_ctl(conn->fd_client_group,\n+\t\tEPOLL_CTL_ADD,\n+\t\tfd_client,\n+\t\t&event);\n+\tif (status == -1) {\n+\t\tclose(fd_client);\n+\t\treturn -1;\n+\t}\n+\n+\t/* Client */\n+\tstatus = write(fd_client,\n+\t\tconn->welcome,\n+\t\tstrlen(conn->welcome));\n+\tif (status == -1) {\n+\t\tclose(fd_client);\n+\t\treturn -1;\n+\t}\n+\n+\tstatus = write(fd_client,\n+\t\tconn->prompt,\n+\t\tstrlen(conn->prompt));\n+\tif (status == -1) {\n+\t\tclose(fd_client);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+data_event_handle(struct conn *conn,\n+\tint fd_client)\n+{\n+\tssize_t len, i, status;\n+\n+\t/* Read input message */\n+\n+\tlen = read(fd_client,\n+\t\tconn->buf,\n+\t\tconn->buf_size);\n+\tif (len == -1) {\n+\t\tif ((errno == EAGAIN) || (errno == EWOULDBLOCK))\n+\t\t\treturn 0;\n+\n+\t\treturn -1;\n+\t}\n+\tif (len == 0)\n+\t\treturn 0;\n+\n+\t/* Handle input messages */\n+\tfor (i = 0; i < len; i++) {\n+\t\tif (conn->buf[i] == '\\n') {\n+\t\t\tsize_t n;\n+\n+\t\t\tconn->msg_in[conn->msg_in_len] = 0;\n+\t\t\tconn->msg_out[0] = 0;\n+\n+\t\t\tconn->msg_handle(conn->msg_in,\n+\t\t\t\tconn->msg_out,\n+\t\t\t\tconn->msg_out_len_max,\n+\t\t\t\tconn->msg_handle_arg);\n+\n+\t\t\tn = strlen(conn->msg_out);\n+\t\t\tif (n) {\n+\t\t\t\tstatus = write(fd_client,\n+\t\t\t\t\tconn->msg_out,\n+\t\t\t\t\tn);\n+\t\t\t\tif (status == -1)\n+\t\t\t\t\treturn status;\n+\t\t\t}\n+\n+\t\t\tconn->msg_in_len = 0;\n+\t\t} else if (conn->msg_in_len < conn->msg_in_len_max) {\n+\t\t\tconn->msg_in[conn->msg_in_len] = conn->buf[i];\n+\t\t\tconn->msg_in_len++;\n+\t\t} else {\n+\t\t\tstatus = write(fd_client,\n+\t\t\t\tMSG_CMD_TOO_LONG,\n+\t\t\t\tstrlen(MSG_CMD_TOO_LONG));\n+\t\t\tif (status == -1)\n+\t\t\t\treturn status;\n+\n+\t\t\tconn->msg_in_len = 0;\n+\t\t}\n+\t}\n+\n+\t/* Write prompt */\n+\tstatus = write(fd_client,\n+\t\tconn->prompt,\n+\t\tstrlen(conn->prompt));\n+\tif (status == -1)\n+\t\treturn status;\n+\n+\treturn 0;\n+}\n+\n+static int\n+control_event_handle(struct conn *conn,\n+\tint fd_client)\n+{\n+\tint status;\n+\n+\tstatus = epoll_ctl(conn->fd_client_group,\n+\t\tEPOLL_CTL_DEL,\n+\t\tfd_client,\n+\t\tNULL);\n+\tif (status == -1)\n+\t\treturn -1;\n+\n+\tstatus = close(fd_client);\n+\tif (status == -1)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+int\n+conn_poll_for_msg(struct conn *conn)\n+{\n+\tstruct epoll_event event;\n+\tint fd_client, status, status_data = 0, status_control = 0;\n+\n+\t/* Check input arguments */\n+\tif (conn == NULL)\n+\t\treturn -1;\n+\n+\t/* Client group */\n+\tstatus = epoll_wait(conn->fd_client_group,\n+\t\t&event,\n+\t\t1,\n+\t\t0);\n+\tif (status == -1)\n+\t\treturn -1;\n+\tif (status == 0)\n+\t\treturn 0;\n+\n+\tfd_client = event.data.fd;\n+\n+\t/* Data available */\n+\tif (event.events & EPOLLIN)\n+\t\tstatus_data = data_event_handle(conn, fd_client);\n+\n+\t/* Control events */\n+\tif (event.events & (EPOLLRDHUP | EPOLLERR | EPOLLHUP))\n+\t\tstatus_control = control_event_handle(conn, fd_client);\n+\n+\tif (status_data || status_control)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\ndiff --git a/examples/pipeline/conn.h b/examples/pipeline/conn.h\nnew file mode 100644\nindex 000000000..871a5efd0\n--- /dev/null\n+++ b/examples/pipeline/conn.h\n@@ -0,0 +1,50 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2020 Intel Corporation\n+ */\n+\n+#ifndef __INCLUDE_CONN_H__\n+#define __INCLUDE_CONN_H__\n+\n+#include <stdint.h>\n+\n+struct conn;\n+\n+#ifndef CONN_WELCOME_LEN_MAX\n+#define CONN_WELCOME_LEN_MAX                               1024\n+#endif\n+\n+#ifndef CONN_PROMPT_LEN_MAX\n+#define CONN_PROMPT_LEN_MAX                                16\n+#endif\n+\n+typedef void\n+(*conn_msg_handle_t)(char *msg_in,\n+\t\t     char *msg_out,\n+\t\t     size_t msg_out_len_max,\n+\t\t     void *arg);\n+\n+struct conn_params {\n+\tconst char *welcome;\n+\tconst char *prompt;\n+\tconst char *addr;\n+\tuint16_t port;\n+\tsize_t buf_size;\n+\tsize_t msg_in_len_max;\n+\tsize_t msg_out_len_max;\n+\tconn_msg_handle_t msg_handle;\n+\tvoid *msg_handle_arg;\n+};\n+\n+struct conn *\n+conn_init(struct conn_params *p);\n+\n+void\n+conn_free(struct conn *conn);\n+\n+int\n+conn_poll_for_conn(struct conn *conn);\n+\n+int\n+conn_poll_for_msg(struct conn *conn);\n+\n+#endif\ndiff --git a/examples/pipeline/main.c b/examples/pipeline/main.c\nindex 353e62c10..1a63c1237 100644\n--- a/examples/pipeline/main.c\n+++ b/examples/pipeline/main.c\n@@ -11,15 +11,136 @@\n #include <rte_launch.h>\n #include <rte_eal.h>\n \n+#include \"conn.h\"\n #include \"obj.h\"\n #include \"thread.h\"\n \n+static const char usage[] =\n+\t\"%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\\n\";\n+\n+static struct app_params {\n+\tstruct conn_params conn;\n+\tchar *script_name;\n+} app = {\n+\t.conn = {\n+\t\t.welcome = \"\\nWelcome!\\n\\n\",\n+\t\t.prompt = \"pipeline> \",\n+\t\t.addr = \"0.0.0.0\",\n+\t\t.port = 8086,\n+\t\t.buf_size = 1024 * 1024,\n+\t\t.msg_in_len_max = 1024,\n+\t\t.msg_out_len_max = 1024 * 1024,\n+\t\t.msg_handle = NULL,\n+\t\t.msg_handle_arg = NULL, /* set later. */\n+\t},\n+\t.script_name = NULL,\n+};\n+\n+static int\n+parse_args(int argc, char **argv)\n+{\n+\tchar *app_name = argv[0];\n+\tstruct option lgopts[] = {\n+\t\t{ NULL,  0, 0, 0 }\n+\t};\n+\tint opt, option_index;\n+\tint h_present, p_present, s_present, n_args, i;\n+\n+\t/* Skip EAL input args */\n+\tn_args = argc;\n+\tfor (i = 0; i < n_args; i++)\n+\t\tif (strcmp(argv[i], \"--\") == 0) {\n+\t\t\targc -= i;\n+\t\t\targv += i;\n+\t\t\tbreak;\n+\t\t}\n+\n+\tif (i == n_args)\n+\t\treturn 0;\n+\n+\t/* Parse args */\n+\th_present = 0;\n+\tp_present = 0;\n+\ts_present = 0;\n+\n+\twhile ((opt = getopt_long(argc, argv, \"h:p:s:\", lgopts, &option_index))\n+\t\t\t!= EOF)\n+\t\tswitch (opt) {\n+\t\tcase 'h':\n+\t\t\tif (h_present) {\n+\t\t\t\tprintf(\"Error: Multiple -h arguments\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\th_present = 1;\n+\n+\t\t\tif (!strlen(optarg)) {\n+\t\t\t\tprintf(\"Error: Argument for -h not provided\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\n+\t\t\tapp.conn.addr = strdup(optarg);\n+\t\t\tif (app.conn.addr == NULL) {\n+\t\t\t\tprintf(\"Error: Not enough memory\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tbreak;\n+\n+\t\tcase 'p':\n+\t\t\tif (p_present) {\n+\t\t\t\tprintf(\"Error: Multiple -p arguments\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tp_present = 1;\n+\n+\t\t\tif (!strlen(optarg)) {\n+\t\t\t\tprintf(\"Error: Argument for -p not provided\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\n+\t\t\tapp.conn.port = (uint16_t) atoi(optarg);\n+\t\t\tbreak;\n+\n+\t\tcase 's':\n+\t\t\tif (s_present) {\n+\t\t\t\tprintf(\"Error: Multiple -s arguments\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\ts_present = 1;\n+\n+\t\t\tif (!strlen(optarg)) {\n+\t\t\t\tprintf(\"Error: Argument for -s not provided\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\n+\t\t\tapp.script_name = strdup(optarg);\n+\t\t\tif (app.script_name == NULL) {\n+\t\t\t\tprintf(\"Error: Not enough memory\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\tprintf(usage, app_name);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\toptind = 1; /* reset getopt lib */\n+\n+\treturn 0;\n+}\n+\n int\n main(int argc, char **argv)\n {\n+\tstruct conn *conn;\n \tstruct obj *obj;\n \tint status;\n \n+\t/* Parse application arguments */\n+\tstatus = parse_args(argc, argv);\n+\tif (status < 0)\n+\t\treturn status;\n+\n \t/* EAL */\n \tstatus = rte_eal_init(argc, argv);\n \tif (status < 0) {\n@@ -46,7 +167,18 @@ main(int argc, char **argv)\n \t\tNULL,\n \t\tSKIP_MASTER);\n \n+\t/* Connectivity */\n+\tapp.conn.msg_handle_arg = obj;\n+\tconn = conn_init(&app.conn);\n+\tif (!conn) {\n+\t\tprintf(\"Error: Connectivity initialization failed (%d)\\n\",\n+\t\t\tstatus);\n+\t\treturn status;\n+\t};\n \t/* Dispatch loop */\n-\tfor ( ; ; );\n-}\n+\tfor ( ; ; ) {\n+\t\tconn_poll_for_conn(conn);\n \n+\t\tconn_poll_for_msg(conn);\n+\t}\n+}\ndiff --git a/examples/pipeline/meson.build b/examples/pipeline/meson.build\nindex ade485f97..a92e84677 100644\n--- a/examples/pipeline/meson.build\n+++ b/examples/pipeline/meson.build\n@@ -10,6 +10,7 @@ build = cc.has_header('sys/epoll.h')\n deps += ['pipeline', 'bus_pci']\n allow_experimental_apis = true\n sources = files(\n+\t'conn.c',\n \t'main.c',\n \t'obj.c',\n \t'thread.c',\n",
    "prefixes": [
        "v3",
        "37/41"
    ]
}