gnrc_netif_hdr: add setter for netif

This eases the refactoring to a pointer-based approach for network
interfaces.
This commit is contained in:
Martine S. Lenders 2018-12-12 19:09:04 +01:00
parent 2261aa9115
commit c3fe882cfe

View File

@ -294,6 +294,19 @@ static inline gnrc_netif_t *gnrc_netif_hdr_get_netif(const gnrc_netif_hdr_t *hdr
return gnrc_netif_get_by_pid(hdr->if_pid);
}
/**
* @brief Convenience function to set the interface of an interface header,
* given the network interface
*
* @param[out] hdr Header to set the interface for.
* @param[in] netif Network interface to set for @p hdr.
*/
static inline void gnrc_netif_hdr_set_netif(gnrc_netif_hdr_t *hdr,
const gnrc_netif_t *netif)
{
hdr->if_pid = (netif != NULL) ? netif->pid : KERNEL_PID_UNDEF;
}
/**
* @brief Outputs a generic interface header to stdout.
*