summaryrefslogtreecommitdiff
path: root/libopie2/opienet
Unidiff
Diffstat (limited to 'libopie2/opienet') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/odebugmapper.cpp2
-rw-r--r--libopie2/opienet/odebugmapper.h2
-rw-r--r--libopie2/opienet/onetutils.cpp2
-rw-r--r--libopie2/opienet/onetutils.h2
-rw-r--r--libopie2/opienet/onetwork.cpp4
5 files changed, 6 insertions, 6 deletions
diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp
index f679afb..0de1247 100644
--- a/libopie2/opienet/odebugmapper.cpp
+++ b/libopie2/opienet/odebugmapper.cpp
@@ -1,223 +1,223 @@
1 1
2/* 2/*
3 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> 3 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
4 */ 4 */
5 5
6#include <opie2/odebug.h> 6#include <opie2/odebug.h>
7 7
8#include "odebugmapper.h" 8#include "odebugmapper.h"
9 9
10using namespace Opie::Core; 10using namespace Opie::Core;
11 11
12namespace Opie { 12namespace Opie {
13namespace Net { 13namespace Net {
14namespace Private { 14namespace Internal {
15 15
16DebugMapper::DebugMapper() 16DebugMapper::DebugMapper()
17{ 17{
18 odebug << "DebugMapper::DebugMapper()" << oendl; 18 odebug << "DebugMapper::DebugMapper()" << oendl;
19 19
20 20
21 _map.insert( 0x8902, new QString("SIOCSPGRP") ); 21 _map.insert( 0x8902, new QString("SIOCSPGRP") );
22 _map.insert( 0x8904, new QString("SIOCGPGRP") ); 22 _map.insert( 0x8904, new QString("SIOCGPGRP") );
23 _map.insert( 0x8905, new QString("SIOCATMARK") ); 23 _map.insert( 0x8905, new QString("SIOCATMARK") );
24 _map.insert( 0x8906, new QString("SIOCGSTAMP") ); 24 _map.insert( 0x8906, new QString("SIOCGSTAMP") );
25 _map.insert( 0x890B, new QString("SIOCADDRT") ); 25 _map.insert( 0x890B, new QString("SIOCADDRT") );
26 _map.insert( 0x890C, new QString("SIOCDELRT") ); 26 _map.insert( 0x890C, new QString("SIOCDELRT") );
27 _map.insert( 0x890D, new QString("SIOCRTMSG") ); 27 _map.insert( 0x890D, new QString("SIOCRTMSG") );
28 _map.insert( 0x8910, new QString("SIOCGIFNAME") ); 28 _map.insert( 0x8910, new QString("SIOCGIFNAME") );
29 _map.insert( 0x8911, new QString("SIOCSIFLINK") ); 29 _map.insert( 0x8911, new QString("SIOCSIFLINK") );
30 _map.insert( 0x8912, new QString("SIOCGIFCONF") ); 30 _map.insert( 0x8912, new QString("SIOCGIFCONF") );
31 _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); 31 _map.insert( 0x8913, new QString("SIOCGIFFLAGS") );
32 _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); 32 _map.insert( 0x8914, new QString("SIOCSIFFLAGS") );
33 _map.insert( 0x8915, new QString("SIOCGIFADDR") ); 33 _map.insert( 0x8915, new QString("SIOCGIFADDR") );
34 _map.insert( 0x8916, new QString("SIOCSIFADDR") ); 34 _map.insert( 0x8916, new QString("SIOCSIFADDR") );
35 _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); 35 _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") );
36 _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); 36 _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") );
37 _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); 37 _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") );
38 _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); 38 _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") );
39 _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); 39 _map.insert( 0x891b, new QString("SIOCGIFNETMASK") );
40 _map.insert( 0x891c, new QString("SIOCSIFNETMASK") ); 40 _map.insert( 0x891c, new QString("SIOCSIFNETMASK") );
41 _map.insert( 0x891d, new QString("SIOCGIFMETRIC") ); 41 _map.insert( 0x891d, new QString("SIOCGIFMETRIC") );
42 _map.insert( 0x891e, new QString("SIOCSIFMETRIC") ); 42 _map.insert( 0x891e, new QString("SIOCSIFMETRIC") );
43 _map.insert( 0x891f, new QString("SIOCGIFMEM") ); 43 _map.insert( 0x891f, new QString("SIOCGIFMEM") );
44 _map.insert( 0x8920, new QString("SIOCSIFMEM") ); 44 _map.insert( 0x8920, new QString("SIOCSIFMEM") );
45 _map.insert( 0x8921, new QString("SIOCGIFMTU") ); 45 _map.insert( 0x8921, new QString("SIOCGIFMTU") );
46 _map.insert( 0x8922, new QString("SIOCSIFMTU") ); 46 _map.insert( 0x8922, new QString("SIOCSIFMTU") );
47 _map.insert( 0x8923, new QString("SIOCSIFNAME") ); 47 _map.insert( 0x8923, new QString("SIOCSIFNAME") );
48 _map.insert( 0x8924, new QString("SIOCSIFHWADDR") ); 48 _map.insert( 0x8924, new QString("SIOCSIFHWADDR") );
49 _map.insert( 0x8925, new QString("SIOCGIFENCAP") ); 49 _map.insert( 0x8925, new QString("SIOCGIFENCAP") );
50 _map.insert( 0x8926, new QString("SIOCSIFENCAP") ); 50 _map.insert( 0x8926, new QString("SIOCSIFENCAP") );
51 _map.insert( 0x8927, new QString("SIOCGIFHWADDR") ); 51 _map.insert( 0x8927, new QString("SIOCGIFHWADDR") );
52 _map.insert( 0x8929, new QString("SIOCGIFSLAVE") ); 52 _map.insert( 0x8929, new QString("SIOCGIFSLAVE") );
53 _map.insert( 0x8930, new QString("SIOCSIFSLAVE") ); 53 _map.insert( 0x8930, new QString("SIOCSIFSLAVE") );
54 _map.insert( 0x8931, new QString("SIOCADDMULTI") ); 54 _map.insert( 0x8931, new QString("SIOCADDMULTI") );
55 _map.insert( 0x8932, new QString("SIOCDELMULTI") ); 55 _map.insert( 0x8932, new QString("SIOCDELMULTI") );
56 _map.insert( 0x8933, new QString("SIOCGIFINDEX") ); 56 _map.insert( 0x8933, new QString("SIOCGIFINDEX") );
57 _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") ); 57 _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") );
58 _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") ); 58 _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") );
59 _map.insert( 0x8936, new QString("SIOCDIFADDR") ); 59 _map.insert( 0x8936, new QString("SIOCDIFADDR") );
60 _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); 60 _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") );
61 _map.insert( 0x8938, new QString("SIOCGIFCOUNT") ); 61 _map.insert( 0x8938, new QString("SIOCGIFCOUNT") );
62 _map.insert( 0x8940, new QString("SIOCGIFBR") ); 62 _map.insert( 0x8940, new QString("SIOCGIFBR") );
63 _map.insert( 0x8941, new QString("SIOCSIFBR") ); 63 _map.insert( 0x8941, new QString("SIOCSIFBR") );
64 _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") ); 64 _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") );
65 _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") ); 65 _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") );
66 _map.insert( 0x8953, new QString("SIOCDARP") ); 66 _map.insert( 0x8953, new QString("SIOCDARP") );
67 _map.insert( 0x8954, new QString("SIOCGARP") ); 67 _map.insert( 0x8954, new QString("SIOCGARP") );
68 _map.insert( 0x8955, new QString("SIOCSARP") ); 68 _map.insert( 0x8955, new QString("SIOCSARP") );
69 _map.insert( 0x8960, new QString("SIOCDRARP") ); 69 _map.insert( 0x8960, new QString("SIOCDRARP") );
70 _map.insert( 0x8961, new QString("SIOCGRARP") ); 70 _map.insert( 0x8961, new QString("SIOCGRARP") );
71 _map.insert( 0x8962, new QString("SIOCSRARP") ); 71 _map.insert( 0x8962, new QString("SIOCSRARP") );
72 _map.insert( 0x8970, new QString("SIOCGIFMAP") ); 72 _map.insert( 0x8970, new QString("SIOCGIFMAP") );
73 _map.insert( 0x8971, new QString("SIOCSIFMAP") ); 73 _map.insert( 0x8971, new QString("SIOCSIFMAP") );
74 _map.insert( 0x8980, new QString("SIOCADDDLCI") ); 74 _map.insert( 0x8980, new QString("SIOCADDDLCI") );
75 _map.insert( 0x8981, new QString("SIOCDELDLCI") ); 75 _map.insert( 0x8981, new QString("SIOCDELDLCI") );
76 _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); 76 _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") );
77 _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); 77 _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") );
78 _map.insert( 0x1fff, new QString("SIOCPARM_MASK") ); 78 _map.insert( 0x1fff, new QString("SIOCPARM_MASK") );
79 _map.insert( 0x00000000, new QString("SIOC_VOID") ); 79 _map.insert( 0x00000000, new QString("SIOC_VOID") );
80 _map.insert( 0x20000000, new QString("SIOC_OUT") ); 80 _map.insert( 0x20000000, new QString("SIOC_OUT") );
81 _map.insert( 0x40000000, new QString("SIOC_IN") ); 81 _map.insert( 0x40000000, new QString("SIOC_IN") );
82 _map.insert( 0x8B00, new QString("SIOCSIWCOMMIT") ); 82 _map.insert( 0x8B00, new QString("SIOCSIWCOMMIT") );
83 _map.insert( 0x8B01, new QString("SIOCGIWNAME") ); 83 _map.insert( 0x8B01, new QString("SIOCGIWNAME") );
84 _map.insert( 0x8B02, new QString("SIOCSIWNWID") ); 84 _map.insert( 0x8B02, new QString("SIOCSIWNWID") );
85 _map.insert( 0x8B03, new QString("SIOCGIWNWID") ); 85 _map.insert( 0x8B03, new QString("SIOCGIWNWID") );
86 _map.insert( 0x8B04, new QString("SIOCSIWFREQ") ); 86 _map.insert( 0x8B04, new QString("SIOCSIWFREQ") );
87 _map.insert( 0x8B05, new QString("SIOCGIWFREQ") ); 87 _map.insert( 0x8B05, new QString("SIOCGIWFREQ") );
88 _map.insert( 0x8B06, new QString("SIOCSIWMODE") ); 88 _map.insert( 0x8B06, new QString("SIOCSIWMODE") );
89 _map.insert( 0x8B07, new QString("SIOCGIWMODE") ); 89 _map.insert( 0x8B07, new QString("SIOCGIWMODE") );
90 _map.insert( 0x8B08, new QString("SIOCSIWSENS") ); 90 _map.insert( 0x8B08, new QString("SIOCSIWSENS") );
91 _map.insert( 0x8B09, new QString("SIOCGIWSENS") ); 91 _map.insert( 0x8B09, new QString("SIOCGIWSENS") );
92 _map.insert( 0x8B0A, new QString("SIOCSIWRANGE") ); 92 _map.insert( 0x8B0A, new QString("SIOCSIWRANGE") );
93 _map.insert( 0x8B0B, new QString("SIOCGIWRANGE") ); 93 _map.insert( 0x8B0B, new QString("SIOCGIWRANGE") );
94 _map.insert( 0x8B0C, new QString("SIOCSIWPRIV") ); 94 _map.insert( 0x8B0C, new QString("SIOCSIWPRIV") );
95 _map.insert( 0x8B0D, new QString("SIOCGIWPRIV") ); 95 _map.insert( 0x8B0D, new QString("SIOCGIWPRIV") );
96 _map.insert( 0x8B0E, new QString("SIOCSIWSTATS") ); 96 _map.insert( 0x8B0E, new QString("SIOCSIWSTATS") );
97 _map.insert( 0x8B0F, new QString("SIOCGIWSTATS") ); 97 _map.insert( 0x8B0F, new QString("SIOCGIWSTATS") );
98 _map.insert( 0x8B10, new QString("SIOCSIWSPY") ); 98 _map.insert( 0x8B10, new QString("SIOCSIWSPY") );
99 _map.insert( 0x8B11, new QString("SIOCGIWSPY") ); 99 _map.insert( 0x8B11, new QString("SIOCGIWSPY") );
100 _map.insert( 0x8B14, new QString("SIOCSIWAP") ); 100 _map.insert( 0x8B14, new QString("SIOCSIWAP") );
101 _map.insert( 0x8B15, new QString("SIOCGIWAP") ); 101 _map.insert( 0x8B15, new QString("SIOCGIWAP") );
102 _map.insert( 0x8B17, new QString("SIOCGIWAPLIST") ); 102 _map.insert( 0x8B17, new QString("SIOCGIWAPLIST") );
103 _map.insert( 0x8B18, new QString("SIOCSIWSCAN") ); 103 _map.insert( 0x8B18, new QString("SIOCSIWSCAN") );
104 _map.insert( 0x8B19, new QString("SIOCGIWSCAN") ); 104 _map.insert( 0x8B19, new QString("SIOCGIWSCAN") );
105 _map.insert( 0x8B1A, new QString("SIOCSIWESSID") ); 105 _map.insert( 0x8B1A, new QString("SIOCSIWESSID") );
106 _map.insert( 0x8B1B, new QString("SIOCGIWESSID") ); 106 _map.insert( 0x8B1B, new QString("SIOCGIWESSID") );
107 _map.insert( 0x8B1C, new QString("SIOCSIWNICKN") ); 107 _map.insert( 0x8B1C, new QString("SIOCSIWNICKN") );
108 _map.insert( 0x8B1D, new QString("SIOCGIWNICKN") ); 108 _map.insert( 0x8B1D, new QString("SIOCGIWNICKN") );
109 _map.insert( 0x8B20, new QString("SIOCSIWRATE") ); 109 _map.insert( 0x8B20, new QString("SIOCSIWRATE") );
110 _map.insert( 0x8B21, new QString("SIOCGIWRATE") ); 110 _map.insert( 0x8B21, new QString("SIOCGIWRATE") );
111 _map.insert( 0x8B22, new QString("SIOCSIWRTS") ); 111 _map.insert( 0x8B22, new QString("SIOCSIWRTS") );
112 _map.insert( 0x8B23, new QString("SIOCGIWRTS") ); 112 _map.insert( 0x8B23, new QString("SIOCGIWRTS") );
113 _map.insert( 0x8B24, new QString("SIOCSIWFRAG") ); 113 _map.insert( 0x8B24, new QString("SIOCSIWFRAG") );
114 _map.insert( 0x8B25, new QString("SIOCGIWFRAG") ); 114 _map.insert( 0x8B25, new QString("SIOCGIWFRAG") );
115 _map.insert( 0x8B26, new QString("SIOCSIWTXPOW") ); 115 _map.insert( 0x8B26, new QString("SIOCSIWTXPOW") );
116 _map.insert( 0x8B27, new QString("SIOCGIWTXPOW") ); 116 _map.insert( 0x8B27, new QString("SIOCGIWTXPOW") );
117 _map.insert( 0x8B28, new QString("SIOCSIWRETRY") ); 117 _map.insert( 0x8B28, new QString("SIOCSIWRETRY") );
118 _map.insert( 0x8B29, new QString("SIOCGIWRETRY") ); 118 _map.insert( 0x8B29, new QString("SIOCGIWRETRY") );
119 _map.insert( 0x8B2A, new QString("SIOCSIWENCODE") ); 119 _map.insert( 0x8B2A, new QString("SIOCSIWENCODE") );
120 _map.insert( 0x8B2B, new QString("SIOCGIWENCODE") ); 120 _map.insert( 0x8B2B, new QString("SIOCGIWENCODE") );
121 _map.insert( 0x8B2C, new QString("SIOCSIWPOWER") ); 121 _map.insert( 0x8B2C, new QString("SIOCSIWPOWER") );
122 _map.insert( 0x8B2D, new QString("SIOCGIWPOWER") ); 122 _map.insert( 0x8B2D, new QString("SIOCGIWPOWER") );
123 _map.insert( 0x8BE0, new QString("SIOCIWFIRSTPRIV") ); 123 _map.insert( 0x8BE0, new QString("SIOCIWFIRSTPRIV") );
124 _map.insert( 0x8BFF, new QString("SIOCIWLASTPRIV") ); 124 _map.insert( 0x8BFF, new QString("SIOCIWLASTPRIV") );
125 _map.insert( 0x8B00, new QString("SIOCIWFIRST") ); 125 _map.insert( 0x8B00, new QString("SIOCIWFIRST") );
126 _map.insert( 0x5000, new QString("SIOCGBPQETHPARAM") ); 126 _map.insert( 0x5000, new QString("SIOCGBPQETHPARAM") );
127 _map.insert( 0x5001, new QString("SIOCSBPQETHPARAM") ); 127 _map.insert( 0x5001, new QString("SIOCSBPQETHPARAM") );
128 _map.insert( 0x890B, new QString("SIOCADDRT") ); 128 _map.insert( 0x890B, new QString("SIOCADDRT") );
129 _map.insert( 0x890C, new QString("SIOCDELRT") ); 129 _map.insert( 0x890C, new QString("SIOCDELRT") );
130 _map.insert( 0x890D, new QString("SIOCRTMSG") ); 130 _map.insert( 0x890D, new QString("SIOCRTMSG") );
131 _map.insert( 0x8910, new QString("SIOCGIFNAME") ); 131 _map.insert( 0x8910, new QString("SIOCGIFNAME") );
132 _map.insert( 0x8911, new QString("SIOCSIFLINK") ); 132 _map.insert( 0x8911, new QString("SIOCSIFLINK") );
133 _map.insert( 0x8912, new QString("SIOCGIFCONF") ); 133 _map.insert( 0x8912, new QString("SIOCGIFCONF") );
134 _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); 134 _map.insert( 0x8913, new QString("SIOCGIFFLAGS") );
135 _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); 135 _map.insert( 0x8914, new QString("SIOCSIFFLAGS") );
136 _map.insert( 0x8915, new QString("SIOCGIFADDR") ); 136 _map.insert( 0x8915, new QString("SIOCGIFADDR") );
137 _map.insert( 0x8916, new QString("SIOCSIFADDR") ); 137 _map.insert( 0x8916, new QString("SIOCSIFADDR") );
138 _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); 138 _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") );
139 _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); 139 _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") );
140 _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); 140 _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") );
141 _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); 141 _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") );
142 _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); 142 _map.insert( 0x891b, new QString("SIOCGIFNETMASK") );
143 _map.insert( 0x891c, new QString("SIOCSIFNETMASK") ); 143 _map.insert( 0x891c, new QString("SIOCSIFNETMASK") );
144 _map.insert( 0x891d, new QString("SIOCGIFMETRIC") ); 144 _map.insert( 0x891d, new QString("SIOCGIFMETRIC") );
145 _map.insert( 0x891e, new QString("SIOCSIFMETRIC") ); 145 _map.insert( 0x891e, new QString("SIOCSIFMETRIC") );
146 _map.insert( 0x891f, new QString("SIOCGIFMEM") ); 146 _map.insert( 0x891f, new QString("SIOCGIFMEM") );
147 _map.insert( 0x8920, new QString("SIOCSIFMEM") ); 147 _map.insert( 0x8920, new QString("SIOCSIFMEM") );
148 _map.insert( 0x8921, new QString("SIOCGIFMTU") ); 148 _map.insert( 0x8921, new QString("SIOCGIFMTU") );
149 _map.insert( 0x8922, new QString("SIOCSIFMTU") ); 149 _map.insert( 0x8922, new QString("SIOCSIFMTU") );
150 _map.insert( 0x8923, new QString("SIOCSIFNAME") ); 150 _map.insert( 0x8923, new QString("SIOCSIFNAME") );
151 _map.insert( 0x8924, new QString("SIOCSIFHWADDR") ); 151 _map.insert( 0x8924, new QString("SIOCSIFHWADDR") );
152 _map.insert( 0x8925, new QString("SIOCGIFENCAP") ); 152 _map.insert( 0x8925, new QString("SIOCGIFENCAP") );
153 _map.insert( 0x8926, new QString("SIOCSIFENCAP") ); 153 _map.insert( 0x8926, new QString("SIOCSIFENCAP") );
154 _map.insert( 0x8927, new QString("SIOCGIFHWADDR") ); 154 _map.insert( 0x8927, new QString("SIOCGIFHWADDR") );
155 _map.insert( 0x8929, new QString("SIOCGIFSLAVE") ); 155 _map.insert( 0x8929, new QString("SIOCGIFSLAVE") );
156 _map.insert( 0x8930, new QString("SIOCSIFSLAVE") ); 156 _map.insert( 0x8930, new QString("SIOCSIFSLAVE") );
157 _map.insert( 0x8931, new QString("SIOCADDMULTI") ); 157 _map.insert( 0x8931, new QString("SIOCADDMULTI") );
158 _map.insert( 0x8932, new QString("SIOCDELMULTI") ); 158 _map.insert( 0x8932, new QString("SIOCDELMULTI") );
159 _map.insert( 0x8933, new QString("SIOCGIFINDEX") ); 159 _map.insert( 0x8933, new QString("SIOCGIFINDEX") );
160 _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") ); 160 _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") );
161 _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") ); 161 _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") );
162 _map.insert( 0x8936, new QString("SIOCDIFADDR") ); 162 _map.insert( 0x8936, new QString("SIOCDIFADDR") );
163 _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); 163 _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") );
164 _map.insert( 0x8938, new QString("SIOCGIFCOUNT") ); 164 _map.insert( 0x8938, new QString("SIOCGIFCOUNT") );
165 _map.insert( 0x8940, new QString("SIOCGIFBR") ); 165 _map.insert( 0x8940, new QString("SIOCGIFBR") );
166 _map.insert( 0x8941, new QString("SIOCSIFBR") ); 166 _map.insert( 0x8941, new QString("SIOCSIFBR") );
167 _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") ); 167 _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") );
168 _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") ); 168 _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") );
169 _map.insert( 0x8944, new QString("SIOCGIFDIVERT") ); 169 _map.insert( 0x8944, new QString("SIOCGIFDIVERT") );
170 _map.insert( 0x8945, new QString("SIOCSIFDIVERT") ); 170 _map.insert( 0x8945, new QString("SIOCSIFDIVERT") );
171 _map.insert( 0x8946, new QString("SIOCETHTOOL") ); 171 _map.insert( 0x8946, new QString("SIOCETHTOOL") );
172 _map.insert( 0x8947, new QString("SIOCGMIIPHY") ); 172 _map.insert( 0x8947, new QString("SIOCGMIIPHY") );
173 _map.insert( 0x8948, new QString("SIOCGMIIREG") ); 173 _map.insert( 0x8948, new QString("SIOCGMIIREG") );
174 _map.insert( 0x8949, new QString("SIOCSMIIREG") ); 174 _map.insert( 0x8949, new QString("SIOCSMIIREG") );
175 _map.insert( 0x894A, new QString("SIOCWANDEV") ); 175 _map.insert( 0x894A, new QString("SIOCWANDEV") );
176 _map.insert( 0x8953, new QString("SIOCDARP") ); 176 _map.insert( 0x8953, new QString("SIOCDARP") );
177 _map.insert( 0x8954, new QString("SIOCGARP") ); 177 _map.insert( 0x8954, new QString("SIOCGARP") );
178 _map.insert( 0x8955, new QString("SIOCSARP") ); 178 _map.insert( 0x8955, new QString("SIOCSARP") );
179 _map.insert( 0x8960, new QString("SIOCDRARP") ); 179 _map.insert( 0x8960, new QString("SIOCDRARP") );
180 _map.insert( 0x8961, new QString("SIOCGRARP") ); 180 _map.insert( 0x8961, new QString("SIOCGRARP") );
181 _map.insert( 0x8962, new QString("SIOCSRARP") ); 181 _map.insert( 0x8962, new QString("SIOCSRARP") );
182 _map.insert( 0x8970, new QString("SIOCGIFMAP") ); 182 _map.insert( 0x8970, new QString("SIOCGIFMAP") );
183 _map.insert( 0x8971, new QString("SIOCSIFMAP") ); 183 _map.insert( 0x8971, new QString("SIOCSIFMAP") );
184 _map.insert( 0x8980, new QString("SIOCADDDLCI") ); 184 _map.insert( 0x8980, new QString("SIOCADDDLCI") );
185 _map.insert( 0x8981, new QString("SIOCDELDLCI") ); 185 _map.insert( 0x8981, new QString("SIOCDELDLCI") );
186 _map.insert( 0x8982, new QString("SIOCGIFVLAN") ); 186 _map.insert( 0x8982, new QString("SIOCGIFVLAN") );
187 _map.insert( 0x8983, new QString("SIOCSIFVLAN") ); 187 _map.insert( 0x8983, new QString("SIOCSIFVLAN") );
188 _map.insert( 0x8990, new QString("SIOCBONDENSLAVE") ); 188 _map.insert( 0x8990, new QString("SIOCBONDENSLAVE") );
189 _map.insert( 0x8991, new QString("SIOCBONDRELEASE") ); 189 _map.insert( 0x8991, new QString("SIOCBONDRELEASE") );
190 _map.insert( 0x8992, new QString("SIOCBONDSETHWADDR") ); 190 _map.insert( 0x8992, new QString("SIOCBONDSETHWADDR") );
191 _map.insert( 0x8993, new QString("SIOCBONDSLAVEINFOQUERY") ); 191 _map.insert( 0x8993, new QString("SIOCBONDSLAVEINFOQUERY") );
192 _map.insert( 0x8994, new QString("SIOCBONDINFOQUERY") ); 192 _map.insert( 0x8994, new QString("SIOCBONDINFOQUERY") );
193 _map.insert( 0x8995, new QString("SIOCBONDCHANGEACTIVE") ); 193 _map.insert( 0x8995, new QString("SIOCBONDCHANGEACTIVE") );
194 _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); 194 _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") );
195 _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); 195 _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") );
196 196
197}; 197};
198 198
199 199
200DebugMapper::~DebugMapper() 200DebugMapper::~DebugMapper()
201{ 201{
202 odebug << "DebugMapper::~DebugMapper()" << oendl; 202 odebug << "DebugMapper::~DebugMapper()" << oendl;
203} 203}
204 204
205 205
206const QString& DebugMapper::map( int value ) const 206const QString& DebugMapper::map( int value ) const
207{ 207{
208 QString* result = _map[ value ]; 208 QString* result = _map[ value ];
209 209
210 if ( !result ) 210 if ( !result )
211 { 211 {
212 owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; 212 owarn << "DebugMapper::map() - value " << value << " is not found." << oendl;
213 return QString::null; 213 return QString::null;
214 } 214 }
215 else 215 else
216 { 216 {
217 return *result; 217 return *result;
218 } 218 }
219} 219}
220 220
221} 221}
222} 222}
223} 223}
diff --git a/libopie2/opienet/odebugmapper.h b/libopie2/opienet/odebugmapper.h
index f47db47..79fb42e 100644
--- a/libopie2/opienet/odebugmapper.h
+++ b/libopie2/opienet/odebugmapper.h
@@ -1,36 +1,36 @@
1 1
2/* 2/*
3 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> 3 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
4 */ 4 */
5 5
6#ifndef DEBUGMAPPER_H 6#ifndef DEBUGMAPPER_H
7#define DEBUGMAPPER_H 7#define DEBUGMAPPER_H
8 8
9#include <qstring.h> 9#include <qstring.h>
10#include <qintdict.h> 10#include <qintdict.h>
11 11
12namespace Opie { 12namespace Opie {
13namespace Net { 13namespace Net {
14namespace Private { 14namespace Internal {
15 15
16typedef QIntDict<QString> IntStringMap; 16typedef QIntDict<QString> IntStringMap;
17 17
18class DebugMapper 18class DebugMapper
19{ 19{
20 public: 20 public:
21 DebugMapper(); 21 DebugMapper();
22 ~DebugMapper(); 22 ~DebugMapper();
23 23
24 const QString& map( int value ) const; 24 const QString& map( int value ) const;
25 private: 25 private:
26 IntStringMap _map; 26 IntStringMap _map;
27 class Private; 27 class Private;
28 Private *d; 28 Private *d;
29}; 29};
30 30
31} 31}
32} 32}
33} 33}
34 34
35#endif 35#endif
36 36
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp
index 7794334..c185805 100644
--- a/libopie2/opienet/onetutils.cpp
+++ b/libopie2/opienet/onetutils.cpp
@@ -1,241 +1,241 @@
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@Vanille.de> 4              (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.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 <assert.h> 37#include <assert.h>
38#include <stdio.h> 38#include <stdio.h>
39 39
40namespace Opie { 40namespace Opie {
41namespace Net { 41namespace Net {
42 42
43/*====================================================================================== 43/*======================================================================================
44 * OMacAddress 44 * OMacAddress
45 *======================================================================================*/ 45 *======================================================================================*/
46 46
47// static initializer for broadcast and unknown MAC Adresses 47// static initializer for broadcast and unknown MAC Adresses
48const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 48const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
49const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); 49const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast );
50const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; 50const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 };
51const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); 51const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown );
52 52
53//TODO: Incorporate Ethernet Manufacturer database here! (inline or so) 53//TODO: Incorporate Ethernet Manufacturer database here! (inline or so)
54 54
55OMacAddress::OMacAddress() 55OMacAddress::OMacAddress()
56{ 56{
57 memcpy( _bytes, __unknown, 6 ); 57 memcpy( _bytes, __unknown, 6 );
58} 58}
59 59
60 60
61OMacAddress::OMacAddress( unsigned char* p ) 61OMacAddress::OMacAddress( unsigned char* p )
62{ 62{
63 memcpy( _bytes, p, 6 ); 63 memcpy( _bytes, p, 6 );
64} 64}
65 65
66 66
67OMacAddress::OMacAddress( const unsigned char* p ) 67OMacAddress::OMacAddress( const unsigned char* p )
68{ 68{
69 memcpy( _bytes, p, 6 ); 69 memcpy( _bytes, p, 6 );
70} 70}
71 71
72 72
73OMacAddress::OMacAddress( struct ifreq& ifr ) 73OMacAddress::OMacAddress( struct ifreq& ifr )
74{ 74{
75 memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); 75 memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 );
76} 76}
77 77
78 78
79OMacAddress::~OMacAddress() 79OMacAddress::~OMacAddress()
80{ 80{
81} 81}
82 82
83 83
84//#ifdef QT_NO_DEBUG 84//#ifdef QT_NO_DEBUG
85//inline 85//inline
86//#endif 86//#endif
87const unsigned char* OMacAddress::native() const 87const unsigned char* OMacAddress::native() const
88{ 88{
89 return (const unsigned char*) &_bytes; 89 return (const unsigned char*) &_bytes;
90} 90}
91 91
92 92
93OMacAddress OMacAddress::fromString( const QString& str ) 93OMacAddress OMacAddress::fromString( const QString& str )
94{ 94{
95 QString addr( str ); 95 QString addr( str );
96 unsigned char buf[6]; 96 unsigned char buf[6];
97 bool ok = true; 97 bool ok = true;
98 int index = 14; 98 int index = 14;
99 for ( int i = 5; i >= 0; --i ) 99 for ( int i = 5; i >= 0; --i )
100 { 100 {
101 buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); 101 buf[i] = addr.right( 2 ).toUShort( &ok, 16 );
102 if ( !ok ) return OMacAddress::unknown; 102 if ( !ok ) return OMacAddress::unknown;
103 addr.truncate( index ); 103 addr.truncate( index );
104 index -= 3; 104 index -= 3;
105 } 105 }
106 return (const unsigned char*) &buf; 106 return (const unsigned char*) &buf;
107} 107}
108 108
109 109
110QString OMacAddress::toString( bool substitute ) const 110QString OMacAddress::toString( bool substitute ) const
111{ 111{
112 QString manu; 112 QString manu;
113 manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff ); 113 manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff );
114 QString serial; 114 QString serial;
115 serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); 115 serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff );
116 if ( !substitute ) return manu+serial; 116 if ( !substitute ) return manu+serial;
117 // fallback - if no vendor is found, just use the number 117 // fallback - if no vendor is found, just use the number
118 QString textmanu = OManufacturerDB::instance()->lookup( manu ); 118 QString textmanu = OManufacturerDB::instance()->lookup( manu );
119 return textmanu.isNull() ? manu+serial : textmanu+serial; 119 return textmanu.isNull() ? manu+serial : textmanu+serial;
120} 120}
121 121
122 122
123QString OMacAddress::manufacturer() const 123QString OMacAddress::manufacturer() const
124{ 124{
125 return OManufacturerDB::instance()->lookupExt( toString() ); 125 return OManufacturerDB::instance()->lookupExt( toString() );
126} 126}
127 127
128 128
129bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) 129bool operator==( const OMacAddress &m1, const OMacAddress &m2 )
130{ 130{
131 return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; 131 return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0;
132} 132}
133 133
134 134
135/*====================================================================================== 135/*======================================================================================
136 * OHostAddress 136 * OHostAddress
137 *======================================================================================*/ 137 *======================================================================================*/
138 138
139 139
140/*====================================================================================== 140/*======================================================================================
141 * OPrivateIOCTL 141 * OPrivateIOCTL
142 *======================================================================================*/ 142 *======================================================================================*/
143 143
144OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) 144OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs )
145 :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) 145 :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs )
146{ 146{
147} 147}
148 148
149 149
150OPrivateIOCTL::~OPrivateIOCTL() 150OPrivateIOCTL::~OPrivateIOCTL()
151{ 151{
152} 152}
153 153
154 154
155int OPrivateIOCTL::numberGetArgs() const 155int OPrivateIOCTL::numberGetArgs() const
156{ 156{
157 return _getargs & IW_PRIV_SIZE_MASK; 157 return _getargs & IW_PRIV_SIZE_MASK;
158} 158}
159 159
160 160
161int OPrivateIOCTL::typeGetArgs() const 161int OPrivateIOCTL::typeGetArgs() const
162{ 162{
163 return _getargs & IW_PRIV_TYPE_MASK >> 12; 163 return _getargs & IW_PRIV_TYPE_MASK >> 12;
164} 164}
165 165
166 166
167int OPrivateIOCTL::numberSetArgs() const 167int OPrivateIOCTL::numberSetArgs() const
168{ 168{
169 return _setargs & IW_PRIV_SIZE_MASK; 169 return _setargs & IW_PRIV_SIZE_MASK;
170} 170}
171 171
172 172
173int OPrivateIOCTL::typeSetArgs() const 173int OPrivateIOCTL::typeSetArgs() const
174{ 174{
175 return _setargs & IW_PRIV_TYPE_MASK >> 12; 175 return _setargs & IW_PRIV_TYPE_MASK >> 12;
176} 176}
177 177
178 178
179void OPrivateIOCTL::invoke() const 179void OPrivateIOCTL::invoke() const
180{ 180{
181 ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); 181 ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl );
182} 182}
183 183
184 184
185void OPrivateIOCTL::setParameter( int num, u_int32_t value ) 185void OPrivateIOCTL::setParameter( int num, u_int32_t value )
186{ 186{
187 u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; 187 u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name;
188 arglist[num] = value; 188 arglist[num] = value;
189} 189}
190 190
191 191
192 192
193namespace Private { 193namespace Internal {
194/*====================================================================================== 194/*======================================================================================
195 * assorted functions 195 * assorted functions
196 *======================================================================================*/ 196 *======================================================================================*/
197 197
198void dumpBytes( const unsigned char* data, int num ) 198void dumpBytes( const unsigned char* data, int num )
199{ 199{
200 printf( "Dumping %d bytes @ %0x", num, data ); 200 printf( "Dumping %d bytes @ %0x", num, data );
201 printf( "-------------------------------------------\n" ); 201 printf( "-------------------------------------------\n" );
202 202
203 for ( int i = 0; i < num; ++i ) 203 for ( int i = 0; i < num; ++i )
204 { 204 {
205 printf( "%02x ", data[i] ); 205 printf( "%02x ", data[i] );
206 if ( !((i+1) % 32) ) printf( "\n" ); 206 if ( !((i+1) % 32) ) printf( "\n" );
207 } 207 }
208 printf( "\n\n" ); 208 printf( "\n\n" );
209} 209}
210 210
211 211
212int stringToMode( const QString& mode ) 212int stringToMode( const QString& mode )
213{ 213{
214 if ( mode == "auto" ) return IW_MODE_AUTO; 214 if ( mode == "auto" ) return IW_MODE_AUTO;
215 else if ( mode == "adhoc" ) return IW_MODE_ADHOC; 215 else if ( mode == "adhoc" ) return IW_MODE_ADHOC;
216 else if ( mode == "managed" ) return IW_MODE_INFRA; 216 else if ( mode == "managed" ) return IW_MODE_INFRA;
217 else if ( mode == "master" ) return IW_MODE_MASTER; 217 else if ( mode == "master" ) return IW_MODE_MASTER;
218 else if ( mode == "repeater" ) return IW_MODE_REPEAT; 218 else if ( mode == "repeater" ) return IW_MODE_REPEAT;
219 else if ( mode == "secondary" ) return IW_MODE_SECOND; 219 else if ( mode == "secondary" ) return IW_MODE_SECOND;
220 else if ( mode == "monitor" ) return IW_MODE_MONITOR; 220 else if ( mode == "monitor" ) return IW_MODE_MONITOR;
221 else assert( 0 ); 221 else assert( 0 );
222} 222}
223 223
224 224
225QString modeToString( int mode ) 225QString modeToString( int mode )
226{ 226{
227 switch ( mode ) 227 switch ( mode )
228 { 228 {
229 case IW_MODE_AUTO: return "auto"; 229 case IW_MODE_AUTO: return "auto";
230 case IW_MODE_ADHOC: return "adhoc"; 230 case IW_MODE_ADHOC: return "adhoc";
231 case IW_MODE_INFRA: return "managed"; 231 case IW_MODE_INFRA: return "managed";
232 case IW_MODE_MASTER: return "master"; 232 case IW_MODE_MASTER: return "master";
233 case IW_MODE_REPEAT: return "repeater"; 233 case IW_MODE_REPEAT: return "repeater";
234 case IW_MODE_SECOND: return "second"; 234 case IW_MODE_SECOND: return "second";
235 case IW_MODE_MONITOR: return "monitor"; 235 case IW_MODE_MONITOR: return "monitor";
236 default: assert( 0 ); 236 default: assert( 0 );
237 } 237 }
238} 238}
239} 239}
240} 240}
241} 241}
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h
index ca6815d..4a09426 100644
--- a/libopie2/opienet/onetutils.h
+++ b/libopie2/opienet/onetutils.h
@@ -1,196 +1,196 @@
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#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;
44 44
45namespace Opie { 45namespace Opie {
46namespace Net { 46namespace Net {
47 47
48class OWirelessNetworkInterface; 48class OWirelessNetworkInterface;
49 49
50/*====================================================================================== 50/*======================================================================================
51 * OMacAddress 51 * OMacAddress
52 *======================================================================================*/ 52 *======================================================================================*/
53 53
54class OMacAddress 54class OMacAddress
55{ 55{
56 public: 56 public:
57 // QString c'tor? -zecke 57 // QString c'tor? -zecke
58 OMacAddress(); 58 OMacAddress();
59 OMacAddress( unsigned char* ); 59 OMacAddress( unsigned char* );
60 OMacAddress( const unsigned char* ); 60 OMacAddress( const unsigned char* );
61 OMacAddress( struct ifreq& ); 61 OMacAddress( struct ifreq& );
62 ~OMacAddress(); 62 ~OMacAddress();
63 63
64 QString manufacturer() const; 64 QString manufacturer() const;
65 QString toString( bool substitute = false ) const; 65 QString toString( bool substitute = false ) const;
66 const unsigned char* native() const; 66 const unsigned char* native() const;
67 67
68 // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? 68 // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem?
69 static OMacAddress fromString( const QString& ); 69 static OMacAddress fromString( const QString& );
70 70
71 public: 71 public:
72 static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff 72 static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff
73 static const OMacAddress& unknown; // 44:44:44:44:44:44 73 static const OMacAddress& unknown; // 44:44:44:44:44:44
74 74
75 private: 75 private:
76 unsigned char _bytes[6]; 76 unsigned char _bytes[6];
77 77
78 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 78 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
79 class Private; 79 class Private;
80 Private *d; 80 Private *d;
81 81
82}; 82};
83 83
84bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 84bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
85 85
86 86
87/*====================================================================================== 87/*======================================================================================
88 * OHostAddress 88 * OHostAddress
89 *======================================================================================*/ 89 *======================================================================================*/
90 90
91class OHostAddress : public QHostAddress 91class OHostAddress : public QHostAddress
92{ 92{
93 /*public: 93 /*public:
94 OHostAddress(); 94 OHostAddress();
95 ~OHostAddress(); 95 ~OHostAddress();
96 */ 96 */
97 private: 97 private:
98 class Private; 98 class Private;
99 Private *d; 99 Private *d;
100}; 100};
101 101
102 102
103/*====================================================================================== 103/*======================================================================================
104 * OPrivateIOCTL 104 * OPrivateIOCTL
105 *======================================================================================*/ 105 *======================================================================================*/
106 106
107class OPrivateIOCTL : public QObject 107class OPrivateIOCTL : public QObject
108{ 108{
109 public: 109 public:
110 OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); 110 OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs );
111 ~OPrivateIOCTL(); 111 ~OPrivateIOCTL();
112 112
113 int numberGetArgs() const; 113 int numberGetArgs() const;
114 int typeGetArgs() const; 114 int typeGetArgs() const;
115 int numberSetArgs() const; 115 int numberSetArgs() const;
116 int typeSetArgs() const; 116 int typeSetArgs() const;
117 117
118 // FIXME return int? as ::ioctl does? -zecke 118 // FIXME return int? as ::ioctl does? -zecke
119 void invoke() const; 119 void invoke() const;
120 void setParameter( int, u_int32_t ); 120 void setParameter( int, u_int32_t );
121 121
122 private: 122 private:
123 u_int32_t _ioctl; 123 u_int32_t _ioctl;
124 u_int16_t _getargs; 124 u_int16_t _getargs;
125 u_int16_t _setargs; 125 u_int16_t _setargs;
126 126
127 class Private; 127 class Private;
128 Private *d; 128 Private *d;
129}; 129};
130 130
131 /*====================================================================================== 131 /*======================================================================================
132 * Miscellaneous 132 * Miscellaneous
133 *======================================================================================*/ 133 *======================================================================================*/
134 134
135namespace Private { 135namespace Internal {
136void dumpBytes( const unsigned char* data, int num ); 136void dumpBytes( const unsigned char* data, int num );
137QString modeToString( int ); 137QString modeToString( int );
138int stringToMode( const QString& ); 138int stringToMode( const QString& );
139} 139}
140} 140}
141} 141}
142 142
143#define IW_PRIV_TYPE_MASK 0x7000 143#define IW_PRIV_TYPE_MASK 0x7000
144#define IW_PRIV_TYPE_NONE 0x0000 144#define IW_PRIV_TYPE_NONE 0x0000
145#define IW_PRIV_TYPE_BYTE 0x1000 145#define IW_PRIV_TYPE_BYTE 0x1000
146#define IW_PRIV_TYPE_CHAR 0x2000 146#define IW_PRIV_TYPE_CHAR 0x2000
147#define IW_PRIV_TYPE_INT 0x4000 147#define IW_PRIV_TYPE_INT 0x4000
148#define IW_PRIV_TYPE_FLOAT 0x5000 148#define IW_PRIV_TYPE_FLOAT 0x5000
149#define IW_PRIV_TYPE_ADDR 0x6000 149#define IW_PRIV_TYPE_ADDR 0x6000
150#define IW_PRIV_SIZE_FIXED 0x0800 150#define IW_PRIV_SIZE_FIXED 0x0800
151#define IW_PRIV_SIZE_MASK 0x07FF 151#define IW_PRIV_SIZE_MASK 0x07FF
152 152
153#ifndef ARPHRD_IEEE80211 153#ifndef ARPHRD_IEEE80211
154#define ARPHRD_IEEE80211 801 154#define ARPHRD_IEEE80211 801
155#endif 155#endif
156#ifndef ARPHRD_IEEE80211_PRISM 156#ifndef ARPHRD_IEEE80211_PRISM
157#define ARPHRD_IEEE80211_PRISM 802 157#define ARPHRD_IEEE80211_PRISM 802
158#endif 158#endif
159 159
160 160
161/* Network to host order macros */ 161/* Network to host order macros */
162 162
163#ifdef LBL_ALIGN 163#ifdef LBL_ALIGN
164#define EXTRACT_16BITS(p) \ 164#define EXTRACT_16BITS(p) \
165 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ 165 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
166 (u_int16_t)*((const u_int8_t *)(p) + 1))) 166 (u_int16_t)*((const u_int8_t *)(p) + 1)))
167#define EXTRACT_32BITS(p) \ 167#define EXTRACT_32BITS(p) \
168 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ 168 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
169 (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ 169 (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
170 (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ 170 (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
171 (u_int32_t)*((const u_int8_t *)(p) + 3))) 171 (u_int32_t)*((const u_int8_t *)(p) + 3)))
172#else 172#else
173#define EXTRACT_16BITS(p) \ 173#define EXTRACT_16BITS(p) \
174 ((u_int16_t)ntohs(*(const u_int16_t *)(p))) 174 ((u_int16_t)ntohs(*(const u_int16_t *)(p)))
175#define EXTRACT_32BITS(p) \ 175#define EXTRACT_32BITS(p) \
176 ((u_int32_t)ntohl(*(const u_int32_t *)(p))) 176 ((u_int32_t)ntohl(*(const u_int32_t *)(p)))
177#endif 177#endif
178 178
179#define EXTRACT_24BITS(p) \ 179#define EXTRACT_24BITS(p) \
180 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \ 180 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
181 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ 181 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
182 (u_int32_t)*((const u_int8_t *)(p) + 2))) 182 (u_int32_t)*((const u_int8_t *)(p) + 2)))
183 183
184/* Little endian protocol host order macros */ 184/* Little endian protocol host order macros */
185#define EXTRACT_LE_8BITS(p) (*(p)) 185#define EXTRACT_LE_8BITS(p) (*(p))
186#define EXTRACT_LE_16BITS(p) \ 186#define EXTRACT_LE_16BITS(p) \
187 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \ 187 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
188 (u_int16_t)*((const u_int8_t *)(p) + 0))) 188 (u_int16_t)*((const u_int8_t *)(p) + 0)))
189#define EXTRACT_LE_32BITS(p) \ 189#define EXTRACT_LE_32BITS(p) \
190 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \ 190 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
191 (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \ 191 (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
192 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ 192 (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
193 (u_int32_t)*((const u_int8_t *)(p) + 0))) 193 (u_int32_t)*((const u_int8_t *)(p) + 0)))
194 194
195#endif // ONETUTILS_H 195#endif // ONETUTILS_H
196 196
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 26a6c81..b6c9876 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -1,362 +1,362 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003-2004 by Michael 'Mickey' Lauer 3              Copyright (C) 2003-2004 by Michael 'Mickey' Lauer
4 =. <mickey@Vanille.de> 4 =. <mickey@Vanille.de>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31/* OPIE */ 31/* OPIE */
32 32
33#include <opie2/onetwork.h> 33#include <opie2/onetwork.h>
34#include <opie2/ostation.h> 34#include <opie2/ostation.h>
35#include <opie2/odebug.h> 35#include <opie2/odebug.h>
36 36
37/* QT */ 37/* QT */
38 38
39#include <qfile.h> 39#include <qfile.h>
40#include <qtextstream.h> 40#include <qtextstream.h>
41 41
42/* UNIX */ 42/* UNIX */
43 43
44#include <assert.h> 44#include <assert.h>
45#include <arpa/inet.h> 45#include <arpa/inet.h>
46#include <errno.h> 46#include <errno.h>
47#include <string.h> 47#include <string.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <math.h> 49#include <math.h>
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#include <sys/socket.h> 51#include <sys/socket.h>
52#include <sys/types.h> 52#include <sys/types.h>
53#include <unistd.h> 53#include <unistd.h>
54#include <linux/sockios.h> 54#include <linux/sockios.h>
55#include <net/if_arp.h> 55#include <net/if_arp.h>
56#include <stdarg.h> 56#include <stdarg.h>
57 57
58#ifndef NODEBUG 58#ifndef NODEBUG
59#include <opie2/odebugmapper.h> 59#include <opie2/odebugmapper.h>
60 60
61 61
62using namespace Opie::Core; 62using namespace Opie::Core;
63using namespace Opie::Net::Private; 63using namespace Opie::Net::Internal;
64DebugMapper* debugmapper = new DebugMapper(); 64DebugMapper* debugmapper = new DebugMapper();
65#endif 65#endif
66 66
67/*====================================================================================== 67/*======================================================================================
68 * ONetwork 68 * ONetwork
69 *======================================================================================*/ 69 *======================================================================================*/
70 70
71namespace Opie { 71namespace Opie {
72namespace Net { 72namespace Net {
73ONetwork* ONetwork::_instance = 0; 73ONetwork* ONetwork::_instance = 0;
74 74
75ONetwork::ONetwork() 75ONetwork::ONetwork()
76{ 76{
77 odebug << "ONetwork::ONetwork()" << oendl; 77 odebug << "ONetwork::ONetwork()" << oendl;
78 odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; 78 odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl;
79 synchronize(); 79 synchronize();
80} 80}
81 81
82void ONetwork::synchronize() 82void ONetwork::synchronize()
83{ 83{
84 // gather available interfaces by inspecting /proc/net/dev 84 // gather available interfaces by inspecting /proc/net/dev
85 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices 85 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices
86 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices 86 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices
87 //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev 87 //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev
88 88
89 _interfaces.clear(); 89 _interfaces.clear();
90 QString str; 90 QString str;
91 QFile f( "/proc/net/dev" ); 91 QFile f( "/proc/net/dev" );
92 bool hasFile = f.open( IO_ReadOnly ); 92 bool hasFile = f.open( IO_ReadOnly );
93 if ( !hasFile ) 93 if ( !hasFile )
94 { 94 {
95 odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; 95 odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl;
96 return; 96 return;
97 } 97 }
98 QTextStream s( &f ); 98 QTextStream s( &f );
99 s.readLine(); 99 s.readLine();
100 s.readLine(); 100 s.readLine();
101 while ( !s.atEnd() ) 101 while ( !s.atEnd() )
102 { 102 {
103 s >> str; 103 s >> str;
104 str.truncate( str.find( ':' ) ); 104 str.truncate( str.find( ':' ) );
105 odebug << "ONetwork: found interface '" << str << "'" << oendl; 105 odebug << "ONetwork: found interface '" << str << "'" << oendl;
106 ONetworkInterface* iface; 106 ONetworkInterface* iface = 0;
107 if ( isWirelessInterface( str ) ) 107 if ( isWirelessInterface( str ) )
108 { 108 {
109 iface = new OWirelessNetworkInterface( this, (const char*) str ); 109 iface = new OWirelessNetworkInterface( this, (const char*) str );
110 odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; 110 odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl;
111 } 111 }
112 else 112 else
113 { 113 {
114 iface = new ONetworkInterface( this, (const char*) str ); 114 iface = new ONetworkInterface( this, (const char*) str );
115 } 115 }
116 _interfaces.insert( str, iface ); 116 _interfaces.insert( str, iface );
117 s.readLine(); 117 s.readLine();
118 } 118 }
119} 119}
120 120
121 121
122short ONetwork::wirelessExtensionVersion() 122short ONetwork::wirelessExtensionVersion()
123{ 123{
124 return WIRELESS_EXT; 124 return WIRELESS_EXT;
125} 125}
126 126
127 127
128int ONetwork::count() const 128int ONetwork::count() const
129{ 129{
130 return _interfaces.count(); 130 return _interfaces.count();
131} 131}
132 132
133 133
134ONetworkInterface* ONetwork::interface( const QString& iface ) const 134ONetworkInterface* ONetwork::interface( const QString& iface ) const
135{ 135{
136 return _interfaces[iface]; 136 return _interfaces[iface];
137} 137}
138 138
139 139
140ONetwork* ONetwork::instance() 140ONetwork* ONetwork::instance()
141{ 141{
142 if ( !_instance ) _instance = new ONetwork(); 142 if ( !_instance ) _instance = new ONetwork();
143 return _instance; 143 return _instance;
144} 144}
145 145
146 146
147ONetwork::InterfaceIterator ONetwork::iterator() const 147ONetwork::InterfaceIterator ONetwork::iterator() const
148{ 148{
149 return ONetwork::InterfaceIterator( _interfaces ); 149 return ONetwork::InterfaceIterator( _interfaces );
150} 150}
151 151
152 152
153bool ONetwork::isPresent( const char* name ) const 153bool ONetwork::isPresent( const char* name ) const
154{ 154{
155 int sfd = socket( AF_INET, SOCK_STREAM, 0 ); 155 int sfd = socket( AF_INET, SOCK_STREAM, 0 );
156 struct ifreq ifr; 156 struct ifreq ifr;
157 memset( &ifr, 0, sizeof( struct ifreq ) ); 157 memset( &ifr, 0, sizeof( struct ifreq ) );
158 strcpy( (char*) &ifr.ifr_name, name ); 158 strcpy( (char*) &ifr.ifr_name, name );
159 int result = ::ioctl( sfd, SIOCGIFFLAGS, &ifr ); 159 int result = ::ioctl( sfd, SIOCGIFFLAGS, &ifr );
160 return result != -1; 160 return result != -1;
161} 161}
162 162
163 163
164bool ONetwork::isWirelessInterface( const char* name ) const 164bool ONetwork::isWirelessInterface( const char* name ) const
165{ 165{
166 int sfd = socket( AF_INET, SOCK_STREAM, 0 ); 166 int sfd = socket( AF_INET, SOCK_STREAM, 0 );
167 struct iwreq iwr; 167 struct iwreq iwr;
168 memset( &iwr, 0, sizeof( struct iwreq ) ); 168 memset( &iwr, 0, sizeof( struct iwreq ) );
169 strcpy( (char*) &iwr.ifr_name, name ); 169 strcpy( (char*) &iwr.ifr_name, name );
170 int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); 170 int result = ::ioctl( sfd, SIOCGIWNAME, &iwr );
171 return result != -1; 171 return result != -1;
172} 172}
173 173
174/*====================================================================================== 174/*======================================================================================
175 * ONetworkInterface 175 * ONetworkInterface
176 *======================================================================================*/ 176 *======================================================================================*/
177 177
178ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) 178ONetworkInterface::ONetworkInterface( QObject* parent, const char* name )
179 :QObject( parent, name ), 179 :QObject( parent, name ),
180 _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) 180 _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 )
181{ 181{
182 odebug << "ONetworkInterface::ONetworkInterface()" << oendl; 182 odebug << "ONetworkInterface::ONetworkInterface()" << oendl;
183 init(); 183 init();
184} 184}
185 185
186 186
187struct ifreq& ONetworkInterface::ifr() const 187struct ifreq& ONetworkInterface::ifr() const
188{ 188{
189 return _ifr; 189 return _ifr;
190} 190}
191 191
192 192
193void ONetworkInterface::init() 193void ONetworkInterface::init()
194{ 194{
195 odebug << "ONetworkInterface::init()" << oendl; 195 odebug << "ONetworkInterface::init()" << oendl;
196 196
197 memset( &_ifr, 0, sizeof( struct ifreq ) ); 197 memset( &_ifr, 0, sizeof( struct ifreq ) );
198 198
199 if ( _sfd == -1 ) 199 if ( _sfd == -1 )
200 { 200 {
201 odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; 201 odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl;
202 return; 202 return;
203 } 203 }
204} 204}
205 205
206 206
207bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const 207bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const
208{ 208{
209 #ifndef NODEBUG 209 #ifndef NODEBUG
210 int result = ::ioctl( _sfd, call, &ifreq ); 210 int result = ::ioctl( _sfd, call, &ifreq );
211 if ( result == -1 ) 211 if ( result == -1 )
212 odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) 212 odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call )
213 << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; 213 << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl;
214 else 214 else
215 odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) 215 odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call )
216 << "' - Status: Ok." << oendl; 216 << "' - Status: Ok." << oendl;
217 return ( result != -1 ); 217 return ( result != -1 );
218 #else 218 #else
219 return ::ioctl( _sfd, call, &ifreq ) != -1; 219 return ::ioctl( _sfd, call, &ifreq ) != -1;
220 #endif 220 #endif
221} 221}
222 222
223 223
224bool ONetworkInterface::ioctl( int call ) const 224bool ONetworkInterface::ioctl( int call ) const
225{ 225{
226 strcpy( _ifr.ifr_name, name() ); 226 strcpy( _ifr.ifr_name, name() );
227 return ioctl( call, _ifr ); 227 return ioctl( call, _ifr );
228} 228}
229 229
230 230
231bool ONetworkInterface::isLoopback() const 231bool ONetworkInterface::isLoopback() const
232{ 232{
233 ioctl( SIOCGIFFLAGS ); 233 ioctl( SIOCGIFFLAGS );
234 return _ifr.ifr_flags & IFF_LOOPBACK; 234 return _ifr.ifr_flags & IFF_LOOPBACK;
235} 235}
236 236
237 237
238bool ONetworkInterface::setUp( bool b ) 238bool ONetworkInterface::setUp( bool b )
239{ 239{
240 ioctl( SIOCGIFFLAGS ); 240 ioctl( SIOCGIFFLAGS );
241 if ( b ) _ifr.ifr_flags |= IFF_UP; 241 if ( b ) _ifr.ifr_flags |= IFF_UP;
242 else _ifr.ifr_flags &= (~IFF_UP); 242 else _ifr.ifr_flags &= (~IFF_UP);
243 return ioctl( SIOCSIFFLAGS ); 243 return ioctl( SIOCSIFFLAGS );
244} 244}
245 245
246 246
247bool ONetworkInterface::isUp() const 247bool ONetworkInterface::isUp() const
248{ 248{
249 ioctl( SIOCGIFFLAGS ); 249 ioctl( SIOCGIFFLAGS );
250 return _ifr.ifr_flags & IFF_UP; 250 return _ifr.ifr_flags & IFF_UP;
251} 251}
252 252
253 253
254void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) 254void ONetworkInterface::setIPV4Address( const QHostAddress& addr )
255{ 255{
256 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; 256 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr;
257 sa->sin_family = AF_INET; 257 sa->sin_family = AF_INET;
258 sa->sin_port = 0; 258 sa->sin_port = 0;
259 sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); 259 sa->sin_addr.s_addr = htonl( addr.ip4Addr() );
260 ioctl( SIOCSIFADDR ); 260 ioctl( SIOCSIFADDR );
261} 261}
262 262
263 263
264QString ONetworkInterface::ipV4Address() const 264QString ONetworkInterface::ipV4Address() const
265{ 265{
266 if ( ioctl( SIOCGIFADDR ) ) 266 if ( ioctl( SIOCGIFADDR ) )
267 { 267 {
268 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; 268 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr;
269 //FIXME: Use QHostAddress here 269 //FIXME: Use QHostAddress here
270 return QString( inet_ntoa( sa->sin_addr ) ); 270 return QString( inet_ntoa( sa->sin_addr ) );
271 } 271 }
272 else 272 else
273 return "<unknown>"; 273 return "<unknown>";
274 274
275} 275}
276 276
277 277
278void ONetworkInterface::setMacAddress( const OMacAddress& addr ) 278void ONetworkInterface::setMacAddress( const OMacAddress& addr )
279{ 279{
280 _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; 280 _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
281 memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); 281 memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 );
282 ioctl( SIOCSIFHWADDR ); 282 ioctl( SIOCSIFHWADDR );
283} 283}
284 284
285 285
286OMacAddress ONetworkInterface::macAddress() const 286OMacAddress ONetworkInterface::macAddress() const
287{ 287{
288 if ( ioctl( SIOCGIFHWADDR ) ) 288 if ( ioctl( SIOCGIFHWADDR ) )
289 { 289 {
290 return OMacAddress( _ifr ); 290 return OMacAddress( _ifr );
291 } 291 }
292 else 292 else
293 { 293 {
294 return OMacAddress::unknown; 294 return OMacAddress::unknown;
295 } 295 }
296} 296}
297 297
298 298
299void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) 299void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr )
300{ 300{
301 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; 301 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr;
302 sa->sin_family = AF_INET; 302 sa->sin_family = AF_INET;
303 sa->sin_port = 0; 303 sa->sin_port = 0;
304 sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); 304 sa->sin_addr.s_addr = htonl( addr.ip4Addr() );
305 ioctl( SIOCSIFNETMASK ); 305 ioctl( SIOCSIFNETMASK );
306} 306}
307 307
308 308
309QString ONetworkInterface::ipV4Netmask() const 309QString ONetworkInterface::ipV4Netmask() const
310{ 310{
311 if ( ioctl( SIOCGIFNETMASK ) ) 311 if ( ioctl( SIOCGIFNETMASK ) )
312 { 312 {
313 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; 313 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr;
314 //FIXME: Use QHostAddress here 314 //FIXME: Use QHostAddress here
315 return QString( inet_ntoa( sa->sin_addr ) ); 315 return QString( inet_ntoa( sa->sin_addr ) );
316 } 316 }
317 else 317 else
318 return "<unknown>"; 318 return "<unknown>";
319} 319}
320 320
321 321
322int ONetworkInterface::dataLinkType() const 322int ONetworkInterface::dataLinkType() const
323{ 323{
324 if ( ioctl( SIOCGIFHWADDR ) ) 324 if ( ioctl( SIOCGIFHWADDR ) )
325 { 325 {
326 return _ifr.ifr_hwaddr.sa_family; 326 return _ifr.ifr_hwaddr.sa_family;
327 } 327 }
328 else 328 else
329 { 329 {
330 return -1; 330 return -1;
331 } 331 }
332} 332}
333 333
334 334
335void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) 335void ONetworkInterface::setMonitoring( OMonitoringInterface* m )
336{ 336{
337 _mon = m; 337 _mon = m;
338 odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl; 338 odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl;
339} 339}
340 340
341 341
342OMonitoringInterface* ONetworkInterface::monitoring() const 342OMonitoringInterface* ONetworkInterface::monitoring() const
343{ 343{
344 return _mon; 344 return _mon;
345} 345}
346 346
347 347
348ONetworkInterface::~ONetworkInterface() 348ONetworkInterface::~ONetworkInterface()
349{ 349{
350 odebug << "ONetworkInterface::~ONetworkInterface()" << oendl; 350 odebug << "ONetworkInterface::~ONetworkInterface()" << oendl;
351 if ( _sfd != -1 ) ::close( _sfd ); 351 if ( _sfd != -1 ) ::close( _sfd );
352} 352}
353 353
354 354
355bool ONetworkInterface::setPromiscuousMode( bool b ) 355bool ONetworkInterface::setPromiscuousMode( bool b )
356{ 356{
357 ioctl( SIOCGIFFLAGS ); 357 ioctl( SIOCGIFFLAGS );
358 if ( b ) _ifr.ifr_flags |= IFF_PROMISC; 358 if ( b ) _ifr.ifr_flags |= IFF_PROMISC;
359 else _ifr.ifr_flags &= (~IFF_PROMISC); 359 else _ifr.ifr_flags &= (~IFF_PROMISC);
360 return ioctl( SIOCSIFFLAGS ); 360 return ioctl( SIOCSIFFLAGS );
361} 361}
362 362