gnrc_netif_hdr: un-inline build function
This commit is contained in:
parent
ad7071d2e6
commit
74722888f6
@ -190,29 +190,7 @@ static inline void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t *hdr, uint8_t *a
|
|||||||
* @return The generic network layer header on success.
|
* @return The generic network layer header on success.
|
||||||
* @return NULL on error.
|
* @return NULL on error.
|
||||||
*/
|
*/
|
||||||
static inline gnrc_pktsnip_t *gnrc_netif_hdr_build(uint8_t *src, uint8_t src_len,
|
gnrc_pktsnip_t *gnrc_netif_hdr_build(uint8_t *src, uint8_t src_len, uint8_t *dst, uint8_t dst_len);
|
||||||
uint8_t *dst, uint8_t dst_len)
|
|
||||||
{
|
|
||||||
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL,
|
|
||||||
sizeof(gnrc_netif_hdr_t) + src_len + dst_len,
|
|
||||||
GNRC_NETTYPE_NETIF);
|
|
||||||
|
|
||||||
if (pkt == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gnrc_netif_hdr_init(pkt->data, src_len, dst_len);
|
|
||||||
|
|
||||||
if (src != NULL && src_len > 0) {
|
|
||||||
gnrc_netif_hdr_set_src_addr(pkt->data, src, src_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dst != NULL && dst_len > 0) {
|
|
||||||
gnrc_netif_hdr_set_dst_addr(pkt->data, dst, dst_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pkt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Outputs a generic interface header to stdout.
|
* @brief Outputs a generic interface header to stdout.
|
||||||
|
|||||||
41
sys/net/gnrc/netif/hdr/gnrc_netif_hdr.c
Normal file
41
sys/net/gnrc/netif/hdr/gnrc_netif_hdr.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Freie Universität Berlin
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "net/gnrc/netif/hdr.h"
|
||||||
|
|
||||||
|
gnrc_pktsnip_t *gnrc_netif_hdr_build(uint8_t *src, uint8_t src_len, uint8_t *dst, uint8_t dst_len)
|
||||||
|
{
|
||||||
|
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL,
|
||||||
|
sizeof(gnrc_netif_hdr_t) + src_len + dst_len,
|
||||||
|
GNRC_NETTYPE_NETIF);
|
||||||
|
|
||||||
|
if (pkt == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gnrc_netif_hdr_init(pkt->data, src_len, dst_len);
|
||||||
|
|
||||||
|
if (src != NULL && src_len > 0) {
|
||||||
|
gnrc_netif_hdr_set_src_addr(pkt->data, src, src_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dst != NULL && dst_len > 0) {
|
||||||
|
gnrc_netif_hdr_set_dst_addr(pkt->data, dst, dst_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
Loading…
x
Reference in New Issue
Block a user