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 
31 #ifndef NET_L2FILTER_H
32 #define NET_L2FILTER_H
33 
34 #include <stddef.h>
35 #include <stdint.h>
36 #include <stdbool.h>
37 #include <errno.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
51 #ifndef CONFIG_L2FILTER_ADDR_MAXLEN
52 #define CONFIG_L2FILTER_ADDR_MAXLEN (8U)
53 #endif
54 
58 #ifndef CONFIG_L2FILTER_LISTSIZE
59 #define CONFIG_L2FILTER_LISTSIZE (8U)
60 #endif
70 typedef struct {
72  size_t addr_len;
73 } l2filter_t;
74 
89 int l2filter_add(l2filter_t *list, const void *addr, size_t addr_len);
90 
105 int l2filter_rm(l2filter_t *list, const void *addr, size_t addr_len);
106 
128 bool l2filter_pass(const l2filter_t *list, const void *addr, size_t addr_len);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* NET_L2FILTER_H */
#define CONFIG_L2FILTER_ADDR_MAXLEN
Maximal length of addresses that can be stored in the filter list.
Definition: l2filter.h:52
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:70
size_t addr_len
address length in byte
Definition: l2filter.h:72