#ifndef UTILITY_H #define UTILITY_H namespace icinga { /** * Utility * * Utility functions. */ class I2_BASE_API Utility { private: static bool m_SSLInitialized; Utility(void); static void InitializeOpenSSL(void); public: /** * GetTypeName * * Returns the type name of an object (using RTTI). */ template static string GetTypeName(const T& value) { string klass = typeid(value).name(); #ifdef HAVE_GCC_ABI_DEMANGLE int status; char *realname = abi::__cxa_demangle(klass.c_str(), 0, 0, &status); if (realname != NULL) { klass = string(realname); free(realname); } #endif /* HAVE_GCC_ABI_DEMANGLE */ return klass; } static void Daemonize(void); static shared_ptr MakeSSLContext(string pubkey, string privkey, string cakey); static string GetCertificateCN(const shared_ptr& certificate); static shared_ptr GetX509Certificate(string pemfile); }; } #endif /* UTILITY_H */