summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-10-02 20:53:58 (UTC)
committer mickeyl <mickeyl>2003-10-02 20:53:58 (UTC)
commit78b29c765dbe70faec614796a4d1421eaf0ec773 (patch) (unidiff)
tree2db88636d14a462d8538003bcd282f3140b1d5f6
parente4fc6c395dd0a7400ed2cf76b3148dd7f535c2ea (diff)
downloadopie-78b29c765dbe70faec614796a4d1421eaf0ec773.zip
opie-78b29c765dbe70faec614796a4d1421eaf0ec773.tar.gz
opie-78b29c765dbe70faec614796a4d1421eaf0ec773.tar.bz2
prepare dhcp decoding
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/dhcp.h200
-rw-r--r--libopie2/opienet/opcap.cpp79
-rw-r--r--libopie2/opienet/opcap.h28
-rw-r--r--libopie2/opienet/opienet.pro4
4 files changed, 309 insertions, 2 deletions
diff --git a/libopie2/opienet/dhcp.h b/libopie2/opienet/dhcp.h
new file mode 100644
index 0000000..3f2f775
--- a/dev/null
+++ b/libopie2/opienet/dhcp.h
@@ -0,0 +1,200 @@
1/* dhcp.h
2
3 Protocol structures... */
4
5/*
6 * Copyright (c) 1995-2001 The Internet Software Consortium.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of The Internet Software Consortium nor the names
19 * of its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
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
34 * SUCH DAMAGE.
35 *
36 * This software has been written for the Internet Software Consortium
37 * by Ted Lemon in cooperation with Vixie Enterprises. To learn more
38 * about the Internet Software Consortium, see ``http://www.isc.org''.
39 * To learn more about Vixie Enterprises, see ``http://www.vix.com''.
40 */
41
42#ifndef DHCP_H
43#define DHCP_H
44
45 #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \
46 20 + /* IP header */ \
47 8) /* UDP header */
48 #define DHCP_SNAME_LEN 64
49 #define DHCP_FILE_LEN 128
50 #define DHCP_FIXED_NON_UDP236
51 #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD)
52 /* Everything but options. */
53 #define DHCP_MTU_MAX 1500
54 #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN)
55
56 #define BOOTP_MIN_LEN 300
57#define DHCP_MIN_LEN 548
58
59struct dhcp_packet {
60 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 hlen; /* 2: Hardware addr length */
63 u_int8_t hops; /* 3: Number of relay agent hops from client */
64 u_int32_t xid; /* 4: Transaction ID */
65 u_int16_t secs; /* 8: Seconds since client started looking */
66 u_int16_t flags;/* 10: Flag bits */
67 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 siaddr;/* 18: IP address of next server to talk to */
70 struct in_addr giaddr;/* 20: DHCP relay agent IP address */
71 unsigned char chaddr [16];/* 24: Client hardware address */
72 char sname [DHCP_SNAME_LEN];/* 40: Server name */
73 char file [DHCP_FILE_LEN];/* 104: Boot filename */
74 unsigned char options [DHCP_OPTION_LEN];
75 /* 212: Optional parameters
76 (actual length dependent on MTU). */
77};
78
79/* BOOTP (rfc951) message types */
80 #define BOOTREQUEST1
81 #define BOOTREPLY2
82
83/* Possible values for flags field... */
84#define BOOTP_BROADCAST 32768L
85
86/* Possible values for hardware type (htype) field... */
87 #define HTYPE_ETHER1 /* Ethernet 10Mbps */
88 #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring...*/
89 #define HTYPE_FDDI 8 /* FDDI... */
90
91/* Magic cookie validating dhcp options field (and bootp vendor
92 extensions field). */
93 #define DHCP_OPTIONS_COOKIE"\143\202\123\143"
94
95/* DHCP Option codes: */
96
97 #define DHO_PAD 0
98 #define DHO_SUBNET_MASK 1
99 #define DHO_TIME_OFFSET 2
100 #define DHO_ROUTERS 3
101 #define DHO_TIME_SERVERS 4
102 #define DHO_NAME_SERVERS 5
103 #define DHO_DOMAIN_NAME_SERVERS 6
104 #define DHO_LOG_SERVERS 7
105 #define DHO_COOKIE_SERVERS 8
106 #define DHO_LPR_SERVERS 9
107 #define DHO_IMPRESS_SERVERS 10
108 #define DHO_RESOURCE_LOCATION_SERVERS11
109 #define DHO_HOST_NAME 12
110 #define DHO_BOOT_SIZE 13
111 #define DHO_MERIT_DUMP 14
112 #define DHO_DOMAIN_NAME 15
113 #define DHO_SWAP_SERVER 16
114 #define DHO_ROOT_PATH 17
115 #define DHO_EXTENSIONS_PATH 18
116 #define DHO_IP_FORWARDING 19
117 #define DHO_NON_LOCAL_SOURCE_ROUTING20
118 #define DHO_POLICY_FILTER 21
119 #define DHO_MAX_DGRAM_REASSEMBLY22
120 #define DHO_DEFAULT_IP_TTL 23
121 #define DHO_PATH_MTU_AGING_TIMEOUT24
122 #define DHO_PATH_MTU_PLATEAU_TABLE25
123 #define DHO_INTERFACE_MTU 26
124 #define DHO_ALL_SUBNETS_LOCAL 27
125 #define DHO_BROADCAST_ADDRESS 28
126 #define DHO_PERFORM_MASK_DISCOVERY29
127 #define DHO_MASK_SUPPLIER 30
128 #define DHO_ROUTER_DISCOVERY 31
129 #define DHO_ROUTER_SOLICITATION_ADDRESS32
130 #define DHO_STATIC_ROUTES 33
131 #define DHO_TRAILER_ENCAPSULATION34
132 #define DHO_ARP_CACHE_TIMEOUT 35
133 #define DHO_IEEE802_3_ENCAPSULATION36
134 #define DHO_DEFAULT_TCP_TTL 37
135 #define DHO_TCP_KEEPALIVE_INTERVAL38
136 #define DHO_TCP_KEEPALIVE_GARBAGE39
137 #define DHO_NIS_DOMAIN 40
138 #define DHO_NIS_SERVERS 41
139 #define DHO_NTP_SERVERS 42
140 #define DHO_VENDOR_ENCAPSULATED_OPTIONS43
141 #define DHO_NETBIOS_NAME_SERVERS44
142 #define DHO_NETBIOS_DD_SERVER 45
143 #define DHO_NETBIOS_NODE_TYPE 46
144 #define DHO_NETBIOS_SCOPE 47
145 #define DHO_FONT_SERVERS 48
146 #define DHO_X_DISPLAY_MANAGER 49
147 #define DHO_DHCP_REQUESTED_ADDRESS50
148 #define DHO_DHCP_LEASE_TIME 51
149 #define DHO_DHCP_OPTION_OVERLOAD52
150 #define DHO_DHCP_MESSAGE_TYPE 53
151 #define DHO_DHCP_SERVER_IDENTIFIER54
152 #define DHO_DHCP_PARAMETER_REQUEST_LIST55
153 #define DHO_DHCP_MESSAGE 56
154 #define DHO_DHCP_MAX_MESSAGE_SIZE57
155 #define DHO_DHCP_RENEWAL_TIME 58
156 #define DHO_DHCP_REBINDING_TIME 59
157 #define DHO_VENDOR_CLASS_IDENTIFIER60
158 #define DHO_DHCP_CLIENT_IDENTIFIER61
159 #define DHO_NWIP_DOMAIN_NAME 62
160 #define DHO_NWIP_SUBOPTIONS 63
161 #define DHO_USER_CLASS 77
162 #define DHO_FQDN 81
163 #define DHO_DHCP_AGENT_OPTIONS 82
164 #define DHO_SUBNET_SELECTION 118 /* RFC3011! */
165/* The DHO_AUTHENTICATE option is not a standard yet, so I've
166 allocated an option out of the "local" option space for it on a
167 temporary basis. Once an option code number is assigned, I will
168 immediately and shamelessly break this, so don't count on it
169 continuing to work. */
170 #define DHO_AUTHENTICATE 210
171
172 #define DHO_END 255
173
174/* DHCP message types. */
175 #define DHCPDISCOVER1
176 #define DHCPOFFER2
177 #define DHCPREQUEST3
178 #define DHCPDECLINE4
179 #define DHCPACK 5
180 #define DHCPNAK 6
181 #define DHCPRELEASE7
182 #define DHCPINFORM8
183
184/* Relay Agent Information option subtypes: */
185 #define RAI_CIRCUIT_ID1
186 #define RAI_REMOTE_ID2
187 #define RAI_AGENT_ID3
188
189/* FQDN suboptions: */
190 #define FQDN_NO_CLIENT_UPDATE 1
191 #define FQDN_SERVER_UPDATE 2
192 #define FQDN_ENCODED 3
193 #define FQDN_RCODE1 4
194 #define FQDN_RCODE2 5
195 #define FQDN_HOSTNAME 6
196 #define FQDN_DOMAINNAME 7
197 #define FQDN_FQDN 8
198 #define FQDN_SUBOPTION_COUNT 8
199
200#endif \ No newline at end of file
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 1de7124..cc8ce7f 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -327,86 +327,165 @@ QHostAddress OARPPacket::senderIPV4Address() const
327 327
328 328
329QHostAddress OARPPacket::targetIPV4Address() const 329QHostAddress OARPPacket::targetIPV4Address() const
330{ 330{
331 return EXTRACT_32BITS( &_arphdr->ar_tip ); 331 return EXTRACT_32BITS( &_arphdr->ar_tip );
332} 332}
333 333
334 334
335OMacAddress OARPPacket::senderMacAddress() const 335OMacAddress OARPPacket::senderMacAddress() const
336{ 336{
337 return OMacAddress( _arphdr->ar_sha ); 337 return OMacAddress( _arphdr->ar_sha );
338} 338}
339 339
340 340
341OMacAddress OARPPacket::targetMacAddress() const 341OMacAddress OARPPacket::targetMacAddress() const
342{ 342{
343 return OMacAddress( _arphdr->ar_tha ); 343 return OMacAddress( _arphdr->ar_tha );
344} 344}
345 345
346 346
347/*====================================================================================== 347/*======================================================================================
348 * OUDPPacket 348 * OUDPPacket
349 *======================================================================================*/ 349 *======================================================================================*/
350 350
351 351
352OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent ) 352OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent )
353 :QObject( parent, "UDP" ), _udphdr( data ) 353 :QObject( parent, "UDP" ), _udphdr( data )
354 354
355{ 355{
356 qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." ); 356 qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." );
357} 357}
358 358
359
359OUDPPacket::~OUDPPacket() 360OUDPPacket::~OUDPPacket()
360{ 361{
361} 362}
362 363
363 364
365int OUDPPacket::fromPort() const
366{
367 return _udphdr->source;
368}
369
370
371int OUDPPacket::toPort() const
372{
373 return _udphdr->dest;
374}
375
376
377int OUDPPacket::length() const
378{
379 return _udphdr->len;
380}
381
382
383int OUDPPacket::checksum() const
384{
385 return _udphdr->check;
386}
387
388
389/*======================================================================================
390 * ODHCPPacket
391 *======================================================================================*/
392
393
394ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* data, QObject* parent )
395 :QObject( parent, "DHCP" ), _dhcphdr( data )
396
397{
398 qDebug( "ODHCPPacket::ODHCPPacket(): decoding DHCP information..." );
399}
400
401
402ODHCPPacket::~ODHCPPacket()
403{
404}
405
406
364/*====================================================================================== 407/*======================================================================================
365 * OTCPPacket 408 * OTCPPacket
366 *======================================================================================*/ 409 *======================================================================================*/
367 410
368 411
369OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent ) 412OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent )
370 :QObject( parent, "TCP" ), _tcphdr( data ) 413 :QObject( parent, "TCP" ), _tcphdr( data )
371 414
372{ 415{
373 qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." ); 416 qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." );
374} 417}
375 418
419
376OTCPPacket::~OTCPPacket() 420OTCPPacket::~OTCPPacket()
377{ 421{
378} 422}
379 423
380 424
425int OTCPPacket::fromPort() const
426{
427 return _tcphdr->source;
428}
429
430
431int OTCPPacket::toPort() const
432{
433 return _tcphdr->dest;
434}
435
436
437int OTCPPacket::seq() const
438{
439 return _tcphdr->seq;
440}
441
442
443int OTCPPacket::ack() const
444{
445 return _tcphdr->ack_seq;
446}
447
448
449int OTCPPacket::window() const
450{
451 return _tcphdr->window;
452}
453
454
455int OTCPPacket::checksum() const
456{
457 return _tcphdr->check;
458}
459
381/*====================================================================================== 460/*======================================================================================
382 * OPrismHeaderPacket 461 * OPrismHeaderPacket
383 *======================================================================================*/ 462 *======================================================================================*/
384 463
385 464
386OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent ) 465OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent )
387 :QObject( parent, "Prism" ), _header( data ) 466 :QObject( parent, "Prism" ), _header( data )
388 467
389{ 468{
390 qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." ); 469 qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." );
391 470
392 qDebug( "Signal Strength = %d", data->signal.data ); 471 qDebug( "Signal Strength = %d", data->signal.data );
393 472
394 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this ); 473 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this );
395} 474}
396 475
397OPrismHeaderPacket::~OPrismHeaderPacket() 476OPrismHeaderPacket::~OPrismHeaderPacket()
398{ 477{
399} 478}
400 479
401 480
402unsigned int OPrismHeaderPacket::signalStrength() const 481unsigned int OPrismHeaderPacket::signalStrength() const
403{ 482{
404 return _header->signal.data; 483 return _header->signal.data;
405} 484}
406 485
407/*====================================================================================== 486/*======================================================================================
408 * OWaveLanPacket 487 * OWaveLanPacket
409 *======================================================================================*/ 488 *======================================================================================*/
410 489
411 490
412OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent ) 491OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent )
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index 9119972..0c9e7da 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -26,65 +26,68 @@
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef OPCAP_H 34#ifndef OPCAP_H
35#define OPCAP_H 35#define OPCAP_H
36 36
37/* LINUX */ 37/* LINUX */
38extern "C" // work around a bpf/pcap conflict in recent headers 38extern "C" // work around a bpf/pcap conflict in recent headers
39{ 39{
40 #include <pcap.h> 40 #include <pcap.h>
41} 41}
42#include <netinet/ether.h> 42#include <netinet/ether.h>
43#include <netinet/ip.h> 43#include <netinet/ip.h>
44#include <netinet/udp.h> 44#include <netinet/udp.h>
45#include <netinet/tcp.h> 45#include <netinet/tcp.h>
46#include <time.h> 46#include <time.h>
47 47
48/* QT */ 48/* QT */
49#include <qevent.h> 49#include <qevent.h>
50#include <qfile.h> 50#include <qfile.h>
51#include <qhostaddress.h> 51#include <qhostaddress.h>
52#include <qobject.h> 52#include <qobject.h>
53#include <qstring.h> 53#include <qstring.h>
54#include <qmap.h> 54#include <qmap.h>
55 55
56/* OPIE */ 56/* OPIE */
57#include <opie2/onetutils.h> 57#include <opie2/onetutils.h>
58
59/* Custom Network Includes */
58#include "802_11_user.h" 60#include "802_11_user.h"
61#include "dhcp.h"
59 62
60/* TYPEDEFS */ 63/* TYPEDEFS */
61typedef struct timeval timevalstruct; 64typedef struct timeval timevalstruct;
62typedef struct pcap_pkthdr packetheaderstruct; 65typedef struct pcap_pkthdr packetheaderstruct;
63 66
64/* FORWARDS */ 67/* FORWARDS */
65class OPacketCapturer; 68class OPacketCapturer;
66class QSocketNotifier; 69class QSocketNotifier;
67 70
68/*====================================================================================== 71/*======================================================================================
69 * OPacket - A frame on the wire 72 * OPacket - A frame on the wire
70 *======================================================================================*/ 73 *======================================================================================*/
71 74
72/** @brief A class representing a data frame on the wire. 75/** @brief A class representing a data frame on the wire.
73 * 76 *
74 * The whole family of the packet classes are used when capturing frames from a network. 77 * The whole family of the packet classes are used when capturing frames from a network.
75 * Most standard network protocols in use share a common architecture, which mostly is 78 * Most standard network protocols in use share a common architecture, which mostly is
76 * a packet header and then the packet payload. In layered architectures, each lower layer 79 * a packet header and then the packet payload. In layered architectures, each lower layer
77 * encapsulates data from its upper layer - that is it 80 * encapsulates data from its upper layer - that is it
78 * treats the data from its upper layer as payload and prepends an own header to the packet, 81 * treats the data from its upper layer as payload and prepends an own header to the packet,
79 * which - again - is treated as the payload for the layer below. The figure below is an 82 * which - again - is treated as the payload for the layer below. The figure below is an
80 * example for how such a data frame is composed out of packets, e.g. when sending a mail. 83 * example for how such a data frame is composed out of packets, e.g. when sending a mail.
81 * 84 *
82 * <pre> 85 * <pre>
83 * | User Data | == Mail Data 86 * | User Data | == Mail Data
84 * | SMTP Header | User Data | == SMTP 87 * | SMTP Header | User Data | == SMTP
85 * | TCP Header | SMTP Header | User Data | == TCP 88 * | TCP Header | SMTP Header | User Data | == TCP
86 * | IP Header | TCP Header | SMTP Header | User Data | == IP 89 * | IP Header | TCP Header | SMTP Header | User Data | == IP
87 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC 90 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC
88 * 91 *
89 * </pre> 92 * </pre>
90 * 93 *
@@ -448,98 +451,121 @@ class OARPPacket : public QObject
448 Q_OBJECT 451 Q_OBJECT
449 452
450 public: 453 public:
451 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); 454 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 );
452 virtual ~OARPPacket(); 455 virtual ~OARPPacket();
453 456
454 QHostAddress senderIPV4Address() const; 457 QHostAddress senderIPV4Address() const;
455 OMacAddress senderMacAddress() const; 458 OMacAddress senderMacAddress() const;
456 QHostAddress targetIPV4Address() const; 459 QHostAddress targetIPV4Address() const;
457 OMacAddress targetMacAddress() const; 460 OMacAddress targetMacAddress() const;
458 461
459 //int type() const; 462 //int type() const;
460 QString type() const; 463 QString type() const;
461 464
462 private: 465 private:
463 const struct myarphdr* _arphdr; 466 const struct myarphdr* _arphdr;
464}; 467};
465 468
466/*====================================================================================== 469/*======================================================================================
467 * OUDPPacket 470 * OUDPPacket
468 *======================================================================================*/ 471 *======================================================================================*/
469 472
470class OUDPPacket : public QObject 473class OUDPPacket : public QObject
471{ 474{
472 Q_OBJECT 475 Q_OBJECT
473 476
474 public: 477 public:
475 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); 478 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 );
476 virtual ~OUDPPacket(); 479 virtual ~OUDPPacket();
477 480
478 int fromPort() const; 481 int fromPort() const;
479 int toPort() const; 482 int toPort() const;
483 int length() const;
484 int checksum() const;
480 485
481 private: 486 private:
482 const struct udphdr* _udphdr; 487 const struct udphdr* _udphdr;
483}; 488};
484 489
485/*====================================================================================== 490/*======================================================================================
491 * ODHCPPacket
492 *======================================================================================*/
493
494class ODHCPPacket : public QObject
495{
496 Q_OBJECT
497
498 public:
499 ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 );
500 virtual ~ODHCPPacket();
501
502 private:
503 const struct dhcp_packet* _dhcphdr;
504};
505
506/*======================================================================================
486 * OTCPPacket 507 * OTCPPacket
487 *======================================================================================*/ 508 *======================================================================================*/
488 509
489class OTCPPacket : public QObject 510class OTCPPacket : public QObject
490{ 511{
491 Q_OBJECT 512 Q_OBJECT
492 513
493 public: 514 public:
494 OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); 515 OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 );
495 virtual ~OTCPPacket(); 516 virtual ~OTCPPacket();
496 517
497 int fromPort() const; 518 int fromPort() const;
498 int toPort() const; 519 int toPort() const;
520 int seq() const;
521 int ack() const;
522 int window() const;
523 int checksum() const;
499 524
500 private: 525 private:
501 const struct tcphdr* _tcphdr; 526 const struct tcphdr* _tcphdr;
502}; 527};
503 528
504 529
505/*====================================================================================== 530/*======================================================================================
506 * OPacketCapturer 531 * OPacketCapturer
507 *======================================================================================*/ 532 *======================================================================================*/
508 533
509/** 534/**
510 * @brief A class based wrapper for network packet capturing. 535 * @brief A class based wrapper for network packet capturing.
511 * 536 *
512 * This class is the base of a high-level interface to the well known packet capturing 537 * This class is the base of a high-level interface to the well known packet capturing
513 * library libpcap. ... 538 * library libpcap.
539 * @see http://tcpdump.org
514 */ 540 */
515class OPacketCapturer : public QObject 541class OPacketCapturer : public QObject
516{ 542{
517 Q_OBJECT 543 Q_OBJECT
518 544
519 public: 545 public:
520 /** 546 /**
521 * Constructor. 547 * Constructor.
522 */ 548 */
523 OPacketCapturer( QObject* parent = 0, const char* name = 0 ); 549 OPacketCapturer( QObject* parent = 0, const char* name = 0 );
524 /** 550 /**
525 * Destructor. 551 * Destructor.
526 */ 552 */
527 ~OPacketCapturer(); 553 ~OPacketCapturer();
528 /** 554 /**
529 * Set the packet capturer to use blocking or non-blocking IO. This can be useful when 555 * Set the packet capturer to use blocking or non-blocking IO. This can be useful when
530 * not using the socket notifier, e.g. without an application object. 556 * not using the socket notifier, e.g. without an application object.
531 */ 557 */
532 void setBlocking( bool ); 558 void setBlocking( bool );
533 /** 559 /**
534 * @returns true if the packet capturer uses blocking IO calls. 560 * @returns true if the packet capturer uses blocking IO calls.
535 */ 561 */
536 bool blocking() const; 562 bool blocking() const;
537 /** 563 /**
538 * Close the packet capturer. This is automatically done in the destructor. 564 * Close the packet capturer. This is automatically done in the destructor.
539 */ 565 */
540 void close(); 566 void close();
541 /** 567 /**
542 * Close the output capture file. 568 * Close the output capture file.
543 */ 569 */
544 void closeDumpFile(); 570 void closeDumpFile();
545 /** 571 /**
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index 93389db..7a7adde 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -1,28 +1,30 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = omanufacturerdb.cpp \ 4HEADERS = 802_11_user.h \
5 dhcp.h \
6 omanufacturerdb.cpp \
5 onetutils.cpp \ 7 onetutils.cpp \
6 onetwork.h \ 8 onetwork.h \
7 opcap.h 9 opcap.h
8SOURCES = omanufacturerdb.cpp \ 10SOURCES = omanufacturerdb.cpp \
9 onetutils.cpp \ 11 onetutils.cpp \
10 onetwork.cpp \ 12 onetwork.cpp \
11 opcap.cpp 13 opcap.cpp
12INTERFACES = 14INTERFACES =
13TARGET = opienet2 15TARGET = opienet2
14VERSION = 1.8.1 16VERSION = 1.8.1
15INCLUDEPATH += $(OPIEDIR)/include 17INCLUDEPATH += $(OPIEDIR)/include
16DEPENDPATH += $(OPIEDIR)/include 18DEPENDPATH += $(OPIEDIR)/include
17LIBS += -lpcap 19LIBS += -lpcap
18MOC_DIR = moc 20MOC_DIR = moc
19OBJECTS_DIR = obj 21OBJECTS_DIR = obj
20 22
21 23
22!contains( platform, x11 ) { 24!contains( platform, x11 ) {
23 include ( $(OPIEDIR)/include.pro ) 25 include ( $(OPIEDIR)/include.pro )
24} 26}
25 27
26contains( platform, x11 ) { 28contains( platform, x11 ) {
27 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 29 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
28} 30}