treewide: use new gnrc_pkt API functions instead of utlist.h macros

This commit is contained in:
Martine Lenders 2020-10-12 15:51:30 +02:00
parent d491e827fb
commit 45144fb4a4
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
33 changed files with 59 additions and 74 deletions

View File

@ -178,10 +178,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
gnrc_pktbuf_remove_snip(pkt, mac_hdr); gnrc_pktbuf_remove_snip(pkt, mac_hdr);
gnrc_pktbuf_remove_snip(pkt, esp_hdr); gnrc_pktbuf_remove_snip(pkt, esp_hdr);
LL_APPEND(pkt, netif_hdr); return gnrc_pkt_append(pkt, netif_hdr);
return pkt;
err: err:
gnrc_pktbuf_release(pkt); gnrc_pktbuf_release(pkt);
return NULL; return NULL;

View File

@ -168,9 +168,7 @@ static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netif_t *dev)
/* finally: remove the nrfmin header and append the netif header */ /* finally: remove the nrfmin header and append the netif header */
gnrc_pktbuf_remove_snip(pkt_snip, hdr_snip); gnrc_pktbuf_remove_snip(pkt_snip, hdr_snip);
LL_APPEND(pkt_snip, netif_snip); return gnrc_pkt_append(pkt_snip, netif_snip);
return pkt_snip;
} }
static const gnrc_netif_ops_t gnrc_nrfmin_ops = { static const gnrc_netif_ops_t gnrc_nrfmin_ops = {

View File

@ -96,7 +96,7 @@ static gnrc_pktsnip_t *cc1xxx_adpt_recv(gnrc_netif_t *netif)
DEBUG("[cc1xxx-gnrc] recv: successfully parsed packet\n"); DEBUG("[cc1xxx-gnrc] recv: successfully parsed packet\n");
/* and append the netif header */ /* and append the netif header */
LL_APPEND(payload, hdr); payload = gnrc_pkt_append(payload, hdr);
#ifdef MODULE_NETSTATS_L2 #ifdef MODULE_NETSTATS_L2
netif->stats.rx_count++; netif->stats.rx_count++;

View File

@ -95,9 +95,7 @@ static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netif_t *netif)
DEBUG("[xbee-gnrc] recv: successfully parsed packet\n"); DEBUG("[xbee-gnrc] recv: successfully parsed packet\n");
/* and append the netif header */ /* and append the netif header */
LL_APPEND(payload, netif_snip); return gnrc_pkt_append(payload, netif_snip);
return payload;
} }
static int xbee_adpt_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) static int xbee_adpt_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)

View File

