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

sys/net/netif: constify netif access

This commit is contained in:
Benjamin Valentin 2023-12-15 16:50:21 +01:00
parent 208790a5f1
commit 2f9c68dabc
3 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,7 @@
#include "lwip/netifapi.h"
#include "net/netif.h"
int netif_get_name(netif_t *iface, char *name)
int netif_get_name(const netif_t *iface, char *name)
{
lwip_netif_t *lwip_netif = (lwip_netif_t*) iface;
struct netif *netif = &lwip_netif->lwip_netif;
@ -34,7 +34,7 @@ int netif_get_name(netif_t *iface, char *name)
return res;
}
int netif_get_opt(netif_t *iface, netopt_t opt, uint16_t context,
int netif_get_opt(const netif_t *iface, netopt_t opt, uint16_t context,
void *value, size_t max_len)
{
(void)context;
@ -83,7 +83,7 @@ int netif_get_opt(netif_t *iface, netopt_t opt, uint16_t context,
return res;
}
int netif_set_opt(netif_t *iface, netopt_t opt, uint16_t context,
int netif_set_opt(const netif_t *iface, netopt_t opt, uint16_t context,
void *value, size_t value_len)
{
(void)context;

View File

@ -104,7 +104,7 @@ netif_t *netif_iter(const netif_t *last);
* @return length of @p name on success
*/
int netif_get_name(netif_t *netif, char *name);
int netif_get_name(const netif_t *netif, char *name);
/**
* @brief Gets the numeric identifier of an interface
@ -170,7 +170,7 @@ netif_t *netif_get_by_id(int16_t id);
* @return Number of bytes written to @p value.
* @return `< 0` on error, 0 on success.
*/
int netif_get_opt(netif_t *netif, netopt_t opt, uint16_t context,
int netif_get_opt(const netif_t *netif, netopt_t opt, uint16_t context,
void *value, size_t max_len);
/**
@ -187,7 +187,7 @@ int netif_get_opt(netif_t *netif, netopt_t opt, uint16_t context,
* @return Number of bytes used from @p value.
* @return `< 0` on error, 0 on success.
*/
int netif_set_opt(netif_t *netif, netopt_t opt, uint16_t context,
int netif_set_opt(const netif_t *netif, netopt_t opt, uint16_t context,
void *value, size_t value_len);
/**

View File

@ -24,7 +24,7 @@
#include "net/netif.h"
int netif_get_name(netif_t *iface, char *name)
int netif_get_name(const netif_t *iface, char *name)
{
gnrc_netif_t *netif = container_of(iface, gnrc_netif_t, netif);
@ -45,14 +45,14 @@ netif_t *netif_get_by_id(int16_t id)
return &gnrc_netif_get_by_pid((kernel_pid_t)id)->netif;
}
int netif_get_opt(netif_t *iface, netopt_t opt, uint16_t context,
int netif_get_opt(const netif_t *iface, netopt_t opt, uint16_t context,
void *value, size_t max_len)
{
const gnrc_netif_t *netif = container_of(iface, gnrc_netif_t, netif);
return gnrc_netapi_get(netif->pid, opt, context, value, max_len);
}
int netif_set_opt(netif_t *iface, netopt_t opt, uint16_t context,
int netif_set_opt(const netif_t *iface, netopt_t opt, uint16_t context,
void *value, size_t value_len)
{
const gnrc_netif_t *netif = container_of(iface, gnrc_netif_t, netif);