Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions
LWM2M Bootstrap Server

Routines to create Bootstrap Servers talking the LWM2M protocol. More...

Typedefs

typedef struct
sol_lwm2m_bootstrap_client_info 
sol_lwm2m_bootstrap_client_info
 A handle that contains information about a bootstrapping LWM2M client. More...
 
typedef struct
sol_lwm2m_bootstrap_server 
sol_lwm2m_bootstrap_server
 A handle to a LWM2M bootstrap server. More...
 

Functions

const struct
sol_network_link_addr
sol_lwm2m_bootstrap_client_info_get_address (const struct sol_lwm2m_bootstrap_client_info *client)
 Gets the bootstrap client address. More...
 
const char * sol_lwm2m_bootstrap_client_info_get_name (const struct sol_lwm2m_bootstrap_client_info *client)
 Gets the name of bootstrap client. More...
 
int sol_lwm2m_bootstrap_server_add_request_monitor (struct sol_lwm2m_bootstrap_server *server, void(*sol_lwm2m_bootstrap_server_request_cb)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo), const void *data)
 Adds a bootstrap request monitor to the server. More...
 
void sol_lwm2m_bootstrap_server_del (struct sol_lwm2m_bootstrap_server *server)
 Deletes a bootstrap server instance. More...
 
int sol_lwm2m_bootstrap_server_del_request_monitor (struct sol_lwm2m_bootstrap_server *server, void(*sol_lwm2m_bootstrap_server_request_cb)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo), const void *data)
 Removes a bootstrap request monitor from the server. More...
 
int sol_lwm2m_bootstrap_server_delete_object_instance (struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, void(*sol_lwm2m_bootstrap_server_status_response_cb)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
 Deletes an object instance on a client through the Bootstrap Interface. More...
 
struct sol_lwm2m_bootstrap_serversol_lwm2m_bootstrap_server_new (uint16_t port, const char **known_clients, uint16_t num_sec_modes,...)
 Creates a new LWM2M bootstrap server. More...
 
int sol_lwm2m_bootstrap_server_send_finish (struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client)
 Signals the end of the Bootstrap Process. More...
 
int sol_lwm2m_bootstrap_server_write (struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, struct sol_lwm2m_resource *resources, size_t len, void(*sol_lwm2m_bootstrap_server_status_response_cb)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
 Writes an object instance or resource through the Bootstrap Interface. More...
 
int sol_lwm2m_bootstrap_server_write_object (struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, struct sol_lwm2m_resource **instances, size_t *instances_len, uint16_t *instances_ids, size_t len, void(*sol_lwm2m_bootstrap_server_status_response_cb)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
 Writes a full object through the Bootstrap Interface. More...
 

Detailed Description

Routines to create Bootstrap Servers talking the LWM2M protocol.

Typedef Documentation

A handle that contains information about a bootstrapping LWM2M client.

A handle to a LWM2M bootstrap server.

See Also
sol_lwm2m_bootstrap_server_new()

Function Documentation

const struct sol_network_link_addr* sol_lwm2m_bootstrap_client_info_get_address ( const struct sol_lwm2m_bootstrap_client_info client)

Gets the bootstrap client address.

Parameters
clientThe LWM2M bootstrap client info.
Returns
The client address or NULL on error.
const char* sol_lwm2m_bootstrap_client_info_get_name ( const struct sol_lwm2m_bootstrap_client_info client)

Gets the name of bootstrap client.

Parameters
clientThe LWM2M bootstrap client info.
Returns
The client name or NULL on error.
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by bootstrap_cb(), delete_all_cb(), write_resource_cb(), write_sec_one_cb(), write_server_one_cb(), and write_servers_cb().

int sol_lwm2m_bootstrap_server_add_request_monitor ( struct sol_lwm2m_bootstrap_server server,
void(*)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo)  sol_lwm2m_bootstrap_server_request_cb,
const void *  data 
)

Adds a bootstrap request monitor to the server.

This function register a bootstrap request monitor. This means that every time a LWM2M client performs a Bootstrap Request sol_lwm2m_bootstrap_server_request_cb will be called.

Parameters
serverThe LWM2M bootstrap server.
sol_lwm2m_bootstrap_server_request_cbA callback that is used to inform a LWM2M client bootstrap request - data User data; server The LWM2M bootstrap server; bs_cinfo The client that initiated the bootstrap request.
dataThe user data to sol_lwm2m_bootstrap_server_request_cb.
Returns
0 on success, -errno on error.
See Also
sol_lwm2m_bootstrap_server_del_request_monitor()
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by main().

void sol_lwm2m_bootstrap_server_del ( struct sol_lwm2m_bootstrap_server server)

Deletes a bootstrap server instance.

Use this function to stop the LWM2M bootstrap server and release its resources.

Parameters
serverThe LWM2M bootstrap server to be deleted.
See Also
sol_lwm2m_bootstrap_server_new()
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by main().

int sol_lwm2m_bootstrap_server_del_request_monitor ( struct sol_lwm2m_bootstrap_server server,
void(*)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo)  sol_lwm2m_bootstrap_server_request_cb,
const void *  data 
)

Removes a bootstrap request monitor from the server.

Parameters
serverThe LWM2M bootstrap server.
sol_lwm2m_bootstrap_server_request_cbThe previous registered callback. - data User data; server The LWM2M bootstrap server; bs_cinfo The client that initiated the bootstrap request.
dataThe user data to sol_lwm2m_bootstrap_server_request_cb.
Returns
0 on success, -errno on error.
See Also
sol_lwm2m_bootstrap_server_add_request_monitor()
int sol_lwm2m_bootstrap_server_delete_object_instance ( struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info client,
const char *  path,
void(*)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, enum sol_coap_response_code response_code)  sol_lwm2m_bootstrap_server_status_response_cb,
const void *  data 
)

