1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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

gnrc_netif_hdr: make in parameters const
This commit is contained in:
Sebastian Meiling 2019-02-21 19:01:44 +02:00 committed by GitHub
commit e804d784d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -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_len *addr* length
*/
static inline void gnrc_netif_hdr_set_src_addr(gnrc_netif_hdr_t *hdr, uint8_t *addr,
uint8_t addr_len)
static inline void gnrc_netif_hdr_set_src_addr(gnrc_netif_hdr_t *hdr,
const uint8_t *addr,
uint8_t addr_len)
{
if (addr_len != hdr->src_l2addr_len) {
return;
@ -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_len *addr* length
*/
static inline void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t *hdr, uint8_t *addr,
uint8_t addr_len)
static inline void gnrc_netif_hdr_set_dst_addr(gnrc_netif_hdr_t *hdr,
const uint8_t *addr,
uint8_t addr_len)
{
if (addr_len != hdr->dst_l2addr_len) {
return;
@ -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 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

View File

@ -15,7 +15,8 @@
#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,
sizeof(gnrc_netif_hdr_t) + src_len + dst_len,