Changeset e2aebe7 for lib/trace.c


Ignore:
Timestamp:
05/29/06 11:27:11 (16 years ago)
Author:
Perry Lorier <perry@…>
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:
f208f92
Parents:
ad96d00
Message:

Change the API for filters to

trace_create_filter
trace_apply_filter
trace_destroy_filter

Also, cleanup bitfield issues with msvc/gcc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rcd7eec7 re2aebe7  
    215215void rt_constructor();
    216216void wag_constructor();
     217void duck_constructor();
    217218
    218219/* call all the constructors if they haven't yet all been called */
     
    630631 * sideeffect: sets packet to NULL
    631632 */
    632 DLLEXPORT void trace_destroy_packet(libtrace_packet_t **packet) {
    633         if ((*packet)->buf_control == TRACE_CTRL_PACKET) {
    634                 free((*packet)->buffer);
    635         }
    636         free((*packet));
    637         *packet = NULL;
     633DLLEXPORT void trace_destroy_packet(libtrace_packet_t *packet) {
     634        if (packet->buf_control == TRACE_CTRL_PACKET) {
     635                free(packet->buffer);
     636        }
     637        packet->buf_control='\0'; /* an "bad" value to force an assert
     638                                   * if this packet is ever reused
     639                                   */
     640        free(packet);
    638641}       
    639642
     
    667670                                 * packet
    668671                                 */
    669                                 if (!trace_bpf_filter(libtrace->filter,packet)){
     672                                if (!trace_apply_filter(libtrace->filter,packet)){
    670673                                        continue;
    671674                                }
     
    916919 * @author Daniel Lawson
    917920 */
    918 DLLEXPORT libtrace_filter_t *trace_bpf_setfilter(const char *filterstring) {
     921DLLEXPORT libtrace_filter_t *trace_create_filter(const char *filterstring) {
    919922#if HAVE_BPF
    920923        libtrace_filter_t *filter = (libtrace_filter_t*)
     
    929932}
    930933
    931 DLLEXPORT void trace_destroy_bpf(libtrace_filter_t *filter)
     934DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter)
    932935{
    933936#if HAVE_BPF
     
    996999}
    9971000
    998 DLLEXPORT int trace_bpf_filter(libtrace_filter_t *filter,
     1001DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter,
    9991002                        const libtrace_packet_t *packet) {
    10001003#if HAVE_BPF
Note: See TracChangeset for help on using the changeset viewer.