@ -94,7 +94,7 @@ static void send(char *addr_str, char *port_str, char *data, unsigned int num,
gnrc_pktsnip_t *netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); gnrc_pktsnip_t *netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
gnrc_netif_hdr_set_netif(netif_hdr->data, netif); gnrc_netif_hdr_set_netif(netif_hdr->data, netif);
LL_PREPEND(ip, netif_hdr); ip = gnrc_pkt_prepend(ip, netif_hdr);
} }
/* send packet */ /* send packet */
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) { if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) {

View File

@ -94,7 +94,7 @@ static void send(char *addr_str, char *port_str, char *data, unsigned int num,
gnrc_pktsnip_t *netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); gnrc_pktsnip_t *netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
gnrc_netif_hdr_set_netif(netif_hdr->data, netif); gnrc_netif_hdr_set_netif(netif_hdr->data, netif);
LL_PREPEND(ip, netif_hdr); ip = gnrc_pkt_prepend(ip, netif_hdr);
} }
/* send packet */ /* send packet */
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) { if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) {

View File

@ -119,7 +119,7 @@ static void _handle_raw_sixlowpan(ble_mac_inbuf_t *inbuf)
od_hex_dump(inbuf->payload, inbuf->len, OD_WIDTH_DEFAULT); od_hex_dump(inbuf->payload, inbuf->len, OD_WIDTH_DEFAULT);
#endif #endif
LL_APPEND(pkt, netif_hdr); pkt = gnrc_pkt_append(pkt, netif_hdr);
/* throw away packet if no one is interested */ /* throw away packet if no one is interested */
if (!gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) { if (!gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) {

View File

@ -175,7 +175,7 @@ static int _parse_packet(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt,
gnrc_netif_hdr_set_netif(netif_hdr, netif); gnrc_netif_hdr_set_netif(netif_hdr, netif);
pkt->type = state->proto; pkt->type = state->proto;
gnrc_pktbuf_remove_snip(pkt, pkt->next); gnrc_pktbuf_remove_snip(pkt, pkt->next);
LL_APPEND(pkt, netif_snip); pkt = gnrc_pkt_append(pkt, netif_snip);
gnrc_pktsnip_t *gomach_snip = NULL; gnrc_pktsnip_t *gomach_snip = NULL;
gnrc_gomach_hdr_t *gomach_hdr = NULL; gnrc_gomach_hdr_t *gomach_hdr = NULL;

View File

@ -218,7 +218,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
#endif #endif
#endif #endif
gnrc_pktbuf_remove_snip(pkt, ieee802154_hdr); gnrc_pktbuf_remove_snip(pkt, ieee802154_hdr);
LL_APPEND(pkt, netif_hdr); pkt = gnrc_pkt_append(pkt, netif_hdr);
} }
DEBUG("_recv_ieee802154: reallocating.\n"); DEBUG("_recv_ieee802154: reallocating.\n");

View File

@ -246,7 +246,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
gnrc_netif_hdr_set_netif(netif_hdr->data, netif); gnrc_netif_hdr_set_netif(netif_hdr->data, netif);
gnrc_pktbuf_remove_snip(pkt, eth_hdr); gnrc_pktbuf_remove_snip(pkt, eth_hdr);
LL_APPEND(pkt, netif_hdr); pkt = gnrc_pkt_append(pkt, netif_hdr);
} }
out: out:

View File

@ -132,7 +132,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
hdr->lqi = rx_info.lqi; hdr->lqi = rx_info.lqi;
hdr->rssi = rx_info.rssi; hdr->rssi = rx_info.rssi;
gnrc_netif_hdr_set_netif(hdr, netif); gnrc_netif_hdr_set_netif(hdr, netif);
LL_APPEND(pkt, netif_snip); pkt = gnrc_pkt_append(pkt, netif_snip);
} }
else { else {
/* Normal mode, try to parse the frame according to IEEE 802.15.4 */ /* Normal mode, try to parse the frame according to IEEE 802.15.4 */
@ -204,7 +204,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
#endif #endif
#endif #endif
gnrc_pktbuf_remove_snip(pkt, ieee802154_hdr); gnrc_pktbuf_remove_snip(pkt, ieee802154_hdr);
LL_APPEND(pkt, netif_hdr); pkt = gnrc_pkt_append(pkt, netif_hdr);
} }
DEBUG("_recv_ieee802154: reallocating.\n"); DEBUG("_recv_ieee802154: reallocating.\n");

View File

@ -101,7 +101,7 @@ void gnrc_icmpv6_echo_req_handle(gnrc_netif_t *netif, ipv6_hdr_t *ipv6_hdr,
/* (netif == NULL) => ipv6_hdr->dst is loopback address */ /* (netif == NULL) => ipv6_hdr->dst is loopback address */
gnrc_netif_hdr_set_netif(hdr->data, netif); gnrc_netif_hdr_set_netif(hdr->data, netif);
LL_PREPEND(pkt, hdr); pkt = gnrc_pkt_prepend(pkt, hdr);
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_IPV6, GNRC_NETREG_DEMUX_CTX_ALL, if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_IPV6, GNRC_NETREG_DEMUX_CTX_ALL,
pkt)) { pkt)) {

View File

@ -221,7 +221,7 @@ static void _send(gnrc_pktsnip_t *pkt, const gnrc_pktsnip_t *orig_pkt,
return; return;
} }
gnrc_netif_hdr_set_netif(netif->data, iface); gnrc_netif_hdr_set_netif(netif->data, iface);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
} }
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_IPV6, if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_IPV6,
GNRC_NETREG_DEMUX_CTX_ALL, GNRC_NETREG_DEMUX_CTX_ALL,

View File

