OpenVPN 3 Core Library
Loading...
Searching...
No Matches
addrlist.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
#ifndef OPENVPN_ADDR_ADDRLIST_H
13
#define OPENVPN_ADDR_ADDRLIST_H
14
15
#include <
openvpn/common/rc.hpp
>
16
#include <
openvpn/addr/ip.hpp
>
17
18
namespace
openvpn::IP
{
19
20
// A list of unique IP addresses
21
class
AddrList
:
public
std::vector<IP::Addr>,
public
RC
<thread_unsafe_refcount>
22
{
23
public
:
24
typedef
RCPtr<AddrList>
Ptr
;
25
26
void
add
(
const
IP::Addr
&a)
27
{
28
if
(!
exists
(a))
29
push_back(a);
30
}
31
32
bool
exists
(
const
IP::Addr
&a)
const
33
{
34
return
std::find(begin(), end(), a) != end();
35
}
36
37
#if 0
38
void
dump()
const
39
{
40
OPENVPN_LOG
(
"******* AddrList::dump"
);
41
for
(
const
auto
& i : *this)
42
{
43
OPENVPN_LOG
(i.to_string());
44
}
45
}
46
#endif
47
};
48
}
// namespace openvpn::IP
49
50
#endif
openvpn::IP::AddrList
Definition
addrlist.hpp:22
openvpn::IP::AddrList::Ptr
RCPtr< AddrList > Ptr
Definition
addrlist.hpp:24
openvpn::IP::AddrList::exists
bool exists(const IP::Addr &a) const
Definition
addrlist.hpp:32
openvpn::IP::AddrList::add
void add(const IP::Addr &a)
Definition
addrlist.hpp:26
openvpn::IP::Addr
Definition
ip.hpp:39
openvpn::RCPtr
The smart pointer class.
Definition
rc.hpp:119
openvpn::RC
Reference count base class for objects tracked by RCPtr. Disallows copying and assignment.
Definition
rc.hpp:912
ip.hpp
OPENVPN_LOG
#define OPENVPN_LOG(args)
Definition
logdatetime.hpp:23
openvpn::IP
Definition
addrlist.hpp:18
rc.hpp
openvpn
addr
addrlist.hpp
Generated by
1.9.8