Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
smp.h File Reference
#include <kernel.h>

Go to the source code of this file.

Data Structures

struct  zephyr_smp_transport
 Provides Zephyr-specific functionality for sending SMP responses. More...
 

Typedefs

typedef int zephyr_smp_transport_out_fn(struct zephyr_smp_transport *zst, struct net_buf *nb)
 SMP transmit function for Zephyr. More...
 
typedef uint16_t zephyr_smp_transport_get_mtu_fn(const struct net_buf *nb)
 SMP MTU query function for Zephyr. More...
 
typedef int zephyr_smp_transport_ud_copy_fn(struct net_buf *dst, const struct net_buf *src)
 SMP copy buffer user_data function for Zephyr. More...
 
typedef void zephyr_smp_transport_ud_free_fn(void *ud)
 SMP free buffer user_data function for Zephyr. More...
 

Functions

void zephyr_smp_transport_init (struct zephyr_smp_transport *zst, zephyr_smp_transport_out_fn *output_func, zephyr_smp_transport_get_mtu_fn *get_mtu_func, zephyr_smp_transport_ud_copy_fn *ud_copy_func, zephyr_smp_transport_ud_free_fn *ud_free_func)
 Initializes a Zephyr SMP transport object. More...
 
void zephyr_smp_rx_req (struct zephyr_smp_transport *zst, struct net_buf *nb)
 Enqueues an incoming SMP request packet for processing. More...
 

Typedef Documentation

◆ zephyr_smp_transport_get_mtu_fn

zephyr_smp_transport_get_mtu_fn

SMP MTU query function for Zephyr.

The supplied net_buf should contain a request received from the peer whose MTU is being queried. This function takes a net_buf parameter because some transports store connection-specific information in the net_buf user header (e.g., the BLE transport stores the peer address).

Parameters
nbContains a request from the relevant peer.
Returns
The transport's MTU; 0 if transmission is currently not possible.

◆ zephyr_smp_transport_out_fn

zephyr_smp_transport_out_fn

SMP transmit function for Zephyr.

The supplied net_buf is always consumed, regardless of return code.

Parameters
zstThe transport to send via.
nbThe net_buf to transmit.
Returns
0 on success, MGMT_ERR_[...] code on failure.

◆ zephyr_smp_transport_ud_copy_fn

zephyr_smp_transport_ud_copy_fn

SMP copy buffer user_data function for Zephyr.

The supplied src net_buf should contain a user_data that cannot be copied using regular memcpy function (e.g., the BLE transport net_buf user_data stores the connection reference that has to be incremented when is going to be used by another buffer).

Parameters
dstSource buffer user_data pointer.
srcDestination buffer user_data pointer.
Returns
0 on success, MGMT_ERR_[...] code on failure.

◆ zephyr_smp_transport_ud_free_fn

zephyr_smp_transport_ud_free_fn

SMP free buffer user_data function for Zephyr.

This function frees net_buf user data, because some transports store connection-specific information in the net_buf user data (e.g., the BLE transport stores the connection reference that has to be decreased).

Parameters
udContains a user_data pointer to be freed.

Function Documentation

◆ zephyr_smp_rx_req()

void zephyr_smp_rx_req ( struct zephyr_smp_transport zst,
struct net_buf nb 
)

Enqueues an incoming SMP request packet for processing.

This function always consumes the supplied net_buf.

Parameters
zstThe transport to use to send the corresponding response(s).
nbThe request packet to process.

◆ zephyr_smp_transport_init()

void zephyr_smp_transport_init ( struct zephyr_smp_transport zst,
zephyr_smp_transport_out_fn output_func,
zephyr_smp_transport_get_mtu_fn get_mtu_func,
zephyr_smp_transport_ud_copy_fn ud_copy_func,
zephyr_smp_transport_ud_free_fn ud_free_func 
)

Initializes a Zephyr SMP transport object.

Parameters
zstThe transport to construct.
output_funcThe transport's send function.
get_mtu_funcThe transport's get-MTU function.
ud_copy_funcThe transport buffer user_data copy function.
ud_free_funcThe transport buffer user_data free function.
Returns
0 on success, MGMT_ERR_[...] code on failure.