Go to the documentation of this file.
21 #ifndef NET_GNRC_NETIF_HDR_H
22 #define NET_GNRC_NETIF_HDR_H
28 #include "net/gnrc/netif/internal.h"
41 #define GNRC_NETIF_HDR_L2ADDR_MAX_LEN (8)
47 #define GNRC_NETIF_HDR_L2ADDR_PRINT_LEN (GNRC_NETIF_HDR_L2ADDR_MAX_LEN * 3)
62 #define GNRC_NETIF_HDR_FLAGS_BROADCAST (0x80)
75 #define GNRC_NETIF_HDR_FLAGS_MULTICAST (0x40)
90 #define GNRC_NETIF_HDR_FLAGS_MORE_DATA (0x10)
118 uint8_t dst_l2addr_len)
151 return ((uint8_t *)(hdr + 1));
169 memcpy(((uint8_t *)(hdr + 1)), addr, addr_len);
201 memcpy(((uint8_t *)(hdr + 1)) + hdr->
src_l2addr_len, addr, addr_len);
204 #if defined(MODULE_GNRC_IPV6) || defined(DOXYGEN)
226 return gnrc_netif_ipv6_iid_from_addr(netif,
253 return gnrc_netif_ipv6_iid_from_addr(netif,
259 #define gnrc_netif_hdr_ipv6_iid_from_src(netif, hdr, iid) (-ENOTSUP);
260 #define gnrc_netif_hdr_ipv6_iid_from_dst(netif, hdr, iid) (-ENOTSUP);
278 const uint8_t *dst, uint8_t dst_len);
int16_t kernel_pid_t
Unique process identifier.
static void gnrc_netif_hdr_set_netif(gnrc_netif_hdr_t *hdr, const gnrc_netif_t *netif)
Convenience function to set the interface of an interface header, given the network interface.
static uint8_t * gnrc_netif_hdr_get_src_addr(const gnrc_netif_hdr_t *hdr)
Get the source address from the given header.
Generic network interface header.
#define assert(cond)
abort the program if assertion is false
uint8_t lqi
lqi of received packet (optional)
static size_t gnrc_netif_hdr_sizeof(const gnrc_netif_hdr_t *hdr)
Get the size of the given generic network interface header.
kernel_pid_t if_pid
PID of network interface.
int gnrc_netif_hdr_get_srcaddr(gnrc_pktsnip_t *pkt, uint8_t **pointer_to_addr)
Extract the source address out of a gnrc packet.
static gnrc_netif_t * gnrc_netif_hdr_get_netif(const gnrc_netif_hdr_t *hdr)
Convenience function to get the corresponding interface struct for a given interface header.
static void gnrc_netif_hdr_init(gnrc_netif_hdr_t *hdr, uint8_t src_l2addr_len, uint8_t dst_l2addr_len)
Initialize the given generic network interface header.
static void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t *hdr, const uint8_t *addr, uint8_t addr_len)
Set the destination address in the given header.
Representation of a network interface.
uint8_t gnrc_netif_hdr_get_flag(gnrc_pktsnip_t *pkt)
Fetch the netif header flags of a gnrc packet.
General definitions for network packets and their helper functions.
kernel_pid_t pid
PID of the network interface's thread.
static uint8_t * gnrc_netif_hdr_get_dst_addr(const gnrc_netif_hdr_t *hdr)
Get the destination address from the given header.
int gnrc_netif_hdr_get_dstaddr(gnrc_pktsnip_t *pkt, uint8_t **pointer_to_addr)
Extract the destination address out of a gnrc packet.
gnrc_pktsnip_t * gnrc_netif_hdr_build(const uint8_t *src, uint8_t src_len, const uint8_t *dst, uint8_t dst_len)
Builds a generic network interface header for sending and adds it to the packet buffer.
gnrc_netif_t * gnrc_netif_get_by_pid(kernel_pid_t pid)
Get network interface by PID.
Interface definition for the global network buffer. Network devices and layers can allocate space for...
static int gnrc_netif_hdr_ipv6_iid_from_dst(const gnrc_netif_t *netif, const gnrc_netif_hdr_t *hdr, eui64_t *iid)
Converts the destination address of a given Generic network interface header to an IPv6 IID.
int16_t rssi
rssi of received packet in dBm (optional)
uint8_t src_l2addr_len
length of l2 source address in byte
Data type to represent an EUI-64.
Definition for GNRC's network interfaces.
void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr)
Outputs a generic interface header to stdout.
uint8_t flags
flags as defined above
uint8_t dst_l2addr_len
length of l2 destination address in byte
static int gnrc_netif_hdr_ipv6_iid_from_src(const gnrc_netif_t *netif, const gnrc_netif_hdr_t *hdr, eui64_t *iid)
Converts the source address of a given Generic network interface header to an IPv6 IID.
Type to represent parts (either headers or payload) of a packet, called snips.
#define KERNEL_PID_UNDEF
Canonical identifier for an invalid PID.
static void gnrc_netif_hdr_set_src_addr(gnrc_netif_hdr_t *hdr, const uint8_t *addr, uint8_t addr_len)
Set the source address in the given header.