Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
|
SMP - Simple Management Protocol. More...
Go to the source code of this file.
Data Structures | |
struct | cbor_nb_reader |
struct | cbor_nb_writer |
struct | smp_streamer |
Decodes, encodes, and transmits SMP packets. More... | |
Enumerations | |
enum | smp_mcumgr_version_t { SMP_MCUMGR_VERSION_1 = 0 , SMP_MCUMGR_VERSION_2 } |
SMP MCUmgr protocol version, part of the SMP header. More... | |
Functions | |
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. | |
int | smp_process_request_packet (struct smp_streamer *streamer, void *req) |
Processes a single SMP request packet and sends all corresponding responses. | |
bool | smp_add_cmd_err (zcbor_state_t *zse, uint16_t group, uint16_t ret) |
Appends an "err" response. | |
bool | smp_add_cmd_ret (zcbor_state_t *zse, uint16_t group, uint16_t ret) |
SMP - Simple Management Protocol.
SMP is a basic protocol that sits on top of the mgmt layer. SMP requests and responses have the following format:
[Offset 0]: Mgmt header [Offset 8]: CBOR map of command-specific key-value pairs.
SMP request packets may contain multiple concatenated requests. Each request must start at an offset that is a multiple of 4, so padding should be inserted between requests as necessary. Requests are processed sequentially from the start of the packet to the end. Each response is sent individually in its own packet. If a request elicits an error response, processing of the packet is aborted.
enum smp_mcumgr_version_t |
Appends an "err" response.
This appends an err response to a pending outgoing response which contains a result code for a specific group. Note that error codes are specific to the command group they are emitted from).
zse | The zcbor encoder to use. |
group | The group which emitted the error. |
ret | The command result code to add. |
struct net_buf * smp_packet_alloc | ( | void | ) |
void smp_packet_free | ( | struct net_buf * | nb | ) |
int smp_process_request_packet | ( | struct smp_streamer * | streamer, |
void * | req ) |
Processes a single SMP request packet and sends all corresponding responses.
Processes all SMP requests in an incoming packet. Requests are processed sequentially from the start of the packet to the end. Each response is sent individually in its own packet. If a request elicits an error response, processing of the packet is aborted. This function consumes the supplied request buffer regardless of the outcome.
streamer | The streamer providing the required SMP callbacks. |
req | The request packet to process. |