summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/odebugmapper.cpp213
-rw-r--r--libopie2/opienet/odebugmapper.h26
-rw-r--r--libopie2/opienet/oioctlmap.cpp366
-rw-r--r--libopie2/opienet/oioctlmap.h17
-rw-r--r--libopie2/opienet/onetutils.cpp15
-rw-r--r--libopie2/opienet/onetutils.h18
-rw-r--r--libopie2/opienet/onetwork.cpp20
-rw-r--r--libopie2/opienet/opienet.pro4
-rwxr-xr-xlibopie2/tools/regen.py52
9 files changed, 311 insertions, 420 deletions
diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp
new file mode 100644
index 0000000..d62b3ba
--- a/dev/null
+++ b/libopie2/opienet/odebugmapper.cpp
@@ -0,0 +1,213 @@
1
2/*
3 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
4 */
5
6#include "odebugmapper.h"
7
8DebugMapper::DebugMapper()
9{
10 qDebug( "DebugMapper::DebugMapper()" );
11
12
13 _map.insert( 0x8902, new QString("SIOCSPGRP") );
14 _map.insert( 0x8904, new QString("SIOCGPGRP") );
15 _map.insert( 0x8905, new QString("SIOCATMARK") );
16 _map.insert( 0x8906, new QString("SIOCGSTAMP") );
17 _map.insert( 0x890B, new QString("SIOCADDRT") );
18 _map.insert( 0x890C, new QString("SIOCDELRT") );
19 _map.insert( 0x890D, new QString("SIOCRTMSG") );
20 _map.insert( 0x8910, new QString("SIOCGIFNAME") );
21 _map.insert( 0x8911, new QString("SIOCSIFLINK") );
22 _map.insert( 0x8912, new QString("SIOCGIFCONF") );
23 _map.insert( 0x8913, new QString("SIOCGIFFLAGS") );
24 _map.insert( 0x8914, new QString("SIOCSIFFLAGS") );
25 _map.insert( 0x8915, new QString("SIOCGIFADDR") );
26 _map.insert( 0x8916, new QString("SIOCSIFADDR") );
27 _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") );
28 _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") );
29 _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") );
30 _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") );
31 _map.insert( 0x891b, new QString("SIOCGIFNETMASK") );
32 _map.insert( 0x891c, new QString("SIOCSIFNETMASK") );
33 _map.insert( 0x891d, new QString("SIOCGIFMETRIC") );
34 _map.insert( 0x891e, new QString("SIOCSIFMETRIC") );
35 _map.insert( 0x891f, new QString("SIOCGIFMEM") );
36 _map.insert( 0x8920, new QString("SIOCSIFMEM") );
37 _map.insert( 0x8921, new QString("SIOCGIFMTU") );
38 _map.insert( 0x8922, new QString("SIOCSIFMTU") );
39 _map.insert( 0x8923, new QString("SIOCSIFNAME") );
40 _map.insert( 0x8924, new QString("SIOCSIFHWADDR") );
41 _map.insert( 0x8925, new QString("SIOCGIFENCAP") );
42 _map.insert( 0x8926, new QString("SIOCSIFENCAP") );
43 _map.insert( 0x8927, new QString("SIOCGIFHWADDR") );
44 _map.insert( 0x8929, new QString("SIOCGIFSLAVE") );
45 _map.insert( 0x8930, new QString("SIOCSIFSLAVE") );
46 _map.insert( 0x8931, new QString("SIOCADDMULTI") );
47 _map.insert( 0x8932, new QString("SIOCDELMULTI") );
48 _map.insert( 0x8933, new QString("SIOCGIFINDEX") );
49 _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") );
50 _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") );
51 _map.insert( 0x8936, new QString("SIOCDIFADDR") );
52 _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") );
53 _map.insert( 0x8938, new QString("SIOCGIFCOUNT") );
54 _map.insert( 0x8940, new QString("SIOCGIFBR") );
55 _map.insert( 0x8941, new QString("SIOCSIFBR") );
56 _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") );
57 _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") );
58 _map.insert( 0x8953, new QString("SIOCDARP") );
59 _map.insert( 0x8954, new QString("SIOCGARP") );
60 _map.insert( 0x8955, new QString("SIOCSARP") );
61 _map.insert( 0x8960, new QString("SIOCDRARP") );
62 _map.insert( 0x8961, new QString("SIOCGRARP") );
63 _map.insert( 0x8962, new QString("SIOCSRARP") );
64 _map.insert( 0x8970, new QString("SIOCGIFMAP") );
65 _map.insert( 0x8971, new QString("SIOCSIFMAP") );
66 _map.insert( 0x8980, new QString("SIOCADDDLCI") );
67 _map.insert( 0x8981, new QString("SIOCDELDLCI") );
68 _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") );
69 _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") );
70 _map.insert( 0x1fff, new QString("SIOCPARM_MASK") );
71 _map.insert( 0x00000000, new QString("SIOC_VOID") );
72 _map.insert( 0x20000000, new QString("SIOC_OUT") );
73 _map.insert( 0x40000000, new QString("SIOC_IN") );
74 _map.insert( 0x8B00, new QString("SIOCSIWCOMMIT") );
75 _map.insert( 0x8B01, new QString("SIOCGIWNAME") );
76 _map.insert( 0x8B02, new QString("SIOCSIWNWID") );
77 _map.insert( 0x8B03, new QString("SIOCGIWNWID") );
78 _map.insert( 0x8B04, new QString("SIOCSIWFREQ") );
79 _map.insert( 0x8B05, new QString("SIOCGIWFREQ") );
80 _map.insert( 0x8B06, new QString("SIOCSIWMODE") );
81 _map.insert( 0x8B07, new QString("SIOCGIWMODE") );
82 _map.insert( 0x8B08, new QString("SIOCSIWSENS") );
83 _map.insert( 0x8B09, new QString("SIOCGIWSENS") );
84 _map.insert( 0x8B0A, new QString("SIOCSIWRANGE") );
85 _map.insert( 0x8B0B, new QString("SIOCGIWRANGE") );
86 _map.insert( 0x8B0C, new QString("SIOCSIWPRIV") );
87 _map.insert( 0x8B0D, new QString("SIOCGIWPRIV") );
88 _map.insert( 0x8B0E, new QString("SIOCSIWSTATS") );
89 _map.insert( 0x8B0F, new QString("SIOCGIWSTATS") );
90 _map.insert( 0x8B10, new QString("SIOCSIWSPY") );
91 _map.insert( 0x8B11, new QString("SIOCGIWSPY") );
92 _map.insert( 0x8B14, new QString("SIOCSIWAP") );
93 _map.insert( 0x8B15, new QString("SIOCGIWAP") );
94 _map.insert( 0x8B17, new QString("SIOCGIWAPLIST") );
95 _map.insert( 0x8B18, new QString("SIOCSIWSCAN") );
96 _map.insert( 0x8B19, new QString("SIOCGIWSCAN") );
97 _map.insert( 0x8B1A, new QString("SIOCSIWESSID") );
98 _map.insert( 0x8B1B, new QString("SIOCGIWESSID") );
99 _map.insert( 0x8B1C, new QString("SIOCSIWNICKN") );
100 _map.insert( 0x8B1D, new QString("SIOCGIWNICKN") );
101 _map.insert( 0x8B20, new QString("SIOCSIWRATE") );
102 _map.insert( 0x8B21, new QString("SIOCGIWRATE") );
103 _map.insert( 0x8B22, new QString("SIOCSIWRTS") );
104 _map.insert( 0x8B23, new QString("SIOCGIWRTS") );
105 _map.insert( 0x8B24, new QString("SIOCSIWFRAG") );
106 _map.insert( 0x8B25, new QString("SIOCGIWFRAG") );
107 _map.insert( 0x8B26, new QString("SIOCSIWTXPOW") );
108 _map.insert( 0x8B27, new QString("SIOCGIWTXPOW") );
109 _map.insert( 0x8B28, new QString("SIOCSIWRETRY") );
110 _map.insert( 0x8B29, new QString("SIOCGIWRETRY") );
111 _map.insert( 0x8B2A, new QString("SIOCSIWENCODE") );
112 _map.insert( 0x8B2B, new QString("SIOCGIWENCODE") );
113 _map.insert( 0x8B2C, new QString("SIOCSIWPOWER") );
114 _map.insert( 0x8B2D, new QString("SIOCGIWPOWER") );
115 _map.insert( 0x8BE0, new QString("SIOCIWFIRSTPRIV") );
116 _map.insert( 0x8BFF, new QString("SIOCIWLASTPRIV") );
117 _map.insert( 0x8B00, new QString("SIOCIWFIRST") );
118 _map.insert( 0x5000, new QString("SIOCGBPQETHPARAM") );
119 _map.insert( 0x5001, new QString("SIOCSBPQETHPARAM") );
120 _map.insert( 0x890B, new QString("SIOCADDRT") );
121 _map.insert( 0x890C, new QString("SIOCDELRT") );
122 _map.insert( 0x890D, new QString("SIOCRTMSG") );
123 _map.insert( 0x8910, new QString("SIOCGIFNAME") );
124 _map.insert( 0x8911, new QString("SIOCSIFLINK") );
125 _map.insert( 0x8912, new QString("SIOCGIFCONF") );
126 _map.insert( 0x8913, new QString("SIOCGIFFLAGS") );
127 _map.insert( 0x8914, new QString("SIOCSIFFLAGS") );
128 _map.insert( 0x8915, new QString("SIOCGIFADDR") );
129 _map.insert( 0x8916, new QString("SIOCSIFADDR") );
130 _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") );
131 _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") );
132 _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") );
133 _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") );
134 _map.insert( 0x891b, new QString("SIOCGIFNETMASK") );
135 _map.insert( 0x891c, new QString("SIOCSIFNETMASK") );
136 _map.insert( 0x891d, new QString("SIOCGIFMETRIC") );
137 _map.insert( 0x891e, new QString("SIOCSIFMETRIC") );
138 _map.insert( 0x891f, new QString("SIOCGIFMEM") );
139 _map.insert( 0x8920, new QString("SIOCSIFMEM") );
140 _map.insert( 0x8921, new QString("SIOCGIFMTU") );
141 _map.insert( 0x8922, new QString("SIOCSIFMTU") );
142 _map.insert( 0x8923, new QString("SIOCSIFNAME") );
143 _map.insert( 0x8924, new QString("SIOCSIFHWADDR") );
144 _map.insert( 0x8925, new QString("SIOCGIFENCAP") );
145 _map.insert( 0x8926, new QString("SIOCSIFENCAP") );
146 _map.insert( 0x8927, new QString("SIOCGIFHWADDR") );
147 _map.insert( 0x8929, new QString("SIOCGIFSLAVE") );
148 _map.insert( 0x8930, new QString("SIOCSIFSLAVE") );
149 _map.insert( 0x8931, new QString("SIOCADDMULTI") );
150 _map.insert( 0x8932, new QString("SIOCDELMULTI") );
151 _map.insert( 0x8933, new QString("SIOCGIFINDEX") );
152 _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") );
153 _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") );
154 _map.insert( 0x8936, new QString("SIOCDIFADDR") );
155 _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") );
156 _map.insert( 0x8938, new QString("SIOCGIFCOUNT") );
157 _map.insert( 0x8940, new QString("SIOCGIFBR") );
158 _map.insert( 0x8941, new QString("SIOCSIFBR") );
159 _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") );
160 _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") );
161 _map.insert( 0x8944, new QString("SIOCGIFDIVERT") );
162 _map.insert( 0x8945, new QString("SIOCSIFDIVERT") );
163 _map.insert( 0x8946, new QString("SIOCETHTOOL") );
164 _map.insert( 0x8947, new QString("SIOCGMIIPHY") );
165 _map.insert( 0x8948, new QString("SIOCGMIIREG") );
166 _map.insert( 0x8949, new QString("SIOCSMIIREG") );
167 _map.insert( 0x894A, new QString("SIOCWANDEV") );
168 _map.insert( 0x8953, new QString("SIOCDARP") );
169 _map.insert( 0x8954, new QString("SIOCGARP") );
170 _map.insert( 0x8955, new QString("SIOCSARP") );
171 _map.insert( 0x8960, new QString("SIOCDRARP") );
172 _map.insert( 0x8961, new QString("SIOCGRARP") );
173 _map.insert( 0x8962, new QString("SIOCSRARP") );
174 _map.insert( 0x8970, new QString("SIOCGIFMAP") );
175 _map.insert( 0x8971, new QString("SIOCSIFMAP") );
176 _map.insert( 0x8980, new QString("SIOCADDDLCI") );
177 _map.insert( 0x8981, new QString("SIOCDELDLCI") );
178 _map.insert( 0x8982, new QString("SIOCGIFVLAN") );
179 _map.insert( 0x8983, new QString("SIOCSIFVLAN") );
180 _map.insert( 0x8990, new QString("SIOCBONDENSLAVE") );
181 _map.insert( 0x8991, new QString("SIOCBONDRELEASE") );
182 _map.insert( 0x8992, new QString("SIOCBONDSETHWADDR") );
183 _map.insert( 0x8993, new QString("SIOCBONDSLAVEINFOQUERY") );
184 _map.insert( 0x8994, new QString("SIOCBONDINFOQUERY") );
185 _map.insert( 0x8995, new QString("SIOCBONDCHANGEACTIVE") );
186 _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") );
187 _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") );
188
189};
190
191
192DebugMapper::~DebugMapper()
193{
194 qDebug( "DebugMapper::~DebugMapper()" );
195}
196
197
198const QString& DebugMapper::map( int value ) const
199{
200 QString* result = _map[ value ];
201
202 if ( !result )
203 {
204 qDebug( "DebugMapper::map() - value not found." );
205 return QString::null;
206 }
207 else
208 {
209 return *result;
210 }
211}
212
213
diff --git a/libopie2/opienet/odebugmapper.h b/libopie2/opienet/odebugmapper.h
new file mode 100644
index 0000000..66b331d
--- a/dev/null
+++ b/libopie2/opienet/odebugmapper.h
@@ -0,0 +1,26 @@
1
2/*
3 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
4 */
5
6#ifndef DEBUGMAPPER_H
7#define DEBUGMAPPER_H
8
9#include <qstring.h>
10#include <qintdict.h>
11
12typedef QIntDict<QString> IntStringMap;
13
14class DebugMapper
15{
16 public:
17 DebugMapper();
18 ~DebugMapper();
19
20 const QString& map( int value ) const;
21 private:
22 IntStringMap _map;
23};
24
25#endif
26
diff --git a/libopie2/opienet/oioctlmap.cpp b/libopie2/opienet/oioctlmap.cpp
deleted file mode 100644
index 4a67eb6..0000000
--- a/libopie2/opienet/oioctlmap.cpp
+++ b/dev/null
@@ -1,366 +0,0 @@
1
2/*
3 * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
4 */
5
6#include "oioctlmap.h"
7
8IntStringMap* 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
deleted file mode 100644
index 1cd89a3..0000000
--- a/libopie2/opienet/oioctlmap.h
+++ b/dev/null
@@ -1,17 +0,0 @@
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
12typedef QIntDict<QString> IntStringMap;
13
14IntStringMap* constructIoctlMap();
15
16#endif
17
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp
index ce147c5..e3eb327 100644
--- a/libopie2/opienet/onetutils.cpp
+++ b/libopie2/opienet/onetutils.cpp
@@ -1,145 +1,134 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4              (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include <opie2/onetutils.h> 32#include <opie2/onetutils.h>
33#include <opie2/onetwork.h> 33#include <opie2/onetwork.h>
34#include <opie2/omanufacturerdb.h> 34#include <opie2/omanufacturerdb.h>
35 35
36#include <net/if.h> 36#include <net/if.h>
37#include <cassert> 37#include <assert.h>
38#include <cstdio> 38#include <stdio.h>
39using namespace std;
40
41#define IW_PRIV_TYPE_MASK 0x7000
42#define IW_PRIV_TYPE_NONE 0x0000
43#define IW_PRIV_TYPE_BYTE 0x1000
44#define IW_PRIV_TYPE_CHAR 0x2000
45#define IW_PRIV_TYPE_INT 0x4000
46#define IW_PRIV_TYPE_FLOAT 0x5000
47#define IW_PRIV_TYPE_ADDR 0x6000
48#define IW_PRIV_SIZE_FIXED 0x0800
49#define IW_PRIV_SIZE_MASK 0x07FF
50 39
51/*====================================================================================== 40/*======================================================================================
52 * OMacAddress 41 * OMacAddress
53 *======================================================================================*/ 42 *======================================================================================*/
54 43
55// static initializer for broadcast and unknown MAC Adresses 44// static initializer for broadcast and unknown MAC Adresses
56const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 45const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
57const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); 46const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast );
58const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; 47const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 };
59const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); 48const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown );
60 49
61//TODO: Incorporate Ethernet Manufacturer database here! (inline or so) 50//TODO: Incorporate Ethernet Manufacturer database here! (inline or so)
62 51
63OMacAddress::OMacAddress() 52OMacAddress::OMacAddress()
64{ 53{
65 memcpy( _bytes, __unknown, 6 ); 54 memcpy( _bytes, __unknown, 6 );
66} 55}
67 56
68 57
69OMacAddress::OMacAddress( unsigned char* p ) 58OMacAddress::OMacAddress( unsigned char* p )
70{ 59{
71 memcpy( _bytes, p, 6 ); 60 memcpy( _bytes, p, 6 );
72} 61}
73 62
74 63
75OMacAddress::OMacAddress( const unsigned char* p ) 64OMacAddress::OMacAddress( const unsigned char* p )
76{ 65{
77 memcpy( _bytes, p, 6 ); 66 memcpy( _bytes, p, 6 );
78} 67}
79 68
80 69
81OMacAddress::OMacAddress( struct ifreq& ifr ) 70OMacAddress::OMacAddress( struct ifreq& ifr )
82{ 71{
83 memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); 72 memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 );
84} 73}
85 74
86 75
87OMacAddress::~OMacAddress() 76OMacAddress::~OMacAddress()
88{ 77{
89} 78}
90 79
91 80
92//#ifdef QT_NO_DEBUG 81//#ifdef QT_NO_DEBUG
93//inline 82//inline
94//#endif 83//#endif
95const unsigned char* OMacAddress::native() const 84const unsigned char* OMacAddress::native() const
96{ 85{
97 return (const unsigned char*) &_bytes; 86 return (const unsigned char*) &_bytes;
98} 87}
99 88
100 89
101OMacAddress OMacAddress::fromString( const QString& str ) 90OMacAddress OMacAddress::fromString( const QString& str )
102{ 91{
103 QString addr( str ); 92 QString addr( str );
104 unsigned char buf[6]; 93 unsigned char buf[6];
105 bool ok = true; 94 bool ok = true;
106 int index = 14; 95 int index = 14;
107 for ( int i = 5; i >= 0; --i ) 96 for ( int i = 5; i >= 0; --i )
108 { 97 {
109 buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); 98 buf[i] = addr.right( 2 ).toUShort( &ok, 16 );
110 if ( !ok ) return OMacAddress::unknown; 99 if ( !ok ) return OMacAddress::unknown;
111 addr.truncate( index ); 100 addr.truncate( index );
112 index -= 3; 101 index -= 3;
113 } 102 }
114 return (const unsigned char*) &buf; 103 return (const unsigned char*) &buf;
115} 104}
116 105
117 106
118QString OMacAddress::toString( bool substitute ) const 107QString OMacAddress::toString( bool substitute ) const
119{ 108{
120 QString manu; 109 QString manu;
121 manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff ); 110 manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff );
122 QString serial; 111 QString serial;
123 serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); 112 serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff );
124 if ( !substitute ) return manu+serial; 113 if ( !substitute ) return manu+serial;
125 // fallback - if no vendor is found, just use the number 114 // fallback - if no vendor is found, just use the number
126 QString textmanu = OManufacturerDB::instance()->lookup( manu ); 115 QString textmanu = OManufacturerDB::instance()->lookup( manu );
127 return textmanu.isNull() ? manu+serial : textmanu+serial; 116 return textmanu.isNull() ? manu+serial : textmanu+serial;
128} 117}
129 118
130 119
131QString OMacAddress::manufacturer() const 120QString OMacAddress::manufacturer() const
132{ 121{
133 return OManufacturerDB::instance()->lookupExt( toString() ); 122 return OManufacturerDB::instance()->lookupExt( toString() );
134} 123}
135 124
136 125
137bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) 126bool operator==( const OMacAddress &m1, const OMacAddress &m2 )
138{ 127{
139 return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; 128 return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0;
140} 129}
141 130
142 131
143/*====================================================================================== 132/*======================================================================================
144 * OHostAddress 133 * OHostAddress
145 *======================================================================================*/ 134 *======================================================================================*/
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h
index 541c5ab..bddfab9 100644
--- a/libopie2/opienet/onetutils.h
+++ b/libopie2/opienet/onetutils.h
@@ -32,132 +32,150 @@
32#ifndef ONETUTILS_H 32#ifndef ONETUTILS_H
33#define ONETUTILS_H 33#define ONETUTILS_H
34 34
35#include <qdict.h> 35#include <qdict.h>
36#include <qmap.h> 36#include <qmap.h>
37#include <qstring.h> 37#include <qstring.h>
38#include <qhostaddress.h> 38#include <qhostaddress.h>
39#include <qobject.h> 39#include <qobject.h>
40 40
41#include <sys/types.h> 41#include <sys/types.h>
42 42
43struct ifreq; 43struct ifreq;
44class OWirelessNetworkInterface; 44class OWirelessNetworkInterface;
45 45
46/*====================================================================================== 46/*======================================================================================
47 * OMacAddress 47 * OMacAddress
48 *======================================================================================*/ 48 *======================================================================================*/
49 49
50class OMacAddress 50class OMacAddress
51{ 51{
52 public: 52 public:
53 // QString c'tor? -zecke 53 // QString c'tor? -zecke
54 OMacAddress(); 54 OMacAddress();
55 OMacAddress( unsigned char* ); 55 OMacAddress( unsigned char* );
56 OMacAddress( const unsigned char* ); 56 OMacAddress( const unsigned char* );
57 OMacAddress( struct ifreq& ); 57 OMacAddress( struct ifreq& );
58 ~OMacAddress(); 58 ~OMacAddress();
59 59
60 QString manufacturer() const; 60 QString manufacturer() const;
61 QString toString( bool substitute = false ) const; 61 QString toString( bool substitute = false ) const;
62 const unsigned char* native() const; 62 const unsigned char* native() const;
63 63
64 // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? 64 // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem?
65 static OMacAddress fromString( const QString& ); 65 static OMacAddress fromString( const QString& );
66 66
67 public: 67 public:
68 static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff 68 static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff
69 static const OMacAddress& unknown; // 44:44:44:44:44:44 69 static const OMacAddress& unknown; // 44:44:44:44:44:44
70 70
71 private: 71 private:
72 unsigned char _bytes[6]; 72 unsigned char _bytes[6];
73 73
74 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 74 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
75 75
76}; 76};
77 77
78bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 78bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
79 79
80 80
81/*====================================================================================== 81/*======================================================================================
82 * OHostAddress 82 * OHostAddress
83 *======================================================================================*/ 83 *======================================================================================*/
84 84
85class OHostAddress : public QHostAddress 85class OHostAddress : public QHostAddress
86{ 86{
87 /*public: 87 /*public:
88 OHostAddress(); 88 OHostAddress();
89 ~OHostAddress(); 89 ~OHostAddress();
90 */ 90 */
91}; 91};
92 92
93 93
94/*====================================================================================== 94/*======================================================================================
95 * OPrivateIOCTL 95 * OPrivateIOCTL
96 *======================================================================================*/ 96 *======================================================================================*/
97 97
98class OPrivateIOCTL : public QObject 98class OPrivateIOCTL : public QObject
99{ 99{
100 public: 100 public:
101 OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); 101 OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs );
102 ~OPrivateIOCTL(); 102 ~OPrivateIOCTL();
103 103
104 int numberGetArgs() const; 104 int numberGetArgs() const;
105 int typeGetArgs() const; 105 int typeGetArgs() const;
106 int numberSetArgs() const; 106 int numberSetArgs() const;
107 int typeSetArgs() const; 107 int typeSetArgs() const;
108 108
109 // FIXME return int? as ::ioctl does? -zecke 109 // FIXME return int? as ::ioctl does? -zecke
110 void invoke() const; 110 void invoke() const;
111 void setParameter( int, u_int32_t ); 111 void setParameter( int, u_int32_t );
112 112
113 private: 113 private:
114 u_int32_t _ioctl; 114 u_int32_t _ioctl;
115 u_int16_t _getargs; 115 u_int16_t _getargs;
116 u_int16_t _setargs; 116 u_int16_t _setargs;
117 117
118}; 118};
119 119
120 /*====================================================================================== 120 /*======================================================================================
121 * Miscellaneous 121 * Miscellaneous
122 *======================================================================================*/ 122 *======================================================================================*/
123 123
124void dumpBytes( const unsigned char* data, int num ); 124void dumpBytes( const unsigned char* data, int num );
125QString modeToString( int ); 125QString modeToString( int );
126int stringToMode( const QString& ); 126int stringToMode( const QString& );
127 127
128#define IW_PRIV_TYPE_MASK 0x7000
129#define IW_PRIV_TYPE_NONE 0x0000
130#define IW_PRIV_TYPE_BYTE 0x1000
131#define IW_PRIV_TYPE_CHAR 0x2000
132#define IW_PRIV_TYPE_INT 0x4000
133#define IW_PRIV_TYPE_FLOAT 0x5000
134#define IW_PRIV_TYPE_ADDR 0x6000
135#define IW_PRIV_SIZE_FIXED 0x0800
136#define IW_PRIV_SIZE_MASK 0x07FF
137
138#ifndef ARPHRD_IEEE80211
139#define ARPHRD_IEEE80211 801
140#endif
141#ifndef ARPHRD_IEEE80211_PRISM
142#define ARPHRD_IEEE80211_PRISM 802
143#endif
144
145
128/* Network to host order macros */ 146/* Network to host order macros */
129 147
130#ifdef LBL_ALIGN 148#ifdef LBL_ALIGN
131#define EXTRACT_16BITS(p) \ 149#define EXTRACT_16BITS(p) \
132 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ 150 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
133 (u_int16_t)*((const u_int8_t *)(p) + 1))) 151 (u_int16_t)*((const u_int8_t *)(p) + 1)))
134#define EXTRACT_32BITS(p) \ 152#define EXTRACT_32BITS(p) \
135 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ 153 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
136 (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ 154 (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
137 (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ 155 (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
138 (u_int32_t)*((const u_int8_t *)(p) + 3))) 156 (u_int32_t)*((const u_int8_t *)(p) + 3)))
139#else 157#else
140#define EXTRACT_16BITS(p) \ 158#define EXTRACT_16BITS(p) \
141 ((u_int16_t)ntohs(*(const u_int16_t *)(p))) 159 ((u_int16_t)ntohs(*(const u_int16_t *)(p)))
142#define EXTRACT_32BITS(p) \ 160#define EXTRACT_32BITS(p) \
143 ((u_int32_t)ntohl(*(const u_int32_t *)(p))) 161 ((u_int32_t)ntohl(*(const u_int32_t *)(p)))
144#endif 162#endif
145 163
146#define EXTRACT_24BITS(p) \ 164#define EXTRACT_24BITS(p) \
147 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \ 165 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
148 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ 166 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
149 (u_int32_t)*((const u_int8_t *)(p) + 2))) 167 (u_int32_t)*((const u_int8_t *)(p) + 2)))
150 168
151/* Little endian protocol host order macros */ 169/* Little endian protocol host order macros */
152#define EXTRACT_LE_8BITS(p) (*(p)) 170#define EXTRACT_LE_8BITS(p) (*(p))
153#define EXTRACT_LE_16BITS(p) \ 171#define EXTRACT_LE_16BITS(p) \
154 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \ 172 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
155 (u_int16_t)*((const u_int8_t *)(p) + 0))) 173 (u_int16_t)*((const u_int8_t *)(p) + 0)))
156#define EXTRACT_LE_32BITS(p) \ 174#define EXTRACT_LE_32BITS(p) \
157 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \ 175 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
158 (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \ 176 (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
159 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ 177 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
160 (u_int32_t)*((const u_int8_t *)(p) + 0))) 178 (u_int32_t)*((const u_int8_t *)(p) + 0)))
161 179
162#endif // ONETUTILS_H 180#endif // ONETUTILS_H
163 181
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index c329e9a..95c813f 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -1,297 +1,295 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 by the Wellenreiter team: 3              Copyright (C) 2003 by the Wellenreiter team:
4 Martin J. Muench <mjm@remote-exploit.org> 4 Martin J. Muench <mjm@remote-exploit.org>
5 Max Moser <mmo@remote-exploit.org 5 Max Moser <mmo@remote-exploit.org
6 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 6 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 12:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
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#include <opie2/ostation.h> 37#include <opie2/ostation.h>
38 38
39/* QT */ 39/* QT */
40 40
41#include <qfile.h> 41#include <qfile.h>
42#include <qtextstream.h> 42#include <qtextstream.h>
43 43
44/* UNIX */ 44/* UNIX */
45 45
46#include <assert.h> 46#include <assert.h>
47#include <arpa/inet.h> 47#include <arpa/inet.h>
48#include <cerrno> 48#include <errno.h>
49#include <cstring> 49#include <string.h>
50#include <cstdlib> 50#include <stdlib.h>
51#include <math.h> 51#include <math.h>
52#include <sys/ioctl.h> 52#include <sys/ioctl.h>
53#include <sys/socket.h> 53#include <sys/socket.h>
54#include <sys/types.h> 54#include <sys/types.h>
55#include <unistd.h> 55#include <unistd.h>
56#include <linux/sockios.h> 56#include <linux/sockios.h>
57#include <net/if_arp.h> 57#include <net/if_arp.h>
58#include <stdarg.h> 58#include <stdarg.h>
59 59
60using namespace std;
61
62#ifndef NODEBUG 60#ifndef NODEBUG
63#include <opie2/oioctlmap.h> 61#include <opie2/odebugmapper.h>
64IntStringMap* _ioctlmap = constructIoctlMap(); 62DebugMapper* debugmapper = new DebugMapper();
65#endif 63#endif
66 64
67/*====================================================================================== 65/*======================================================================================
68 * ONetwork 66 * ONetwork
69 *======================================================================================*/ 67 *======================================================================================*/
70 68
71ONetwork* ONetwork::_instance = 0; 69ONetwork* ONetwork::_instance = 0;
72 70
73ONetwork::ONetwork() 71ONetwork::ONetwork()
74{ 72{
75 qDebug( "ONetwork::ONetwork()" ); 73 qDebug( "ONetwork::ONetwork()" );
76 qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT ); 74 qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT );
77 synchronize(); 75 synchronize();
78} 76}
79 77
80void ONetwork::synchronize() 78void ONetwork::synchronize()
81{ 79{
82 // gather available interfaces by inspecting /proc/net/dev 80 // gather available interfaces by inspecting /proc/net/dev
83 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices 81 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices
84 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices 82 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices
85 //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev 83 //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev
86 84
87 _interfaces.clear(); 85 _interfaces.clear();
88 QString str; 86 QString str;
89 QFile f( "/proc/net/dev" ); 87 QFile f( "/proc/net/dev" );
90 bool hasFile = f.open( IO_ReadOnly ); 88 bool hasFile = f.open( IO_ReadOnly );
91 if ( !hasFile ) 89 if ( !hasFile )
92 { 90 {
93 qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" ); 91 qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" );
94 return; 92 return;
95 } 93 }
96 QTextStream s( &f ); 94 QTextStream s( &f );
97 s.readLine(); 95 s.readLine();
98 s.readLine(); 96 s.readLine();
99 while ( !s.atEnd() ) 97 while ( !s.atEnd() )
100 { 98 {
101 s >> str; 99 s >> str;
102 str.truncate( str.find( ':' ) ); 100 str.truncate( str.find( ':' ) );
103 qDebug( "ONetwork: found interface '%s'", (const char*) str ); 101 qDebug( "ONetwork: found interface '%s'", (const char*) str );
104 ONetworkInterface* iface; 102 ONetworkInterface* iface;
105 if ( isWirelessInterface( str ) ) 103 if ( isWirelessInterface( str ) )
106 { 104 {
107 iface = new OWirelessNetworkInterface( this, (const char*) str ); 105 iface = new OWirelessNetworkInterface( this, (const char*) str );
108 qDebug( "ONetwork: interface '%s' has Wireless Extensions", (const char*) str ); 106 qDebug( "ONetwork: interface '%s' has Wireless Extensions", (const char*) str );
109 } 107 }
110 else 108 else
111 { 109 {
112 iface = new ONetworkInterface( this, (const char*) str ); 110 iface = new ONetworkInterface( this, (const char*) str );
113 } 111 }
114 _interfaces.insert( str, iface ); 112 _interfaces.insert( str, iface );
115 s.readLine(); 113 s.readLine();
116 } 114 }
117} 115}
118 116
119 117
120short ONetwork::wirelessExtensionVersion() 118short ONetwork::wirelessExtensionVersion()
121{ 119{
122 return WIRELESS_EXT; 120 return WIRELESS_EXT;
123} 121}
124 122
125 123
126int ONetwork::count() const 124int ONetwork::count() const
127{ 125{
128 return _interfaces.count(); 126 return _interfaces.count();
129} 127}
130 128
131 129
132ONetworkInterface* ONetwork::interface( const QString& iface ) const 130ONetworkInterface* ONetwork::interface( const QString& iface ) const
133{ 131{
134 return _interfaces[iface]; 132 return _interfaces[iface];
135} 133}
136 134
137 135
138ONetwork* ONetwork::instance() 136ONetwork* ONetwork::instance()
139{ 137{
140 if ( !_instance ) _instance = new ONetwork(); 138 if ( !_instance ) _instance = new ONetwork();
141 return _instance; 139 return _instance;
142} 140}
143 141
144 142
145ONetwork::InterfaceIterator ONetwork::iterator() const 143ONetwork::InterfaceIterator ONetwork::iterator() const
146{ 144{
147 return ONetwork::InterfaceIterator( _interfaces ); 145 return ONetwork::InterfaceIterator( _interfaces );
148} 146}
149 147
150 148
151bool ONetwork::isWirelessInterface( const char* name ) const 149bool ONetwork::isWirelessInterface( const char* name ) const
152{ 150{
153 int sfd = socket( AF_INET, SOCK_STREAM, 0 ); 151 int sfd = socket( AF_INET, SOCK_STREAM, 0 );
154 struct iwreq iwr; 152 struct iwreq iwr;
155 memset( &iwr, 0, sizeof( struct iwreq ) ); 153 memset( &iwr, 0, sizeof( struct iwreq ) );
156 strcpy( (char*) &iwr.ifr_name, name ); 154 strcpy( (char*) &iwr.ifr_name, name );
157 int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); 155 int result = ::ioctl( sfd, SIOCGIWNAME, &iwr );
158 return result != -1; 156 return result != -1;
159} 157}
160 158
161/*====================================================================================== 159/*======================================================================================
162 * ONetworkInterface 160 * ONetworkInterface
163 *======================================================================================*/ 161 *======================================================================================*/
164 162
165ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) 163ONetworkInterface::ONetworkInterface( QObject* parent, const char* name )
166 :QObject( parent, name ), 164 :QObject( parent, name ),
167 _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) 165 _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 )
168{ 166{
169 qDebug( "ONetworkInterface::ONetworkInterface()" ); 167 qDebug( "ONetworkInterface::ONetworkInterface()" );
170 init(); 168 init();
171} 169}
172 170
173 171
174struct ifreq& ONetworkInterface::ifr() const 172struct ifreq& ONetworkInterface::ifr() const
175{ 173{
176 return _ifr; 174 return _ifr;
177} 175}
178 176
179 177
180void ONetworkInterface::init() 178void ONetworkInterface::init()
181{ 179{
182 qDebug( "ONetworkInterface::init()" ); 180 qDebug( "ONetworkInterface::init()" );
183 181
184 memset( &_ifr, 0, sizeof( struct ifreq ) ); 182 memset( &_ifr, 0, sizeof( struct ifreq ) );
185 183
186 if ( _sfd == -1 ) 184 if ( _sfd == -1 )
187 { 185 {
188 qDebug( "ONetworkInterface::init(): Warning - can't get socket for device '%s'", name() ); 186 qDebug( "ONetworkInterface::init(): Warning - can't get socket for device '%s'", name() );
189 return; 187 return;
190 } 188 }
191} 189}
192 190
193 191
194bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const 192bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const
195{ 193{
196 #ifndef NODEBUG 194 #ifndef NODEBUG
197 int result = ::ioctl( _sfd, call, &ifreq ); 195 int result = ::ioctl( _sfd, call, &ifreq );
198 if ( result == -1 ) 196 if ( result == -1 )
199 qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); 197 qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) );
200 else 198 else
201 qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); 199 qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call );
202 return ( result != -1 ); 200 return ( result != -1 );
203 #else 201 #else
204 return ::ioctl( _sfd, call, &ifreq ) != -1; 202 return ::ioctl( _sfd, call, &ifreq ) != -1;
205 #endif 203 #endif
206} 204}
207 205
208 206
209bool ONetworkInterface::ioctl( int call ) const 207bool ONetworkInterface::ioctl( int call ) const
210{ 208{
211 strcpy( _ifr.ifr_name, name() ); 209 strcpy( _ifr.ifr_name, name() );
212 return ioctl( call, _ifr ); 210 return ioctl( call, _ifr );
213} 211}
214 212
215 213
216bool ONetworkInterface::isLoopback() const 214bool ONetworkInterface::isLoopback() const
217{ 215{
218 ioctl( SIOCGIFFLAGS ); 216 ioctl( SIOCGIFFLAGS );
219 return _ifr.ifr_flags & IFF_LOOPBACK; 217 return _ifr.ifr_flags & IFF_LOOPBACK;
220} 218}
221 219
222 220
223bool ONetworkInterface::setUp( bool b ) 221bool ONetworkInterface::setUp( bool b )
224{ 222{
225 ioctl( SIOCGIFFLAGS ); 223 ioctl( SIOCGIFFLAGS );
226 if ( b ) _ifr.ifr_flags |= IFF_UP; 224 if ( b ) _ifr.ifr_flags |= IFF_UP;
227 else _ifr.ifr_flags &= (~IFF_UP); 225 else _ifr.ifr_flags &= (~IFF_UP);
228 return ioctl( SIOCSIFFLAGS ); 226 return ioctl( SIOCSIFFLAGS );
229} 227}
230 228
231 229
232bool ONetworkInterface::isUp() const 230bool ONetworkInterface::isUp() const
233{ 231{
234 ioctl( SIOCGIFFLAGS ); 232 ioctl( SIOCGIFFLAGS );
235 return _ifr.ifr_flags & IFF_UP; 233 return _ifr.ifr_flags & IFF_UP;
236} 234}
237 235
238 236
239void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) 237void ONetworkInterface::setIPV4Address( const QHostAddress& addr )
240{ 238{
241 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; 239 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr;
242 sa->sin_family = AF_INET; 240 sa->sin_family = AF_INET;
243 sa->sin_port = 0; 241 sa->sin_port = 0;
244 sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); 242 sa->sin_addr.s_addr = htonl( addr.ip4Addr() );
245 ioctl( SIOCSIFADDR ); 243 ioctl( SIOCSIFADDR );
246} 244}
247 245
248 246
249QString ONetworkInterface::ipV4Address() const 247QString ONetworkInterface::ipV4Address() const
250{ 248{
251 if ( ioctl( SIOCGIFADDR ) ) 249 if ( ioctl( SIOCGIFADDR ) )
252 { 250 {
253 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; 251 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr;
254 //FIXME: Use QHostAddress here 252 //FIXME: Use QHostAddress here
255 return QString( inet_ntoa( sa->sin_addr ) ); 253 return QString( inet_ntoa( sa->sin_addr ) );
256 } 254 }
257 else 255 else
258 return "<unknown>"; 256 return "<unknown>";
259 257
260} 258}
261 259
262 260
263void ONetworkInterface::setMacAddress( const OMacAddress& addr ) 261void ONetworkInterface::setMacAddress( const OMacAddress& addr )
264{ 262{
265 _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; 263 _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
266 memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); 264 memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 );
267 ioctl( SIOCSIFHWADDR ); 265 ioctl( SIOCSIFHWADDR );
268} 266}
269 267
270 268
271OMacAddress ONetworkInterface::macAddress() const 269OMacAddress ONetworkInterface::macAddress() const
272{ 270{
273 if ( ioctl( SIOCGIFHWADDR ) ) 271 if ( ioctl( SIOCGIFHWADDR ) )
274 { 272 {
275 return OMacAddress( _ifr ); 273 return OMacAddress( _ifr );
276 } 274 }
277 else 275 else
278 { 276 {
279 return OMacAddress::unknown; 277 return OMacAddress::unknown;
280 } 278 }
281} 279}
282 280
283 281
284void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) 282void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr )
285{ 283{
286 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; 284 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr;
287 sa->sin_family = AF_INET; 285 sa->sin_family = AF_INET;
288 sa->sin_port = 0; 286 sa->sin_port = 0;
289 sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); 287 sa->sin_addr.s_addr = htonl( addr.ip4Addr() );
290 ioctl( SIOCSIFNETMASK ); 288 ioctl( SIOCSIFNETMASK );
291} 289}
292 290
293 291
294QString ONetworkInterface::ipV4Netmask() const 292QString ONetworkInterface::ipV4Netmask() const
295{ 293{
296 if ( ioctl( SIOCGIFNETMASK ) ) 294 if ( ioctl( SIOCGIFNETMASK ) )
297 { 295 {
@@ -876,195 +874,195 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
876 { 874 {
877 qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." ); 875 qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." );
878 #if 0 876 #if 0
879 if ( qApp ) 877 if ( qApp )
880 { 878 {
881 qApp->processEvents( 100 ); 879 qApp->processEvents( 100 );
882 continue; 880 continue;
883 } 881 }
884 #endif 882 #endif
885 tv.tv_sec = 0; 883 tv.tv_sec = 0;
886 tv.tv_usec = 100000; 884 tv.tv_usec = 100000;
887 continue; 885 continue;
888 } 886 }
889 } 887 }
890 888
891 qDebug( "ONetworkInterface::scanNetwork() - scan finished." ); 889 qDebug( "ONetworkInterface::scanNetwork() - scan finished." );
892 890
893 if ( results ) 891 if ( results )
894 { 892 {
895 qDebug( " - result length = %d", _iwr.u.data.length ); 893 qDebug( " - result length = %d", _iwr.u.data.length );
896 if ( !_iwr.u.data.length ) 894 if ( !_iwr.u.data.length )
897 { 895 {
898 qDebug( " - no results (empty neighbourhood)" ); 896 qDebug( " - no results (empty neighbourhood)" );
899 return stations; 897 return stations;
900 } 898 }
901 899
902 qDebug( " - results are in!" ); 900 qDebug( " - results are in!" );
903 dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); 901 dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length );
904 902
905 // parse results 903 // parse results
906 904
907 int offset = 0; 905 int offset = 0;
908 struct iw_event* we = (struct iw_event*) &buffer[0]; 906 struct iw_event* we = (struct iw_event*) &buffer[0];
909 907
910 while ( offset < _iwr.u.data.length ) 908 while ( offset < _iwr.u.data.length )
911 { 909 {
912 //const char* cmd = *(*_ioctlmap)[we->cmd]; 910 //const char* cmd = *(*_ioctlmap)[we->cmd];
913 //if ( !cmd ) cmd = "<unknown>"; 911 //if ( !cmd ) cmd = "<unknown>";
914 qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len ); 912 qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len );
915 switch (we->cmd) 913 switch (we->cmd)
916 { 914 {
917 case SIOCGIWAP: 915 case SIOCGIWAP:
918 { 916 {
919 qDebug( "SIOCGIWAP" ); 917 qDebug( "SIOCGIWAP" );
920 stations->append( new OStation() ); 918 stations->append( new OStation() );
921 stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0]; 919 stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0];
922 break; 920 break;
923 } 921 }
924 case SIOCGIWMODE: 922 case SIOCGIWMODE:
925 { 923 {
926 qDebug( "SIOCGIWMODE" ); 924 qDebug( "SIOCGIWMODE" );
927 stations->last()->type = modeToString( we->u.mode ); 925 stations->last()->type = modeToString( we->u.mode );
928 break; 926 break;
929 } 927 }
930 case SIOCGIWFREQ: 928 case SIOCGIWFREQ:
931 { 929 {
932 qDebug( "SIOCGIWFREQ" ); 930 qDebug( "SIOCGIWFREQ" );
933 stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ]; 931 stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ];
934 break; 932 break;
935 } 933 }
936 case SIOCGIWESSID: 934 case SIOCGIWESSID:
937 { 935 {
938 qDebug( "SIOCGIWESSID" ); 936 qDebug( "SIOCGIWESSID" );
939 stations->last()->ssid = we->u.essid.pointer; 937 stations->last()->ssid = we->u.essid.pointer;
940 break; 938 break;
941 } 939 }
942 case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break; 940 case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break;
943 case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break; 941 case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break;
944 case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */ 942 case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */
945 case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */ 943 case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */
946 case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */ 944 case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */
947 case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */ 945 case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */
948 case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */ 946 case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */
949 default: qDebug( "unhandled event" ); 947 default: qDebug( "unhandled event" );
950 } 948 }
951 949
952 offset += we->len; 950 offset += we->len;
953 we = (struct iw_event*) &buffer[offset]; 951 we = (struct iw_event*) &buffer[offset];
954 } 952 }
955 953
956 return stations; 954 return stations;
957 955
958 } 956 }
959 else 957 else
960 { 958 {
961 qDebug( " - no results (timeout) :(" ); 959 qDebug( " - no results (timeout) :(" );
962 return stations; 960 return stations;
963 } 961 }
964} 962}
965 963
966 964
967bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const 965bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const
968{ 966{
969 #ifndef NODEBUG 967 #ifndef NODEBUG
970 int result = ::ioctl( _sfd, call, &iwreq ); 968 int result = ::ioctl( _sfd, call, &iwreq );
971 if ( result == -1 ) 969 if ( result == -1 )
972 qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); 970 qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) );
973 else 971 else
974 qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); 972 qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call );
975 return ( result != -1 ); 973 return ( result != -1 );
976 #else 974 #else
977 return ::ioctl( _sfd, call, &iwreq ) != -1; 975 return ::ioctl( _sfd, call, &iwreq ) != -1;
978 #endif 976 #endif
979} 977}
980 978
981 979
982bool OWirelessNetworkInterface::wioctl( int call ) const 980bool OWirelessNetworkInterface::wioctl( int call ) const
983{ 981{
984 strcpy( _iwr.ifr_name, name() ); 982 strcpy( _iwr.ifr_name, name() );
985 return wioctl( call, _iwr ); 983 return wioctl( call, _iwr );
986} 984}
987 985
988 986
989/*====================================================================================== 987/*======================================================================================
990 * OMonitoringInterface 988 * OMonitoringInterface
991 *======================================================================================*/ 989 *======================================================================================*/
992 990
993OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 991OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
994 :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) 992 :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader )
995{ 993{
996} 994}
997 995
998 996
999OMonitoringInterface::~OMonitoringInterface() 997OMonitoringInterface::~OMonitoringInterface()
1000{ 998{
1001} 999}
1002 1000
1003 1001
1004void OMonitoringInterface::setChannel( int c ) 1002void OMonitoringInterface::setChannel( int c )
1005{ 1003{
1006 // use standard WE channel switching protocol 1004 // use standard WE channel switching protocol
1007 memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); 1005 memset( &_if->_iwr, 0, sizeof( struct iwreq ) );
1008 _if->_iwr.u.freq.m = c; 1006 _if->_iwr.u.freq.m = c;
1009 _if->_iwr.u.freq.e = 0; 1007 _if->_iwr.u.freq.e = 0;
1010 _if->wioctl( SIOCSIWFREQ ); 1008 _if->wioctl( SIOCSIWFREQ );
1011} 1009}
1012 1010
1013 1011
1014void OMonitoringInterface::setEnabled( bool b ) 1012void OMonitoringInterface::setEnabled( bool b )
1015{ 1013{
1016} 1014}
1017 1015
1018 1016
1019/*====================================================================================== 1017/*======================================================================================
1020 * OCiscoMonitoringInterface 1018 * OCiscoMonitoringInterface
1021 *======================================================================================*/ 1019 *======================================================================================*/
1022 1020
1023OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 1021OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
1024 :OMonitoringInterface( iface, prismHeader ) 1022 :OMonitoringInterface( iface, prismHeader )
1025{ 1023{
1026 iface->setMonitoring( this ); 1024 iface->setMonitoring( this );
1027} 1025}
1028 1026
1029 1027
1030OCiscoMonitoringInterface::~OCiscoMonitoringInterface() 1028OCiscoMonitoringInterface::~OCiscoMonitoringInterface()
1031{ 1029{
1032} 1030}
1033 1031
1034 1032
1035void OCiscoMonitoringInterface::setEnabled( bool b ) 1033void OCiscoMonitoringInterface::setEnabled( bool b )
1036{ 1034{
1037 QString fname; 1035 QString fname;
1038 fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); 1036 fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() );
1039 QFile f( fname ); 1037 QFile f( fname );
1040 if ( !f.exists() ) return; 1038 if ( !f.exists() ) return;
1041 1039
1042 if ( f.open( IO_WriteOnly ) ) 1040 if ( f.open( IO_WriteOnly ) )
1043 { 1041 {
1044 QTextStream s( &f ); 1042 QTextStream s( &f );
1045 s << "Mode: r"; 1043 s << "Mode: r";
1046 s << "Mode: y"; 1044 s << "Mode: y";
1047 s << "XmitPower: 1"; 1045 s << "XmitPower: 1";
1048 } 1046 }
1049 1047
1050 // flushing and closing will be done automatically when f goes out of scope 1048 // flushing and closing will be done automatically when f goes out of scope
1051} 1049}
1052 1050
1053 1051
1054QString OCiscoMonitoringInterface::name() const 1052QString OCiscoMonitoringInterface::name() const
1055{ 1053{
1056 return "cisco"; 1054 return "cisco";
1057} 1055}
1058 1056
1059 1057
1060void OCiscoMonitoringInterface::setChannel( int ) 1058void OCiscoMonitoringInterface::setChannel( int )
1061{ 1059{
1062 // cisco devices automatically switch channels when in monitor mode 1060 // cisco devices automatically switch channels when in monitor mode
1063} 1061}
1064 1062
1065 1063
1066/*====================================================================================== 1064/*======================================================================================
1067 * OWlanNGMonitoringInterface 1065 * OWlanNGMonitoringInterface
1068 *======================================================================================*/ 1066 *======================================================================================*/
1069 1067
1070 1068
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index d966462..386c2db 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -1,34 +1,34 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = 802_11_user.h \ 4HEADERS = 802_11_user.h \
5 dhcp.h \ 5 dhcp.h \
6 udp_ports.h \ 6 udp_ports.h \
7 wireless.h \ 7 wireless.h \
8 oioctlmap.h \ 8 odebugmapper.h \
9 omanufacturerdb.h \ 9 omanufacturerdb.h \
10 onetutils.h \ 10 onetutils.h \
11 onetwork.h \ 11 onetwork.h \
12 opcap.h \ 12 opcap.h \
13 ostation.h 13 ostation.h
14SOURCES = oioctlmap.cpp \ 14SOURCES = odebugmapper.cpp \
15 omanufacturerdb.cpp \ 15 omanufacturerdb.cpp \
16 onetutils.cpp \ 16 onetutils.cpp \
17 onetwork.cpp \ 17 onetwork.cpp \
18 opcap.cpp \ 18 opcap.cpp \
19 ostation.cpp 19 ostation.cpp
20INTERFACES = 20INTERFACES =
21TARGET = opienet2 21TARGET = opienet2
22VERSION = 1.8.1 22VERSION = 1.8.1
23INCLUDEPATH += $(OPIEDIR)/include 23INCLUDEPATH += $(OPIEDIR)/include
24DEPENDPATH += $(OPIEDIR)/include 24DEPENDPATH += $(OPIEDIR)/include
25LIBS += -lpcap 25LIBS += -lpcap
26 26
27 27
28!contains( platform, x11 ) { 28!contains( platform, x11 ) {
29 include ( $(OPIEDIR)/include.pro ) 29 include ( $(OPIEDIR)/include.pro )
30} 30}
31 31
32contains( platform, x11 ) { 32contains( platform, x11 ) {
33 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 33 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
34} 34}
diff --git a/libopie2/tools/regen.py b/libopie2/tools/regen.py
index 2f7f418..9ad5352 100755
--- a/libopie2/tools/regen.py
+++ b/libopie2/tools/regen.py
@@ -1,64 +1,94 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2 2
3# 3#
4# regenerate ioctl_table.h 4# regenerate ioctl_table.h
5# 5#
6 6
7import sys 7import sys
8import os 8import os
9result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines() 9result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines()
10 10
11try: 11try:
12 tablehfile = file( sys.argv[1]+".h", "w" ) 12 tablehfile = file( sys.argv[1]+".h", "w" )
13except: 13except:
14 tablehfile = sys.stdout 14 tablehfile = sys.stdout
15 15
16try: 16try:
17 tablecfile = file( sys.argv[1]+".cpp", "w" ) 17 tablecfile = file( sys.argv[1]+".cpp", "w" )
18except: 18except:
19 tablecfile = sys.stdout 19 tablecfile = sys.stdout
20 20
21print >>tablehfile,""" 21print >>tablehfile,"""
22/* 22/*
23 * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> 23 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
24 */ 24 */
25 25
26#ifndef IOCTLMAP_H 26#ifndef DEBUGMAPPER_H
27#define IOCTLMAP_H 27#define DEBUGMAPPER_H
28 28
29#include <qstring.h> 29#include <qstring.h>
30#include <qintdict.h> 30#include <qintdict.h>
31 31
32typedef QIntDict<QString> IntStringMap; 32typedef QIntDict<QString> IntStringMap;
33 33
34IntStringMap* constructIoctlMap(); 34class DebugMapper
35{
36 public:
37 DebugMapper();
38 ~DebugMapper();
39
40 const QString& map( int value ) const;
41 private:
42 IntStringMap _map;
43};
35 44
36#endif 45#endif
37""" 46"""
38 47
39print >>tablecfile,""" 48print >>tablecfile,"""
40/* 49/*
41 * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> 50 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
42 */ 51 */
43 52
44#include "%s" 53#include "%s"
45 54
46IntStringMap* constructIoctlMap() 55DebugMapper::DebugMapper()
47{ 56{
48\tIntStringMap* map = new IntStringMap(); 57 qDebug( "DebugMapper::DebugMapper()" );
49 58
50""" % (tablehfile.name) 59""" % (tablehfile.name)
51 60
52for line in result: 61for line in result:
53 l = line.split() 62 l = line.split()
54 if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ): 63 if not l[0].startswith( "#define" ) or not l[2].startswith( "0x" ):
55 print >>sys.stderr, "can't parse line: %s" % l 64 print >>sys.stderr, "can't parse line: %s" % l
56 continue 65 continue
57 #print >>tablecfile, "\tqDebug( \"adding %s = %s\" );" % ( l[2], l[1] ) 66 print >>tablecfile, " _map.insert( %s, new QString(\"%s\") );" % ( l[2], l[1] )
58 print >>tablecfile, "\tmap->insert( %s, new QString(\"%s\") );" % ( l[2], l[1] )
59 67
60 68
61print >>tablecfile,""" 69print >>tablecfile,"""
62\treturn map;
63}; 70};
64""" \ No newline at end of file 71
72
73DebugMapper::~DebugMapper()
74{
75 qDebug( "DebugMapper::~DebugMapper()" );
76}
77
78
79const QString& DebugMapper::map( int value ) const
80{
81 QString* result = _map[ value ];
82
83 if ( !result )
84 {
85 qDebug( "DebugMapper::map() - value not found." );
86 return QString::null;
87 }
88 else
89 {
90 return *result;
91 }
92}
93
94"""