1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/wakaama/contrib: remove unneeded reference to security object

This commit is contained in:
Leandro Lanzieri 2021-02-05 17:44:22 +01:00
parent fcd582eff2
commit bfc81ae967
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
3 changed files with 23 additions and 7 deletions

View File

@ -127,12 +127,19 @@ static netif_t *_get_interface(char *host);
void *lwm2m_connect_server(uint16_t sec_obj_inst_id, void *user_data)
{
lwm2m_client_data_t *client_data = (lwm2m_client_data_t *)user_data;
lwm2m_list_t *instance;
lwm2m_client_connection_t *new_conn = NULL;
/* get the security object list */
lwm2m_object_t *security_objects = (lwm2m_object_t *)LWM2M_LIST_FIND(
client_data->lwm2m_ctx->objectList,
LWM2M_SECURITY_OBJECT_ID);
if (!security_objects) {
DEBUG("[lwm2m_connect_server] Could not find sec object\n");
return NULL;
}
/* get the security object instance */
instance = LWM2M_LIST_FIND(client_data->obj_security->instanceList,
sec_obj_inst_id);
lwm2m_list_t *instance = LWM2M_LIST_FIND(security_objects, sec_obj_inst_id);
if (instance == NULL) {
DEBUG("[lwm2m_connect_server] Could not find sec object instance\n");
return NULL;
@ -343,8 +350,18 @@ static lwm2m_client_connection_t *_connection_create(int instance_id,
memset(uri_buf, 0, sizeof(uri_buf));
DEBUG("Creating connection\n");
/* get the server URI from the requested instance */
uri = _get_uri_from_security_obj(client_data->obj_security, instance_id,
/* get the list of security objects */
lwm2m_object_t *security_objects = (lwm2m_object_t *)LWM2M_LIST_FIND(
client_data->lwm2m_ctx->objectList,
LWM2M_SECURITY_OBJECT_ID);
if (!security_objects) {
DEBUG("[_connection_create] Could not find any security object\n");
return NULL;
}
/* get the URI from the security object instance */
uri = _get_uri_from_security_obj(security_objects, instance_id,
uri_buf, sizeof(uri_buf) - 1);
host = _parse_schema(uri, &default_port, instance_id);

View File

@ -37,6 +37,7 @@ lwm2m_object_t *lwm2m_get_object_device(void);
lwm2m_object_t *lwm2m_client_get_security_object(
lwm2m_client_data_t *client_data)
{
(void)client_data;
lwm2m_object_t *ret;
char *server_uri = CONFIG_LWM2M_SERVER_URI;
int server_id = CONFIG_LWM2M_SERVER_ID;
@ -47,7 +48,6 @@ lwm2m_object_t *lwm2m_client_get_security_object(
ret = get_security_object(server_id, server_uri, psk_id, psk_buffer,
psk_len, IS_ACTIVE(CONFIG_LWM2M_BOOTSTRAP));
client_data->obj_security = ret;
return ret;
}

View File

@ -56,7 +56,6 @@ typedef struct {
sock_udp_t sock; /**< UDP server sock */
sock_udp_ep_t local_ep; /**< Local endpoint */
lwm2m_context_t *lwm2m_ctx; /**< LwM2M context */
lwm2m_object_t *obj_security; /**< LwM2M security object */
lwm2m_client_connection_t *conn_list; /**< LwM2M connections list */
} lwm2m_client_data_t;