📄 winterdata.cpp
字号:
/* WinterData.cpp *//******************************************************************************************* Copyright 2002-2003 ATMEL Corporation. This file is part of ATMEL Wireless LAN Drivers. ATMEL Wireless LAN Drivers is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ATMEL Wireless LAN Drivers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ATMEL Wireless LAN Drivers; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*******************************************************************************************/#include "WinterData.h"// CWinterData class implementation//==================================CWinterData::CWinterData( CWinterModel *model ) : CWinterModelChild( model ){}CWinterData::~CWinterData( ){}// CMacAddressData class implementation//======================================CMacAddressData::CMacAddressData( CWinterModel *model, UCHAR *mac_address ) : CWinterData( model ){}CMacAddressData::~CMacAddressData( ){}bool CMacAddressData::Import( void *from ){ SetMacAddress( ( UCHAR * ) from ); return true;}bool CMacAddressData::Export( void *to ){ // This function will not be used so far. memcpy( to, GetMacAddress( ), 6 ); return true;}void CMacAddressData::SetMacAddress( UCHAR mac[MAC_LENGTH] ){ memcpy( mMacAddress, mac, MAC_LENGTH ); return;}UCHAR *CMacAddressData::GetMacAddress( ){ return mMacAddress;}// CWepInfoData class implementation//===================================CWepInfoData::CWepInfoData( CWinterModel *model, PENCRYPTION_INFO src ) : CWinterData( model ){}CWepInfoData::~CWepInfoData( ){}bool CWepInfoData::doimport( PENCRYPTION_INFO src ){ if( src == NULL ) { return false; } SetWepKeyToUse( src->WepKeyToUse ); SetWepMode( src->WepMode ); SetAuthenticationType( src->AuthenticationType ); SetEncryptionLevel( src->EncryptionLevel );#ifdef ATMEL_WLAN for(int i=0; i<4; i++) { SetWepKey( src->KeyMaterial[i], i ); }#else SetWepKey1( src->WepKey1 ); SetWepKey2( src->WepKey2 ); SetWepKey3( src->WepKey3 ); SetWepKey4( src->WepKey4 );#endif SetModified( true ); return true;}bool CWepInfoData::doexport( PENCRYPTION_INFO tgt ){ tgt->WepKeyToUse = GetWepKeyToUse( ); tgt->WepMode = GetWepMode( ); tgt->AuthenticationType = GetAuthenticationType( ); tgt->EncryptionLevel = GetEncryptionLevel( );#ifdef ATMEL_WLAN switch(tgt->EncryptionLevel) { case 0 : tgt->KeyLength =0; tgt->PairwiseCipherSuite = CIPHER_SUITE_NONE; break; case 1 : tgt->KeyLength =5; tgt->PairwiseCipherSuite = CIPHER_SUITE_WEP_64; break; case 2 : tgt->KeyLength =13; tgt->PairwiseCipherSuite = CIPHER_SUITE_WEP_128; break; } for(int i=0; i<4; i++) { memcpy( tgt->KeyMaterial[i], GetWepKey(i), LONG_WEP_KEY_SIZE ); } tgt->KeyMaterial[tgt->WepKeyToUse][39] = 1; #else memcpy( tgt->WepKey1, GetWepKey1(), LONG_WEP_KEY_SIZE ); memcpy( tgt->WepKey2, GetWepKey2(), LONG_WEP_KEY_SIZE ); memcpy( tgt->WepKey3, GetWepKey3(), LONG_WEP_KEY_SIZE ); memcpy( tgt->WepKey4, GetWepKey4(), LONG_WEP_KEY_SIZE );#endif return true;}bool CWepInfoData::Import( void *from ){ return doimport( ( PENCRYPTION_INFO ) from );}bool CWepInfoData::Export( void *to ){ return doexport( ( PENCRYPTION_INFO ) to );}void CWepInfoData::SetWepKeyToUse( UCHAR wepkey ){ mWepKeyToUse = wepkey; SetModified( true ); return;}UCHAR CWepInfoData::GetWepKeyToUse( ){ return mWepKeyToUse;}void CWepInfoData::SetWepMode( UCHAR wepmode ){ mWepMode = wepmode; SetModified( true ); return;}UCHAR CWepInfoData::GetWepMode( ){ return mWepMode;}void CWepInfoData::SetAuthenticationType( USHORT authtype ){ mAuthenticationType = authtype; SetModified( true ); return;}USHORT CWepInfoData::GetAuthenticationType( ){ return mAuthenticationType;}void CWepInfoData::SetEncryptionLevel( int encryptlevel ){ mEncryptionLevel = encryptlevel; SetModified( true ); return;}int CWepInfoData::GetEncryptionLevel( ){ return mEncryptionLevel;}#ifdef ATMEL_WLANUCHAR *CWepInfoData::GetWepKey( int n ){ return mWepKey[n];}void CWepInfoData::SetWepKey( UCHAR wepkey[LONG_WEP_KEY_SIZE], int n ){ memcpy( mWepKey[n], wepkey, LONG_WEP_KEY_SIZE ); SetModified( true ); return;}#elsevoid CWepInfoData::SetWepKey1( UCHAR wepkey1[ LONG_WEP_KEY_SIZE ] ){ memcpy( mWepKey1, wepkey1, LONG_WEP_KEY_SIZE ); SetModified( true ); return;}UCHAR *CWepInfoData::GetWepKey1( ){ return mWepKey1;}void CWepInfoData::SetWepKey2( UCHAR wepkey2[ LONG_WEP_KEY_SIZE ] ){ memcpy( mWepKey2, wepkey2, LONG_WEP_KEY_SIZE ); SetModified( true ); return;}UCHAR *CWepInfoData::GetWepKey2( ){ return mWepKey2;}void CWepInfoData::SetWepKey3( UCHAR wepkey3[ LONG_WEP_KEY_SIZE ] ){ memcpy( mWepKey3, wepkey3, LONG_WEP_KEY_SIZE ); SetModified( true ); return;}UCHAR *CWepInfoData::GetWepKey3( ){ return mWepKey3;}void CWepInfoData::SetWepKey4( UCHAR wepkey4[ LONG_WEP_KEY_SIZE ] ){ memcpy( mWepKey4, wepkey4, LONG_WEP_KEY_SIZE ); SetModified( true ); return;}UCHAR *CWepInfoData::GetWepKey4( ){ return mWepKey4;}#endif// CBssInfoData class implementation//===================================CBssInfoData::CBssInfoData( BSS_INFO_EX *src ){ if( src != NULL ) { doimport( src ); }}CBssInfoData::~CBssInfoData( ){}bool CBssInfoData::doimport( BSS_INFO_EX *src ){ if( src == NULL ) { return false; } SetChannel( src->Channel ); SetSSID( src->SSID ); SetSSIDsize( src->SSIDsize ); SetBSSID( src->BSSID ); SetRSSI( src->RSSI ); SetUsingWep( src->UsingWEP ); SetPreambleType( src->PreambleType ); SetBeaconPeriod( src->BeaconPeriod ); SetBSStype( src->BSStype ); return true;}bool CBssInfoData::doexport( BSS_INFO_EX *tgt ){ tgt->Channel = GetChannel( ); memcpy( tgt->SSID, GetSSID( ), MAX_SSID_LENGTH ); memcpy( tgt->BSSID, GetBSSID( ), 6 ); tgt->SSIDsize = GetSSIDsize( ); tgt->RSSI = GetRSSI( ); tgt->UsingWEP = GetUsingWep( ); tgt->PreambleType = GetPreambleType( ); tgt->BeaconPeriod = GetBeaconPeriod( ); tgt->BSStype = GetBSStype( ); return true;}bool CBssInfoData::Import( void *from ){ return doimport( ( BSS_INFO_EX * ) from );}bool CBssInfoData::Export( void *to ){ return doexport( ( BSS_INFO_EX * ) to );}void CBssInfoData::SetChannel( int channel ){ mChannel = channel; return;}int CBssInfoData::GetChannel( ){ return mChannel;}void CBssInfoData::SetSSID( UCHAR ssid[ MAX_SSID_LENGTH ] ){ memcpy( mSSID, ssid, MAX_SSID_LENGTH ); return;}UCHAR *CBssInfoData::GetSSID( ){ return mSSID;}void CBssInfoData::SetSSIDsize( UCHAR ssidsize ){ mSSIDsize = ssidsize; return;}UCHAR CBssInfoData::GetSSIDsize( ){ return mSSIDsize;}void CBssInfoData::SetBSSID( UCHAR bssid[6] ){ memcpy( mBSSID, bssid, 6 ); return;}UCHAR *CBssInfoData::GetBSSID( ){ return mBSSID;}void CBssInfoData::SetRSSI( UCHAR rssi ){ mRSSI = rssi; return;}UCHAR CBssInfoData::GetRSSI( ){ return mRSSI;}void CBssInfoData::SetUsingWep( UCHAR usingwep ){ mUsingWep = usingwep; return;}UCHAR CBssInfoData::GetUsingWep( ){ return mUsingWep;}void CBssInfoData::SetPreambleType( UCHAR preambletype ){ mPreambleType = preambletype; return;}UCHAR CBssInfoData::GetPreambleType( ){ return mPreambleType;}void CBssInfoData::SetBeaconPeriod( USHORT beaconperiod ){ mBeaconPeriod = beaconperiod; return;}USHORT CBssInfoData::GetBeaconPeriod( ){ return mBeaconPeriod;}void CBssInfoData::SetBSStype( UCHAR bsstype ){ mBSStype = bsstype; return;}UCHAR CBssInfoData::GetBSStype( ){ return mBSStype;}// CVersionInfoData class implementation//=======================================CVersionInfoData::CVersionInfoData( CWinterModel *model, VERSION_INFO *src ) : CWinterData( model ){}CVersionInfoData::~CVersionInfoData( ){}bool CVersionInfoData::doimport( VERSION_INFO *src ){ if( src == NULL ) { return false; } SetDriverMajorVersion( src->DriverMajorVersion ); SetDriverMinorVersion( src->DriverMinorVersion ); SetDriverSubVersion( src->DriverSubVersion ); SetDriverBuild( src->DriverBuild ); SetFwMajorVersion( src->FwMajorVersion ); SetFwMinorVersion( src->FwMinorVersion ); SetFwSubVersion( src->FwSubVersion ); SetFwBuild( src->FwBuild ); SetModified( true ); return true;}bool CVersionInfoData::doexport( VERSION_INFO *tgt ){ tgt->DriverMajorVersion = GetDriverMajorVersion( ); tgt->DriverMinorVersion = GetDriverMinorVersion( ); tgt->DriverSubVersion = GetDriverSubVersion( ); tgt->DriverBuild = GetDriverBuild( ); tgt->FwMajorVersion = GetFwMajorVersion( ); tgt->FwMinorVersion = GetFwMinorVersion( ); tgt->FwSubVersion = GetFwSubVersion( ); tgt->FwBuild = GetFwBuild( ); return true;}bool CVersionInfoData::Import( void *from ){ return doimport( ( VERSION_INFO * ) from );}bool CVersionInfoData::Export( void *to ){ return doexport( ( VERSION_INFO * ) to );}void CVersionInfoData::SetDriverMajorVersion( UCHAR majorversion ){ mDriverMajorVersion = majorversion; SetModified( true ); return;}UCHAR CVersionInfoData::GetDriverMajorVersion( ){ return mDriverMajorVersion;}void CVersionInfoData::SetDriverMinorVersion( UCHAR minorversion ){ mDriverMinorVersion = minorversion; SetModified( true ); return;}UCHAR CVersionInfoData::GetDriverMinorVersion( ){ return mDriverMinorVersion;}void CVersionInfoData::SetDriverSubVersion( UCHAR subversion ){ mDriverSubVersion = subversion; SetModified( true ); return;}UCHAR CVersionInfoData::GetDriverSubVersion( ){ return mDriverSubVersion;}void CVersionInfoData::SetDriverBuild( USHORT driverbuild ){ mDriverBuild = driverbuild; SetModified( true ); return;}USHORT CVersionInfoData::GetDriverBuild( ){ return mDriverBuild;}void CVersionInfoData::SetFwMajorVersion( USHORT fwmajorversion ){ mFwMajorVersion = fwmajorversion; SetModified( true ); return;}USHORT CVersionInfoData::GetFwMajorVersion( )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -