Changeset 14d8a63 for lib/format_wag.c


Ignore:
Timestamp:
11/25/05 16:12:39 (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:
3840760
Parents:
e9fa643
Message:

update to version 3.0.0
zero-copy patch - trace.c updated with new trace_create_packet() etc
format_*.c updated with zero-copy codepath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_wag.c

    r79dbcef r14d8a63  
    276276        void *buffer = 0;
    277277
     278        if (packet->buf_control == EXTERNAL) {
     279                packet->buf_control = PACKET;
     280                packet->buffer = malloc(LIBTRACE_PACKET_BUFSIZE);
     281        }
    278282        packet->trace = libtrace;
    279283        buffer = packet->buffer;
     
    318322                packet->status.type = RT_DATA;
    319323                packet->status.message = 0;
     324                packet->header = packet->buffer;
     325                packet->payload = packet->buffer + pcap_get_framing_length(packet);
    320326                packet->size = numbytes;
    321327                return numbytes;
     
    338344
    339345static void *wag_get_link(const struct libtrace_packet_t *packet) {
     346        return (void *)packet->payload;
     347        /*
    340348        struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer;
    341349        void *payload = wagptr->data;
    342350        return (void*)payload;
     351        */
    343352}
    344353
     
    348357
    349358static int8_t wag_get_direction(const struct libtrace_packet_t *packet) {
    350         struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer;
     359        struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->header;
    351360        if (wagptr->hdr.type == 0) {
    352361                return wagptr->hdr.subtype;
     
    356365
    357366static uint64_t wag_get_erf_timestamp(const struct libtrace_packet_t *packet) {
    358         struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer;
     367        struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->header;
    359368        uint64_t timestamp = 0;
    360369        timestamp = wagptr->ts.subsecs;
     
    366375
    367376static int wag_get_capture_length(const struct libtrace_packet_t *packet) {
    368         struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer;
     377        struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->header;
    369378        //return (wagptr->hdr.size);
    370379        return ntohs(wagptr->hdr.size);
     
    372381
    373382static int wag_get_wire_length(const struct libtrace_packet_t *packet) {
    374         struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer;
     383        struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->header;
    375384        //return (wagptr->hdr.size);
    376385        return ntohs(wagptr->hdr.size);
Note: See TracChangeset for help on using the changeset viewer.