author | mickeyl <mickeyl> | 2004-05-01 16:13:43 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-05-01 16:13:43 (UTC) |
commit | d5abd7878f553f5ac0a41966b27f4c09389d3cfd (patch) (unidiff) | |
tree | 3140d1d1fe012c03c6c26bc587faeea5501f0b28 | |
parent | 5a64ec5a21bb254c0e6a57e379cd1afc25259f19 (diff) | |
download | opie-d5abd7878f553f5ac0a41966b27f4c09389d3cfd.zip opie-d5abd7878f553f5ac0a41966b27f4c09389d3cfd.tar.gz opie-d5abd7878f553f5ac0a41966b27f4c09389d3cfd.tar.bz2 |
- fix off-by-one bug in OChannelHopper
- fix bug in OPacket which broke everything using it
- expose both wireless extension versions (runtime + compile time) through API
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 12 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 10 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 4 |
3 files changed, 18 insertions, 8 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index b6c9876..e141097 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -120,5 +120,5 @@ void ONetwork::synchronize() | |||
120 | 120 | ||
121 | 121 | ||
122 | short ONetwork::wirelessExtensionVersion() | 122 | short ONetwork::wirelessExtensionCompileVersion() |
123 | { | 123 | { |
124 | return WIRELESS_EXT; | 124 | return WIRELESS_EXT; |
@@ -383,5 +383,5 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | |||
383 | _iface( iface ), _interval( 0 ), _tid( 0 ) | 383 | _iface( iface ), _interval( 0 ), _tid( 0 ) |
384 | { | 384 | { |
385 | int _maxChannel = iface->channels()+1; | 385 | int _maxChannel = iface->channels(); |
386 | // generate fancy hopping sequence honoring the device capabilities | 386 | // generate fancy hopping sequence honoring the device capabilities |
387 | if ( _maxChannel >= 1 ) _channels.append( 1 ); | 387 | if ( _maxChannel >= 1 ) _channels.append( 1 ); |
@@ -400,5 +400,4 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | |||
400 | if ( _maxChannel >= 12 ) _channels.append( 12 ); | 400 | if ( _maxChannel >= 12 ) _channels.append( 12 ); |
401 | _channel = _channels.begin(); | 401 | _channel = _channels.begin(); |
402 | |||
403 | } | 402 | } |
404 | 403 | ||
@@ -562,4 +561,5 @@ void OWirelessNetworkInterface::buildInformation() | |||
562 | { | 561 | { |
563 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); | 562 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); |
563 | odebug << "OWirelessNetworkInterface::buildInformation: Adding frequency " << freq << " as channel " << i+1 << oendl; | ||
564 | _channels.insert( freq, i+1 ); | 564 | _channels.insert( freq, i+1 ); |
565 | } | 565 | } |
@@ -572,4 +572,10 @@ void OWirelessNetworkInterface::buildInformation() | |||
572 | 572 | ||
573 | 573 | ||
574 | short OWirelessNetworkInterface::wirelessExtensionDriverVersion() const | ||
575 | { | ||
576 | return _range.we_version_compiled; | ||
577 | } | ||
578 | |||
579 | |||
574 | void OWirelessNetworkInterface::buildPrivateList() | 580 | void OWirelessNetworkInterface::buildPrivateList() |
575 | { | 581 | { |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index f5fbe1d..a49c8fb 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -126,5 +126,5 @@ class ONetwork : public QObject | |||
126 | * @returns the wireless extension version used at compile time. | 126 | * @returns the wireless extension version used at compile time. |
127 | **/ | 127 | **/ |
128 | static short wirelessExtensionVersion(); | 128 | static short wirelessExtensionCompileVersion(); |
129 | 129 | ||
130 | protected: | 130 | protected: |
@@ -452,6 +452,10 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
452 | */ | 452 | */ |
453 | virtual int signalStrength() const; | 453 | virtual int signalStrength() const; |
454 | /** @internal commit pending changes to the driver | 454 | /** |
455 | * | 455 | * @returns the wireless extension version used by the interface driver. |
456 | **/ | ||
457 | short wirelessExtensionDriverVersion() const; | ||
458 | /** | ||
459 | * @internal commit pending changes to the driver | ||
456 | */ | 460 | */ |
457 | void commit() const; | 461 | void commit() const; |
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index f8ebe6b..a9dc577 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -59,7 +59,7 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* | |||
59 | { | 59 | { |
60 | 60 | ||
61 | _data = new unsigned char[sizeof data]; | 61 | _data = new unsigned char[ header.len ]; |
62 | assert( _data ); | 62 | assert( _data ); |
63 | memcpy( const_cast<unsigned char*>(_data), data, sizeof data ); | 63 | memcpy( const_cast<unsigned char*>(_data), data, header.len ); |
64 | // We have to copy the data structure here, because the 'data' pointer handed by libpcap | 64 | // We have to copy the data structure here, because the 'data' pointer handed by libpcap |
65 | // points to an internal region which is reused by lipcap. | 65 | // points to an internal region which is reused by lipcap. |