📄 intelmobilenetworkclassprovider.h
字号:
/*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/#pragma once//==============================================================================// IntelMobileNetworkClassProvider.h//// Declaration of the class for the default network provider for IntelMobile. //// //==============================================================================#define IFNAMSIZ 100#include "inc/network/network_NetworkAdapterClassObject.h"#include "inc/network/network_LinkProtocolClassObject.h"#include "Instance_NetworkAdapter.h"#include "Instance_WiredAdapter.h"#include "Instance_RadioAdapter.h"#include "Instance_LinkProtocol.h"#include "Instance_Protocol802_3.h"#include "Instance_Protocol802_11.h"#include "netdev_lib.h"enum eMediaInUse{ eMediaInUse_eFalse = 0, eMediaInUse_eTrue, eMediaInUse_eNoDevice};struct _netdev_cache{ netdev_dev dev; netdev_enabled enabled; netdev_running running;};typedef _netdev_cache netdev_cache;class NetworkClassProvider : public IClassProvider, public LoggerBase//, public Helper{public: // Added initialization of the logger members by accessing the global layermanager // NetworkClassProvider() : LoggerBase ( GetLayer()->GetLog() ), m_szVersion ( IntelMobileText( "1.1" ) ), // Highest version of IntelMobile framework supported m_szType ( IntelMobileText( "Network" ) ), // Network, Battery, Processor, etc. m_szName ( IntelMobileText( "NetworkClassProvider" ) ), // DLL name m_NetworkAdapterClass ( GetLayer()->GetLog() ), m_WiredAdapterClass ( GetLayer()->GetLog() ), m_RadioAdapterClass ( GetLayer()->GetLog() ), m_LinkProtocolClass ( GetLayer()->GetLog() ), m_Protocol802_11Class ( GetLayer()->GetLog() ), m_Protocol802_3Class ( GetLayer()->GetLog() ), m_ProtocolWwanClass ( GetLayer()->GetLog() ), m_ProtocolCdmaClass ( GetLayer()->GetLog() ), m_ProtocolGprsClass ( GetLayer()->GetLog() ), m_ProtocolBluetoothPanClass ( GetLayer()->GetLog() ), m_lThreadsCreated ( 0 ), m_lInitialized ( 0 ), m_lScanned ( 0 ), m_hWin32NetThreadHandle ( INVALID_HANDLE_VALUE ), m_dwListenThreadId ( 0 ) { InitializeCriticalSection( &m_DefaultProviderCS ); Initialize(); } ~NetworkClassProvider();public: // ProviderClass methods bool Load(); bool Unload(); bool Scan(); const IntelMobileString& GetVersion() { return m_szVersion; } const IntelMobileString& GetName() { return m_szName; } const IntelMobileString& GetType() { return m_szType; } // IClassProvider methods ServerClassObject& GetClassObject( /*in*/ const IntelMobileString& sType ); ServerInstanceObject* CreateInstance( /*in*/ const IntelMobileString& externalKey, /*in*/ const IntelMobileString& internalKey, /*in*/ const IntelMobileString& sType );private: // Wrappers for Objects ServerNetworkAdapterClassObject m_NetworkAdapterClass; ServerWiredAdapterClassObject m_WiredAdapterClass; ServerRadioAdapterClassObject m_RadioAdapterClass; ServerLinkProtocolClassObject m_LinkProtocolClass; ServerProtocol802_11ClassObject m_Protocol802_11Class; ServerProtocol802_3ClassObject m_Protocol802_3Class; ServerProtocolWwanClassObject m_ProtocolWwanClass; ServerProtocolCdmaClassObject m_ProtocolCdmaClass; ServerProtocolGprsClassObject m_ProtocolGprsClass; ServerProtocolBluetoothPanClassObject m_ProtocolBluetoothPanClass; const IntelMobileString m_szVersion; const IntelMobileString m_szName; const IntelMobileString m_szType; vector<IScanInstanceProvider*> m_vtScanInstanceProvider; // Support methods and membersprivate: ServerInstanceObject* CreateInstanceAdapter( /*in*/ const IntelMobileString& externalKey, /*in*/ const IntelMobileString& internalKey ); ServerInstanceObject* CreateInstanceProtocol( /*in*/ const IntelMobileString& externalKey, /*in*/ const IntelMobileString& internalKey ); inline Lock() { EnterCriticalSection( &m_DefaultProviderCS ); } inline Unlock() { LeaveCriticalSection( &m_DefaultProviderCS ); } void Initialize(); HRESULT ProcessRouteChanges(); HRESULT RegisterForHwndDeviceNotifications();static DWORD WINAPI ListenForDeviceChanges( /*in*/ LPVOID param);static DWORD WINAPI ListenForRouteChanges( /*in*/ LPVOID param); long m_lThreadsCreated; long m_lInitialized; long m_lScanned; CRITICAL_SECTION m_DefaultProviderCS; HANDLE m_hWin32NetThreadHandle; DWORD m_dwListenThreadId;static bool m_bQuit;static HANDLE m_hDeviceThreadHandle;static DWORD m_dwDeviceListenThreadId; vector<netdev_cache> netdev_cache_list;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -