summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetutils.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opienet/onetutils.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetutils.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp
index 8006f41..3e11b53 100644
--- a/libopie2/opienet/onetutils.cpp
+++ b/libopie2/opienet/onetutils.cpp
@@ -27,24 +27,34 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/onetutils.h>
#include <net/if.h>
#include <cstdio>
using namespace std;
+#define IW_PRIV_TYPE_MASK 0x7000
+#define IW_PRIV_TYPE_NONE 0x0000
+#define IW_PRIV_TYPE_BYTE 0x1000
+#define IW_PRIV_TYPE_CHAR 0x2000
+#define IW_PRIV_TYPE_INT 0x4000
+#define IW_PRIV_TYPE_FLOAT 0x5000
+#define IW_PRIV_TYPE_ADDR 0x6000
+#define IW_PRIV_SIZE_FIXED 0x0800
+#define IW_PRIV_SIZE_MASK 0x07FF
+
/*======================================================================================
* OMacAddress
*======================================================================================*/
// static initializer for broadcast and unknown MAC Adresses
const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast );
const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 };
const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown );
//TODO: Incorporate Ethernet Manufacturer database here!
@@ -78,24 +88,73 @@ QString OMacAddress::toString() const
s.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
_bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff,
_bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff );
return s;
}
bool operator==( const OMacAddress &m1, const OMacAddress &m2 )
{
return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0;
}
+
+/*======================================================================================
+ * OHostAddress
+ *======================================================================================*/
+
+
+/*======================================================================================
+ * OPrivateIOCTL
+ *======================================================================================*/
+
+OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs )
+ :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs )
+{
+}
+
+
+OPrivateIOCTL::~OPrivateIOCTL()
+{
+}
+
+
+inline int OPrivateIOCTL::numberGetArgs() const
+{
+ return _getargs & IW_PRIV_SIZE_MASK;
+}
+
+
+inline int OPrivateIOCTL::typeGetArgs() const
+{
+ return _getargs & IW_PRIV_TYPE_MASK >> 12;
+}
+
+
+inline int OPrivateIOCTL::numberSetArgs() const
+{
+ return _setargs & IW_PRIV_SIZE_MASK;
+}
+
+
+inline int OPrivateIOCTL::typeSetArgs() const
+{
+ return _setargs & IW_PRIV_TYPE_MASK >> 12;
+}
+
+
+/*======================================================================================
+ * assorted functions
+ *======================================================================================*/
+
void dumpBytes( const unsigned char* data, int num )
{
printf( "Dumping %d bytes @ %0x", num, data );
printf( "-------------------------------------------\n" );
for ( int i = 0; i < num; ++i )
{
printf( "%02x ", data[i] );
if ( !((i+1) % 32) ) printf( "\n" );
}
printf( "\n\n" );
}