summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp33
-rw-r--r--libopie2/opienet/udp_ports.h89
2 files changed, 112 insertions, 10 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index cc8ce7f..f1f2b4b 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -41,6 +41,8 @@
41#include <qsocketnotifier.h> 41#include <qsocketnotifier.h>
42#include <qobjectlist.h> 42#include <qobjectlist.h>
43 43
44#include "udp_ports.h"
45
44/*====================================================================================== 46/*======================================================================================
45 * OPacket 47 * OPacket
46 *======================================================================================*/ 48 *======================================================================================*/
@@ -354,6 +356,17 @@ OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QOb
354 356
355{ 357{
356 qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." ); 358 qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." );
359 qDebug( "fromPort = %d", fromPort() );
360 qDebug( " toPort = %d", toPort() );
361
362 // TODO: Make this a case or a hash if we know more udp protocols
363
364 if ( fromPort() == UDP_PORT_BOOTPS || fromPort() == UDP_PORT_BOOTPC ||
365 toPort() == UDP_PORT_BOOTPS || toPort() == UDP_PORT_BOOTPC )
366 {
367 qDebug( "seems to be part of a DHCP conversation => creating DHCP packet." );
368 new ODHCPPacket( end, (const struct dhcp_packet*) (data+1), this );
369 }
357} 370}
358 371
359 372
@@ -364,25 +377,25 @@ OUDPPacket::~OUDPPacket()
364 377
365int OUDPPacket::fromPort() const 378int OUDPPacket::fromPort() const
366{ 379{
367 return _udphdr->source; 380 return EXTRACT_16BITS( &_udphdr->source );
368} 381}
369 382
370 383
371int OUDPPacket::toPort() const 384int OUDPPacket::toPort() const
372{ 385{
373 return _udphdr->dest; 386 return EXTRACT_16BITS( &_udphdr->dest );
374} 387}
375 388
376 389
377int OUDPPacket::length() const 390int OUDPPacket::length() const
378{ 391{
379 return _udphdr->len; 392 return EXTRACT_16BITS( &_udphdr->len );
380} 393}
381 394
382 395
383int OUDPPacket::checksum() const 396int OUDPPacket::checksum() const
384{ 397{
385 return _udphdr->check; 398 return EXTRACT_16BITS( &_udphdr->check );
386} 399}
387 400
388 401
@@ -424,37 +437,37 @@ OTCPPacket::~OTCPPacket()
424 437
425int OTCPPacket::fromPort() const 438int OTCPPacket::fromPort() const
426{ 439{
427 return _tcphdr->source; 440 return EXTRACT_16BITS( &_tcphdr->source );
428} 441}
429 442
430 443
431int OTCPPacket::toPort() const 444int OTCPPacket::toPort() const
432{ 445{
433 return _tcphdr->dest; 446 return EXTRACT_16BITS( &_tcphdr->dest );
434} 447}
435 448
436 449
437int OTCPPacket::seq() const 450int OTCPPacket::seq() const
438{ 451{
439 return _tcphdr->seq; 452 return EXTRACT_16BITS( &_tcphdr->seq );
440} 453}
441 454
442 455
443int OTCPPacket::ack() const 456int OTCPPacket::ack() const
444{ 457{
445 return _tcphdr->ack_seq; 458 return EXTRACT_16BITS( &_tcphdr->ack_seq );
446} 459}
447 460
448 461
449int OTCPPacket::window() const 462int OTCPPacket::window() const
450{ 463{
451 return _tcphdr->window; 464 return EXTRACT_16BITS( &_tcphdr->window );
452} 465}
453 466
454 467
455int OTCPPacket::checksum() const 468int OTCPPacket::checksum() const
456{ 469{
457 return _tcphdr->check; 470 return EXTRACT_16BITS( &_tcphdr->check );
458} 471}
459 472
460/*====================================================================================== 473/*======================================================================================
diff --git a/libopie2/opienet/udp_ports.h b/libopie2/opienet/udp_ports.h
new file mode 100644
index 0000000..5e92497
--- a/dev/null
+++ b/libopie2/opienet/udp_ports.h
@@ -0,0 +1,89 @@
1/*
2 * This file has been generated by doing
3 * find . -name "*"|xargs grep -h '#define UDP_PORT' > udp_ports.h
4 * in the root directory of Ethereal 0.9.15. Cudos to the Ethereal Team.
5 * -- Michael 'Mickey' Lauer <mickeyl@handhelds.org>
6 */
7
8 #define UDP_PORT_AODV654
9#define UDP_PORT_LENGTH 2
10#define UDP_PORT_OFFSET PARAMETER_VALUE_OFFSET
11#define UDP_PORT_RAS1 1718
12#define UDP_PORT_RAS2 1719
13 #define UDP_PORT_CPHA8116
14 #define UDP_PORT_DDTP1052
15 #define UDP_PORT_CUPS631
16 #define UDP_PORT_DLSW 2067
17 #define UDP_PORT_ISAKMP500
18#define UDP_PORT_L2TP 1701
19#define UDP_PORT_IAPP 2313
20#define UDP_PORT_HSRP 1985
21 #define UDP_PORT_SSDP 1900
22 #define UDP_PORT_TACACS49
23 #define UDP_PORT_CLDAP 389
24 #define UDP_PORT_VINES573
25 #define UDP_PORT_NBNS137
26 #define UDP_PORT_NBDGM138
27#define UDP_PORT_XYPLEX 173
28#define UDP_PORT_PIM_RP_DISC 496
29#define UDP_PORT_SLIMP3_V1 1069
30#define UDP_PORT_SLIMP3_V2 3483
31 #define UDP_PORT_RMCP 623
32 #define UDP_PORT_RMCP_SECURE664
33#define UDP_PORT_SYSLOG 514
34 #define UDP_PORT_SNMP 161
35 #define UDP_PORT_SNMP_TRAP162
36#define UDP_PORT_TFTP 69
37#define UDP_PORT_TIME 37
38 #define UDP_PORT_STUN 3478
39 #define UDP_PORT_SRVLOC427
40 #define UDP_PORT_TZSP0x9090
41 #define UDP_PORT_WCCP2048
42#define UDP_PORT_MSPROXY 1745
43#define UDP_PORT_BOOTPS 67
44#define UDP_PORT_BOOTPC 68
45#define UDP_PORT_XDMCP 177
46 #define UDP_PORT_DHCPV6_DOWNSTREAM546
47 #define UDP_PORT_DHCPV6_UPSTREAM547
48#define UDP_PORT_DNS 53
49#define UDP_PORT_MDNS 5353
50#define UDP_PORT_ICP 3130
51 #define UDP_PORT_ICQ4000
52 #define UDP_PORT_IPX 213 /* RFC 1234 */
53#define UDP_PORT_LDP 646
54#define UDP_PORT_LLC1 12000
55#define UDP_PORT_LLC2 12001
56#define UDP_PORT_LLC3 12002
57#define UDP_PORT_LLC4 12003
58#define UDP_PORT_LLC5 12004
59#define UDP_PORT_MIP 434
60 #define UDP_PORT_NCP 524
61 #define UDP_PORT_NTP123
62#define UDP_PORT_RIP 520
63 #define UDP_PORT_SAP9875
64#define UDP_PORT_SIP 5060
65 #define UDP_PORT_TIMED525
66#define UDP_PORT_RIPNG 521
67 #define UDP_PORT_WSP 9200 /* wap-wsp */
68 #define UDP_PORT_WTP_WSP 9201 /* wap-wsp-wtp */
69 #define UDP_PORT_WTLS_WSP 9202 /* wap-wsp-s */
70 #define UDP_PORT_WTLS_WTP_WSP 9203 /* wap-wsp-wtp-s*/
71 #define UDP_PORT_WSP_PUSH 2948 /* wap-wsp */
72 #define UDP_PORT_WTLS_WSP_PUSH 2949 /* wap-wsp-s */
73#define UDP_PORT_WHO 513
74 #define UDP_PORT_KERBEROS 88
75#define UDP_PORT_SFLOW 6343
76#define UDP_PORT_LAPLINK 1547
77 #define UDP_PORT_NETFLOW2055
78 #define UDP_PORT_RX_LOW 7000
79 #define UDP_PORT_RX_HIGH7009
80 #define UDP_PORT_RX_AFS_BACKUPS7021
81#define UDP_PORT_MGCP_GATEWAY 2427
82#define UDP_PORT_MGCP_CALLAGENT 2727
83#define UDP_PORT_PCLI 9000
84#define UDP_PORT_ARTNET 0x1936
85#define UDP_PORT_TERREDO 3544
86 #define UDP_PORT_RADIUS 1645
87 #define UDP_PORT_RADIUS_NEW1812
88 #define UDP_PORT_RADACCT1646
89 #define UDP_PORT_RADACCT_NEW1813