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

net/gnrc/ipv6_whitelist: Move config macros to 'CONFIG_' namespace

Macros that changed:
GNRC_IPV6_WHITELIST_SIZE -> CONFIG_GNRC_IPV6_WHITELIST_SIZE
This commit is contained in:
Leandro Lanzieri 2019-07-16 11:37:53 +02:00
parent c6b9f9509c
commit de2fbeb112
3 changed files with 10 additions and 10 deletions

View File

@ -37,8 +37,8 @@ extern "C" {
/**
* Maximum size of the whitelist.
*/
#ifndef GNRC_IPV6_WHITELIST_SIZE
#define GNRC_IPV6_WHITELIST_SIZE (8)
#ifndef CONFIG_GNRC_IPV6_WHITELIST_SIZE
#define CONFIG_GNRC_IPV6_WHITELIST_SIZE (8)
#endif
/** @} */

View File

@ -21,14 +21,14 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
ipv6_addr_t gnrc_ipv6_whitelist[GNRC_IPV6_WHITELIST_SIZE];
BITFIELD(gnrc_ipv6_whitelist_set, GNRC_IPV6_WHITELIST_SIZE);
ipv6_addr_t gnrc_ipv6_whitelist[CONFIG_GNRC_IPV6_WHITELIST_SIZE];
BITFIELD(gnrc_ipv6_whitelist_set, CONFIG_GNRC_IPV6_WHITELIST_SIZE);
static char addr_str[IPV6_ADDR_MAX_STR_LEN];
int gnrc_ipv6_whitelist_add(const ipv6_addr_t *addr)
{
for (int i = 0; i < GNRC_IPV6_WHITELIST_SIZE; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_WHITELIST_SIZE; i++) {
if (!bf_isset(gnrc_ipv6_whitelist_set, i)) {
bf_set(gnrc_ipv6_whitelist_set, i);
memcpy(&gnrc_ipv6_whitelist[i], addr, sizeof(*addr));
@ -42,7 +42,7 @@ int gnrc_ipv6_whitelist_add(const ipv6_addr_t *addr)
void gnrc_ipv6_whitelist_del(const ipv6_addr_t *addr)
{
for (int i = 0; i < GNRC_IPV6_WHITELIST_SIZE; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_WHITELIST_SIZE; i++) {
if (ipv6_addr_equal(addr, &gnrc_ipv6_whitelist[i])) {
bf_unset(gnrc_ipv6_whitelist_set, i);
DEBUG("IPv6 whitelist: unwhitelisted %s\n",
@ -53,7 +53,7 @@ void gnrc_ipv6_whitelist_del(const ipv6_addr_t *addr)
bool gnrc_ipv6_whitelisted(const ipv6_addr_t *addr)
{
for (int i = 0; i < GNRC_IPV6_WHITELIST_SIZE; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_WHITELIST_SIZE; i++) {
if (bf_isset(gnrc_ipv6_whitelist_set, i) &&
ipv6_addr_equal(addr, &gnrc_ipv6_whitelist[i])) {
return true;

View File

@ -20,13 +20,13 @@
#include "net/gnrc/ipv6/whitelist.h"
extern ipv6_addr_t gnrc_ipv6_whitelist[GNRC_IPV6_WHITELIST_SIZE];
extern BITFIELD(gnrc_ipv6_whitelist_set, GNRC_IPV6_WHITELIST_SIZE);
extern ipv6_addr_t gnrc_ipv6_whitelist[CONFIG_GNRC_IPV6_WHITELIST_SIZE];
extern BITFIELD(gnrc_ipv6_whitelist_set, CONFIG_GNRC_IPV6_WHITELIST_SIZE);
void gnrc_ipv6_whitelist_print(void)
{
char addr_str[IPV6_ADDR_MAX_STR_LEN];
for (int i = 0; i < GNRC_IPV6_WHITELIST_SIZE; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_WHITELIST_SIZE; i++) {
if (bf_isset(gnrc_ipv6_whitelist_set, i)) {
puts(ipv6_addr_to_str(addr_str, &gnrc_ipv6_whitelist[i], sizeof(addr_str)));
}