21#ifndef NET_GNRC_NETIF_HDR_H
22#define NET_GNRC_NETIF_HDR_H
28#include "net/gnrc/netif/internal.h"
42#define GNRC_NETIF_HDR_L2ADDR_MAX_LEN (8)
48#define GNRC_NETIF_HDR_L2ADDR_PRINT_LEN (GNRC_NETIF_HDR_L2ADDR_MAX_LEN * 3)
55#define GNRC_NETIF_HDR_NO_RSSI (INT16_MIN)
61#define GNRC_NETIF_HDR_NO_LQI (0)
76#define GNRC_NETIF_HDR_FLAGS_BROADCAST (0x80)
89#define GNRC_NETIF_HDR_FLAGS_MULTICAST (0x40)
104#define GNRC_NETIF_HDR_FLAGS_MORE_DATA (0x10)
115#define GNRC_NETIF_HDR_FLAGS_TIMESTAMP (0x08)
139#if IS_USED(MODULE_GNRC_NETIF_TIMESTAMP) || defined(DOXYGEN)
167 uint8_t dst_l2addr_len)
200 return ((uint8_t *)(hdr + 1));
218 memcpy(((uint8_t *)(hdr + 1)), addr, addr_len);
249 memcpy(((uint8_t *)(hdr + 1)) + hdr->
src_l2addr_len, addr, addr_len);
266#if IS_USED(MODULE_GNRC_NETIF_TIMESTAMP)
287#if IS_USED(MODULE_GNRC_NETIF_TIMESTAMP)
296#if defined(MODULE_GNRC_IPV6) || defined(DOXYGEN)
318 return gnrc_netif_ipv6_iid_from_addr(netif,
345 return gnrc_netif_ipv6_iid_from_addr(netif,
351#define gnrc_netif_hdr_ipv6_iid_from_src(netif, hdr, iid) (-ENOTSUP);
352#define gnrc_netif_hdr_ipv6_iid_from_dst(netif, hdr, iid) (-ENOTSUP);
370 const uint8_t *dst, uint8_t dst_len);
#define assert(cond)
abort the program if assertion is false
Definition for GNRC's network interfaces.
int16_t kernel_pid_t
Unique process identifier.
#define KERNEL_PID_UNDEF
Canonical identifier for an invalid PID.
int gnrc_netif_hdr_get_srcaddr(gnrc_pktsnip_t *pkt, uint8_t **pointer_to_addr)
Extract the source address out of a gnrc packet.
uint8_t gnrc_netif_hdr_get_flag(gnrc_pktsnip_t *pkt)
Fetch the netif header flags of a gnrc packet.
static uint8_t * gnrc_netif_hdr_get_src_addr(const gnrc_netif_hdr_t *hdr)
Get the source address from the given header.
static size_t gnrc_netif_hdr_sizeof(const gnrc_netif_hdr_t *hdr)
Get the size of the given generic network interface 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.
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_src_addr(gnrc_netif_hdr_t *hdr, const uint8_t *addr, uint8_t addr_len)
Set the source address in the given header.
static int gnrc_netif_hdr_get_timestamp(const gnrc_netif_hdr_t *hdr, uint64_t *dest)
Get the timestamp of the frame in nanoseconds since epoch.
static uint8_t * gnrc_netif_hdr_get_dst_addr(const gnrc_netif_hdr_t *hdr)
Get the destination address from the given header.
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.
#define GNRC_NETIF_HDR_FLAGS_TIMESTAMP
Indicate presence of a valid timestamp.
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 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 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.
#define GNRC_NETIF_HDR_NO_RSSI
Special value to indicate that no RSSI value is present.
void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr)
Outputs a generic interface header to stdout.
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.
#define GNRC_NETIF_HDR_NO_LQI
Special value to indicate that no LQI value is present.
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.
static void gnrc_netif_hdr_set_timestamp(gnrc_netif_hdr_t *hdr, uint64_t timestamp)
Set the timestamp in the netif header.
gnrc_netif_t * gnrc_netif_get_by_pid(kernel_pid_t pid)
Get network interface by PID.
General definitions for network packets and their helper functions.
Interface definition for the global network buffer.
Generic network interface header.
kernel_pid_t if_pid
PID of network interface.
int16_t rssi
RSSI of received packet or GNRC_NETIF_HDR_NO_RSSI.
uint8_t dst_l2addr_len
length of l2 destination address in byte
uint8_t src_l2addr_len
length of l2 source address in byte
uint64_t timestamp
Timestamp of reception in nanoseconds since epoch.
uint8_t flags
flags as defined above
uint8_t lqi
LQI of received packet or GNRC_NETIF_HDR_NO_LQI.
Representation of a network interface.
kernel_pid_t pid
PID of the network interface's thread.
Type to represent parts (either headers or payload) of a packet, called snips.
Utility header providing time unit defines.
Data type to represent an EUI-64.