Zephyr API 3.6.99
Loading...
Searching...
No Matches
lwm2m_ctx Struct Reference

LwM2M context structure to maintain information for a single LwM2M connection. More...

#include <lwm2m.h>

Data Fields

struct sockaddr remote_addr
 Destination address storage.
 
void * processed_req
 A pointer to currently processed request, for internal LwM2M engine use.
 
int(* set_socketoptions )(struct lwm2m_ctx *client_ctx)
 Custom socket options.
 
bool use_dtls
 Flag to indicate if context should use DTLS.
 
bool connection_suspended
 Flag to indicate that the socket connection is suspended.
 
bool buffer_client_messages
 Flag to indicate that the client is buffering Notifications and Send messages.
 
int sec_obj_inst
 Current index of Security Object used for server credentials.
 
int srv_obj_inst
 Current index of Server Object used in this context.
 
bool bootstrap_mode
 Flag to enable BOOTSTRAP interface.
 
int sock_fd
 Socket File Descriptor.
 
lwm2m_socket_fault_cb_t fault_cb
 Socket fault callback.
 
lwm2m_observe_cb_t observe_cb
 Callback for new or cancelled observations, and acknowledged or timed out notifications.
 
lwm2m_ctx_event_cb_t event_cb
 Callback for client events.
 
uint8_t validate_buf [CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]
 Validation buffer.
 
void(* set_socket_state )(int fd, enum lwm2m_socket_states state)
 Callback to indicate transmission states.
 
DTLS related information

Available only when

CONFIG_LWM2M_DTLS_SUPPORT 

is enabled and lwm2m_ctx::use_dtls is set to true.

int tls_tag
 TLS tag is set by client as a reference used when the LwM2M engine calls tls_credential_(add|delete)
 
char * desthostname
 Destination hostname.
 
uint16_t desthostnamelen
 Destination hostname length.
 
bool hostname_verify
 Flag to indicate if hostname verification is enabled.
 
int(* load_credentials )(struct lwm2m_ctx *client_ctx)
 Custom load_credentials function.
 

Detailed Description

LwM2M context structure to maintain information for a single LwM2M connection.

Field Documentation

◆ bootstrap_mode

bool lwm2m_ctx::bootstrap_mode

Flag to enable BOOTSTRAP interface.

See Section "Bootstrap Interface" of LwM2M Technical Specification for more information.

◆ buffer_client_messages

bool lwm2m_ctx::buffer_client_messages

Flag to indicate that the client is buffering Notifications and Send messages.

True value buffer Notifications and Send messages.

◆ connection_suspended

bool lwm2m_ctx::connection_suspended

Flag to indicate that the socket connection is suspended.

With queue mode, this will tell if there is a need to reconnect.

◆ desthostname

char* lwm2m_ctx::desthostname

Destination hostname.

When MBEDTLS SNI is enabled socket must be set with destination server hostname.

◆ desthostnamelen

uint16_t lwm2m_ctx::desthostnamelen

Destination hostname length.

◆ event_cb

lwm2m_ctx_event_cb_t lwm2m_ctx::event_cb

Callback for client events.

◆ fault_cb

lwm2m_socket_fault_cb_t lwm2m_ctx::fault_cb

Socket fault callback.

LwM2M processing thread will call this callback in case of socket errors on receive.

◆ hostname_verify

bool lwm2m_ctx::hostname_verify

Flag to indicate if hostname verification is enabled.

◆ load_credentials

int(* lwm2m_ctx::load_credentials) (struct lwm2m_ctx *client_ctx)

Custom load_credentials function.

Client can set load_credentials function as a way of overriding the default behavior of load_tls_credential() in lwm2m_engine.c

◆ observe_cb

lwm2m_observe_cb_t lwm2m_ctx::observe_cb

Callback for new or cancelled observations, and acknowledged or timed out notifications.

◆ processed_req

void* lwm2m_ctx::processed_req

A pointer to currently processed request, for internal LwM2M engine use.

The underlying type is struct lwm2m_message, but since it's declared in a private header and not exposed to the application, it's stored as a void pointer.

◆ remote_addr

struct sockaddr lwm2m_ctx::remote_addr

Destination address storage.

◆ sec_obj_inst

int lwm2m_ctx::sec_obj_inst

Current index of Security Object used for server credentials.

◆ set_socket_state

void(* lwm2m_ctx::set_socket_state) (int fd, enum lwm2m_socket_states state)

Callback to indicate transmission states.

Client application may request LwM2M engine to indicate hints about transmission states and use that information to control various power saving modes.

◆ set_socketoptions

int(* lwm2m_ctx::set_socketoptions) (struct lwm2m_ctx *client_ctx)

Custom socket options.

Client can override default socket options by providing a callback that is called after a socket is created and before connect.

◆ sock_fd

int lwm2m_ctx::sock_fd

Socket File Descriptor.

◆ srv_obj_inst

int lwm2m_ctx::srv_obj_inst

Current index of Server Object used in this context.

◆ tls_tag

int lwm2m_ctx::tls_tag

TLS tag is set by client as a reference used when the LwM2M engine calls tls_credential_(add|delete)

◆ use_dtls

bool lwm2m_ctx::use_dtls

Flag to indicate if context should use DTLS.

Enabled via the use of coaps:// protocol prefix in connection information. NOTE: requires

CONFIG_LWM2M_DTLS_SUPPORT 

◆ validate_buf

uint8_t lwm2m_ctx::validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]

Validation buffer.

Used as a temporary buffer to decode the resource value before validation. On successful validation, its content is copied into the actual resource buffer.


The documentation for this struct was generated from the following file: