Changeset f2794ea for swig


Ignore:
Timestamp:
09/21/04 15:32:23 (16 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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • swig/libtrace.i

    r6f34090 rf2794ea  
    163163                return trace_get_icmp(self);
    164164        }
     165        void *trace_get_link() {
     166                return trace_get_link(self);
     167        }
    165168        double trace_get_seconds() {
    166169                return trace_get_seconds(self);
     170        }
     171        uint64_t trace_get_erf_timestamp() {
     172                return trace_get_erf_timestamp(self);
     173        }
     174        struct timeval trace_get_timeval() {
     175                return trace_get_timeval(self);
     176        }
     177        int trace_get_capture_length() {
     178                return trace_get_capture_length(self);
     179        }
     180        int trace_get_wire_lenth() {
     181                return trace_get_wire_length(self);
     182        }
     183        libtrace_linktype_t trace_get_link_type() {
     184                return trace_get_link_type(self);
     185        }
     186        uint8_t trace_get_direction() {
     187                return trace_get_direction(self);
     188        }
     189        int trace_bpf_filter(struct libtrace_filter_t *filter) {
     190                return trace_bpf_filter(filter,self);
     191        }
     192       
     193};
     194
     195%rename (Filter) libtrace_filter_t;
     196struct libtrace_filter_t {};
     197
     198%extend libtrace_filter_t {
     199        libtrace_filter_t(char *filterstring) {
     200                return trace_bpf_setfilter(filterstring);
     201        };
     202        int trace_bpf_filter(struct libtrace_packet_t *packet) {
     203                return trace_bpf_filter(self,packet);
    167204        }
    168205};
  • swig/libtrace_wrap.c

    r6f34090 rf2794ea  
    684684/* -------- TYPES TABLE (BEGIN) -------- */
    685685
    686 #define  SWIGTYPE_p_in_addr swig_types[0]
    687 #define  SWIGTYPE_p_libtrace_icmp swig_types[1]
    688 #define  SWIGTYPE_p_libtrace_icmp_un_echo swig_types[2]
    689 #define  SWIGTYPE_p_libtrace_packet_t swig_types[3]
    690 #define  SWIGTYPE_p_libtrace_ip swig_types[4]
    691 #define  SWIGTYPE_p_libtrace_icmp_un_frag swig_types[5]
    692 #define  SWIGTYPE_p_libtrace_t swig_types[6]
    693 #define  SWIGTYPE_p_libtrace_udp swig_types[7]
    694 #define  SWIGTYPE_p_libtrace_tcp swig_types[8]
    695 #define  SWIGTYPE_p_libtrace_icmp_un swig_types[9]
    696 static swig_type_info *swig_types[11];
     686#define  SWIGTYPE_p_libtrace_t swig_types[0]
     687#define  SWIGTYPE_p_libtrace_udp swig_types[1]
     688#define  SWIGTYPE_p_libtrace_ip swig_types[2]
     689#define  SWIGTYPE_p_libtrace_icmp_un_echo swig_types[3]
     690#define  SWIGTYPE_p_libtrace_icmp_un swig_types[4]
     691#define  SWIGTYPE_p_uint64_t swig_types[5]
     692#define  SWIGTYPE_p_void swig_types[6]
     693#define  SWIGTYPE_p_libtrace_packet_t swig_types[7]
     694#define  SWIGTYPE_p_libtrace_filter_t swig_types[8]
     695#define  SWIGTYPE_p_libtrace_icmp_un_frag swig_types[9]
     696#define  SWIGTYPE_p_timeval swig_types[10]
     697#define  SWIGTYPE_p_libtrace_icmp swig_types[11]
     698#define  SWIGTYPE_p_in_addr swig_types[12]
     699#define  SWIGTYPE_p_libtrace_tcp swig_types[13]
     700#define  SWIGTYPE_p_libtrace_linktype_t swig_types[14]
     701static swig_type_info *swig_types[16];
    697702
    698703/* -------- TYPES TABLE (END) -------- */
     
    795800                return trace_get_icmp(self);
    796801        }
     802void *libtrace_packet_t_trace_get_link(struct libtrace_packet_t *self){
     803                return trace_get_link(self);
     804        }
    797805double libtrace_packet_t_trace_get_seconds(struct libtrace_packet_t *self){
    798806                return trace_get_seconds(self);
     807        }
     808uint64_t libtrace_packet_t_trace_get_erf_timestamp(struct libtrace_packet_t *self){
     809                return trace_get_erf_timestamp(self);
     810        }
     811struct timeval libtrace_packet_t_trace_get_timeval(struct libtrace_packet_t *self){
     812                return trace_get_timeval(self);
     813        }
     814int libtrace_packet_t_trace_get_capture_length(struct libtrace_packet_t *self){
     815                return trace_get_capture_length(self);
     816        }
     817int libtrace_packet_t_trace_get_wire_lenth(struct libtrace_packet_t *self){
     818                return trace_get_wire_length(self);
     819        }
     820libtrace_linktype_t libtrace_packet_t_trace_get_link_type(struct libtrace_packet_t *self){
     821                return trace_get_link_type(self);
     822        }
     823uint8_t libtrace_packet_t_trace_get_direction(struct libtrace_packet_t *self){
     824                return trace_get_direction(self);
     825        }
     826int libtrace_packet_t_trace_bpf_filter(struct libtrace_packet_t *self,struct libtrace_filter_t *filter){
     827                return trace_bpf_filter(filter,self);
     828        }
     829struct libtrace_filter_t *new_libtrace_filter_t(char *filterstring){
     830                return trace_bpf_setfilter(filterstring);
     831        }
     832int libtrace_filter_t_trace_bpf_filter(struct libtrace_filter_t *self,struct libtrace_packet_t *packet){
     833                return trace_bpf_filter(self,packet);
    799834        }
    800835struct libtrace_t *new_libtrace_t(char *uri){ return trace_create(uri); }
     
    21502185
    21512186
     2187static PyObject *_wrap_Packet_trace_get_link(PyObject *self, PyObject *args) {
     2188    PyObject *resultobj;
     2189    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2190    void *result;
     2191    PyObject * obj0 = 0 ;
     2192   
     2193    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_link",&obj0)) goto fail;
     2194    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2195    result = (void *)libtrace_packet_t_trace_get_link(arg1);
     2196   
     2197    resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_void, 0);
     2198    return resultobj;
     2199    fail:
     2200    return NULL;
     2201}
     2202
     2203
    21522204static PyObject *_wrap_Packet_trace_get_seconds(PyObject *self, PyObject *args) {
    21532205    PyObject *resultobj;
     
    21612213   
    21622214    resultobj = PyFloat_FromDouble(result);
     2215    return resultobj;
     2216    fail:
     2217    return NULL;
     2218}
     2219
     2220
     2221static PyObject *_wrap_Packet_trace_get_erf_timestamp(PyObject *self, PyObject *args) {
     2222    PyObject *resultobj;
     2223    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2224    uint64_t result;
     2225    PyObject * obj0 = 0 ;
     2226   
     2227    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_erf_timestamp",&obj0)) goto fail;
     2228    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2229    result = libtrace_packet_t_trace_get_erf_timestamp(arg1);
     2230   
     2231    {
     2232        uint64_t * resultptr;
     2233        resultptr = (uint64_t *) malloc(sizeof(uint64_t));
     2234        memmove(resultptr, &result, sizeof(uint64_t));
     2235        resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_uint64_t, 1);
     2236    }
     2237    return resultobj;
     2238    fail:
     2239    return NULL;
     2240}
     2241
     2242
     2243static PyObject *_wrap_Packet_trace_get_timeval(PyObject *self, PyObject *args) {
     2244    PyObject *resultobj;
     2245    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2246    struct timeval result;
     2247    PyObject * obj0 = 0 ;
     2248   
     2249    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_timeval",&obj0)) goto fail;
     2250    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2251    result = libtrace_packet_t_trace_get_timeval(arg1);
     2252   
     2253    {
     2254        struct timeval * resultptr;
     2255        resultptr = (struct timeval *) malloc(sizeof(struct timeval));
     2256        memmove(resultptr, &result, sizeof(struct timeval));
     2257        resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_timeval, 1);
     2258    }
     2259    return resultobj;
     2260    fail:
     2261    return NULL;
     2262}
     2263
     2264
     2265static PyObject *_wrap_Packet_trace_get_capture_length(PyObject *self, PyObject *args) {
     2266    PyObject *resultobj;
     2267    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2268    int result;
     2269    PyObject * obj0 = 0 ;
     2270   
     2271    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_capture_length",&obj0)) goto fail;
     2272    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2273    result = (int)libtrace_packet_t_trace_get_capture_length(arg1);
     2274   
     2275    resultobj = PyInt_FromLong((long)result);
     2276    return resultobj;
     2277    fail:
     2278    return NULL;
     2279}
     2280
     2281
     2282static PyObject *_wrap_Packet_trace_get_wire_lenth(PyObject *self, PyObject *args) {
     2283    PyObject *resultobj;
     2284    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2285    int result;
     2286    PyObject * obj0 = 0 ;
     2287   
     2288    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_wire_lenth",&obj0)) goto fail;
     2289    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2290    result = (int)libtrace_packet_t_trace_get_wire_lenth(arg1);
     2291   
     2292    resultobj = PyInt_FromLong((long)result);
     2293    return resultobj;
     2294    fail:
     2295    return NULL;
     2296}
     2297
     2298
     2299static PyObject *_wrap_Packet_trace_get_link_type(PyObject *self, PyObject *args) {
     2300    PyObject *resultobj;
     2301    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2302    libtrace_linktype_t result;
     2303    PyObject * obj0 = 0 ;
     2304   
     2305    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_link_type",&obj0)) goto fail;
     2306    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2307    result = libtrace_packet_t_trace_get_link_type(arg1);
     2308   
     2309    {
     2310        libtrace_linktype_t * resultptr;
     2311        resultptr = (libtrace_linktype_t *) malloc(sizeof(libtrace_linktype_t));
     2312        memmove(resultptr, &result, sizeof(libtrace_linktype_t));
     2313        resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_libtrace_linktype_t, 1);
     2314    }
     2315    return resultobj;
     2316    fail:
     2317    return NULL;
     2318}
     2319
     2320
     2321static PyObject *_wrap_Packet_trace_get_direction(PyObject *self, PyObject *args) {
     2322    PyObject *resultobj;
     2323    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2324    uint8_t result;
     2325    PyObject * obj0 = 0 ;
     2326   
     2327    if(!PyArg_ParseTuple(args,(char *)"O:Packet_trace_get_direction",&obj0)) goto fail;
     2328    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2329    result = (uint8_t)libtrace_packet_t_trace_get_direction(arg1);
     2330   
     2331    resultobj = PyInt_FromLong((long)result);
     2332    return resultobj;
     2333    fail:
     2334    return NULL;
     2335}
     2336
     2337
     2338static PyObject *_wrap_Packet_trace_bpf_filter(PyObject *self, PyObject *args) {
     2339    PyObject *resultobj;
     2340    struct libtrace_packet_t *arg1 = (struct libtrace_packet_t *) 0 ;
     2341    struct libtrace_filter_t *arg2 = (struct libtrace_filter_t *) 0 ;
     2342    int result;
     2343    PyObject * obj0 = 0 ;
     2344    PyObject * obj1 = 0 ;
     2345   
     2346    if(!PyArg_ParseTuple(args,(char *)"OO:Packet_trace_bpf_filter",&obj0,&obj1)) goto fail;
     2347    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2348    if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_libtrace_filter_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2349    result = (int)libtrace_packet_t_trace_bpf_filter(arg1,arg2);
     2350   
     2351    resultobj = PyInt_FromLong((long)result);
    21632352    return resultobj;
    21642353    fail:
     
    21712360    if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL;
    21722361    SWIG_TypeClientData(SWIGTYPE_p_libtrace_packet_t, obj);
     2362    Py_INCREF(obj);
     2363    return Py_BuildValue((char *)"");
     2364}
     2365static PyObject *_wrap_new_Filter(PyObject *self, PyObject *args) {
     2366    PyObject *resultobj;
     2367    char *arg1 ;
     2368    struct libtrace_filter_t *result;
     2369   
     2370    if(!PyArg_ParseTuple(args,(char *)"s:new_Filter",&arg1)) goto fail;
     2371    result = (struct libtrace_filter_t *)new_libtrace_filter_t(arg1);
     2372   
     2373    resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_libtrace_filter_t, 1);
     2374    return resultobj;
     2375    fail:
     2376    return NULL;
     2377}
     2378
     2379
     2380static PyObject *_wrap_Filter_trace_bpf_filter(PyObject *self, PyObject *args) {
     2381    PyObject *resultobj;
     2382    struct libtrace_filter_t *arg1 = (struct libtrace_filter_t *) 0 ;
     2383    struct libtrace_packet_t *arg2 = (struct libtrace_packet_t *) 0 ;
     2384    int result;
     2385    PyObject * obj0 = 0 ;
     2386    PyObject * obj1 = 0 ;
     2387   
     2388    if(!PyArg_ParseTuple(args,(char *)"OO:Filter_trace_bpf_filter",&obj0,&obj1)) goto fail;
     2389    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_libtrace_filter_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2390    if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_libtrace_packet_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     2391    result = (int)libtrace_filter_t_trace_bpf_filter(arg1,arg2);
     2392   
     2393    resultobj = PyInt_FromLong((long)result);
     2394    return resultobj;
     2395    fail:
     2396    return NULL;
     2397}
     2398
     2399
     2400static PyObject * Filter_swigregister(PyObject *self, PyObject *args) {
     2401    PyObject *obj;
     2402    if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL;
     2403    SWIG_TypeClientData(SWIGTYPE_p_libtrace_filter_t, obj);
    21732404    Py_INCREF(obj);
    21742405    return Py_BuildValue((char *)"");
     
    23132544         { (char *)"Packet_trace_get_udp", _wrap_Packet_trace_get_udp, METH_VARARGS },
    23142545         { (char *)"Packet_trace_get_icmp", _wrap_Packet_trace_get_icmp, METH_VARARGS },
     2546         { (char *)"Packet_trace_get_link", _wrap_Packet_trace_get_link, METH_VARARGS },
    23152547         { (char *)"Packet_trace_get_seconds", _wrap_Packet_trace_get_seconds, METH_VARARGS },
     2548         { (char *)"Packet_trace_get_erf_timestamp", _wrap_Packet_trace_get_erf_timestamp, METH_VARARGS },
     2549         { (char *)"Packet_trace_get_timeval", _wrap_Packet_trace_get_timeval, METH_VARARGS },
     2550         { (char *)"Packet_trace_get_capture_length", _wrap_Packet_trace_get_capture_length, METH_VARARGS },
     2551         { (char *)"Packet_trace_get_wire_lenth", _wrap_Packet_trace_get_wire_lenth, METH_VARARGS },
     2552         { (char *)"Packet_trace_get_link_type", _wrap_Packet_trace_get_link_type, METH_VARARGS },
     2553         { (char *)"Packet_trace_get_direction", _wrap_Packet_trace_get_direction, METH_VARARGS },
     2554         { (char *)"Packet_trace_bpf_filter", _wrap_Packet_trace_bpf_filter, METH_VARARGS },
    23162555         { (char *)"Packet_swigregister", Packet_swigregister, METH_VARARGS },
     2556         { (char *)"new_Filter", _wrap_new_Filter, METH_VARARGS },
     2557         { (char *)"Filter_trace_bpf_filter", _wrap_Filter_trace_bpf_filter, METH_VARARGS },
     2558         { (char *)"Filter_swigregister", Filter_swigregister, METH_VARARGS },
    23172559         { (char *)"new_Trace", _wrap_new_Trace, METH_VARARGS },
    23182560         { (char *)"delete_Trace", _wrap_delete_Trace, METH_VARARGS },
     
    23252567/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
    23262568
    2327 static swig_type_info _swigt__p_in_addr[] = {{"_p_in_addr", 0, "in_addr *", 0},{"_p_in_addr"},{0}};
    2328 static swig_type_info _swigt__p_libtrace_icmp[] = {{"_p_libtrace_icmp", 0, "struct libtrace_icmp *", 0},{"_p_libtrace_icmp"},{0}};
    2329 static swig_type_info _swigt__p_libtrace_icmp_un_echo[] = {{"_p_libtrace_icmp_un_echo", 0, "libtrace_icmp_un_echo *", 0},{"_p_libtrace_icmp_un_echo"},{0}};
    2330 static swig_type_info _swigt__p_libtrace_packet_t[] = {{"_p_libtrace_packet_t", 0, "struct libtrace_packet_t *", 0},{"_p_libtrace_packet_t"},{0}};
    2331 static swig_type_info _swigt__p_libtrace_ip[] = {{"_p_libtrace_ip", 0, "struct libtrace_ip *", 0},{"_p_libtrace_ip"},{0}};
    2332 static swig_type_info _swigt__p_libtrace_icmp_un_frag[] = {{"_p_libtrace_icmp_un_frag", 0, "libtrace_icmp_un_frag *", 0},{"_p_libtrace_icmp_un_frag"},{0}};
    23332569static swig_type_info _swigt__p_libtrace_t[] = {{"_p_libtrace_t", 0, "libtrace_t *", 0},{"_p_libtrace_t"},{0}};
    23342570static swig_type_info _swigt__p_libtrace_udp[] = {{"_p_libtrace_udp", 0, "struct libtrace_udp *", 0},{"_p_libtrace_udp"},{0}};
     2571static swig_type_info _swigt__p_libtrace_ip[] = {{"_p_libtrace_ip", 0, "struct libtrace_ip *", 0},{"_p_libtrace_ip"},{0}};
     2572static swig_type_info _swigt__p_libtrace_icmp_un_echo[] = {{"_p_libtrace_icmp_un_echo", 0, "libtrace_icmp_un_echo *", 0},{"_p_libtrace_icmp_un_echo"},{0}};
     2573static swig_type_info _swigt__p_libtrace_icmp_un[] = {{"_p_libtrace_icmp_un", 0, "libtrace_icmp_un *", 0},{"_p_libtrace_icmp_un"},{0}};
     2574static swig_type_info _swigt__p_uint64_t[] = {{"_p_uint64_t", 0, "uint64_t *", 0},{"_p_uint64_t"},{0}};
     2575static swig_type_info _swigt__p_void[] = {{"_p_void", 0, "void *", 0},{"_p_void"},{0}};
     2576static swig_type_info _swigt__p_libtrace_packet_t[] = {{"_p_libtrace_packet_t", 0, "struct libtrace_packet_t *", 0},{"_p_libtrace_packet_t"},{0}};
     2577static swig_type_info _swigt__p_libtrace_filter_t[] = {{"_p_libtrace_filter_t", 0, "libtrace_filter_t *", 0},{"_p_libtrace_filter_t"},{0}};
     2578static swig_type_info _swigt__p_libtrace_icmp_un_frag[] = {{"_p_libtrace_icmp_un_frag", 0, "libtrace_icmp_un_frag *", 0},{"_p_libtrace_icmp_un_frag"},{0}};
     2579static swig_type_info _swigt__p_timeval[] = {{"_p_timeval", 0, "struct timeval *", 0},{"_p_timeval"},{0}};
     2580static swig_type_info _swigt__p_libtrace_icmp[] = {{"_p_libtrace_icmp", 0, "struct libtrace_icmp *", 0},{"_p_libtrace_icmp"},{0}};
     2581static swig_type_info _swigt__p_in_addr[] = {{"_p_in_addr", 0, "in_addr *", 0},{"_p_in_addr"},{0}};
    23352582static swig_type_info _swigt__p_libtrace_tcp[] = {{"_p_libtrace_tcp", 0, "struct libtrace_tcp *", 0},{"_p_libtrace_tcp"},{0}};
    2336 static swig_type_info _swigt__p_libtrace_icmp_un[] = {{"_p_libtrace_icmp_un", 0, "libtrace_icmp_un *", 0},{"_p_libtrace_icmp_un"},{0}};
     2583static swig_type_info _swigt__p_libtrace_linktype_t[] = {{"_p_libtrace_linktype_t", 0, "libtrace_linktype_t *", 0},{"_p_libtrace_linktype_t"},{0}};
    23372584
    23382585static swig_type_info *swig_types_initial[] = {
    2339 _swigt__p_in_addr,
    2340 _swigt__p_libtrace_icmp,
    2341 _swigt__p_libtrace_icmp_un_echo,
    2342 _swigt__p_libtrace_packet_t,
    2343 _swigt__p_libtrace_ip,
    2344 _swigt__p_libtrace_icmp_un_frag,
    23452586_swigt__p_libtrace_t,
    23462587_swigt__p_libtrace_udp,
     2588_swigt__p_libtrace_ip,
     2589_swigt__p_libtrace_icmp_un_echo,
     2590_swigt__p_libtrace_icmp_un,
     2591_swigt__p_uint64_t,
     2592_swigt__p_void,
     2593_swigt__p_libtrace_packet_t,
     2594_swigt__p_libtrace_filter_t,
     2595_swigt__p_libtrace_icmp_un_frag,
     2596_swigt__p_timeval,
     2597_swigt__p_libtrace_icmp,
     2598_swigt__p_in_addr,
    23472599_swigt__p_libtrace_tcp,
    2348 _swigt__p_libtrace_icmp_un,
     2600_swigt__p_libtrace_linktype_t,
    234926010
    23502602};
  • 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.