author | zecke <zecke> | 2004-04-04 21:27:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-04 21:27:42 (UTC) |
commit | f664b509b5e622ab74560fb74093175e50b2790c (patch) (unidiff) | |
tree | d46acaa8dd49ab2de70aebcdcf57bce1276c6fd1 /libopie2/opienet | |
parent | eb2831b5c94c4c27b8282842c9709234f5365e01 (diff) | |
download | opie-f664b509b5e622ab74560fb74093175e50b2790c.zip opie-f664b509b5e622ab74560fb74093175e50b2790c.tar.gz opie-f664b509b5e622ab74560fb74093175e50b2790c.tar.bz2 |
Opie::XYZ::Private -> Opie::XYZ::Internal
-rw-r--r-- | libopie2/opienet/odebugmapper.cpp | 2 | ||||
-rw-r--r-- | libopie2/opienet/odebugmapper.h | 2 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 2 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 2 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 4 |
5 files changed, 6 insertions, 6 deletions
diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp index f679afb..0de1247 100644 --- a/libopie2/opienet/odebugmapper.cpp +++ b/libopie2/opienet/odebugmapper.cpp | |||
@@ -1,78 +1,78 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include "odebugmapper.h" | 8 | #include "odebugmapper.h" |
9 | 9 | ||
10 | using namespace Opie::Core; | 10 | using namespace Opie::Core; |
11 | 11 | ||
12 | namespace Opie { | 12 | namespace Opie { |
13 | namespace Net { | 13 | namespace Net { |
14 | namespace Private { | 14 | namespace Internal { |
15 | 15 | ||
16 | DebugMapper::DebugMapper() | 16 | DebugMapper::DebugMapper() |
17 | { | 17 | { |
18 | odebug << "DebugMapper::DebugMapper()" << oendl; | 18 | odebug << "DebugMapper::DebugMapper()" << oendl; |
19 | 19 | ||
20 | 20 | ||
21 | _map.insert( 0x8902, new QString("SIOCSPGRP") ); | 21 | _map.insert( 0x8902, new QString("SIOCSPGRP") ); |
22 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); | 22 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); |
23 | _map.insert( 0x8905, new QString("SIOCATMARK") ); | 23 | _map.insert( 0x8905, new QString("SIOCATMARK") ); |
24 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); | 24 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); |
25 | _map.insert( 0x890B, new QString("SIOCADDRT") ); | 25 | _map.insert( 0x890B, new QString("SIOCADDRT") ); |
26 | _map.insert( 0x890C, new QString("SIOCDELRT") ); | 26 | _map.insert( 0x890C, new QString("SIOCDELRT") ); |
27 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); | 27 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); |
28 | _map.insert( 0x8910, new QString("SIOCGIFNAME") ); | 28 | _map.insert( 0x8910, new QString("SIOCGIFNAME") ); |
29 | _map.insert( 0x8911, new QString("SIOCSIFLINK") ); | 29 | _map.insert( 0x8911, new QString("SIOCSIFLINK") ); |
30 | _map.insert( 0x8912, new QString("SIOCGIFCONF") ); | 30 | _map.insert( 0x8912, new QString("SIOCGIFCONF") ); |
31 | _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); | 31 | _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); |
32 | _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); | 32 | _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); |
33 | _map.insert( 0x8915, new QString("SIOCGIFADDR") ); | 33 | _map.insert( 0x8915, new QString("SIOCGIFADDR") ); |
34 | _map.insert( 0x8916, new QString("SIOCSIFADDR") ); | 34 | _map.insert( 0x8916, new QString("SIOCSIFADDR") ); |
35 | _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); | 35 | _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); |
36 | _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); | 36 | _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); |
37 | _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); | 37 | _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); |
38 | _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); | 38 | _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); |
39 | _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); | 39 | _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); |
40 | _map.insert( 0x891c, new QString("SIOCSIFNETMASK") ); | 40 | _map.insert( 0x891c, new QString("SIOCSIFNETMASK") ); |
41 | _map.insert( 0x891d, new QString("SIOCGIFMETRIC") ); | 41 | _map.insert( 0x891d, new QString("SIOCGIFMETRIC") ); |
42 | _map.insert( 0x891e, new QString("SIOCSIFMETRIC") ); | 42 | _map.insert( 0x891e, new QString("SIOCSIFMETRIC") ); |
43 | _map.insert( 0x891f, new QString("SIOCGIFMEM") ); | 43 | _map.insert( 0x891f, new QString("SIOCGIFMEM") ); |
44 | _map.insert( 0x8920, new QString("SIOCSIFMEM") ); | 44 | _map.insert( 0x8920, new QString("SIOCSIFMEM") ); |
45 | _map.insert( 0x8921, new QString("SIOCGIFMTU") ); | 45 | _map.insert( 0x8921, new QString("SIOCGIFMTU") ); |
46 | _map.insert( 0x8922, new QString("SIOCSIFMTU") ); | 46 | _map.insert( 0x8922, new QString("SIOCSIFMTU") ); |
47 | _map.insert( 0x8923, new QString("SIOCSIFNAME") ); | 47 | _map.insert( 0x8923, new QString("SIOCSIFNAME") ); |
48 | _map.insert( 0x8924, new QString("SIOCSIFHWADDR") ); | 48 | _map.insert( 0x8924, new QString("SIOCSIFHWADDR") ); |
49 | _map.insert( 0x8925, new QString("SIOCGIFENCAP") ); | 49 | _map.insert( 0x8925, new QString("SIOCGIFENCAP") ); |
50 | _map.insert( 0x8926, new QString("SIOCSIFENCAP") ); | 50 | _map.insert( 0x8926, new QString("SIOCSIFENCAP") ); |
51 | _map.insert( 0x8927, new QString("SIOCGIFHWADDR") ); | 51 | _map.insert( 0x8927, new QString("SIOCGIFHWADDR") ); |
52 | _map.insert( 0x8929, new QString("SIOCGIFSLAVE") ); | 52 | _map.insert( 0x8929, new QString("SIOCGIFSLAVE") ); |
53 | _map.insert( 0x8930, new QString("SIOCSIFSLAVE") ); | 53 | _map.insert( 0x8930, new QString("SIOCSIFSLAVE") ); |
54 | _map.insert( 0x8931, new QString("SIOCADDMULTI") ); | 54 | _map.insert( 0x8931, new QString("SIOCADDMULTI") ); |
55 | _map.insert( 0x8932, new QString("SIOCDELMULTI") ); | 55 | _map.insert( 0x8932, new QString("SIOCDELMULTI") ); |
56 | _map.insert( 0x8933, new QString("SIOCGIFINDEX") ); | 56 | _map.insert( 0x8933, new QString("SIOCGIFINDEX") ); |
57 | _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") ); | 57 | _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") ); |
58 | _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") ); | 58 | _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") ); |
59 | _map.insert( 0x8936, new QString("SIOCDIFADDR") ); | 59 | _map.insert( 0x8936, new QString("SIOCDIFADDR") ); |
60 | _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); | 60 | _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); |
61 | _map.insert( 0x8938, new QString("SIOCGIFCOUNT") ); | 61 | _map.insert( 0x8938, new QString("SIOCGIFCOUNT") ); |
62 | _map.insert( 0x8940, new QString("SIOCGIFBR") ); | 62 | _map.insert( 0x8940, new QString("SIOCGIFBR") ); |
63 | _map.insert( 0x8941, new QString("SIOCSIFBR") ); | 63 | _map.insert( 0x8941, new QString("SIOCSIFBR") ); |
64 | _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") ); | 64 | _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") ); |
65 | _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") ); | 65 | _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") ); |
66 | _map.insert( 0x8953, new QString("SIOCDARP") ); | 66 | _map.insert( 0x8953, new QString("SIOCDARP") ); |
67 | _map.insert( 0x8954, new QString("SIOCGARP") ); | 67 | _map.insert( 0x8954, new QString("SIOCGARP") ); |
68 | _map.insert( 0x8955, new QString("SIOCSARP") ); | 68 | _map.insert( 0x8955, new QString("SIOCSARP") ); |
69 | _map.insert( 0x8960, new QString("SIOCDRARP") ); | 69 | _map.insert( 0x8960, new QString("SIOCDRARP") ); |
70 | _map.insert( 0x8961, new QString("SIOCGRARP") ); | 70 | _map.insert( 0x8961, new QString("SIOCGRARP") ); |
71 | _map.insert( 0x8962, new QString("SIOCSRARP") ); | 71 | _map.insert( 0x8962, new QString("SIOCSRARP") ); |
72 | _map.insert( 0x8970, new QString("SIOCGIFMAP") ); | 72 | _map.insert( 0x8970, new QString("SIOCGIFMAP") ); |
73 | _map.insert( 0x8971, new QString("SIOCSIFMAP") ); | 73 | _map.insert( 0x8971, new QString("SIOCSIFMAP") ); |
74 | _map.insert( 0x8980, new QString("SIOCADDDLCI") ); | 74 | _map.insert( 0x8980, new QString("SIOCADDDLCI") ); |
75 | _map.insert( 0x8981, new QString("SIOCDELDLCI") ); | 75 | _map.insert( 0x8981, new QString("SIOCDELDLCI") ); |
76 | _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); | 76 | _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); |
77 | _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); | 77 | _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); |
78 | _map.insert( 0x1fff, new QString("SIOCPARM_MASK") ); | 78 | _map.insert( 0x1fff, new QString("SIOCPARM_MASK") ); |
diff --git a/libopie2/opienet/odebugmapper.h b/libopie2/opienet/odebugmapper.h index f47db47..79fb42e 100644 --- a/libopie2/opienet/odebugmapper.h +++ b/libopie2/opienet/odebugmapper.h | |||
@@ -1,36 +1,36 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef DEBUGMAPPER_H | 6 | #ifndef DEBUGMAPPER_H |
7 | #define DEBUGMAPPER_H | 7 | #define DEBUGMAPPER_H |
8 | 8 | ||
9 | #include <qstring.h> | 9 | #include <qstring.h> |
10 | #include <qintdict.h> | 10 | #include <qintdict.h> |
11 | 11 | ||
12 | namespace Opie { | 12 | namespace Opie { |
13 | namespace Net { | 13 | namespace Net { |
14 | namespace Private { | 14 | namespace Internal { |
15 | 15 | ||
16 | typedef QIntDict<QString> IntStringMap; | 16 | typedef QIntDict<QString> IntStringMap; |
17 | 17 | ||
18 | class DebugMapper | 18 | class DebugMapper |
19 | { | 19 | { |
20 | public: | 20 | public: |
21 | DebugMapper(); | 21 | DebugMapper(); |
22 | ~DebugMapper(); | 22 | ~DebugMapper(); |
23 | 23 | ||
24 | const QString& map( int value ) const; | 24 | const QString& map( int value ) const; |
25 | private: | 25 | private: |
26 | IntStringMap _map; | 26 | IntStringMap _map; |
27 | class Private; | 27 | class Private; |
28 | Private *d; | 28 | Private *d; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | } | 31 | } |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | 36 | ||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 7794334..c185805 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -129,113 +129,113 @@ QString OMacAddress::manufacturer() const | |||
129 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | 129 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) |
130 | { | 130 | { |
131 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; | 131 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | /*====================================================================================== | 135 | /*====================================================================================== |
136 | * OHostAddress | 136 | * OHostAddress |
137 | *======================================================================================*/ | 137 | *======================================================================================*/ |
138 | 138 | ||
139 | 139 | ||
140 | /*====================================================================================== | 140 | /*====================================================================================== |
141 | * OPrivateIOCTL | 141 | * OPrivateIOCTL |
142 | *======================================================================================*/ | 142 | *======================================================================================*/ |
143 | 143 | ||
144 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) | 144 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) |
145 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) | 145 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) |
146 | { | 146 | { |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | OPrivateIOCTL::~OPrivateIOCTL() | 150 | OPrivateIOCTL::~OPrivateIOCTL() |
151 | { | 151 | { |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | int OPrivateIOCTL::numberGetArgs() const | 155 | int OPrivateIOCTL::numberGetArgs() const |
156 | { | 156 | { |
157 | return _getargs & IW_PRIV_SIZE_MASK; | 157 | return _getargs & IW_PRIV_SIZE_MASK; |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | int OPrivateIOCTL::typeGetArgs() const | 161 | int OPrivateIOCTL::typeGetArgs() const |
162 | { | 162 | { |
163 | return _getargs & IW_PRIV_TYPE_MASK >> 12; | 163 | return _getargs & IW_PRIV_TYPE_MASK >> 12; |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | int OPrivateIOCTL::numberSetArgs() const | 167 | int OPrivateIOCTL::numberSetArgs() const |
168 | { | 168 | { |
169 | return _setargs & IW_PRIV_SIZE_MASK; | 169 | return _setargs & IW_PRIV_SIZE_MASK; |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | int OPrivateIOCTL::typeSetArgs() const | 173 | int OPrivateIOCTL::typeSetArgs() const |
174 | { | 174 | { |
175 | return _setargs & IW_PRIV_TYPE_MASK >> 12; | 175 | return _setargs & IW_PRIV_TYPE_MASK >> 12; |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | void OPrivateIOCTL::invoke() const | 179 | void OPrivateIOCTL::invoke() const |
180 | { | 180 | { |
181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | 181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) | 185 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) |
186 | { | 186 | { |
187 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; | 187 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; |
188 | arglist[num] = value; | 188 | arglist[num] = value; |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | 192 | ||
193 | namespace Private { | 193 | namespace Internal { |
194 | /*====================================================================================== | 194 | /*====================================================================================== |
195 | * assorted functions | 195 | * assorted functions |
196 | *======================================================================================*/ | 196 | *======================================================================================*/ |
197 | 197 | ||
198 | void dumpBytes( const unsigned char* data, int num ) | 198 | void dumpBytes( const unsigned char* data, int num ) |
199 | { | 199 | { |
200 | printf( "Dumping %d bytes @ %0x", num, data ); | 200 | printf( "Dumping %d bytes @ %0x", num, data ); |
201 | printf( "-------------------------------------------\n" ); | 201 | printf( "-------------------------------------------\n" ); |
202 | 202 | ||
203 | for ( int i = 0; i < num; ++i ) | 203 | for ( int i = 0; i < num; ++i ) |
204 | { | 204 | { |
205 | printf( "%02x ", data[i] ); | 205 | printf( "%02x ", data[i] ); |
206 | if ( !((i+1) % 32) ) printf( "\n" ); | 206 | if ( !((i+1) % 32) ) printf( "\n" ); |
207 | } | 207 | } |
208 | printf( "\n\n" ); | 208 | printf( "\n\n" ); |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
212 | int stringToMode( const QString& mode ) | 212 | int stringToMode( const QString& mode ) |
213 | { | 213 | { |
214 | if ( mode == "auto" ) return IW_MODE_AUTO; | 214 | if ( mode == "auto" ) return IW_MODE_AUTO; |
215 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; | 215 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; |
216 | else if ( mode == "managed" ) return IW_MODE_INFRA; | 216 | else if ( mode == "managed" ) return IW_MODE_INFRA; |
217 | else if ( mode == "master" ) return IW_MODE_MASTER; | 217 | else if ( mode == "master" ) return IW_MODE_MASTER; |
218 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; | 218 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; |
219 | else if ( mode == "secondary" ) return IW_MODE_SECOND; | 219 | else if ( mode == "secondary" ) return IW_MODE_SECOND; |
220 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; | 220 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; |
221 | else assert( 0 ); | 221 | else assert( 0 ); |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | QString modeToString( int mode ) | 225 | QString modeToString( int mode ) |
226 | { | 226 | { |
227 | switch ( mode ) | 227 | switch ( mode ) |
228 | { | 228 | { |
229 | case IW_MODE_AUTO: return "auto"; | 229 | case IW_MODE_AUTO: return "auto"; |
230 | case IW_MODE_ADHOC: return "adhoc"; | 230 | case IW_MODE_ADHOC: return "adhoc"; |
231 | case IW_MODE_INFRA: return "managed"; | 231 | case IW_MODE_INFRA: return "managed"; |
232 | case IW_MODE_MASTER: return "master"; | 232 | case IW_MODE_MASTER: return "master"; |
233 | case IW_MODE_REPEAT: return "repeater"; | 233 | case IW_MODE_REPEAT: return "repeater"; |
234 | case IW_MODE_SECOND: return "second"; | 234 | case IW_MODE_SECOND: return "second"; |
235 | case IW_MODE_MONITOR: return "monitor"; | 235 | case IW_MODE_MONITOR: return "monitor"; |
236 | default: assert( 0 ); | 236 | default: assert( 0 ); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | } | 241 | } |
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index ca6815d..4a09426 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -71,126 +71,126 @@ class OMacAddress | |||
71 | public: | 71 | public: |
72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
73 | static const OMacAddress& unknown; // 44:44:44:44:44:44 | 73 | static const OMacAddress& unknown; // 44:44:44:44:44:44 |
74 | 74 | ||
75 | private: | 75 | private: |
76 | unsigned char _bytes[6]; | 76 | unsigned char _bytes[6]; |
77 | 77 | ||
78 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 78 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | class Private; | 79 | class Private; |
80 | Private *d; | 80 | Private *d; |
81 | 81 | ||
82 | }; | 82 | }; |
83 | 83 | ||
84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
85 | 85 | ||
86 | 86 | ||
87 | /*====================================================================================== | 87 | /*====================================================================================== |
88 | * OHostAddress | 88 | * OHostAddress |
89 | *======================================================================================*/ | 89 | *======================================================================================*/ |
90 | 90 | ||
91 | class OHostAddress : public QHostAddress | 91 | class OHostAddress : public QHostAddress |
92 | { | 92 | { |
93 | /*public: | 93 | /*public: |
94 | OHostAddress(); | 94 | OHostAddress(); |
95 | ~OHostAddress(); | 95 | ~OHostAddress(); |
96 | */ | 96 | */ |
97 | private: | 97 | private: |
98 | class Private; | 98 | class Private; |
99 | Private *d; | 99 | Private *d; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | 102 | ||
103 | /*====================================================================================== | 103 | /*====================================================================================== |
104 | * OPrivateIOCTL | 104 | * OPrivateIOCTL |
105 | *======================================================================================*/ | 105 | *======================================================================================*/ |
106 | 106 | ||
107 | class OPrivateIOCTL : public QObject | 107 | class OPrivateIOCTL : public QObject |
108 | { | 108 | { |
109 | public: | 109 | public: |
110 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); | 110 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); |
111 | ~OPrivateIOCTL(); | 111 | ~OPrivateIOCTL(); |
112 | 112 | ||
113 | int numberGetArgs() const; | 113 | int numberGetArgs() const; |
114 | int typeGetArgs() const; | 114 | int typeGetArgs() const; |
115 | int numberSetArgs() const; | 115 | int numberSetArgs() const; |
116 | int typeSetArgs() const; | 116 | int typeSetArgs() const; |
117 | 117 | ||
118 | // FIXME return int? as ::ioctl does? -zecke | 118 | // FIXME return int? as ::ioctl does? -zecke |
119 | void invoke() const; | 119 | void invoke() const; |
120 | void setParameter( int, u_int32_t ); | 120 | void setParameter( int, u_int32_t ); |
121 | 121 | ||
122 | private: | 122 | private: |
123 | u_int32_t _ioctl; | 123 | u_int32_t _ioctl; |
124 | u_int16_t _getargs; | 124 | u_int16_t _getargs; |
125 | u_int16_t _setargs; | 125 | u_int16_t _setargs; |
126 | 126 | ||
127 | class Private; | 127 | class Private; |
128 | Private *d; | 128 | Private *d; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | /*====================================================================================== | 131 | /*====================================================================================== |
132 | * Miscellaneous | 132 | * Miscellaneous |
133 | *======================================================================================*/ | 133 | *======================================================================================*/ |
134 | 134 | ||
135 | namespace Private { | 135 | namespace Internal { |
136 | void dumpBytes( const unsigned char* data, int num ); | 136 | void dumpBytes( const unsigned char* data, int num ); |
137 | QString modeToString( int ); | 137 | QString modeToString( int ); |
138 | int stringToMode( const QString& ); | 138 | int stringToMode( const QString& ); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | #define IW_PRIV_TYPE_MASK 0x7000 | 143 | #define IW_PRIV_TYPE_MASK 0x7000 |
144 | #define IW_PRIV_TYPE_NONE 0x0000 | 144 | #define IW_PRIV_TYPE_NONE 0x0000 |
145 | #define IW_PRIV_TYPE_BYTE 0x1000 | 145 | #define IW_PRIV_TYPE_BYTE 0x1000 |
146 | #define IW_PRIV_TYPE_CHAR 0x2000 | 146 | #define IW_PRIV_TYPE_CHAR 0x2000 |
147 | #define IW_PRIV_TYPE_INT 0x4000 | 147 | #define IW_PRIV_TYPE_INT 0x4000 |
148 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 148 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
149 | #define IW_PRIV_TYPE_ADDR 0x6000 | 149 | #define IW_PRIV_TYPE_ADDR 0x6000 |
150 | #define IW_PRIV_SIZE_FIXED 0x0800 | 150 | #define IW_PRIV_SIZE_FIXED 0x0800 |
151 | #define IW_PRIV_SIZE_MASK 0x07FF | 151 | #define IW_PRIV_SIZE_MASK 0x07FF |
152 | 152 | ||
153 | #ifndef ARPHRD_IEEE80211 | 153 | #ifndef ARPHRD_IEEE80211 |
154 | #define ARPHRD_IEEE80211 801 | 154 | #define ARPHRD_IEEE80211 801 |
155 | #endif | 155 | #endif |
156 | #ifndef ARPHRD_IEEE80211_PRISM | 156 | #ifndef ARPHRD_IEEE80211_PRISM |
157 | #define ARPHRD_IEEE80211_PRISM 802 | 157 | #define ARPHRD_IEEE80211_PRISM 802 |
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | 160 | ||
161 | /* Network to host order macros */ | 161 | /* Network to host order macros */ |
162 | 162 | ||
163 | #ifdef LBL_ALIGN | 163 | #ifdef LBL_ALIGN |
164 | #define EXTRACT_16BITS(p) \ | 164 | #define EXTRACT_16BITS(p) \ |
165 | ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ | 165 | ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ |
166 | (u_int16_t)*((const u_int8_t *)(p) + 1))) | 166 | (u_int16_t)*((const u_int8_t *)(p) + 1))) |
167 | #define EXTRACT_32BITS(p) \ | 167 | #define EXTRACT_32BITS(p) \ |
168 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ | 168 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ |
169 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ | 169 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ |
170 | (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ | 170 | (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ |
171 | (u_int32_t)*((const u_int8_t *)(p) + 3))) | 171 | (u_int32_t)*((const u_int8_t *)(p) + 3))) |
172 | #else | 172 | #else |
173 | #define EXTRACT_16BITS(p) \ | 173 | #define EXTRACT_16BITS(p) \ |
174 | ((u_int16_t)ntohs(*(const u_int16_t *)(p))) | 174 | ((u_int16_t)ntohs(*(const u_int16_t *)(p))) |
175 | #define EXTRACT_32BITS(p) \ | 175 | #define EXTRACT_32BITS(p) \ |
176 | ((u_int32_t)ntohl(*(const u_int32_t *)(p))) | 176 | ((u_int32_t)ntohl(*(const u_int32_t *)(p))) |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | #define EXTRACT_24BITS(p) \ | 179 | #define EXTRACT_24BITS(p) \ |
180 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \ | 180 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \ |
181 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ | 181 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ |
182 | (u_int32_t)*((const u_int8_t *)(p) + 2))) | 182 | (u_int32_t)*((const u_int8_t *)(p) + 2))) |
183 | 183 | ||
184 | /* Little endian protocol host order macros */ | 184 | /* Little endian protocol host order macros */ |
185 | #define EXTRACT_LE_8BITS(p) (*(p)) | 185 | #define EXTRACT_LE_8BITS(p) (*(p)) |
186 | #define EXTRACT_LE_16BITS(p) \ | 186 | #define EXTRACT_LE_16BITS(p) \ |
187 | ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \ | 187 | ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \ |
188 | (u_int16_t)*((const u_int8_t *)(p) + 0))) | 188 | (u_int16_t)*((const u_int8_t *)(p) + 0))) |
189 | #define EXTRACT_LE_32BITS(p) \ | 189 | #define EXTRACT_LE_32BITS(p) \ |
190 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \ | 190 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \ |
191 | (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \ | 191 | (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \ |
192 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ | 192 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ |
193 | (u_int32_t)*((const u_int8_t *)(p) + 0))) | 193 | (u_int32_t)*((const u_int8_t *)(p) + 0))) |
194 | 194 | ||
195 | #endif // ONETUTILS_H | 195 | #endif // ONETUTILS_H |
196 | 196 | ||
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 26a6c81..b6c9876 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1,170 +1,170 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer | 3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer |
4 | =. <mickey@Vanille.de> | 4 | =. <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | 32 | ||
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/ostation.h> | 34 | #include <opie2/ostation.h> |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | 38 | ||
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | 41 | ||
42 | /* UNIX */ | 42 | /* UNIX */ |
43 | 43 | ||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | #include <arpa/inet.h> | 45 | #include <arpa/inet.h> |
46 | #include <errno.h> | 46 | #include <errno.h> |
47 | #include <string.h> | 47 | #include <string.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> |
52 | #include <sys/types.h> | 52 | #include <sys/types.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | #include <linux/sockios.h> | 54 | #include <linux/sockios.h> |
55 | #include <net/if_arp.h> | 55 | #include <net/if_arp.h> |
56 | #include <stdarg.h> | 56 | #include <stdarg.h> |
57 | 57 | ||
58 | #ifndef NODEBUG | 58 | #ifndef NODEBUG |
59 | #include <opie2/odebugmapper.h> | 59 | #include <opie2/odebugmapper.h> |
60 | 60 | ||
61 | 61 | ||
62 | using namespace Opie::Core; | 62 | using namespace Opie::Core; |
63 | using namespace Opie::Net::Private; | 63 | using namespace Opie::Net::Internal; |
64 | DebugMapper* debugmapper = new DebugMapper(); | 64 | DebugMapper* debugmapper = new DebugMapper(); |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | /*====================================================================================== | 67 | /*====================================================================================== |
68 | * ONetwork | 68 | * ONetwork |
69 | *======================================================================================*/ | 69 | *======================================================================================*/ |
70 | 70 | ||
71 | namespace Opie { | 71 | namespace Opie { |
72 | namespace Net { | 72 | namespace Net { |
73 | ONetwork* ONetwork::_instance = 0; | 73 | ONetwork* ONetwork::_instance = 0; |
74 | 74 | ||
75 | ONetwork::ONetwork() | 75 | ONetwork::ONetwork() |
76 | { | 76 | { |
77 | odebug << "ONetwork::ONetwork()" << oendl; | 77 | odebug << "ONetwork::ONetwork()" << oendl; |
78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
79 | synchronize(); | 79 | synchronize(); |
80 | } | 80 | } |
81 | 81 | ||
82 | void ONetwork::synchronize() | 82 | void ONetwork::synchronize() |
83 | { | 83 | { |
84 | // gather available interfaces by inspecting /proc/net/dev | 84 | // gather available interfaces by inspecting /proc/net/dev |
85 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 85 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
86 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | 86 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
87 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | 87 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev |
88 | 88 | ||
89 | _interfaces.clear(); | 89 | _interfaces.clear(); |
90 | QString str; | 90 | QString str; |
91 | QFile f( "/proc/net/dev" ); | 91 | QFile f( "/proc/net/dev" ); |
92 | bool hasFile = f.open( IO_ReadOnly ); | 92 | bool hasFile = f.open( IO_ReadOnly ); |
93 | if ( !hasFile ) | 93 | if ( !hasFile ) |
94 | { | 94 | { |
95 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; | 95 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | QTextStream s( &f ); | 98 | QTextStream s( &f ); |
99 | s.readLine(); | 99 | s.readLine(); |
100 | s.readLine(); | 100 | s.readLine(); |
101 | while ( !s.atEnd() ) | 101 | while ( !s.atEnd() ) |
102 | { | 102 | { |
103 | s >> str; | 103 | s >> str; |
104 | str.truncate( str.find( ':' ) ); | 104 | str.truncate( str.find( ':' ) ); |
105 | odebug << "ONetwork: found interface '" << str << "'" << oendl; | 105 | odebug << "ONetwork: found interface '" << str << "'" << oendl; |
106 | ONetworkInterface* iface; | 106 | ONetworkInterface* iface = 0; |
107 | if ( isWirelessInterface( str ) ) | 107 | if ( isWirelessInterface( str ) ) |
108 | { | 108 | { |
109 | iface = new OWirelessNetworkInterface( this, (const char*) str ); | 109 | iface = new OWirelessNetworkInterface( this, (const char*) str ); |
110 | odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; | 110 | odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; |
111 | } | 111 | } |
112 | else | 112 | else |
113 | { | 113 | { |
114 | iface = new ONetworkInterface( this, (const char*) str ); | 114 | iface = new ONetworkInterface( this, (const char*) str ); |
115 | } | 115 | } |
116 | _interfaces.insert( str, iface ); | 116 | _interfaces.insert( str, iface ); |
117 | s.readLine(); | 117 | s.readLine(); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | short ONetwork::wirelessExtensionVersion() | 122 | short ONetwork::wirelessExtensionVersion() |
123 | { | 123 | { |
124 | return WIRELESS_EXT; | 124 | return WIRELESS_EXT; |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | int ONetwork::count() const | 128 | int ONetwork::count() const |
129 | { | 129 | { |
130 | return _interfaces.count(); | 130 | return _interfaces.count(); |
131 | } | 131 | } |
132 | 132 | ||
133 | 133 | ||
134 | ONetworkInterface* ONetwork::interface( const QString& iface ) const | 134 | ONetworkInterface* ONetwork::interface( const QString& iface ) const |
135 | { | 135 | { |
136 | return _interfaces[iface]; | 136 | return _interfaces[iface]; |
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | ONetwork* ONetwork::instance() | 140 | ONetwork* ONetwork::instance() |
141 | { | 141 | { |
142 | if ( !_instance ) _instance = new ONetwork(); | 142 | if ( !_instance ) _instance = new ONetwork(); |
143 | return _instance; | 143 | return _instance; |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | ONetwork::InterfaceIterator ONetwork::iterator() const | 147 | ONetwork::InterfaceIterator ONetwork::iterator() const |
148 | { | 148 | { |
149 | return ONetwork::InterfaceIterator( _interfaces ); | 149 | return ONetwork::InterfaceIterator( _interfaces ); |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | bool ONetwork::isPresent( const char* name ) const | 153 | bool ONetwork::isPresent( const char* name ) const |
154 | { | 154 | { |
155 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); | 155 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); |
156 | struct ifreq ifr; | 156 | struct ifreq ifr; |
157 | memset( &ifr, 0, sizeof( struct ifreq ) ); | 157 | memset( &ifr, 0, sizeof( struct ifreq ) ); |
158 | strcpy( (char*) &ifr.ifr_name, name ); | 158 | strcpy( (char*) &ifr.ifr_name, name ); |
159 | int result = ::ioctl( sfd, SIOCGIFFLAGS, &ifr ); | 159 | int result = ::ioctl( sfd, SIOCGIFFLAGS, &ifr ); |
160 | return result != -1; | 160 | return result != -1; |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | bool ONetwork::isWirelessInterface( const char* name ) const | 164 | bool ONetwork::isWirelessInterface( const char* name ) const |
165 | { | 165 | { |
166 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); | 166 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); |
167 | struct iwreq iwr; | 167 | struct iwreq iwr; |
168 | memset( &iwr, 0, sizeof( struct iwreq ) ); | 168 | memset( &iwr, 0, sizeof( struct iwreq ) ); |
169 | strcpy( (char*) &iwr.ifr_name, name ); | 169 | strcpy( (char*) &iwr.ifr_name, name ); |
170 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); | 170 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); |