Blame view

RIOT/sys/include/net/gnrc/ipv6/blacklist.h 1.76 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  /*
   * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
   * Copyright (C) 2016 Martin Landsmann <martin.landsmann@haw-hamburg.de>
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   */
  
  /**
   * @defgroup    net_gnrc_ipv6_blacklist IPv6 address blacklist
   * @ingroup     net_gnrc_ipv6
   * @brief       This refuses IPv6 addresses that are defined in this list.
   * @{
   *
   * @file
   * @brief   IPv6 blacklist definitions
   *
   * @author  Martine Lenders <mlenders@inf.fu-berlin.de>
   * @author  Martin Landsmann <martin.landsmann@haw-hamburg.de>
   */
  #ifndef NET_GNRC_IPV6_BLACKLIST_H
  #define NET_GNRC_IPV6_BLACKLIST_H
  
  #include <stdbool.h>
  
  #include "net/ipv6/addr.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * Maximum size of the blacklist.
   */
  #ifndef GNRC_IPV6_BLACKLIST_SIZE
  #define GNRC_IPV6_BLACKLIST_SIZE    (8)
  #endif
  
  /**
   * @brief   Adds an IPv6 address to the blacklist.
   *
   * @param[in] addr  An IPv6 address.
   *
   * @return  0, on success.
   * @return  -1, if blacklist is full.
   */
  int gnrc_ipv6_blacklist_add(const ipv6_addr_t *addr);
  
  /**
   * @brief   Removes an IPv6 address from the blacklist.
   *
   * Addresses not in the blacklist will be ignored.
   *
   * @param[in] addr  An IPv6 address.
   */
  void gnrc_ipv6_blacklist_del(const ipv6_addr_t *addr);
  
  /**
   * @brief   Checks if an IPv6 address is blacklisted.
   *
   * @param[in] addr  An IPv6 address.
   *
   * @return  true, if @p addr is blacklisted.
   * @return  false, if @p addr is not blacklisted.
   */
  bool gnrc_ipv6_blacklisted(const ipv6_addr_t *addr);
  
  /**
   * @brief   Prints the blacklist.
   */
  void gnrc_ipv6_blacklist_print(void);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* NET_GNRC_IPV6_BLACKLIST_H */
  /** @} */