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
Macros | Functions | Variables
lwm2m-bs-server.c File Reference
#include "sol-lwm2m-bs-server.h"
#include "sol-mainloop.h"
#include "sol-vector.h"
#include "sol-util.h"
#include <stdio.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>

Macros

#define ACCESS_CONTROL_OBJ_ACL_RES_ID   (2)
 
#define ACCESS_CONTROL_OBJ_ID   (2)
 
#define ACCESS_CONTROL_OBJ_INSTANCE_RES_ID   (1)
 
#define ACCESS_CONTROL_OBJ_OBJECT_RES_ID   (0)
 
#define ACCESS_CONTROL_OBJ_OWNER_RES_ID   (3)
 
#define BS_SERVER_PRIVATE_KEY   ("9b7dfec20e49fe2cacf23fb21d06a8dc496530c695ec24cdf6c002ce44afa5fb")
 
#define BS_SERVER_PUBLIC_KEY
 
#define CLIENT_BS_PSK_ID   ("cli1-bs")
 
#define CLIENT_BS_PSK_KEY   ("FEDCBA9876543210")
 
#define CLIENT_PUBLIC_KEY
 
#define CLIENT_SERVER_PSK_ID   ("cli1")
 
#define CLIENT_SERVER_PSK_KEY   ("0123456789ABCDEF")
 
#define LIFETIME   (60)
 
#define PSK_KEY_LEN   16
 
#define RPK_PRIVATE_KEY_LEN   32
 
#define RPK_PUBLIC_KEY_LEN   (2 * RPK_PRIVATE_KEY_LEN)
 
#define SECURITY_BOOTSTRAP_SERVER_ACCOUNT_TIMEOUT_RES_ID   (12)
 
#define SECURITY_CLIENT_HOLD_OFF_TIME_RES_ID   (11)
 
#define SECURITY_IS_BOOTSTRAP_RES_ID   (1)
 
#define SECURITY_OBJ_ID   (0)
 
#define SECURITY_PUBLIC_KEY_OR_IDENTITY_RES_ID   (3)
 
#define SECURITY_SECRET_KEY_RES_ID   (5)
 
#define SECURITY_SECURITY_MODE_RES_ID   (2)
 
#define SECURITY_SERVER_ID_RES_ID   (10)
 
#define SECURITY_SERVER_PUBLIC_KEY_RES_ID   (4)
 
#define SECURITY_SERVER_URI_RES_ID   (0)
 
#define SERVER_OBJ_BINDING_RES_ID   (7)
 
#define SERVER_OBJ_ID   (1)
 
#define SERVER_OBJ_LIFETIME_RES_ID   (1)
 
#define SERVER_OBJ_REGISTRATION_UPDATE_RES_ID   (8)
 
#define SERVER_OBJ_SHORT_RES_ID   (0)
 

Functions

static void bootstrap_cb (void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo)
 
static void delete_all_cb (void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo, const char *path, enum sol_coap_response_code response_code)
 
int main (int argc, char *argv[])
 
static void write_resource_cb (void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo, const char *path, enum sol_coap_response_code response_code)
 
static void write_sec_one_cb (void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo, const char *path, enum sol_coap_response_code response_code)
 
static void write_server_one_cb (void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo, const char *path, enum sol_coap_response_code response_code)
 
static void write_servers_cb (void *data, struct sol_lwm2m_bootstrap_server *server, struct sol_lwm2m_bootstrap_client_info *bs_cinfo, const char *path, enum sol_coap_response_code response_code)
 

Variables

static struct sol_blob binding
 
const char * known_clients [] = { "cli1", "cli2", NULL }
 
static struct sol_blob psk_id_0
 
static struct sol_blob psk_key_0
 
static struct sol_blob server_one_addr
 

Macro Definition Documentation

#define ACCESS_CONTROL_OBJ_ACL_RES_ID   (2)
#define ACCESS_CONTROL_OBJ_ID   (2)
#define ACCESS_CONTROL_OBJ_INSTANCE_RES_ID   (1)
#define ACCESS_CONTROL_OBJ_OBJECT_RES_ID   (0)
#define ACCESS_CONTROL_OBJ_OWNER_RES_ID   (3)
#define BS_SERVER_PRIVATE_KEY   ("9b7dfec20e49fe2cacf23fb21d06a8dc496530c695ec24cdf6c002ce44afa5fb")
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by main().

#define BS_SERVER_PUBLIC_KEY
Value:
("cd4110e97bbd6e7e5a800028079d02915c70b915ea4596402098deea585eb7ad" \
"f3e080487327f70758b13bc0583f4293d13288a0164a8e324779aa4f7ada26c1")
Examples:
/src/samples/coap/lwm2m-bs-server.c, and /src/samples/coap/lwm2m-client.c.

Referenced by main().

