|
From: Chad M. <cmm...@us...> - 2005-06-19 16:21:37
|
Update of /cvsroot/seq/showeq/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20497/src Modified Files: Tag: pre_5_0_beta packetcapture.cpp packetstream.cpp Log Message: Added two known bugs to BUGS. Changed the Debug message about dropping packets to a Warning. Added some debugging code to packetcapture that is turned off, just so you can watch and monitor the race between the packet capture thread taking in packets and the main thread processing them and changing the pcap filter. Index: packetstream.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/packetstream.cpp,v retrieving revision 1.1.6.10 retrieving revision 1.1.6.11 diff -u -d -r1.1.6.10 -r1.1.6.11 --- packetstream.cpp 16 May 2005 23:04:16 -0000 1.1.6.10 +++ packetstream.cpp 19 Jun 2005 16:20:55 -0000 1.1.6.11 @@ -261,7 +261,7 @@ // one yet... while(it == m_cache.end()) { - seqDebug("SEQ: Giving up on finding arq %04x in stream %s cache, skipping!", + seqWarn("SEQ: Giving up on finding arq %04x in stream %s cache, skipping!", m_arqSeqExp, EQStreamStr[m_streamid]); // incremente the expected arq sequence number Index: packetcapture.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/packetcapture.cpp,v retrieving revision 1.2.4.4 retrieving revision 1.2.4.5 diff -u -d -r1.2.4.4 -r1.2.4.5 --- packetcapture.cpp 18 Apr 2005 03:16:23 -0000 1.2.4.4 +++ packetcapture.cpp 19 Jun 2005 16:20:55 -0000 1.2.4.5 @@ -12,9 +12,15 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <netinet/ip.h> +#include <netinet/udp.h> +#include <netinet/if_ether.h> +#include <arpa/inet.h> #include "packetcapture.h" #include "diagnosticmessages.h" + +//#define PCAP_DEBUG 1 //---------------------------------------------------------------------- // PacketCaptureThread @@ -230,6 +236,45 @@ memcpy (pc->data, data, ph->len); pc->next = NULL; +#ifdef PCAP_DEBUG + struct ether_header* ethHeader = (struct ether_header*) data; + + if (ntohs(ethHeader->ether_type) == ETHERTYPE_IP) + { + struct ip* ipHeader = + (struct ip*) (data + sizeof(struct ether_header)); + + char src[128]; + strcpy(src, inet_ntoa(ipHeader->ip_src)); + char dst[128]; + strcpy(dst, inet_ntoa(ipHeader->ip_dst)); + + if (ipHeader->ip_p == IPPROTO_UDP) + { + struct udphdr* udpHeader = + (struct udphdr*) (data + sizeof(struct ip) + sizeof(struct ether_header)); + + printf("recv(%d): %s:%d -> %s:%d (size: %d)\n", + ipHeader->ip_p, + src, + ntohs(udpHeader->source), + dst, + ntohs(udpHeader->dest), + ph->len); + } + else + { + printf("Non-UDP traffic %s -> %s\n", + inet_ntoa(ipHeader->ip_src), + inet_ntoa(ipHeader->ip_dst)); + } + } + else + { + printf("Non-IP packet...\n"); + } +#endif + // Throttle offline playback properly if applicable. int speed = myThis->m_playbackSpeed; |