Deletes an object instance on a client through the Bootstrap Interface.

Parameters
serverThe LWM2M bootstrap server.
clientThe LWM2M bootstrap client info to delete an object
pathThe object path to be deleted (Example /1/1).
sol_lwm2m_bootstrap_server_status_response_cbA callback to be called when the delete operation is completed. - server The LW2M bootstrap server; client The LWM2M client; path The client's path; response_code The operation's response_code; data User data.
dataUser data to sol_lwm2m_bootstrap_server_status_response_cb
Returns
0 on success, -errno on error.
Note
Only in Bootstrap Interface, Delete operation MAY target to '/' URI to delete all the existing Object Instances - except LWM2M Bootstrap Server Account - in the LWM2M Client, for initialization purpose before LWM2M Bootstrap Server sends Write operation(s) to the LWM2M Client.
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by bootstrap_cb().

struct sol_lwm2m_bootstrap_server* sol_lwm2m_bootstrap_server_new ( uint16_t  port,
const char **  known_clients,
uint16_t  num_sec_modes,
  ... 
)

Creates a new LWM2M bootstrap server.

The server will be immediately operational and waiting for connections.

Parameters
portThe UDP port to be used.
known_clientsA NULL-terminated array with the name of all clients this server has Bootstrap Information for.
num_sec_modesThe number of DTLS Security Modes this Bootstrap Server will support.
...At least one sol_lwm2m_security_mode followed by its relevant parameters, as per the table below:
Security Mode Follow-up arguments Description
SOL_LWM2M_SECURITY_MODE_PRE_SHARED_KEY struct sol_lwm2m_security_psk **known_psks known_psks The Clients' Pre-Shared Keys this Bootstrap Server has previous knowledge of. It MUST be a NULL-terminated array.
SOL_LWM2M_SECURITY_MODE_RAW_PUBLIC_KEY struct sol_lwm2m_security_rpk *rpk, struct sol_blob **known_pub_keys rpk This Bootstrap Server's Key Pair - known_pub_keys The Clients' Public Keys this Bootstrap Server has previous knowledge of. It MUST be a NULL-terminated array.
Note
: SOL_LWM2M_SECURITY_MODE_CERTIFICATE is not supported yet.
Returns
The LWM2M bootstrap server or NULL on error.
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by main().

int sol_lwm2m_bootstrap_server_send_finish ( struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info client 
)

Signals the end of the Bootstrap Process.

Use this function to tell the LWM2M Client that this LWM2M Bootstrap Server has finished sending the available Bootstrap Information.

Parameters
serverThe LWM2M Bootstrap Server.
clientThe LWM2M Bootstrap Client info object.
Note
After this function returns, the sol_lwm2m_bootstrap_client_info handle will be invalid!
See Also
sol_lwm2m_bootstrap_server_new()
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by write_resource_cb().

int sol_lwm2m_bootstrap_server_write ( struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info client,
const char *  path,
struct sol_lwm2m_resource resources,
size_t  len,
void(*)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, enum sol_coap_response_code response_code)  sol_lwm2m_bootstrap_server_status_response_cb,
const void *  data 
)

Writes an object instance or resource through the Bootstrap Interface.

Parameters
serverThe LWM2M bootstrap server.
clientThe LWM2M bootstrap client info to write.
pathThe object path to be written (Example /2/1).
resourcesAn array of sol_lwm2m_resource
lenThe length of resources
sol_lwm2m_bootstrap_server_status_response_cbA callback to be called when the write operation is completed. - server The LW2M bootstrap server; client The LWM2M client; path The client's path; response_code The operation's response_code; data User data.
dataUser data to sol_lwm2m_bootstrap_server_status_response_cb
Returns
0 on success, -errno on error.
Note
All data is sent using TLV.
Only in Bootstrap Interface, the Write operation can be made using a TLV consisting of various Object Instances.
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by delete_all_cb(), write_sec_one_cb(), and write_servers_cb().

int sol_lwm2m_bootstrap_server_write_object ( struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info client,
const char *  path,
struct sol_lwm2m_resource **  instances,
size_t *  instances_len,
uint16_t *  instances_ids,
size_t  len,
void(*)(void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *client, const char *path, enum sol_coap_response_code response_code)  sol_lwm2m_bootstrap_server_status_response_cb,
const void *  data 
)

Writes a full object through the Bootstrap Interface.

Parameters
serverThe LWM2M bootstrap server.
clientThe LWM2M bootstrap client info to write.
pathThe object path to be written (Example /2).
instancesAn array of sol_lwm2m_resource arrays
instances_lenAn array with the length of each element from instances
instances_idsAn array with the desired instance_id of each element from instances
lenThe length of instances
sol_lwm2m_bootstrap_server_status_response_cbA callback to be called when the write operation is completed. - server The LW2M bootstrap server; client The LWM2M client; path The client's path; response_code The operation's response_code; data User data.
dataUser data to sol_lwm2m_bootstrap_server_status_response_cb
Returns
0 on success, -errno on error.
Note
All data is sent using TLV.
Only in Bootstrap Interface, the Write operation can be made using a TLV consisting of various Object Instances.
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by write_server_one_cb().