1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 23:41:18 +01:00

ng_slip: port to ng_netapi_dispatch_receive()

This commit is contained in:
Martine Lenders 2015-07-16 22:15:40 +02:00 committed by Martine Lenders
parent b66ada2ae7
commit 8609678bcd

View File

@ -110,7 +110,6 @@ int _slip_tx_cb(void *arg)
static void _slip_receive(gnrc_slip_dev_t *dev, size_t bytes)
{
gnrc_netif_hdr_t *hdr;
gnrc_netreg_entry_t *sendto;
gnrc_pktsnip_t *pkt, *netif_hdr;
pkt = gnrc_pktbuf_add(NULL, NULL, bytes, GNRC_NETTYPE_UNDEF);
@ -151,21 +150,10 @@ static void _slip_receive(gnrc_slip_dev_t *dev, size_t bytes)
}
#endif
sendto = gnrc_netreg_lookup(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL);
if (sendto == NULL) {
if (gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt) == 0) {
DEBUG("slip: unable to forward packet of type %i\n", pkt->type);
gnrc_pktbuf_release(pkt);
}
gnrc_pktbuf_hold(pkt, gnrc_netreg_num(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL) - 1);
while (sendto != NULL) {
DEBUG("slip: sending pkt %p to PID %" PRIkernel_pid "\n", (void *)pkt,
sendto->pid);
gnrc_netapi_receive(sendto->pid, pkt);
sendto = gnrc_netreg_getnext(sendto);
}
}
static inline void _slip_send_char(gnrc_slip_dev_t *dev, char c)