@ -344,7 +344,7 @@ gnrc_pktsnip_t *gnrc_ipv6_ext_build(gnrc_pktsnip_t *ipv6, gnrc_pktsnip_t *next,
} }
if (ipv6 != NULL) { if (ipv6 != NULL) {
LL_SEARCH_SCALAR(ipv6, prev, next, next); prev = gnrc_pkt_prev_snip(ipv6, next);
if (prev == NULL) { if (prev == NULL) {
return NULL; return NULL;

View File

@ -311,9 +311,7 @@ static gnrc_pktsnip_t *_create_netif_hdr(uint8_t *dst_l2addr,
hdr->flags = flags; hdr->flags = flags;
/* add netif_hdr to front of the pkt list */ /* add netif_hdr to front of the pkt list */
LL_PREPEND(pkt, netif_hdr); return gnrc_pkt_prepend(pkt, netif_hdr);
return pkt;
} }
static bool _is_ipv6_hdr(gnrc_pktsnip_t *hdr) static bool _is_ipv6_hdr(gnrc_pktsnip_t *hdr)

View File

@ -851,7 +851,7 @@ static void _send_delayed_nbr_adv(const gnrc_netif_t *netif,
return; return;
} }
gnrc_netif_hdr_set_netif(pkt->data, netif); gnrc_netif_hdr_set_netif(pkt->data, netif);
LL_PREPEND(payload, pkt); pkt = gnrc_pkt_prepend(payload, pkt);
_evtimer_add(pkt, GNRC_IPV6_NIB_SND_NA, &nce->snd_na, _evtimer_add(pkt, GNRC_IPV6_NIB_SND_NA, &nce->snd_na,
random_uint32_range(0, NDP_MAX_ANYCAST_MS_DELAY)); random_uint32_range(0, NDP_MAX_ANYCAST_MS_DELAY));
} }
@ -1240,7 +1240,8 @@ static bool _resolve_addr(const ipv6_addr_t *dst, gnrc_netif_t *netif,
return false; return false;
} }
gnrc_netif_hdr_set_netif(netif_hdr->data, netif); gnrc_netif_hdr_set_netif(netif_hdr->data, netif);
LL_PREPEND(queue_entry->pkt, netif_hdr); queue_entry->pkt = gnrc_pkt_prepend(queue_entry->pkt,
netif_hdr);
} }
gnrc_pktqueue_add(&entry->pktqueue, queue_entry); gnrc_pktqueue_add(&entry->pktqueue, queue_entry);
} }

View File

@ -610,8 +610,7 @@ static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif,
return NULL; return NULL;
} }
gnrc_netif_hdr_set_netif(l2hdr->data, netif); gnrc_netif_hdr_set_netif(l2hdr->data, netif);
LL_PREPEND(iphdr, l2hdr); return gnrc_pkt_prepend(iphdr, l2hdr);
return l2hdr;
} }
static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src) static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src)

View File

