Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
smp.h
Go to the documentation of this file.
1/*
2 * Copyright Runtime.io 2018. All rights reserved.
3 * Copyright (c) 2022-2023 Nordic Semiconductor ASA
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_MGMT_SMP_H_
9#define ZEPHYR_INCLUDE_MGMT_SMP_H_
10
11#include <zephyr/kernel.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
23
24struct smp_transport;
25struct zephyr_smp_transport;
26struct net_buf;
27
37typedef int (*smp_transport_out_fn)(struct net_buf *nb);
38
52typedef uint16_t (*smp_transport_get_mtu_fn)(const struct net_buf *nb);
53
67typedef int (*smp_transport_ud_copy_fn)(struct net_buf *dst,
68 const struct net_buf *src);
69
79typedef void (*smp_transport_ud_free_fn)(void *ud);
80
92typedef bool (*smp_transport_query_valid_check_fn)(struct net_buf *nb, void *arg);
93
102typedef void (*smp_transport_ud_req_init_fn)(struct net_buf *nb, void *priv);
103
127
132 /* Must be the first member. */
133 struct k_work work;
134
135 /* FIFO containing incoming requests to be processed. */
136 struct k_fifo fifo;
137
138 /* Function pointers */
140
141#ifdef CONFIG_MCUMGR_TRANSPORT_REASSEMBLY
142 /* Packet reassembly internal data, API access only */
143 struct {
144 struct net_buf *current; /* net_buf used for reassembly */
145 uint16_t expected; /* expected bytes to come */
146 } __reassembly;
147#endif
148};
149
169
180
190
200void smp_rx_remove_invalid(struct smp_transport *zst, void *arg);
201
207void smp_rx_clear(struct smp_transport *zst);
208
215
224
228
229#ifdef __cplusplus
230}
231#endif
232
233#endif
void(* smp_transport_ud_req_init_fn)(struct net_buf *nb, void *priv)
SMP init request buffer.
Definition smp.h:102
void(* smp_transport_ud_free_fn)(void *ud)
SMP free user_data callback.
Definition smp.h:79
uint16_t(* smp_transport_get_mtu_fn)(const struct net_buf *nb)
SMP MTU query callback for transport.
Definition smp.h:52
int(* smp_transport_out_fn)(struct net_buf *nb)
SMP transmit callback for transport.
Definition smp.h:37
smp_transport_type
SMP transport type for client registration.
Definition smp.h:153
void smp_rx_clear(struct smp_transport *zst)
Used to clear pending queued requests for an SMP transport.
struct smp_transport * smp_client_transport_get(int smpt_type)
Discover a registered SMP transport client object.
bool(* smp_transport_query_valid_check_fn)(struct net_buf *nb, void *arg)
Function for checking if queued data is still valid.
Definition smp.h:92
int(* smp_transport_ud_copy_fn)(struct net_buf *dst, const struct net_buf *src)
SMP copy user_data callback.
Definition smp.h:67
void smp_rx_remove_invalid(struct smp_transport *zst, void *arg)
Used to remove queued requests for an SMP transport that are no longer valid.
int smp_transport_init(struct smp_transport *smpt)
Initializes a Zephyr SMP transport object.
void smp_client_transport_register(struct smp_client_transport_entry *entry)
Register a Zephyr SMP transport object for client.
@ SMP_UDP_IPV6_TRANSPORT
SMP UDP IPv6.
Definition smp.h:163
@ SMP_SHELL_TRANSPORT
SMP shell.
Definition smp.h:159
@ SMP_BLUETOOTH_TRANSPORT
SMP bluetooth.
Definition smp.h:157
@ SMP_USER_DEFINED_TRANSPORT
SMP user defined type.
Definition smp.h:167
@ SMP_SERIAL_TRANSPORT
SMP serial.
Definition smp.h:155
@ SMP_UDP_IPV4_TRANSPORT
SMP UDP IPv4.
Definition smp.h:161
@ SMP_LORAWAN_TRANSPORT
SMP LoRaWAN.
Definition smp.h:165
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public kernel APIs.
#define bool
Definition stdbool.h:13
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Definition kernel.h:2806
A structure used to submit work.
Definition kernel.h:4437
Network buffer representation.
Definition net_buf.h:1006
SMP Client transport structure.
Definition smp.h:173
int smpt_type
Transport type.
Definition smp.h:178
sys_snode_t node
Definition smp.h:174
struct smp_transport * smpt
Transport structure pointer.
Definition smp.h:176
Function pointers of SMP transport functions, if a handler is NULL then it is not supported/implement...
Definition smp.h:108
smp_transport_ud_req_init_fn ud_init
Transport's request buffer init function.
Definition smp.h:125
smp_transport_get_mtu_fn get_mtu
Transport's get-MTU function.
Definition smp.h:113
smp_transport_query_valid_check_fn query_valid_check
Transport's check function for if a query is valid.
Definition smp.h:122
smp_transport_out_fn output
Transport's send function.
Definition smp.h:110
smp_transport_ud_free_fn ud_free
Transport buffer user_data free function.
Definition smp.h:119
smp_transport_ud_copy_fn ud_copy
Transport buffer user_data copy function.
Definition smp.h:116
SMP transport object for sending SMP responses.
Definition smp.h:131
struct k_work work
Definition smp.h:133
struct k_fifo fifo
Definition smp.h:136
struct smp_transport_api_t functions
Definition smp.h:139