Changeset f2794ea for swig/python


Ignore:
Timestamp:
09/21/04 15:32:23 (17 years ago)
Author:
Daniel Lawson <dlawson@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
d5e7d91
Parents:
6f34090
Message:

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

Location:
swig/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • swig/python/check.py

    r6f34090 rf2794ea  
    1111
    1212count = 0
     13
     14filter = libtrace.Filter("tcp and port 80")
     15
    1316while 1:
    1417        trace.trace_read_packet(packet)
    1518        if not packet:
    1619                break
     20
    1721        ippacket = packet.trace_get_ip()
    1822        if not ippacket:
    1923                continue
    2024
    21         count += 1
    22         if count % 10000 == 0:
    23                 print count
    24         #print packet.size
    25 #       print ippacket.ip_src,'->',ippacket.ip_dst
     25        tcppacket = packet.trace_get_tcp()
     26        if not tcppacket:
     27                continue
    2628
     29        if not packet.trace_bpf_filter(filter):
     30                continue
     31
     32        print ippacket.ip_src,':',tcppacket.source,'->',ippacket.ip_dst,':',tcppacket.dest
     33
  • swig/python/libtrace.py

    r6f34090 rf2794ea  
    290290    def trace_get_udp(*args): return _libtrace.Packet_trace_get_udp(*args)
    291291    def trace_get_icmp(*args): return _libtrace.Packet_trace_get_icmp(*args)
     292    def trace_get_link(*args): return _libtrace.Packet_trace_get_link(*args)
    292293    def trace_get_seconds(*args): return _libtrace.Packet_trace_get_seconds(*args)
     294    def trace_get_erf_timestamp(*args): return _libtrace.Packet_trace_get_erf_timestamp(*args)
     295    def trace_get_timeval(*args): return _libtrace.Packet_trace_get_timeval(*args)
     296    def trace_get_capture_length(*args): return _libtrace.Packet_trace_get_capture_length(*args)
     297    def trace_get_wire_lenth(*args): return _libtrace.Packet_trace_get_wire_lenth(*args)
     298    def trace_get_link_type(*args): return _libtrace.Packet_trace_get_link_type(*args)
     299    def trace_get_direction(*args): return _libtrace.Packet_trace_get_direction(*args)
     300    def trace_bpf_filter(*args): return _libtrace.Packet_trace_bpf_filter(*args)
    293301
    294302class PacketPtr(Packet):
     
    298306        _swig_setattr(self, Packet,self.__class__,Packet)
    299307_libtrace.Packet_swigregister(PacketPtr)
     308
     309class Filter(_object):
     310    __swig_setmethods__ = {}
     311    __setattr__ = lambda self, name, value: _swig_setattr(self, Filter, name, value)
     312    __swig_getmethods__ = {}
     313    __getattr__ = lambda self, name: _swig_getattr(self, Filter, name)
     314    def __repr__(self):
     315        return "<C libtrace_filter_t instance at %s>" % (self.this,)
     316    def __init__(self, *args):
     317        _swig_setattr(self, Filter, 'this', _libtrace.new_Filter(*args))
     318        _swig_setattr(self, Filter, 'thisown', 1)
     319    def trace_bpf_filter(*args): return _libtrace.Filter_trace_bpf_filter(*args)
     320
     321class FilterPtr(Filter):
     322    def __init__(self, this):
     323        _swig_setattr(self, Filter, 'this', this)
     324        if not hasattr(self,"thisown"): _swig_setattr(self, Filter, 'thisown', 0)
     325        _swig_setattr(self, Filter,self.__class__,Filter)
     326_libtrace.Filter_swigregister(FilterPtr)
    300327
    301328class Trace(_object):
Note: See TracChangeset for help on using the changeset viewer.