From 30e5401a945ebdfd92eedb9f3def9a6acd0fc6ca Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sat, 05 Apr 2003 19:29:47 +0000 Subject: - 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) --- (limited to 'libopie2/opienet/onetutils.cpp') 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 @@ -62,7 +62,7 @@ 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 ); } @@ -83,6 +83,32 @@ 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 { QString s; -- cgit v0.9.0.2