diff --git a/MEWMIProv/Src/WSmanCommands.cpp b/MEWMIProv/Src/WSmanCommands.cpp index ee56c6fe..cc8d2482 100644 --- a/MEWMIProv/Src/WSmanCommands.cpp +++ b/MEWMIProv/Src/WSmanCommands.cpp @@ -14,7 +14,7 @@ #include "WSmanCommands.h" #include "SIOWSManClient.h" #include "KVMWSManClient.h" -#include "RedirectionServiceWSManClient.h" +#include "AMTRedirectionServiceWSManClient.h" #include "StringManipulator.h" using namespace std; @@ -40,7 +40,7 @@ UINT32 WSmanCommands::TerminateKVMSession(void) UINT32 WSmanCommands::isIDEREnabled(bool *enabled) { - RedirectionServiceWSManClient redirectionClient; + AMTRedirectionServiceWSManClient redirectionClient; unsigned short state; *enabled = false; @@ -69,7 +69,7 @@ UINT32 WSmanCommands::isIDEREnabled(bool *enabled) UINT32 WSmanCommands::isSOLEnabled(bool *enabled) { - RedirectionServiceWSManClient redirectionClient; + AMTRedirectionServiceWSManClient redirectionClient; unsigned short state; *enabled = false; diff --git a/WsmanClient/AMTRedirectionServiceWSManClient.cpp b/WsmanClient/AMTRedirectionServiceWSManClient.cpp index a142db96..95138af5 100644 --- a/WsmanClient/AMTRedirectionServiceWSManClient.cpp +++ b/WsmanClient/AMTRedirectionServiceWSManClient.cpp @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2009-2019 Intel Corporation + * Copyright (C) 2009-2020 Intel Corporation */ /*++ @@ -56,6 +56,18 @@ bool AMTRedirectionServiceWSManClient::TerminateSession(unsigned int SessionType return true; } +bool AMTRedirectionServiceWSManClient::RedirectionState(unsigned short *state) +{ + if (!Init(true)) + return false; + if (m_service.EnabledStateExists()) + { + *state = m_service.EnabledState(); + return true; + } + return false; +} + bool AMTRedirectionServiceWSManClient::Init(bool forceGet) { if (!forceGet && m_isInit) diff --git a/WsmanClient/AMTRedirectionServiceWSManClient.h b/WsmanClient/AMTRedirectionServiceWSManClient.h index e910be66..24e64c9a 100644 --- a/WsmanClient/AMTRedirectionServiceWSManClient.h +++ b/WsmanClient/AMTRedirectionServiceWSManClient.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2009-2019 Intel Corporation + * Copyright (C) 2009-2020 Intel Corporation */ #pragma once @@ -24,6 +24,7 @@ class WSMAN_DLL_API AMTRedirectionServiceWSManClient : AMTRedirectionServiceWSManClient(void); virtual ~AMTRedirectionServiceWSManClient(void); bool TerminateSession(unsigned int SessionType); + bool RedirectionState(unsigned short *state); bool Init(bool forceGet= false); private: diff --git a/WsmanClient/CMakeLists.txt b/WsmanClient/CMakeLists.txt index 0096d85f..02241c11 100644 --- a/WsmanClient/CMakeLists.txt +++ b/WsmanClient/CMakeLists.txt @@ -1,5 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -# Copyright (C) 2010-2019 Intel Corporation +# Copyright (C) 2010-2020 Intel Corporation cmake_minimum_required (VERSION 3.1) add_subdirectory ("${TOP_DIR}/CIM_Framework" "CIM_Framework") @@ -21,7 +21,6 @@ add_library (LmsWsmanClient SHARED KVMScreenSettingClient.cpp KVMWSManClient.cpp PowerManagementCapabilitiesWsManClient.cpp - RedirectionServiceWSManClient.cpp SIOWSManClient.cpp SyncIpClient.cpp TimeSynchronizationClient.cpp diff --git a/WsmanClient/RedirectionServiceWSManClient.cpp b/WsmanClient/RedirectionServiceWSManClient.cpp deleted file mode 100644 index 94449013..00000000 --- a/WsmanClient/RedirectionServiceWSManClient.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* - * Copyright (C) 2009-2019 Intel Corporation - */ -/*++ - -@file: RedirectionServiceWSManClient.cpp - ---*/ - -#include "RedirectionServiceWSManClient.h" -#include "global.h" -#include "WsmanClientCatch.h" - -RedirectionServiceWSManClient::RedirectionServiceWSManClient() : m_isInit(false) -{ -} - -RedirectionServiceWSManClient::~RedirectionServiceWSManClient() -{ -} - -bool RedirectionServiceWSManClient::RedirectionState(unsigned short *state) -{ - if (!Init(true)) - return false; - if (m_service.EnabledStateExists()) - { - *state = m_service.EnabledState(); - return true; - } - return false; -} - -bool RedirectionServiceWSManClient::Init(bool forceGet) -{ - if (!forceGet && m_isInit) - { - return true; - } - m_isInit = false; - - try - { - if (!m_endpoint) - SetEndpoint(); - //Lock WsMan to prevent reentry - std::lock_guard lock(WsManSemaphore()); - m_service.WsmanClient(m_client.get()); - m_service.Get(); - m_isInit = true; - } - CATCH_exception("RedirectionServiceWSManClient::Init") - - return m_isInit; -} \ No newline at end of file diff --git a/WsmanClient/RedirectionServiceWSManClient.h b/WsmanClient/RedirectionServiceWSManClient.h deleted file mode 100644 index 93626688..00000000 --- a/WsmanClient/RedirectionServiceWSManClient.h +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* - * Copyright (C) 2009-2019 Intel Corporation - */ -/*++ - -@file: RedirectioServiceWSManClient.h - ---*/ - -#ifndef _REDIRECTION_SERVICE_WSMAN_CLIENT_H -#define _REDIRECTION_SERVICE_WSMAN_CLIENT_H - -#include "AMT_RedirectionService.h" -#include "BaseWSManClient.h" - -class WSMAN_DLL_API RedirectionServiceWSManClient : public BaseWSManClient -{ -public: - RedirectionServiceWSManClient(); - virtual ~RedirectionServiceWSManClient(); - - /*Actual soap actions!*/ - - bool RedirectionState(unsigned short* state); - bool Init(bool forceGet = false); -private: - bool m_isInit; - - LOCK_BEFORE; - Intel::Manageability::Cim::Typed::AMT_RedirectionService m_service; - UNLOCK_AFTER; -}; - -#endif //_REDIRECTION_SERVICE_WSMAN_CLIENT_H \ No newline at end of file