From patchwork Tue Dec 12 14:47:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 847530 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:c0c::238; helo=mail-wr0-x238.google.com; envelope-from=swupdate+bncbdd6bwv65qpbb7oyx7iqkgqe6okfxbq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="IURvgAYK"; dkim-atps=neutral Received: from mail-wr0-x238.google.com (mail-wr0-x238.google.com [IPv6:2a00:1450:400c:c0c::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 3yx2m04Mysz9s7F for ; Wed, 13 Dec 2017 01:49:35 +1100 (AEDT) Received: by mail-wr0-x238.google.com with SMTP id c9sf12498176wrb.4 for ; Tue, 12 Dec 2017 06:49:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1513090173; cv=pass; d=google.com; s=arc-20160816; b=R5ERLrW4FeC4f5+VrCfHwqi/ZJNe1s+DVZ5KQG1SsHlnA/u4yLWfAoVzLtXqg2Isoo LUoXqctTi805elfCqhVQ29RKyV+ew2wIKEZij3OrR1Q+MhrLrbFJ+IuN45vZ/p5KOrpS jubYocKuy8kyNTK9DcA6Fz0J8tKUIF5wnZqRR4xd8yD7fbxxFZXF7rBRYtRKXuB/Zpdr PkNmdqhGMEG1fwFLEkwT9Q3haPJRHCIi1P2OY3G+en0dZCtfFv8bh7vJZ1r1nxZeCGo5 /JeWD9hAhff6lNsu1WRIm8PAqYODorZqw5AAcawPG6lPkifpRfmSMHMgtaPC7KWoPTaq bfqg== 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=6RgrhHIGqqwfnwLWLquMGiqPs0QZg68A+BT9aPadOaA=; b=xB2+hdvHISuiIOa2jPHAC91M7tNhPE/URVGp7pPFYodlO8Y+0AT+/jqsorur3CwGvr 03hJalgOP3HpR0swS/zPl2cnvM7AxCP5+zJYAdB+jABO+bsoTtmZ6q8oKNKXdyEAk2W9 4MeT2Mr9PqyswDXUq12tcxNRkTZQcJ+WLWqE3UHFDLWmMkqKT7I7BCo5f4MCcVhEizOV HgffzUTjJp2spBHyvyeJPljMtrWhXoWiI9y5TrMF4ze8+N1TDrQy2CyYr3+iD3jrKTWY bx0hOeBHSfrFUNvZiwmlUdB5f+stzxRc41iLWATTMdUoq8wzz2AJcR8N0MBtZXDr5435 hjew== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 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=6RgrhHIGqqwfnwLWLquMGiqPs0QZg68A+BT9aPadOaA=; b=IURvgAYKOw9qSeOYw/WkSkpozi4T+buBShRgLPvd5lP6EEZTUVe4Wa8j/NiIDmLx2A wl3noZC620zJyV/9w08z1jn5tk7gSgRFitDKmD4YDLEFgVi8e60L5sB80bmC67kVkouc wMhCoae9frhGb05tJNUk12d1avxbgW8oGrbLuU+RKaI4fmUUuOCmWdhmf+N0s7mWK0DK x85LjfsZfPNLKf3gkq3aRHDOiZoZAvLsXfSvm0qcv1j1HTZFQSisLKrF80CVMDJSfgyU LwhIQbJEupGc0iK7thzB3AADPidohSwFleUocXrTffVq4F9T1wTBw+QNBmqV+fw5Q9kc aDMQ== 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=6RgrhHIGqqwfnwLWLquMGiqPs0QZg68A+BT9aPadOaA=; b=mtHymcLXUEQlcqn6E2IlDbkoPU/mey1CoE/pgPyE9MlGz7kdGPqos99G2LGsyflY8V +qm+hoOCX8rCp0IhJSn+ykbfmUQ6lmXhySiqJ0rBWejwvW8ZP4K3q7FDZI543AitnisQ McM4FJxP+61xLsUyEUR2bG+qEt+LYYrKr+2j9doptbntWaUqn51pgEyCiHD/rnM44c/c MZYgN0ZaVkH/+KeNBRp5v2wg8aMqLzBA8Z72AQ0Npr2i+zQ+5mZc/4hg+4oWbYFFJnTT SSKFCMAX9XhOet6G4hNuLAUvXNuC07RpKnUcnb+cSFzOzBzm8bWG/SD1IDLOARvrwq2b /how== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKGB3mJAT+Ec4wSAsHmNTXtrDIXoVnAPYdmiJq6vldxTEGnmKZD5N3KS ADFF1xoBlYDt0jVLPEbK9TA= X-Google-Smtp-Source: ACJfBotk86n2j3CaoHPHE4R0oq95uwuES8anWfKW3CQzCsHysnEEoCDOmzYzBW7Pmcy+NQgYJUTXCg== X-Received: by 10.28.71.203 with SMTP id m72mr24324wmi.3.1513090173182; Tue, 12 Dec 2017 06:49:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.216.78 with SMTP id p75ls2252655wmg.10.canary-gmail; Tue, 12 Dec 2017 06:49:32 -0800 (PST) X-Received: by 10.28.45.139 with SMTP id t133mr210592wmt.24.1513090172473; Tue, 12 Dec 2017 06:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513090172; cv=none; d=google.com; s=arc-20160816; b=wF9xrV/aCGGQdhn3PVtJPUKR5a0kzFscXbfpirQ//KpKxgohscck6KNyg1XcKARDW2 IPNPtrXop6exHS+HGIgGo+SxOTXwh5HaPQF3sNJrj7dEHUEsnwbZvT+ChZ5pBnPvOhRD 8s4W9WcsgZh7gVO7gW6FlC4ZSHV0TYgVmuT27yw4OQUZmt++63alI40cAcOjgpUNRe+7 nEJuX15eC/LGmzQGEmtJPWvC0bZd2r84a8JfbdDi5LExP2kV4bOpMVsRlwBwL5L/hE2M Tyt1ELZny859zjESV2X9waQsuEGbEHa76JluEjhjFiN/uDGuC0Iyox5ThJszLVg1yN3L XNlA== 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=YyzmYgMJZE48Pq3Dtj3JaDQJCkR3Zl3LZAaaZETbd+U=; b=liBYR+fcPW8q5VtEwNgRLF9QT6R4x6BmLVjb3l888yy6NazEWNfpEMzjn3ONw2YPma h1CKT68vs4p5UaTPoUoBR3P5XUA+77Cjbo3x5C56GRpblXEzgqLAKKHXPMvMJOOfs7kg tR7HmSBOYsCVVYjV/6q47xGqqcR7B09PEUUaXaZ8xDVSH32WAUEIg8jfq6Z+liz1P/mj tE3GtHLxJ8O9dXQBpYpIMivxhFm47CXukTUfu2qBt1YEIkWq7XCZAIVMcAc+O6Zyo0Re dtsKgebqLkDI0HTCmBwTHqTNB/f3clHnGtG0J0j2RPtNCAXQXKWgQd4sf4H1lBIGAC/H jtVQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=christian.storm@siemens.com Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id r134si1575517wmd.3.2017.12.12.06.49.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 06:49:32 -0800 (PST) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id vBCEnWdu013090 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 12 Dec 2017 15:49:32 +0100 Received: from MD1KR9XC.ww002.siemens.net ([139.25.69.251]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id vBCEnVAr013171; Tue, 12 Dec 2017 15:49:32 +0100 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH 4/4] suricatta: update documentation for channel refactoring Date: Tue, 12 Dec 2017 15:47:44 +0100 Message-Id: <20171212144744.24224-4-christian.storm@siemens.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171212144744.24224-1-christian.storm@siemens.com> References: <20171212144744.24224-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.2 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: , Adapt the suricatta.rst documentation and the refactored channel's header comments to reflect the changes of commit 0c17ff0. Signed-off-by: Christian Storm --- doc/source/suricatta.rst | 45 ++++++++++++++++++++------------------------- include/channel.h | 7 ++++--- include/channel_curl.h | 6 +++--- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/doc/source/suricatta.rst b/doc/source/suricatta.rst index 19411d6..a11c56b 100644 --- a/doc/source/suricatta.rst +++ b/doc/source/suricatta.rst @@ -77,24 +77,29 @@ Supporting different Servers ---------------------------- Support for servers other than hawkBit can be realized by implementing -the "interfaces" described in ``include/suricatta/channel.h`` and +the "interfaces" described in ``include/channel.h`` and ``include/suricatta/server.h``. The former abstracts a particular connection to the server, e.g., HTTP-based in case of hawkBit, while the latter implements the logics to poll and install updates. -See ``suricatta/channel_hawkbit.{c,h}`` and +See ``corelib/channel_curl.c``/``include/channel_curl.h`` and ``suricatta/server_hawkbit.{c,h}`` for an example implementation targeted towards hawkBit. -``include/suricatta/channel.h`` describes the functionality a channel +``include/channel.h`` describes the functionality a channel has to implement: .. code:: c - channel_op_res_t channel_open(channel_t *this, void *cfg); - channel_op_res_t channel_close(channel_t *this); - channel_op_res_t channel_put(channel_t *this, void* data); - channel_op_res_t channel_get(channel_t *this, void* data); - channel_op_res_t channel_get_file(channel_t *this, void* data, int file_handle); + typedef struct channel channel_t; + struct channel { + ... + }; + + channel_t *channel_new(void); + +which sets up and returns a ``channel_t`` struct with pointers to +functions for opening, closing, fetching, and sending data over +the channel. ``include/suricatta/server.h`` describes the functionality a server has to implement: @@ -109,10 +114,8 @@ to implement: server_op_res_t server_stop(void); server_op_res_t server_ipc(int fd); -The types ``channel_op_res_t`` and ``server_op_res_t`` are defined in -``include/suricatta/suricatta.h`` and represent the valid function -return codes for a channel's and a server's implementation, -respectively. +The type ``server_op_res_t`` is defined in ``include/suricatta/suricatta.h``. +It represents the valid function return codes for a server's implementation. In addition to implementing the particular channel and server, the ``suricatta/Config.in`` file has to be adapted to include a new option @@ -126,28 +129,20 @@ one for hawkBit into the ``menu "Server"`` section is sufficient. bool "hawkBit support" depends on HAVE_LIBCURL depends on HAVE_JSON_C - select SURICATTA + select JSON + select CURL help Support for hawkBit server. https://projects.eclipse.org/projects/iot.hawkbit -Note that the various server options and hence implementations should be -selectable in a mutually exclusive manner, i.e., at most one should be -active. Hence, include according ``depends on !`` lines -into the configuration to specify this mutual exclusion of server -implementations. Support for multiple channels and servers -simultaneously is left for future work as outlined in suricatta's -road-map. - Having included the new server implementation into the configuration, edit ``suricatta/Makefile`` to specify the implementation's linkage into the SWUpdate binary, e.g., for the hawkBit example implementation, the -following lines add ``channel_hawkbit.o`` and ``server_hawkbit.o`` to -the resulting SWUpdate binary if ``SURICATTA_HAWKBIT`` was selected -while configuring SWUpdate. +following lines add ``server_hawkbit.o`` to the resulting SWUpdate binary +if ``SURICATTA_HAWKBIT`` was selected while configuring SWUpdate. :: ifneq ($(CONFIG_SURICATTA_HAWKBIT),) - lib-$(CONFIG_SURICATTA) += channel_hawkbit.o server_hawkbit.o + lib-$(CONFIG_SURICATTA) += server_hawkbit.o endif diff --git a/include/channel.h b/include/channel.h index f0c13a7..906624b 100644 --- a/include/channel.h +++ b/include/channel.h @@ -20,10 +20,11 @@ #pragma once #include "channel_op_res.h" -/* Suricatta Channel Interface. +/* SWUpdate Channel Interface. * - * Each suricatta channel has to implement this interface. - * Cf. `channel_hawkbit.c` for an example implementation targeted towards the + * Each channel has to implement this interface. + * Cf. channel_curl.c for an example implementation basing on curl that + * is used by server_hawkbit.c implementing support for the * [hawkBit](https://projects.eclipse.org/projects/iot.hawkbit) server. */ typedef struct channel channel_t; diff --git a/include/channel_curl.h b/include/channel_curl.h index 94d3c55..d7d5677 100644 --- a/include/channel_curl.h +++ b/include/channel_curl.h @@ -23,11 +23,11 @@ #include "sslapi.h" #include -/* hawkBit Channel Implementation Private Header File. +/* Curl Channel Implementation Private Header File. * * This is a "private" header for testability, i.e., the declarations and - * definitions herein should be used by `server_hawkbit.c`, `channel_hawkbit.c`, - * and unit tests only. + * definitions herein should be used by code employing the curl channel + * (e.g. server_hawkbit.c) and unit tests only. */ typedef enum {