Commit a56b7104 authored by Milan Platisa's avatar Milan Platisa

Merge remote-tracking branch 'origin/development' into dev_pmtu

# Conflicts:
#	.gitignore
#	test/unit/unit_timer.c
parents 456b411f 6810dc8b
......@@ -24,3 +24,6 @@ cscope.out
*.gcno
*.expand
.hg
*.pcap
.ycm_extra_conf.py
.clang_complete
RTOS:
IPV4:
IPV4: ETH
IPV6:
DEVLOOP:
DEVLOOP:
CRC:
ETH: IPV4
ETH:
TCP: IPV4
UDP: IPV4
IPV4FRAG: IPV4
......@@ -21,5 +21,7 @@ SNTP_CLIENT: DNS_CLIENT
TFTP: UDP
MDNS: MCAST
DNS_SD: MDNS
AODV: IPV4
AODV: IPV4 UDP
PPP: IPV4
6LOWPAN: IPV6
IEEE802154: 6LOWPAN
......@@ -56,6 +56,8 @@ TUN?=0
TAP?=0
PCAP?=0
PPP?=1
6LOWPAN?=0
IEEE802154?=0
IPC?=0
CYASSL?=0
WOLFSSL?=0
......@@ -64,6 +66,26 @@ POLARSSL?=0
#IPv6 related
IPV6?=1
TEST?=0
ifeq ($(TEST),1)
6LOWPAN=1
IEEE802154=1
endif
UNITS?=0
ifeq ($(UNITS),1)
6LOWPAN=1
IEEE802154=1
ARCH=faulty
endif
UNITS_MM?=0
ifeq ($(UNITS_MM),1)
6LOWPAN=1
IEEE802154=1
MEMORY_MANAGER=1
endif
EXTRA_CFLAGS+=-DPICO_COMPILE_TIME=`date +%s`
EXTRA_CFLAGS+=$(PLATFORM_CFLAGS)
......@@ -292,6 +314,9 @@ endif
ifneq ($(PPP),0)
include rules/ppp.mk
endif
ifneq ($(6LOWPAN), 0)
include rules/6lowpan.mk
endif
ifneq ($(IPC),0)
include rules/ipc.mk
endif
......@@ -324,6 +349,10 @@ TEST6_ELF= test/picoapp6.elf
test: posix
@if [ $(TEST) -eq 0 ]; then \
echo "\n\nsmoke tests should be compiled with TEST=1 from now on!"; \
exit 1; \
fi
@mkdir -p $(PREFIX)/test/
@make -C test/examples PREFIX=$(PREFIX)
@echo -e "\t[CC] picoapp.o"
......@@ -366,6 +395,10 @@ loop: mod core
@$(CC) -c -o $(PREFIX)/loop_ping.o test/loop_ping.c $(CFLAGS) -ggdb
units: mod core lib $(UNITS_OBJ) $(MOD_OBJ)
@if [ $(UNITS) -eq 0 ]; then \
echo "\n\nunit tests should be compiled with UNITS=1 from now on!"; \
exit 1; \
fi
@echo -e "\n\t[UNIT TESTS SUITE]"
@mkdir -p $(PREFIX)/test
@echo -e "\t[CC] units.o"
......@@ -397,6 +430,8 @@ units: mod core lib $(UNITS_OBJ) $(MOD_OBJ)
@$(CC) -o $(PREFIX)/test/modunit_mld.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_mld.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_igmp.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_igmp.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_hotplug_detection.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_hotplug_detection.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_802154.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_802154.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_6lowpan.elf $(UNIT_CFLAGS) -I. -I test/examples test/unit/modunit_pico_6lowpan.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
@$(CC) -o $(PREFIX)/test/modunit_strings.elf $(UNIT_CFLAGS) -I. test/unit/modunit_pico_strings.c $(UNIT_LDFLAGS) $(UNITS_OBJ) $(PREFIX)/lib/libpicotcp.a
devunits: mod core lib
......@@ -409,6 +444,10 @@ devunits: mod core lib
@$(CC) -o $(PREFIX)/test/devunits $(CFLAGS) -I stack $(PREFIX)/test/unit/device/*.o -lcheck -lm -pthread -lrt
units_mm: mod core lib
@if [ $(UNITS_MM) -eq 0 ]; then \
echo "\n\nMM unit tests should be compiled with UNITS_MM=1 from now on!"; \
exit 1; \
fi
@echo -e "\n\t[UNIT TESTS SUITE]"
@mkdir -p $(PREFIX)/test
@echo -e "\t[CC] units_mm.o"
......
......@@ -2,15 +2,41 @@
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
*********************************************************************/
#define dbg(...) do {} while(0)
/******************/
/*** MACHINE CONFIGURATION ***/
/* Temporary (POSIX) stuff. */
#include <string.h>
#include <unistd.h>
/* Temporary debugging stuff. */
#include <stdarg.h>
#include "halUart.h"
#include <stdio.h>
static void print_uart(char *str)
{
int i, len;
len = (int)strlen(str);
for (i = 0; i < len; i++) {
HAL_UartWriteByte(str[i]);
if (HAL_UartTxFull())
HAL_UartFlush();
}
}
static inline void sam_dbg(const char *format, ...)
{
char msg[128] = { 0 };
va_list args;
va_start(args, format);
vsnprintf(msg, 256, format, args);
va_end(args);
print_uart(msg);
}
//#define dbg sam_dbg
#define dbg(...) do { } while(0)
extern volatile uint32_t sam_tick;
#define pico_zalloc(x) calloc(x, 1)
......
......@@ -7,6 +7,7 @@
#define INCLUDE_PICO_ADDRESSING
#include "pico_config.h"
#include "pico_constants.h"
PACKED_STRUCT_DEF pico_ip4
{
......@@ -24,6 +25,10 @@ union pico_address
struct pico_ip6 ip6;
};
/******************************************************************************
* Ethernet Address Definitions
******************************************************************************/
PACKED_STRUCT_DEF pico_eth
{
uint8_t addr[6];
......@@ -32,12 +37,82 @@ PACKED_STRUCT_DEF pico_eth
extern const uint8_t PICO_ETHADDR_ALL[];
/******************************************************************************
* Generic 6LoWPAN Address Definitions
******************************************************************************/
/* 6lowpan supports 16-bit short addresses */
PACKED_STRUCT_DEF pico_6lowpan_short
{
uint16_t addr;
};
/* And also EUI-64 addresses */
PACKED_STRUCT_DEF pico_6lowpan_ext
{
uint8_t addr[8];
};
/* Address memory as either a short 16-bit address or a 64-bit address */
union pico_6lowpan_u
{
uint8_t data[8];
struct pico_6lowpan_short _short;
struct pico_6lowpan_ext _ext;
};
/* Info data structure to pass to pico_device_init by the device driver */
struct pico_6lowpan_info
{
struct pico_6lowpan_short addr_short;
struct pico_6lowpan_ext addr_ext;
struct pico_6lowpan_short pan_id;
};
/* Different addressing modes for IEEE802.15.4 addresses */
#define AM_6LOWPAN_NONE (0u)
#define AM_6LOWPAN_RES (1u)
#define AM_6LOWPAN_SHORT (2u)
#define AM_6LOWPAN_EXT (3u)
#define SIZE_6LOWPAN_SHORT (2u)
#define SIZE_6LOWPAN_EXT (8u)
#define SIZE_6LOWPAN(m) (((m) == 2) ? (2) : (((m) == 3) ? (8) : (0)))
/******************************************************************************
* Generic 6LoWPAN Address Definitions
******************************************************************************/
/* Storage data structure for IEEE802.15.4 addresses */
struct pico_802154
{
union pico_6lowpan_u addr;
uint8_t mode;
};
/******************************************************************************
* Link Layer addresses
******************************************************************************/
#define IID_16(iid) (0 == (iid)[2] && 0xff == (iid)[3] && 0xfe == (iid)[4] && 0 == (iid)[5])
enum pico_ll_mode
{
LL_MODE_ETHERNET = 0,
#ifdef PICO_SUPPORT_802154
LL_MODE_IEEE802154,
#endif
};
union pico_ll_addr
{
struct pico_eth eth;
struct pico_802154 pan;
};
PACKED_STRUCT_DEF pico_trans
{
uint16_t sport;
uint16_t dport;
};
/* Here are some protocols. */
......
......@@ -19,6 +19,7 @@
# define PACKED_STRUCT_DEF __packed struct
# define PEDANTIC_STRUCT_DEF __packed struct
# define PACKED_UNION_DEF __packed union
# define PACKED __packed
# define WEAK
#elif defined __WATCOMC__
# define PACKED_STRUCT_DEF _Packed struct
......@@ -29,6 +30,7 @@
# define PACKED_STRUCT_DEF struct __attribute__((packed))
# define PEDANTIC_STRUCT_DEF struct
# define PACKED_UNION_DEF union /* Sane compilers do not require packed unions */
# define PACKED __attribute__((packed))
# define WEAK __attribute__((weak))
# ifdef __GNUC__
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
......@@ -169,7 +171,6 @@ static inline uint32_t be_to_host_long(uint32_t be)
}
#endif
/* Mockables */
#if defined UNIT_TEST
# define MOCKABLE __attribute__((weak))
......
......@@ -12,6 +12,8 @@
#define PICO_SIZE_IP6 16
#define PICO_SIZE_ETH 6
#define PICO_SIZE_TRANS 8
#define PICO_SIZE_IEEE802154_EXT (8u)
#define PICO_SIZE_IEEE802154_SHORT (2u)
/** Endian-dependant constants **/
typedef uint64_t pico_time;
......@@ -33,6 +35,8 @@ extern volatile uint64_t pico_tick;
#define PICO_IP4_ANY (0x00000000U)
#define PICO_IP4_BCAST (0xffffffffU)
#define PICO_IEEE802154_BCAST (0xffffu)
/* defined in modules/pico_ipv6.c */
#ifdef PICO_SUPPORT_IPV6
extern const uint8_t PICO_IPV6_ANY[PICO_SIZE_IP6];
......
......@@ -24,6 +24,7 @@ struct pico_device {
uint32_t overhead;
uint32_t mtu;
struct pico_ethdev *eth; /* Null if non-ethernet */
enum pico_ll_mode mode;
struct pico_queue *q_in;
struct pico_queue *q_out;
int (*link_state)(struct pico_device *self);
......
......@@ -12,6 +12,8 @@
#define PICO_FRAME_FLAG_EXT_BUFFER (0x02)
#define PICO_FRAME_FLAG_EXT_USAGE_COUNTER (0x04)
#define PICO_FRAME_FLAG_SACKED (0x80)
#define PICO_FRAME_FLAG_LL_SEC (0x40)
#define PICO_FRAME_FLAG_SLP_FRAG (0x20)
#define IS_BCAST(f) ((f->flags & PICO_FRAME_FLAG_BCAST) == PICO_FRAME_FLAG_BCAST)
......@@ -69,6 +71,12 @@ struct pico_frame {
uint16_t frag;
#endif
#if defined(PICO_SUPPORT_6LOWPAN)
uint32_t hash;
union pico_ll_addr src;
union pico_ll_addr dst;
#endif
/* Pointer to socket */
struct pico_socket *sock;
......
......@@ -58,6 +58,7 @@ int32_t pico_stack_recv(struct pico_device *dev, uint8_t *buffer, uint32_t len);
int32_t pico_stack_recv_zerocopy(struct pico_device *dev, uint8_t *buffer, uint32_t len);
int32_t pico_stack_recv_zerocopy_ext_buffer(struct pico_device *dev, uint8_t *buffer, uint32_t len);
int32_t pico_stack_recv_zerocopy_ext_buffer_notify(struct pico_device *dev, uint8_t *buffer, uint32_t len, void (*notify_free)(uint8_t *buffer));
struct pico_frame *pico_stack_recv_new_frame(struct pico_device *dev, uint8_t *buffer, uint32_t len);
/* ----- Initialization ----- */
int pico_stack_init(void);
......
This diff is collapsed.
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights
reserved. See LICENSE and COPYING for usage.
Authors: Jelle De Vleeschouwer
*********************************************************************/
#ifndef INCLUDE_PICO_6LOWPAN
#define INCLUDE_PICO_6LOWPAN
#include "pico_protocol.h"
#include "pico_device.h"
#include "pico_config.h"
#include "pico_frame.h"
#define PICO_6LP_FLAG_LOWPAN (0x01)
#define PICO_6LP_FLAG_NOMAC (0x02)
#ifdef PICO_SUPPORT_6LOWPAN
#define PICO_DEV_IS_6LOWPAN(dev) ((dev) && ((dev)->hostvars.lowpan_flags & PICO_6LP_FLAG_LOWPAN))
#define PICO_DEV_IS_NOMAC(dev) ((dev) && ((dev)->hostvars.lowpan_flags & PICO_6LP_FLAG_NOMAC))
#else
#define PICO_DEV_IS_6LOWPAN(dev) (0)
#define PICO_DEV_IS_NOMAC(dev) (0)
#endif
/******************************************************************************
* Public variables
******************************************************************************/
extern struct pico_protocol pico_proto_6lowpan;
/******************************************************************************
* Public functions
******************************************************************************/
int32_t pico_6lowpan_pull(struct pico_frame *f);
int pico_6lowpan_init(void);
#endif /* INCLUDE_PICO_6LOWPAN */
This diff is collapsed.
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights
reserved. See LICENSE and COPYING for usage.
Authors: Jelle De Vleeschouwer
*********************************************************************/
#ifndef INCLUDE_PICO_6LOWPAN_LL
#define INCLUDE_PICO_6LOWPAN_LL
#include "pico_addressing.h"
#include "pico_protocol.h"
#include "pico_6lowpan.h"
#include "pico_device.h"
#include "pico_config.h"
#include "pico_frame.h"
#include "pico_ipv6.h"
/* Possible actions to perform on a received frame */
#define FRAME_6LOWPAN_LL_RELEASE (-1)
#define FRAME_6LOWPAN_LL_DISCARD (-2)
/*******************************************************************************
* CTX
******************************************************************************/
#ifdef PICO_6LOWPAN_IPHC_ENABLED
#define PICO_IPHC_CTX_COMPRESS (0x01u)
struct iphc_ctx
{
struct pico_ip6 prefix;
uint8_t id;
uint8_t size;
pico_time lifetime;
uint8_t flags;
struct pico_device *dev;
};
struct iphc_ctx * ctx_lookup(struct pico_ip6 addr);
struct iphc_ctx * ctx_lookup_id(uint8_t id);
void ctx_update(struct pico_ip6 addr, uint8_t id, uint8_t size, pico_time lifetime, uint8_t flags, struct pico_device *dev);
#endif
/******************************************************************************
* Interface with link layer
******************************************************************************/
struct pico_dev_6lowpan
{
struct pico_device dev;
int (* send)(struct pico_device *dev, void *_buf, int len, union pico_ll_addr src, union pico_ll_addr dst);
};
struct pico_6lowpan_ll_protocol
{
int32_t (* process_in)(struct pico_frame *f);
int32_t (* process_out)(struct pico_frame *f);
int32_t (* estimate)(struct pico_frame *f);
int32_t (* addr_from_buf)(union pico_ll_addr *addr, uint8_t *buf);
int32_t (* addr_from_net)(union pico_ll_addr *addr, struct pico_frame *f, int32_t dest);
int32_t (* addr_len)(union pico_ll_addr *addr);
int32_t (* addr_cmp)(union pico_ll_addr *a, union pico_ll_addr *b);
int32_t (* addr_iid)(uint8_t *iid, union pico_ll_addr *addr);
struct pico_frame * (*alloc)(struct pico_device *dev, uint16_t size);
};
/******************************************************************************
* Public variables
******************************************************************************/
extern struct pico_6lowpan_ll_protocol pico_6lowpan_lls[];
extern struct pico_protocol pico_proto_6lowpan_ll;
/******************************************************************************
* Public functions
******************************************************************************/
void pico_6lowpan_ll_init(void);
int32_t pico_6lowpan_ll_push(struct pico_frame *f);
int32_t pico_6lowpan_ll_pull(struct pico_frame *f);
int32_t frame_6lowpan_ll_store_addr(struct pico_frame *f);
int32_t pico_6lowpan_ll_sendto_dev(struct pico_device *dev, struct pico_frame *f);
int32_t pico_6lowpan_stack_recv(struct pico_device *dev, uint8_t *buffer, uint32_t len, union pico_ll_addr *src, union pico_ll_addr *dst);
#endif /* INCLUDE_PICO_6LOWPAN_LL */
This diff is collapsed.
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights
reserved. See LICENSE and COPYING for usage.
Authors: Jelle De Vleeschouwer
*********************************************************************/
#ifndef INCLUDE_PICO_802154
#define INCLUDE_PICO_802154
#include "pico_device.h"
#include "pico_config.h"
#include "pico_6lowpan_ll.h"
/*******************************************************************************
* Size definitions
******************************************************************************/
#define MTU_802154_PHY (128u)
#define MTU_802154_MAC (125u) // 127 - Frame Check Sequence
#define SIZE_802154_MHR_MIN (5u)
#define SIZE_802154_MHR_MAX (23u)
#define SIZE_802154_FCS (2u)
#define SIZE_802154_LEN (1u)
#define SIZE_802154_PAN (2u)
/*******************************************************************************
* Structure definitions
******************************************************************************/
PACKED_STRUCT_DEF pico_802154_hdr
{
uint16_t fcf;
uint8_t seq;
uint16_t pan_id;
};
extern const struct pico_6lowpan_ll_protocol pico_6lowpan_ll_802154;
#endif /* INCLUDE_PICO_802154 */
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
Authors: Jelle De Vleeschouwer
*********************************************************************/
/*
* For testing purposes. pico_dev_radio_manager allows simulating a mesh
* network for smoke tests. I previously used geomess, but that's another
* dependency to add then. Then @danielinux wrote the pico_dev_radiotest but
* that required adding a multicast route on the host which in its turn
* required 'sudo'. So I wrote a small simulator which doesn't require sudo.
* - Jelle
*/
#include "pico_dev_radiotest.h"
#include "pico_addressing.h"
#include "pico_dev_tap.h"
#include "pico_802154.h"
#include "pico_device.h"
#include "pico_config.h"
#include "pico_stack.h"
#include "pico_dev_radio_mgr.h"
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <string.h>
#include <stdio.h>
#ifdef DEBUG_RADIOTEST
#define RADIO_DBG dbg
#else
#define RADIO_DBG(...) do { } while (0)
#endif
#define LISTENING_PORT 7777
#define MESSAGE_MTU 150
#define EVER (;;)
struct socket {
int s;
uint8_t mgr;
uint8_t id;
uint8_t area0;
uint8_t area1;
};
/* Compare two application sockets */
static int
pico_radio_mgr_sock_cmp(void *a, void *b)
{
struct socket *sa = a, *sb = b;
return (int)(sa->id - sb->id);
}
PICO_TREE_DECLARE(Sockets, pico_radio_mgr_sock_cmp);
/* Insert a new socket in the tree */
static int
pico_radio_mgr_socket_insert(int socket, uint8_t id, uint8_t area0, uint8_t area1, uint8_t mgr)
{
struct socket *s = PICO_ZALLOC(sizeof(struct socket));
if (s) {
s->area0 = area0;
s->area1 = area1;
s->s = socket;
s->mgr = mgr;
s->id = id;
if (!pico_tree_insert(&Sockets, s))
return 0;
PICO_FREE(s);
}
return -1;
}
/* Gather an array of poll descriptors with all sockets */
static struct pollfd *
pico_radio_mgr_socket_all(int *n)
{
struct pico_tree_node *i = NULL;
struct socket *key = NULL;
struct pollfd *fds = NULL;
int j = 1;
*n = 0;
/* Retrieve all sockets */
pico_tree_foreach(i, &Sockets) {
(*n)++;
}
/* Create array from tree */
fds = PICO_ZALLOC(sizeof(struct pollfd) * (size_t)*n);
if (fds) {
/* Put every socket in array */
pico_tree_foreach(i, &Sockets) {
if (i && (key = i->keyValue)) {
if (!key->id) {
fds[0].fd = key->s;
fds[0].events = POLLIN;
} else {
fds[j].fd = key->s;
fds[j].events = POLLIN;
j++;
}
}
}
}
return fds;
}
/* Get connection socket that belongs to a particular node */
static struct socket *
pico_radio_mgr_socket_node(uint8_t id)
{
struct socket test = { 0, 0, id };
return pico_tree_findKey(&Sockets, &test);
}
/* Handle POLLHUP event */
static int
pico_radio_mgr_socket_hup(int socket)
{
struct pico_tree_node *i = NULL;
struct socket *key = NULL;
pico_tree_foreach(i, &Sockets) {
key = i->keyValue;
if (key && key->s == socket) {
pico_tree_delete(&Sockets, key);
RADIO_DBG("Radio %d detached from network\n", key->id);
PICO_FREE(key);
close(socket);
return 0;
}
}
return -1;
}
/* Receive's an 'Hello'-message from the node that contains the id, the inserts
* an entry in the Sockets-tree */
static int
pico_radio_mgr_welcome(int socket)
{
int ret_len = sizeof(uint8_t);
uint8_t id = 0, area0, area1;
ret_len = (int)recv(socket, &id, (size_t)ret_len, 0);
if (ret_len != 1) return -1;
ret_len = (int)recv(socket, &area0, (size_t)ret_len, 0);
if (ret_len != 1) return -1;
ret_len = (int)recv(socket, &area1, (size_t)ret_len, 0);
if (ret_len != 1) return -1;
if (!id) { // Node's can't have ID '0'.
close(socket);
return -1;
}
dbg("Connected to node %u in area %u and %u on socket %d.\n", id, area0, area1, socket);
if (pico_radio_mgr_socket_insert(socket, id, area0, area1, 0)) {
close(socket);
return -1;
}
return 0;
}
/* Accepts a new TCP connection request */
static int
pico_radio_mgr_accept(int socket)
{
unsigned int len = sizeof(struct sockaddr_in);
struct sockaddr_in addr;
int s = accept(socket, (struct sockaddr *)&addr, &len);
if (s < 0) {
RADIO_DBG("Failed accepting connection\n");
return s;
} else if (!s) {
return s;
}
return pico_radio_mgr_welcome(s);
}
/* Start listening for TCP connection requests on 'LISTENING_PORT' */
static int
pico_radio_mgr_listen(void)
{
struct sockaddr_in addr;
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
int ret = 0;
memset(&addr, 0, sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_port = htons(LISTENING_PORT);
addr.sin_addr.s_addr = INADDR_ANY;
ret = bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
if (ret < 0) {
RADIO_DBG("Failed binding socket to address: %s\n", strerror(ret));
return -1;
}
ret = listen(s, 5);
if (ret < 0) {
RADIO_DBG("Failed start listening\n");
return -1;
}
/* Also insert server socket in tree for polling */
if (pico_radio_mgr_socket_insert(s, 0, 0, 0, 1)) {
close(s);
return -1;