OpenVPN 3 Core Library
Loading...
Searching...
No Matches
proto_context_options.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// Helper class to parse certain options needed by ProtoContext.
13
14#ifndef OPENVPN_SSL_PROTO_CONTEXT_OPTIONS_H
15#define OPENVPN_SSL_PROTO_CONTEXT_OPTIONS_H
16
17#include <string>
18
21
22namespace openvpn {
23struct ProtoContextCompressionOptions : public RC<thread_safe_refcount>
24{
26
33
38
39 bool is_comp() const
40 {
42 }
43 bool is_comp_asym() const
44 {
46 }
47
48 void parse_compression_mode(const std::string &mode)
49 {
50 if (mode == "no")
52 else if (mode == "yes")
54 else if (mode == "asym")
56 else
57 OPENVPN_THROW_ARG1(option_error, ERR_INVALID_OPTION_VAL, "error parsing compression mode: " << mode);
58 }
59
61};
62} // namespace openvpn
63
64#endif
The smart pointer class.
Definition rc.hpp:119
Reference count base class for objects tracked by RCPtr. Disallows copying and assignment.
Definition rc.hpp:912
#define OPENVPN_THROW_ARG1(exc, arg, stuff)
RCPtr< ProtoContextCompressionOptions > Ptr
void parse_compression_mode(const std::string &mode)