Files | |
file | hdr.h |
Generic network interface header. | |
Data Structures | |
struct | gnrc_netif_hdr_t |
Generic network interface header. More... | |
Macros | |
#define | GNRC_NETIF_HDR_L2ADDR_MAX_LEN (8) |
Maximum length of the l2 addresses of the generic interface header in bytes. | |
#define | GNRC_NETIF_HDR_L2ADDR_PRINT_LEN (GNRC_NETIF_HDR_L2ADDR_MAX_LEN * 3) |
Maximum length of the string representatiom of l2 addresses of the generic interface header in bytes. | |
Functions | |
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. More... | |
static size_t | gnrc_netif_hdr_sizeof (const gnrc_netif_hdr_t *hdr) |
Get the size of the given generic network interface header. More... | |
static uint8_t * | gnrc_netif_hdr_get_src_addr (const gnrc_netif_hdr_t *hdr) |
Get the source address from the given header. More... | |
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. More... | |
static uint8_t * | gnrc_netif_hdr_get_dst_addr (const gnrc_netif_hdr_t *hdr) |
Get the destination address from the given header. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | gnrc_netif_hdr_print (gnrc_netif_hdr_t *hdr) |
Outputs a generic interface header to stdout. More... | |
uint8_t | gnrc_netif_hdr_get_flag (gnrc_pktsnip_t *pkt) |
Fetch the netif header flags of a gnrc packet. More... | |
int | gnrc_netif_hdr_get_dstaddr (gnrc_pktsnip_t *pkt, uint8_t **pointer_to_addr) |
Extract the destination address out of a gnrc packet. More... | |
int | gnrc_netif_hdr_get_srcaddr (gnrc_pktsnip_t *pkt, uint8_t **pointer_to_addr) |
Extract the source address out of a gnrc packet. More... | |
Flags for the gnrc_netif_hdr_t | |
#define | GNRC_NETIF_HDR_FLAGS_BROADCAST (0x80) |
Send packet broadcast. More... | |
#define | GNRC_NETIF_HDR_FLAGS_MULTICAST (0x40) |
Send packet multicast. More... | |
#define | GNRC_NETIF_HDR_FLAGS_MORE_DATA (0x10) |
More data will follow. More... | |
#define GNRC_NETIF_HDR_FLAGS_BROADCAST (0x80) |
Send packet broadcast.
Packets with this flag set must be send broadcast. gnrc_netif_hdr_t::dst_l2addr_len and any appended destination address must be ignored. If the link layer does not support broadcast the packet must be dropped silently.
#define GNRC_NETIF_HDR_FLAGS_MORE_DATA (0x10) |
More data will follow.
This flag signals that this packet is part of a burst of packets. The link layer implementation can choose to translate this flag into frame header bits to tell the remote node that more traffic will follow shortly. The most direct use case for this flag is to set it for fragmented packets in duty cycled networks to tell the remote node to keep its radio turned on after receiving the first fragment.
#define GNRC_NETIF_HDR_FLAGS_MULTICAST (0x40) |
Send packet multicast.
Packets with this flag set must be send multicast. gnrc_netif_hdr_t::dst_l2addr_len and any appended destination address must be ignored. The context for the multicast address must be derived from the network layer destination address. If the link layer does not support multicast it should interpret this flag the same way it does GNRC_NETIF_HDR_FLAGS_BROADCAST.
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.
[in] | src | Source address for the header. Can be NULL if not known or required. |
[in] | src_len | Length of src . Can be 0 if not known or required. |
[in] | dst | Destination address for the header. Can be NULL if not known or required. |
[in] | dst_len | Length of dst . Can be 0 if not known or required. |
|
inlinestatic |
int gnrc_netif_hdr_get_dstaddr | ( | gnrc_pktsnip_t * | pkt, |
uint8_t ** | pointer_to_addr | ||
) |
Extract the destination address out of a gnrc packet.
[in] | pkt | gnrc packet from whom to extract |
[out] | pointer_to_addr | pointer to address will be stored here |
pkt
or if no destination address field presented in netif header. uint8_t gnrc_netif_hdr_get_flag | ( | gnrc_pktsnip_t * | pkt | ) |
Fetch the netif header flags of a gnrc packet.
[in] | pkt | gnrc packet from whom to fetch |
pkt
|
inlinestatic |
Convenience function to get the corresponding interface struct for a given interface header.
hdr != NULL
[in] | hdr | Header to read interface from. |
|
inlinestatic |
int gnrc_netif_hdr_get_srcaddr | ( | gnrc_pktsnip_t * | pkt, |
uint8_t ** | pointer_to_addr | ||
) |
Extract the source address out of a gnrc packet.
[in] | pkt | gnrc packet from whom to extract |
[out] | pointer_to_addr | pointer to address will be stored here |
pkt
or if no source address field presented in netif header.
|
inlinestatic |
|
inlinestatic |
Converts the destination address of a given Generic network interface header to an IPv6 IID.
netif
is intentionally required to be provided so that the caller needs to retrieve it from gnrc_netif_hdr_t::if_pid of hdr
only once instead of this function retrieving it at every call.netif->pid == hdr->if_pid
[in] | netif | A network interface. gnrc_netif_t::pid must be equal to gnrc_netif_hdr_t::if_pid of hdr . |
[in] | hdr | Header to convert destination address from. |
[out] | iid | The IID based on gnrc_netif_t::device_type. |
|
inlinestatic |
Converts the source address of a given Generic network interface header to an IPv6 IID.
netif
is intentionally required to be provided so that the caller needs to retrieve it from gnrc_netif_hdr_t::if_pid of hdr
only once instead of this function retrieving it at every call.netif->pid == hdr->if_pid
[in] | netif | A network interface. gnrc_netif_t::pid must be equal to gnrc_netif_hdr_t::if_pid of hdr . |
[in] | hdr | Header to convert source address from. |
[out] | iid | The IID based on gnrc_netif_t::device_type. |
void gnrc_netif_hdr_print | ( | gnrc_netif_hdr_t * | hdr | ) |
Outputs a generic interface header to stdout.
[in] | hdr | A generic interface header. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |