OpenVPN 3 Core Library
Loading...
Searching...
No Matches
option_error.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#pragma once
13
14#include <cassert>
16
17namespace openvpn {
18
19OPENVPN_EXCEPTION_WITH_CODE(option_error, ERR_PROFILE_OPTION, ERR_INVALID_OPTION_DNS, ERR_INVALID_OPTION_CRYPTO, ERR_INVALID_CONFIG, ERR_INVALID_OPTION_PUSHED, ERR_INVALID_OPTION_VAL);
20
23
24inline std::string option_error::code2string(option_error_code code)
25{
26 static const char *code_strings[] = {
27 "ERR_INVALID_OPTION_DNS",
28 "ERR_INVALID_OPTION_CRYPTO",
29 "ERR_INVALID_CONFIG",
30 "ERR_INVALID_OPTION_PUSHED",
31 "ERR_INVALID_OPTION_VAL"};
32
33 assert(code < sizeof(code_strings));
34 return code_strings[code];
35}
36
38
39} // namespace openvpn
#define OPENVPN_EXCEPTION_WITH_CODE(C, DEFAULT_CODE,...)