summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetutils.cpp
Unidiff
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
@@ -33,12 +33,22 @@
33 33
34#include <net/if.h> 34#include <net/if.h>
35 35
36#include <cstdio> 36#include <cstdio>
37using namespace std; 37using namespace std;
38 38
39#define IW_PRIV_TYPE_MASK 0x7000
40#define IW_PRIV_TYPE_NONE 0x0000
41#define IW_PRIV_TYPE_BYTE 0x1000
42#define IW_PRIV_TYPE_CHAR 0x2000
43#define IW_PRIV_TYPE_INT 0x4000
44#define IW_PRIV_TYPE_FLOAT 0x5000
45#define IW_PRIV_TYPE_ADDR 0x6000
46#define IW_PRIV_SIZE_FIXED 0x0800
47#define IW_PRIV_SIZE_MASK 0x07FF
48
39/*====================================================================================== 49/*======================================================================================
40 * OMacAddress 50 * OMacAddress
41 *======================================================================================*/ 51 *======================================================================================*/
42 52
43// static initializer for broadcast and unknown MAC Adresses 53// static initializer for broadcast and unknown MAC Adresses
44const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 54const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -84,12 +94,61 @@ QString OMacAddress::toString() const
84 94
85bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) 95bool operator==( const OMacAddress &m1, const OMacAddress &m2 )
86{ 96{
87 return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; 97 return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0;
88} 98}
89 99
100
101/*======================================================================================
102 * OHostAddress
103 *======================================================================================*/
104
105
106/*======================================================================================
107 * OPrivateIOCTL
108 *======================================================================================*/
109
110OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs )
111 :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs )
112{
113}
114
115
116OPrivateIOCTL::~OPrivateIOCTL()
117{
118}
119
120
121inline int OPrivateIOCTL::numberGetArgs() const
122{
123 return _getargs & IW_PRIV_SIZE_MASK;
124}
125
126
127inline int OPrivateIOCTL::typeGetArgs() const
128{
129 return _getargs & IW_PRIV_TYPE_MASK >> 12;
130}
131
132
133inline int OPrivateIOCTL::numberSetArgs() const
134{
135 return _setargs & IW_PRIV_SIZE_MASK;
136}
137
138
139inline int OPrivateIOCTL::typeSetArgs() const
140{
141 return _setargs & IW_PRIV_TYPE_MASK >> 12;
142}
143
144
145/*======================================================================================
146 * assorted functions
147 *======================================================================================*/
148
90void dumpBytes( const unsigned char* data, int num ) 149void dumpBytes( const unsigned char* data, int num )
91{ 150{
92 printf( "Dumping %d bytes @ %0x", num, data ); 151 printf( "Dumping %d bytes @ %0x", num, data );
93 printf( "-------------------------------------------\n" ); 152 printf( "-------------------------------------------\n" );
94 153
95 for ( int i = 0; i < num; ++i ) 154 for ( int i = 0; i < num; ++i )