📄 network_networkadapterinstanceobject.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.
*/#ifndef _NETWORK_NETWORKADAPTERINSTANCEOBJECT_H#define _NETWORK_NETWORKADAPTERINSTANCEOBJECT_H#include "inc/framework/base_InstanceObject.h"#include "inc/framework/base_Property.h"#include "inc/network/network_LinkProtocolInstanceObject.h"class ServerNetworkAdapterInstanceObject;CLASSEXPANSION ( AdapterLinkClass, IntelMobileNetworkAdapterAdapterLinkEnum, "AdapterLink", false, false, 5000 );CLASSEXPANSION ( AutoSenseClass, IntelMobileBool, "AutoSense", false, false, 5000 );CLASSEXPANSION ( DescriptionClass, IntelMobileString, "Description", false, false, 5000 );CLASSEXPANSION ( DeviceIdClass, IntelMobileString, "DeviceId", false, false, 5000 );CLASSEXPANSION ( FullDeviceIdClass, IntelMobileString, "FullDeviceId", false, true, 5000 );//CLASSEXPANSION ( DevicePresentClass, IntelMobileBool, "DevicePresent", false, false, 5000 );CLASSEXPANSION ( EnabledClass, IntelMobileBool, "Enabled", false, false, 5000 );CLASSEXPANSION ( IndexClass, IntelMobileInt, "Index", false, false, 5000 );CLASSEXPANSION ( ManufacturerClass, IntelMobileString, "Manufacturer", false, true, 5000 );CLASSEXPANSION ( NameClass, IntelMobileString, "Name", false, false, 5000 );CLASSEXPANSION ( NdiLowerClass, IntelMobileString, "NdiLower", false, false, 5000 );CLASSEXPANSION ( NdiUpperClass, IntelMobileString, "NdiUpper", false, false, 5000 );CLASSEXPANSION ( ConnectionIdClass, IntelMobileString, "ConnectionId", false, false, 5000 );CLASSEXPANSION ( ConnectionStateClass, IntelMobileNetworkAdapterConnectionStateEnum, "ConnectionState", false, false, 5000 );CLASSEXPANSION ( PnpDeviceIdClass, IntelMobileString, "PnpDeviceId", false, false, 5000 );CLASSARRAYEXPANSION ( ProtocolsClass, IntelMobileString, "Protocols", false, false, 5000 );//CLASSEXPANSION ( MaxNumberControlledClass, IntelMobileUInt, "MaxNumberControlled", false, true, 5000 );//CLASSEXPANSION ( MaxSpeedClass, IntelMobileUInt64, "MaxSpeed", false, true, 5000 );//CLASSEXPANSION ( SpeedClass, IntelMobileUInt64, "Speed", false, false, 5000 );//CLASSEXPANSION ( ObjectStateClass, IntelMobileString, "ObjectState", false, false, 5000 );//CLASSEXPANSION ( LogicalDeviceStateClass, IntelMobileString, "LogicalDeviceState", false, false, 5000 );//CLASSEXPANSION ( LinkedTimeClass, IntelMobileUInt64, "LinkedTime", false, false, 5000 );//CLASSEXPANSION ( PacketTxCountClass, IntelMobileUInt64, "PacketTxCount", false, false, 5000 );//CLASSEXPANSION ( PacketRxCountClass, IntelMobileUInt64, "PacketRxCount", false, false, 5000 );class ServerNetworkAdapterInstanceObject : public ServerInstanceObject{public: // SCR#29: Remove Logger from server objects. // Removed redundant constructor and private CLog* member // ServerNetworkAdapterInstanceObject( const IntelMobileString& szKey, CLog& theLog, const IntelMobileString sType = IntelMobileText("NetworkAdapter") ); virtual ~ServerNetworkAdapterInstanceObject() {} // Propertiespublic: AdapterLinkClass AdapterLink; // in the form: 0 AutoSenseClass AutoSense; // in the form: 1 DescriptionClass Description; // in the form: "Intel(R) PRO/Wireless LAN 2100 3A Mini PCI Adapter" DeviceIdClass DeviceId; // in the form: "{434ECC58-6872-4327-9CEB-A58DCD0EA126}" FullDeviceIdClass FullDeviceId; // in the form: "\\?\PCI#VEN_8086&DEV_1043&SUBSYS_25658086&REV_04#4&39a85202&0&18F0#{ad498944-762f-11d0-8dcb-00c04fc3358c}\{434ECC58-6872-4327-9CEB-A58DCD0EA126}" EnabledClass Enabled; // in the form: 1 //DevicePresentClass DevicePresent; // in the form: 1 IndexClass Index; // in the form: 13 ManufacturerClass Manufacturer; // in the form: "Intel(R) Corporation" NameClass Name; // in the form: "Intel(R) PRO/Wireless LAN 2100 3A Mini PCI Adapter" NdiLowerClass NdiLower; // in the form: "ethernet" NdiUpperClass NdiUpper; // in the form: "ndis5,wifipro" ConnectionIdClass ConnectionId; // in the form: "Local Area Connection" ConnectionStateClass ConnectionState; // in the form: 2 PnpDeviceIdClass PnpDeviceId; // in the form: "PCI\VEN_8086&DEV_1043&SUBSYS_25658086&REV_04\4&39a85202&0&18F0" ProtocolsClass Protocols; //MaxNumberControlledClass MaxNumberControlled; //MaxSpeedClass MaxSpeed; //SpeedClass Speed; //ObjectStateClass ObjectState; //LogicalDeviceStateClass LogicalDeviceState; //LinkedTimeClass LinkedTime; //PacketTxCountClass PacketTxCount; //PacketRxCountClass PacketRxCount; // Methodspublic: // associates protocol with device (done only in Scan()) virtual bool AddProtocol ( /*out*/ ServerLinkProtocolInstanceObject* pProtocol ) { bool bRet = false; IntelMobileString sValue = pProtocol->GetKey(); if (sValue[0] == NULL) { throw (sValue[0]); } if ( sValue[0] != NULL ) { // Don't add the protocol twice size_t iProtocols = Protocols.GetSize(); bool bFound = false; for ( size_t i = 0; i < iProtocols; i++ ) { if ( Protocols.GetValue( i ) == sValue ) { bFound = true; bRet = true; break; } } if ( !bFound ) { Protocols.InsertValue( sValue ); bRet = true; } } else bRet = false; return bRet; } // Removes protocol from the Protocol ArrayString member and physically deletes the memory allocation for the Protocol InstanceObject virtual bool RemoveProtocol ( /*in*/ ServerLinkProtocolInstanceObject* pProtocol, /*in*/ const IntelMobileString& sProtocolKey ) { // Terrible implementation because of the ArrayProperty hack. // If ArrayProperties natively supported deletes, this would be much simpler bool bRet = false; // Remove the string from the ProtocolClass property (update the size of the property) size_t iProtocols = Protocols.GetSize(); vector<IntelMobileString> sStringArray; // make a copy of the strings in the protocol property for ( size_t i = 0; i < iProtocols; i++ ) { sStringArray.push_back( Protocols.GetValue( i ) ); } Protocols.Clear(); for (size_t j = 0; j < (size_t)iProtocols; j++ ) { if ( sProtocolKey != sStringArray[j] ) { Protocols.InsertValue( sStringArray[j] ); } } // Remove the protocol from the collection pProtocol->RemoveInstance(); return bRet; }};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -