Loading...
Searching...
No Matches
lwm2m_client.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 HAW Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <ctype.h>
24#include <errno.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <sys/types.h>
29#include <unistd.h>
30#include <sys/time.h>
31
32#include "periph/pm.h"
33#include "net/sock/udp.h"
34
35#if IS_USED(MODULE_WAKAAMA_CLIENT_DTLS)
36#include "net/sock/dtls.h"
37#endif
38
39#include "lwm2m_client_config.h"
40#include "liblwm2m.h"
41
49
62
66typedef struct {
69#if IS_USED(MODULE_WAKAAMA_CLIENT_DTLS)
70 sock_udp_t dtls_udp_sock;
71 sock_dtls_t dtls_sock;
72 sock_udp_ep_t dtls_local_ep;
73#endif
75 lwm2m_context_t *lwm2m_ctx;
78
82#define LWM2M_CLIENT_RCV_BUFFER_SIZE (200)
83
88#define LWM2M_CLIENT_REBOOT_TIME (5)
89
96#define LWM2M_CLIENT_MIN_REFRESH_TIME (1)
97
107lwm2m_context_t *lwm2m_client_run(lwm2m_client_data_t *client_data,
108 lwm2m_object_t *obj_list[],
109 uint16_t obj_numof);
110
120
128static inline lwm2m_context_t *lwm2m_client_get_ctx(
129 lwm2m_client_data_t *client_data)
130{
131 return client_data->lwm2m_ctx;
132}
133
134#if IS_USED(MODULE_WAKAAMA_CLIENT_DTLS) || defined(DOXYGEN)
140
149
156#endif /* MODULE_WAKAAMA_CLIENT_DTLS || DOXYGEN */
157
158#ifdef __cplusplus
159}
160#endif
161
int16_t kernel_pid_t
Unique process identifier.
Definition sched.h:134
static lwm2m_context_t * lwm2m_client_get_ctx(lwm2m_client_data_t *client_data)
Returns the LwM2M context of a LwM2M client.
void lwm2m_client_refresh_dtls_credentials(void)
Refreshes the client available credentials using the currently registered security objects.
void lwm2m_client_init(lwm2m_client_data_t *client_data)
Initializes a LwM2M client.
lwm2m_context_t * lwm2m_client_run(lwm2m_client_data_t *client_data, lwm2m_object_t *obj_list[], uint16_t obj_numof)
Starts a LwM2M client.
void lwm2m_client_remove_credential(credman_tag_t tag)
Removes a credential tag from the available to use with the LwM2M DTLS sock.
void lwm2m_client_add_credential(credman_tag_t tag)
Adds a credential tag to be used with the LwM2M DTLS sock.
struct lwm2m_client_connection lwm2m_client_connection_t
Connection to server descriptor.
lwm2m_client_connection_type_t
Type of connection to the LwM2M server.
@ LWM2M_CLIENT_CONN_DTLS
DTLS over UDP.
@ LWM2M_CLIENT_CONN_UDP
UDP.
uint16_t credman_tag_t
Tag of the credential.
Definition credman.h:92
struct sock_udp sock_udp_t
forward declare for async
Definition types.h:136
struct sock_dtls sock_dtls_t
forward declare for async
Definition types.h:44
struct sock_dtls_session sock_dtls_session_t
Information about a created session.
Definition dtls.h:635
struct _sock_tl_ep sock_udp_ep_t
An end point for a UDP sock object.
Definition udp.h:292
LwM2M client configurations.
Power management interface.
DTLS sock definitions.
UDP sock definitions.
Connection to server descriptor.
time_t last_send
last sent packet to the server
sock_dtls_session_t session
DTLS session (needs wakaama_client_dtls module)
lwm2m_client_connection_type_t type
type of connection
sock_udp_ep_t remote
remote endpoint
struct lwm2m_client_connection * next
pointer to the next connection
LwM2M client descriptor.
lwm2m_client_connection_t * conn_list
LwM2M connections list.
kernel_pid_t pid
PID of the client thread.
sock_udp_t sock
UDP server sock.
sock_udp_ep_t local_ep
Local endpoint.
lwm2m_context_t * lwm2m_ctx
LwM2M context.