@ -116,9 +116,7 @@ static gnrc_pktsnip_t *_build_frag_pkt(gnrc_pktsnip_t *pkt,
frag_hdr->tag = byteorder_htons(fbuf->tag); frag_hdr->tag = byteorder_htons(fbuf->tag);
LL_PREPEND(frag, netif); return gnrc_pkt_prepend(frag, netif);
return frag;
} }
static uint16_t _copy_pkt_to_frag(uint8_t *data, const gnrc_pktsnip_t *pkt, static uint16_t _copy_pkt_to_frag(uint8_t *data, const gnrc_pktsnip_t *pkt,

View File

@ -627,7 +627,7 @@ int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf
new_netif_hdr->flags = netif_hdr->flags; new_netif_hdr->flags = netif_hdr->flags;
new_netif_hdr->lqi = netif_hdr->lqi; new_netif_hdr->lqi = netif_hdr->lqi;
new_netif_hdr->rssi = netif_hdr->rssi; new_netif_hdr->rssi = netif_hdr->rssi;
LL_APPEND(rbuf->pkt, netif); rbuf->pkt = gnrc_pkt_append(rbuf->pkt, netif);
#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_STATS) #if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_STATS)
gnrc_sixlowpan_frag_stats_get()->fragments += _count_frags(rbuf); gnrc_sixlowpan_frag_stats_get()->fragments += _count_frags(rbuf);
gnrc_sixlowpan_frag_stats_get()->datagrams++; gnrc_sixlowpan_frag_stats_get()->datagrams++;

View File

@ -797,8 +797,8 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
ipv6))) { ipv6))) {
/* add netif header to `ipv6` so its flags can be used when /* add netif header to `ipv6` so its flags can be used when
* forwarding the fragment */ * forwarding the fragment */
LL_DELETE(sixlo, netif); sixlo = gnrc_pkt_delete(sixlo, netif);
LL_APPEND(ipv6, netif); ipv6 = gnrc_pkt_append(ipv6, netif);
/* provide space to copy remaining payload */ /* provide space to copy remaining payload */
if (gnrc_pktbuf_realloc_data(ipv6, uncomp_hdr_len + sixlo->size - if (gnrc_pktbuf_realloc_data(ipv6, uncomp_hdr_len + sixlo->size -
payload_offset) != 0) { payload_offset) != 0) {
@ -862,8 +862,8 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
#endif /* MODULE_GNRC_SIXLOWPAN_FRAG_VRB */ #endif /* MODULE_GNRC_SIXLOWPAN_FRAG_VRB */
} }
else { else {
LL_DELETE(sixlo, netif); sixlo = gnrc_pkt_delete(sixlo, netif);
LL_APPEND(ipv6, netif); ipv6 = gnrc_pkt_append(ipv6, netif);
gnrc_sixlowpan_dispatch_recv(ipv6, NULL, page); gnrc_sixlowpan_dispatch_recv(ipv6, NULL, page);
} }
gnrc_pktbuf_release(sixlo); gnrc_pktbuf_release(sixlo);

View File

@ -18,7 +18,7 @@
gnrc_pktsnip_t *gnrc_pktbuf_remove_snip(gnrc_pktsnip_t *pkt, gnrc_pktsnip_t *gnrc_pktbuf_remove_snip(gnrc_pktsnip_t *pkt,
gnrc_pktsnip_t *snip) gnrc_pktsnip_t *snip)
{ {
LL_DELETE(pkt, snip); pkt = gnrc_pkt_delete(pkt, snip);
snip->next = NULL; snip->next = NULL;
gnrc_pktbuf_release(snip); gnrc_pktbuf_release(snip);
@ -32,8 +32,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_replace_snip(gnrc_pktsnip_t *pkt,
/* If add is a list we need to preserve its tail */ /* If add is a list we need to preserve its tail */
if (add->next != NULL) { if (add->next != NULL) {
gnrc_pktsnip_t *tail = add->next; gnrc_pktsnip_t *tail = add->next;
gnrc_pktsnip_t *back; /* find the last snip in tail */
LL_SEARCH_SCALAR(tail, back, next, NULL); /* find the last snip in add */ gnrc_pktsnip_t *back = gnrc_pkt_prev_snip(tail, NULL);
/* Replace old */ /* Replace old */
LL_REPLACE_ELEM(pkt, old, add); LL_REPLACE_ELEM(pkt, old, add);
/* and wire in the tail between */ /* and wire in the tail between */

View File

@ -224,7 +224,7 @@ void gnrc_rpl_send(gnrc_pktsnip_t *pkt, kernel_pid_t iface, ipv6_addr_t *src, ip
return; return;
} }
gnrc_netif_hdr_set_netif(hdr->data, netif); gnrc_netif_hdr_set_netif(hdr->data, netif);
LL_PREPEND(pkt, hdr); pkt = gnrc_pkt_prepend(pkt, hdr);
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_IPV6, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) { if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_IPV6, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) {
DEBUG("RPL: cannot send packet: no subscribers found.\n"); DEBUG("RPL: cannot send packet: no subscribers found.\n");

View File

@ -231,7 +231,7 @@ ssize_t gnrc_sock_send(gnrc_pktsnip_t *payload, sock_ip_ep_t *local,
} }
netif_hdr = netif->data; netif_hdr = netif->data;
netif_hdr->if_pid = iface; netif_hdr->if_pid = iface;
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
} }
#ifdef MODULE_GNRC_NETERR #ifdef MODULE_GNRC_NETERR
/* cppcheck-suppress uninitvar /* cppcheck-suppress uninitvar

View File

@ -132,8 +132,7 @@ int _pkt_build_reset_from_pkt(gnrc_pktsnip_t **out_pkt, gnrc_pktsnip_t *in_pkt)
} }
else { else {
((gnrc_netif_hdr_t *)net_snp->data)->if_pid = net_hdr->if_pid; ((gnrc_netif_hdr_t *)net_snp->data)->if_pid = net_hdr->if_pid;
LL_PREPEND(ip6_snp, net_snp); *(out_pkt) = gnrc_pkt_prepend(ip6_snp, net_snp);
*(out_pkt) = net_snp;
} }
} }
#else #else
@ -240,8 +239,7 @@ int _pkt_build(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t **out_pkt, uint16_t *seq_con,
} }
else { else {
((gnrc_netif_hdr_t *)net_snp->data)->if_pid = (kernel_pid_t)tcb->ll_iface; ((gnrc_netif_hdr_t *)net_snp->data)->if_pid = (kernel_pid_t)tcb->ll_iface;
LL_PREPEND(ip6_snp, net_snp); *(out_pkt) = gnrc_pkt_prepend(ip6_snp, net_snp);
*(out_pkt) = net_snp;
} }
} }
#else #else

View File

@ -321,7 +321,7 @@ static void _pinger(_ping_data_t *data)
goto error_exit; goto error_exit;
} }
gnrc_netif_hdr_set_netif(tmp->data, data->netif); gnrc_netif_hdr_set_netif(tmp->data, data->netif);
LL_PREPEND(pkt, tmp); pkt = gnrc_pkt_prepend(pkt, tmp);
} }
if (data->datalen >= sizeof(uint32_t)) { if (data->datalen >= sizeof(uint32_t)) {
uint32_t now = xtimer_now_usec(); uint32_t now = xtimer_now_usec();

View File

@ -1593,7 +1593,7 @@ int _gnrc_netif_send(int argc, char **argv)
gnrc_pktbuf_release(pkt); gnrc_pktbuf_release(pkt);
return 1; return 1;
} }
LL_PREPEND(pkt, hdr); pkt = gnrc_pkt_prepend(pkt, hdr);
nethdr = (gnrc_netif_hdr_t *)hdr->data; nethdr = (gnrc_netif_hdr_t *)hdr->data;
nethdr->flags = flags; nethdr->flags = flags;
/* and send it */ /* and send it */

View File

@ -96,7 +96,7 @@ static void send(char *addr_str, char *port_str, char *data_len_str, unsigned in
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, NULL, 0); gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
((gnrc_netif_hdr_t *)netif->data)->if_pid = (kernel_pid_t)iface; ((gnrc_netif_hdr_t *)netif->data)->if_pid = (kernel_pid_t)iface;
LL_PREPEND(ip, netif); ip = gnrc_pkt_prepend(ip, netif);
} }
/* send packet */ /* send packet */
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) { if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) {

View File

@ -1189,7 +1189,7 @@ static void test_netapi_send__raw_unicast_ethernet_packet(void)
TEST_ASSERT_NOT_NULL(pkt); TEST_ASSERT_NOT_NULL(pkt);
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst)); gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ethernet_netif, pkt); gnrc_netif_send(&ethernet_netif, pkt);
} }
@ -1204,7 +1204,7 @@ static void test_netapi_send__raw_broadcast_ethernet_packet(void)
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
hdr = netif->data; hdr = netif->data;
hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST; hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST;
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ethernet_netif, pkt); gnrc_netif_send(&ethernet_netif, pkt);
} }
@ -1217,7 +1217,7 @@ static void test_netapi_send__raw_unicast_ieee802154_long_long_packet(void)
TEST_ASSERT_NOT_NULL(pkt); TEST_ASSERT_NOT_NULL(pkt);
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst)); gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
} }
@ -1230,7 +1230,7 @@ static void test_netapi_send__raw_unicast_ieee802154_long_short_packet(void)
TEST_ASSERT_NOT_NULL(pkt); TEST_ASSERT_NOT_NULL(pkt);
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst)); gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
} }
@ -1248,7 +1248,7 @@ static void test_netapi_send__raw_unicast_ieee802154_short_long_packet1(void)
0, &src_len, sizeof(src_len))); 0, &src_len, sizeof(src_len)));
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst)); gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
/* reset src_len */ /* reset src_len */
src_len = 8U; src_len = 8U;
@ -1268,7 +1268,7 @@ static void test_netapi_send__raw_unicast_ieee802154_short_long_packet2(void)
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(src, sizeof(src), gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(src, sizeof(src),
dst, sizeof(dst)); dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
} }
@ -1286,7 +1286,7 @@ static void test_netapi_send__raw_unicast_ieee802154_short_short_packet(void)
0, &src_len, sizeof(src_len))); 0, &src_len, sizeof(src_len)));
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst)); gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
/* reset src_len */ /* reset src_len */
src_len = 8U; src_len = 8U;
@ -1306,7 +1306,7 @@ static void test_netapi_send__raw_broadcast_ieee802154_long_packet(void)
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
hdr = netif->data; hdr = netif->data;
hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST; hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST;
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
} }
@ -1326,7 +1326,7 @@ static void test_netapi_send__raw_broadcast_ieee802154_short_packet(void)
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
hdr = netif->data; hdr = netif->data;
hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST; hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST;
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
/* reset src_len */ /* reset src_len */
src_len = 8U; src_len = 8U;
@ -1360,7 +1360,7 @@ static void test_netapi_send__ipv6_unicast_ethernet_packet(void)
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst_netif, gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst_netif,
sizeof(dst_netif)); sizeof(dst_netif));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ethernet_netif, pkt); gnrc_netif_send(&ethernet_netif, pkt);
} }
@ -1387,7 +1387,7 @@ static void test_netapi_send__ipv6_multicast_ethernet_packet(void)
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
netif_hdr = netif->data; netif_hdr = netif->data;
netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MULTICAST; netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MULTICAST;
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ethernet_netif, pkt); gnrc_netif_send(&ethernet_netif, pkt);
} }
@ -1416,7 +1416,7 @@ static void test_netapi_send__ipv6_unicast_ieee802154_packet(void)
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst_netif, gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst_netif,
sizeof(dst_netif)); sizeof(dst_netif));
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
} }
@ -1443,7 +1443,7 @@ static void test_netapi_send__ipv6_multicast_ieee802154_packet(void)
TEST_ASSERT_NOT_NULL(netif); TEST_ASSERT_NOT_NULL(netif);
netif_hdr = netif->data; netif_hdr = netif->data;
netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MULTICAST; netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MULTICAST;
LL_PREPEND(pkt, netif); pkt = gnrc_pkt_prepend(pkt, netif);
gnrc_netif_send(&ieee802154_netif, pkt); gnrc_netif_send(&ieee802154_netif, pkt);
} }

