OpenVPN 3 Core Library
Loading...
Searching...
No Matches
mode.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_COMMON_MODE_H
13
#define OPENVPN_COMMON_MODE_H
14
15
// A client/server mode class.
16
17
namespace
openvpn
{
18
class
Mode
19
{
20
public
:
21
enum
Type
22
{
23
CLIENT
,
24
SERVER
,
25
};
26
27
Mode
()
28
:
type_
(
CLIENT
)
29
{
30
}
31
explicit
Mode
(
const
Type
t)
32
:
type_
(t)
33
{
34
}
35
36
bool
is_server
()
const
37
{
38
return
type_
==
SERVER
;
39
}
40
bool
is_client
()
const
41
{
42
return
type_
==
CLIENT
;
43
}
44
45
bool
operator==
(
const
Mode
&other)
46
{
47
return
type_
== other.
type_
;
48
}
49
50
bool
operator!=
(
const
Mode
&other)
51
{
52
return
type_
!= other.
type_
;
53
}
54
55
const
char
*
str
()
const
56
{
57
switch
(
type_
)
58
{
59
case
CLIENT
:
60
return
"CLIENT"
;
61
case
SERVER
:
62
return
"SERVER"
;
63
default
:
64
return
"UNDEF_MODE"
;
65
}
66
}
67
68
private
:
69
Type
type_
;
70
};
71
}
// namespace openvpn
72
73
#endif
// OPENVPN_COMMON_MODE_H
openvpn::Mode
Definition
mode.hpp:19
openvpn::Mode::operator==
bool operator==(const Mode &other)
Definition
mode.hpp:45
openvpn::Mode::is_server
bool is_server() const
Definition
mode.hpp:36
openvpn::Mode::is_client
bool is_client() const
Definition
mode.hpp:40
openvpn::Mode::Type
Type
Definition
mode.hpp:22
openvpn::Mode::CLIENT
@ CLIENT
Definition
mode.hpp:23
openvpn::Mode::SERVER
@ SERVER
Definition
mode.hpp:24
openvpn::Mode::Mode
Mode()
Definition
mode.hpp:27
openvpn::Mode::str
const char * str() const
Definition
mode.hpp:55
openvpn::Mode::Mode
Mode(const Type t)
Definition
mode.hpp:31
openvpn::Mode::operator!=
bool operator!=(const Mode &other)
Definition
mode.hpp:50
openvpn::Mode::type_
Type type_
Definition
mode.hpp:69
openvpn
Definition
ovpncli.cpp:97
openvpn
common
mode.hpp
Generated by
1.9.8