Changeset 6f34090 for swig/libtrace.i


Ignore:
Timestamp:
09/21/04 15:18:19 (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:
f2794ea
Parents:
77ba31d
Message:

updated for new api

File:
1 edited

Legend:

Unmodified
Added
Removed
  • swig/libtrace.i

    r77ba31d r6f34090  
    44#include "libtrace.h"
    55%}
     6%include "carrays.i"
     7%include "cmalloc.i"
    68
    79%nodefault;
     
    1416};
    1517
    16 %rename (libtrace_ip) IP;
    1718struct libtrace_ip
    1819  {
     
    3334    const uint16_t ip_off;              /**< fragment offset field */
    3435    // Needs ntoha
     36    %newobject ip_src;
     37    %newobject ip_dst;
    3538    const char *const ip_src;
    3639    const char *const ip_dst;
     
    3841  };
    3942
    40 %extend libtrace_ip {
    41         ~libtrace_ip() { free(self); }
    42 }
     43
     44
    4345
    4446%{
     
    9092};
    9193
    92 %extend libtrace_tcp {
    93         ~libtrace_tcp() { free(self); }
    94 }
    95 
    9694%{
    9795 MAKE_NTOHS(libtrace_tcp,source)
     
    115113  }
    116114};
    117 
    118 %extend libtrace_udp {
    119         ~libtrace_udp() { free(self); }
    120 }
    121115
    122116%{
     
    148142};
    149143
    150 %extend libtrace_icmp {
    151         ~libtrace_icmp() { free(self); }
    152 }
    153 
    154144%rename (Packet) libtrace_packet_t;
    155 struct libtrace_packet_t
    156 {
    157         struct libtrace_t *trace;
    158         char *buffer;
    159         size_t size;
    160         uint8_t status;
    161 };
     145struct libtrace_packet_t {};
    162146
    163147%extend libtrace_packet_t {
    164148        libtrace_packet_t() {
    165                 struct libtrace_packet_t *packet = 0;
    166                 packet = malloc(sizeof(struct libtrace_packet_t));
    167                 packet->buffer = malloc(sizeof(char) * 65536);
     149                struct libtrace_packet_t *packet = malloc(sizeof(struct libtrace_packet_t));
    168150                return packet;
    169151                }
    170         ~libtrace_packet_t() { free(self->buffer); free(self);}
     152        ~libtrace_packet_t() { free(self);}
    171153        struct libtrace_ip *trace_get_ip() {
    172154                return trace_get_ip(self);
Note: See TracChangeset for help on using the changeset viewer.