Generic network interface header

GNRC_NETIF_HDR_FLAGS_BROADCAST

Send packet broadcast.

1
(0x80)

Packets with this flag set must be send broadcast. gnrc/netif/hdr.h::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.

GNRC_NETIF_HDR_FLAGS_MULTICAST

Send packet multicast.

1
(0x40)

Packets with this flag set must be send multicast. gnrc/netif/hdr.h::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.h::GNRC_NETIF_HDR_FLAGS_BROADCAST.

GNRC_NETIF_HDR_FLAGS_MORE_DATA

More data will follow.

1
(0x10)

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.

See also

The corresponding bit in the IEEE 802.15.4 frame control field, sys/include/net/ieee802154.h::IEEE802154_FCF_FRAME_PEND

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.

Parameters

hdr:header to initialize
src_l2addr_len:link layer source address length
dst_l2addr_len:link layer destination address length

msp430_types.h::size_t gnrc_netif_hdr_sizeof(gnrc_netif_hdr_t * hdr)

Get the size of the given generic network interface header.

Parameters

hdr:header to get the size of

Return values

  • the size of the given header, including link layer addresses
uint8_t * gnrc_netif_hdr_get_src_addr(gnrc_netif_hdr_t * hdr)

Get the source address from the given header.

Parameters

hdr:header to read from

Return values

  • pointer to source address on success
  • NULL on error
void gnrc_netif_hdr_set_src_addr(gnrc_netif_hdr_t * hdr, uint8_t * addr, uint8_t addr_len)

Set the source address in the given header.

Parameters

hdr:header to write to
addr:new source address
addr_len:addr length

uint8_t * gnrc_netif_hdr_get_dst_addr(gnrc_netif_hdr_t * hdr)

Get the destination address from the given header.

Parameters

hdr:header to read from

Return values

  • pointer to destination address on success
  • NULL on error
void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t * hdr, uint8_t * addr, uint8_t addr_len)

Set the destination address in the given header.

Parameters

hdr:header to write to
addr:new destination address
addr_len:addr length

include/net/gnrc/pkt.h::gnrc_pktsnip_t * gnrc_netif_hdr_build(uint8_t * src, uint8_t src_len, uint8_t * dst, uint8_t dst_len)

Builds a generic network interface header for sending and adds it to the packet buffer.

Parameters

src:Source address for the header. Can be NULL if not known or required.
src_len:Length of src. Can be 0 if not known or required.
dst:Destination address for the header. Can be NULL if not known or required.
dst_len:Length of dst. Can be 0 if not known or required.

Return values

  • The generic network layer header on success.
  • NULL on error.
void gnrc_netif_hdr_print(gnrc_netif_hdr_t * hdr)

Outputs a generic interface header to stdout.

Parameters

hdr:A generic interface header.

uint8_t gnrc_netif_hdr_get_flag(include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt)

Fetch the netif header flags of a gnrc packet.

Parameters

pkt:gnrc packet from whom to fetch

Return values

  • netif header flags of pkt
  • 0, if no header is present
int gnrc_netif_hdr_get_dstaddr(include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt, uint8_t ** pointer_to_addr)

Extract the destination address out of a gnrc packet.

Parameters

pkt:gnrc packet from whom to extract
pointer_to_addr:
 pointer to address will be stored here

Return values

  • length of destination address
  • -ENOENT, if no netif header is presented in pkt or if no destination address field presented in netif header.
int gnrc_netif_hdr_get_srcaddr(include/net/gnrc/pkt.h::gnrc_pktsnip_t * pkt, uint8_t ** pointer_to_addr)

Extract the source address out of a gnrc packet.

Parameters

pkt:gnrc packet from whom to extract
pointer_to_addr:
 pointer to address will be stored here

Return values

  • length of source address
  • -ENOENT, if no netif header is presented in pkt or if no source address field presented in netif header.
GNRC_NETIF_HDR_L2ADDR_MAX_LEN

Maximum length of the l2 addresses of the generic interface header in bytes.

1
(8)
GNRC_NETIF_HDR_L2ADDR_PRINT_LEN

Maximum length of the string representatiom of l2 addresses of the generic interface header in bytes.

1
(GNRC_NETIF_HDR_L2ADDR_MAX_LEN * 3)
struct gnrc_netif_hdr_t

Generic network interface header.

The link layer addresses included in this header are put in memory directly following this struct.

uint8_t src_l2addr_len

length of l2 source address in byte

uint8_t dst_l2addr_len

length of l2 destination address in byte

kernel_types.h::kernel_pid_t if_pid

PID of network interface.

uint8_t flags

flags as defined above

uint8_t lqi

lqi of received packet (optional)

int16_t rssi

rssi of received packet in dBm (optional)