Hi! First of all: thanks for everyone for your help so far. I’m using RIOT in an RPL network and I’m trying to send UDP packets with a custom application level data. I developed a solution which is similar to the udp packet handling in the gnrc_networking example. In the networking example the payload is the following: payload = gnrc_pktbuf_add(NULL, data, strlen(data), GNRC_NETTYPE_UNDEF); I registered my thread to gnrc with the following lines:
server.pid = rfnode_udpthread_init(); server.demux_ctx = (uint32_t)port; gnrc_netreg_register(GNRC_NETTYPE_UDP, &server); printf(“Success: started UDP server on port %d\n”,(int) port); When my eventloop catches a GNRC_NETAPI_MSG_TYPE_RCV then it calls my function when I get the data out of the msg. In the message handler I filter for: snip->type == GNRC_NETTYPE_UNDEF
It works right if I open a direct connection, but if I set up an RPL netowork with multiple nodes, then if I send any packet to a destination ( by the IP in the fibroute cmd ) then it catches so many snippets ( possibly for RPL? ), so its not usable. I did some debugging, and the snippets seems to be all right (UNDEF->UDP->IPV6->NETAPI in the snippet).
I added my own GNRC type into gnrc_nettype_t in nettype.h called GNRC_NETTYPE_RFPKT, so I could filter it: payload = gnrc_pktbuf_add(NULL, data, strlen(data), GNRC_NETTYPE_RFPKT); I also filter for this type in my msg handler: snip->type == GNRC_NETTYPE_RFPKT and it doesn’t catch any, and the snippets which I get also seem to be wrong, and I don’t see my type in the snippets anywhere.
I think that I’m using the networking stack in wrong way, what am I missing? Viktor