View File

@ -62,14 +62,13 @@ static gnrc_pktsnip_t *_build_ipv6_packet(const ipv6_addr_t *src,
ipv6_hdr->len = byteorder_htons((uint16_t)payload->size); ipv6_hdr->len = byteorder_htons((uint16_t)payload->size);
ipv6_hdr->nh = nh; ipv6_hdr->nh = nh;
ipv6_hdr->hl = 64; ipv6_hdr->hl = 64;
LL_APPEND(payload, ipv6); payload = gnrc_pkt_append(payload, ipv6);
netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
if (netif_hdr == NULL) { if (netif_hdr == NULL) {
return NULL; return NULL;
} }
((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = (kernel_pid_t)netif; ((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = (kernel_pid_t)netif;
LL_APPEND(payload, netif_hdr); return gnrc_pkt_append(payload, netif_hdr);
return payload;
} }

View File

@ -85,14 +85,13 @@ static gnrc_pktsnip_t *_build_udp_packet(const ipv6_addr_t *src,
else { else {
udp_hdr->checksum = byteorder_htons(~csum); udp_hdr->checksum = byteorder_htons(~csum);
} }
LL_APPEND(udp, ipv6); udp = gnrc_pkt_append(udp, ipv6);
netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
if (netif_hdr == NULL) { if (netif_hdr == NULL) {
return NULL; return NULL;
} }
((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = (kernel_pid_t)netif; ((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = (kernel_pid_t)netif;
LL_APPEND(udp, netif_hdr); return gnrc_pkt_append(udp, netif_hdr);
return udp;
} }

View File

@ -148,7 +148,7 @@ static void send(char *addr_str, char *port_str, char *data_len_str, unsigned in
return; return;
} }
gnrc_netif_hdr_set_netif(netif_hdr->data, netif); gnrc_netif_hdr_set_netif(netif_hdr->data, netif);
LL_PREPEND(ip, netif_hdr); ip = gnrc_pkt_prepend(ip, netif_hdr);
} }
/* send packet */ /* send packet */
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) { if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) {

View File

@ -104,7 +104,7 @@ static int test_send(void)
puts("Could not allocate send header"); puts("Could not allocate send header");
return 0; return 0;
} }
LL_PREPEND(pkt, hdr); pkt = gnrc_pkt_prepend(pkt, hdr);
/* prepare expected data */ /* prepare expected data */
memcpy(exp_mac->dst, _test_dst, sizeof(_test_dst)); memcpy(exp_mac->dst, _test_dst, sizeof(_test_dst));
memcpy(exp_mac->src, _dev_addr, sizeof(_dev_addr)); memcpy(exp_mac->src, _dev_addr, sizeof(_dev_addr));

View File

@ -63,7 +63,7 @@ static void test_gnrc_mac_queue_tx_packet(void)
hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
gnrc_pktsnip_t *pkt_bcast = gnrc_pktbuf_add(NULL, TEST_STRING12, sizeof(TEST_STRING12), gnrc_pktsnip_t *pkt_bcast = gnrc_pktbuf_add(NULL, TEST_STRING12, sizeof(TEST_STRING12),
GNRC_NETTYPE_UNDEF); GNRC_NETTYPE_UNDEF);
LL_APPEND(hdr, pkt_bcast); hdr = gnrc_pkt_append(hdr, pkt_bcast);
pkt_bcast = hdr; pkt_bcast = hdr;
netif_hdr = hdr->data; netif_hdr = hdr->data;
@ -72,13 +72,13 @@ static void test_gnrc_mac_queue_tx_packet(void)
hdr = gnrc_netif_hdr_build(NULL, 0, dst_addr, 2); hdr = gnrc_netif_hdr_build(NULL, 0, dst_addr, 2);
gnrc_pktsnip_t *pkt1 = gnrc_pktbuf_add(NULL, TEST_STRING4, sizeof(TEST_STRING4), gnrc_pktsnip_t *pkt1 = gnrc_pktbuf_add(NULL, TEST_STRING4, sizeof(TEST_STRING4),
GNRC_NETTYPE_UNDEF); GNRC_NETTYPE_UNDEF);
LL_APPEND(hdr, pkt1); hdr = gnrc_pkt_append(hdr, pkt1);
pkt1 = hdr; pkt1 = hdr;
hdr = gnrc_netif_hdr_build(NULL, 0, dst_addr, 2); hdr = gnrc_netif_hdr_build(NULL, 0, dst_addr, 2);
gnrc_pktsnip_t *pkt2 = gnrc_pktbuf_add(NULL, TEST_STRING8, sizeof(TEST_STRING8), gnrc_pktsnip_t *pkt2 = gnrc_pktbuf_add(NULL, TEST_STRING8, sizeof(TEST_STRING8),
GNRC_NETTYPE_UNDEF); GNRC_NETTYPE_UNDEF);
LL_APPEND(hdr, pkt2); hdr = gnrc_pkt_append(hdr, pkt2);
pkt2 = hdr; pkt2 = hdr;
dst_addr[0] = 0x44; dst_addr[0] = 0x44;
@ -87,7 +87,7 @@ static void test_gnrc_mac_queue_tx_packet(void)
hdr = gnrc_netif_hdr_build(NULL, 0, dst_addr, 2); hdr = gnrc_netif_hdr_build(NULL, 0, dst_addr, 2);
gnrc_pktsnip_t *pkt3 = gnrc_pktbuf_add(NULL, TEST_STRING16, sizeof(TEST_STRING16), gnrc_pktsnip_t *pkt3 = gnrc_pktbuf_add(NULL, TEST_STRING16, sizeof(TEST_STRING16),
GNRC_NETTYPE_UNDEF); GNRC_NETTYPE_UNDEF);
LL_APPEND(hdr, pkt3); hdr = gnrc_pkt_append(hdr, pkt3);
pkt3 = hdr; pkt3 = hdr;
#if CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0 #if CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0