author | mickeyl <mickeyl> | 2003-04-05 19:29:47 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-05 19:29:47 (UTC) |
commit | 30e5401a945ebdfd92eedb9f3def9a6acd0fc6ca (patch) (side-by-side diff) | |
tree | eca3cb8d01045773db7de60d8194ea85313d3e0a /libopie2/opienet/onetutils.cpp | |
parent | 2bfd529736f1dcf008540be2199cd3887a53c75c (diff) | |
download | opie-30e5401a945ebdfd92eedb9f3def9a6acd0fc6ca.zip opie-30e5401a945ebdfd92eedb9f3def9a6acd0fc6ca.tar.gz opie-30e5401a945ebdfd92eedb9f3def9a6acd0fc6ca.tar.bz2 |
- setting the monitor mode on wireless cards via private ioctls is now much more reliable because we detect the appropriate ioctl number at runtime
- ONetworkInterface supports now the evil but handy feature to change MAC address on the fly (provided the driver supports this)
Diffstat (limited to 'libopie2/opienet/onetutils.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index b317810..0fb21ff 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp @@ -63,5 +63,5 @@ const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); OMacAddress::OMacAddress( unsigned char* p ) { - memcpy( _bytes, p, 6 ); // D'OH! memcpy in my sources... eeek... + memcpy( _bytes, p, 6 ); } @@ -84,4 +84,30 @@ OMacAddress::~OMacAddress() +#ifdef QT_NO_DEBUG +inline +#endif +const unsigned char* OMacAddress::native() const +{ + return (const unsigned char*) &_bytes; +} + + +OMacAddress OMacAddress::fromString( const QString& str ) +{ + QString addr( str ); + unsigned char buf[6]; + bool ok = true; + int index = 14; + for ( int i = 5; i >= 0; --i ) + { + buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); + if ( !ok ) return OMacAddress::unknown; + addr.truncate( index ); + index -= 3; + } + return (const unsigned char*) &buf; +} + + QString OMacAddress::toString() const { |