get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43813,
    "url": "http://patches.dpdk.org/api/patches/43813/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1535026093-101872-4-git-send-email-ciara.power@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": "<1535026093-101872-4-git-send-email-ciara.power@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1535026093-101872-4-git-send-email-ciara.power@intel.com",
    "date": "2018-08-23T12:08:05",
    "name": "[03/11] telemetry: add client feature and sockets",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "77be26aa6ca55da59bab672a4c3e6937b3046415",
    "submitter": {
        "id": 978,
        "url": "http://patches.dpdk.org/api/people/978/?format=api",
        "name": "Power, Ciara",
        "email": "ciara.power@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/1535026093-101872-4-git-send-email-ciara.power@intel.com/mbox/",
    "series": [
        {
            "id": 1038,
            "url": "http://patches.dpdk.org/api/series/1038/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1038",
            "date": "2018-08-23T12:08:02",
            "name": "introduce telemetry library",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1038/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43813/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/43813/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5A3814CA1;\n\tThu, 23 Aug 2018 14:08:34 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id E0AE54C8D\n\tfor <dev@dpdk.org>; Thu, 23 Aug 2018 14:08:28 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Aug 2018 05:08:28 -0700",
            "from silpixa00399503.ir.intel.com ([10.237.222.102])\n\tby fmsmga005.fm.intel.com with ESMTP; 23 Aug 2018 05:08:27 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,278,1531810800\"; d=\"scan'208\";a=\"256613840\"",
        "From": "Ciara Power <ciara.power@intel.com>",
        "To": "harry.van.haaren@intel.com, brian.archbold@intel.com,\n\temma.kenny@intel.com, ciara.power@intel.com",
        "Cc": "dev@dpdk.org",
        "Date": "Thu, 23 Aug 2018 13:08:05 +0100",
        "Message-Id": "<1535026093-101872-4-git-send-email-ciara.power@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1535026093-101872-1-git-send-email-ciara.power@intel.com>",
        "References": "<1535026093-101872-1-git-send-email-ciara.power@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 03/11] telemetry: add client feature and sockets",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch introduces clients to the telemetry API.\n\nWhen a client makes a connection through the initial telemetry\nsocket, they can send a message through the socket to be\nparsed. Register messages are expected through this socket, to\nenable clients to register and have a client socket setup for\nfuture communications.\n\nA TAILQ is used to store all clients information. Using this, the\nclient sockets are polled for messages, which will later be parsed\nand dealt with accordingly.\n\nFunctionality that make use of the client sockets were introduced\nin this patch also, such as writing to client sockets, and sending\nerror responses.\n\nSigned-off-by: Ciara Power <ciara.power@intel.com>\nSigned-off-by: Brian Archbold <brian.archbold@intel.com>\n---\n lib/librte_telemetry/meson.build              |   2 +\n lib/librte_telemetry/rte_telemetry.c          | 358 ++++++++++++++++++++++++++\n lib/librte_telemetry/rte_telemetry_internal.h |  25 ++\n mk/rte.app.mk                                 |   2 +-\n 4 files changed, 386 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build\nindex 7716076..0ccfa36 100644\n--- a/lib/librte_telemetry/meson.build\n+++ b/lib/librte_telemetry/meson.build\n@@ -5,3 +5,5 @@ sources = files('rte_telemetry.c')\n headers = files('rte_telemetry.h', 'rte_telemetry_internal.h')\n deps += ['metrics', 'ethdev']\n cflags += '-DALLOW_EXPERIMENTAL_API'\n+jansson = cc.find_library('jansson', required: true)\n+ext_deps += jansson\ndiff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c\nindex f984929..e9dd022 100644\n--- a/lib/librte_telemetry/rte_telemetry.c\n+++ b/lib/librte_telemetry/rte_telemetry.c\n@@ -6,6 +6,7 @@\n #include <fcntl.h>\n #include <sys/socket.h>\n #include <sys/un.h>\n+#include <jansson.h>\n \n #include <rte_eal.h>\n #include <rte_ethdev.h>\n@@ -15,6 +16,8 @@\n #include \"rte_telemetry.h\"\n #include \"rte_telemetry_internal.h\"\n \n+#define BUF_SIZE 1024\n+#define ACTION_POST 1\n #define SLEEP_TIME 10\n \n #define DEFAULT_DPDK_PATH \"/var/run/.rte_telemetry\"\n@@ -36,6 +39,88 @@ rte_telemetry_check_port_activity(int port_id)\n \treturn 0;\n }\n \n+int32_t\n+rte_telemetry_write_to_socket(struct telemetry_impl *telemetry,\n+\tconst char *json_string)\n+{\n+\tint ret;\n+\n+\tif (!telemetry) {\n+\t\tTELEMETRY_LOG_ERR(\"Error, could not initialise \"\n+\t\t\t\"TELEMETRY_API\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (!telemetry->request_client) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - No client has been chosen to\"\n+\t\t\t\" write to\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (!json_string) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Invalid JSON string!\\n\");\n+\t\treturn -1;\n+\t}\n+\tret = send(telemetry->request_client->fd,\n+\t\t\t json_string, strlen(json_string), 0);\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Failed to write to socket for \"\n+\t\t\t\"client: %s\\n\", telemetry->request_client->file_path);\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n+int32_t\n+rte_telemetry_send_error_response(struct telemetry_impl *telemetry,\n+\tint error_type)\n+{\n+\tint ret;\n+\tconst char *status_code, *json_buffer;\n+\tjson_t *root;\n+\n+\tif (error_type == -EPERM)\n+\t\tstatus_code = \"Status Error: Unknown\";\n+\telse if (error_type == -EINVAL)\n+\t\tstatus_code = \"Status Error: Invalid Argument 404\";\n+\telse if (error_type == -ENOMEM)\n+\t\tstatus_code = \"Status Error: Memory Allocation Error\";\n+\telse {\n+\t\tTELEMETRY_LOG_ERR(\"Error - invalid error type\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\troot = json_object();\n+\n+\tif (!root) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Could not create root JSON \"\n+\t\t\t\"object\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\n+\tret = json_object_set_new(root, \"status_code\",\n+\t\tjson_string(status_code));\n+\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Status code field cannot be set\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\n+\tret = json_object_set_new(root, \"data\", json_null());\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Data field cannot be set\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\n+\tjson_buffer = json_dumps(root, JSON_INDENT(2));\n+\tjson_decref(root);\n+\n+\tret = rte_telemetry_write_to_socket(telemetry, json_buffer);\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Could not write to socket\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\treturn 0;\n+}\n+\n static int32_t\n rte_telemetry_reg_ethdev_to_metrics(uint16_t port_id)\n {\n@@ -127,6 +212,31 @@ rte_telemetry_initial_accept(struct telemetry_impl *telemetry)\n }\n \n static int32_t\n+rte_telemetry_read_client(struct telemetry_impl *telemetry)\n+{\n+\tchar buf[BUF_SIZE];\n+\tint buffer_read = 0;\n+\terrno = 0;\n+\n+\tbuffer_read = read(telemetry->accept_fd, buf, BUF_SIZE-1);\n+\tbuf[buffer_read] = '\\0';\n+\tif (buffer_read == -1) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Read error\\n\");\n+\t\treturn -1;\n+\t} else if (buffer_read == 0) {\n+\t\tclose(telemetry->accept_fd);\n+\t\ttelemetry->accept_fd = 0;\n+\t} else {\n+\t\tint ret = rte_telemetry_parse_client_message(telemetry, buf);\n+\t\tif (ret < 0)\n+\t\t\tTELEMETRY_LOG_WARN(\"Warning - parse message failed\\n\");\n+\t\tclose(telemetry->accept_fd);\n+\t\ttelemetry->accept_fd = 0;\n+\t}\n+\treturn 0;\n+}\n+\n+static int32_t\n rte_telemetry_accept_new_client(struct telemetry_impl *telemetry)\n {\n \tint ret;\n@@ -148,6 +258,28 @@ rte_telemetry_accept_new_client(struct telemetry_impl *telemetry)\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t}\n+\t} else {\n+\t\tret = rte_telemetry_read_client(telemetry);\n+\t\tif (ret < 0) {\n+\t\t\tTELEMETRY_LOG_ERR(\"Error - failed to read socket \"\n+\t\t\t\t\"buffer\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+static int32_t\n+rte_telemetry_read_client_sockets(struct telemetry_impl *telemetry)\n+{\n+\ttelemetry_client *client;\n+\tTAILQ_FOREACH(client, &telemetry->client_list_head, client_list) {\n+\t\tchar client_buf[BUF_SIZE];\n+\t\tint bytes = read(client->fd, client_buf, BUF_SIZE-1);\n+\t\tclient_buf[bytes] = '\\0';\n+\t\tif (bytes > 0) {\n+\t\t\ttelemetry->request_client = client;\n+\t\t}\n \t}\n \treturn 0;\n }\n@@ -169,6 +301,12 @@ rte_telemetry_run(void *userdata)\n \t\t\t\"failed\\n\");\n \t\treturn -1;\n \t}\n+\n+\tret = rte_telemetry_read_client_sockets(telemetry);\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - client socket read failed\\n\");\n+\t\treturn -1;\n+\t}\n \treturn 0;\n }\n \n@@ -267,6 +405,7 @@ rte_telemetry_init(uint32_t socket_id)\n \t\t\tTELEMETRY_LOG_ERR(\"Error - TELEMETRY cleanup failed\\n\");\n \t\treturn -EPERM;\n \t}\n+\tTAILQ_INIT(&static_telemetry->client_list_head);\n \n \tpthread_attr_init(&attr);\n \tret = rte_ctrl_thread_create(&static_telemetry->thread_id,\n@@ -282,12 +421,38 @@ rte_telemetry_init(uint32_t socket_id)\n \treturn 0;\n }\n \n+static int32_t\n+rte_telemetry_client_cleanup(struct telemetry_client *client)\n+{\n+\tint ret;\n+\n+\tret = close(client->fd);\n+\tfree(client->file_path);\n+\tfree(client);\n+\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Close client socket failed\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\treturn 0;\n+}\n+\n int32_t\n rte_telemetry_cleanup(void)\n {\n \tint ret;\n \tstruct telemetry_impl *telemetry = static_telemetry;\n \n+\ttelemetry_client *client, *temp_client;\n+\tTAILQ_FOREACH_SAFE(client, &telemetry->client_list_head, client_list,\n+\t\ttemp_client) {\n+\t\tTAILQ_REMOVE(&telemetry->client_list_head, client, client_list);\n+\t\tret = rte_telemetry_client_cleanup(client);\n+\t\tif (ret < 0) {\n+\t\t\tTELEMETRY_LOG_ERR(\"Error - Client cleanup failed\\n\");\n+\t\t\treturn -EPERM;\n+\t\t}\n+\t}\n \tret = close(telemetry->server_fd);\n \tif (ret < 0) {\n \t\tTELEMETRY_LOG_ERR(\"Error - Close TELEMETRY socket failed\\n\");\n@@ -301,6 +466,199 @@ rte_telemetry_cleanup(void)\n \treturn 0;\n }\n \n+int32_t\n+rte_telemetry_unregister_client(struct telemetry_impl *telemetry,\n+\tconst char *client_path)\n+{\n+\tint ret;\n+\n+\tif (!telemetry) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - TELEMETRY is not initialised\\n\");\n+\t\treturn -ENODEV;\n+\t}\n+\n+\tif (!client_path) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Invalid client path\\n\");\n+\t\tgoto einval_fail;\n+\t}\n+\n+\tif (TAILQ_EMPTY(&telemetry->client_list_head)) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - there are no clients currently \"\n+\t\t\t\"registered\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\ttelemetry_client *client, *temp_client;\n+\tTAILQ_FOREACH_SAFE(client, &telemetry->client_list_head, client_list,\n+\t\t\ttemp_client) {\n+\t\tif (strcmp(client_path, client->file_path) == 0) {\n+\t\t\tTAILQ_REMOVE(&telemetry->client_list_head, client,\n+\t\t\t\tclient_list);\n+\t\t\tret = rte_telemetry_client_cleanup(client);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tTELEMETRY_LOG_ERR(\"Error - Client cleanup \"\n+\t\t\t\t\t\"failed\\n\");\n+\t\t\t\treturn -EPERM;\n+\t\t\t}\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\tTELEMETRY_LOG_WARN(\"Warning - couldn't find client, possibly not \"\n+\t\t\"registered yet.\\n\");\n+\treturn -1;\n+\n+einval_fail:\n+\tret = rte_telemetry_send_error_response(telemetry, -EINVAL);\n+\tif (ret < 0)\n+\t\tTELEMETRY_LOG_ERR(\"Error - Could not send error\\n\");\n+\treturn -EINVAL;\n+}\n+\n+int32_t\n+rte_telemetry_register_client(struct telemetry_impl *telemetry,\n+\tconst char *client_path)\n+{\n+\tint ret, fd;\n+\tif (!telemetry) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - could not initialize \"\n+\t\t\t\"TELEMETRY API\\n\");\n+\t\treturn -ENODEV;\n+\t}\n+\n+\tif (!client_path) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Invalid client path\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ttelemetry_client *client;\n+\tTAILQ_FOREACH(client, &telemetry->client_list_head, client_list) {\n+\t\tif (strcmp(client_path, client->file_path) == 0) {\n+\t\t\tTELEMETRY_LOG_WARN(\"Warning - '%s' already \"\n+\t\t\t\t\"registered\\n\", client_path);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\tfd = socket(AF_UNIX, SOCK_STREAM, 0);\n+\tif (fd == -1) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Client socket error\\n\");\n+\t\treturn -EACCES;\n+\t}\n+\tret = rte_telemetry_set_socket_nonblock(fd);\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - Could not set socket to NONBLOCK\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\n+\tstruct sockaddr_un addrs = {0};\n+\taddrs.sun_family = AF_UNIX;\n+\tstrlcpy(addrs.sun_path, client_path, sizeof(addrs.sun_path));\n+\ttelemetry_client *new_client =\n+\t\t(telemetry_client *)malloc(sizeof(telemetry_client));\n+\tnew_client->file_path = strdup(client_path);\n+\tnew_client->fd = fd;\n+\n+\tif (connect(fd, (struct sockaddr *)&addrs, sizeof(addrs)) == -1) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - TELEMETRY client connect to %s \"\n+\t\t\t\"didn't work\\n\", client_path);\n+\t\tret = rte_telemetry_client_cleanup(new_client);\n+\t\tif (ret < 0) {\n+\t\t\tTELEMETRY_LOG_ERR(\"Error - Client cleanup failed\\n\");\n+\t\t\treturn -EPERM;\n+\t\t}\n+\t\treturn -EINVAL;\n+\t}\n+\tTAILQ_INSERT_HEAD(&telemetry->client_list_head, new_client,\n+\t\tclient_list);\n+\n+\treturn 0;\n+}\n+\n+int32_t\n+rte_telemetry_parse_client_message(struct telemetry_impl *telemetry, char *buf)\n+{\n+\tint ret;\n+\tjson_error_t error;\n+\tjson_t *root = json_loads(buf, 0, &error);\n+\n+\tif (!root) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Could not load JSON object from \"\n+\t\t\t\"data passed in : %s\\n\", error.text);\n+\t\tgoto fail;\n+\t} else if (!json_is_object(root)) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - JSON Request is not a JSON \"\n+\t\t\t\"object\\n\");\n+\t\tjson_decref(root);\n+\t\tgoto fail;\n+\t}\n+\n+\tjson_t *action = json_object_get(root, \"action\");\n+\tif (!action) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Request does not have action \"\n+\t\t\t\"field\\n\");\n+\t\tgoto fail;\n+\t} else if (!json_is_integer(action)) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Action value is not an \"\n+\t\t\t\"integer\\n\");\n+\t\tgoto fail;\n+\t}\n+\n+\tjson_t *command = json_object_get(root, \"command\");\n+\tif (!command) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Request does not have command \"\n+\t\t\t\"field\\n\");\n+\t\tgoto fail;\n+\t} else if (!json_is_string(command)) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Command value is not a string\\n\");\n+\t\tgoto fail;\n+\t}\n+\n+\tint action_int = json_integer_value(action);\n+\tif (action_int != ACTION_POST) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Invalid action code\\n\");\n+\t\tgoto fail;\n+\t}\n+\n+\tconst char *command_string = json_string_value(command);\n+\tif (strcmp(command_string, \"clients\") != 0) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Invalid command\\n\");\n+\t\tgoto fail;\n+\t}\n+\n+\tjson_t *data = json_object_get(root, \"data\");\n+\tif (!data) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Request does not have data \"\n+\t\t\t\"field\\n\");\n+\t\tgoto fail;\n+\t}\n+\n+\tjson_t *client_path = json_object_get(data, \"client_path\");\n+\tif (!client_path) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - Request does not have \"\n+\t\t\t\"client_path field\\n\");\n+\t\tgoto fail;\n+\t}\n+\tif (!json_is_string(client_path)) {\n+\t\tTELEMETRY_LOG_WARN(\"Warning - client_path value is not a \"\n+\t\t\t\"string\\n\");\n+\t\tgoto fail;\n+\t}\n+\n+\tconst char *client_path_string = json_string_value(client_path);\n+\n+\tret = rte_telemetry_register_client(telemetry, client_path_string);\n+\tif (ret < 0) {\n+\t\tTELEMETRY_LOG_ERR(\"Error - could not register client\\n\");\n+\t\ttelemetry->register_fail_count++;\n+\t\tgoto fail;\n+\t}\n+\n+\treturn 0;\n+\n+fail:\n+\tTELEMETRY_LOG_WARN(\"Warning - Client attempted to register with \"\n+\t\t\"invalid message\\n\");\n+\treturn -1;\n+}\n+\n int telemetry_log_level;\n RTE_INIT(rte_telemetry_log_init);\n \ndiff --git a/lib/librte_telemetry/rte_telemetry_internal.h b/lib/librte_telemetry/rte_telemetry_internal.h\nindex 569d56a..e3292cf 100644\n--- a/lib/librte_telemetry/rte_telemetry_internal.h\n+++ b/lib/librte_telemetry/rte_telemetry_internal.h\n@@ -3,6 +3,7 @@\n  */\n \n #include <rte_log.h>\n+#include <rte_tailq.h>\n \n #ifndef _RTE_TELEMETRY_INTERNAL_H_\n #define _RTE_TELEMETRY_INTERNAL_H_\n@@ -23,6 +24,12 @@ extern int telemetry_log_level;\n #define TELEMETRY_LOG_INFO(fmt, args...) \\\n \tTELEMETRY_LOG(INFO, fmt, ## args)\n \n+typedef struct telemetry_client {\n+\tchar *file_path;\n+\tint fd;\n+\tTAILQ_ENTRY(telemetry_client) client_list;\n+} telemetry_client;\n+\n typedef struct telemetry_impl {\n \tint accept_fd;\n \tint server_fd;\n@@ -31,6 +38,24 @@ typedef struct telemetry_impl {\n \tuint32_t socket_id;\n \tint reg_index;\n \tint metrics_register_done;\n+\tTAILQ_HEAD(, telemetry_client) client_list_head;\n+\tstruct telemetry_client *request_client;\n+\tint register_fail_count;\n } telemetry_impl;\n \n+int32_t\n+rte_telemetry_parse_client_message(struct telemetry_impl *telemetry, char *buf);\n+\n+int32_t\n+rte_telemetry_send_error_response(struct telemetry_impl *telemetry,\n+\tint error_type);\n+\n+int32_t\n+rte_telemetry_register_client(struct telemetry_impl *telemetry,\n+\tconst char *client_path);\n+\n+int32_t\n+rte_telemetry_unregister_client(struct telemetry_impl *telemetry,\n+\tconst char *client_path);\n+\n #endif\ndiff --git a/mk/rte.app.mk b/mk/rte.app.mk\nindex 8551191..1963812 100644\n--- a/mk/rte.app.mk\n+++ b/mk/rte.app.mk\n@@ -80,7 +80,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_SECURITY)       += -lrte_security\n _LDLIBS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV)    += -lrte_compressdev\n _LDLIBS-$(CONFIG_RTE_LIBRTE_EVENTDEV)       += -lrte_eventdev\n _LDLIBS-$(CONFIG_RTE_LIBRTE_RAWDEV)         += -lrte_rawdev\n-_LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY)      += -lrte_metrics -lrte_telemetry\n+_LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY)      += -lrte_metrics -lrte_telemetry -ljansson\n _LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)          += -lrte_timer\n _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)        += -lrte_mempool\n _LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING)   += -lrte_mempool_ring\n",
    "prefixes": [
        "03/11"
    ]
}