From patchwork Thu Aug 17 11:17:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1822282 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20221208 header.b=UIVhVq6V; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23f; helo=mail-lj1-x23f.google.com; envelope-from=swupdate+bncbaabbted7ctamgqe5um5ofq@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lj1-x23f.google.com (mail-lj1-x23f.google.com [IPv6:2a00:1450:4864:20::23f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RRMt96rqWz1yfk for ; Thu, 17 Aug 2023 21:17:36 +1000 (AEST) Received: by mail-lj1-x23f.google.com with SMTP id 38308e7fff4ca-2b9bb2d0b47sf73871881fa.2 for ; Thu, 17 Aug 2023 04:17:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1692271053; cv=pass; d=google.com; s=arc-20160816; b=RvjqvHmDn7c9K8/nrcupg5B7IcnA0DxsvFuy7+Odgz+igdESAdpP4HdGfSMmCps88r CCz+QYwxAziw15FFRIa0ozVlgrlupXRBZTROqnE6zZbypICDxuZ0VEyQBspctu+SNGGN D8ow6dbtdO1qYmHek4PVAVW5grfajtTUj9mgvDeN5uU0WI1F3EWhLW/KMeU1rjonVq/g IvN1b36sxBjC28s+1GH9TDac25C+K+P2SBmUNu87ZfejoFwpTxRsFh6oNdLsdTi/J7xe AEQbMUk6/cc2URQV7oRl8z9CdNJ5xo2whSY582IlngFIUni5G9urKLP8zmj6EAYcP2hn veKg== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=JvULnfZgQxOWROsKg4asoRqvW+RMGm4g+uKI7EBJ554=; fh=8dElY+qPRRukreI1M8SqoUXvyuuvKbIPX0wU3Qm8B9Y=; b=UVsH3gARg/lH/jO03Nr9a+bHJHfGfUvxMwk2z6ErVkfpk+g58WjCpY0PIfmxWZh3Gd zvhfBhJQY3sV7lYC7lLXuo1Y+WBEOtD7udfUxp/8UT1Fbbc7Bwmd2wGcMcPt4Ylta/6q uCIHXdHuyDvXezrGQ+a+fJYA1NxRmbxtrznfnUn4hMhut+OWAS32k9gYfSyIMa3Foz4T yUTLhpX0w5SH8qRaOL8RRbzJbpzYpz57/rotFuz+u/yaiyHFKBfvHwnQEPC/Se37W3nm yaL0SB12e39J38Qjye5FoQG62Krakj/iqwfKQfD6RzCud0xUhodcTdVg+N15SVAbiW9v fIvA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=softfail (google.com: domain of transitioning stefano.babic@swupdate.org does not designate 212.18.0.9 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1692271053; x=1692875853; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=JvULnfZgQxOWROsKg4asoRqvW+RMGm4g+uKI7EBJ554=; b=UIVhVq6VEgMx4H5W9o8m5VYcVQVkzQfj6OjLuezCoGMMKmOM6/04gHF87GqfxAfifW eWvrzhiO0CIWBt5g76xsiuaG3SWuMpIkfLCK0faBzFsjO/Dd6Zv9bKEWqGnL4UerSKt0 OL1Ey4TH2jVWLGVqzrT65ZNbWMR4+OH31MsRPA4pfThb/HrrG5lsMBJHuIcnyKh4B/++ NkT1ihhIF3aFwSENKuMfitIyxqcOggIVLlJ68O+W75IVuVUeaEXVY/d0BM+Xmb+Y7C4R ITfJnXRqklXchrV55Csdkx1phK8QsIVmWHBbvNrt/DF4E6KCnEBxEf7PtOQumYBz5Upx zVtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692271053; x=1692875853; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=JvULnfZgQxOWROsKg4asoRqvW+RMGm4g+uKI7EBJ554=; b=LNIxSXi3n+6wx9xBxB13Tldaev5pkiS3wxWyG36QOQfz9DGCCh4J0WSCsfpv+zn89L 6YWxp2bNQtHN48GH4QbINqk/qvsfC+di5NCzVlGIGGT83lIV4g26eTCHfwFfGkAeKyIF LlYY3DJ9WTh5lvE69yBBi7zOKvwS+40vTGogjkopWTDmBbaVSzdjyBvV2u6iprMXV1Zo wUjBVgV/Scp/MC8VMKzkCMbOWNlUar6ZTBdJL+nmzf9eSLFYpKC8oYM+NoCWGP+9V/sQ bOKyvC5vMXqpCidMPydQ7gwavI49MAGeZnNdVgbkEO20GJZGxZO3adjVHNJsJhTIesG5 TYtw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0YwpXR/oyYth8YB/tbmnMega1qTTVdiixsALdU0A6f4bz5kh6+9O OGKc1VoN93DIgT28As8pCB4= X-Google-Smtp-Source: AGHT+IF/Dpi0Gbb0D/MPvHUcSWTqNkQw/Af4jSsMUbsDZW322/1m0SFYZYUu+2LtKbM2so3wOMv+7w== X-Received: by 2002:a2e:9111:0:b0:2b6:daed:494f with SMTP id m17-20020a2e9111000000b002b6daed494fmr3548773ljg.35.1692271052840; Thu, 17 Aug 2023 04:17:32 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:651c:c86:b0:2b9:35cd:6782 with SMTP id bz6-20020a05651c0c8600b002b935cd6782ls279045ljb.0.-pod-prod-05-eu; Thu, 17 Aug 2023 04:17:31 -0700 (PDT) X-Received: by 2002:a2e:96d9:0:b0:2bb:97f2:b219 with SMTP id d25-20020a2e96d9000000b002bb97f2b219mr3917967ljj.32.1692271051098; Thu, 17 Aug 2023 04:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692271051; cv=none; d=google.com; s=arc-20160816; b=aNiYFt7AQ8idAwqf2RSnFv8lWQP0JEg+QYwiB08Whm+xfxG9hhb05IozlVruALBtD3 3kt5zD5t5t8iDBvzQl1gLBWkDWnJt5IfQwJzQIZBURF49LOX8N6NRe4a/NAnJ9ks4LMf xfa/lVf/lCOpGMuFLwMLLiQSlAg+1qKGknRXebtgyIFADg4tO3qtT1YuXNQy1f/jdOMr f+BrdyW9JWZOYYfQZVG420fM7Sag84Al/HuolXGs9DWic/lcgyQEG0vOjhOrd2LbHVeH 1ezVTRBhUs8Jg844J5xoy0r5fUfaHUGL377f8gxhdlUqjwqgwaBVZ8Hv4gfOAjl8hqwz Gp2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=wKOPcoFWW8GR56xLGhmswkaDxpdUzHeK+uC6n6T/RvI=; fh=8dElY+qPRRukreI1M8SqoUXvyuuvKbIPX0wU3Qm8B9Y=; b=rZ1A8C0VXw0YZitHQpSS8Cn+WNJo7UYOxnjab/mu/yXwRnj+w0lK/1pSn5HjeqNq/p vXt+JSQiI/fkNO/We8SlatfsmDbxovS0OWH2OdrcpOL39fzGjgtDs5mCu6bnZrHH+TBy WRKZqBT1K8NRkugJCmq9MOvFI59FWGpjMz86LN27rhLNo4w/Zr+K3ieUiagHlNBXCjR3 FeCBXAIrwqtCwm06VdGaPoQhBpmiGjZE9Us4s7fgcBA7D/zauzA+m5jH6zjdf/Ib1TSO Hao+PIrYCqHRVllN2xxTMBN+um/gRmuPG9BtAZ23Zmd38UoS0Z3MUxh7oLVa1OeqglSk whtw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=softfail (google.com: domain of transitioning stefano.babic@swupdate.org does not designate 212.18.0.9 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id m18-20020a2ea592000000b002b96150efccsi1354282ljp.0.2023.08.17.04.17.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2023 04:17:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning stefano.babic@swupdate.org does not designate 212.18.0.9 as permitted sender) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4RRMt24GGxz1r3Dw; Thu, 17 Aug 2023 13:17:30 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4RRMt248YRz1qqlS; Thu, 17 Aug 2023 13:17:30 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id yFGNj38uvjxw; Thu, 17 Aug 2023 13:17:29 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Thu, 17 Aug 2023 13:17:29 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 2EBCE4540810; Thu, 17 Aug 2023 13:17:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xjUay26tfJxr; Thu, 17 Aug 2023 13:17:25 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.48]) by babic.homelinux.org (Postfix) with ESMTP id 9DB0B4540B75; Thu, 17 Aug 2023 13:17:17 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 4/6] Factorize functions used to get IPC command Date: Thu, 17 Aug 2023 13:17:10 +0200 Message-Id: <20230817111712.235063-4-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230817111712.235063-1-stefano.babic@swupdate.org> References: <20230817111712.235063-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; spf=softfail (google.com: domain of transitioning stefano.babic@swupdate.org does not designate 212.18.0.9 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org 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: , factorize server_tokenize_msg(), map_channel_retcode() and suricatta_channel_settings() that cna be used outside suricatta modules. Signed-off-by: Stefano Babic --- corelib/Makefile | 2 +- suricatta/common.c => corelib/server_utils.c | 3 +-- suricatta/suricatta_private.h => include/server_utils.h | 1 + suricatta/Makefile | 2 +- suricatta/server_general.c | 2 +- suricatta/server_hawkbit.c | 2 +- suricatta/suricatta.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename suricatta/common.c => corelib/server_utils.c (97%) rename suricatta/suricatta_private.h => include/server_utils.h (95%) diff --git a/corelib/Makefile b/corelib/Makefile index fb0a9894..5f6f8e94 100644 --- a/corelib/Makefile +++ b/corelib/Makefile @@ -34,5 +34,5 @@ lib-$(CONFIG_SIGALG_RSAPSS) += swupdate_rsa_verify_mbedtls.o endif lib-$(CONFIG_LIBCONFIG) += swupdate_settings.o \ parsing_library_libconfig.o -lib-$(CONFIG_JSON) += parsing_library_libjson.o +lib-$(CONFIG_JSON) += parsing_library_libjson.o server_utils.o lib-$(CONFIG_CHANNEL_CURL) += channel_curl.o diff --git a/suricatta/common.c b/corelib/server_utils.c similarity index 97% rename from suricatta/common.c rename to corelib/server_utils.c index c47fa5c7..d7d733d2 100644 --- a/suricatta/common.c +++ b/corelib/server_utils.c @@ -13,8 +13,7 @@ #include #include #include -#include "suricatta/suricatta.h" -#include "suricatta_private.h" +#include "server_utils.h" void suricatta_channel_settings(void *elem, channel_data_t *chan) { diff --git a/suricatta/suricatta_private.h b/include/server_utils.h similarity index 95% rename from suricatta/suricatta_private.h rename to include/server_utils.h index 25f9e7f4..7df02e3b 100644 --- a/suricatta/suricatta_private.h +++ b/include/server_utils.h @@ -9,6 +9,7 @@ #include #include #include +#include "channel.h" #include struct json_object; diff --git a/suricatta/Makefile b/suricatta/Makefile index f5b2bbdf..6be15429 100644 --- a/suricatta/Makefile +++ b/suricatta/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 2014-2018 Stefano Babic # # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_SURICATTA) += suricatta.o common.o +obj-$(CONFIG_SURICATTA) += suricatta.o ifneq ($(CONFIG_SURICATTA_HAWKBIT),) obj-$(CONFIG_SURICATTA) += server_hawkbit.o endif diff --git a/suricatta/server_general.c b/suricatta/server_general.c index 7c78eba3..e86bdee1 100644 --- a/suricatta/server_general.c +++ b/suricatta/server_general.c @@ -26,7 +26,7 @@ #include #include "suricatta/suricatta.h" #include "suricatta/server.h" -#include "suricatta_private.h" +#include "server_utils.h" #include "parselib.h" #include "channel.h" #include diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 3e68db57..e6006cf6 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -22,7 +22,7 @@ #include #include "suricatta/suricatta.h" #include "suricatta/server.h" -#include "suricatta_private.h" +#include "server_utils.h" #include "parselib.h" #include "channel.h" #include "channel_curl.h" diff --git a/suricatta/suricatta.c b/suricatta/suricatta.c index 6fb0ae99..9f454d59 100644 --- a/suricatta/suricatta.c +++ b/suricatta/suricatta.c @@ -20,7 +20,7 @@ #include "pctl.h" #include "suricatta/suricatta.h" #include "suricatta/server.h" -#include "suricatta_private.h" +#include "server_utils.h" #include "parselib.h" #include "swupdate_settings.h" #include