From patchwork Mon Mar 5 15:40:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 881553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::238; helo=mail-wm0-x238.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbsgk6xkakgqeu5dedxi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=siemens.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="NXZHErJl"; dkim-atps=neutral Received: from mail-wm0-x238.google.com (mail-wm0-x238.google.com [IPv6:2a00:1450:400c:c09::238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zw40B5jlkz9s3p for ; Tue, 6 Mar 2018 02:42:02 +1100 (AEDT) Received: by mail-wm0-x238.google.com with SMTP id u83sf4804964wmb.3 for ; Mon, 05 Mar 2018 07:42:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1520264520; cv=pass; d=google.com; s=arc-20160816; b=cP8XD81nQBRSI72UQt/di3r6G2XBoYfrrlgDiLkpgK8TIB7doFDuEWe9DZmxtp/99R 69noOg0fQUcQhyXI6qHfEf6HHyPuf4wDSf5mTN0EFGEjHokNKDrg6ns9KQpTwEZO3SsA 6KdB0C4/JXIT93yMJoiLm1D+brGZLBIgMBqTVj/S4Y+ZZDBabAxii4tXjAvs6hUnOigo drtG04YXAtDDdD721TiMDrianlThZZ3q2Jg+GIp5L719b6sOyqqgVkXXfV83hykSHxwo tQb4EDM3D6TNq0uo9Vo41sXjVqAnSjHbLNcUmgQvNnSazBPnRMp2IlXhk6BGI9jmV4Qj /eSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=M/srug0zobH1kGcP3HvBD/mblHdFHYWA5wdOtJNQAkk=; b=cdcHcwciX+upuB8gakS8oE7Mr+FibR7i3fOdGI6WAdLlac5dDQKVsYjythtikgAQr5 ji0vFWeonThEJycsJfJWjfepdNBSBMYbIHYw6HTKyvRxZlC9MxkAyIR3msQAXCb4GL9q m8f2N6Rgkrm6vXU63zoUaHTHNI12cnEd0q6BThY1osQG0Sb7DOOlglIzG6GYQG34Suuc ViGp9bQcSLuojeh/w0Rj08p6CC51aqKloE0S7FrtMIoRBGqH8asgW6auU5vs2K8yAHC1 IGrJAkgx+jjqFBraYTQGIS67Ll7AElYyl5eIxVMPapl0HjNOyTmuNDsXwqBIkuUd3S5R DkvA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=christian.storm@siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=M/srug0zobH1kGcP3HvBD/mblHdFHYWA5wdOtJNQAkk=; b=NXZHErJlfyezETooAdIwkujzTWwyvedaQqiHI/6BUyPx/FrRkd7NQGDWQOsNST17xB ZMGIMMi5SkL9JFvWh4URoPapFL7qbDmKiD6luyT8EUKNlI1J2c33M9dqzUsgKAKrAMrv G3tqfqUxqPD0fY0p2UknV+R26L6QP32ix8BkodmsVjJf2ge7AgZAIfyTNtzK/D9Jq1RT go/nmuoYHB699pd1ghLWUcHonS8aqBM/NpkNK6xy882w3pt3BEzBtG1mGsRAcJvV/rg0 QxzJjKaUvsqn0TGimWOG+HKYw4zfWNglR4qKGR63KiLxxtR8N3MmNCZREXXnNaZeN4BD nDpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=M/srug0zobH1kGcP3HvBD/mblHdFHYWA5wdOtJNQAkk=; b=OW9GTuFQKB/ZH7Y/JQBaNzU+vQgfND/AIMDmIeBylBL1SrioAIWDOpak8pdVXjF79f 7FVRvOvfWlqNPbxgfBpTyo1B6JmhOWhjTsoIH96HLYyLXkxZZv+WjHlbkUi7iID2ouvr zE/ZdSMlv7Im92GOCLh/QLneKyMK7U8yil79KYVFZXQl40Xqw39nP3YQpU6QC0MIyxfQ Bg/tVipdw6HfhC0YR+eXb1Vvl/1ZiY6OdzNPW7OQKiOTNCnTtpFN5w49bWHObOry0lJq sSFpFY1kbuNC19aukbSj/6p/oldZaPJ1rYk79xziqqY09W+TIZlmVlc7kpwZSuZflwvY NePQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AElRT7HUypxJwNv5dH7moR6UwVk4s1pDzNFu+LwYor+IhK9HLehXLnm9 2yNBUkfxsfnx2IKQ30alDT0= X-Google-Smtp-Source: AG47ELuNcKydNjxCEvQ4Cvfb2/aDDZuL0jjAGNAmxppw2dlhZc5nXpy5+mxfcqDD1FReqUuBzBZAJQ== X-Received: by 10.28.11.76 with SMTP id 73mr145871wml.1.1520264520203; Mon, 05 Mar 2018 07:42:00 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.124.15 with SMTP id x15ls1574657wmc.4.canary-gmail; Mon, 05 Mar 2018 07:41:59 -0800 (PST) X-Received: by 10.28.128.141 with SMTP id b135mr1142497wmd.15.1520264519175; Mon, 05 Mar 2018 07:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520264519; cv=none; d=google.com; s=arc-20160816; b=1H2DzAl4P5IRc2k83BO6CoZ0NpAzRZTM73miGGgPBG+sVcjNOh5cELmH6HSD3KYfts zC0pBVfudwqLcrElnqf8sxa9l2TbL/Q7QdhdB5DfSB4fkrwdAxmFTErT8lJtwkDQJ4zc NKnJTRKzu5+QRk5jT4+5+PxlsaqgfNLFFh/aK6nFmj4dDhRae6JatKsvDX0ESMAnQMYj V0NIgl1Co36SCe7bPooi98NuvZP259BJs08NNNjWdyTpzdL2vFiw+MAdngwi93k5HJDl dFA56L9iS8t9a6lyfmXYIC7dJCCsBm7wSG33XuDH16kh2eZS8DtFLRkry896UpuA+yiP p9mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OMuV72DUMayCxxuQmOLrWwGFkU3uzIvJz1JzuBRrI78=; b=QYHJFm1OqGgyaNLSPXsWc7XGEgVcxcY2Bo/PlBZkVH/c2V875679deJ8ACWY2c78S4 ehNm3ONr/MJNyZAQhjE2QLhrGOFgtu3ugNYcqmpRyOynoea+pNW+E5RGGBTKGdZj3u7p iQmonjo8kg0qpaMN+K9ptXyXMZqgJnhMrbfZW5+0d/aVi5ZiQRHZxTlyrJvxdLoadxtq SAeRAlFS9fNymHzgp4lzPuTCXmac+VLEwpFFX4LhpOV0ZzCAIarZ0hTqdWhBsfrQlsbU SKqbD98MO90pfb+0VmI4gtEn3M/WxMRU+SNjclFs60k+HdVJ/XgVuS7mqTwkaCFgxDhk tpKA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=christian.storm@siemens.com Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id a139si226216wma.4.2018.03.05.07.41.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 07:41:59 -0800 (PST) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id w25FfwpX003916 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 5 Mar 2018 16:41:58 +0100 Received: from MD1KR9XC.ww002.siemens.net ([139.25.69.202]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id w25FfRYM022466; Mon, 5 Mar 2018 16:41:58 +0100 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH 7/8] channel_curl: rename json_string -> request_body Date: Mon, 5 Mar 2018 16:40:05 +0100 Message-Id: <20180305154006.18122-7-christian.storm@siemens.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180305154006.18122-1-christian.storm@siemens.com> References: <20180305154006.18122-1-christian.storm@siemens.com> X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=christian.storm@siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , As channel_curl should not be bound to be used exclusively with JSON, channel_data_t's json_string field is renamed to a more generic name request_body. Signed-off-by: Christian Storm --- corelib/channel_curl.c | 10 +++++----- include/channel_curl.h | 2 +- suricatta/server_hawkbit.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index a6e0284..1340850 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -469,12 +469,12 @@ channel_op_res_t channel_set_options(channel_t *this, if ((curl_easy_setopt(channel_curl->handle, CURLOPT_POST, 1L) != CURLE_OK) || (curl_easy_setopt(channel_curl->handle, CURLOPT_POSTFIELDS, - channel_data->json_string) != CURLE_OK)) { + channel_data->request_body) != CURLE_OK)) { result = CHANNEL_EINIT; goto cleanup; } if (channel_data->debug) { - TRACE("Post JSON: %s\n", channel_data->json_string); + TRACE("Posted: %s\n", channel_data->request_body); } break; } @@ -537,14 +537,14 @@ static size_t put_read_callback(void *ptr, size_t size, size_t nmemb, void *data size_t n; /* Check data to be sent */ - bytes = strlen(channel_data->json_string) - channel_data->offs; + bytes = strlen(channel_data->request_body) - channel_data->offs; if (!bytes) return 0; n = min(bytes, size * nmemb); - memcpy(ptr, &channel_data->json_string[channel_data->offs], n); + memcpy(ptr, &channel_data->request_body[channel_data->offs], n); channel_data->offs += n; return n; @@ -646,7 +646,7 @@ static channel_op_res_t channel_put_method(channel_t *this, void *data) if ((curl_easy_setopt(channel_curl->handle, CURLOPT_READFUNCTION, put_read_callback) != CURLE_OK) || (curl_easy_setopt(channel_curl->handle, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)strlen(channel_data->json_string)) != CURLE_OK) || + (curl_off_t)strlen(channel_data->request_body)) != CURLE_OK) || (curl_easy_setopt(channel_curl->handle, CURLOPT_READDATA, channel_data) != CURLE_OK)) { ERROR("Set channel option failed.\n"); diff --git a/include/channel_curl.h b/include/channel_curl.h index 13988fa..a1f9240 100644 --- a/include/channel_curl.h +++ b/include/channel_curl.h @@ -34,7 +34,7 @@ typedef enum { typedef struct { char *url; char *auth; - char *json_string; + char *request_body; #ifdef CONFIG_JSON json_object *json_reply; #endif diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 02ffb3a..a487354 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -325,7 +325,7 @@ server_op_res_t server_send_cancel_reply(channel_t *channel, const int action_id goto cleanup; } channel_data_reply.url = url; - channel_data_reply.json_string = json_reply_string; + channel_data_reply.request_body = json_reply_string; channel_data_reply.method = CHANNEL_POST; result = map_channel_retcode(channel->put(channel, (void *)&channel_data_reply)); @@ -443,8 +443,8 @@ server_send_deployment_reply(const int action_id, const int job_cnt_max, goto cleanup; } channel_data.url = url; - channel_data.json_string = json_reply_string; - TRACE("PUTing to %s: %s\n", channel_data.url, channel_data.json_string); + channel_data.request_body = json_reply_string; + TRACE("PUTing to %s: %s\n", channel_data.url, channel_data.request_body); channel_data.method = CHANNEL_POST; result = map_channel_retcode(channel->put(channel, (void *)&channel_data)); @@ -1434,8 +1434,8 @@ server_op_res_t server_send_target_data(void) } channel_data_reply.url = url; - channel_data_reply.json_string = json_reply_string; - TRACE("URL=%s JSON=%s", channel_data_reply.url, channel_data_reply.json_string); + channel_data_reply.request_body = json_reply_string; + TRACE("URL=%s JSON=%s", channel_data_reply.url, channel_data_reply.request_body); channel_data_reply.method = CHANNEL_PUT; result = map_channel_retcode(channel->put(channel, (void *)&channel_data_reply));