Changeset 14d8a63 for lib/trace.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/trace.c

    rf3ed52a r14d8a63  
    488488}
    489489
     490/** Create a new packet object
     491 *
     492 * @ return a pointer to an initialised libtrace_packet_t structure
     493 */
     494struct libtrace_packet_t *trace_packet_create() {
     495        struct libtrace_packet_t *packet = calloc(1,sizeof(struct libtrace_packet_t));
     496        packet->buffer = malloc(LIBTRACE_PACKET_BUFSIZE);
     497        packet->buf_control = PACKET;
     498        return packet;
     499}
     500
     501/** Destroy a packet object
     502 *
     503 * sideeffect: sets packet to NULL
     504 */
     505void trace_packet_destroy(struct libtrace_packet_t **packet) {
     506        if ((*packet)->buf_control) {
     507                free((*packet)->buffer);
     508        }
     509        free((*packet));
     510        packet = NULL;
     511}       
     512
    490513/* Read one packet from the trace into buffer
    491514 *
     
    543566 */
    544567void *trace_get_link(const struct libtrace_packet_t *packet) {
     568        return (void *)packet->payload;
     569/*
    545570        const void *ethptr = 0;
    546571
     
    551576        }
    552577        return (void *)ethptr;
     578*/
    553579}
    554580
Note: See TracChangeset for help on using the changeset viewer.