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 <algorithm>
16
17
#include <
openvpn/common/rc.hpp
>
18
#include <
openvpn/addr/ip.hpp
>
19
20
namespace
openvpn::IP
{
21
22
// A list of unique IP addresses
23
class
AddrList
:
public
std::vector<Addr>,
public
RC
<thread_unsafe_refcount>
24
{
25
public
:
26
using
Ptr
=
RCPtr<AddrList>
;
27
28
void
add
(
const
Addr
&a)
29
{
30
if
(!
exists
(a))
31
push_back(a);
32
}
33
34
bool
exists
(
const
Addr
&a)
const
35
{
36
return
std::ranges::find(*
this
, a) != end();
37
}
38
39
#if 0
40
void
dump()
const
41
{
42
OPENVPN_LOG
(
"******* AddrList::dump"
);
43
for
(
const
auto
& i : *this)
44
{
45
OPENVPN_LOG
(i.to_string());
46
}
47
}
48
#endif
49
};
50
}
// namespace openvpn::IP
51
52
#endif
openvpn::IP::AddrList
Definition
addrlist.hpp:24
openvpn::IP::AddrList::exists
bool exists(const Addr &a) const
Definition
addrlist.hpp:34
openvpn::IP::AddrList::add
void add(const Addr &a)
Definition
addrlist.hpp:28
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:908
ip.hpp
OPENVPN_LOG
#define OPENVPN_LOG(args)
Definition
logdatetime.hpp:23
openvpn::IP
Definition
addrlist.hpp:20
rc.hpp
openvpn
addr
addrlist.hpp
Generated by
1.9.8