Loading...
Searching...
No Matches
handlers.h
1/*
2 * SPDX-FileCopyrightText: 2019 Koen Zandberg
3 * SPDX-FileCopyrightText: 2019 Kaspar Schleiser <kaspar@schleiser.de>
4 * SPDX-FileCopyrightText: 2019 Inria
5 * SPDX-FileCopyrightText: 2019 Freie Universität Berlin
6 * SPDX-License-Identifier: LGPL-2.1-only
7 */
8
9#pragma once
10
23
24#include <stddef.h>
25#include <stdint.h>
26
27#include "suit.h"
28#include "uuid.h"
29#include "nanocbor/nanocbor.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
39#define SUIT_WRAPPER_AUTHENTICATION (2)
40#define SUIT_WRAPPER_MANIFEST (3)
42
47#define SUIT_CONTAINER_VERSION (1)
48#define SUIT_CONTAINER_SEQ_NO (2)
49#define SUIT_CONTAINER_COMMON (3)
50#define SUIT_CONTAINER_DEPS_RESOLUTION (7)
51#define SUIT_CONTAINER_PAYLOAD_FETCH (8)
52#define SUIT_CONTAINER_INSTALL (9)
53#define SUIT_CONTAINER_VALIDATE (10)
54#define SUIT_CONTAINER_LOAD (11)
55#define SUIT_CONTAINER_RUN (12)
56#define SUIT_CONTAINER_TEXT (13)
58
63#define SUIT_COMMON_DEPENDENCIES (1)
64#define SUIT_COMMON_COMPONENTS (2)
65#define SUIT_COMMON_DEP_COMPONENTS (3)
66#define SUIT_COMMON_COMMAND_SEQUENCE (4)
68
73#define SUIT_COND_VENDOR_ID (1)
74#define SUIT_COND_CLASS_ID (2)
75#define SUIT_COND_IMAGE_MATCH (3)
76#define SUIT_COND_USE_BEFORE (4)
77#define SUIT_COND_COMPONENT_OFFSET (5)
78#define SUIT_COND_DEVICE_ID (24)
79#define SUIT_COND_IMAGE_NOT_MATCH (25)
80#define SUIT_COND_MIN_BATTERY (26)
81#define SUIT_COND_UPDATE_AUTHZ (27)
82#define SUIT_COND_VERSION (28)
84
89#define SUIT_DIR_SET_COMPONENT_IDX (12)
90#define SUIT_DIR_SET_DEPENDENCY_IDX (13)
91#define SUIT_DIR_ABORT (14)
92#define SUIT_DIR_TRY_EACH (15)
93#define SUIT_DIR_PROCESS_DEPS (18)
94#define SUIT_DIR_SET_PARAM (19)
95#define SUIT_DIR_OVERRIDE_PARAM (20)
96#define SUIT_DIR_FETCH (21)
97#define SUIT_DIR_COPY (22)
98#define SUIT_DIR_RUN (23)
99#define SUIT_DIR_WAIT (29)
100#define SUIT_DIR_RUN_SEQUENCE (30)
101#define SUIT_DIR_RUN_WITH_ARGS (31)
102#define SUIT_DIR_SWAP (32)
104
115typedef int (*suit_manifest_handler_t)(suit_manifest_t *manifest, int key,
116 nanocbor_value_t *it);
117
121extern const suit_manifest_handler_t suit_global_handlers[];
122extern const size_t suit_global_handlers_len;
123
127extern const suit_manifest_handler_t suit_command_sequence_handlers[];
128
132extern const size_t suit_command_sequence_handlers_len;
133
137extern const suit_manifest_handler_t suit_envelope_handlers[];
138
142extern const size_t suit_envelope_handlers_len;
143
147extern const suit_manifest_handler_t suit_common_handlers[];
148
152extern const size_t suit_common_handlers_len;
153
168int suit_handle_manifest_structure(suit_manifest_t *manifest,
169 nanocbor_value_t *it,
170 const suit_manifest_handler_t *handlers,
171 size_t handlers_len);
172
188int suit_handle_manifest_structure_bstr(suit_manifest_t *manifest,
189 nanocbor_value_t *bseq,
190 const suit_manifest_handler_t *handlers,
191 size_t handlers_len);
192
207uint16_t suit_param_ref_to_cbor(const suit_manifest_t *manifest,
208 const suit_param_ref_t *ref,
209 nanocbor_value_t *val);
210
219void suit_param_cbor_to_ref(const suit_manifest_t *manifest,
220 suit_param_ref_t *ref,
221 const nanocbor_value_t *val);
222
223#ifdef __cplusplus
224}
225#endif
226
SUIT manifest struct.
Definition suit.h:231
SUIT parameter reference.
Definition suit.h:183
RFC 4122 UUID functions