-rw-r--r-- | libopie2/opienet/oioctlmap.cpp | 366 | ||||
-rw-r--r-- | libopie2/opienet/oioctlmap.h | 17 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 21 | ||||
-rw-r--r-- | libopie2/opienet/opienet.pro | 11 |
4 files changed, 406 insertions, 9 deletions
diff --git a/libopie2/opienet/oioctlmap.cpp b/libopie2/opienet/oioctlmap.cpp new file mode 100644 index 0000000..4a67eb6 --- a/dev/null +++ b/libopie2/opienet/oioctlmap.cpp | |||
@@ -0,0 +1,366 @@ | |||
1 | |||
2 | /* | ||
3 | * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | ||
4 | */ | ||
5 | |||
6 | #include "oioctlmap.h" | ||
7 | |||
8 | IntStringMap* constructIoctlMap() | ||
9 | { | ||
10 | IntStringMap* map = new IntStringMap(); | ||
11 | |||
12 | |||
13 | qDebug( "adding 0x8902 = SIOCSPGRP" ); | ||
14 | map->insert( 0x8902, new QString("SIOCSPGRP") ); | ||
15 | qDebug( "adding 0x8904 = SIOCGPGRP" ); | ||
16 | map->insert( 0x8904, new QString("SIOCGPGRP") ); | ||
17 | qDebug( "adding 0x8905 = SIOCATMARK" ); | ||
18 | map->insert( 0x8905, new QString("SIOCATMARK") ); | ||
19 | qDebug( "adding 0x8906 = SIOCGSTAMP" ); | ||
20 | map->insert( 0x8906, new QString("SIOCGSTAMP") ); | ||
21 | qDebug( "adding 0x890B = SIOCADDRT" ); | ||
22 | map->insert( 0x890B, new QString("SIOCADDRT") ); | ||
23 | qDebug( "adding 0x890C = SIOCDELRT" ); | ||
24 | map->insert( 0x890C, new QString("SIOCDELRT") ); | ||
25 | qDebug( "adding 0x890D = SIOCRTMSG" ); | ||
26 | map->insert( 0x890D, new QString("SIOCRTMSG") ); | ||
27 | qDebug( "adding 0x8910 = SIOCGIFNAME" ); | ||
28 | map->insert( 0x8910, new QString("SIOCGIFNAME") ); | ||
29 | qDebug( "adding 0x8911 = SIOCSIFLINK" ); | ||
30 | map->insert( 0x8911, new QString("SIOCSIFLINK") ); | ||
31 | qDebug( "adding 0x8912 = SIOCGIFCONF" ); | ||
32 | map->insert( 0x8912, new QString("SIOCGIFCONF") ); | ||
33 | qDebug( "adding 0x8913 = SIOCGIFFLAGS" ); | ||
34 | map->insert( 0x8913, new QString("SIOCGIFFLAGS") ); | ||
35 | qDebug( "adding 0x8914 = SIOCSIFFLAGS" ); | ||
36 | map->insert( 0x8914, new QString("SIOCSIFFLAGS") ); | ||
37 | qDebug( "adding 0x8915 = SIOCGIFADDR" ); | ||
38 | map->insert( 0x8915, new QString("SIOCGIFADDR") ); | ||
39 | qDebug( "adding 0x8916 = SIOCSIFADDR" ); | ||
40 | map->insert( 0x8916, new QString("SIOCSIFADDR") ); | ||
41 | qDebug( "adding 0x8917 = SIOCGIFDSTADDR" ); | ||
42 | map->insert( 0x8917, new QString("SIOCGIFDSTADDR") ); | ||
43 | qDebug( "adding 0x8918 = SIOCSIFDSTADDR" ); | ||
44 | map->insert( 0x8918, new QString("SIOCSIFDSTADDR") ); | ||
45 | qDebug( "adding 0x8919 = SIOCGIFBRDADDR" ); | ||
46 | map->insert( 0x8919, new QString("SIOCGIFBRDADDR") ); | ||
47 | qDebug( "adding 0x891a = SIOCSIFBRDADDR" ); | ||
48 | map->insert( 0x891a, new QString("SIOCSIFBRDADDR") ); | ||
49 | qDebug( "adding 0x891b = SIOCGIFNETMASK" ); | ||
50 | map->insert( 0x891b, new QString("SIOCGIFNETMASK") ); | ||
51 | qDebug( "adding 0x891c = SIOCSIFNETMASK" ); | ||
52 | map->insert( 0x891c, new QString("SIOCSIFNETMASK") ); | ||
53 | qDebug( "adding 0x891d = SIOCGIFMETRIC" ); | ||
54 | map->insert( 0x891d, new QString("SIOCGIFMETRIC") ); | ||
55 | qDebug( "adding 0x891e = SIOCSIFMETRIC" ); | ||
56 | map->insert( 0x891e, new QString("SIOCSIFMETRIC") ); | ||
57 | qDebug( "adding 0x891f = SIOCGIFMEM" ); | ||
58 | map->insert( 0x891f, new QString("SIOCGIFMEM") ); | ||
59 | qDebug( "adding 0x8920 = SIOCSIFMEM" ); | ||
60 | map->insert( 0x8920, new QString("SIOCSIFMEM") ); | ||
61 | qDebug( "adding 0x8921 = SIOCGIFMTU" ); | ||
62 | map->insert( 0x8921, new QString("SIOCGIFMTU") ); | ||
63 | qDebug( "adding 0x8922 = SIOCSIFMTU" ); | ||
64 | map->insert( 0x8922, new QString("SIOCSIFMTU") ); | ||
65 | qDebug( "adding 0x8923 = SIOCSIFNAME" ); | ||
66 | map->insert( 0x8923, new QString("SIOCSIFNAME") ); | ||
67 | qDebug( "adding 0x8924 = SIOCSIFHWADDR" ); | ||
68 | map->insert( 0x8924, new QString("SIOCSIFHWADDR") ); | ||
69 | qDebug( "adding 0x8925 = SIOCGIFENCAP" ); | ||
70 | map->insert( 0x8925, new QString("SIOCGIFENCAP") ); | ||
71 | qDebug( "adding 0x8926 = SIOCSIFENCAP" ); | ||
72 | map->insert( 0x8926, new QString("SIOCSIFENCAP") ); | ||
73 | qDebug( "adding 0x8927 = SIOCGIFHWADDR" ); | ||
74 | map->insert( 0x8927, new QString("SIOCGIFHWADDR") ); | ||
75 | qDebug( "adding 0x8929 = SIOCGIFSLAVE" ); | ||
76 | map->insert( 0x8929, new QString("SIOCGIFSLAVE") ); | ||
77 | qDebug( "adding 0x8930 = SIOCSIFSLAVE" ); | ||
78 | map->insert( 0x8930, new QString("SIOCSIFSLAVE") ); | ||
79 | qDebug( "adding 0x8931 = SIOCADDMULTI" ); | ||
80 | map->insert( 0x8931, new QString("SIOCADDMULTI") ); | ||
81 | qDebug( "adding 0x8932 = SIOCDELMULTI" ); | ||
82 | map->insert( 0x8932, new QString("SIOCDELMULTI") ); | ||
83 | qDebug( "adding 0x8933 = SIOCGIFINDEX" ); | ||
84 | map->insert( 0x8933, new QString("SIOCGIFINDEX") ); | ||
85 | qDebug( "adding 0x8934 = SIOCSIFPFLAGS" ); | ||
86 | map->insert( 0x8934, new QString("SIOCSIFPFLAGS") ); | ||
87 | qDebug( "adding 0x8935 = SIOCGIFPFLAGS" ); | ||
88 | map->insert( 0x8935, new QString("SIOCGIFPFLAGS") ); | ||
89 | qDebug( "adding 0x8936 = SIOCDIFADDR" ); | ||
90 | map->insert( 0x8936, new QString("SIOCDIFADDR") ); | ||
91 | qDebug( "adding 0x8937 = SIOCSIFHWBROADCAST" ); | ||
92 | map->insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); | ||
93 | qDebug( "adding 0x8938 = SIOCGIFCOUNT" ); | ||
94 | map->insert( 0x8938, new QString("SIOCGIFCOUNT") ); | ||
95 | qDebug( "adding 0x8940 = SIOCGIFBR" ); | ||
96 | map->insert( 0x8940, new QString("SIOCGIFBR") ); | ||
97 | qDebug( "adding 0x8941 = SIOCSIFBR" ); | ||
98 | map->insert( 0x8941, new QString("SIOCSIFBR") ); | ||
99 | qDebug( "adding 0x8942 = SIOCGIFTXQLEN" ); | ||
100 | map->insert( 0x8942, new QString("SIOCGIFTXQLEN") ); | ||
101 | qDebug( "adding 0x8943 = SIOCSIFTXQLEN" ); | ||
102 | map->insert( 0x8943, new QString("SIOCSIFTXQLEN") ); | ||
103 | qDebug( "adding 0x8953 = SIOCDARP" ); | ||
104 | map->insert( 0x8953, new QString("SIOCDARP") ); | ||
105 | qDebug( "adding 0x8954 = SIOCGARP" ); | ||
106 | map->insert( 0x8954, new QString("SIOCGARP") ); | ||
107 | qDebug( "adding 0x8955 = SIOCSARP" ); | ||
108 | map->insert( 0x8955, new QString("SIOCSARP") ); | ||
109 | qDebug( "adding 0x8960 = SIOCDRARP" ); | ||
110 | map->insert( 0x8960, new QString("SIOCDRARP") ); | ||
111 | qDebug( "adding 0x8961 = SIOCGRARP" ); | ||
112 | map->insert( 0x8961, new QString("SIOCGRARP") ); | ||
113 | qDebug( "adding 0x8962 = SIOCSRARP" ); | ||
114 | map->insert( 0x8962, new QString("SIOCSRARP") ); | ||
115 | qDebug( "adding 0x8970 = SIOCGIFMAP" ); | ||
116 | map->insert( 0x8970, new QString("SIOCGIFMAP") ); | ||
117 | qDebug( "adding 0x8971 = SIOCSIFMAP" ); | ||
118 | map->insert( 0x8971, new QString("SIOCSIFMAP") ); | ||
119 | qDebug( "adding 0x8980 = SIOCADDDLCI" ); | ||
120 | map->insert( 0x8980, new QString("SIOCADDDLCI") ); | ||
121 | qDebug( "adding 0x8981 = SIOCDELDLCI" ); | ||
122 | map->insert( 0x8981, new QString("SIOCDELDLCI") ); | ||
123 | qDebug( "adding 0x89F0 = SIOCDEVPRIVATE" ); | ||
124 | map->insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); | ||
125 | qDebug( "adding 0x89E0 = SIOCPROTOPRIVATE" ); | ||
126 | map->insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); | ||
127 | qDebug( "adding 0x1fff = SIOCPARM_MASK" ); | ||
128 | map->insert( 0x1fff, new QString("SIOCPARM_MASK") ); | ||
129 | qDebug( "adding 0x00000000 = SIOC_VOID" ); | ||
130 | map->insert( 0x00000000, new QString("SIOC_VOID") ); | ||
131 | qDebug( "adding 0x20000000 = SIOC_OUT" ); | ||
132 | map->insert( 0x20000000, new QString("SIOC_OUT") ); | ||
133 | qDebug( "adding 0x40000000 = SIOC_IN" ); | ||
134 | map->insert( 0x40000000, new QString("SIOC_IN") ); | ||
135 | qDebug( "adding 0x8B00 = SIOCSIWCOMMIT" ); | ||
136 | map->insert( 0x8B00, new QString("SIOCSIWCOMMIT") ); | ||
137 | qDebug( "adding 0x8B01 = SIOCGIWNAME" ); | ||
138 | map->insert( 0x8B01, new QString("SIOCGIWNAME") ); | ||
139 | qDebug( "adding 0x8B02 = SIOCSIWNWID" ); | ||
140 | map->insert( 0x8B02, new QString("SIOCSIWNWID") ); | ||
141 | qDebug( "adding 0x8B03 = SIOCGIWNWID" ); | ||
142 | map->insert( 0x8B03, new QString("SIOCGIWNWID") ); | ||
143 | qDebug( "adding 0x8B04 = SIOCSIWFREQ" ); | ||
144 | map->insert( 0x8B04, new QString("SIOCSIWFREQ") ); | ||
145 | qDebug( "adding 0x8B05 = SIOCGIWFREQ" ); | ||
146 | map->insert( 0x8B05, new QString("SIOCGIWFREQ") ); | ||
147 | qDebug( "adding 0x8B06 = SIOCSIWMODE" ); | ||
148 | map->insert( 0x8B06, new QString("SIOCSIWMODE") ); | ||
149 | qDebug( "adding 0x8B07 = SIOCGIWMODE" ); | ||
150 | map->insert( 0x8B07, new QString("SIOCGIWMODE") ); | ||
151 | qDebug( "adding 0x8B08 = SIOCSIWSENS" ); | ||
152 | map->insert( 0x8B08, new QString("SIOCSIWSENS") ); | ||
153 | qDebug( "adding 0x8B09 = SIOCGIWSENS" ); | ||
154 | map->insert( 0x8B09, new QString("SIOCGIWSENS") ); | ||
155 | qDebug( "adding 0x8B0A = SIOCSIWRANGE" ); | ||
156 | map->insert( 0x8B0A, new QString("SIOCSIWRANGE") ); | ||
157 | qDebug( "adding 0x8B0B = SIOCGIWRANGE" ); | ||
158 | map->insert( 0x8B0B, new QString("SIOCGIWRANGE") ); | ||
159 | qDebug( "adding 0x8B0C = SIOCSIWPRIV" ); | ||
160 | map->insert( 0x8B0C, new QString("SIOCSIWPRIV") ); | ||
161 | qDebug( "adding 0x8B0D = SIOCGIWPRIV" ); | ||
162 | map->insert( 0x8B0D, new QString("SIOCGIWPRIV") ); | ||
163 | qDebug( "adding 0x8B0E = SIOCSIWSTATS" ); | ||
164 | map->insert( 0x8B0E, new QString("SIOCSIWSTATS") ); | ||
165 | qDebug( "adding 0x8B0F = SIOCGIWSTATS" ); | ||
166 | map->insert( 0x8B0F, new QString("SIOCGIWSTATS") ); | ||
167 | qDebug( "adding 0x8B10 = SIOCSIWSPY" ); | ||
168 | map->insert( 0x8B10, new QString("SIOCSIWSPY") ); | ||
169 | qDebug( "adding 0x8B11 = SIOCGIWSPY" ); | ||
170 | map->insert( 0x8B11, new QString("SIOCGIWSPY") ); | ||
171 | qDebug( "adding 0x8B14 = SIOCSIWAP" ); | ||
172 | map->insert( 0x8B14, new QString("SIOCSIWAP") ); | ||
173 | qDebug( "adding 0x8B15 = SIOCGIWAP" ); | ||
174 | map->insert( 0x8B15, new QString("SIOCGIWAP") ); | ||
175 | qDebug( "adding 0x8B17 = SIOCGIWAPLIST" ); | ||
176 | map->insert( 0x8B17, new QString("SIOCGIWAPLIST") ); | ||
177 | qDebug( "adding 0x8B18 = SIOCSIWSCAN" ); | ||
178 | map->insert( 0x8B18, new QString("SIOCSIWSCAN") ); | ||
179 | qDebug( "adding 0x8B19 = SIOCGIWSCAN" ); | ||
180 | map->insert( 0x8B19, new QString("SIOCGIWSCAN") ); | ||
181 | qDebug( "adding 0x8B1A = SIOCSIWESSID" ); | ||
182 | map->insert( 0x8B1A, new QString("SIOCSIWESSID") ); | ||
183 | qDebug( "adding 0x8B1B = SIOCGIWESSID" ); | ||
184 | map->insert( 0x8B1B, new QString("SIOCGIWESSID") ); | ||
185 | qDebug( "adding 0x8B1C = SIOCSIWNICKN" ); | ||
186 | map->insert( 0x8B1C, new QString("SIOCSIWNICKN") ); | ||
187 | qDebug( "adding 0x8B1D = SIOCGIWNICKN" ); | ||
188 | map->insert( 0x8B1D, new QString("SIOCGIWNICKN") ); | ||
189 | qDebug( "adding 0x8B20 = SIOCSIWRATE" ); | ||
190 | map->insert( 0x8B20, new QString("SIOCSIWRATE") ); | ||
191 | qDebug( "adding 0x8B21 = SIOCGIWRATE" ); | ||
192 | map->insert( 0x8B21, new QString("SIOCGIWRATE") ); | ||
193 | qDebug( "adding 0x8B22 = SIOCSIWRTS" ); | ||
194 | map->insert( 0x8B22, new QString("SIOCSIWRTS") ); | ||
195 | qDebug( "adding 0x8B23 = SIOCGIWRTS" ); | ||
196 | map->insert( 0x8B23, new QString("SIOCGIWRTS") ); | ||
197 | qDebug( "adding 0x8B24 = SIOCSIWFRAG" ); | ||
198 | map->insert( 0x8B24, new QString("SIOCSIWFRAG") ); | ||
199 | qDebug( "adding 0x8B25 = SIOCGIWFRAG" ); | ||
200 | map->insert( 0x8B25, new QString("SIOCGIWFRAG") ); | ||
201 | qDebug( "adding 0x8B26 = SIOCSIWTXPOW" ); | ||
202 | map->insert( 0x8B26, new QString("SIOCSIWTXPOW") ); | ||
203 | qDebug( "adding 0x8B27 = SIOCGIWTXPOW" ); | ||
204 | map->insert( 0x8B27, new QString("SIOCGIWTXPOW") ); | ||
205 | qDebug( "adding 0x8B28 = SIOCSIWRETRY" ); | ||
206 | map->insert( 0x8B28, new QString("SIOCSIWRETRY") ); | ||
207 | qDebug( "adding 0x8B29 = SIOCGIWRETRY" ); | ||
208 | map->insert( 0x8B29, new QString("SIOCGIWRETRY") ); | ||
209 | qDebug( "adding 0x8B2A = SIOCSIWENCODE" ); | ||
210 | map->insert( 0x8B2A, new QString("SIOCSIWENCODE") ); | ||
211 | qDebug( "adding 0x8B2B = SIOCGIWENCODE" ); | ||
212 | map->insert( 0x8B2B, new QString("SIOCGIWENCODE") ); | ||
213 | qDebug( "adding 0x8B2C = SIOCSIWPOWER" ); | ||
214 | map->insert( 0x8B2C, new QString("SIOCSIWPOWER") ); | ||
215 | qDebug( "adding 0x8B2D = SIOCGIWPOWER" ); | ||
216 | map->insert( 0x8B2D, new QString("SIOCGIWPOWER") ); | ||
217 | qDebug( "adding 0x8BE0 = SIOCIWFIRSTPRIV" ); | ||
218 | map->insert( 0x8BE0, new QString("SIOCIWFIRSTPRIV") ); | ||
219 | qDebug( "adding 0x8BFF = SIOCIWLASTPRIV" ); | ||
220 | map->insert( 0x8BFF, new QString("SIOCIWLASTPRIV") ); | ||
221 | qDebug( "adding 0x8B00 = SIOCIWFIRST" ); | ||
222 | map->insert( 0x8B00, new QString("SIOCIWFIRST") ); | ||
223 | qDebug( "adding 0x5000 = SIOCGBPQETHPARAM" ); | ||
224 | map->insert( 0x5000, new QString("SIOCGBPQETHPARAM") ); | ||
225 | qDebug( "adding 0x5001 = SIOCSBPQETHPARAM" ); | ||
226 | map->insert( 0x5001, new QString("SIOCSBPQETHPARAM") ); | ||
227 | qDebug( "adding 0x890B = SIOCADDRT" ); | ||
228 | map->insert( 0x890B, new QString("SIOCADDRT") ); | ||
229 | qDebug( "adding 0x890C = SIOCDELRT" ); | ||
230 | map->insert( 0x890C, new QString("SIOCDELRT") ); | ||
231 | qDebug( "adding 0x890D = SIOCRTMSG" ); | ||
232 | map->insert( 0x890D, new QString("SIOCRTMSG") ); | ||
233 | qDebug( "adding 0x8910 = SIOCGIFNAME" ); | ||
234 | map->insert( 0x8910, new QString("SIOCGIFNAME") ); | ||
235 | qDebug( "adding 0x8911 = SIOCSIFLINK" ); | ||
236 | map->insert( 0x8911, new QString("SIOCSIFLINK") ); | ||
237 | qDebug( "adding 0x8912 = SIOCGIFCONF" ); | ||
238 | map->insert( 0x8912, new QString("SIOCGIFCONF") ); | ||
239 | qDebug( "adding 0x8913 = SIOCGIFFLAGS" ); | ||
240 | map->insert( 0x8913, new QString("SIOCGIFFLAGS") ); | ||
241 | qDebug( "adding 0x8914 = SIOCSIFFLAGS" ); | ||
242 | map->insert( 0x8914, new QString("SIOCSIFFLAGS") ); | ||
243 | qDebug( "adding 0x8915 = SIOCGIFADDR" ); | ||
244 | map->insert( 0x8915, new QString("SIOCGIFADDR") ); | ||
245 | qDebug( "adding 0x8916 = SIOCSIFADDR" ); | ||
246 | map->insert( 0x8916, new QString("SIOCSIFADDR") ); | ||
247 | qDebug( "adding 0x8917 = SIOCGIFDSTADDR" ); | ||
248 | map->insert( 0x8917, new QString("SIOCGIFDSTADDR") ); | ||
249 | qDebug( "adding 0x8918 = SIOCSIFDSTADDR" ); | ||
250 | map->insert( 0x8918, new QString("SIOCSIFDSTADDR") ); | ||
251 | qDebug( "adding 0x8919 = SIOCGIFBRDADDR" ); | ||
252 | map->insert( 0x8919, new QString("SIOCGIFBRDADDR") ); | ||
253 | qDebug( "adding 0x891a = SIOCSIFBRDADDR" ); | ||
254 | map->insert( 0x891a, new QString("SIOCSIFBRDADDR") ); | ||
255 | qDebug( "adding 0x891b = SIOCGIFNETMASK" ); | ||
256 | map->insert( 0x891b, new QString("SIOCGIFNETMASK") ); | ||
257 | qDebug( "adding 0x891c = SIOCSIFNETMASK" ); | ||
258 | map->insert( 0x891c, new QString("SIOCSIFNETMASK") ); | ||
259 | qDebug( "adding 0x891d = SIOCGIFMETRIC" ); | ||
260 | map->insert( 0x891d, new QString("SIOCGIFMETRIC") ); | ||
261 | qDebug( "adding 0x891e = SIOCSIFMETRIC" ); | ||
262 | map->insert( 0x891e, new QString("SIOCSIFMETRIC") ); | ||
263 | qDebug( "adding 0x891f = SIOCGIFMEM" ); | ||
264 | map->insert( 0x891f, new QString("SIOCGIFMEM") ); | ||
265 | qDebug( "adding 0x8920 = SIOCSIFMEM" ); | ||
266 | map->insert( 0x8920, new QString("SIOCSIFMEM") ); | ||
267 | qDebug( "adding 0x8921 = SIOCGIFMTU" ); | ||
268 | map->insert( 0x8921, new QString("SIOCGIFMTU") ); | ||
269 | qDebug( "adding 0x8922 = SIOCSIFMTU" ); | ||
270 | map->insert( 0x8922, new QString("SIOCSIFMTU") ); | ||
271 | qDebug( "adding 0x8923 = SIOCSIFNAME" ); | ||
272 | map->insert( 0x8923, new QString("SIOCSIFNAME") ); | ||
273 | qDebug( "adding 0x8924 = SIOCSIFHWADDR" ); | ||
274 | map->insert( 0x8924, new QString("SIOCSIFHWADDR") ); | ||
275 | qDebug( "adding 0x8925 = SIOCGIFENCAP" ); | ||
276 | map->insert( 0x8925, new QString("SIOCGIFENCAP") ); | ||
277 | qDebug( "adding 0x8926 = SIOCSIFENCAP" ); | ||
278 | map->insert( 0x8926, new QString("SIOCSIFENCAP") ); | ||
279 | qDebug( "adding 0x8927 = SIOCGIFHWADDR" ); | ||
280 | map->insert( 0x8927, new QString("SIOCGIFHWADDR") ); | ||
281 | qDebug( "adding 0x8929 = SIOCGIFSLAVE" ); | ||
282 | map->insert( 0x8929, new QString("SIOCGIFSLAVE") ); | ||
283 | qDebug( "adding 0x8930 = SIOCSIFSLAVE" ); | ||
284 | map->insert( 0x8930, new QString("SIOCSIFSLAVE") ); | ||
285 | qDebug( "adding 0x8931 = SIOCADDMULTI" ); | ||
286 | map->insert( 0x8931, new QString("SIOCADDMULTI") ); | ||
287 | qDebug( "adding 0x8932 = SIOCDELMULTI" ); | ||
288 | map->insert( 0x8932, new QString("SIOCDELMULTI") ); | ||
289 | qDebug( "adding 0x8933 = SIOCGIFINDEX" ); | ||
290 | map->insert( 0x8933, new QString("SIOCGIFINDEX") ); | ||
291 | qDebug( "adding 0x8934 = SIOCSIFPFLAGS" ); | ||
292 | map->insert( 0x8934, new QString("SIOCSIFPFLAGS") ); | ||
293 | qDebug( "adding 0x8935 = SIOCGIFPFLAGS" ); | ||
294 | map->insert( 0x8935, new QString("SIOCGIFPFLAGS") ); | ||
295 | qDebug( "adding 0x8936 = SIOCDIFADDR" ); | ||
296 | map->insert( 0x8936, new QString("SIOCDIFADDR") ); | ||
297 | qDebug( "adding 0x8937 = SIOCSIFHWBROADCAST" ); | ||
298 | map->insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); | ||
299 | qDebug( "adding 0x8938 = SIOCGIFCOUNT" ); | ||
300 | map->insert( 0x8938, new QString("SIOCGIFCOUNT") ); | ||
301 | qDebug( "adding 0x8940 = SIOCGIFBR" ); | ||
302 | map->insert( 0x8940, new QString("SIOCGIFBR") ); | ||
303 | qDebug( "adding 0x8941 = SIOCSIFBR" ); | ||
304 | map->insert( 0x8941, new QString("SIOCSIFBR") ); | ||
305 | qDebug( "adding 0x8942 = SIOCGIFTXQLEN" ); | ||
306 | map->insert( 0x8942, new QString("SIOCGIFTXQLEN") ); | ||
307 | qDebug( "adding 0x8943 = SIOCSIFTXQLEN" ); | ||
308 | map->insert( 0x8943, new QString("SIOCSIFTXQLEN") ); | ||
309 | qDebug( "adding 0x8944 = SIOCGIFDIVERT" ); | ||
310 | map->insert( 0x8944, new QString("SIOCGIFDIVERT") ); | ||
311 | qDebug( "adding 0x8945 = SIOCSIFDIVERT" ); | ||
312 | map->insert( 0x8945, new QString("SIOCSIFDIVERT") ); | ||
313 | qDebug( "adding 0x8946 = SIOCETHTOOL" ); | ||
314 | map->insert( 0x8946, new QString("SIOCETHTOOL") ); | ||
315 | qDebug( "adding 0x8947 = SIOCGMIIPHY" ); | ||
316 | map->insert( 0x8947, new QString("SIOCGMIIPHY") ); | ||
317 | qDebug( "adding 0x8948 = SIOCGMIIREG" ); | ||
318 | map->insert( 0x8948, new QString("SIOCGMIIREG") ); | ||
319 | qDebug( "adding 0x8949 = SIOCSMIIREG" ); | ||
320 | map->insert( 0x8949, new QString("SIOCSMIIREG") ); | ||
321 | qDebug( "adding 0x894A = SIOCWANDEV" ); | ||
322 | map->insert( 0x894A, new QString("SIOCWANDEV") ); | ||
323 | qDebug( "adding 0x8953 = SIOCDARP" ); | ||
324 | map->insert( 0x8953, new QString("SIOCDARP") ); | ||
325 | qDebug( "adding 0x8954 = SIOCGARP" ); | ||
326 | map->insert( 0x8954, new QString("SIOCGARP") ); | ||
327 | qDebug( "adding 0x8955 = SIOCSARP" ); | ||
328 | map->insert( 0x8955, new QString("SIOCSARP") ); | ||
329 | qDebug( "adding 0x8960 = SIOCDRARP" ); | ||
330 | map->insert( 0x8960, new QString("SIOCDRARP") ); | ||
331 | qDebug( "adding 0x8961 = SIOCGRARP" ); | ||
332 | map->insert( 0x8961, new QString("SIOCGRARP") ); | ||
333 | qDebug( "adding 0x8962 = SIOCSRARP" ); | ||
334 | map->insert( 0x8962, new QString("SIOCSRARP") ); | ||
335 | qDebug( "adding 0x8970 = SIOCGIFMAP" ); | ||
336 | map->insert( 0x8970, new QString("SIOCGIFMAP") ); | ||
337 | qDebug( "adding 0x8971 = SIOCSIFMAP" ); | ||
338 | map->insert( 0x8971, new QString("SIOCSIFMAP") ); | ||
339 | qDebug( "adding 0x8980 = SIOCADDDLCI" ); | ||
340 | map->insert( 0x8980, new QString("SIOCADDDLCI") ); | ||
341 | qDebug( "adding 0x8981 = SIOCDELDLCI" ); | ||
342 | map->insert( 0x8981, new QString("SIOCDELDLCI") ); | ||
343 | qDebug( "adding 0x8982 = SIOCGIFVLAN" ); | ||
344 | map->insert( 0x8982, new QString("SIOCGIFVLAN") ); | ||
345 | qDebug( "adding 0x8983 = SIOCSIFVLAN" ); | ||
346 | map->insert( 0x8983, new QString("SIOCSIFVLAN") ); | ||
347 | qDebug( "adding 0x8990 = SIOCBONDENSLAVE" ); | ||
348 | map->insert( 0x8990, new QString("SIOCBONDENSLAVE") ); | ||
349 | qDebug( "adding 0x8991 = SIOCBONDRELEASE" ); | ||
350 | map->insert( 0x8991, new QString("SIOCBONDRELEASE") ); | ||
351 | qDebug( "adding 0x8992 = SIOCBONDSETHWADDR" ); | ||
352 | map->insert( 0x8992, new QString("SIOCBONDSETHWADDR") ); | ||
353 | qDebug( "adding 0x8993 = SIOCBONDSLAVEINFOQUERY" ); | ||
354 | map->insert( 0x8993, new QString("SIOCBONDSLAVEINFOQUERY") ); | ||
355 | qDebug( "adding 0x8994 = SIOCBONDINFOQUERY" ); | ||
356 | map->insert( 0x8994, new QString("SIOCBONDINFOQUERY") ); | ||
357 | qDebug( "adding 0x8995 = SIOCBONDCHANGEACTIVE" ); | ||
358 | map->insert( 0x8995, new QString("SIOCBONDCHANGEACTIVE") ); | ||
359 | qDebug( "adding 0x89F0 = SIOCDEVPRIVATE" ); | ||
360 | map->insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); | ||
361 | qDebug( "adding 0x89E0 = SIOCPROTOPRIVATE" ); | ||
362 | map->insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); | ||
363 | |||
364 | return map; | ||
365 | }; | ||
366 | |||
diff --git a/libopie2/opienet/oioctlmap.h b/libopie2/opienet/oioctlmap.h new file mode 100644 index 0000000..1cd89a3 --- a/dev/null +++ b/libopie2/opienet/oioctlmap.h | |||
@@ -0,0 +1,17 @@ | |||
1 | |||
2 | /* | ||
3 | * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | ||
4 | */ | ||
5 | |||
6 | #ifndef IOCTLMAP_H | ||
7 | #define IOCTLMAP_H | ||
8 | |||
9 | #include <qstring.h> | ||
10 | #include <qintdict.h> | ||
11 | |||
12 | typedef QIntDict<QString> IntStringMap; | ||
13 | |||
14 | IntStringMap* constructIoctlMap(); | ||
15 | |||
16 | #endif | ||
17 | |||
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index be45924..918ba07 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -13,96 +13,101 @@ | |||
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | 35 | ||
36 | #include <opie2/onetwork.h> | 36 | #include <opie2/onetwork.h> |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | 39 | ||
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | 42 | ||
43 | /* UNIX */ | 43 | /* UNIX */ |
44 | 44 | ||
45 | #include <assert.h> | 45 | #include <assert.h> |
46 | #include <arpa/inet.h> | 46 | #include <arpa/inet.h> |
47 | #include <cerrno> | 47 | #include <cerrno> |
48 | #include <cstring> | 48 | #include <cstring> |
49 | #include <cstdlib> | 49 | #include <cstdlib> |
50 | #include <math.h> | 50 | #include <math.h> |
51 | #include <sys/ioctl.h> | 51 | #include <sys/ioctl.h> |
52 | #include <sys/socket.h> | 52 | #include <sys/socket.h> |
53 | #include <sys/types.h> | 53 | #include <sys/types.h> |
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #include <linux/sockios.h> | 55 | #include <linux/sockios.h> |
56 | #include <net/if_arp.h> | 56 | #include <net/if_arp.h> |
57 | #include <stdarg.h> | 57 | #include <stdarg.h> |
58 | 58 | ||
59 | using namespace std; | 59 | using namespace std; |
60 | 60 | ||
61 | #ifndef NODEBUG | ||
62 | #include <opie2/oioctlmap.h> | ||
63 | IntStringMap* _ioctlmap = constructIoctlMap(); | ||
64 | #endif | ||
65 | |||
61 | /*====================================================================================== | 66 | /*====================================================================================== |
62 | * ONetwork | 67 | * ONetwork |
63 | *======================================================================================*/ | 68 | *======================================================================================*/ |
64 | 69 | ||
65 | ONetwork* ONetwork::_instance = 0; | 70 | ONetwork* ONetwork::_instance = 0; |
66 | 71 | ||
67 | ONetwork::ONetwork() | 72 | ONetwork::ONetwork() |
68 | { | 73 | { |
69 | qDebug( "ONetwork::ONetwork()" ); | 74 | qDebug( "ONetwork::ONetwork()" ); |
70 | qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT ); | 75 | qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT ); |
71 | synchronize(); | 76 | synchronize(); |
72 | } | 77 | } |
73 | 78 | ||
74 | void ONetwork::synchronize() | 79 | void ONetwork::synchronize() |
75 | { | 80 | { |
76 | // gather available interfaces by inspecting /proc/net/dev | 81 | // gather available interfaces by inspecting /proc/net/dev |
77 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 82 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
78 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | 83 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
79 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | 84 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev |
80 | 85 | ||
81 | _interfaces.clear(); | 86 | _interfaces.clear(); |
82 | QString str; | 87 | QString str; |
83 | QFile f( "/proc/net/dev" ); | 88 | QFile f( "/proc/net/dev" ); |
84 | bool hasFile = f.open( IO_ReadOnly ); | 89 | bool hasFile = f.open( IO_ReadOnly ); |
85 | if ( !hasFile ) | 90 | if ( !hasFile ) |
86 | { | 91 | { |
87 | qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" ); | 92 | qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" ); |
88 | return; | 93 | return; |
89 | } | 94 | } |
90 | QTextStream s( &f ); | 95 | QTextStream s( &f ); |
91 | s.readLine(); | 96 | s.readLine(); |
92 | s.readLine(); | 97 | s.readLine(); |
93 | while ( !s.atEnd() ) | 98 | while ( !s.atEnd() ) |
94 | { | 99 | { |
95 | s >> str; | 100 | s >> str; |
96 | str.truncate( str.find( ':' ) ); | 101 | str.truncate( str.find( ':' ) ); |
97 | qDebug( "ONetwork: found interface '%s'", (const char*) str ); | 102 | qDebug( "ONetwork: found interface '%s'", (const char*) str ); |
98 | ONetworkInterface* iface; | 103 | ONetworkInterface* iface; |
99 | if ( isWirelessInterface( str ) ) | 104 | if ( isWirelessInterface( str ) ) |
100 | { | 105 | { |
101 | iface = new OWirelessNetworkInterface( this, (const char*) str ); | 106 | iface = new OWirelessNetworkInterface( this, (const char*) str ); |
102 | qDebug( "ONetwork: interface '%s' has Wireless Extensions", (const char*) str ); | 107 | qDebug( "ONetwork: interface '%s' has Wireless Extensions", (const char*) str ); |
103 | } | 108 | } |
104 | else | 109 | else |
105 | { | 110 | { |
106 | iface = new ONetworkInterface( this, (const char*) str ); | 111 | iface = new ONetworkInterface( this, (const char*) str ); |
107 | } | 112 | } |
108 | _interfaces.insert( str, iface ); | 113 | _interfaces.insert( str, iface ); |
@@ -142,102 +147,106 @@ ONetwork::InterfaceIterator ONetwork::iterator() const | |||
142 | } | 147 | } |
143 | 148 | ||
144 | 149 | ||
145 | bool ONetwork::isWirelessInterface( const char* name ) const | 150 | bool ONetwork::isWirelessInterface( const char* name ) const |
146 | { | 151 | { |
147 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); | 152 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); |
148 | struct iwreq iwr; | 153 | struct iwreq iwr; |
149 | memset( &iwr, 0, sizeof( struct iwreq ) ); | 154 | memset( &iwr, 0, sizeof( struct iwreq ) ); |
150 | strcpy( (char*) &iwr.ifr_name, name ); | 155 | strcpy( (char*) &iwr.ifr_name, name ); |
151 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); | 156 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); |
152 | return result != -1; | 157 | return result != -1; |
153 | } | 158 | } |
154 | 159 | ||
155 | /*====================================================================================== | 160 | /*====================================================================================== |
156 | * ONetworkInterface | 161 | * ONetworkInterface |
157 | *======================================================================================*/ | 162 | *======================================================================================*/ |
158 | 163 | ||
159 | ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) | 164 | ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) |
160 | :QObject( parent, name ), | 165 | :QObject( parent, name ), |
161 | _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) | 166 | _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) |
162 | { | 167 | { |
163 | qDebug( "ONetworkInterface::ONetworkInterface()" ); | 168 | qDebug( "ONetworkInterface::ONetworkInterface()" ); |
164 | init(); | 169 | init(); |
165 | } | 170 | } |
166 | 171 | ||
167 | 172 | ||
168 | struct ifreq& ONetworkInterface::ifr() const | 173 | struct ifreq& ONetworkInterface::ifr() const |
169 | { | 174 | { |
170 | return _ifr; | 175 | return _ifr; |
171 | } | 176 | } |
172 | 177 | ||
173 | 178 | ||
174 | void ONetworkInterface::init() | 179 | void ONetworkInterface::init() |
175 | { | 180 | { |
176 | qDebug( "ONetworkInterface::init()" ); | 181 | qDebug( "ONetworkInterface::init()" ); |
177 | 182 | ||
178 | memset( &_ifr, 0, sizeof( struct ifreq ) ); | 183 | memset( &_ifr, 0, sizeof( struct ifreq ) ); |
179 | 184 | ||
180 | if ( _sfd == -1 ) | 185 | if ( _sfd == -1 ) |
181 | { | 186 | { |
182 | qDebug( "ONetworkInterface::init(): Warning - can't get socket for device '%s'", name() ); | 187 | qDebug( "ONetworkInterface::init(): Warning - can't get socket for device '%s'", name() ); |
183 | return; | 188 | return; |
184 | } | 189 | } |
185 | } | 190 | } |
186 | 191 | ||
187 | 192 | ||
188 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const | 193 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const |
189 | { | 194 | { |
195 | #ifndef NODEBUG | ||
190 | int result = ::ioctl( _sfd, call, &ifreq ); | 196 | int result = ::ioctl( _sfd, call, &ifreq ); |
191 | if ( result == -1 ) | 197 | if ( result == -1 ) |
192 | qDebug( "ONetworkInterface::ioctl (%s) call %d (0x%04X) - Status: Failed: %d (%s)", name(), call, call, result, strerror( errno ) ); | 198 | qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); |
193 | else | 199 | else |
194 | qDebug( "ONetworkInterface::ioctl (%s) call %d (0x%04X) - Status: Ok.", name(), call, call ); | 200 | qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); |
195 | return ( result != -1 ); | 201 | return ( result != -1 ); |
202 | #else | ||
203 | return ::ioctl( _sfd, call, &ifreq ) != -1; | ||
204 | #endif | ||
196 | } | 205 | } |
197 | 206 | ||
198 | 207 | ||
199 | bool ONetworkInterface::ioctl( int call ) const | 208 | bool ONetworkInterface::ioctl( int call ) const |
200 | { | 209 | { |
201 | strcpy( _ifr.ifr_name, name() ); | 210 | strcpy( _ifr.ifr_name, name() ); |
202 | return ioctl( call, _ifr ); | 211 | return ioctl( call, _ifr ); |
203 | } | 212 | } |
204 | 213 | ||
205 | 214 | ||
206 | bool ONetworkInterface::isLoopback() const | 215 | bool ONetworkInterface::isLoopback() const |
207 | { | 216 | { |
208 | ioctl( SIOCGIFFLAGS ); | 217 | ioctl( SIOCGIFFLAGS ); |
209 | return _ifr.ifr_flags & IFF_LOOPBACK; | 218 | return _ifr.ifr_flags & IFF_LOOPBACK; |
210 | } | 219 | } |
211 | 220 | ||
212 | 221 | ||
213 | bool ONetworkInterface::setUp( bool b ) | 222 | bool ONetworkInterface::setUp( bool b ) |
214 | { | 223 | { |
215 | ioctl( SIOCGIFFLAGS ); | 224 | ioctl( SIOCGIFFLAGS ); |
216 | if ( b ) _ifr.ifr_flags |= IFF_UP; | 225 | if ( b ) _ifr.ifr_flags |= IFF_UP; |
217 | else _ifr.ifr_flags &= (~IFF_UP); | 226 | else _ifr.ifr_flags &= (~IFF_UP); |
218 | return ioctl( SIOCSIFFLAGS ); | 227 | return ioctl( SIOCSIFFLAGS ); |
219 | } | 228 | } |
220 | 229 | ||
221 | 230 | ||
222 | bool ONetworkInterface::isUp() const | 231 | bool ONetworkInterface::isUp() const |
223 | { | 232 | { |
224 | ioctl( SIOCGIFFLAGS ); | 233 | ioctl( SIOCGIFFLAGS ); |
225 | return _ifr.ifr_flags & IFF_UP; | 234 | return _ifr.ifr_flags & IFF_UP; |
226 | } | 235 | } |
227 | 236 | ||
228 | 237 | ||
229 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) | 238 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) |
230 | { | 239 | { |
231 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 240 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
232 | sa->sin_family = AF_INET; | 241 | sa->sin_family = AF_INET; |
233 | sa->sin_port = 0; | 242 | sa->sin_port = 0; |
234 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 243 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
235 | ioctl( SIOCSIFADDR ); | 244 | ioctl( SIOCSIFADDR ); |
236 | } | 245 | } |
237 | 246 | ||
238 | 247 | ||
239 | QString ONetworkInterface::ipV4Address() const | 248 | QString ONetworkInterface::ipV4Address() const |
240 | { | 249 | { |
241 | if ( ioctl( SIOCGIFADDR ) ) | 250 | if ( ioctl( SIOCGIFADDR ) ) |
242 | { | 251 | { |
243 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 252 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
@@ -838,102 +847,106 @@ int OWirelessNetworkInterface::scanNetwork() | |||
838 | tv.tv_sec = 0; | 847 | tv.tv_sec = 0; |
839 | tv.tv_usec = 250000; // initial timeout ~ 250ms | 848 | tv.tv_usec = 250000; // initial timeout ~ 250ms |
840 | char buffer[IW_SCAN_MAX_DATA]; | 849 | char buffer[IW_SCAN_MAX_DATA]; |
841 | 850 | ||
842 | while ( !results && timeout > 0 ) | 851 | while ( !results && timeout > 0 ) |
843 | { | 852 | { |
844 | timeout -= tv.tv_usec; | 853 | timeout -= tv.tv_usec; |
845 | select( 0, 0, 0, 0, &tv ); | 854 | select( 0, 0, 0, 0, &tv ); |
846 | 855 | ||
847 | _iwr.u.data.pointer = &buffer[0]; | 856 | _iwr.u.data.pointer = &buffer[0]; |
848 | _iwr.u.data.flags = 0; | 857 | _iwr.u.data.flags = 0; |
849 | _iwr.u.data.length = sizeof buffer; | 858 | _iwr.u.data.length = sizeof buffer; |
850 | if ( wioctl( SIOCGIWSCAN ) ) | 859 | if ( wioctl( SIOCGIWSCAN ) ) |
851 | { | 860 | { |
852 | results = true; | 861 | results = true; |
853 | continue; | 862 | continue; |
854 | } | 863 | } |
855 | else if ( errno == EAGAIN) | 864 | else if ( errno == EAGAIN) |
856 | { | 865 | { |
857 | qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." ); | 866 | qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." ); |
858 | #if 0 | 867 | #if 0 |
859 | if ( qApp ) | 868 | if ( qApp ) |
860 | { | 869 | { |
861 | qApp->processEvents( 100 ); | 870 | qApp->processEvents( 100 ); |
862 | continue; | 871 | continue; |
863 | } | 872 | } |
864 | #endif | 873 | #endif |
865 | tv.tv_sec = 0; | 874 | tv.tv_sec = 0; |
866 | tv.tv_usec = 100000; | 875 | tv.tv_usec = 100000; |
867 | continue; | 876 | continue; |
868 | } | 877 | } |
869 | } | 878 | } |
870 | 879 | ||
871 | qDebug( "ONetworkInterface::scanNetwork() - scan finished." ); | 880 | qDebug( "ONetworkInterface::scanNetwork() - scan finished." ); |
872 | 881 | ||
873 | if ( results ) | 882 | if ( results ) |
874 | { | 883 | { |
875 | qDebug( " - results are in!" ); | 884 | qDebug( " - results are in!" ); |
876 | } | 885 | } |
877 | else | 886 | else |
878 | { | 887 | { |
879 | qDebug( " - no results :(" ); | 888 | qDebug( " - no results :(" ); |
880 | } | 889 | } |
881 | } | 890 | } |
882 | 891 | ||
883 | 892 | ||
884 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 893 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
885 | { | 894 | { |
895 | #ifndef NODEBUG | ||
886 | int result = ::ioctl( _sfd, call, &iwreq ); | 896 | int result = ::ioctl( _sfd, call, &iwreq ); |
887 | if ( result == -1 ) | 897 | if ( result == -1 ) |
888 | qDebug( "ONetworkInterface::wioctl (%s) call %d (0x%04X) - Status: Failed: %d (%s)", name(), call, call, result, strerror( errno ) ); | 898 | qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); |
889 | else | 899 | else |
890 | qDebug( "ONetworkInterface::wioctl (%s) call %d (0x%04X) - Status: Ok.", name(), call, call ); | 900 | qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); |
891 | return ( result != -1 ); | 901 | return ( result != -1 ); |
902 | #else | ||
903 | return ::ioctl( _sfd, call, &iwreq ) != -1; | ||
904 | #endif | ||
892 | } | 905 | } |
893 | 906 | ||
894 | 907 | ||
895 | bool OWirelessNetworkInterface::wioctl( int call ) const | 908 | bool OWirelessNetworkInterface::wioctl( int call ) const |
896 | { | 909 | { |
897 | strcpy( _iwr.ifr_name, name() ); | 910 | strcpy( _iwr.ifr_name, name() ); |
898 | return wioctl( call, _iwr ); | 911 | return wioctl( call, _iwr ); |
899 | } | 912 | } |
900 | 913 | ||
901 | 914 | ||
902 | /*====================================================================================== | 915 | /*====================================================================================== |
903 | * OMonitoringInterface | 916 | * OMonitoringInterface |
904 | *======================================================================================*/ | 917 | *======================================================================================*/ |
905 | 918 | ||
906 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 919 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
907 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) | 920 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) |
908 | { | 921 | { |
909 | } | 922 | } |
910 | 923 | ||
911 | 924 | ||
912 | OMonitoringInterface::~OMonitoringInterface() | 925 | OMonitoringInterface::~OMonitoringInterface() |
913 | { | 926 | { |
914 | } | 927 | } |
915 | 928 | ||
916 | 929 | ||
917 | void OMonitoringInterface::setChannel( int c ) | 930 | void OMonitoringInterface::setChannel( int c ) |
918 | { | 931 | { |
919 | // use standard WE channel switching protocol | 932 | // use standard WE channel switching protocol |
920 | memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); | 933 | memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); |
921 | _if->_iwr.u.freq.m = c; | 934 | _if->_iwr.u.freq.m = c; |
922 | _if->_iwr.u.freq.e = 0; | 935 | _if->_iwr.u.freq.e = 0; |
923 | _if->wioctl( SIOCSIWFREQ ); | 936 | _if->wioctl( SIOCSIWFREQ ); |
924 | } | 937 | } |
925 | 938 | ||
926 | 939 | ||
927 | bool OMonitoringInterface::enabled() const | 940 | bool OMonitoringInterface::enabled() const |
928 | { | 941 | { |
929 | return _if->monitorMode(); | 942 | return _if->monitorMode(); |
930 | } | 943 | } |
931 | 944 | ||
932 | 945 | ||
933 | void OMonitoringInterface::setEnabled( bool b ) | 946 | void OMonitoringInterface::setEnabled( bool b ) |
934 | { | 947 | { |
935 | } | 948 | } |
936 | 949 | ||
937 | 950 | ||
938 | /*====================================================================================== | 951 | /*====================================================================================== |
939 | * OCiscoMonitoringInterface | 952 | * OCiscoMonitoringInterface |
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro index 6fcc1ec..304d968 100644 --- a/libopie2/opienet/opienet.pro +++ b/libopie2/opienet/opienet.pro | |||
@@ -1,31 +1,32 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = 802_11_user.h \ | 4 | HEADERS = 802_11_user.h \ |
5 | dhcp.h \ | 5 | dhcp.h \ |
6 | udp_ports.h \ | ||
6 | wireless.h \ | 7 | wireless.h \ |
7 | omanufacturerdb.cpp \ | 8 | oioctlmap.h \ |
8 | onetutils.cpp \ | 9 | omanufacturerdb.h \ |
10 | onetutils.h \ | ||
9 | onetwork.h \ | 11 | onetwork.h \ |
10 | opcap.h | 12 | opcap.h |
11 | SOURCES = omanufacturerdb.cpp \ | 13 | SOURCES = oioctlmap.cpp \ |
14 | omanufacturerdb.cpp \ | ||
12 | onetutils.cpp \ | 15 | onetutils.cpp \ |
13 | onetwork.cpp \ | 16 | onetwork.cpp \ |
14 | opcap.cpp | 17 | opcap.cpp |
15 | INTERFACES = | 18 | INTERFACES = |
16 | TARGET = opienet2 | 19 | TARGET = opienet2 |
17 | VERSION = 1.8.1 | 20 | VERSION = 1.8.1 |
18 | INCLUDEPATH += $(OPIEDIR)/include | 21 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH += $(OPIEDIR)/include | 22 | DEPENDPATH += $(OPIEDIR)/include |
20 | LIBS += -lpcap | 23 | LIBS += -lpcap |
21 | MOC_DIR = moc | ||
22 | OBJECTS_DIR = obj | ||
23 | 24 | ||
24 | 25 | ||
25 | !contains( platform, x11 ) { | 26 | !contains( platform, x11 ) { |
26 | include ( $(OPIEDIR)/include.pro ) | 27 | include ( $(OPIEDIR)/include.pro ) |
27 | } | 28 | } |
28 | 29 | ||
29 | contains( platform, x11 ) { | 30 | contains( platform, x11 ) { |
30 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 31 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
31 | } | 32 | } |