Skip to content
Snippets Groups Projects
Unverified Commit e804d784 authored by Sebastian Meiling's avatar Sebastian Meiling Committed by GitHub
Browse files

Merge pull request #11048 from miri64/gnrc_netif_hdr/enh/in-params-const

gnrc_netif_hdr: make in parameters const
parents bd77c1b1 998b9ed0
No related branches found
No related tags found
No related merge requests found
...@@ -158,8 +158,9 @@ static inline uint8_t *gnrc_netif_hdr_get_src_addr(const gnrc_netif_hdr_t *hdr) ...@@ -158,8 +158,9 @@ static inline uint8_t *gnrc_netif_hdr_get_src_addr(const gnrc_netif_hdr_t *hdr)
* @param[in] addr new source address * @param[in] addr new source address
* @param[in] addr_len *addr* length * @param[in] addr_len *addr* length
*/ */
static inline void gnrc_netif_hdr_set_src_addr(gnrc_netif_hdr_t *hdr, uint8_t *addr, static inline void gnrc_netif_hdr_set_src_addr(gnrc_netif_hdr_t *hdr,
uint8_t addr_len) const uint8_t *addr,
uint8_t addr_len)
{ {
if (addr_len != hdr->src_l2addr_len) { if (addr_len != hdr->src_l2addr_len) {
return; return;
...@@ -189,8 +190,9 @@ static inline uint8_t *gnrc_netif_hdr_get_dst_addr(const gnrc_netif_hdr_t *hdr) ...@@ -189,8 +190,9 @@ static inline uint8_t *gnrc_netif_hdr_get_dst_addr(const gnrc_netif_hdr_t *hdr)
* @param[in] addr new destination address * @param[in] addr new destination address
* @param[in] addr_len *addr* length * @param[in] addr_len *addr* length
*/ */
static inline void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t *hdr, uint8_t *addr, static inline void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t *hdr,
uint8_t addr_len) const uint8_t *addr,
uint8_t addr_len)
{ {
if (addr_len != hdr->dst_l2addr_len) { if (addr_len != hdr->dst_l2addr_len) {
return; return;
...@@ -272,7 +274,8 @@ static inline int gnrc_netif_hdr_ipv6_iid_from_dst(const gnrc_netif_t *netif, ...@@ -272,7 +274,8 @@ static inline int gnrc_netif_hdr_ipv6_iid_from_dst(const gnrc_netif_t *netif,
* @return The generic network layer header on success. * @return The generic network layer header on success.
* @return NULL on error. * @return NULL on error.
*/ */
gnrc_pktsnip_t *gnrc_netif_hdr_build(uint8_t *src, uint8_t src_len, uint8_t *dst, uint8_t dst_len); gnrc_pktsnip_t *gnrc_netif_hdr_build(const uint8_t *src, uint8_t src_len,
const uint8_t *dst, uint8_t dst_len);
/** /**
* @brief Convenience function to get the corresponding interface struct for * @brief Convenience function to get the corresponding interface struct for
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
#include "net/gnrc/netif/hdr.h" #include "net/gnrc/netif/hdr.h"
gnrc_pktsnip_t *gnrc_netif_hdr_build(uint8_t *src, uint8_t src_len, uint8_t *dst, uint8_t dst_len) gnrc_pktsnip_t *gnrc_netif_hdr_build(const uint8_t *src, uint8_t src_len,
const uint8_t *dst, uint8_t dst_len)
{ {
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL, gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL,
sizeof(gnrc_netif_hdr_t) + src_len + dst_len, sizeof(gnrc_netif_hdr_t) + src_len + dst_len,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment