-rw-r--r-- | libopie2/opienet/802_11_user.h | 1 | ||||
-rw-r--r-- | libopie2/opienet/dhcp.h | 2 | ||||
-rw-r--r-- | libopie2/opienet/odebugmapper.cpp | 10 | ||||
-rw-r--r-- | libopie2/opienet/odebugmapper.h | 10 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 7 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 8 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 9 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 15 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 9 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 31 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 52 | ||||
-rw-r--r-- | libopie2/opienet/ostation.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/ostation.h | 9 |
14 files changed, 176 insertions, 3 deletions
diff --git a/libopie2/opienet/802_11_user.h b/libopie2/opienet/802_11_user.h index 7ae27c5..1a9a7a0 100644 --- a/libopie2/opienet/802_11_user.h +++ b/libopie2/opienet/802_11_user.h | |||
@@ -434,25 +434,26 @@ struct ctrl_ps_poll_t { | |||
434 | struct ctrl_end_t { | 434 | struct ctrl_end_t { |
435 | u_int16_tfc; | 435 | u_int16_tfc; |
436 | u_int16_tduration; | 436 | u_int16_tduration; |
437 | u_int8_tra[6]; | 437 | u_int8_tra[6]; |
438 | u_int8_tbssid[6]; | 438 | u_int8_tbssid[6]; |
439 | u_int8_tfcs[4]; | 439 | u_int8_tfcs[4]; |
440 | }; | 440 | }; |
441 | 441 | ||
442 | #define CTRL_END_LEN(2+2+6+6+4) | 442 | #define CTRL_END_LEN(2+2+6+6+4) |
443 | 443 | ||
444 | struct ctrl_end_ack_t { | 444 | struct ctrl_end_ack_t { |
445 | u_int16_tfc; | 445 | u_int16_tfc; |
446 | u_int16_tduration; | 446 | u_int16_tduration; |
447 | u_int8_tra[6]; | 447 | u_int8_tra[6]; |
448 | u_int8_tbssid[6]; | 448 | u_int8_tbssid[6]; |
449 | u_int8_tfcs[4]; | 449 | u_int8_tfcs[4]; |
450 | }; | 450 | }; |
451 | 451 | ||
452 | #define CTRL_END_ACK_LEN(2+2+6+6+4) | 452 | #define CTRL_END_ACK_LEN(2+2+6+6+4) |
453 | 453 | ||
454 | #define IV_IV(iv)((iv) & 0xFFFFFF) | 454 | #define IV_IV(iv)((iv) & 0xFFFFFF) |
455 | #define IV_PAD(iv)(((iv) >> 24) & 0x3F) | 455 | #define IV_PAD(iv)(((iv) >> 24) & 0x3F) |
456 | #define IV_KEYID(iv)(((iv) >> 30) & 0x03) | 456 | #define IV_KEYID(iv)(((iv) >> 30) & 0x03) |
457 | 457 | ||
458 | |||
458 | #endif | 459 | #endif |
diff --git a/libopie2/opienet/dhcp.h b/libopie2/opienet/dhcp.h index 368e375..6ba4c53 100644 --- a/libopie2/opienet/dhcp.h +++ b/libopie2/opienet/dhcp.h | |||
@@ -21,48 +21,49 @@ | |||
21 | * | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND | 22 | * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND |
23 | * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 23 | * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
24 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 24 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
26 | * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR | 26 | * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR |
27 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 27 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
30 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 30 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
31 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 31 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
33 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. |
35 | * | 35 | * |
36 | * This software has been written for the Internet Software Consortium | 36 | * This software has been written for the Internet Software Consortium |
37 | * by Ted Lemon in cooperation with Vixie Enterprises. To learn more | 37 | * by Ted Lemon in cooperation with Vixie Enterprises. To learn more |
38 | * about the Internet Software Consortium, see ``http://www.isc.org''. | 38 | * about the Internet Software Consortium, see ``http://www.isc.org''. |
39 | * To learn more about Vixie Enterprises, see ``http://www.vix.com''. | 39 | * To learn more about Vixie Enterprises, see ``http://www.vix.com''. |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #ifndef DHCP_H | 42 | #ifndef DHCP_H |
43 | #define DHCP_H | 43 | #define DHCP_H |
44 | 44 | ||
45 | |||
45 | #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ | 46 | #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ |
46 | 20 + /* IP header */ \ | 47 | 20 + /* IP header */ \ |
47 | 8) /* UDP header */ | 48 | 8) /* UDP header */ |
48 | #define DHCP_SNAME_LEN 64 | 49 | #define DHCP_SNAME_LEN 64 |
49 | #define DHCP_FILE_LEN 128 | 50 | #define DHCP_FILE_LEN 128 |
50 | #define DHCP_FIXED_NON_UDP236 | 51 | #define DHCP_FIXED_NON_UDP236 |
51 | #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) | 52 | #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) |
52 | /* Everything but options. */ | 53 | /* Everything but options. */ |
53 | #define DHCP_MTU_MAX 1500 | 54 | #define DHCP_MTU_MAX 1500 |
54 | #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) | 55 | #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) |
55 | 56 | ||
56 | #define BOOTP_MIN_LEN 300 | 57 | #define BOOTP_MIN_LEN 300 |
57 | #define DHCP_MIN_LEN 548 | 58 | #define DHCP_MIN_LEN 548 |
58 | 59 | ||
59 | struct dhcp_packet { | 60 | struct dhcp_packet { |
60 | u_int8_t op; /* 0: Message opcode/type */ | 61 | u_int8_t op; /* 0: Message opcode/type */ |
61 | u_int8_t htype;/* 1: Hardware addr type (net/if_types.h) */ | 62 | u_int8_t htype;/* 1: Hardware addr type (net/if_types.h) */ |
62 | u_int8_t hlen; /* 2: Hardware addr length */ | 63 | u_int8_t hlen; /* 2: Hardware addr length */ |
63 | u_int8_t hops; /* 3: Number of relay agent hops from client */ | 64 | u_int8_t hops; /* 3: Number of relay agent hops from client */ |
64 | u_int32_t xid; /* 4: Transaction ID */ | 65 | u_int32_t xid; /* 4: Transaction ID */ |
65 | u_int16_t secs; /* 8: Seconds since client started looking */ | 66 | u_int16_t secs; /* 8: Seconds since client started looking */ |
66 | u_int16_t flags;/* 10: Flag bits */ | 67 | u_int16_t flags;/* 10: Flag bits */ |
67 | struct in_addr ciaddr;/* 12: Client IP address (if already in use) */ | 68 | struct in_addr ciaddr;/* 12: Client IP address (if already in use) */ |
68 | struct in_addr yiaddr;/* 16: Client IP address */ | 69 | struct in_addr yiaddr;/* 16: Client IP address */ |
@@ -176,26 +177,27 @@ struct dhcp_packet { | |||
176 | #define DHCPOFFER2 | 177 | #define DHCPOFFER2 |
177 | #define DHCPREQUEST3 | 178 | #define DHCPREQUEST3 |
178 | #define DHCPDECLINE4 | 179 | #define DHCPDECLINE4 |
179 | #define DHCPACK 5 | 180 | #define DHCPACK 5 |
180 | #define DHCPNAK 6 | 181 | #define DHCPNAK 6 |
181 | #define DHCPRELEASE7 | 182 | #define DHCPRELEASE7 |
182 | #define DHCPINFORM8 | 183 | #define DHCPINFORM8 |
183 | 184 | ||
184 | /* Relay Agent Information option subtypes: */ | 185 | /* Relay Agent Information option subtypes: */ |
185 | #define RAI_CIRCUIT_ID1 | 186 | #define RAI_CIRCUIT_ID1 |
186 | #define RAI_REMOTE_ID2 | 187 | #define RAI_REMOTE_ID2 |
187 | #define RAI_AGENT_ID3 | 188 | #define RAI_AGENT_ID3 |
188 | 189 | ||
189 | /* FQDN suboptions: */ | 190 | /* FQDN suboptions: */ |
190 | #define FQDN_NO_CLIENT_UPDATE 1 | 191 | #define FQDN_NO_CLIENT_UPDATE 1 |
191 | #define FQDN_SERVER_UPDATE 2 | 192 | #define FQDN_SERVER_UPDATE 2 |
192 | #define FQDN_ENCODED 3 | 193 | #define FQDN_ENCODED 3 |
193 | #define FQDN_RCODE1 4 | 194 | #define FQDN_RCODE1 4 |
194 | #define FQDN_RCODE2 5 | 195 | #define FQDN_RCODE2 5 |
195 | #define FQDN_HOSTNAME 6 | 196 | #define FQDN_HOSTNAME 6 |
196 | #define FQDN_DOMAINNAME 7 | 197 | #define FQDN_DOMAINNAME 7 |
197 | #define FQDN_FQDN 8 | 198 | #define FQDN_FQDN 8 |
198 | #define FQDN_SUBOPTION_COUNT 8 | 199 | #define FQDN_SUBOPTION_COUNT 8 |
199 | 200 | ||
201 | |||
200 | #endif | 202 | #endif |
201 | 203 | ||
diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp index 7e4ab2b..f679afb 100644 --- a/libopie2/opienet/odebugmapper.cpp +++ b/libopie2/opienet/odebugmapper.cpp | |||
@@ -1,33 +1,39 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include "odebugmapper.h" | 8 | #include "odebugmapper.h" |
9 | 9 | ||
10 | using namespace Opie::Core; | ||
11 | |||
12 | namespace Opie { | ||
13 | namespace Net { | ||
14 | namespace Private { | ||
15 | |||
10 | DebugMapper::DebugMapper() | 16 | DebugMapper::DebugMapper() |
11 | { | 17 | { |
12 | odebug << "DebugMapper::DebugMapper()" << oendl; | 18 | odebug << "DebugMapper::DebugMapper()" << oendl; |
13 | 19 | ||
14 | 20 | ||
15 | _map.insert( 0x8902, new QString("SIOCSPGRP") ); | 21 | _map.insert( 0x8902, new QString("SIOCSPGRP") ); |
16 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); | 22 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); |
17 | _map.insert( 0x8905, new QString("SIOCATMARK") ); | 23 | _map.insert( 0x8905, new QString("SIOCATMARK") ); |
18 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); | 24 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); |
19 | _map.insert( 0x890B, new QString("SIOCADDRT") ); | 25 | _map.insert( 0x890B, new QString("SIOCADDRT") ); |
20 | _map.insert( 0x890C, new QString("SIOCDELRT") ); | 26 | _map.insert( 0x890C, new QString("SIOCDELRT") ); |
21 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); | 27 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); |
22 | _map.insert( 0x8910, new QString("SIOCGIFNAME") ); | 28 | _map.insert( 0x8910, new QString("SIOCGIFNAME") ); |
23 | _map.insert( 0x8911, new QString("SIOCSIFLINK") ); | 29 | _map.insert( 0x8911, new QString("SIOCSIFLINK") ); |
24 | _map.insert( 0x8912, new QString("SIOCGIFCONF") ); | 30 | _map.insert( 0x8912, new QString("SIOCGIFCONF") ); |
25 | _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); | 31 | _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); |
26 | _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); | 32 | _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); |
27 | _map.insert( 0x8915, new QString("SIOCGIFADDR") ); | 33 | _map.insert( 0x8915, new QString("SIOCGIFADDR") ); |
28 | _map.insert( 0x8916, new QString("SIOCSIFADDR") ); | 34 | _map.insert( 0x8916, new QString("SIOCSIFADDR") ); |
29 | _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); | 35 | _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); |
30 | _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); | 36 | _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); |
31 | _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); | 37 | _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); |
32 | _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); | 38 | _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); |
33 | _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); | 39 | _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); |
@@ -191,25 +197,27 @@ DebugMapper::DebugMapper() | |||
191 | }; | 197 | }; |
192 | 198 | ||
193 | 199 | ||
194 | DebugMapper::~DebugMapper() | 200 | DebugMapper::~DebugMapper() |
195 | { | 201 | { |
196 | odebug << "DebugMapper::~DebugMapper()" << oendl; | 202 | odebug << "DebugMapper::~DebugMapper()" << oendl; |
197 | } | 203 | } |
198 | 204 | ||
199 | 205 | ||
200 | const QString& DebugMapper::map( int value ) const | 206 | const QString& DebugMapper::map( int value ) const |
201 | { | 207 | { |
202 | QString* result = _map[ value ]; | 208 | QString* result = _map[ value ]; |
203 | 209 | ||
204 | if ( !result ) | 210 | if ( !result ) |
205 | { | 211 | { |
206 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; | 212 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; |
207 | return QString::null; | 213 | return QString::null; |
208 | } | 214 | } |
209 | else | 215 | else |
210 | { | 216 | { |
211 | return *result; | 217 | return *result; |
212 | } | 218 | } |
213 | } | 219 | } |
214 | 220 | ||
215 | 221 | } | |
222 | } | ||
223 | } | ||
diff --git a/libopie2/opienet/odebugmapper.h b/libopie2/opienet/odebugmapper.h index 66b331d..f47db47 100644 --- a/libopie2/opienet/odebugmapper.h +++ b/libopie2/opienet/odebugmapper.h | |||
@@ -1,26 +1,36 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef DEBUGMAPPER_H | 6 | #ifndef DEBUGMAPPER_H |
7 | #define DEBUGMAPPER_H | 7 | #define DEBUGMAPPER_H |
8 | 8 | ||
9 | #include <qstring.h> | 9 | #include <qstring.h> |
10 | #include <qintdict.h> | 10 | #include <qintdict.h> |
11 | 11 | ||
12 | namespace Opie { | ||
13 | namespace Net { | ||
14 | namespace Private { | ||
15 | |||
12 | typedef QIntDict<QString> IntStringMap; | 16 | typedef QIntDict<QString> IntStringMap; |
13 | 17 | ||
14 | class DebugMapper | 18 | class DebugMapper |
15 | { | 19 | { |
16 | public: | 20 | public: |
17 | DebugMapper(); | 21 | DebugMapper(); |
18 | ~DebugMapper(); | 22 | ~DebugMapper(); |
19 | 23 | ||
20 | const QString& map( int value ) const; | 24 | const QString& map( int value ) const; |
21 | private: | 25 | private: |
22 | IntStringMap _map; | 26 | IntStringMap _map; |
27 | class Private; | ||
28 | Private *d; | ||
23 | }; | 29 | }; |
24 | 30 | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | |||
25 | #endif | 35 | #endif |
26 | 36 | ||
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index b93b752..209ec94 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -22,48 +22,52 @@ | |||
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 | #include "omanufacturerdb.h" | 31 | #include "omanufacturerdb.h" |
32 | 32 | ||
33 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 33 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
34 | 34 | ||
35 | /* OPIE */ | 35 | /* OPIE */ |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 37 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include <qfile.h> | 43 | #include <qfile.h> |
44 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
45 | 45 | ||
46 | using namespace Opie::Core; | ||
47 | namespace Opie { | ||
48 | namespace Net { | ||
49 | |||
46 | OManufacturerDB* OManufacturerDB::_instance = 0; | 50 | OManufacturerDB* OManufacturerDB::_instance = 0; |
47 | 51 | ||
48 | OManufacturerDB* OManufacturerDB::instance() | 52 | OManufacturerDB* OManufacturerDB::instance() |
49 | { | 53 | { |
50 | if ( !OManufacturerDB::_instance ) | 54 | if ( !OManufacturerDB::_instance ) |
51 | { | 55 | { |
52 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 56 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
53 | _instance = new OManufacturerDB(); | 57 | _instance = new OManufacturerDB(); |
54 | } | 58 | } |
55 | return _instance; | 59 | return _instance; |
56 | } | 60 | } |
57 | 61 | ||
58 | 62 | ||
59 | OManufacturerDB::OManufacturerDB() | 63 | OManufacturerDB::OManufacturerDB() |
60 | { | 64 | { |
61 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 65 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
62 | Global::statusMessage( "Reading Manufacturers..." ); | 66 | Global::statusMessage( "Reading Manufacturers..." ); |
63 | #endif | 67 | #endif |
64 | QString filename( "/etc/manufacturers" ); | 68 | QString filename( "/etc/manufacturers" ); |
65 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 69 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
66 | if ( !QFile::exists( filename ) ) | 70 | if ( !QFile::exists( filename ) ) |
67 | { | 71 | { |
68 | filename = "/opt/QtPalmtop/etc/manufacturers"; | 72 | filename = "/opt/QtPalmtop/etc/manufacturers"; |
69 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 73 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
@@ -112,24 +116,27 @@ OManufacturerDB::OManufacturerDB() | |||
112 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 116 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
113 | Global::statusMessage( "Manufacturers Complete..." ); | 117 | Global::statusMessage( "Manufacturers Complete..." ); |
114 | #endif | 118 | #endif |
115 | } | 119 | } |
116 | } | 120 | } |
117 | 121 | ||
118 | 122 | ||
119 | OManufacturerDB::~OManufacturerDB() | 123 | OManufacturerDB::~OManufacturerDB() |
120 | { | 124 | { |
121 | } | 125 | } |
122 | 126 | ||
123 | 127 | ||
124 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 128 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
125 | { | 129 | { |
126 | return manufacturers[macaddr.upper().left(8)]; | 130 | return manufacturers[macaddr.upper().left(8)]; |
127 | } | 131 | } |
128 | 132 | ||
129 | 133 | ||
130 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 134 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const |
131 | { | 135 | { |
132 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); | 136 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); |
133 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; | 137 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; |
134 | } | 138 | } |
135 | 139 | ||
140 | } | ||
141 | } | ||
142 | |||
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h index c2712e5..5c1940e 100644 --- a/libopie2/opienet/omanufacturerdb.h +++ b/libopie2/opienet/omanufacturerdb.h | |||
@@ -12,58 +12,66 @@ | |||
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 | #ifndef OMANUFACTURERDB_H | 31 | #ifndef OMANUFACTURERDB_H |
32 | #define OMANUFACTURERDB_H | 32 | #define OMANUFACTURERDB_H |
33 | 33 | ||
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | 35 | ||
36 | namespace Opie { | ||
37 | namespace Net { | ||
38 | |||
36 | /** | 39 | /** |
37 | * @brief A Ethernet card vendor database. | 40 | * @brief A Ethernet card vendor database. |
38 | * | 41 | * |
39 | * This class encapsulates the lookup of Ethernet vendor given a | 42 | * This class encapsulates the lookup of Ethernet vendor given a |
40 | * certain Mac Address. Only the first three bytes define the vendor. | 43 | * certain Mac Address. Only the first three bytes define the vendor. |
41 | */ | 44 | */ |
42 | class OManufacturerDB | 45 | class OManufacturerDB |
43 | { | 46 | { |
44 | public: | 47 | public: |
45 | /** | 48 | /** |
46 | * @returns the one-and-only @ref OManufacturerDB instance. | 49 | * @returns the one-and-only @ref OManufacturerDB instance. |
47 | */ | 50 | */ |
48 | static OManufacturerDB* instance(); | 51 | static OManufacturerDB* instance(); |
49 | /** | 52 | /** |
50 | * @returns the short manufacturer string given a @a macaddr. | 53 | * @returns the short manufacturer string given a @a macaddr. |
51 | */ | 54 | */ |
52 | const QString& lookup( const QString& macaddr ) const; | 55 | const QString& lookup( const QString& macaddr ) const; |
53 | /** | 56 | /** |
54 | * @returns the enhanced manufacturer string given a @a macaddr. | 57 | * @returns the enhanced manufacturer string given a @a macaddr. |
55 | */ | 58 | */ |
56 | const QString& lookupExt( const QString& macaddr ) const; | 59 | const QString& lookupExt( const QString& macaddr ) const; |
57 | 60 | ||
58 | protected: | 61 | protected: |
59 | OManufacturerDB(); | 62 | OManufacturerDB(); |
60 | virtual ~OManufacturerDB(); | 63 | virtual ~OManufacturerDB(); |
61 | 64 | ||
62 | private: | 65 | private: |
63 | QMap<QString, QString> manufacturers; | 66 | QMap<QString, QString> manufacturers; |
64 | QMap<QString, QString> manufacturersExt; | 67 | QMap<QString, QString> manufacturersExt; |
65 | static OManufacturerDB* _instance; | 68 | static OManufacturerDB* _instance; |
69 | class Private; | ||
70 | Private *d; | ||
66 | }; | 71 | }; |
67 | 72 | ||
73 | } | ||
74 | } | ||
75 | |||
68 | #endif | 76 | #endif |
69 | 77 | ||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 48cfa43..7794334 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -16,48 +16,51 @@ | |||
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 | ||
40 | namespace Opie { | ||
41 | namespace Net { | ||
42 | |||
40 | /*====================================================================================== | 43 | /*====================================================================================== |
41 | * OMacAddress | 44 | * OMacAddress |
42 | *======================================================================================*/ | 45 | *======================================================================================*/ |
43 | 46 | ||
44 | // static initializer for broadcast and unknown MAC Adresses | 47 | // static initializer for broadcast and unknown MAC Adresses |
45 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 48 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
46 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); | 49 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); |
47 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; | 50 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; |
48 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); | 51 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); |
49 | 52 | ||
50 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) | 53 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) |
51 | 54 | ||
52 | OMacAddress::OMacAddress() | 55 | OMacAddress::OMacAddress() |
53 | { | 56 | { |
54 | memcpy( _bytes, __unknown, 6 ); | 57 | memcpy( _bytes, __unknown, 6 ); |
55 | } | 58 | } |
56 | 59 | ||
57 | 60 | ||
58 | OMacAddress::OMacAddress( unsigned char* p ) | 61 | OMacAddress::OMacAddress( unsigned char* p ) |
59 | { | 62 | { |
60 | memcpy( _bytes, p, 6 ); | 63 | memcpy( _bytes, p, 6 ); |
61 | } | 64 | } |
62 | 65 | ||
63 | 66 | ||
@@ -164,69 +167,75 @@ int OPrivateIOCTL::typeGetArgs() const | |||
164 | int OPrivateIOCTL::numberSetArgs() const | 167 | int OPrivateIOCTL::numberSetArgs() const |
165 | { | 168 | { |
166 | return _setargs & IW_PRIV_SIZE_MASK; | 169 | return _setargs & IW_PRIV_SIZE_MASK; |
167 | } | 170 | } |
168 | 171 | ||
169 | 172 | ||
170 | int OPrivateIOCTL::typeSetArgs() const | 173 | int OPrivateIOCTL::typeSetArgs() const |
171 | { | 174 | { |
172 | return _setargs & IW_PRIV_TYPE_MASK >> 12; | 175 | return _setargs & IW_PRIV_TYPE_MASK >> 12; |
173 | } | 176 | } |
174 | 177 | ||
175 | 178 | ||
176 | void OPrivateIOCTL::invoke() const | 179 | void OPrivateIOCTL::invoke() const |
177 | { | 180 | { |
178 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | 181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); |
179 | } | 182 | } |
180 | 183 | ||
181 | 184 | ||
182 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) | 185 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) |
183 | { | 186 | { |
184 | 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; |
185 | arglist[num] = value; | 188 | arglist[num] = value; |
186 | } | 189 | } |
187 | 190 | ||
191 | |||
192 | |||
193 | namespace Private { | ||
188 | /*====================================================================================== | 194 | /*====================================================================================== |
189 | * assorted functions | 195 | * assorted functions |
190 | *======================================================================================*/ | 196 | *======================================================================================*/ |
191 | 197 | ||
192 | void dumpBytes( const unsigned char* data, int num ) | 198 | void dumpBytes( const unsigned char* data, int num ) |
193 | { | 199 | { |
194 | printf( "Dumping %d bytes @ %0x", num, data ); | 200 | printf( "Dumping %d bytes @ %0x", num, data ); |
195 | printf( "-------------------------------------------\n" ); | 201 | printf( "-------------------------------------------\n" ); |
196 | 202 | ||
197 | for ( int i = 0; i < num; ++i ) | 203 | for ( int i = 0; i < num; ++i ) |
198 | { | 204 | { |
199 | printf( "%02x ", data[i] ); | 205 | printf( "%02x ", data[i] ); |
200 | if ( !((i+1) % 32) ) printf( "\n" ); | 206 | if ( !((i+1) % 32) ) printf( "\n" ); |
201 | } | 207 | } |
202 | printf( "\n\n" ); | 208 | printf( "\n\n" ); |
203 | } | 209 | } |
204 | 210 | ||
205 | 211 | ||
206 | int stringToMode( const QString& mode ) | 212 | int stringToMode( const QString& mode ) |
207 | { | 213 | { |
208 | if ( mode == "auto" ) return IW_MODE_AUTO; | 214 | if ( mode == "auto" ) return IW_MODE_AUTO; |
209 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; | 215 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; |
210 | else if ( mode == "managed" ) return IW_MODE_INFRA; | 216 | else if ( mode == "managed" ) return IW_MODE_INFRA; |
211 | else if ( mode == "master" ) return IW_MODE_MASTER; | 217 | else if ( mode == "master" ) return IW_MODE_MASTER; |
212 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; | 218 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; |
213 | else if ( mode == "secondary" ) return IW_MODE_SECOND; | 219 | else if ( mode == "secondary" ) return IW_MODE_SECOND; |
214 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; | 220 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; |
215 | else assert( 0 ); | 221 | else assert( 0 ); |
216 | } | 222 | } |
217 | 223 | ||
218 | 224 | ||
219 | QString modeToString( int mode ) | 225 | QString modeToString( int mode ) |
220 | { | 226 | { |
221 | switch ( mode ) | 227 | switch ( mode ) |
222 | { | 228 | { |
223 | case IW_MODE_AUTO: return "auto"; | 229 | case IW_MODE_AUTO: return "auto"; |
224 | case IW_MODE_ADHOC: return "adhoc"; | 230 | case IW_MODE_ADHOC: return "adhoc"; |
225 | case IW_MODE_INFRA: return "managed"; | 231 | case IW_MODE_INFRA: return "managed"; |
226 | case IW_MODE_MASTER: return "master"; | 232 | case IW_MODE_MASTER: return "master"; |
227 | case IW_MODE_REPEAT: return "repeater"; | 233 | case IW_MODE_REPEAT: return "repeater"; |
228 | case IW_MODE_SECOND: return "second"; | 234 | case IW_MODE_SECOND: return "second"; |
229 | case IW_MODE_MONITOR: return "monitor"; | 235 | case IW_MODE_MONITOR: return "monitor"; |
230 | default: assert( 0 ); | 236 | default: assert( 0 ); |
231 | } | 237 | } |
232 | } | 238 | } |
239 | } | ||
240 | } | ||
241 | } | ||
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index bddfab9..ca6815d 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -20,131 +20,146 @@ | |||
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 | ||
43 | struct ifreq; | 43 | struct ifreq; |
44 | |||
45 | namespace Opie { | ||
46 | namespace Net { | ||
47 | |||
44 | class OWirelessNetworkInterface; | 48 | class OWirelessNetworkInterface; |
45 | 49 | ||
46 | /*====================================================================================== | 50 | /*====================================================================================== |
47 | * OMacAddress | 51 | * OMacAddress |
48 | *======================================================================================*/ | 52 | *======================================================================================*/ |
49 | 53 | ||
50 | class OMacAddress | 54 | class OMacAddress |
51 | { | 55 | { |
52 | public: | 56 | public: |
53 | // QString c'tor? -zecke | 57 | // QString c'tor? -zecke |
54 | OMacAddress(); | 58 | OMacAddress(); |
55 | OMacAddress( unsigned char* ); | 59 | OMacAddress( unsigned char* ); |
56 | OMacAddress( const unsigned char* ); | 60 | OMacAddress( const unsigned char* ); |
57 | OMacAddress( struct ifreq& ); | 61 | OMacAddress( struct ifreq& ); |
58 | ~OMacAddress(); | 62 | ~OMacAddress(); |
59 | 63 | ||
60 | QString manufacturer() const; | 64 | QString manufacturer() const; |
61 | QString toString( bool substitute = false ) const; | 65 | QString toString( bool substitute = false ) const; |
62 | const unsigned char* native() const; | 66 | const unsigned char* native() const; |
63 | 67 | ||
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? | 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? |
65 | static OMacAddress fromString( const QString& ); | 69 | static OMacAddress fromString( const QString& ); |
66 | 70 | ||
67 | public: | 71 | public: |
68 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
69 | static const OMacAddress& unknown; // 44:44:44:44:44:44 | 73 | static const OMacAddress& unknown; // 44:44:44:44:44:44 |
70 | 74 | ||
71 | private: | 75 | private: |
72 | unsigned char _bytes[6]; | 76 | unsigned char _bytes[6]; |
73 | 77 | ||
74 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 78 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | class Private; | ||
80 | Private *d; | ||
75 | 81 | ||
76 | }; | 82 | }; |
77 | 83 | ||
78 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | 85 | ||
80 | 86 | ||
81 | /*====================================================================================== | 87 | /*====================================================================================== |
82 | * OHostAddress | 88 | * OHostAddress |
83 | *======================================================================================*/ | 89 | *======================================================================================*/ |
84 | 90 | ||
85 | class OHostAddress : public QHostAddress | 91 | class OHostAddress : public QHostAddress |
86 | { | 92 | { |
87 | /*public: | 93 | /*public: |
88 | OHostAddress(); | 94 | OHostAddress(); |
89 | ~OHostAddress(); | 95 | ~OHostAddress(); |
90 | */ | 96 | */ |
97 | private: | ||
98 | class Private; | ||
99 | Private *d; | ||
91 | }; | 100 | }; |
92 | 101 | ||
93 | 102 | ||
94 | /*====================================================================================== | 103 | /*====================================================================================== |
95 | * OPrivateIOCTL | 104 | * OPrivateIOCTL |
96 | *======================================================================================*/ | 105 | *======================================================================================*/ |
97 | 106 | ||
98 | class OPrivateIOCTL : public QObject | 107 | class OPrivateIOCTL : public QObject |
99 | { | 108 | { |
100 | public: | 109 | public: |
101 | 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 ); |
102 | ~OPrivateIOCTL(); | 111 | ~OPrivateIOCTL(); |
103 | 112 | ||
104 | int numberGetArgs() const; | 113 | int numberGetArgs() const; |
105 | int typeGetArgs() const; | 114 | int typeGetArgs() const; |
106 | int numberSetArgs() const; | 115 | int numberSetArgs() const; |
107 | int typeSetArgs() const; | 116 | int typeSetArgs() const; |
108 | 117 | ||
109 | // FIXME return int? as ::ioctl does? -zecke | 118 | // FIXME return int? as ::ioctl does? -zecke |
110 | void invoke() const; | 119 | void invoke() const; |
111 | void setParameter( int, u_int32_t ); | 120 | void setParameter( int, u_int32_t ); |
112 | 121 | ||
113 | private: | 122 | private: |
114 | u_int32_t _ioctl; | 123 | u_int32_t _ioctl; |
115 | u_int16_t _getargs; | 124 | u_int16_t _getargs; |
116 | u_int16_t _setargs; | 125 | u_int16_t _setargs; |
117 | 126 | ||
127 | class Private; | ||
128 | Private *d; | ||
118 | }; | 129 | }; |
119 | 130 | ||
120 | /*====================================================================================== | 131 | /*====================================================================================== |
121 | * Miscellaneous | 132 | * Miscellaneous |
122 | *======================================================================================*/ | 133 | *======================================================================================*/ |
123 | 134 | ||
135 | namespace Private { | ||
124 | void dumpBytes( const unsigned char* data, int num ); | 136 | void dumpBytes( const unsigned char* data, int num ); |
125 | QString modeToString( int ); | 137 | QString modeToString( int ); |
126 | int stringToMode( const QString& ); | 138 | int stringToMode( const QString& ); |
139 | } | ||
140 | } | ||
141 | } | ||
127 | 142 | ||
128 | #define IW_PRIV_TYPE_MASK 0x7000 | 143 | #define IW_PRIV_TYPE_MASK 0x7000 |
129 | #define IW_PRIV_TYPE_NONE 0x0000 | 144 | #define IW_PRIV_TYPE_NONE 0x0000 |
130 | #define IW_PRIV_TYPE_BYTE 0x1000 | 145 | #define IW_PRIV_TYPE_BYTE 0x1000 |
131 | #define IW_PRIV_TYPE_CHAR 0x2000 | 146 | #define IW_PRIV_TYPE_CHAR 0x2000 |
132 | #define IW_PRIV_TYPE_INT 0x4000 | 147 | #define IW_PRIV_TYPE_INT 0x4000 |
133 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 148 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
134 | #define IW_PRIV_TYPE_ADDR 0x6000 | 149 | #define IW_PRIV_TYPE_ADDR 0x6000 |
135 | #define IW_PRIV_SIZE_FIXED 0x0800 | 150 | #define IW_PRIV_SIZE_FIXED 0x0800 |
136 | #define IW_PRIV_SIZE_MASK 0x07FF | 151 | #define IW_PRIV_SIZE_MASK 0x07FF |
137 | 152 | ||
138 | #ifndef ARPHRD_IEEE80211 | 153 | #ifndef ARPHRD_IEEE80211 |
139 | #define ARPHRD_IEEE80211 801 | 154 | #define ARPHRD_IEEE80211 801 |
140 | #endif | 155 | #endif |
141 | #ifndef ARPHRD_IEEE80211_PRISM | 156 | #ifndef ARPHRD_IEEE80211_PRISM |
142 | #define ARPHRD_IEEE80211_PRISM 802 | 157 | #define ARPHRD_IEEE80211_PRISM 802 |
143 | #endif | 158 | #endif |
144 | 159 | ||
145 | 160 | ||
146 | /* Network to host order macros */ | 161 | /* Network to host order macros */ |
147 | 162 | ||
148 | #ifdef LBL_ALIGN | 163 | #ifdef LBL_ALIGN |
149 | #define EXTRACT_16BITS(p) \ | 164 | #define EXTRACT_16BITS(p) \ |
150 | ((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 | \ |
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index e5b091f..ab3e77f 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -36,55 +36,61 @@ | |||
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 | |||
61 | |||
62 | using namespace Opie::Core; | ||
63 | using namespace Opie::Net::Private; | ||
60 | DebugMapper* debugmapper = new DebugMapper(); | 64 | DebugMapper* debugmapper = new DebugMapper(); |
61 | #endif | 65 | #endif |
62 | 66 | ||
63 | /*====================================================================================== | 67 | /*====================================================================================== |
64 | * ONetwork | 68 | * ONetwork |
65 | *======================================================================================*/ | 69 | *======================================================================================*/ |
66 | 70 | ||
71 | namespace Opie { | ||
72 | namespace Net { | ||
67 | ONetwork* ONetwork::_instance = 0; | 73 | ONetwork* ONetwork::_instance = 0; |
68 | 74 | ||
69 | ONetwork::ONetwork() | 75 | ONetwork::ONetwork() |
70 | { | 76 | { |
71 | odebug << "ONetwork::ONetwork()" << oendl; | 77 | odebug << "ONetwork::ONetwork()" << oendl; |
72 | 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; |
73 | synchronize(); | 79 | synchronize(); |
74 | } | 80 | } |
75 | 81 | ||
76 | void ONetwork::synchronize() | 82 | void ONetwork::synchronize() |
77 | { | 83 | { |
78 | // gather available interfaces by inspecting /proc/net/dev | 84 | // gather available interfaces by inspecting /proc/net/dev |
79 | //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 |
80 | //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 |
81 | //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 |
82 | 88 | ||
83 | _interfaces.clear(); | 89 | _interfaces.clear(); |
84 | QString str; | 90 | QString str; |
85 | QFile f( "/proc/net/dev" ); | 91 | QFile f( "/proc/net/dev" ); |
86 | bool hasFile = f.open( IO_ReadOnly ); | 92 | bool hasFile = f.open( IO_ReadOnly ); |
87 | if ( !hasFile ) | 93 | if ( !hasFile ) |
88 | { | 94 | { |
89 | 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; |
90 | return; | 96 | return; |
@@ -1216,24 +1222,27 @@ void OOrinocoMonitoringInterface::setChannel( int c ) | |||
1216 | { | 1222 | { |
1217 | int monitorCode = _prismHeader ? 1 : 2; | 1223 | int monitorCode = _prismHeader ? 1 : 2; |
1218 | _if->setPrivate( "monitor", 2, monitorCode, c ); | 1224 | _if->setPrivate( "monitor", 2, monitorCode, c ); |
1219 | } | 1225 | } |
1220 | } | 1226 | } |
1221 | 1227 | ||
1222 | 1228 | ||
1223 | void OOrinocoMonitoringInterface::setEnabled( bool b ) | 1229 | void OOrinocoMonitoringInterface::setEnabled( bool b ) |
1224 | { | 1230 | { |
1225 | if ( b ) | 1231 | if ( b ) |
1226 | { | 1232 | { |
1227 | setChannel( 1 ); | 1233 | setChannel( 1 ); |
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | _if->setPrivate( "monitor", 2, 0, 0 ); | 1237 | _if->setPrivate( "monitor", 2, 0, 0 ); |
1232 | } | 1238 | } |
1233 | } | 1239 | } |
1234 | 1240 | ||
1235 | 1241 | ||
1236 | QString OOrinocoMonitoringInterface::name() const | 1242 | QString OOrinocoMonitoringInterface::name() const |
1237 | { | 1243 | { |
1238 | return "orinoco"; | 1244 | return "orinoco"; |
1239 | } | 1245 | } |
1246 | |||
1247 | } | ||
1248 | } | ||
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 93b129f..a953296 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -35,48 +35,51 @@ | |||
35 | #error Need to define a wireless extension version to build against! | 35 | #error Need to define a wireless extension version to build against! |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #if OPIE_WE_VERSION == 15 | 38 | #if OPIE_WE_VERSION == 15 |
39 | #include "wireless.15.h" | 39 | #include "wireless.15.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #if OPIE_WE_VERSION == 16 | 42 | #if OPIE_WE_VERSION == 16 |
43 | #include "wireless.16.h" | 43 | #include "wireless.16.h" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | /* OPIE */ | 46 | /* OPIE */ |
47 | 47 | ||
48 | #include <opie2/onetutils.h> | 48 | #include <opie2/onetutils.h> |
49 | #include <opie2/ostation.h> | 49 | #include <opie2/ostation.h> |
50 | 50 | ||
51 | /* QT */ | 51 | /* QT */ |
52 | 52 | ||
53 | #include <qvaluelist.h> | 53 | #include <qvaluelist.h> |
54 | #include <qdict.h> | 54 | #include <qdict.h> |
55 | #include <qmap.h> | 55 | #include <qmap.h> |
56 | #include <qobject.h> | 56 | #include <qobject.h> |
57 | #include <qhostaddress.h> | 57 | #include <qhostaddress.h> |
58 | 58 | ||
59 | namespace Opie { | ||
60 | namespace Net { | ||
61 | |||
59 | class ONetworkInterface; | 62 | class ONetworkInterface; |
60 | class OWirelessNetworkInterface; | 63 | class OWirelessNetworkInterface; |
61 | class OChannelHopper; | 64 | class OChannelHopper; |
62 | class OMonitoringInterface; | 65 | class OMonitoringInterface; |
63 | 66 | ||
64 | /*====================================================================================== | 67 | /*====================================================================================== |
65 | * ONetwork | 68 | * ONetwork |
66 | *======================================================================================*/ | 69 | *======================================================================================*/ |
67 | 70 | ||
68 | /** | 71 | /** |
69 | * @brief A container class for all network interfaces | 72 | * @brief A container class for all network interfaces |
70 | * | 73 | * |
71 | * This class provides access to all available network interfaces of your computer. | 74 | * This class provides access to all available network interfaces of your computer. |
72 | * | 75 | * |
73 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 76 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
74 | */ | 77 | */ |
75 | class ONetwork : public QObject | 78 | class ONetwork : public QObject |
76 | { | 79 | { |
77 | Q_OBJECT | 80 | Q_OBJECT |
78 | 81 | ||
79 | public: | 82 | public: |
80 | typedef QDict<ONetworkInterface> InterfaceMap; | 83 | typedef QDict<ONetworkInterface> InterfaceMap; |
81 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 84 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
82 | 85 | ||
@@ -102,48 +105,50 @@ class ONetwork : public QObject | |||
102 | */ | 105 | */ |
103 | bool isWirelessInterface( const char* interface ) const; | 106 | bool isWirelessInterface( const char* interface ) const; |
104 | /** | 107 | /** |
105 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. | 108 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. |
106 | * @see ONetworkInterface | 109 | * @see ONetworkInterface |
107 | */ | 110 | */ |
108 | ONetworkInterface* interface( const QString& interface ) const; | 111 | ONetworkInterface* interface( const QString& interface ) const; |
109 | /** | 112 | /** |
110 | * @internal Rebuild the internal interface database | 113 | * @internal Rebuild the internal interface database |
111 | * @note Sometimes it might be useful to call this from client code, | 114 | * @note Sometimes it might be useful to call this from client code, |
112 | * e.g. after issuing a cardctl insert | 115 | * e.g. after issuing a cardctl insert |
113 | */ | 116 | */ |
114 | void synchronize(); | 117 | void synchronize(); |
115 | /** | 118 | /** |
116 | * @returns the wireless extension version used at compile time. | 119 | * @returns the wireless extension version used at compile time. |
117 | **/ | 120 | **/ |
118 | static short wirelessExtensionVersion(); | 121 | static short wirelessExtensionVersion(); |
119 | 122 | ||
120 | protected: | 123 | protected: |
121 | ONetwork(); | 124 | ONetwork(); |
122 | 125 | ||
123 | private: | 126 | private: |
124 | static ONetwork* _instance; | 127 | static ONetwork* _instance; |
125 | InterfaceMap _interfaces; | 128 | InterfaceMap _interfaces; |
129 | class Private; | ||
130 | Private *d; | ||
126 | }; | 131 | }; |
127 | 132 | ||
128 | 133 | ||
129 | /*====================================================================================== | 134 | /*====================================================================================== |
130 | * ONetworkInterface | 135 | * ONetworkInterface |
131 | *======================================================================================*/ | 136 | *======================================================================================*/ |
132 | 137 | ||
133 | /** | 138 | /** |
134 | * @brief A network interface wrapper. | 139 | * @brief A network interface wrapper. |
135 | * | 140 | * |
136 | * This class provides a wrapper for a network interface. All the cumbersume details of | 141 | * This class provides a wrapper for a network interface. All the cumbersume details of |
137 | * Linux ioctls are hidden under a convenient high-level interface. | 142 | * Linux ioctls are hidden under a convenient high-level interface. |
138 | * @warning Most of the setting methods contained in this class require the appropriate | 143 | * @warning Most of the setting methods contained in this class require the appropriate |
139 | * process permissions to work. | 144 | * process permissions to work. |
140 | * | 145 | * |
141 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 146 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
142 | */ | 147 | */ |
143 | class ONetworkInterface : public QObject | 148 | class ONetworkInterface : public QObject |
144 | { | 149 | { |
145 | friend class OMonitoringInterface; | 150 | friend class OMonitoringInterface; |
146 | friend class OCiscoMonitoringInterface; | 151 | friend class OCiscoMonitoringInterface; |
147 | friend class OWlanNGMonitoringInterface; | 152 | friend class OWlanNGMonitoringInterface; |
148 | friend class OHostAPMonitoringInterface; | 153 | friend class OHostAPMonitoringInterface; |
149 | friend class OOrinocoMonitoringInterface; | 154 | friend class OOrinocoMonitoringInterface; |
@@ -213,48 +218,51 @@ class ONetworkInterface : public QObject | |||
213 | /** | 218 | /** |
214 | * Associate the IPv4 @a netmask with the interface. | 219 | * Associate the IPv4 @a netmask with the interface. |
215 | */ | 220 | */ |
216 | void setIPV4Netmask( const QHostAddress& netmask ); | 221 | void setIPV4Netmask( const QHostAddress& netmask ); |
217 | /** | 222 | /** |
218 | * @returns the IPv4 netmask associated with the interface. | 223 | * @returns the IPv4 netmask associated with the interface. |
219 | */ | 224 | */ |
220 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress | 225 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress |
221 | /** | 226 | /** |
222 | * @returns the data link type currently associated with the interface. | 227 | * @returns the data link type currently associated with the interface. |
223 | * @see #include <net/if_arp.h> for possible values. | 228 | * @see #include <net/if_arp.h> for possible values. |
224 | */ | 229 | */ |
225 | int dataLinkType() const; | 230 | int dataLinkType() const; |
226 | 231 | ||
227 | protected: | 232 | protected: |
228 | const int _sfd; | 233 | const int _sfd; |
229 | mutable ifreq _ifr; | 234 | mutable ifreq _ifr; |
230 | OMonitoringInterface* _mon; | 235 | OMonitoringInterface* _mon; |
231 | 236 | ||
232 | protected: | 237 | protected: |
233 | struct ifreq& ifr() const; | 238 | struct ifreq& ifr() const; |
234 | virtual void init(); | 239 | virtual void init(); |
235 | bool ioctl( int call ) const; | 240 | bool ioctl( int call ) const; |
236 | bool ioctl( int call, struct ifreq& ) const; | 241 | bool ioctl( int call, struct ifreq& ) const; |
242 | private: | ||
243 | class Private; | ||
244 | Private *d; | ||
237 | }; | 245 | }; |
238 | 246 | ||
239 | /*====================================================================================== | 247 | /*====================================================================================== |
240 | * OChannelHopper | 248 | * OChannelHopper |
241 | *======================================================================================*/ | 249 | *======================================================================================*/ |
242 | 250 | ||
243 | /** | 251 | /** |
244 | * @brief A radio frequency channel hopper. | 252 | * @brief A radio frequency channel hopper. |
245 | * | 253 | * |
246 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 254 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
247 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 255 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
248 | * This is necessary when in monitoring mode and scanning for other devices, because | 256 | * This is necessary when in monitoring mode and scanning for other devices, because |
249 | * the radio frequency hardware can only detect packets sent on the same frequency. | 257 | * the radio frequency hardware can only detect packets sent on the same frequency. |
250 | * | 258 | * |
251 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 259 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
252 | */ | 260 | */ |
253 | class OChannelHopper : public QObject | 261 | class OChannelHopper : public QObject |
254 | { | 262 | { |
255 | Q_OBJECT | 263 | Q_OBJECT |
256 | 264 | ||
257 | public: | 265 | public: |
258 | /** | 266 | /** |
259 | * Constructor. | 267 | * Constructor. |
260 | */ | 268 | */ |
@@ -275,48 +283,50 @@ class OChannelHopper : public QObject | |||
275 | * Set the channel hopping @a interval. | 283 | * Set the channel hopping @a interval. |
276 | * An interval of 0 deactivates the channel hopper. | 284 | * An interval of 0 deactivates the channel hopper. |
277 | */ | 285 | */ |
278 | void setInterval( int interval ); | 286 | void setInterval( int interval ); |
279 | /** | 287 | /** |
280 | * @returns the channel hopping interval | 288 | * @returns the channel hopping interval |
281 | */ | 289 | */ |
282 | int interval() const; | 290 | int interval() const; |
283 | 291 | ||
284 | signals: | 292 | signals: |
285 | /** | 293 | /** |
286 | * This signal is emitted right after the channel hopper performed a hop | 294 | * This signal is emitted right after the channel hopper performed a hop |
287 | */ | 295 | */ |
288 | void hopped( int ); | 296 | void hopped( int ); |
289 | 297 | ||
290 | protected: | 298 | protected: |
291 | virtual void timerEvent( QTimerEvent* ); | 299 | virtual void timerEvent( QTimerEvent* ); |
292 | 300 | ||
293 | private: | 301 | private: |
294 | OWirelessNetworkInterface* _iface; | 302 | OWirelessNetworkInterface* _iface; |
295 | int _interval; | 303 | int _interval; |
296 | int _tid; | 304 | int _tid; |
297 | QValueList<int> _channels; | 305 | QValueList<int> _channels; |
298 | QValueList<int>::Iterator _channel; | 306 | QValueList<int>::Iterator _channel; |
307 | class Private; | ||
308 | Private *d; | ||
299 | }; | 309 | }; |
300 | 310 | ||
301 | 311 | ||
302 | /*====================================================================================== | 312 | /*====================================================================================== |
303 | * OWirelessNetworkInterface | 313 | * OWirelessNetworkInterface |
304 | *======================================================================================*/ | 314 | *======================================================================================*/ |
305 | 315 | ||
306 | /** | 316 | /** |
307 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 317 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
308 | * | 318 | * |
309 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 319 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
310 | * | 320 | * |
311 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 321 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
312 | */ | 322 | */ |
313 | class OWirelessNetworkInterface : public ONetworkInterface | 323 | class OWirelessNetworkInterface : public ONetworkInterface |
314 | { | 324 | { |
315 | friend class OMonitoringInterface; | 325 | friend class OMonitoringInterface; |
316 | friend class OCiscoMonitoringInterface; | 326 | friend class OCiscoMonitoringInterface; |
317 | friend class OWlanNGMonitoringInterface; | 327 | friend class OWlanNGMonitoringInterface; |
318 | friend class OHostAPMonitoringInterface; | 328 | friend class OHostAPMonitoringInterface; |
319 | friend class OOrinocoMonitoringInterface; | 329 | friend class OOrinocoMonitoringInterface; |
320 | 330 | ||
321 | friend class OPrivateIOCTL; | 331 | friend class OPrivateIOCTL; |
322 | 332 | ||
@@ -434,126 +444,147 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
434 | * In other modes the result is driver dependent. | 444 | * In other modes the result is driver dependent. |
435 | */ | 445 | */ |
436 | virtual int signalStrength() const; | 446 | virtual int signalStrength() const; |
437 | /** @internal commit pending changes to the driver | 447 | /** @internal commit pending changes to the driver |
438 | * | 448 | * |
439 | */ | 449 | */ |
440 | void commit() const; | 450 | void commit() const; |
441 | 451 | ||
442 | protected: | 452 | protected: |
443 | void buildInformation(); | 453 | void buildInformation(); |
444 | void buildPrivateList(); | 454 | void buildPrivateList(); |
445 | void dumpInformation() const; | 455 | void dumpInformation() const; |
446 | virtual void init(); | 456 | virtual void init(); |
447 | struct iwreq& iwr() const; | 457 | struct iwreq& iwr() const; |
448 | bool wioctl( int call ) const; | 458 | bool wioctl( int call ) const; |
449 | bool wioctl( int call, struct iwreq& ) const; | 459 | bool wioctl( int call, struct iwreq& ) const; |
450 | 460 | ||
451 | protected: | 461 | protected: |
452 | mutable struct iwreq _iwr; | 462 | mutable struct iwreq _iwr; |
453 | QMap<int,int> _channels; | 463 | QMap<int,int> _channels; |
454 | struct iw_range _range; | 464 | struct iw_range _range; |
455 | 465 | ||
456 | private: | 466 | private: |
457 | OChannelHopper* _hopper; | 467 | OChannelHopper* _hopper; |
468 | class Private; | ||
469 | Private *d; | ||
458 | }; | 470 | }; |
459 | 471 | ||
460 | 472 | ||
461 | /*====================================================================================== | 473 | /*====================================================================================== |
462 | * OMonitoringInterface | 474 | * OMonitoringInterface |
463 | *======================================================================================*/ | 475 | *======================================================================================*/ |
464 | 476 | ||
465 | 477 | ||
466 | class OMonitoringInterface | 478 | class OMonitoringInterface |
467 | { | 479 | { |
468 | public: | 480 | public: |
469 | OMonitoringInterface(); | 481 | OMonitoringInterface(); |
470 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 482 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
471 | virtual ~OMonitoringInterface(); | 483 | virtual ~OMonitoringInterface(); |
472 | 484 | ||
473 | public: | 485 | public: |
474 | virtual void setEnabled( bool ); | 486 | virtual void setEnabled( bool ); |
475 | virtual void setChannel( int ); | 487 | virtual void setChannel( int ); |
476 | 488 | ||
477 | virtual QString name() const = 0; | 489 | virtual QString name() const = 0; |
478 | 490 | ||
479 | protected: | 491 | protected: |
480 | OWirelessNetworkInterface* _if; | 492 | OWirelessNetworkInterface* _if; |
481 | bool _prismHeader; | 493 | bool _prismHeader; |
494 | private: | ||
495 | class Private; | ||
496 | Private *d; | ||
482 | 497 | ||
483 | }; | 498 | }; |
484 | 499 | ||
485 | 500 | ||
486 | /*====================================================================================== | 501 | /*====================================================================================== |
487 | * OCiscoMonitoring | 502 | * OCiscoMonitoring |
488 | *======================================================================================*/ | 503 | *======================================================================================*/ |
489 | 504 | ||
490 | 505 | ||
491 | class OCiscoMonitoringInterface : public OMonitoringInterface | 506 | class OCiscoMonitoringInterface : public OMonitoringInterface |
492 | { | 507 | { |
493 | public: | 508 | public: |
494 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 509 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
495 | virtual ~OCiscoMonitoringInterface(); | 510 | virtual ~OCiscoMonitoringInterface(); |
496 | 511 | ||
497 | virtual void setEnabled( bool ); | 512 | virtual void setEnabled( bool ); |
498 | virtual QString name() const; | 513 | virtual QString name() const; |
499 | virtual void setChannel( int ); | 514 | virtual void setChannel( int ); |
515 | private: | ||
516 | class Private; | ||
517 | Private *d; | ||
500 | 518 | ||
501 | }; | 519 | }; |
502 | 520 | ||
503 | 521 | ||
504 | /*====================================================================================== | 522 | /*====================================================================================== |
505 | * OWlanNGMonitoringInterface | 523 | * OWlanNGMonitoringInterface |
506 | *======================================================================================*/ | 524 | *======================================================================================*/ |
507 | 525 | ||
508 | 526 | ||
509 | class OWlanNGMonitoringInterface : public OMonitoringInterface | 527 | class OWlanNGMonitoringInterface : public OMonitoringInterface |
510 | { | 528 | { |
511 | public: | 529 | public: |
512 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 530 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
513 | virtual ~OWlanNGMonitoringInterface(); | 531 | virtual ~OWlanNGMonitoringInterface(); |
514 | 532 | ||
515 | public: | 533 | public: |
516 | virtual void setEnabled( bool ); | 534 | virtual void setEnabled( bool ); |
517 | virtual QString name() const; | 535 | virtual QString name() const; |
518 | virtual void setChannel( int ); | 536 | virtual void setChannel( int ); |
537 | private: | ||
538 | class Private; | ||
539 | Private *d; | ||
519 | 540 | ||
520 | }; | 541 | }; |
521 | 542 | ||
522 | 543 | ||
523 | /*====================================================================================== | 544 | /*====================================================================================== |
524 | * OHostAPMonitoringInterface | 545 | * OHostAPMonitoringInterface |
525 | *======================================================================================*/ | 546 | *======================================================================================*/ |
526 | 547 | ||
527 | 548 | ||
528 | class OHostAPMonitoringInterface : public OMonitoringInterface | 549 | class OHostAPMonitoringInterface : public OMonitoringInterface |
529 | { | 550 | { |
530 | public: | 551 | public: |
531 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 552 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
532 | virtual ~OHostAPMonitoringInterface(); | 553 | virtual ~OHostAPMonitoringInterface(); |
533 | 554 | ||
534 | public: | 555 | public: |
535 | virtual void setEnabled( bool ); | 556 | virtual void setEnabled( bool ); |
536 | virtual QString name() const; | 557 | virtual QString name() const; |
558 | |||
559 | private: | ||
560 | class Private; | ||
561 | Private *d; | ||
537 | }; | 562 | }; |
538 | 563 | ||
539 | 564 | ||
540 | /*====================================================================================== | 565 | /*====================================================================================== |
541 | * OOrinocoMonitoringInterface | 566 | * OOrinocoMonitoringInterface |
542 | *======================================================================================*/ | 567 | *======================================================================================*/ |
543 | 568 | ||
544 | 569 | ||
545 | class OOrinocoMonitoringInterface : public OMonitoringInterface | 570 | class OOrinocoMonitoringInterface : public OMonitoringInterface |
546 | { | 571 | { |
547 | public: | 572 | public: |
548 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 573 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
549 | virtual ~OOrinocoMonitoringInterface(); | 574 | virtual ~OOrinocoMonitoringInterface(); |
550 | 575 | ||
551 | public: | 576 | public: |
552 | virtual void setChannel( int ); | 577 | virtual void setChannel( int ); |
553 | virtual void setEnabled( bool ); | 578 | virtual void setEnabled( bool ); |
554 | virtual QString name() const; | 579 | virtual QString name() const; |
555 | 580 | ||
581 | private: | ||
582 | class Private; | ||
583 | Private *d; | ||
556 | }; | 584 | }; |
557 | 585 | ||
586 | } | ||
587 | } | ||
588 | |||
558 | #endif // ONETWORK_H | 589 | #endif // ONETWORK_H |
559 | 590 | ||
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index fdd519c..4081d4f 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -24,48 +24,53 @@ | |||
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 | #include <opie2/opcap.h> | 32 | #include <opie2/opcap.h> |
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) | 36 | #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) |
37 | #include <qsocketnotifier.h> | 37 | #include <qsocketnotifier.h> |
38 | #include <qobjectlist.h> | 38 | #include <qobjectlist.h> |
39 | 39 | ||
40 | /* SYSTEM */ | 40 | /* SYSTEM */ |
41 | #include <sys/time.h> | 41 | #include <sys/time.h> |
42 | #include <sys/types.h> | 42 | #include <sys/types.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | 44 | ||
45 | /* LOCAL */ | 45 | /* LOCAL */ |
46 | #include "udp_ports.h" | 46 | #include "udp_ports.h" |
47 | 47 | ||
48 | using namespace Opie::Core; | ||
49 | |||
50 | namespace Opie { | ||
51 | namespace Net { | ||
52 | |||
48 | /*====================================================================================== | 53 | /*====================================================================================== |
49 | * OPacket | 54 | * OPacket |
50 | *======================================================================================*/ | 55 | *======================================================================================*/ |
51 | 56 | ||
52 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) | 57 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) |
53 | :QObject( parent, "Generic" ), _hdr( header ), _data( data ) | 58 | :QObject( parent, "Generic" ), _hdr( header ), _data( data ) |
54 | { | 59 | { |
55 | //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); | 60 | //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); |
56 | 61 | ||
57 | _end = (unsigned char*) data + header.len; | 62 | _end = (unsigned char*) data + header.len; |
58 | //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); | 63 | //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); |
59 | 64 | ||
60 | switch ( datalink ) | 65 | switch ( datalink ) |
61 | { | 66 | { |
62 | case DLT_EN10MB: | 67 | case DLT_EN10MB: |
63 | odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; | 68 | odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; |
64 | new OEthernetPacket( _end, (const struct ether_header*) data, this ); | 69 | new OEthernetPacket( _end, (const struct ether_header*) data, this ); |
65 | break; | 70 | break; |
66 | 71 | ||
67 | case DLT_IEEE802_11: | 72 | case DLT_IEEE802_11: |
68 | odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; | 73 | odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; |
69 | new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); | 74 | new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); |
70 | break; | 75 | break; |
71 | 76 | ||
@@ -1323,25 +1328,26 @@ void OPacketCapturer::readyToReceive() | |||
1323 | 1328 | ||
1324 | const QMap<QString,int>& OPacketCapturer::statistics() const | 1329 | const QMap<QString,int>& OPacketCapturer::statistics() const |
1325 | { | 1330 | { |
1326 | return _stats; | 1331 | return _stats; |
1327 | } | 1332 | } |
1328 | 1333 | ||
1329 | 1334 | ||
1330 | int OPacketCapturer::snapShot() const | 1335 | int OPacketCapturer::snapShot() const |
1331 | { | 1336 | { |
1332 | return pcap_snapshot( _pch ); | 1337 | return pcap_snapshot( _pch ); |
1333 | } | 1338 | } |
1334 | 1339 | ||
1335 | 1340 | ||
1336 | bool OPacketCapturer::swapped() const | 1341 | bool OPacketCapturer::swapped() const |
1337 | { | 1342 | { |
1338 | return pcap_is_swapped( _pch ); | 1343 | return pcap_is_swapped( _pch ); |
1339 | } | 1344 | } |
1340 | 1345 | ||
1341 | 1346 | ||
1342 | QString OPacketCapturer::version() const | 1347 | QString OPacketCapturer::version() const |
1343 | { | 1348 | { |
1344 | return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) ); | 1349 | return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) ); |
1345 | } | 1350 | } |
1346 | 1351 | ||
1347 | 1352 | } | |
1353 | } | ||
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index b873b49..dc609a3 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h | |||
@@ -43,50 +43,52 @@ | |||
43 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
44 | #include <qmap.h> | 44 | #include <qmap.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | extern "C" // work around a bpf/pcap conflict in recent headers | 47 | extern "C" // work around a bpf/pcap conflict in recent headers |
48 | { | 48 | { |
49 | #include <pcap.h> | 49 | #include <pcap.h> |
50 | } | 50 | } |
51 | #include <netinet/ether.h> | 51 | #include <netinet/ether.h> |
52 | #include <netinet/ip.h> | 52 | #include <netinet/ip.h> |
53 | #include <netinet/udp.h> | 53 | #include <netinet/udp.h> |
54 | #include <netinet/tcp.h> | 54 | #include <netinet/tcp.h> |
55 | #include <time.h> | 55 | #include <time.h> |
56 | 56 | ||
57 | /* Custom Network Includes (must go here, don't reorder!) */ | 57 | /* Custom Network Includes (must go here, don't reorder!) */ |
58 | #include "802_11_user.h" | 58 | #include "802_11_user.h" |
59 | #include "dhcp.h" | 59 | #include "dhcp.h" |
60 | 60 | ||
61 | 61 | ||
62 | /* TYPEDEFS */ | 62 | /* TYPEDEFS */ |
63 | typedef struct timeval timevalstruct; | 63 | typedef struct timeval timevalstruct; |
64 | typedef struct pcap_pkthdr packetheaderstruct; | 64 | typedef struct pcap_pkthdr packetheaderstruct; |
65 | 65 | ||
66 | /* FORWARDS */ | 66 | /* FORWARDS */ |
67 | class OPacketCapturer; | ||
68 | class QSocketNotifier; | 67 | class QSocketNotifier; |
68 | namespace Opie { | ||
69 | namespace Net { | ||
70 | class OPacketCapturer; | ||
69 | 71 | ||
70 | /*====================================================================================== | 72 | /*====================================================================================== |
71 | * OPacket - A frame on the wire | 73 | * OPacket - A frame on the wire |
72 | *======================================================================================*/ | 74 | *======================================================================================*/ |
73 | 75 | ||
74 | /** @brief A class representing a data frame on the wire. | 76 | /** @brief A class representing a data frame on the wire. |
75 | * | 77 | * |
76 | * The whole family of the packet classes are used when capturing frames from a network. | 78 | * The whole family of the packet classes are used when capturing frames from a network. |
77 | * Most standard network protocols in use share a common architecture, which mostly is | 79 | * Most standard network protocols in use share a common architecture, which mostly is |
78 | * a packet header and then the packet payload. In layered architectures, each lower layer | 80 | * a packet header and then the packet payload. In layered architectures, each lower layer |
79 | * encapsulates data from its upper layer - that is it | 81 | * encapsulates data from its upper layer - that is it |
80 | * treats the data from its upper layer as payload and prepends an own header to the packet, | 82 | * treats the data from its upper layer as payload and prepends an own header to the packet, |
81 | * which - again - is treated as the payload for the layer below. The figure below is an | 83 | * which - again - is treated as the payload for the layer below. The figure below is an |
82 | * example for how such a data frame is composed out of packets, e.g. when sending a mail. | 84 | * example for how such a data frame is composed out of packets, e.g. when sending a mail. |
83 | * | 85 | * |
84 | * <pre> | 86 | * <pre> |
85 | * | User Data | == Mail Data | 87 | * | User Data | == Mail Data |
86 | * | SMTP Header | User Data | == SMTP | 88 | * | SMTP Header | User Data | == SMTP |
87 | * | TCP Header | SMTP Header | User Data | == TCP | 89 | * | TCP Header | SMTP Header | User Data | == TCP |
88 | * | IP Header | TCP Header | SMTP Header | User Data | == IP | 90 | * | IP Header | TCP Header | SMTP Header | User Data | == IP |
89 | * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC | 91 | * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC |
90 | * | 92 | * |
91 | * </pre> | 93 | * </pre> |
92 | * | 94 | * |
@@ -120,452 +122,496 @@ class OPacket : public QObject | |||
120 | friend class OPacketCapturer; | 122 | friend class OPacketCapturer; |
121 | friend QTextStream& operator<<( QTextStream& s, const OPacket& p ); | 123 | friend QTextStream& operator<<( QTextStream& s, const OPacket& p ); |
122 | 124 | ||
123 | public: | 125 | public: |
124 | OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); | 126 | OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); |
125 | virtual ~OPacket(); | 127 | virtual ~OPacket(); |
126 | 128 | ||
127 | timevalstruct timeval() const; | 129 | timevalstruct timeval() const; |
128 | 130 | ||
129 | int caplen() const; | 131 | int caplen() const; |
130 | int len() const; | 132 | int len() const; |
131 | QString dump( int = 32 ) const; | 133 | QString dump( int = 32 ) const; |
132 | 134 | ||
133 | void updateStats( QMap<QString,int>&, QObjectList* ); | 135 | void updateStats( QMap<QString,int>&, QObjectList* ); |
134 | 136 | ||
135 | private: | 137 | private: |
136 | 138 | ||
137 | QString dumpStructure() const; | 139 | QString dumpStructure() const; |
138 | QString _dumpStructure( QObjectList* ) const; | 140 | QString _dumpStructure( QObjectList* ) const; |
139 | 141 | ||
140 | private: | 142 | private: |
141 | const packetheaderstruct _hdr; // pcap packet header | 143 | const packetheaderstruct _hdr; // pcap packet header |
142 | const unsigned char* _data; // pcap packet data | 144 | const unsigned char* _data; // pcap packet data |
143 | const unsigned char* _end; // end of pcap packet data | 145 | const unsigned char* _end; // end of pcap packet data |
146 | private: | ||
147 | class Private; | ||
148 | Private *d; | ||
144 | }; | 149 | }; |
145 | 150 | ||
146 | QTextStream& operator<<( QTextStream& s, const OPacket& p ); | 151 | QTextStream& operator<<( QTextStream& s, const OPacket& p ); |
147 | 152 | ||
148 | /*====================================================================================== | 153 | /*====================================================================================== |
149 | * OEthernetPacket - DLT_EN10MB frame | 154 | * OEthernetPacket - DLT_EN10MB frame |
150 | *======================================================================================*/ | 155 | *======================================================================================*/ |
151 | 156 | ||
152 | class OEthernetPacket : public QObject | 157 | class OEthernetPacket : public QObject |
153 | { | 158 | { |
154 | Q_OBJECT | 159 | Q_OBJECT |
155 | 160 | ||
156 | public: | 161 | public: |
157 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); | 162 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); |
158 | virtual ~OEthernetPacket(); | 163 | virtual ~OEthernetPacket(); |
159 | 164 | ||
160 | OMacAddress sourceAddress() const; | 165 | OMacAddress sourceAddress() const; |
161 | OMacAddress destinationAddress() const; | 166 | OMacAddress destinationAddress() const; |
162 | int type() const; | 167 | int type() const; |
163 | 168 | ||
164 | private: | 169 | private: |
165 | const struct ether_header* _ether; | 170 | const struct ether_header* _ether; |
171 | private: | ||
172 | class Private; | ||
173 | Private *d; | ||
166 | }; | 174 | }; |
167 | 175 | ||
168 | /*====================================================================================== | 176 | /*====================================================================================== |
169 | * OPrismHeaderPacket - DLT_PRISM_HEADER frame | 177 | * OPrismHeaderPacket - DLT_PRISM_HEADER frame |
170 | *======================================================================================*/ | 178 | *======================================================================================*/ |
171 | 179 | ||
172 | class OPrismHeaderPacket : public QObject | 180 | class OPrismHeaderPacket : public QObject |
173 | { | 181 | { |
174 | Q_OBJECT | 182 | Q_OBJECT |
175 | 183 | ||
176 | public: | 184 | public: |
177 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); | 185 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); |
178 | virtual ~OPrismHeaderPacket(); | 186 | virtual ~OPrismHeaderPacket(); |
179 | 187 | ||
180 | unsigned int signalStrength() const; | 188 | unsigned int signalStrength() const; |
181 | 189 | ||
182 | private: | 190 | private: |
183 | const struct prism_hdr* _header; | 191 | const struct prism_hdr* _header; |
192 | class Private; | ||
193 | Private *d; | ||
184 | }; | 194 | }; |
185 | 195 | ||
186 | /*====================================================================================== | 196 | /*====================================================================================== |
187 | * OWaveLanPacket - DLT_IEEE802_11 frame | 197 | * OWaveLanPacket - DLT_IEEE802_11 frame |
188 | *======================================================================================*/ | 198 | *======================================================================================*/ |
189 | 199 | ||
190 | class OWaveLanPacket : public QObject | 200 | class OWaveLanPacket : public QObject |
191 | { | 201 | { |
192 | Q_OBJECT | 202 | Q_OBJECT |
193 | 203 | ||
194 | public: | 204 | public: |
195 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); | 205 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); |
196 | virtual ~OWaveLanPacket(); | 206 | virtual ~OWaveLanPacket(); |
197 | 207 | ||
198 | int duration() const; | 208 | int duration() const; |
199 | bool fromDS() const; | 209 | bool fromDS() const; |
200 | bool toDS() const; | 210 | bool toDS() const; |
201 | virtual OMacAddress macAddress1() const; | 211 | virtual OMacAddress macAddress1() const; |
202 | virtual OMacAddress macAddress2() const; | 212 | virtual OMacAddress macAddress2() const; |
203 | virtual OMacAddress macAddress3() const; | 213 | virtual OMacAddress macAddress3() const; |
204 | virtual OMacAddress macAddress4() const; | 214 | virtual OMacAddress macAddress4() const; |
205 | bool usesPowerManagement() const; | 215 | bool usesPowerManagement() const; |
206 | int type() const; | 216 | int type() const; |
207 | int subType() const; | 217 | int subType() const; |
208 | int version() const; | 218 | int version() const; |
209 | bool usesWep() const; | 219 | bool usesWep() const; |
210 | 220 | ||
211 | private: | 221 | private: |
212 | const struct ieee_802_11_header* _wlanhdr; | 222 | const struct ieee_802_11_header* _wlanhdr; |
223 | class Private; | ||
224 | Private *d; | ||
213 | }; | 225 | }; |
214 | 226 | ||
215 | 227 | ||
216 | /*====================================================================================== | 228 | /*====================================================================================== |
217 | * OWaveLanManagementPacket - type: management (T_MGMT) | 229 | * OWaveLanManagementPacket - type: management (T_MGMT) |
218 | *======================================================================================*/ | 230 | *======================================================================================*/ |
219 | 231 | ||
220 | class OWaveLanManagementPacket : public QObject | 232 | class OWaveLanManagementPacket : public QObject |
221 | { | 233 | { |
222 | Q_OBJECT | 234 | Q_OBJECT |
223 | 235 | ||
224 | public: | 236 | public: |
225 | OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); | 237 | OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); |
226 | virtual ~OWaveLanManagementPacket(); | 238 | virtual ~OWaveLanManagementPacket(); |
227 | 239 | ||
228 | QString managementType() const; | 240 | QString managementType() const; |
229 | 241 | ||
230 | int beaconInterval() const; | 242 | int beaconInterval() const; |
231 | int capabilities() const; // generic | 243 | int capabilities() const; // generic |
232 | 244 | ||
233 | bool canESS() const; | 245 | bool canESS() const; |
234 | bool canIBSS() const; | 246 | bool canIBSS() const; |
235 | bool canCFP() const; | 247 | bool canCFP() const; |
236 | bool canCFP_REQ() const; | 248 | bool canCFP_REQ() const; |
237 | bool canPrivacy() const; | 249 | bool canPrivacy() const; |
238 | 250 | ||
239 | private: | 251 | private: |
240 | const struct ieee_802_11_mgmt_header* _header; | 252 | const struct ieee_802_11_mgmt_header* _header; |
241 | const struct ieee_802_11_mgmt_body* _body; | 253 | const struct ieee_802_11_mgmt_body* _body; |
254 | class Private; | ||
255 | Private *d; | ||
242 | }; | 256 | }; |
243 | 257 | ||
244 | 258 | ||
245 | /*====================================================================================== | 259 | /*====================================================================================== |
246 | * OWaveLanManagementSSID | 260 | * OWaveLanManagementSSID |
247 | *======================================================================================*/ | 261 | *======================================================================================*/ |
248 | 262 | ||
249 | class OWaveLanManagementSSID : public QObject | 263 | class OWaveLanManagementSSID : public QObject |
250 | { | 264 | { |
251 | Q_OBJECT | 265 | Q_OBJECT |
252 | 266 | ||
253 | public: | 267 | public: |
254 | OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); | 268 | OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); |
255 | virtual ~OWaveLanManagementSSID(); | 269 | virtual ~OWaveLanManagementSSID(); |
256 | 270 | ||
257 | QString ID( bool decloak = false ) const; | 271 | QString ID( bool decloak = false ) const; |
258 | 272 | ||
259 | private: | 273 | private: |
260 | const struct ssid_t* _data; | 274 | const struct ssid_t* _data; |
275 | class Private; | ||
276 | Private *d; | ||
261 | }; | 277 | }; |
262 | 278 | ||
263 | /*====================================================================================== | 279 | /*====================================================================================== |
264 | * OWaveLanManagementRates | 280 | * OWaveLanManagementRates |
265 | *======================================================================================*/ | 281 | *======================================================================================*/ |
266 | 282 | ||
267 | class OWaveLanManagementRates : public QObject | 283 | class OWaveLanManagementRates : public QObject |
268 | { | 284 | { |
269 | Q_OBJECT | 285 | Q_OBJECT |
270 | 286 | ||
271 | public: | 287 | public: |
272 | OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); | 288 | OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); |
273 | virtual ~OWaveLanManagementRates(); | 289 | virtual ~OWaveLanManagementRates(); |
274 | 290 | ||
275 | private: | 291 | private: |
276 | const struct rates_t* _data; | 292 | const struct rates_t* _data; |
293 | class Private; | ||
294 | Private *d; | ||
277 | }; | 295 | }; |
278 | 296 | ||
279 | /*====================================================================================== | 297 | /*====================================================================================== |
280 | * OWaveLanManagementCF | 298 | * OWaveLanManagementCF |
281 | *======================================================================================*/ | 299 | *======================================================================================*/ |
282 | 300 | ||
283 | class OWaveLanManagementCF : public QObject | 301 | class OWaveLanManagementCF : public QObject |
284 | { | 302 | { |
285 | Q_OBJECT | 303 | Q_OBJECT |
286 | 304 | ||
287 | public: | 305 | public: |
288 | OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); | 306 | OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); |
289 | virtual ~OWaveLanManagementCF(); | 307 | virtual ~OWaveLanManagementCF(); |
290 | 308 | ||
291 | private: | 309 | private: |
292 | const struct cf_t* _data; | 310 | const struct cf_t* _data; |
311 | class Private; | ||
312 | Private *d; | ||
293 | }; | 313 | }; |
294 | 314 | ||
295 | /*====================================================================================== | 315 | /*====================================================================================== |
296 | * OWaveLanManagementFH | 316 | * OWaveLanManagementFH |
297 | *======================================================================================*/ | 317 | *======================================================================================*/ |
298 | 318 | ||
299 | class OWaveLanManagementFH : public QObject | 319 | class OWaveLanManagementFH : public QObject |
300 | { | 320 | { |
301 | Q_OBJECT | 321 | Q_OBJECT |
302 | 322 | ||
303 | public: | 323 | public: |
304 | OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); | 324 | OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); |
305 | virtual ~OWaveLanManagementFH(); | 325 | virtual ~OWaveLanManagementFH(); |
306 | 326 | ||
307 | private: | 327 | private: |
308 | const struct fh_t* _data; | 328 | const struct fh_t* _data; |
329 | class Private; | ||
330 | Private *d; | ||
309 | }; | 331 | }; |
310 | 332 | ||
311 | /*====================================================================================== | 333 | /*====================================================================================== |
312 | * OWaveLanManagementDS | 334 | * OWaveLanManagementDS |
313 | *======================================================================================*/ | 335 | *======================================================================================*/ |
314 | 336 | ||
315 | class OWaveLanManagementDS : public QObject | 337 | class OWaveLanManagementDS : public QObject |
316 | { | 338 | { |
317 | Q_OBJECT | 339 | Q_OBJECT |
318 | 340 | ||
319 | public: | 341 | public: |
320 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); | 342 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); |
321 | virtual ~OWaveLanManagementDS(); | 343 | virtual ~OWaveLanManagementDS(); |
322 | 344 | ||
323 | int channel() const; | 345 | int channel() const; |
324 | 346 | ||
325 | private: | 347 | private: |
326 | const struct ds_t* _data; | 348 | const struct ds_t* _data; |
349 | class Private; | ||
350 | Private *d; | ||
327 | }; | 351 | }; |
328 | 352 | ||
329 | /*====================================================================================== | 353 | /*====================================================================================== |
330 | * OWaveLanManagementTim | 354 | * OWaveLanManagementTim |
331 | *======================================================================================*/ | 355 | *======================================================================================*/ |
332 | 356 | ||
333 | class OWaveLanManagementTim : public QObject | 357 | class OWaveLanManagementTim : public QObject |
334 | { | 358 | { |
335 | Q_OBJECT | 359 | Q_OBJECT |
336 | 360 | ||
337 | public: | 361 | public: |
338 | OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); | 362 | OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); |
339 | virtual ~OWaveLanManagementTim(); | 363 | virtual ~OWaveLanManagementTim(); |
340 | 364 | ||
341 | private: | 365 | private: |
342 | const struct tim_t* _data; | 366 | const struct tim_t* _data; |
367 | class Private; | ||
368 | Private *d; | ||
343 | }; | 369 | }; |
344 | 370 | ||
345 | /*====================================================================================== | 371 | /*====================================================================================== |
346 | * OWaveLanManagementIBSS | 372 | * OWaveLanManagementIBSS |
347 | *======================================================================================*/ | 373 | *======================================================================================*/ |
348 | 374 | ||
349 | class OWaveLanManagementIBSS : public QObject | 375 | class OWaveLanManagementIBSS : public QObject |
350 | { | 376 | { |
351 | Q_OBJECT | 377 | Q_OBJECT |
352 | 378 | ||
353 | public: | 379 | public: |
354 | OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); | 380 | OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); |
355 | virtual ~OWaveLanManagementIBSS(); | 381 | virtual ~OWaveLanManagementIBSS(); |
356 | 382 | ||
357 | private: | 383 | private: |
358 | const struct ibss_t* _data; | 384 | const struct ibss_t* _data; |
385 | class Private; | ||
386 | Private *d; | ||
359 | }; | 387 | }; |
360 | 388 | ||
361 | /*====================================================================================== | 389 | /*====================================================================================== |
362 | * OWaveLanManagementChallenge | 390 | * OWaveLanManagementChallenge |
363 | *======================================================================================*/ | 391 | *======================================================================================*/ |
364 | 392 | ||
365 | class OWaveLanManagementChallenge : public QObject | 393 | class OWaveLanManagementChallenge : public QObject |
366 | { | 394 | { |
367 | Q_OBJECT | 395 | Q_OBJECT |
368 | 396 | ||
369 | public: | 397 | public: |
370 | OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); | 398 | OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); |
371 | virtual ~OWaveLanManagementChallenge(); | 399 | virtual ~OWaveLanManagementChallenge(); |
372 | 400 | ||
373 | private: | 401 | private: |
374 | const struct challenge_t* _data; | 402 | const struct challenge_t* _data; |
403 | class Private; | ||
404 | Private *d; | ||
375 | }; | 405 | }; |
376 | 406 | ||
377 | /*====================================================================================== | 407 | /*====================================================================================== |
378 | * OWaveLanDataPacket - type: data (T_DATA) | 408 | * OWaveLanDataPacket - type: data (T_DATA) |
379 | *======================================================================================*/ | 409 | *======================================================================================*/ |
380 | 410 | ||
381 | class OWaveLanDataPacket : public QObject | 411 | class OWaveLanDataPacket : public QObject |
382 | { | 412 | { |
383 | Q_OBJECT | 413 | Q_OBJECT |
384 | 414 | ||
385 | public: | 415 | public: |
386 | OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); | 416 | OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); |
387 | virtual ~OWaveLanDataPacket(); | 417 | virtual ~OWaveLanDataPacket(); |
388 | 418 | ||
389 | private: | 419 | private: |
390 | const struct ieee_802_11_data_header* _header; | 420 | const struct ieee_802_11_data_header* _header; |
421 | class Private; | ||
422 | Private *d; | ||
391 | }; | 423 | }; |
392 | 424 | ||
393 | /*====================================================================================== | 425 | /*====================================================================================== |
394 | * OWaveLanControlPacket - type: control (T_CTRL) | 426 | * OWaveLanControlPacket - type: control (T_CTRL) |
395 | *======================================================================================*/ | 427 | *======================================================================================*/ |
396 | 428 | ||
397 | class OWaveLanControlPacket : public QObject | 429 | class OWaveLanControlPacket : public QObject |
398 | { | 430 | { |
399 | Q_OBJECT | 431 | Q_OBJECT |
400 | 432 | ||
401 | public: | 433 | public: |
402 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); | 434 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); |
403 | virtual ~OWaveLanControlPacket(); | 435 | virtual ~OWaveLanControlPacket(); |
404 | 436 | ||
405 | QString controlType() const; | 437 | QString controlType() const; |
406 | 438 | ||
407 | private: | 439 | private: |
408 | const struct ieee_802_11_control_header* _header; | 440 | const struct ieee_802_11_control_header* _header; |
441 | class Private; | ||
442 | Private *d; | ||
409 | }; | 443 | }; |
410 | 444 | ||
411 | /*====================================================================================== | 445 | /*====================================================================================== |
412 | * OLLCPacket - IEEE 802.2 Link Level Control | 446 | * OLLCPacket - IEEE 802.2 Link Level Control |
413 | *======================================================================================*/ | 447 | *======================================================================================*/ |
414 | 448 | ||
415 | class OLLCPacket : public QObject | 449 | class OLLCPacket : public QObject |
416 | { | 450 | { |
417 | Q_OBJECT | 451 | Q_OBJECT |
418 | 452 | ||
419 | public: | 453 | public: |
420 | OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); | 454 | OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); |
421 | virtual ~OLLCPacket(); | 455 | virtual ~OLLCPacket(); |
422 | 456 | ||
423 | private: | 457 | private: |
424 | const struct ieee_802_11_802_2_header* _header; | 458 | const struct ieee_802_11_802_2_header* _header; |
459 | class Private; | ||
460 | Private *d; | ||
425 | }; | 461 | }; |
426 | 462 | ||
427 | /*====================================================================================== | 463 | /*====================================================================================== |
428 | * OIPPacket | 464 | * OIPPacket |
429 | *======================================================================================*/ | 465 | *======================================================================================*/ |
430 | 466 | ||
431 | class OIPPacket : public QObject | 467 | class OIPPacket : public QObject |
432 | { | 468 | { |
433 | Q_OBJECT | 469 | Q_OBJECT |
434 | 470 | ||
435 | public: | 471 | public: |
436 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); | 472 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); |
437 | virtual ~OIPPacket(); | 473 | virtual ~OIPPacket(); |
438 | 474 | ||
439 | QHostAddress fromIPAddress() const; | 475 | QHostAddress fromIPAddress() const; |
440 | QHostAddress toIPAddress() const; | 476 | QHostAddress toIPAddress() const; |
441 | 477 | ||
442 | int tos() const; | 478 | int tos() const; |
443 | int len() const; | 479 | int len() const; |
444 | int id() const; | 480 | int id() const; |
445 | int offset() const; | 481 | int offset() const; |
446 | int ttl() const; | 482 | int ttl() const; |
447 | int protocol() const; | 483 | int protocol() const; |
448 | int checksum() const; | 484 | int checksum() const; |
449 | 485 | ||
450 | private: | 486 | private: |
451 | const struct iphdr* _iphdr; | 487 | const struct iphdr* _iphdr; |
488 | class Private; | ||
489 | Private *d; | ||
452 | }; | 490 | }; |
453 | 491 | ||
454 | /*====================================================================================== | 492 | /*====================================================================================== |
455 | * OARPPacket | 493 | * OARPPacket |
456 | *======================================================================================*/ | 494 | *======================================================================================*/ |
457 | 495 | ||
458 | class OARPPacket : public QObject | 496 | class OARPPacket : public QObject |
459 | { | 497 | { |
460 | Q_OBJECT | 498 | Q_OBJECT |
461 | 499 | ||
462 | public: | 500 | public: |
463 | OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); | 501 | OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); |
464 | virtual ~OARPPacket(); | 502 | virtual ~OARPPacket(); |
465 | 503 | ||
466 | QHostAddress senderIPV4Address() const; | 504 | QHostAddress senderIPV4Address() const; |
467 | OMacAddress senderMacAddress() const; | 505 | OMacAddress senderMacAddress() const; |
468 | QHostAddress targetIPV4Address() const; | 506 | QHostAddress targetIPV4Address() const; |
469 | OMacAddress targetMacAddress() const; | 507 | OMacAddress targetMacAddress() const; |
470 | 508 | ||
471 | //int type() const; | 509 | //int type() const; |
472 | QString type() const; | 510 | QString type() const; |
473 | 511 | ||
474 | private: | 512 | private: |
475 | const struct myarphdr* _arphdr; | 513 | const struct myarphdr* _arphdr; |
514 | class Private; | ||
515 | Private *d; | ||
476 | }; | 516 | }; |
477 | 517 | ||
478 | /*====================================================================================== | 518 | /*====================================================================================== |
479 | * OUDPPacket | 519 | * OUDPPacket |
480 | *======================================================================================*/ | 520 | *======================================================================================*/ |
481 | 521 | ||
482 | class OUDPPacket : public QObject | 522 | class OUDPPacket : public QObject |
483 | { | 523 | { |
484 | Q_OBJECT | 524 | Q_OBJECT |
485 | 525 | ||
486 | public: | 526 | public: |
487 | OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); | 527 | OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); |
488 | virtual ~OUDPPacket(); | 528 | virtual ~OUDPPacket(); |
489 | 529 | ||
490 | int fromPort() const; | 530 | int fromPort() const; |
491 | int toPort() const; | 531 | int toPort() const; |
492 | int length() const; | 532 | int length() const; |
493 | int checksum() const; | 533 | int checksum() const; |
494 | 534 | ||
495 | private: | 535 | private: |
496 | const struct udphdr* _udphdr; | 536 | const struct udphdr* _udphdr; |
537 | class Private; | ||
538 | Private *d; | ||
497 | }; | 539 | }; |
498 | 540 | ||
499 | /*====================================================================================== | 541 | /*====================================================================================== |
500 | * ODHCPPacket | 542 | * ODHCPPacket |
501 | *======================================================================================*/ | 543 | *======================================================================================*/ |
502 | 544 | ||
503 | class ODHCPPacket : public QObject | 545 | class ODHCPPacket : public QObject |
504 | { | 546 | { |
505 | Q_OBJECT | 547 | Q_OBJECT |
506 | 548 | ||
507 | public: | 549 | public: |
508 | ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); | 550 | ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); |
509 | virtual ~ODHCPPacket(); | 551 | virtual ~ODHCPPacket(); |
510 | 552 | ||
511 | QHostAddress clientAddress() const; | 553 | QHostAddress clientAddress() const; |
512 | QHostAddress yourAddress() const; | 554 | QHostAddress yourAddress() const; |
513 | QHostAddress serverAddress() const; | 555 | QHostAddress serverAddress() const; |
514 | QHostAddress relayAddress() const; | 556 | QHostAddress relayAddress() const; |
515 | 557 | ||
516 | OMacAddress clientMacAddress() const; | 558 | OMacAddress clientMacAddress() const; |
517 | 559 | ||
518 | bool isRequest() const; | 560 | bool isRequest() const; |
519 | bool isReply() const; | 561 | bool isReply() const; |
520 | QString type() const; | 562 | QString type() const; |
521 | 563 | ||
522 | private: | 564 | private: |
523 | const struct dhcp_packet* _dhcphdr; | 565 | const struct dhcp_packet* _dhcphdr; |
524 | unsigned char _type; | 566 | unsigned char _type; |
567 | class Private; | ||
568 | Private *d; | ||
525 | }; | 569 | }; |
526 | 570 | ||
527 | /*====================================================================================== | 571 | /*====================================================================================== |
528 | * OTCPPacket | 572 | * OTCPPacket |
529 | *======================================================================================*/ | 573 | *======================================================================================*/ |
530 | 574 | ||
531 | class OTCPPacket : public QObject | 575 | class OTCPPacket : public QObject |
532 | { | 576 | { |
533 | Q_OBJECT | 577 | Q_OBJECT |
534 | 578 | ||
535 | public: | 579 | public: |
536 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); | 580 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); |
537 | virtual ~OTCPPacket(); | 581 | virtual ~OTCPPacket(); |
538 | 582 | ||
539 | int fromPort() const; | 583 | int fromPort() const; |
540 | int toPort() const; | 584 | int toPort() const; |
541 | int seq() const; | 585 | int seq() const; |
542 | int ack() const; | 586 | int ack() const; |
543 | int window() const; | 587 | int window() const; |
544 | int checksum() const; | 588 | int checksum() const; |
545 | 589 | ||
546 | private: | 590 | private: |
547 | const struct tcphdr* _tcphdr; | 591 | const struct tcphdr* _tcphdr; |
592 | class Private; | ||
593 | Private *d; | ||
548 | }; | 594 | }; |
549 | 595 | ||
550 | 596 | ||
551 | /*====================================================================================== | 597 | /*====================================================================================== |
552 | * OPacketCapturer | 598 | * OPacketCapturer |
553 | *======================================================================================*/ | 599 | *======================================================================================*/ |
554 | 600 | ||
555 | /** | 601 | /** |
556 | * @brief A class based wrapper for network packet capturing. | 602 | * @brief A class based wrapper for network packet capturing. |
557 | * | 603 | * |
558 | * This class is the base of a high-level interface to the well known packet capturing | 604 | * This class is the base of a high-level interface to the well known packet capturing |
559 | * library libpcap. | 605 | * library libpcap. |
560 | * @see http://tcpdump.org | 606 | * @see http://tcpdump.org |
561 | */ | 607 | */ |
562 | class OPacketCapturer : public QObject | 608 | class OPacketCapturer : public QObject |
563 | { | 609 | { |
564 | Q_OBJECT | 610 | Q_OBJECT |
565 | 611 | ||
566 | public: | 612 | public: |
567 | /** | 613 | /** |
568 | * Constructor. | 614 | * Constructor. |
569 | */ | 615 | */ |
570 | OPacketCapturer( QObject* parent = 0, const char* name = 0 ); | 616 | OPacketCapturer( QObject* parent = 0, const char* name = 0 ); |
571 | /** | 617 | /** |
@@ -644,28 +690,32 @@ class OPacketCapturer : public QObject | |||
644 | QString version() const; | 690 | QString version() const; |
645 | /** | 691 | /** |
646 | * @returns the packet statistic database. | 692 | * @returns the packet statistic database. |
647 | * @see QMap | 693 | * @see QMap |
648 | */ | 694 | */ |
649 | const QMap<QString,int>& statistics() const; | 695 | const QMap<QString,int>& statistics() const; |
650 | 696 | ||
651 | signals: | 697 | signals: |
652 | /** | 698 | /** |
653 | * This signal is emitted, when a packet has been received. | 699 | * This signal is emitted, when a packet has been received. |
654 | */ | 700 | */ |
655 | void receivedPacket( OPacket* ); | 701 | void receivedPacket( OPacket* ); |
656 | 702 | ||
657 | protected slots: | 703 | protected slots: |
658 | void readyToReceive(); | 704 | void readyToReceive(); |
659 | 705 | ||
660 | protected: | 706 | protected: |
661 | QString _name; // devicename | 707 | QString _name; // devicename |
662 | bool _open; // check this before doing pcap calls | 708 | bool _open; // check this before doing pcap calls |
663 | pcap_t* _pch; // pcap library handle | 709 | pcap_t* _pch; // pcap library handle |
664 | pcap_dumper_t* _pcd; // pcap dumper handle | 710 | pcap_dumper_t* _pcd; // pcap dumper handle |
665 | QSocketNotifier* _sn; // socket notifier for main loop | 711 | QSocketNotifier* _sn; // socket notifier for main loop |
666 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap | 712 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap |
667 | QMap<QString, int> _stats; // statistics; | 713 | QMap<QString, int> _stats; // statistics; |
714 | class Private; // Private Forward declaration | ||
715 | Private *d; // if we need to add data | ||
668 | }; | 716 | }; |
717 | } | ||
718 | } | ||
669 | 719 | ||
670 | #endif // OPCAP_H | 720 | #endif // OPCAP_H |
671 | 721 | ||
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp index 8c989d8..140b924 100644 --- a/libopie2/opienet/ostation.cpp +++ b/libopie2/opienet/ostation.cpp | |||
@@ -10,55 +10,63 @@ | |||
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 | #include <opie2/ostation.h> | 31 | #include <opie2/ostation.h> |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | |||
35 | using namespace Opie::Core; | ||
36 | |||
37 | namespace Opie { | ||
38 | namespace Net { | ||
34 | /*====================================================================================== | 39 | /*====================================================================================== |
35 | * OStation | 40 | * OStation |
36 | *======================================================================================*/ | 41 | *======================================================================================*/ |
37 | 42 | ||
38 | OStation::OStation() | 43 | OStation::OStation() |
39 | { | 44 | { |
40 | odebug << "OStation::OStation()" << oendl; | 45 | odebug << "OStation::OStation()" << oendl; |
41 | 46 | ||
42 | type = "<unknown>"; | 47 | type = "<unknown>"; |
43 | macAddress = OMacAddress::unknown; | 48 | macAddress = OMacAddress::unknown; |
44 | ssid = "<unknown>"; | 49 | ssid = "<unknown>"; |
45 | channel = 0; | 50 | channel = 0; |
46 | apAddress = OMacAddress::unknown; | 51 | apAddress = OMacAddress::unknown; |
47 | 52 | ||
48 | } | 53 | } |
49 | 54 | ||
50 | 55 | ||
51 | OStation::~OStation() | 56 | OStation::~OStation() |
52 | { | 57 | { |
53 | odebug << "OStation::~OStation()" << oendl; | 58 | odebug << "OStation::~OStation()" << oendl; |
54 | } | 59 | } |
55 | 60 | ||
56 | 61 | ||
57 | void OStation::dump() | 62 | void OStation::dump() |
58 | { | 63 | { |
59 | odebug << "------- OStation::dump() ------------" << oendl; | 64 | odebug << "------- OStation::dump() ------------" << oendl; |
60 | qDebug( "type: %s", (const char*) type ); | 65 | qDebug( "type: %s", (const char*) type ); |
61 | qDebug( "mac: %s", (const char*) macAddress.toString() ); | 66 | qDebug( "mac: %s", (const char*) macAddress.toString() ); |
62 | qDebug( "ap: %s", (const char*) apAddress.toString() ); | 67 | qDebug( "ap: %s", (const char*) apAddress.toString() ); |
63 | qDebug( "ip: %s", (const char*) ipAddress.toString() ); | 68 | qDebug( "ip: %s", (const char*) ipAddress.toString() ); |
64 | } | 69 | } |
70 | |||
71 | } | ||
72 | } \ No newline at end of file | ||
diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h index 1e7366d..68f1114 100644 --- a/libopie2/opienet/ostation.h +++ b/libopie2/opienet/ostation.h | |||
@@ -19,55 +19,64 @@ | |||
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 | #ifndef OSTATION_H | 31 | #ifndef OSTATION_H |
32 | #define OSTATION_H | 32 | #define OSTATION_H |
33 | 33 | ||
34 | #include <opie2/onetutils.h> | 34 | #include <opie2/onetutils.h> |
35 | 35 | ||
36 | #include <qlist.h> | 36 | #include <qlist.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 | ||
43 | namespace Opie { | ||
44 | namespace Net { | ||
45 | |||
43 | class OStation; | 46 | class OStation; |
44 | 47 | ||
48 | |||
45 | typedef QList<OStation> OStationList; | 49 | typedef QList<OStation> OStationList; |
46 | 50 | ||
47 | /*====================================================================================== | 51 | /*====================================================================================== |
48 | * OStation | 52 | * OStation |
49 | *======================================================================================*/ | 53 | *======================================================================================*/ |
50 | 54 | ||
51 | class OStation | 55 | class OStation |
52 | { | 56 | { |
53 | public: | 57 | public: |
54 | OStation(); | 58 | OStation(); |
55 | ~OStation(); | 59 | ~OStation(); |
56 | 60 | ||
57 | void dump(); | 61 | void dump(); |
58 | 62 | ||
59 | /* Ethernet */ | 63 | /* Ethernet */ |
60 | QString type; | 64 | QString type; |
61 | OMacAddress macAddress; | 65 | OMacAddress macAddress; |
62 | QHostAddress ipAddress; | 66 | QHostAddress ipAddress; |
63 | 67 | ||
64 | /* WaveLan */ | 68 | /* WaveLan */ |
65 | QString ssid; | 69 | QString ssid; |
66 | OMacAddress apAddress; | 70 | OMacAddress apAddress; |
67 | int channel; | 71 | int channel; |
68 | bool encrypted; | 72 | bool encrypted; |
73 | private: | ||
74 | class Private; | ||
75 | Private *d; | ||
69 | }; | 76 | }; |
70 | 77 | ||
78 | } | ||
79 | } | ||
71 | 80 | ||
72 | #endif // OSTATION_H | 81 | #endif // OSTATION_H |
73 | 82 | ||