Zephyr Project API  3.4.0
A Scalable Open Source RTOS
smp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2021 mcumgr authors
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
25#ifndef H_SMP_
26#define H_SMP_
27
28#include <zephyr/net/buf.h>
30
31#include <zcbor_common.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
41
44};
45
47 struct net_buf *nb;
48 /* CONFIG_MCUMGR_SMP_CBOR_MAX_DECODING_LEVELS + 2 translates to minimal
49 * zcbor backup states.
50 */
51 zcbor_state_t zs[CONFIG_MCUMGR_SMP_CBOR_MAX_DECODING_LEVELS + 2];
52};
53
55 struct net_buf *nb;
56 zcbor_state_t zs[2];
57
58#ifdef CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL
59 uint16_t error_group;
60 uint16_t error_ret;
61#endif
62};
63
71
77void smp_packet_free(struct net_buf *nb);
78
86
87#ifdef CONFIG_MCUMGR_SMP_VERBOSE_ERR_RESPONSE
88 const char *rc_rsn;
89#endif
90};
91
106int smp_process_request_packet(struct smp_streamer *streamer, void *req);
107
121bool smp_add_cmd_ret(zcbor_state_t *zse, uint16_t group, uint16_t ret);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* H_SMP_ */
static ZTEST_BMEM volatile int ret
Definition: k_float_disable.c:29
Buffer management.
int smp_process_request_packet(struct smp_streamer *streamer, void *req)
Processes a single SMP request packet and sends all corresponding responses.
smp_mcumgr_version_t
Definition: smp.h:38
@ SMP_MCUMGR_VERSION_2
Definition: smp.h:43
@ SMP_MCUMGR_VERSION_1
Definition: smp.h:40
bool smp_add_cmd_ret(zcbor_state_t *zse, uint16_t group, uint16_t ret)
Appends a "ret" response.
struct net_buf * smp_packet_alloc(void)
Allocates a net_buf for holding an mcumgr request or response.
void smp_packet_free(struct net_buf *nb)
Frees an mcumgr net_buf.
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: smp.h:46
struct net_buf * nb
Definition: smp.h:47
zcbor_state_t zs[CONFIG_MCUMGR_SMP_CBOR_MAX_DECODING_LEVELS+2]
Definition: smp.h:51
Definition: smp.h:54
zcbor_state_t zs[2]
Definition: smp.h:56
struct net_buf * nb
Definition: smp.h:55
Network buffer representation.
Definition: buf.h:906
Decodes, encodes, and transmits SMP packets.
Definition: smp.h:82
struct cbor_nb_writer * writer
Definition: smp.h:85
struct smp_transport * smpt
Definition: smp.h:83
struct cbor_nb_reader * reader
Definition: smp.h:84
SMP transport object for sending SMP responses.
Definition: smp.h:118