Changeset be54c88


Ignore:
Timestamp:
07/21/04 10:01:21 (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:
c837874
Parents:
781cf2c
Message:

removed some bad debugging stuff i left in. assert(0) doesn't play nice in random places

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/Makefile

    r277442c rbe54c88  
    11CC=gcc-3.0
    22CFLAGS= -Wall -Wimplicit -Wformat -pipe -g -O3
     3PROFCFLAGS= -Wall -Wimplicit -Wformat -pipe -g -pg -fprofile-arcs -a
    34
    45INCLUDE = -I../include -I/usr/local/wand/include
    56CFLAGS += -D_FILE_OFFSET_BITS=64
    67CFLAGS += $(INCLUDE)
     8PROFCFLAGS += -D_FILE_OFFSET_BITS=64
     9PROFCFLAGS += $(INCLUDE)
    710libdir = -L/usr/local/wand/lib/
    811LDLIBS = $(libdir) -lpcapl -lzl
     
    1114CURRENT=1
    1215AGE=0
    13 REVISION=8
     16REVISION=9
    1417
    1518INCLIBS=/usr/local/wand/lib/libzl.a /usr/local/wand/lib/libpcapl.a
     
    1821
    1922all: libtrace.lo libtrace.la
     23
     24profile: clean libtrace-prof.lo libtrace-prof.la
     25
     26libfifo-prof.lo:        fifo.c
     27        libtool --mode=compile $(CC) $(PROFCFLAGS) -c $< -o libfifo-prof.lo
     28
     29libtrace-prof.lo:       trace.c
     30        libtool --mode=compile $(CC) $(PROFCFLAGS) -c $< -o libtrace-prof.lo
     31
     32libtrace-prof.la:       libtrace-prof.lo libfifo-prof.lo
     33        libtool --mode=link $(CC) $(CFLAGS) -o libtrace-prof.la \
     34        libtrace-prof.lo libfifo-prof.lo -rpath /usr/local/wand/lib $(LDLIBS) \
     35        -version-info $(CURRENT):$(REVISION):$(AGE)
     36
    2037
    2138
     
    3350
    3451clean:
    35         $(RM) *~ *.o libtrace.a *.lo *.la libtrace.so.* .libs/*.*
     52        $(RM) *~ *.o *.a *.lo *.la *.so .libs/*.*
    3653
    3754distclean:
    3855        $(RM) *~ *.o
    3956
     57
     58install-profile: libtrace-prof.la
     59        libtool --mode=install install -c libtrace-prof.la /usr/local/wand/lib/libtrace-prof.la
     60        libtool --finish /usr/local/wand/lib/
    4061
    4162install: libtrace.la
  • lib/trace.c

    r277442c rbe54c88  
    429429        assert(buffer);
    430430        assert(status);
    431         assert(len > 104); // we know we see packets this big anyway. Don't be silly.
     431        assert(len > 200);
    432432
    433433        bzero(buffer,len);
    434434       
     435        /* PCAP gives us it's own per-packet interface. Let's use it */
    435436        if (libtrace->format == PCAP || libtrace->format == PCAPINT) {
    436437                if ((pcappkt = pcap_next(libtrace->input.pcap, &pcaphdr)) == NULL) {
     
    444445        }
    445446
     447        /* If we're reading from an ERF input, it's an offline trace. We can make some assumptions */
     448        if (libtrace->format == ERF) {
     449                void *buffer2 = buffer;
     450                // read in the trace header
     451                if ((numbytes=gzread(libtrace->input.file,
     452                                                buffer,
     453                                                sizeof(dag_record_t))) == -1) {
     454                        perror("gzread");
     455                        return -1;
     456                }
     457                if (numbytes == 0) {
     458                        return 0;
     459                }
     460                size = ntohs(((dag_record_t *)buffer)->rlen) - sizeof(dag_record_t);
     461                assert(len > size);
     462                buffer2 += sizeof(dag_record_t);
     463
     464                // read in the rest of the packet
     465                if ((numbytes=gzread(libtrace->input.file,
     466                                                buffer2,
     467                                                size)) == -1) {
     468                        perror("gzread");
     469                        return -1;
     470                }
     471                return sizeof(dag_record_t) + numbytes;
     472        }
    446473        do {
    447474                if (fifo_out_available(libtrace->fifo) == 0 || read_required) {
     
    11131140
    11141141        assert(filter->filter);
    1115         printf("%d %d\n",clen,ntohs(clen));
    11161142        return bpf_filter(filter->filter, linkptr, clen, clen);
    11171143       
Note: See TracChangeset for help on using the changeset viewer.