OpenVPN 3 Core Library
Loading...
Searching...
No Matches
demangle.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// Demangle a C++ name (GCC only)
13
14#ifndef OPENVPN_COMMON_DEMANGLE_H
15#define OPENVPN_COMMON_DEMANGLE_H
16
17#include <cxxabi.h>
18
19#include <string>
20#include <memory>
21
22namespace openvpn {
23
24inline std::string cxx_demangle(const char *mangled_name)
25{
26 int status;
27 std::unique_ptr<char[]> realname;
28
29 realname.reset(abi::__cxa_demangle(mangled_name, 0, 0, &status));
30 if (!status)
31 return std::string(realname.get());
32 else
33 return "DEMANGLE_ERROR";
34}
35
36} // namespace openvpn
37
38#endif
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
std::string cxx_demangle(const char *mangled_name)
Definition demangle.hpp:24