pkg/wakaama: remove gnrc dependency
This commit is contained in:
parent
2765e5463d
commit
c8dbdd2685
@ -169,8 +169,11 @@ static void *_lwm2m_client_run(void *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Waiting for UDP packet on port: %d\n", _client_data->sock.local.port);
|
sock_udp_ep_t local;
|
||||||
rcv_len = sock_udp_recv(&_client_data->sock, &rcv_buf, sizeof(rcv_buf),
|
int res = sock_udp_get_local(&_client_data->sock, &local);
|
||||||
|
assert(res >= 0);
|
||||||
|
DEBUG("Waiting for UDP packet on port: %d\n", local.port);
|
||||||
|
rcv_len = sock_udp_recv(&_client_data->sock, rcv_buf, sizeof(rcv_buf),
|
||||||
tv * US_PER_SEC, &remote);
|
tv * US_PER_SEC, &remote);
|
||||||
DEBUG("sock_udp_recv()\n");
|
DEBUG("sock_udp_recv()\n");
|
||||||
if (rcv_len > 0) {
|
if (rcv_len > 0) {
|
||||||
|
|||||||
@ -124,14 +124,6 @@ static void _parse_host_and_port(char **host, char **port, char *default_port);
|
|||||||
*/
|
*/
|
||||||
static netif_t *_get_interface(char *host);
|
static netif_t *_get_interface(char *host);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets a given interface to a given UDP endpoint
|
|
||||||
*
|
|
||||||
* @param[out] ep UDP endpoint
|
|
||||||
* @param[in] netif Network interface to assign
|
|
||||||
*/
|
|
||||||
static void _set_interface(sock_udp_ep_t *ep, const netif_t *netif);
|
|
||||||
|
|
||||||
void *lwm2m_connect_server(uint16_t sec_obj_inst_id, void *user_data)
|
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_client_data_t *client_data = (lwm2m_client_data_t *)user_data;
|
||||||
@ -313,20 +305,6 @@ static void _parse_host_and_port(char **host, char **port, char *default_port)
|
|||||||
*port = _port;
|
*port = _port;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _set_interface(sock_udp_ep_t *ep, const netif_t *netif)
|
|
||||||
{
|
|
||||||
if (netif == NULL || ep == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* currently there is no way to assign a network interface to a sock
|
|
||||||
* endpoint by means of a generic API, so we need to check */
|
|
||||||
if (IS_USED(MODULE_GNRC_NETIF)) {
|
|
||||||
const gnrc_netif_t *gnrc_netif = (gnrc_netif_t *)netif;
|
|
||||||
ep->netif = (uint16_t)gnrc_netif->pid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static netif_t *_get_interface(char *host)
|
static netif_t *_get_interface(char *host)
|
||||||
{
|
{
|
||||||
netif_t *netif = NULL;
|
netif_t *netif = NULL;
|
||||||
@ -411,7 +389,11 @@ static lwm2m_client_connection_t *_connection_create(int instance_id,
|
|||||||
goto free_out;
|
goto free_out;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_set_interface(&conn->remote, netif);
|
int16_t netif_id = netif_get_id(netif);
|
||||||
|
if (netif_id < 0) {
|
||||||
|
goto free_out;
|
||||||
|
}
|
||||||
|
conn->remote.netif = netif_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user