author | mickeyl <mickeyl> | 2003-10-21 13:23:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-21 13:23:37 (UTC) |
commit | 76ca3158518a851085b5a5ebe3724d0c0c3be857 (patch) (unidiff) | |
tree | c1e3cd417968e08a4f01497a431720f3088f0fa6 | |
parent | fccc5d110dea3bc32176694c8e5fc7f014706be6 (diff) | |
download | opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.zip opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.tar.gz opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.tar.bz2 |
add clear text debug output for ioctls
-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 | ||||
-rwxr-xr-x | libopie2/tools/regen.py | 64 |
5 files changed, 470 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 | |||
@@ -37,48 +37,53 @@ | |||
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 ); |
@@ -166,54 +171,58 @@ ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) | |||
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 | } |
@@ -862,54 +871,58 @@ int OWirelessNetworkInterface::scanNetwork() | |||
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 | ||
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 | } |
diff --git a/libopie2/tools/regen.py b/libopie2/tools/regen.py new file mode 100755 index 0000000..2f7f418 --- a/dev/null +++ b/libopie2/tools/regen.py | |||
@@ -0,0 +1,64 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | # | ||
4 | # regenerate ioctl_table.h | ||
5 | # | ||
6 | |||
7 | import sys | ||
8 | import os | ||
9 | result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines() | ||
10 | |||
11 | try: | ||
12 | tablehfile = file( sys.argv[1]+".h", "w" ) | ||
13 | except: | ||
14 | tablehfile = sys.stdout | ||
15 | |||
16 | try: | ||
17 | tablecfile = file( sys.argv[1]+".cpp", "w" ) | ||
18 | except: | ||
19 | tablecfile = sys.stdout | ||
20 | |||
21 | print >>tablehfile,""" | ||
22 | /* | ||
23 | * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | ||
24 | */ | ||
25 | |||
26 | #ifndef IOCTLMAP_H | ||
27 | #define IOCTLMAP_H | ||
28 | |||
29 | #include <qstring.h> | ||
30 | #include <qintdict.h> | ||
31 | |||
32 | typedef QIntDict<QString> IntStringMap; | ||
33 | |||
34 | IntStringMap* constructIoctlMap(); | ||
35 | |||
36 | #endif | ||
37 | """ | ||
38 | |||
39 | print >>tablecfile,""" | ||
40 | /* | ||
41 | * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | ||
42 | */ | ||
43 | |||
44 | #include "%s" | ||
45 | |||
46 | IntStringMap* constructIoctlMap() | ||
47 | { | ||
48 | \tIntStringMap* map = new IntStringMap(); | ||
49 | |||
50 | """ % (tablehfile.name) | ||
51 | |||
52 | for line in result: | ||
53 | l = line.split() | ||
54 | if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ): | ||
55 | print >>sys.stderr, "can't parse line: %s" % l | ||
56 | continue | ||
57 | #print >>tablecfile, "\tqDebug( \"adding %s = %s\" );" % ( l[2], l[1] ) | ||
58 | print >>tablecfile, "\tmap->insert( %s, new QString(\"%s\") );" % ( l[2], l[1] ) | ||
59 | |||
60 | |||
61 | print >>tablecfile,""" | ||
62 | \treturn map; | ||
63 | }; | ||
64 | """ \ No newline at end of file | ||