l2filter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
32 #ifndef NET_L2FILTER_H
33 #define NET_L2FILTER_H
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 #include <stdbool.h>
38 #include <errno.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
52 #ifndef CONFIG_L2FILTER_ADDR_MAXLEN
53 #define CONFIG_L2FILTER_ADDR_MAXLEN (8U)
54 #endif
55 
59 #ifndef CONFIG_L2FILTER_LISTSIZE
60 #define CONFIG_L2FILTER_LISTSIZE (8U)
61 #endif
71 typedef struct {
73  size_t addr_len;
74 } l2filter_t;
75 
90 int l2filter_add(l2filter_t *list, const void *addr, size_t addr_len);
91 
106 int l2filter_rm(l2filter_t *list, const void *addr, size_t addr_len);
107 
129 bool l2filter_pass(const l2filter_t *list, const void *addr, size_t addr_len);
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* NET_L2FILTER_H */
#define CONFIG_L2FILTER_ADDR_MAXLEN
Maximal length of addresses that can be stored in the filter list.
Definition: l2filter.h:53
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:71
size_t addr_len
address length in byte
Definition: l2filter.h:73