#define CLIENT_BS_PSK_ID   ("cli1-bs")
#define CLIENT_BS_PSK_KEY   ("FEDCBA9876543210")
#define CLIENT_PUBLIC_KEY
Value:
("D055EE14084D6E0615599DB583913E4A3E4526A2704D61F27A4CCFBA9758EF9A" \
"B418B64AFE8030DA1DDCF4F42E2F2631D043B1FB03E22F4D17DE43F9F9ADEE70")
Examples:
/src/samples/coap/lwm2m-bs-server.c, /src/samples/coap/lwm2m-client.c, and /src/samples/coap/lwm2m-server.c.

Referenced by main().

#define CLIENT_SERVER_PSK_ID   ("cli1")
#define CLIENT_SERVER_PSK_KEY   ("0123456789ABCDEF")
#define LIFETIME   (60)
#define PSK_KEY_LEN   16
#define RPK_PRIVATE_KEY_LEN   32
#define RPK_PUBLIC_KEY_LEN   (2 * RPK_PRIVATE_KEY_LEN)
#define SECURITY_BOOTSTRAP_SERVER_ACCOUNT_TIMEOUT_RES_ID   (12)
#define SECURITY_CLIENT_HOLD_OFF_TIME_RES_ID   (11)
#define SECURITY_IS_BOOTSTRAP_RES_ID   (1)
#define SECURITY_OBJ_ID   (0)
#define SECURITY_PUBLIC_KEY_OR_IDENTITY_RES_ID   (3)
#define SECURITY_SECRET_KEY_RES_ID   (5)
#define SECURITY_SECURITY_MODE_RES_ID   (2)
#define SECURITY_SERVER_ID_RES_ID   (10)
#define SECURITY_SERVER_PUBLIC_KEY_RES_ID   (4)
#define SECURITY_SERVER_URI_RES_ID   (0)
#define SERVER_OBJ_BINDING_RES_ID   (7)
#define SERVER_OBJ_ID   (1)
#define SERVER_OBJ_LIFETIME_RES_ID   (1)
#define SERVER_OBJ_REGISTRATION_UPDATE_RES_ID   (8)
#define SERVER_OBJ_SHORT_RES_ID   (0)

Function Documentation

static void bootstrap_cb ( void *  data,
struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info bs_cinfo 
)
static
static void delete_all_cb ( void *  data,
struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info bs_cinfo,
const char *  path,
enum sol_coap_response_code  response_code 
)
static
int main ( int  argc,
char *  argv[] 
)
static void write_resource_cb ( void *  data,
struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info bs_cinfo,
const char *  path,
enum sol_coap_response_code  response_code 
)
static
static void write_sec_one_cb ( void *  data,
struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info bs_cinfo,
const char *  path,
enum sol_coap_response_code  response_code 
)
static
static void write_server_one_cb ( void *  data,
struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info bs_cinfo,
const char *  path,
enum sol_coap_response_code  response_code 
)
static
static void write_servers_cb ( void *  data,
struct sol_lwm2m_bootstrap_server server,
struct sol_lwm2m_bootstrap_client_info bs_cinfo,
const char *  path,
enum sol_coap_response_code  response_code 
)
static

Variable Documentation

struct sol_blob binding
static
Initial value:
= {
.parent = NULL,
.mem = (void *)"U",
.size = sizeof("U") - 1,
.refcnt = 1
}
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE
Blob type object for the nofree implementation.
Examples:
/src/samples/coap/lwm2m-bs-server.c, and /src/samples/coap/lwm2m-client.c.
const char* known_clients[] = { "cli1", "cli2", NULL }
Examples:
/src/samples/coap/lwm2m-bs-server.c.

Referenced by main().

struct sol_blob psk_id_0
static
Initial value:
= {
.parent = NULL,
.mem = (void *)CLIENT_SERVER_PSK_ID,
.size = sizeof(CLIENT_SERVER_PSK_ID) - 1,
.refcnt = 1
}
#define CLIENT_SERVER_PSK_ID
Definition: lwm2m-bs-server.c:68
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE
Blob type object for the nofree implementation.
Examples:
/src/samples/coap/lwm2m-bs-server.c.
struct sol_blob psk_key_0
static
Initial value:
= {
.parent = NULL,
.mem = (void *)CLIENT_SERVER_PSK_KEY,
.size = sizeof(CLIENT_SERVER_PSK_KEY) - 1,
.refcnt = 1
}
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE
Blob type object for the nofree implementation.
#define CLIENT_SERVER_PSK_KEY
Definition: lwm2m-bs-server.c:69
Examples:
/src/samples/coap/lwm2m-bs-server.c.
struct sol_blob server_one_addr
static
Initial value:
= {
.parent = NULL,
.mem = (void *)"coaps://localhost:5684",
.size = sizeof("coaps://localhost:5684") - 1,
.refcnt = 1
}
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE
Blob type object for the nofree implementation.
Examples:
/src/samples/coap/lwm2m-bs-server.c.