summaryrefslogtreecommitdiff
path: root/orkaudio/audiocaptureplugins/voip/VoIp.cpp
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2006-06-20 20:21:27 +0000
committerHenri Herscher <henri@oreka.org>2006-06-20 20:21:27 +0000
commit0a51c441700be676a20353a72f019d13673ab0fb (patch)
tree1627d51522fc1514d540d939860ed4f03f455619 /orkaudio/audiocaptureplugins/voip/VoIp.cpp
parent37e831162bd5080be5e111a39880a51d4406bcca (diff)
Changed the Filter interface so that filters can also receive capture events, not just audio chunks.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@267 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins/voip/VoIp.cpp')
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index f925a21..9df7a8b 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -453,12 +453,22 @@ void HandlePacket(u_char *param, const struct pcap_pkthdr *header, const u_char
IpHeaderStruct* ipHeader = (IpHeaderStruct*)((char*)ethernetHeader + sizeof(EthernetHeaderStruct));
if(ipHeader->ip_v != 4) // sanity check, is it an IP packet v4
{
- // If not, the IP packet might be wrapped into a 802.1Q VLAN or MPLS header (add 4 bytes)
- ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+4);
+ // If not, the IP packet might have been captured using the tcpdump -i switch
+ ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+2);
if(ipHeader->ip_v != 4)
{
- // Still not an IP packet V4, drop it
- return;
+ // If not, the IP packet might be wrapped into a 802.1Q VLAN or MPLS header (add 4 bytes, ie 2 bytes on top of previous 2)
+ ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+2);
+ if(ipHeader->ip_v != 4)
+ {
+ // If not, the IP packet might be tcpdump -i as well as VLAN, add another 2 bytes
+ ipHeader = (IpHeaderStruct*)((u_char*)ipHeader+2);
+ if(ipHeader->ip_v != 4)
+ {
+ // Still not an IP packet V4, drop it
+ return;
+ }
+ }
}
}
int ipHeaderLength = ipHeader->ip_hl*4;