source: swig/python/check.py @ f2794ea

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since f2794ea was f2794ea, checked in by Daniel Lawson <dlawson@…>, 17 years ago

finished rest of libtrace api.
fixed memleak with calling strdup() on inet_ntoa on ip_src/ip_dst

  • Property mode set to 100755
File size: 526 bytes
Line 
1#!/usr/bin/python
2import libtrace
3import sys
4
5trace = libtrace.Trace(sys.argv[1])
6
7print "trace=",trace
8
9
10packet = libtrace.Packet()
11
12count = 0
13
14filter = libtrace.Filter("tcp and port 80")
15
16while 1:
17        trace.trace_read_packet(packet)
18        if not packet:
19                break
20
21        ippacket = packet.trace_get_ip()
22        if not ippacket:
23                continue
24
25        tcppacket = packet.trace_get_tcp()
26        if not tcppacket:
27                continue
28
29        if not packet.trace_bpf_filter(filter):
30                continue
31
32        print ippacket.ip_src,':',tcppacket.source,'->',ippacket.ip_dst,':',tcppacket.dest
33
Note: See TracBrowser for help on using the repository browser.