l2filter.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2017 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
31 #include <stddef.h>
32 #include <stdint.h>
33 #include <stdbool.h>
34 #include <errno.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
48 #ifndef CONFIG_L2FILTER_ADDR_MAXLEN
49 #define CONFIG_L2FILTER_ADDR_MAXLEN (8U)
50 #endif
51 
55 #ifndef CONFIG_L2FILTER_LISTSIZE
56 #define CONFIG_L2FILTER_LISTSIZE (8U)
57 #endif
67 typedef struct {
69  size_t addr_len;
70 } l2filter_t;
71 
88 int l2filter_add(l2filter_t *list, const void *addr, size_t addr_len);
89 
104 int l2filter_rm(l2filter_t *list, const void *addr, size_t addr_len);
105 
127 bool l2filter_pass(const l2filter_t *list, const void *addr, size_t addr_len);
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
#define CONFIG_L2FILTER_ADDR_MAXLEN
Maximal length of addresses that can be stored in the filter list.
Definition: l2filter.h:49
int l2filter_rm(l2filter_t *list, const void *addr, size_t addr_len)
Remove an entry from the given filter list.
bool l2filter_pass(const l2filter_t *list, const void *addr, size_t addr_len)
Check if the given address passes the set filters.
int l2filter_add(l2filter_t *list, const void *addr, size_t addr_len)
Add an entry to a devices filter list.
Filter list entries.
Definition: l2filter.h:67
size_t addr_len
address length in byte
Definition: l2filter.h:69