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