From 037e7cc02b66a54d5dec19a6b93a7bf107a95a0e Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 28 3月 2020 22:29:12 +0800 Subject: [PATCH] documentation update (win32) and others --- src/library/os/execution_environment.hpp | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/library/os/execution_environment.hpp b/src/library/os/execution_environment.hpp index ce3fb63..97172e4 100644 --- a/src/library/os/execution_environment.hpp +++ b/src/library/os/execution_environment.hpp @@ -8,10 +8,21 @@ #ifndef SRC_LIBRARY_OS_VIRTUALIZATION_HPP_ #define SRC_LIBRARY_OS_VIRTUALIZATION_HPP_ +#include <string> + namespace license { +namespace os { + +/* + * windows bios sometimes reports vm names add execution environment detection from bios +const char *vmVendors[] = { + "VMware", "Microsoft Corporation", "Virtual Machine", "innotek GmbH", "PowerVM", "Bochs", "KVM"}; +*/ typedef enum { NONE, CONTAINER, VM } VIRTUALIZATION; + typedef enum { + PROV_UNKNOWN, ON_PREMISE, GOOGLE_CLOUD, AZURE_CLOUD, @@ -25,17 +36,28 @@ ALI_CLOUD } CLOUD_PROVIDER; - class ExecutionEnvironment { +private: + std::string m_sys_vendor; + std::string m_bios_vendor; + std::string m_bios_description; + public: - ExecutionEnvironment(){}; - virtual ~ExecutionEnvironment(){}; - VIRTUALIZATION getVirtualization(); - bool is_cloud(); - bool is_docker(); - CLOUD_PROVIDER getCloudProvider(); + ExecutionEnvironment(); + ~ExecutionEnvironment(){}; + VIRTUALIZATION getVirtualization() const; + bool is_cloud() const; + bool is_docker() const; + // detect if it's a kind of container technology (docker or lxc) + bool is_container() const; + CLOUD_PROVIDER getCloudProvider() const; + const std::string& bios_vendor() const { return m_bios_vendor; }; + const std::string& sys_vendor() const { return m_sys_vendor; }; + const std::string& bios_description() const { return m_bios_description; }; + // VIRTUALIZATION_DETAIL getVirtualizationDetail() const; //as reported by the bios }; +} // namespace os } // namespace license #endif /* SRC_LIBRARY_OS_VIRTUALIZATION_HPP_ */ -- Gitblit v1.9.1