From patchwork Tue Aug 30 16:22:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1671933 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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+bncbdd6bwv65qpbb77rxcmamgqezqcjg7i@googlegroups.com; receiver=) 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=20210112 header.b=QkesmnML; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHCH76B7Dz1ynD for ; Wed, 31 Aug 2022 02:21:23 +1000 (AEST) Received: by mail-lj1-x23f.google.com with SMTP id o16-20020a2e90d0000000b002681c6931a3sf465040ljg.10 for ; Tue, 30 Aug 2022 09:21:23 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1661876480; cv=pass; d=google.com; s=arc-20160816; b=VbOV1Nlvpb7sPmWgL/dXavByXkounq05PPAEZaoKJi9qIM1viOvGPAbJzNEldjihWo 6JtcXgNMl8i4fa9fEz7pwYVGJyWgbSMQFU8O0zIsYs78oxbt6qbDRDdCxgeOApxYWhw2 65StRj2ge+CNTxLK6h97VLYq5XZTvehi2k1HYuNiewccYVdmr+iOilgFWoXpyVBvbeBa 5exoznVIFjVFW0Vc9bD5fAD4O/QQSAZ7x9OKAt3wzN3lCUg1AET9KepUkSUxUNbhkas/ Z0Pxy8TC5QV2gucG8S45TRiM9MGx6+9Bcsn+g5xfoarFi0pQj4BULvU6kJ/8S9k3SMlX W9Tg== ARC-Message-Signature: i=3; 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:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=oH0wRQoVIPxd7S04zDfiv8bQz9h1Irzyvoigu2bE6kA=; b=LkVHldR14hfURJ7V2xNaJTbEELjRpZgrloqo7ZPcz3cccqkDMi+PCHk6RO6hWfBrhh L3qn+7ZNYvHIbTWB5hu4n/jNwppl5BTA6zu2VmRfuid7/7W7p5n1xOOoBW/Y06S73hLb KJph0QjMvObLfVYj8KlFPyc5vxz/AQ34oOmZyMEOcyBGnHsCFGL8Y+jNheUEkYSJB9vy mEOSI/13p7igjIZnlK6FswjiSZSyNghSiRsbt3g+Pu8zREQ/yB7LQx+aHUyVahCFB167 lpq13Bjn6ASqZgQ2kBI6p0f/BAbPRB85tlfW+BtNvt/atfrLFopLz7mdIgRC+3tvOWlb 0vqQ== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=yeVLJpYe; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.105.70 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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:message-id:date:subject:cc:to:from :sender:from:to:cc; bh=oH0wRQoVIPxd7S04zDfiv8bQz9h1Irzyvoigu2bE6kA=; b=QkesmnMLARpYkGHrL3ozpQCLl/NFIZav7BVCSEnOT3jTV9AVBMkdqnGrSFAq9gxffs Ut16Ai6yYn9fAn2/gvUAuDMqQXAJGxRJDi3LEFr4SDPZUwuBp7ZXp7Ih17Tp0HgfBpJX Ib2nzr9l54N5PRZucs0wypjBEGINx4WXnAApBq+T6l+P9LMaj9ghpMOD2iHqf1lWiP0+ 7l/pLBGsYG8nqjGASi6IJCDnXGLtoN57h3ZGIpIjsUEPHUgMviOfCSNXxMqbDvrnorbH SZXLGmgdO0iozOOCD5G9bQpJz/0hTtiOOfsVRW4e83BReRN1MZ+nxYfN8NLG5dOQ52/f LmaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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 :message-id:date:subject:cc:to:from:x-gm-message-state:sender:from :to:cc; bh=oH0wRQoVIPxd7S04zDfiv8bQz9h1Irzyvoigu2bE6kA=; b=i/xTBfzNnxBqZsmhMWQOKHAYet/ohvFWJwXBnfitjoInf3h+AMyYiQSvqZ6FyL6HnB giNWdIvbxEQjIXed4/hCKl/Qci50+BwpoKJ3qvWW+vffPzKPg6kuFoO5gbf1sHDWjW8q iIs4npZY4N0kCxHT+n1QJeOY2OwRpH5HSrMPkl6mdU/vxxTHd6B7NT7pUb8ylH+d7SFl QFpAWcrxZehdciv6YJtytEa7N583he073p/QCauxFZngkDtUNB3/HH69G23nZBXSdsZ3 JH2TOwo9No9I9ceA8QFZyBJexmeuMFdLOtwOeYNdHJHjr26ziUMbZ+Pxo6W98rOlepP9 k2Tg== Sender: swupdate@googlegroups.com X-Gm-Message-State: ACgBeo2N4hgT4XcenXAOl3zI0nFHO9Xrpb+78yaXal9v/tQrExCgVcwZ QJfcFQGq7hkdCn2WkbZiu4o= X-Google-Smtp-Source: AA6agR7v8IqNbJqNDgqJv5LwFukSbyqRLgpvxp6Ggtyv9K6Abvb1IODySwLgp6Dds1MnNx2QfDxM3w== X-Received: by 2002:a2e:960c:0:b0:266:c8a7:8b36 with SMTP id v12-20020a2e960c000000b00266c8a78b36mr1806674ljh.59.1661876479908; Tue, 30 Aug 2022 09:21:19 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:651c:1a06:b0:25e:58e5:b6d5 with SMTP id by6-20020a05651c1a0600b0025e58e5b6d5ls2136087ljb.1.-pod-prod-gmail; Tue, 30 Aug 2022 09:21:18 -0700 (PDT) X-Received: by 2002:a2e:a589:0:b0:261:b223:488b with SMTP id m9-20020a2ea589000000b00261b223488bmr7760797ljp.33.1661876478252; Tue, 30 Aug 2022 09:21:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661876478; cv=pass; d=google.com; s=arc-20160816; b=RomZ7Dr4dzT6cxDHHDI/liXDEe7bZ7VXfiMKvM0//sNmk+bvNYuJC/n1JgUNon6cM0 0DDWw1Zlp7Ef75RqcQ8q9AX5uqkRseOez/iJl9dKYdcV4VFhdcC7t6bCArErHzChAYGt koYw/QiHaNn2F+tPqHaJl58nCCgpXXuRPx4Cw3ZIMutVu1r5FTJniNYOQ5rdVs+Yv9R3 3LEuS0n5uUqnJy86HKcV2u9r6EeFcecpzyVxpgiOFp97G1xxrxXduMCN8fLmHutnjx48 AsGm/jsV0YvB6zh+Itzm0gvuwWqcopf8Ol3hWWawYXUy8V0EyQiP2i26i9j/sp2ew4bJ DTRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=9FqUVB4kC/mM40Dl6PwvCQ3ORGt8Nyo47yWoN6BwwlQ=; b=PAWxECl2DrL4zNTUC2nsZxBrY1GT1qj6H/jrKVnG4w6XgvT/x6F80E0PcvFZxFwsat cEZOHznuLTmD8Dw3j2qwdw09k6QmvnOHgVDKCTHOVuykfTdgoWOzkwhn/6itgEkii8t+ rHeWGuvghOq0DKj3YUGRwvwpGDinfFLfknveYN3bQiYW6wm/pI265eNr9RA2r2MRCnn/ ePDm2wFYanmjZjg0rNBA1mrvRfD7cTThlzNxLGw64eel/m070Iwnv3jvehQxcXKQYZCU 04N5yMwqxMvc4yY2c0RlaEuk0c03HSYKqi6Ugg8e6ErR91bbmHZS+NmGpoPvnW4KQl4+ xNFw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=yeVLJpYe; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.105.70 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2070.outbound.protection.outlook.com. [40.107.105.70]) by gmr-mx.google.com with ESMTPS id t12-20020a056512068c00b0048b12871da5si473101lfe.4.2022.08.30.09.21.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2022 09:21:18 -0700 (PDT) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 40.107.105.70 as permitted sender) client-ip=40.107.105.70; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nfituXKvpAQ6OWw3hCoM9qGOVYtVU4kRLFsLJrQ0BY+EFaNdi6JQruaQIdDP4ahisBJRLFK0UudUYfm9eRmcRWR1/vEsEOkx4T/w/SruTova8TrEfOyS4zqw1HquYGG6ST7CFuf07LXHThivjlwSia72D0QGR8Z7Wsla3ar3gaPcmxf3FgfB3T2R2tavXphpOPZjRzQKAwJa3kP71OmuoZZrGPSotVSFzSEptXStyj4CT4imyZgN3GeB62XbyfnA3BHI+SkOUpgzJ5L3YBta4O1jfaL1fpOOT5fNO6c8zlM0678pd9LHqsMO9BGfDGE4ZszDmogfI+BR2bjH6X+K3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9FqUVB4kC/mM40Dl6PwvCQ3ORGt8Nyo47yWoN6BwwlQ=; b=jWz3pkBABud0rvDwyw3OmJkWOLnnjPOPtyc1vIZiFYHrYvsJsTqekOf7o0mV00ZCR9NyUskiDv+jQxSsu8anK94Sr0S1Sow8tU2nciivngLhzbtj+WIAURH1kn2GAgGRi8UIrmG0hd5wnCqC+S/rmHUXa/BuJF+bbEU4+SvjvQ23HhTzdwpxtupZrnFzYXy1aS+qYE4pVwEvwjZivjnZWXREZ5/C5VLjkl4jnkNM1qkFDXmhVZ7xTB4cXGBHmc0jEv5s6mPkPJK3Lg+gHZeeMXekFPxR6oM02HePUS+6W4d9L+r1Zg85KHl/FcTE/YH+4xn0bsvCJN5DOsU3ZtAj6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.76) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none Received: from AM0PR05CA0096.eurprd05.prod.outlook.com (2603:10a6:208:136::36) by DBAPR10MB4106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:1ca::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.19; Tue, 30 Aug 2022 16:21:16 +0000 Received: from VE1EUR01FT080.eop-EUR01.prod.protection.outlook.com (2603:10a6:208:136:cafe::58) by AM0PR05CA0096.outlook.office365.com (2603:10a6:208:136::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 16:21:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.76) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.76 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.76; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.76) by VE1EUR01FT080.mail.protection.outlook.com (10.152.2.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 16:21:16 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VSA.ad011.siemens.net (194.138.21.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.12; Tue, 30 Aug 2022 18:21:15 +0200 Received: from MD1ZFJVC.ad001.siemens.net (139.25.0.117) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Tue, 30 Aug 2022 18:21:15 +0200 From: Christian Storm To: CC: Christian Storm Subject: [swupdate] [PATCH 1/5] bindings: Update Lua IPC interface specification Date: Tue, 30 Aug 2022 18:22:21 +0200 Message-ID: <20220830162225.42042-1-christian.storm@siemens.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Originating-IP: [139.25.0.117] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 528ba79b-8a44-4d7a-2f23-08da8aa3a9e0 X-MS-TrafficTypeDiagnostic: DBAPR10MB4106:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PXedqhnC5WZXb4HhFLoQP2rhBOn8iQyqyY/Wep8UZl23oybFHa0Ywot9dvY8/Ql4HALPf4uAVONKBqDKy9fjMI1U5qrYpyCd7foAU8kCkhV7fdrsSrQB0fgZYA/GXbnNLRsHeboiIYzrjm+VKPVfXQwAJoFdFiSZYMoX1oBIKalefH58UV7HuDFN8SEvBvSlM6BAw3VvvvLIW4jzyLZ2xxCmmnMKR7IqRFKnMY825QLAN1NHngtTElVA6gZw36BqkIcuxU7RfYcj1vV4oUfH0obZMwNjCD+xI0fvShvySqs1DLWObf2HzrQkBwaaG2eLwv6u9ls597n98a++yeEPJBIzFy6Iw1bDcftMnZt8fHDFCLzgjEJUTseuQr4pi3yUNnntzALHMOypNw3bmQzElQZlLyYklgngyF1/ds/lMkaFJJcCjKqHLAAAy8joJoKP0uldJUCPmPhBpAr8NNyQFfKEkC7iPv/psSsLctmHXY0Rm08v4ssUgBif5ABhkitVezEszGw6pIl1BtDUHc96aag1y3XKNyH3b0mL1FAn0hMtodn98tQQmEGaEabJNqfpBRWEnQCYz+kpCHXRK5FUUjCZ5Zw/wL7VxGyrVsDOHo3LyYkksTCCRuMOHuHcRQxzgduxrazhcWI5mbl9fxlGPETu0u+FNG4RfDjSywQK7Mkd9E3iY6Ki9XfBkwY6/4+nZEfJ/s0Uc7p3onU7APgVLwldiKI83OG2YjNuD30eUQxYjQUiDffu6UmZEf2IQpZoD8vpaz2tS4VkXYKo+qpwqRLYNpv+Ei1w1yhfcF5rsUU7vI8GoNGpUWhhpsxfzN8U X-Forefront-Antispam-Report: CIP:194.138.21.76;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(136003)(376002)(346002)(396003)(40470700004)(46966006)(36840700001)(82740400003)(83380400001)(41300700001)(478600001)(36860700001)(6666004)(107886003)(5660300002)(8936002)(2906002)(44832011)(15650500001)(36756003)(81166007)(1076003)(70206006)(70586007)(82310400005)(82960400001)(956004)(6916009)(47076005)(26005)(2616005)(186003)(40460700003)(356005)(336012)(16526019)(40480700001)(4326008)(8676002)(86362001)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 16:21:16.0065 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 528ba79b-8a44-4d7a-2f23-08da8aa3a9e0 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.76];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT080.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR10MB4106 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=yeVLJpYe; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.105.70 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Use @enum for enum-like tables. Use correct type Table for `self` returns. Signed-off-by: Christian Storm --- bindings/lua_swupdate.lua | 50 ++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/bindings/lua_swupdate.lua b/bindings/lua_swupdate.lua index 423ac78..e6a061f 100644 --- a/bindings/lua_swupdate.lua +++ b/bindings/lua_swupdate.lua @@ -31,9 +31,8 @@ local lua_swupdate = {} lua_swupdate.ipv4 = function() end ---- @class lua_swupdate.RECOVERY_STATUS +--- @enum lua_swupdate.RECOVERY_STATUS --- Lua equivalent of `RECOVERY_STATUS` as in `include/swupdate_status.h`. ---- @type table lua_swupdate.RECOVERY_STATUS = { IDLE = 0, START = 1, @@ -47,9 +46,8 @@ lua_swupdate.RECOVERY_STATUS = { } ---- @class lua_swupdate.sourcetype +--- @enum lua_swupdate.sourcetype --- Lua equivalent of `sourcetype` as in `include/swupdate_status.h`. ---- @type table lua_swupdate.sourcetype = { SOURCE_UNKNOWN = 0, SOURCE_WEBSERVER = 1, @@ -61,10 +59,10 @@ lua_swupdate.sourcetype = { --- Lua equivalent of `struct progress_msg` as in `include/progress_ipc.h`. ---- @class progress_msg ---- @field status number Update status, one of `lua_swupdate.RECOVERY_STATUS`'s values +--- @class lua_swupdate.progress_msg +--- @field status lua_swupdate.RECOVERY_STATUS Update status, one of `lua_swupdate.RECOVERY_STATUS`'s values --- @field download number Downloaded data percentage ---- @field source number Interface that triggered the update, one of `lua_swupdate.sourcetype`'s values +--- @field source lua_swupdate.sourcetype Interface that triggered the update, one of `lua_swupdate.sourcetype`'s values --- @field nsteps number Total number of steps --- @field step number Current step --- @field percent number Percentage done in current step @@ -73,7 +71,6 @@ lua_swupdate.sourcetype = { --- @field info string Additional information about installation ---- @class lua_swupdate.progress --- SWUpdate progress socket binding. -- -- The returned Class Table contains methods to @@ -83,28 +80,27 @@ lua_swupdate.progress = function() return { --- Connect to SWUpdate's progress socket. -- - --- @param self lua_swupdate.progress This `lua_swupdate.progress` instance - --- @return number | nil # The connection handle or nil in case of error - --- @return nil | string # nil or an error message in case of error + --- @param self table This `lua_swupdate.progress` instance + --- @return number | nil # The connection handle or nil in case of error + --- @return nil | string # nil or an error message in case of error connect = function(self) end, --- Receive data from SWUpdate's progress socket. -- - --- @param self lua_swupdate.progress This `lua_swupdate.progress` instance - --- @return lua_swupdate.progress | progress_msg # This `lua_swupdate.progress` instance on error or the received progress message - --- @return nil # nil in case of error + --- @param self table This `lua_swupdate.progress` instance + --- @return table | lua_swupdate.progress_msg # This `lua_swupdate.progress` instance on error or the received progress message + --- @return nil # nil in case of error receive = function(self) end, --- Close connection to SWUpdate's progress socket. -- - --- @param self lua_swupdate.progress This `lua_swupdate.progress` instance - --- @return lua_swupdate.progress # This `lua_swupdate.progress` instance + --- @param self table This `lua_swupdate.progress` instance + --- @return table # This `lua_swupdate.progress` instance close = function(self) end, } end ---- @class lua_swupdate.control --- SWUpdate control socket binding. -- -- The returned Class Table contains methods to @@ -114,24 +110,24 @@ lua_swupdate.control = function() return { --- Connect to SWUpdate's control socket. -- - --- @param self lua_swupdate.control This `lua_swupdate.control` instance - --- @return number | nil # Connection handle or nil in case of error - --- @return nil | string # nil or an error message in case of error + --- @param self table This `lua_swupdate.control` instance + --- @return number | nil # Connection handle or nil in case of error + --- @return nil | string # nil or an error message in case of error connect = function(self) end, --- Write to connected SWUpdate control socket. -- - --- @param self lua_swupdate.control This `lua_swupdate.control` instance - --- @param data string Chunk data to write to SWUpdate's control socket - --- @return boolean | nil # true or nil in case of error - --- @return nil | string # nil or an error message in case of error + --- @param self table This `lua_swupdate.control` instance + --- @param data string Chunk data to write to SWUpdate's control socket + --- @return boolean | nil # true or nil in case of error + --- @return nil | string # nil or an error message in case of error write = function(self, data) end, --- Close connection to SWUpdate's control socket. -- - --- @param self lua_swupdate.control This `lua_swupdate.control` instance - --- @return boolean | nil # true or nil in case of error - --- @return nil | string # nil or an error message in case of error + --- @param self table This `lua_swupdate.control` instance + --- @return boolean | nil # true or nil in case of error + --- @return nil | string # nil or an error message in case of error close = function(self) end, } end From patchwork Tue Aug 30 16:22:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1671934 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::238; helo=mail-lj1-x238.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbbhsxcmamgqelddmnxy@googlegroups.com; receiver=) 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=20210112 header.b=NTUbmEfL; dkim-atps=neutral Received: from mail-lj1-x238.google.com (mail-lj1-x238.google.com [IPv6:2a00:1450:4864:20::238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHCHD5V6gz1ynD for ; Wed, 31 Aug 2022 02:21:28 +1000 (AEST) Received: by mail-lj1-x238.google.com with SMTP id f10-20020a2e9e8a000000b00261af150cf0sf3273831ljk.13 for ; Tue, 30 Aug 2022 09:21:28 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1661876485; cv=pass; d=google.com; s=arc-20160816; b=zItJczRrPWHvlgkaWkomonaKFXRQri0TWayajuLg5HZsiP/e29b/orgdbnkZ5FzSeV FaRZTwFjhiMUuXnSkrRVBUHcGdygAmZelTF6RxbqNG4Sa5I0VHL0FVR9h36+EW5wL/ej Zyuq7FUpsIl0l5M3RzXyseDRW58Fe432yzZQ28H7a+8NdOu341vbFzFE7hyb7xRB/KY0 sDsHE0jchrvcMBzi9GEh+PDEq/qSQCVtVPkxABDuuX9XuBtjXcVoYIZPPe8a/CHlpS6u LGKGWdVYj9mNaDGcBcwCHBYACiZaYRCRLbs5JfxO34wvYByXvaI0W5kBb0wgfBhvBcDc O/Xw== ARC-Message-Signature: i=3; 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=puSzenvtuyzoPO2KVn1YM3/fh/90+F5Q9c3kbxu7gv4=; b=XAJhgjLav3DhjUUYHB+MuJOXTeQ4p0MGZGSnX03g5mOK7IXDV6yE0NKb0MvjB68jcP EfJbIO7rwmql5maiffp26YFK/FYAiHmNwdubPCXyFfgPxjuoemVjtgltzDziMTzo+TXM QszcM/aK5zePKojhym6/Mh5hpQ3RhwMSoiBFU81/RfiEtXupXSVDyl1QJwCR5B/GxDrG 2xP2odEUzDfJW3Bwvx0RLFIacGazCCeEDkRF1m1pEdww4gG6GwWAzIq9VwwMt/UJ5SCI RxoL1HWFhLY1o1Tb/1gKSNtBE+qWecPXvt5sawn54AFwXA5vof4w+DAWhlWTXLe5Y/uQ qTdQ== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=xyAvYT46; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.0.84 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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; bh=puSzenvtuyzoPO2KVn1YM3/fh/90+F5Q9c3kbxu7gv4=; b=NTUbmEfL7G1NfKoW3jL9ZMA93DNgrOfOLZmzioLVSkNL5LFMqLRGHp2hUFRRqkPQje mAcPX76sw7fKI0mWUFPN1ZC8hSlQV7avqmnlJtgI+hoKFRyaJ1oZvJ8ua0wzrQ3X5k97 GGZcJ+rTKRutcxj6Qcsa+1j7CpOq+yJ5MVWUF0n8i0P+vo6voFOKYSjAITanpaAv8HXr 6kFN/C0OzIFZnnaYzWafZnM5W5NoriQ9Mr6ERxrqpYtXa31s+Wh6xTzeeC2+w5RECtWy TQ7V8Ig0AG2tT7jZEFvbC+4aMR767Fy27wlmR6E2huthad6twVAtihxiizyPO5x9qICJ D5mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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-gm-message-state:sender:from:to:cc; bh=puSzenvtuyzoPO2KVn1YM3/fh/90+F5Q9c3kbxu7gv4=; b=PI1CBTBy61ioEflk9Q2BdDfEHc2m68FQWmDO6Hat4ewZ97kf31Bi3SQ+1+jucT2V4r /LdpnrLKmbe/96lNGnyvmHAIuc1p9YxMh4P2tQ3Drl78iBuUsbj/DpBS0pqI1QlZt5z/ MXrUyx15+OqH3r3EUyNvHiyJYK/rqvoi7gr67l6NFjuu7Do+4YolxTyad1crT/GRsinF p0vT9nyuPyg7SsyUSnXK6N0FaKCZKoU9uPzoRYDH+kGZ8xg+BNHde5j3xIOW2GbItFHA j7/bH+AbAejYTLbQJ11zf68jRCYAoEUbPvKh4pW9QTw7EqPSgCUDlaTapsto6C+V2lnS d3JQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: ACgBeo2uLNIIOWK3C36kzZiULvIc2R+ZXRAKnbjnZP7fRg9ZBow0JRh+ dazwN8omD1JwjtWJ9HVgoGg= X-Google-Smtp-Source: AA6agR4pDNVwxUd8l1BL0KOgrqI7Pu2bZ9GBEt9GdHX4Rv7sTUZ6AF21v6/iNMMk9pkPIPd1ZvJv3g== X-Received: by 2002:a05:6512:3e16:b0:494:7a54:aa99 with SMTP id i22-20020a0565123e1600b004947a54aa99mr1155698lfv.156.1661876485528; Tue, 30 Aug 2022 09:21:25 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:bc29:0:b0:261:d944:1ee6 with SMTP id b41-20020a2ebc29000000b00261d9441ee6ls2138970ljf.0.-pod-prod-gmail; Tue, 30 Aug 2022 09:21:24 -0700 (PDT) X-Received: by 2002:a2e:8881:0:b0:255:7790:25e6 with SMTP id k1-20020a2e8881000000b00255779025e6mr7250905lji.525.1661876483950; Tue, 30 Aug 2022 09:21:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661876483; cv=pass; d=google.com; s=arc-20160816; b=iW0JHveQNFmaA2Pan+esTJncRBwI2LFLfnmQAruRsqVTJSocyKH6AaGSpTr/P57aaW gnFIKVGepF2bjIbYXP9hXEhJYt39316PekSRdXygVaSEW8DIv8TDqW6U/9OEu2mmSevI Tko2NSnqzrqSWNELO9UmR0Kn6CDWPr2MiMM9IXxw7fdue8kZ0mT9SReMSjtmQnI4tFLk dhXBSSXRO/3TblnN8M17bE1P+UwSAy0y6OfTjBap8/xHJIx9fdbAA0pdnnzRuJb3ue3C Zm2ZL0nPM5OrFY+rd1nwRCsbp0tJgoIYb3cYRhEXK1sH7sEonDdfB9Mo7p4OSuxD7k2v PKVg== ARC-Message-Signature: i=2; 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:dkim-signature; bh=Ei4Y8oDr6CsWGHXTSVyqzTmd4fbrK+K+hjqUXQJI5kU=; b=CwEVff+4A0vWjRa4bJOKvFTgZPnUTshmnCqPBvOuLL/Mn3FXGwyMiyEskIsRt71uU2 OYP6GGhaIEuNqspxFZDKtS8OTX4YKgv0OSyz+4JRN2V556dljO64oVkLlhbqD2WkvuIU BmahK7R+V6bMAQlWGHMjm79ijb11BGba4J7Kc5Hl5BHixVMJLWMpFGAh/tanzcVfF0TM K9fzdqwRLSxXPy1rMSsLYdvkqWw4ksQgVool0K5+LpjeOEV5KXl9jI8moaezyGkgy6Ia wl2pfmp2IEtWcDK/dywShgh6U191sDBzaR3FsJ4289W0lx3Uakh4rVuXoIh3/yWUc6be FHaQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=xyAvYT46; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.0.84 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00084.outbound.protection.outlook.com. [40.107.0.84]) by gmr-mx.google.com with ESMTPS id i22-20020a2ea376000000b0026187cf0f12si512904ljn.8.2022.08.30.09.21.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2022 09:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 40.107.0.84 as permitted sender) client-ip=40.107.0.84; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jk+Jxez7mhX//213wnxU/z2POgJyNLHP5Rctjq5pavJj/eErmfHINb1MdaccWWvRx0V0b2W5l8OUQm/ZunFtV+OcHk9ME9RMxO2wVbYk1QSMXVf+ZmrpkVPzXAaQJU/sVYalCXNTai0UURMmEoGOZbhEqakSu9MwJZOSRpfeYqmpA2MwefSREOQ0Lq8QQr5cl7v1u2PXznplDUigkGUdTUY4AevxCmKHtMchK74HucMvfZlHxb5ymSrqy42l9Fp34DCVDb2yOG7gWcpC50PUiB1Nic++jpsb1qiSLnsFOMbkJur+iMWAlrRWUFmxFe1onRhmXv6dWZqZTik2Ofuo3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ei4Y8oDr6CsWGHXTSVyqzTmd4fbrK+K+hjqUXQJI5kU=; b=FilIyvFAGZ23JmtMb4Jo9LRb4bq5MPSLbFESU+MsbTaG9crgj3nb8lkstF73mAGxfKuJZWdmCwVfPXd0ReaPIh0QEH5uH04HSQ7qDAK5wGpK6KJYR26WJ18jY2N6l9ibr/6h2H6FWHPMwzjM4HSecAR5T+1Rzwx5YMj03GChXtGIz1XAHfaAdUZnaj0xTE0Ubvevst1UtnLue76v9BS8dmFJcDoDr2tRa3oDzPfzVZuLkgcoFJPJzXPBPhvuQa47+Q9CeVtaXvE0zg2KCACJ+Fmg+BKYdlh+7QGtB9f8HXCufOJ8MtuExi/qcZ3Zj2TAv0AWjrYU4KyPHxI2GE9mZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.75) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none Received: from DB6PR1001CA0002.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:b7::12) by DB8PR10MB3944.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:16e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 16:21:22 +0000 Received: from DB5EUR01FT038.eop-EUR01.prod.protection.outlook.com (2603:10a6:4:b7:cafe::45) by DB6PR1001CA0002.outlook.office365.com (2603:10a6:4:b7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 16:21:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.75) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.75 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.75; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.75) by DB5EUR01FT038.mail.protection.outlook.com (10.152.4.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 16:21:22 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VRA.ad011.siemens.net (194.138.21.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.12; Tue, 30 Aug 2022 18:21:22 +0200 Received: from MD1ZFJVC.ad001.siemens.net (139.25.0.117) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Tue, 30 Aug 2022 18:21:21 +0200 From: Christian Storm To: CC: Christian Storm Subject: [swupdate] [PATCH 2/5] handlers: Update Lua Handler interface specification Date: Tue, 30 Aug 2022 18:22:22 +0200 Message-ID: <20220830162225.42042-2-christian.storm@siemens.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830162225.42042-1-christian.storm@siemens.com> References: <20220830162225.42042-1-christian.storm@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.117] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf5b87e5-f7ab-4e14-6d3a-08da8aa3adb6 X-MS-TrafficTypeDiagnostic: DB8PR10MB3944:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lPRbQZHPK6cidpYB/OwSwowChbxVzGJ2fe7jZO+OSCwTnuMMZBMnjIhY2wWNdVGbnohUWsy0TRDtt9JCNnwnsTlqCk5SE+nJ09+ug9mOmJNnWxvGBASafhA78NSozoNIJ3UzSIZCdzDvkYho67xRNMhUbTn42CTgJeMA2I5nQa98D1/r46PaXRqXA66zBdfql20I12nlUkRl8KLhzO/Zvp6okknJc/Dl/1KRUo92om7E7O/ZJ/Tt+fwHVn//6gf35fnoSc2fLd4FWpb1CPnK3jLL6taPlN29hrZ7WJiIO3I8+TRs7/bo1N8tlbxCh1XrsUOg4wWQtgPCrJ4g1WhdHkvHK8ZGMWJ1o2E0mp94o51gllvXkZ+EzJDS4BMp0KM6/A0J7zuMISE5JdFUCLCOF6BhaUqROTGZq2PzsLfXG65RAxePbfbtnt4wp7cRgDu0SBeiCXbPNZh9OCzTgTI2EO9cogSJn0vVX6s2HkrxY+NtmAirOrIi9rS5KtsWYKHRtnKclROSfFbldNcWOfywg5xI9WizyxKWsfTSX73xFIj5SNngurWEg0b67uJYnEQnYVlnieogk9Y+IiKLTNnYBlKXp/GD8yZ4u9F0XB3S/yW4qUnlPZuO4ekBJRroHbHMn7oeHczQK1kOXogL/EicWYMwBqED5OA0RGlOwqsQlDA6FtiwTx5rtMgbnSzpjF9nkb6UDqJkWDywEifne4ixCxxyuvX0oz+V0s6Bfl7LhSP8eijM2scVa8YrRnW5tNekVcTKdbwruVvI5UO/aPruNNJPmTRnW+wKVmULUPsF7x6mjtngykFlHcWkECjSaCoh X-Forefront-Antispam-Report: CIP:194.138.21.75;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(136003)(39860400002)(396003)(36840700001)(40470700004)(46966006)(1076003)(336012)(47076005)(2616005)(956004)(16526019)(26005)(186003)(6916009)(316002)(107886003)(36756003)(44832011)(2906002)(83380400001)(15650500001)(356005)(40460700003)(82740400003)(82960400001)(36860700001)(40480700001)(8936002)(5660300002)(478600001)(41300700001)(82310400005)(86362001)(70206006)(8676002)(4326008)(70586007)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 16:21:22.4343 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf5b87e5-f7ab-4e14-6d3a-08da8aa3adb6 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.75];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT038.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3944 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=xyAvYT46; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.0.84 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Use @enum for enum-like tables. Namespace returned tables. Signed-off-by: Christian Storm --- handlers/swupdate.lua | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/handlers/swupdate.lua b/handlers/swupdate.lua index fc87a99..621da19 100644 --- a/handlers/swupdate.lua +++ b/handlers/swupdate.lua @@ -22,9 +22,8 @@ local swupdate = {} ---- @class swupdate.RECOVERY_STATUS +--- @enum swupdate.RECOVERY_STATUS --- Lua equivalent of `RECOVERY_STATUS` as in `include/swupdate_status.h`. ---- @type table swupdate.RECOVERY_STATUS = { IDLE = 0, START = 1, @@ -67,9 +66,9 @@ swupdate.debug = function(format, ...) end swupdate.progress = function(msg) end --- Lua equivalent of `notify(status, error, INFOLEVEL, msg)`. ---- @param status number Current status, one of `swupdate.RECOVERY_STATUS`'s values ---- @param error number Error code ---- @param msg string Message +--- @param status swupdate.RECOVERY_STATUS Current status, one of `swupdate.RECOVERY_STATUS`'s values +--- @param error number Error code +--- @param msg string Message swupdate.notify = function(status, error, msg) end @@ -89,13 +88,12 @@ swupdate.mount = function(device, filesystem) end --- Unmount a mountpoint. -- --- @param target string Mountpoint to unmount ---- @return boolean # true if successful, nil on error +--- @return boolean | nil # true if successful, nil on error swupdate.umount = function(target) end ---- @class swupdate.ROOT_DEVICE +--- @enum swupdate.ROOT_DEVICE --- Lua equivalent of `root_dev_type` as in `include/lua_util.h`. ---- @type table swupdate.ROOT_DEVICE = { PATH = 0, UUID = 1, @@ -105,14 +103,14 @@ swupdate.ROOT_DEVICE = { --- Current root device information. ---- @class rootdev ---- @field type number Root device type, one of `swupdate.ROOT_DEVICE`'s values ---- @field value string Root device path ---- @field path string Full root device path, if identified, else nil +--- @class swupdate.rootdev +--- @field type swupdate.ROOT_DEVICE Root device type, one of `swupdate.ROOT_DEVICE`'s values +--- @field value string Root device path +--- @field path string Full root device path, if identified, else nil --- Get current root device. -- ---- @return rootdev # Table containing type, and (full) path to root device +--- @return swupdate.rootdev # Table containing type, and (full) path to root device swupdate.getroot = function() end @@ -128,18 +126,18 @@ swupdate.tmpdir = function() end --- SWUpdate hardware information. ---- @class swupdate_hardware +--- @class swupdate.hardware --- @field boardname string SWUpdate's boardname --- @field revision string SWUpdate's revision --- Get SWUpdate hardware. -- ---- @return swupdate_hardware # Table with 'boardname' and 'revision' fields +--- @return swupdate.hardware # Table with 'boardname' and 'revision' fields swupdate.get_hw = function() end --- SWUpdate version information. ---- @class swupdate_version +--- @class swupdate.version --- @field [1] number SWUpdate's version --- @field [2] number SWUpdate's patch level --- @field version number SWUpdate's version @@ -147,7 +145,7 @@ swupdate.get_hw = function() end --- Get SWUpdate version. -- ---- @return swupdate_version # Table with 'version' and 'patchlevel' fields +--- @return swupdate.version # Table with 'version' and 'patchlevel' fields swupdate.getversion = function() end @@ -171,9 +169,8 @@ swupdate.set_bootenv = function(key, value) end swupdate.get_bootenv = function(key) end ---- @class swupdate.HANDLER_MASK +--- @enum swupdate.HANDLER_MASK --- Lua equivalent of `HANDLER_MASK` as in `include/handler.h`. ---- @type table swupdate.HANDLER_MASK = { IMAGE_HANDLER = 1, FILE_HANDLER = 2, @@ -188,9 +185,9 @@ swupdate.HANDLER_MASK = { -- -- The signature of the function to be registered as Handler implementation is: -- --- --- @param image img_type Lua equivalent of `struct img_type` --- --- @param fn? string `preinst` or `postinst` for `SCRIPT_HANDLER`s, else nil --- --- @return number # 0 on success, 1 on error +-- --- @param image img_type Lua equivalent of `struct img_type` +-- --- @param fn | nil string `preinst` or `postinst` for `SCRIPT_HANDLER`s, else nil +-- --- @return number # 0 on success, 1 on error -- function lua_handler(image, fn) -- ... -- end From patchwork Tue Aug 30 16:22:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1671935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23d; helo=mail-lj1-x23d.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbdpsxcmamgqeqrnf7sq@googlegroups.com; receiver=) 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=20210112 header.b=m28wTsmF; dkim-atps=neutral Received: from mail-lj1-x23d.google.com (mail-lj1-x23d.google.com [IPv6:2a00:1450:4864:20::23d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHCHN60T7z1ynD for ; Wed, 31 Aug 2022 02:21:36 +1000 (AEST) Received: by mail-lj1-x23d.google.com with SMTP id g15-20020a2ea4af000000b00261cf22a8efsf3232005ljm.8 for ; Tue, 30 Aug 2022 09:21:36 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1661876493; cv=pass; d=google.com; s=arc-20160816; b=bpqcENB/oFhGQeNI+wbiQ2hFGUTjzzKORO8Yn6mk0Jz8UWjWV4A5U/YJxfMoLR2g2h qCi8MkhU2HeX2FAmNV6UDXk1NVwZenCpvnOmjUZaM3IOwITcWXNfTNzsHvHJwp08NDB/ M8pN6ejWZV0ic+ttU/n30yqxqJ/Wfz7caNGFhdkRBjQap5zbQhdXOOMSTFg/QsgIuJgW 1IZ8eUYMXTDE99Gz5qgjCUe4lAx/6OdbZmUN4HDdnwIS3XIe10EXf4s7WNj5pezhQvE9 a6cGN4Mhqwekoa/ZVoRfiaR1ZsPrHQ3Jw3HpYk2SH6nJdIbbZJ8tPpJ78z6LNklvrauc gy6g== ARC-Message-Signature: i=3; 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=EvLxCh0uudPiiCRZsTzG84zxeSsvCctlc5hT95W5kHE=; b=eatW80uT+JtIUnxvGPOCqDrXHySDkBMncBC0IV4SoVizQUDP6bs4uUcnE54QjdfCTz fAMkr//qAbCwQK1ycjN7LW+cSeTzBRqJz8P3zuhSMweMAEJL2O9k6ZBNQx3Tld3/KbTe /xwhgfa8MZUZVddGc+LJBdBGkK0CVQfmExKbLKLaT/HJeMTS9necr+Z1AjMPEZ6KEcYU 1yTqv1d68AlRYv/tV7JrXdaDt5WJcmZY4RqImB+uyBHqN6f/HT/mHq3oaf+06PmnN2QR vg2MCVOIwC6JHUrQ5WpUdv3Bzxc5MECnOhKS5GXZb7ulVym/U2trmOhckTWc7UDlDCo7 50tA== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=zcNGppOn; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.2.84 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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; bh=EvLxCh0uudPiiCRZsTzG84zxeSsvCctlc5hT95W5kHE=; b=m28wTsmFmCb5ZAnGRPwToQPWqIds5wBiPGKsCWoWNXziU8OpcEHeLZeNVQ6hbz/w0X DhAsChlyBzIyDF1cmhEzB/SUol9tapNk8sdxjEzF3YA8Rywcqq1ELK/sF5D4MxMtfkiz hWMIQPWr3rz6n8VOmHB4Ojj20Y5+dXKK8Ax3Z29LxBknAiIgVVEKlvicUylBfH7RLMii 1GDLHnrt2lVljyWRr0khHATjzFHF7VFaIgg9DOagTM/6JoxIlnF/GIPHPLoMC4B9L0pD pcGa45yiGrMqQXtfzN2UonNleqHZo++ZNSHM5mP9u56VKwDk/Wo+TKa2EVSdeW8EmXLA lD3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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-gm-message-state:sender:from:to:cc; bh=EvLxCh0uudPiiCRZsTzG84zxeSsvCctlc5hT95W5kHE=; b=he0xCxIwbnEf+WMiRTr2t8UuN8snooiqGKM3yIEYHpc7XweAXPkICEgvNvI5+Bt1YN OLH7m51E90Ti/yEFqexHDugBQhKByN5Vl+ILGvm5Alxg5z0CZJsyMH30Xf73DjoedS96 DVICaJC24h8zmimEPuyo7wOzydTM4WWOMG3ISSEXLAl+ekeFLhsRwkVgaDEe6KGtvYmx dCeUC6M8IzTib7XIe9xJS/uuM9WcTQfq2szoDNMmrqJAfg8jFe3NaLeZkLvOBtibHyUc DqVLokym9q2hnZhMpHQLkD4OBkpepv6I2ednYV6rv5Az7ktTFfG/pGGATIVs2pm0Nucd /DOQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: ACgBeo1HuZDue5D7+ag0EfhgF9V5JbvBjNBsIpmRo8BeQdcT0R2RscXE 9FoajW5n2dA7lgN/vxo5vaw= X-Google-Smtp-Source: AA6agR6+ICM2u/QaBbvuRc0m5TnteFAQoH4CktAOHEK64zDehJPcmGBasyzX4MsMlhLTk5PraE8ulw== X-Received: by 2002:a05:651c:10ba:b0:266:ee76:26a9 with SMTP id k26-20020a05651c10ba00b00266ee7626a9mr1611368ljn.382.1661876493735; Tue, 30 Aug 2022 09:21:33 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6512:20c4:b0:494:6c7d:cf65 with SMTP id u4-20020a05651220c400b004946c7dcf65ls1406213lfr.2.-pod-prod-gmail; Tue, 30 Aug 2022 09:21:32 -0700 (PDT) X-Received: by 2002:a05:6512:2987:b0:492:e469:b327 with SMTP id du7-20020a056512298700b00492e469b327mr3953683lfb.534.1661876492266; Tue, 30 Aug 2022 09:21:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661876492; cv=pass; d=google.com; s=arc-20160816; b=gaz5nyt46BvUOnBPzh5ef/mY/MpafXVyqQ83asQNC+JJuPs/nCCAZhhkvRN1lFqHee IQb+1yQJsAB3NaV9JpMG2dp9fgzBWKgPR5UFbTXg9kk9iPNLqlA5dgsUleP+b1q9I0ZO BZSfbL/EGsXN1/LUwOUR/q4p8dVTF1db3iXPHGYn+RZr+0Qb7j30hJpWY4e9cN0hslXL y8mjTenCAAtu0pdOeMeIOdBhykfhfiHOl1XZiAZexW3u1myb1Te57fsr7o4kPTXCZiEj 4kOm8Q6jWk1TpAwYi2kRlL9Nj7vVV1egEuJpbhjXD87wNDr0BzNFb2Lk2BzvDkKrKDfr 1gGQ== ARC-Message-Signature: i=2; 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:dkim-signature; bh=jMBBg62pb79PTPeSSpQo7ylW7EfpdU9XUjlP/VuOZbI=; b=d3fOVig3r7jLy/fN6/YpIreBmvoLQ6ug4Wj9gc3GISxrx+zODvIlHgGrHRMSFFjPTj L2PHSOYljmnKCyaE/SHnVh6BHRisdiPq4KhxB2TdNkP9zXEc24dzJwrJNGj5uRfKcls2 zSxa2VdtiYQs6l7BCh1tIbI4Xb3ZMfU2W7JJkIo2cVuVEEROV8iw4SrU8PJjpp2CBNgm wu25R9Wa7idoNIHxavUkspOhHCLTqPlcr0g8R8EjlSvwQRF6wjJ3bXpy5gktHZ1pF7U4 hPggt8uKbpDz7rNjYKVE/eAYompDp4uA6q2XhYTUlIylkAP216GNKoLAtVzyBTpP+lpD 09Sg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=zcNGppOn; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.2.84 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20084.outbound.protection.outlook.com. [40.107.2.84]) by gmr-mx.google.com with ESMTPS id q4-20020a056512210400b0048b2a291222si82497lfr.6.2022.08.30.09.21.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2022 09:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 40.107.2.84 as permitted sender) client-ip=40.107.2.84; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JRqkYHZLyov/bsn8PbevlJvycRs6L/yFETtBFP1Szl7pm65f1S2cACRi6Za59remkCMqhVabw3+XXA0WOR92wJcjGNRCi/Xa408OwiXyreYAIQn5TkHAzKLOmPsVNdY7b0B36oZneKCxEPFTwg9iNk60T/N5dvgAVtoGms+b4DgwG9J6EoUqRSUlg5Wwo+ST4cESBrW3VK5cqzCfxQeiFr6uRTUEh0axB77/hRdqQ8hInPYK0vaH9oI7hahHFs+xY5tAFwm/Lq12LJQSzCwTPsbzFP7dKVkQaHS9zMkpyXfjdd+SlbxdP+bllh5uhDJZQlck9n2mR5RyTBBAadZKuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jMBBg62pb79PTPeSSpQo7ylW7EfpdU9XUjlP/VuOZbI=; b=RPxypO40z+NnSvl/+NIsAcgBE3s8KvnYQ4SUOtCUJHWsbjQEHED5WbFqdUpBDGGYbqWCnNHo6tSCUIeiAkLCt56I4OQtW/uBATcpxvdiIG0LO5XQ6rihppYMJ1RUJ8nygTDRmMoE2Vd8ptIoe0rh+SGzEoS+EuoK/iAT87xWSdtv5VWG/mGXSUSdg3R9rsFOBDW1s+kN+X77SGGCnR4RMUBJd+OYhE4mJVb+XmpbjhZ9WMC9U+m2v/NwZqZuAbrtgr6p7Hyd7pEulm199bJ1K+3iLp7HiY43/pRRrAoPKlos0hHT9c0fdwdzUDhqHlUoY22/0OL4an08VpYlnFzDMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.74) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none Received: from AS8PR04CA0165.eurprd04.prod.outlook.com (2603:10a6:20b:331::20) by PA4PR10MB4349.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:10f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 16:21:30 +0000 Received: from VE1EUR01FT051.eop-EUR01.prod.protection.outlook.com (2603:10a6:20b:331:cafe::d7) by AS8PR04CA0165.outlook.office365.com (2603:10a6:20b:331::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 16:21:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.74) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.74 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.74; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.74) by VE1EUR01FT051.mail.protection.outlook.com (10.152.3.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 30 Aug 2022 16:21:29 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VQA.ad011.siemens.net (194.138.21.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.12; Tue, 30 Aug 2022 18:21:29 +0200 Received: from MD1ZFJVC.ad001.siemens.net (139.25.0.117) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Tue, 30 Aug 2022 18:21:29 +0200 From: Christian Storm To: CC: Christian Storm Subject: [swupdate] [PATCH 3/5] suricatta/lua: Update Lua interface specification Date: Tue, 30 Aug 2022 18:22:23 +0200 Message-ID: <20220830162225.42042-3-christian.storm@siemens.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830162225.42042-1-christian.storm@siemens.com> References: <20220830162225.42042-1-christian.storm@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.117] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 684fe1c3-a36c-4727-2b6d-08da8aa3b209 X-MS-TrafficTypeDiagnostic: PA4PR10MB4349:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jEBwRDcVyCM2eJ5K7PS6ODguJFZnpkrKMZpM2Krovqgcz0c5rRPGxHFufzw+eCNKYGOtQ+38HgRWO+/kGvZ8fDFsd3900Owiwh8Th1VABwVJlUWf5FbqQs355ypKBWcKtIFP2kJLS4SFhhWlKHhFMmfsc4qPc85Cq/nCQ3AFP1tprosRZDjGGBAhc3rrw6TAiqYrGhqKarsDqQ+WONS6CgkkBQDTej9O3tOT3NEzlEwv2PQg7FRKgFjg1EXrlk6sKS8Xq64nY/faLbSJ/YLVjoXkyFF+YGT1+lw8IL1TVSCgzjvx7WwPs4jh+ekjCWIf5yJG2NmM9LRWjJ4slZnbybvTpSfruQu5JRFxQ6PwRpE3tVmhFtknrLC28f8Cg/6Edk+9hyigDeiPxjYKPu+DfGpo2cGhhVLCEvqwItWH0BAhUhj+gaIF7jZC8lnrhkJRb2oOE3zcCxiooA24eMAIk/ROa1YxXog9JPlZBHu+Exyv8c+VUnjW12QLEELMbxZeA+w1gts4f16VPYg6aeWvVFrSzjZypPpfyJWVtJMYbVJSn3ivnGxV26OxrULavyEN13giXLqNisKxhfOUkMRYvwZeOxh49gMAYv8cemcFrd/eTQMZ7Izvrd+f6irB4PIJGNH7rgPDcDCGqDi+MXNC98sibXQuHywQUc+aVW0kR3lBDac3tjv/nH/AwQYxr3Oe9mXcjwjp1zrgP64QOWjiUkXSJm1gsQVR1bV1gXXCABGhQvksiJLFLhW9e0ibhDdfHSll3+BXuaVAC/A1gBGUyg== X-Forefront-Antispam-Report: CIP:194.138.21.74;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:hybrid.siemens.com;CAT:NONE;SFS:(13230016)(4636009)(376002)(396003)(39860400002)(136003)(346002)(46966006)(40470700004)(36840700001)(47076005)(40480700001)(336012)(83380400001)(2616005)(15650500001)(956004)(70586007)(2906002)(8676002)(70206006)(107886003)(36756003)(36860700001)(1076003)(186003)(6916009)(82960400001)(82310400005)(7636003)(7596003)(356005)(316002)(41300700001)(26005)(478600001)(86362001)(4326008)(16526019)(44832011)(82740400003)(8936002)(40460700003)(5660300002)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 16:21:29.6969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 684fe1c3-a36c-4727-2b6d-08da8aa3b209 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.74];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT051.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR10MB4349 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=zcNGppOn; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.2.84 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Use @enum for enum-like tables. Split "classes" for proper function specification inference. Use proper types for suricatta.channel.options Table. Update suricatta.channel.open() with actually returned types. Add suricatta.getversion() return type specification. Signed-off-by: Christian Storm --- suricatta/suricatta.lua | 127 +++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/suricatta/suricatta.lua b/suricatta/suricatta.lua index d15ab47..81988d2 100644 --- a/suricatta/suricatta.lua +++ b/suricatta/suricatta.lua @@ -21,8 +21,7 @@ local suricatta = {} --- Lua equivalent of `server_op_res_t` enum as in `include/util.h`. -- ---- @class suricatta.status ---- @type table +--- @enum suricatta.status suricatta.status = { OK = 0, EERR = 1, @@ -61,7 +60,7 @@ suricatta.notify = { --- SWUpdate's persistent state IDs as in `include/state.h` and reverse-lookup. -- ---- @class suricatta.pstate +--- @enum suricatta.pstate suricatta.pstate = { OK = string.byte('0'), [string.byte('0')] = "OK", INSTALLED = string.byte('1'), [string.byte('1')] = "INSTALLED", @@ -71,24 +70,25 @@ suricatta.pstate = { ERROR = string.byte('5'), [string.byte('5')] = "ERROR", WAIT = string.byte('6'), [string.byte('6')] = "WAIT", IN_PROGRESS = string.byte('7'), [string.byte('7')] = "IN_PROGRESS", +} - --- Get the current stored persistent state. - -- - --- @return boolean # Whether operation was successful or not - --- @return suricatta.pstate # Persistent state ID number - get = function() end, +--- Get the current stored persistent state. +-- +--- @return boolean # Whether operation was successful or not +--- @return suricatta.pstate # Persistent state ID number +suricatta.pstate.get = function() end + +--- Save persistent state information. +-- +--- @param state suricatta.pstate Persistent state ID number +--- @return boolean # Whether operation was successful or not +suricatta.pstate.save = function(state) end - --- Save persistent state information. - -- - --- @param state suricatta.pstate Persistent state ID number - --- @return boolean # Whether operation was successful or not - save = function(state) end, -} --- Function registry IDs for Lua suricatta functions. -- ---- @class suricatta.server +--- @enum suricatta.server suricatta.server = { HAS_PENDING_ACTION = 0, INSTALL_UPDATE = 1, @@ -100,21 +100,20 @@ suricatta.server = { PRINT_HELP = 7, CALLBACK_PROGRESS = 8, CALLBACK_CHECK_CANCEL = 9, - - --- Register a Lua function as Suricatta interface implementation. - -- - --- @param function_p function Function to register for `purpose` - --- @param purpose suricatta.server Suricatta interface function implemented - --- @return boolean # Whether operation was successful or not - register = function(function_p, purpose) end, } +--- Register a Lua function as Suricatta interface implementation. +-- +--- @param function_p function Function to register for `purpose` +--- @param purpose suricatta.server Suricatta interface function implemented +--- @return boolean # Whether operation was successful or not +suricatta.server.register = function(function_p, purpose) end + suricatta.channel = { --- Content type passed over the channel as in `include/channel_curl.h`. -- - --- @class suricatta.channel.content - --- @type table + --- @enum suricatta.channel.content content = { NONE = 0, JSON = 1, @@ -123,8 +122,7 @@ suricatta.channel = { --- Transfer method to use over channel as in `include/channel_curl.h`. -- - --- @class suricatta.channel.method - --- @type table + --- @enum suricatta.channel.method method = { GET = 0, POST = 1, @@ -163,33 +161,33 @@ suricatta.channel = { --- @field max_download_speed string `CURLOPT_MAX_RECV_SPEED_LARGE` - rate limit data download speed --- @field headers_to_send table Header to send options = { - url = nil, - cached_file = nil, - auth = nil, - request_body = nil, - iface = nil, - dry_run = nil, - cafile = nil, - sslkey = nil, - sslcert = nil, - ciphers = nil, - proxy = nil, - info = nil, - auth_token = nil, - content_type = nil, - retry_sleep = nil, - method = nil, - retries = nil, - low_speed_timeout = nil, - connection_timeout = nil, - format = nil, - debug = nil, - usessl = nil, - strictssl = nil, - nocheckanswer = nil, - nofollow = nil, - max_download_speed = nil, - headers_to_send = nil, + url = "", + cached_file = "", + auth = "", + request_body = "", + iface = "", + dry_run = false, + cafile = "", + sslkey = "", + sslcert = "", + ciphers = "", + proxy = "", + info = "", + auth_token = "", + content_type = "", + retry_sleep = 5, + method = 0, + retries = 5, + low_speed_timeout = 300, + connection_timeout = 300, + format = 2, + debug = false, + usessl = false, + strictssl = false, + nocheckanswer = false, + nofollow = true, + max_download_speed = "", + headers_to_send = {}, }, --- Open a new channel. @@ -206,7 +204,7 @@ suricatta.channel = { --- @field get function Channel get operation --- @field put function Channel put operation --- @field close function Channel close operation - return { + return true, { --- Channel creation-time set options as in `include/channel_curl.h`. -- @@ -220,7 +218,7 @@ suricatta.channel = { --- @return suricatta.status # Suricatta return code --- @return table # Operation results get = function(options_get) - return { + return true, suricatta.status.OK, { --- @type number http_response_code = nil, --- @type suricatta.channel.content @@ -241,7 +239,7 @@ suricatta.channel = { --- @return suricatta.status # Suricatta return code --- @return table # Operation results put = function(options_put) - return { + return true, suricatta.status.OK, { --- @type number http_response_code = nil, --- @type suricatta.channel.content @@ -263,7 +261,7 @@ suricatta.channel = { --- @type table ---- @class op_channel +--- @class suricatta.op_channel -- -- Channel to use for the download / installation operation as returned by `suricatta.channel.open()` -- plus channel options overriding the defaults per operation (@see suricatta.channel.options) @@ -282,7 +280,7 @@ suricatta.channel = { -- Note that this file is to be deleted, if applicable, from the Lua realm. -- --- @see suricatta.download ---- @param install_channel op_channel Channel to use for the download+installation operation +--- @param install_channel suricatta.op_channel Channel to use for the download+installation operation --- @return boolean # Whether operation was successful or not --- @return suricatta.status # Suricatta return code --- @return table # Error messages, if any @@ -295,8 +293,8 @@ suricatta.install = function(install_channel) end -- an appropriate `install_channel` Table's `url` field. -- --- @see suricatta.install ---- @param download_channel op_channel Channel to use for the download operation ---- @param localpath string Path where to store the downloaded artifact to +--- @param download_channel suricatta.op_channel Channel to use for the download operation +--- @param localpath string Path where to store the downloaded artifact to --- @return boolean # Whether operation was successful or not --- @return suricatta.status # Suricatta return code --- @return table # Error messages, if any @@ -319,9 +317,16 @@ suricatta.sleep = function(seconds) end suricatta.get_tmpdir = function() end +--- SWUpdate version information. +--- @class suricatta.version +--- @field [1] number SWUpdate's version +--- @field [2] number SWUpdate's patch level +--- @field version number SWUpdate's version +--- @field patchlevel number SWUpdate's patch level + --- Get SWUpdate version. -- ---- @return table # Table with 'version' and 'patchlevel' fields +--- @return suricatta.version # Table with 'version' and 'patchlevel' fields suricatta.getversion = function() end From patchwork Tue Aug 30 16:22:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1671936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33e; helo=mail-wm1-x33e.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbhpsxcmamgqecikcdpi@googlegroups.com; receiver=) 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=20210112 header.b=slINvJzW; dkim-atps=neutral Received: from mail-wm1-x33e.google.com (mail-wm1-x33e.google.com [IPv6:2a00:1450:4864:20::33e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHCHh5Vhtz1ynb for ; Wed, 31 Aug 2022 02:21:52 +1000 (AEST) Received: by mail-wm1-x33e.google.com with SMTP id r83-20020a1c4456000000b003a7b679981csf5889850wma.6 for ; Tue, 30 Aug 2022 09:21:52 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1661876509; cv=pass; d=google.com; s=arc-20160816; b=pt3ZYpbJxyjNakl0m3vDotNh/uxvHW7RhYqEYjhJKHqvbeLAfCfjSQ9pYLK+RCrl4g PB4TGqvvHTI9LvvYdgmwpJCAPiKuUe0lpUPoAk9WHTPCcp/CVn/uHgYLqI79WHf6M3DE 3Iad93oAkDT7Q2qLNw2lphBi8cd1BzKDvcLdvFdcO+8+jGlIXEfbGfuGbptLsmogtRf0 CMtIDFeKmajzXcVnFjmFad5x4/6QFfYMSb9ziHfhZQuVKnBwdetE/mzmxikHzNhhOOtl sq/Rz7qKYMdvgD9n3+gHFjaRyJC30BKaQu3i4H6l8mMogGQcZe4EWNsg/am3JIjqPkZM wCKA== ARC-Message-Signature: i=3; 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=TxFnIdLU8zElLDAcpsQ1IGcvp63VqDq9dQEUSRBf0tQ=; b=UCXv/8tZ0Imx8c45+23KkQemvOlS5HdECZmDc3zn8jLlItaohqKJ4N25G/8Cj5lHJX RZRCFmgJ6+tuhLR4+otz4d0hcHGYXx5x1dDHb+9xg3m8WDl5Ie6ppai0Gif0QQ5f6jjc Y/4t4gF5EWoDwaH/o2/7zlNltuKpTg5qifkIK22PUZJIe8MwOD2L5dt5hV/ehw3mfwHu jQhgssBIpZlgD/gC0qDuWR9FC/USAgMQuOW0OPyDjAvACN5DQapItQpTMIj5Yb+5Sfbu oVBptxfrceykUjM5u0mcKYJ8qt76jSgKB6aPs0lpfl76TRne5MGT5XOHHzsvWWd0a+47 aPVA== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=yHTgmYrN; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.20.77 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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; bh=TxFnIdLU8zElLDAcpsQ1IGcvp63VqDq9dQEUSRBf0tQ=; b=slINvJzWYVxt+XS5JetB8XTIiXTtjxlFLe/LG4cA6R+Wb6EiKXjBiyr0cTatjm84ih fhjlq+XCFT45aKbu/upMa2zaOmsib6kqeZITKx/qtdjRC95gFU+f3J4G2dkk5goMxqWc 1Y9Mg+nN59su1tW0IfjWcmGrW5JvoTWoQRVB45dvVImDdafYIaMAZYLJKgB3FuPanCmw rGlFnkZEHzcmR9m5dxsza3Osyz/zEFji+f2DPFWOA1eFx7+0JzVlYTLBPgjBV9LOj3ND SSz8F9c32eSJXHN7SbGmrRyQvfUsXQ4u+k3brs1Ff16HgHYgYmSB159FYeJximSh1Vcg BnBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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-gm-message-state:sender:from:to:cc; bh=TxFnIdLU8zElLDAcpsQ1IGcvp63VqDq9dQEUSRBf0tQ=; b=hyOMtO5bj0f/+Pu+5qnUueCbsCk6TWzsnRUGL5sjSHSnFJPJ8kRjfi1GsoxtR31Zsk /nRIEvShLWXcSfYpaiNJ+5f9h4rr/kdeQah3RmcFDc1xqhCA9tBZvelUMbtrTN0RP2Aw OBXSTNvT7vgvQ5ExatBNp2qW5BIVoc9PwwijfF6OGKTnDepIafyPakAlry1CKBK/ohiB /paIeDH/vxL5Kh2pZgrasbZaIDuMup7rkGgRGP8rbrzT7HGs5mbiBxLT+5Fvi1mnwXzH u10xPJSP8irfzyymmOX4z3TmxOYqdxSLfWLQyJ9pC6jReQrnOMZ6AaECMR+zBuhYXZxl 7wUQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: ACgBeo2N2ZdxnC5Uw5F38rtM2VKJ1AHBfquFrq9SjBxTaIGoLqOiV+CR 8KZf+Pf6C6hJLiyX9qKh9tI= X-Google-Smtp-Source: AA6agR5oR5qHOr9cvr+U4FD3UHSb3WKHdD/ZYtF7Dq/tZqd6QaFdC8+gAU9JRnyx240J2kcJyXsx+g== X-Received: by 2002:a05:600c:3ac4:b0:3a5:f6e5:1cbc with SMTP id d4-20020a05600c3ac400b003a5f6e51cbcmr9975521wms.92.1661876509730; Tue, 30 Aug 2022 09:21:49 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:4848:0:b0:225:58db:7886 with SMTP id n8-20020a5d4848000000b0022558db7886ls7256707wrs.1.-pod-prod-gmail; Tue, 30 Aug 2022 09:21:48 -0700 (PDT) X-Received: by 2002:a05:6000:1568:b0:226:e2d0:abcb with SMTP id 8-20020a056000156800b00226e2d0abcbmr2599705wrz.456.1661876508484; Tue, 30 Aug 2022 09:21:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661876508; cv=pass; d=google.com; s=arc-20160816; b=HKo3xsnivqUGdpBLxBy2ykU0bZJ/OmZCX+hfeobBhFuWrs898s7vudVu6hKqOJfcLX 2ZQZEGTNo8gdvf6UJQ4p0TpUNm73QfxXMF03a41BOFPRYOUK+AGnV2xN9TdS8HSyGfJa 0TGmht2FpiZWp6Pgdiuh8aC331qI4w5tWUvmWbH4MIxEAozMmSP16zd4stQMzyoyRDA1 zIrlqe5ziFsJ1RCElFXpkr9M1pyY9tdaogLkCem1ZBn7ebYisEpUkiC8qp/vAGLwT1oX /FvPgBxAtGtBAOxEDDB+zteBGSPp4X4t6nqc/dUqiCXQciaj8+dGyBlHa8Qftqi/4ko0 7OcA== ARC-Message-Signature: i=2; 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:dkim-signature; bh=9PRyG4Yew+gFMWyzh93aLPpJ7dtIaEgURjGCnIDMmOs=; b=lgSwLrbDn0Age2q+yfwyEKkWalXGtm2bH+VCTzl0oB7PeryAYNI9d3NyUOpKzgu22M Y8W8T6esE85lswG3YQV1PVsgEs5arZF2OX39aeeoP3DxxXm5S7wFcpAXUVk3B4U3vzkC raybyxF7DQ8affEgzmT31IlDWsH/cpqIE4ng+/0td3l9vAv2Ed3el++UNn4GqoV+etM0 HL3oKmta5kG64iAsFMW+wes8HvIA7yDTgAdpqZtHRuWU2qgtBaMKW0MYR6rKJM0M+iFy whR074ytTP4idescQ3yClRu39DYQYVwbPmUz6YywyyX/pICGd5CSPn2grr77Z0Gmc7da 9sDg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=yHTgmYrN; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.20.77 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2077.outbound.protection.outlook.com. [40.107.20.77]) by gmr-mx.google.com with ESMTPS id i7-20020a5d4387000000b0021e8b3a5ffesi448589wrq.2.2022.08.30.09.21.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2022 09:21:48 -0700 (PDT) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 40.107.20.77 as permitted sender) client-ip=40.107.20.77; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AyTtHWgX2PuiNOc1ecUY+SGWou+Kxphx0pwfFjDLcohb+/ClaA3GXk4StPHzMaiOf7i3DjDq22+XpMdEX2ocPn4gBBCFfYJU+AfbYIuHYgMDwkKcq64CcyQbMu1uS4HGeJHH1l6pCuwdoPyuUApanPGwUBpWPFtxXkQDavmK7m1f5ZDrJwwsSNOkJJXY35n+fy/ojXrSm5C451x412VPF6aZ72+ZIply55N3AXJpHnJkX8xC5Pzp0m5vjgw0wWjm/8xnxnKawZ0huUmbheElCRJstWNZ21U3XwH5jPklLj++AjfsMGDPDUoGIM0X2vUlA2sFQ+FrUz/qP6l0GjurIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9PRyG4Yew+gFMWyzh93aLPpJ7dtIaEgURjGCnIDMmOs=; b=A9Sy0XuLQOHBEe2mNwNIZgCmlbP8u0c3J4z3tB/k0UQhweQrnh4A0bdKNryicUb9Rt2a9gVaOCxQ2lue4RujXirY+sQnKgHNzwI8fhw8ikICOf0WJWkvS+e07zVVcc/rh59AmGoMnArZmzCWvGQR1dxK/HijKDOZbPcrJGaIsybY2xxbaixE5Dg6p9Lgbh7nvfPNcGB/PR4GY1pMX1Eu8iTkCAB1/DhSNWUM/gn9qnWI38aJysDOYfqMPw7kUT48LLvvc62P+Th/qIbyR4QTpjaCiDARuA4ieEywh/UHdHImdxl2aIHEeceD0GSYfNXPUIOhV6To7r64lTmjCSpBNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.76) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none Received: from FR0P281CA0061.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::16) by AM9PR10MB4072.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:1f7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 16:21:47 +0000 Received: from VE1EUR01FT035.eop-EUR01.prod.protection.outlook.com (2603:10a6:d10:49:cafe::2d) by FR0P281CA0061.outlook.office365.com (2603:10a6:d10:49::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 30 Aug 2022 16:21:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.76) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.76 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.76; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.76) by VE1EUR01FT035.mail.protection.outlook.com (10.152.2.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 30 Aug 2022 16:21:46 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VSA.ad011.siemens.net (194.138.21.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.12; Tue, 30 Aug 2022 18:21:45 +0200 Received: from MD1ZFJVC.ad001.siemens.net (139.25.0.117) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Tue, 30 Aug 2022 18:21:45 +0200 From: Christian Storm To: CC: Christian Storm Subject: [swupdate] [PATCH 4/5] suricatta/lua: Update General HTTP Server example Date: Tue, 30 Aug 2022 18:22:24 +0200 Message-ID: <20220830162225.42042-4-christian.storm@siemens.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830162225.42042-1-christian.storm@siemens.com> References: <20220830162225.42042-1-christian.storm@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.117] X-ClientProxiedBy: DEMCHDC89XA.ad011.siemens.net (139.25.226.103) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad41bc17-9d39-4605-cbee-08da8aa3bc31 X-MS-TrafficTypeDiagnostic: AM9PR10MB4072:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nArL2mqEAPs3Gt3qEZO0BNyUUjpRKFab5malv80/kG3Fti7MouX8+5BQ17k3KifeNBwLauEwjr1J6zy4Oo8GcWpDveMii/0MWnOixsYBZK3Lfb69KsmeZgTvzXtHmBSbrn24SLS7oYuivjHfTwyoe74EjSMbn+u3gQGmmMdxKoITqNW8204gL5mQoAfu6oz0Kghi6E6+vQ1gaXWTsUtYbQdrA+imu0E1zQMCbgzKJ3zeBd2/yHZoOF1vGKLkfnrK9b3a21OmxQNfACl+D2PKlnD/GqtMYjze9kCNpR90MalFYV9/UHDk7wHFtEWvi+StHO9jPboiBUlAojXRhbk2QBGPBS3i/JT+83336A+qTsrd8AUkl63qQB6roJ8fIjHAklITSXZAGPVYUleVmM544uJLGebaR5BCLQrAgCHbR+5BRtd+j2fCoN7dg1ShYgsjIuQ62K0yC/4CYnYWwSO10aj9ltIk586aIHj61COtc+FIsWt0VzywXmaJpCEme6Ksv/PXgf75+KlG3SESDd8t37pN4PuggFctfT983W5on+hUsmsXSUW23+pZ5nMIdIBdfSi1JpLog1l/GoawkP8Zq/x10+/f0u07UNd75xhODY5+GR7n3Gtofhs97eIynVLaxrFp1aUj0/MBzZO4WCDwGlAwj/Q7t80ik9bjo3oV2TFvmdEjJIfCDpGp0srfG4aWcjrigFqD+Dqp0rllFtzU+ayeg7hvHoLG5JQqTNfVpoVQ3zLWIS3KKKK4s18GB1+Ah+s8WK8PfF4pm0ARfS5s/SjsNlcdGHoW89fDzgK8/N5gExQKm7+lgnxUkOFYvIo9 X-Forefront-Antispam-Report: CIP:194.138.21.76;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(346002)(396003)(136003)(39860400002)(376002)(40470700004)(46966006)(36840700001)(82310400005)(40480700001)(36860700001)(356005)(82960400001)(82740400003)(70586007)(4326008)(81166007)(8676002)(41300700001)(5660300002)(478600001)(8936002)(70206006)(6916009)(316002)(40460700003)(1076003)(47076005)(2616005)(16526019)(956004)(83380400001)(2906002)(6666004)(44832011)(186003)(26005)(15650500001)(86362001)(336012)(36756003)(107886003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 16:21:46.7403 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad41bc17-9d39-4605-cbee-08da8aa3bc31 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.76];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT035.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR10MB4072 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=yHTgmYrN; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.20.77 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Use @enum for enum-like tables. Remove device.pstate as it's not really needed. Update has_pending_action() to showcase optional action_id parameter. Split ipc_message.json for proper type inference. Signed-off-by: Christian Storm --- examples/suricatta/swupdate_suricatta.lua | 51 ++++++++++++----------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/examples/suricatta/swupdate_suricatta.lua b/examples/suricatta/swupdate_suricatta.lua index 75a35a8..f1d2da6 100644 --- a/examples/suricatta/swupdate_suricatta.lua +++ b/examples/suricatta/swupdate_suricatta.lua @@ -22,7 +22,7 @@ local suricatta = require("suricatta") -- Unknown options are (silently) ignored. -- If an option's required argument is missing, (':', option) is returned. -- ---- @param argv string Integer-keyed arguments table +--- @param argv table Integer-keyed arguments table --- @param optstring string GETOPT(3)-like option string --- @return function # Iterator, returning the next (option, optarg) pair function getopt(argv, optstring) @@ -112,21 +112,21 @@ end --[[ Suricatta General Purpose HTTP Server Module ]] --[[ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ]] +--- Marker for not (yet) set valid Device ID +DEVICE_ID_INVALID = "InvalidDeviceID" + --- Device state and information. -- --- @class device ---- @field pstate suricatta.pstate Persistent state ID number ---- @field id string Device ID +--- @field id string Device ID device = { - pstate = nil, - id = nil + id = DEVICE_ID_INVALID } --- Job type "enum". -- ---- @class job.type ---- @type table +--- @enum job.type jobtype = { INSTALL = 1, DOWNLOAD = 2, @@ -166,7 +166,7 @@ gs = { -- sleeping again. -- --- @param action_id number Current Action ID [unused] ---- @return number # Action ID [optional] +--- @return number|nil # Action ID [optional] --- @return suricatta.status # Suricatta return code function has_pending_action(action_id) action_id = action_id @@ -174,7 +174,7 @@ function has_pending_action(action_id) local _, pstate = suricatta.pstate.get() if pstate == suricatta.pstate.INSTALLED then suricatta.notify.warn("An installed update is pending testing, not querying server.") - return suricatta.status.NO_UPDATE_AVAILABLE + return action_id, suricatta.status.NO_UPDATE_AVAILABLE end suricatta.notify.trace("Querying %q", gs.channel_config.url) @@ -197,10 +197,10 @@ function has_pending_action(action_id) "Server queries client data for: %s", data.received_headers["Served-Client"] or "" ) - return suricatta.status.ID_REQUESTED + return action_id, suricatta.status.ID_REQUESTED end suricatta.notify.trace("Server served request for: %s", data.received_headers["Served-Client"] or "") - return suricatta.status.NO_UPDATE_AVAILABLE + return action_id, suricatta.status.NO_UPDATE_AVAILABLE end if data.http_response_code == 503 then @@ -208,7 +208,7 @@ function has_pending_action(action_id) -- Try again after seconds announced in HTTP header or default value. gs.polldelay.current = tonumber(data.received_headers["Retry-After"]) or gs.polldelay.default suricatta.notify.debug("Server busy, waiting for %ds.", gs.polldelay.current) - return suricatta.status.NO_UPDATE_AVAILABLE + return action_id, suricatta.status.NO_UPDATE_AVAILABLE end if data.http_response_code == 302 then @@ -219,11 +219,11 @@ function has_pending_action(action_id) suricatta.notify.info("Update available, update job enqueued.") gs.job.md5 = data.received_headers["Content-Md5"] gs.job.url = data.received_headers["Location"] - return suricatta.status.UPDATE_AVAILABLE + return action_id, suricatta.status.UPDATE_AVAILABLE end suricatta.notify.trace("Unhandled HTTP status code %d.", data.http_response_code) - return suricatta.status.NO_UPDATE_AVAILABLE + return action_id, suricatta.status.NO_UPDATE_AVAILABLE end suricatta.server.register(has_pending_action, suricatta.server.HAS_PENDING_ACTION) @@ -491,7 +491,7 @@ function server_start(defaults, argv, fconfig) end gs.polldelay.current = gs.polldelay.default - if not gs.channel_config.url or not device.id then + if not gs.channel_config.url or device.id == DEVICE_ID_INVALID then suricatta.notify.error("Mandatory configuration parameter missing.") return suricatta.status.EINIT end @@ -560,28 +560,31 @@ end suricatta.server.register(send_target_data, suricatta.server.SEND_TARGET_DATA) ---- Lua-alike of `ipc_message` as in `include/network_ipc.h` +--- Lua "enum" of IPC commands as in `include/network_ipc.h` -- --- Note: Some members are deliberately not passed through to the Lua realm --- such as `ipc_message.data.len` as that's handled by the C-to-Lua bridge --- transparently. --- Also, this is not a direct equivalent as, e.g., the `json` field is not --- present in `struct ipc_message`, but rather it's a "sensible" selection. --- As another example, CMD_ENABLE is also not passed through and hence not --- in `ipc_commands` as it's handled directly in `suricatta/suricatta.c`. +-- `CMD_ENABLE` is not passed through and hence not in `ipc_commands` as +-- it's handled directly in `suricatta/suricatta.c`. -- --- @type table --- @class ipc_commands --- @field ACTIVATION number 0 --- @field CONFIG number 1 --- @field GET_STATUS number 3 + +--- Lua-alike of `ipc_message` as in `include/network_ipc.h` +-- +-- Note: Some members are deliberately not passed through to the Lua realm +-- such as `ipc_message.data.len` as that's handled by the C-to-Lua bridge +-- transparently. +-- Also, this is not a direct equivalent as, e.g., the `json` field is not +-- present in `struct ipc_message`, but rather it's a "sensible" selection. -- --- @class ipc_message --- @field magic number SWUpdate IPC magic number --- @field commands ipc_commands IPC commands --- @field cmd number Command number, one of `ipc_commands`'s values --- @field msg string String data sent via IPC ---- @field json string If `msg` is JSON, JSON as Lua Table +--- @field json table If `msg` is JSON, JSON as Lua Table --- Handle IPC messages sent to Suricatta Lua module. From patchwork Tue Aug 30 16:22:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 1671937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::13b; helo=mail-lf1-x13b.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbixsxcmamgqenfs3prq@googlegroups.com; receiver=) 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=20210112 header.b=GV5GI7oH; dkim-atps=neutral Received: from mail-lf1-x13b.google.com (mail-lf1-x13b.google.com [IPv6:2a00:1450:4864:20::13b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHCHp5Vg1z1ynD for ; Wed, 31 Aug 2022 02:21:58 +1000 (AEST) Received: by mail-lf1-x13b.google.com with SMTP id 6-20020ac25686000000b004946d14f34dsf1587979lfr.21 for ; Tue, 30 Aug 2022 09:21:58 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1661876515; cv=pass; d=google.com; s=arc-20160816; b=MiiT58ov3+MEXFg8kb8MRL5gDM8twmMWMsFYBjMaUfTRQcTViEtimoxuPw6fhZkTKR xs3szX1A/Z5FhOY6DPqyODrAIE7MzslllQDpQ2GFM5ksBkcdZETGIyOjiho9Kbq1ol7k H0ExiHVs3SUYUMCv9KRsl/KDHsREmRtG4pipkRqNM377E25kvv1gJ2efDF8n9COSaSDW 7H4UW1JssJ0X9+CpuTqHedz3E9GLTKJZSvgCp/lbbLDmI6vsvJ7XQIZcnfxvtpdqDsnj rV46ywYI3Wui5C19O0gcq5RQ5BJRDlHOHe5esrEyQAtxvuXBLpbQMDYIlzC0SDl+16qA Mksg== ARC-Message-Signature: i=3; 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=kmikbUJrmUK8hIF2uRK6LvfZ+cdgnQJcr6SYkQE043U=; b=jcxp9iISYICGooA6ScGgkJ2yDlNrWweuOcOCA2VKgdyyYUIgycf/eAW+BEjoFjCCmp naMouTXMoErsflp0F3S9XKKp29n/NtD6oKzhJYissMHyXThQnpEqvxdsAj9y0pv+W1dp aeuHnoS2vaCVpTY3G7cZY3RvkVoQOWk8Erc4obnuUw+mLAKSwe44W+XMGe3+gkwtbygL 6gUkcTgqFwGoFTb54lbPZEVsz8QUzmrxuq1YVdDpqTZZDBLrMU8e38/g7F2HsDxqifhw wxLTz1CKX5Xu6FvGGQvYBECmvTUU4JLa505rjUWdcnxNt3z6vg3lTEF/LRs8Q68tb8y9 mkig== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=RiGgp1aT; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.5.57 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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; bh=kmikbUJrmUK8hIF2uRK6LvfZ+cdgnQJcr6SYkQE043U=; b=GV5GI7oHtIcLnvmsxWJ/nK3kEGRgDIC9oIYO6oOwf5qfmBNHJpUOT2RQ3LIO+LYQOr pDus+cYzaqZMG5P6SafKRdIQUQfVuLU2Qx+VkapkT2kxhwTwPWLVKq9DLpCdyi/KjaWC QDYHTJLZFRPgmkYLK+WTyibJ7p81ZrPta0xjw/eOrDDLy/Ep/uU/nUXreCjPgL7wx47a bysu3R8y80TInIsfeuDw5hVqB3oae52hsL8K4v2egh0vm65hlMqxeYtpzwN5+Lr5jAqb DhzRVuD5w0lYx66iit74iFmY2WqGgxMFlkSWurHwq7io0HVLe2tOYQ2pWze/Yeg642QU f2ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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-gm-message-state:sender:from:to:cc; bh=kmikbUJrmUK8hIF2uRK6LvfZ+cdgnQJcr6SYkQE043U=; b=zyM2/TMVIppaGPcM+b9fvxct5tbMtMvUsPe2WUXz4/UTo5QwIsaglBGY74+1t12vpK 4HQnSsKZsKyM3esbwMxUiSKDc6wOMOS6G0QAmgxuVoeWPXcTuYZ1rsLZGfGcC9EDyJvg 2B/eihbm0sdosel4sqmYOiz/Bb4oqOeuGUv6r1db0Sj121Z7kEL4zzr9DVNfeKgQxiyW BI+shwB5pSAPpB+/XecOFK+Rd7NOH2NWeTWrNveqXXQwchgtrzbokIHvRQGHRUrdSZNc Ivu0PSPW29LCd4z27bW0e4TYZkBN/N3NffeD1t8GBiE6Q7YLCGaEOI6CUbP45eGXf2s9 B04A== Sender: swupdate@googlegroups.com X-Gm-Message-State: ACgBeo1f6kAbGzdbTkyDA6l368GzHj92+DcDcGpFtSWzdllFSdp4lBn6 VkYECZuifAm8AzwDZHO+05c= X-Google-Smtp-Source: AA6agR5OtreoqndrxkDsEJurWVzTMHtbTqPS0O7G4fR7F7RJkicT5YK5Li15diJgbQTaTJ4dzVPOpQ== X-Received: by 2002:a05:651c:11c6:b0:265:d1cb:b7b4 with SMTP id z6-20020a05651c11c600b00265d1cbb7b4mr2359682ljo.69.1661876515292; Tue, 30 Aug 2022 09:21:55 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:860e:0:b0:267:68b0:da9b with SMTP id a14-20020a2e860e000000b0026768b0da9bls120798lji.11.-pod-prod-gmail; Tue, 30 Aug 2022 09:21:53 -0700 (PDT) X-Received: by 2002:a05:651c:210d:b0:266:26b8:31ba with SMTP id a13-20020a05651c210d00b0026626b831bamr2252774ljq.149.1661876513868; Tue, 30 Aug 2022 09:21:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661876513; cv=pass; d=google.com; s=arc-20160816; b=JdXp+PFA8wO8bPOvVA+tu725zZvQTifaa0I3ZKkqmZe09tr7j7cCxX1+vNBDYrsDmG NTTAJKhXI3qDzjKmNrw/SLlq6N9+nfsO6QQXOq4vpZPL/nn7eaUxFOqiq7Ox6RuqcKi6 rOolTrZ0AV9C4VtCOtRQj2e8fZmCrtjh3w/2p2PivmC6vSGnCOROVJeeyiCXHwdWsp1r 6xyH49UnvfiaSzkdiNnxmz2AxjHhSgZxx9s6/A50HJ0Bdom56HPS5uKOxBQ7xpVW6i8y wUW5L9BdxEzNkb9CU9Xx0ak/jysr8fnRvQLvYm5prAxSW9bWnM1coWMat6gHFw7aJk90 q6wg== ARC-Message-Signature: i=2; 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:dkim-signature; bh=xOJycbU+nBcYkYTQ+5G5p4wzq+rBmuFmUqCtYpYAlNk=; b=At9s5tDwHb2/eU1EMvh2esjA38cjnI6U/qU07buiNsoz4HC+jFHOEPNKRJef9J1+xb 7tuKgbfUBZjntRz9gzjwWZlDNYjC6hvf04Rd0XD7asxvlPwg/tYd7I5A7V3RPD1rRlAd dvuP0vxy/V4bTCdHrbLPe0lCPYeaXDu/nH11+YiCjlwkqELaWGNb/E+apNK5zMRbPeIS Sah5nOoRBwZAx59EHXPQKZspY8NimGkXbn+BDpdr2ibM+hiVER3imD3N/nubI4ZxEmk0 QNZ7TvZJ0s5r2hZNdshzHVjo5FPRtwO30SMbkAyG9yiMDRrDTB5MCFPu9ZyjpAoziO0c 7PNw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=RiGgp1aT; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.5.57 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50057.outbound.protection.outlook.com. [40.107.5.57]) by gmr-mx.google.com with ESMTPS id p15-20020a2ea4cf000000b002652a5a5536si180592ljm.2.2022.08.30.09.21.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2022 09:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 40.107.5.57 as permitted sender) client-ip=40.107.5.57; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dm/g4m9d7VQLEx7c3pGKusIXDu84utOU51rHSj/ii77ya775O457xUnmQmPhhksP8oQ525I48Ye2hkmuh7o3WPxnl8aeXzJ+0nEHDXNPPePjhDHGAZzep59NvzK9/mkqwGGZZo0FbF6qdBoVCAfOxm64HM08+8CkfdX1SU8LAjfUoOTT4BxJArefW1OXllHWcADZOWcoDw6XjeSv1arguESUMssSBLPJZuV2fuCJD6Lp+mDnrFZc3KzIh1qv/crK/BYO1Jjjnvx52ihQ2BWTMZ3Qzjg/j6oB9+HOoKSIKohTCWM69NFiDzRL9hiPin8cb6WIoEXp/YI7/F+SrKxH6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xOJycbU+nBcYkYTQ+5G5p4wzq+rBmuFmUqCtYpYAlNk=; b=W9/bxQtQWaVon+vXCNkEkDado3rQ50ZLyaiOlvEAz3OkrosDh7maVyolH1d4UFEZYNMdf4WImyLzkgMPtbAzNjSVWcVd/RGeeEyzs1Yfqy27sjUcEpvrCViNqYOQNSUNyzRzCHClm5Ex+8biU9nsExh9x7S0BMhJQgznfA2Vz2eqBPjxPiCQsMWEZLLjVTZEnowJU5M68jDNsLZcskMTfZFf0ujXIU1vpbJczFT9J4zmLG1C7BQV0mO6CzwsqlbOfrnEKlQP/Gb0RHc/GKdVMp1YTXKrXA6V5oY2inTZb+ZGKUcQoWp7cWBMwgvB2A9RpEj+dGhQRt1NQ6q5t/7SFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.75) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none Received: from DB3PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:8:1::49) by AS8PR10MB6505.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:569::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.16; Tue, 30 Aug 2022 16:21:52 +0000 Received: from DB5EUR01FT007.eop-EUR01.prod.protection.outlook.com (2603:10a6:8:1:cafe::26) by DB3PR06CA0036.outlook.office365.com (2603:10a6:8:1::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 16:21:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.75) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.75 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.75; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.75) by DB5EUR01FT007.mail.protection.outlook.com (10.152.4.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 16:21:51 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VRA.ad011.siemens.net (194.138.21.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.12; Tue, 30 Aug 2022 18:21:51 +0200 Received: from MD1ZFJVC.ad001.siemens.net (139.25.0.117) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Tue, 30 Aug 2022 18:21:51 +0200 From: Christian Storm To: CC: Christian Storm Subject: [swupdate] [PATCH 5/5] handlers: Add stat() to Lua Handler interface specification Date: Tue, 30 Aug 2022 18:22:25 +0200 Message-ID: <20220830162225.42042-5-christian.storm@siemens.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830162225.42042-1-christian.storm@siemens.com> References: <20220830162225.42042-1-christian.storm@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.117] X-ClientProxiedBy: DEMCHDC89XA.ad011.siemens.net (139.25.226.103) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb080849-437e-4396-1f8e-08da8aa3bf51 X-MS-TrafficTypeDiagnostic: AS8PR10MB6505:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A4iSeh+0Oue6gOOo1Go2hby0UbFPtjisL8jnPV+U1QQy2QesY9CLoxsS3VOMyWBuV8cyOYyk4jiRrCrIg+81iI2bwAL6oeJtNxifWB1UXyxJQ5QNXjgI0EHwFZM8xFRO4RvDuAKD/T82zaPUonfLTmAt/bC59T9nVpPDPy7ebiGQlLFpvGidEPfMhtMm+K2GhG+/pH2orMfUFr4EPYTSbOSn+ZLWyVJ7OpAUtNM8QkHJlDG3i33Lsha+/ooEZWAvzOhNGYd1Yhi9W6en6qRCTqJwiqobkEdBkYRgY9XzLG+kH3CnUdZr7nQFLCF5PYoYor3pB1e9VZ91xUUm0ohIKt7ot7dwzDM7RZP5l+sIrYC/Zh6tpLJ+y+2njymYQvxnqbBeueCfC8WZ0T5hYw6W7dt4j3JhEJ+6cn370bLoejDHuKBJw9GQa+rmr+2vxfA7vpJ5oQh+CgFETTfgd2svRS6Wh8iA/imabSvXhZwQSe0onUmSeLdT/Nh5MMHLWxjPABLXlgqJaLRpvnqWal4SF3GDPdu/XTPtRh5BUIwAX98pfnMiLdhdnVkohg34/KtXit174Konbv/Jh7JPbjyh4jV/rVinHnhEv6fKO8yCWDJ7qhsiydjw4/zfFsJj1ey7XWyujz5FmZpAmxmFNJ+t4uOJN/HE3iBP688KQELyVeIAr1+OH1ByhCZ9pwDs7axt/0nWh2OYV7ZvrfM5XIVKx6RCZvS8qA+ew5c6H2ah8+vz7Xxu+BSaN1NUaKT7nYXEKmK2w5/FfBZZ/YWsbeA107mbuzUV6DKzHs2QsyVWdOtIYzJRkaFCs3L37zeQecBF X-Forefront-Antispam-Report: CIP:194.138.21.75;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(346002)(36840700001)(40470700004)(46966006)(86362001)(36756003)(82740400003)(26005)(83380400001)(36860700001)(41300700001)(47076005)(2616005)(336012)(16526019)(186003)(6666004)(107886003)(1076003)(956004)(40480700001)(316002)(6916009)(82310400005)(8676002)(4326008)(478600001)(70586007)(70206006)(82960400001)(2906002)(356005)(81166007)(5660300002)(40460700003)(44832011)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 16:21:51.9679 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb080849-437e-4396-1f8e-08da8aa3bf51 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.75];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT007.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB6505 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=RiGgp1aT; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of christian.storm@siemens.com designates 40.107.5.57 as permitted sender) smtp.mailfrom=christian.storm@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , Commit 8a5d6a3 introduced the STAT(2) wrapper to the Lua realm. Add the missing interface specification. Signed-off-by: Christian Storm --- handlers/swupdate.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/handlers/swupdate.lua b/handlers/swupdate.lua index 621da19..c83a9ed 100644 --- a/handlers/swupdate.lua +++ b/handlers/swupdate.lua @@ -114,6 +114,35 @@ swupdate.ROOT_DEVICE = { swupdate.getroot = function() end +--- Table with major/minor numbers of the device on which the swupdate.stat()'d file resides. +--- @class swupdate.stat_dev +--- @field major number Major device number +--- @field minor number Minor device number + +--- `struct stat`-alike Table. +--- @class swupdate.stat_info +--- @field mode "directory"|"named pipe"|"link"|"regular file"|"socket"|"block device"|"char device"|"unknown" File type and mode +--- @field dev swupdate.stat_dev ID of device containing file +--- @field ino number Inode number +--- @field nlink number Number of hard links +--- @field uid number User ID of owner +--- @field gid number Group ID of owner +--- @field rdev swupdate.stat_dev Device ID (if special file) +--- @field access string Time of last access, e.g., "Wed Jun 30 21:49:08 1993" +--- @field modification string Time of last modification, e.g., "Wed Jun 30 21:49:08 1993" +--- @field change string Time of last status change, e.g., "Wed Jun 30 21:49:08 1993" +--- @field size number Total size, in bytes +--- @field permissions string Unix file permissions string, e.g., "rwxr-xr-x" +--- @field blocks number Number of 512B blocks allocated +--- @field blksize number Block size for filesystem I/O + +--- STAT(2) Wrapper. +-- +--- @param pathname string Retrieve information about the file `pathname` +--- @return swupdate.stat_info | nil # `struct stat`-alike Table if successful, nil on error +swupdate.stat = function(pathname) end + + --- Get SWUpdate's TMPDIRSCRIPT directory. -- --- @return string # TMPDIRSCRIPT directory