- Timestamp:
- 02/27/06 16:53:10 (16 years ago)
- 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:
- 5fb2251
- Parents:
- 8a8e54b
- Location:
- lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/fifo.c
rd5879cc rd8f02df 37 37 #include <string.h> /* bzero */ 38 38 #include "fifo.h" 39 #include "libtrace_int.h" 39 40 40 41 #include <sys/types.h> … … 83 84 84 85 if ((fifo->base = malloc(fifo->length)) == 0) { 85 trace_set_err(errno,"malloc failed");86 86 return 0; 87 87 } -
lib/format_erf.c
rd5879cc rd8f02df 555 555 dag_record_t *erfptr, int pad, void *buffer, size_t size) { 556 556 int numbytes = 0; 557 assert(size >=0 && size<=65536);557 assert(size<=65536); 558 558 /* FIXME: Shouldn't this return != dag_record_size+pad on error? */ 559 559 if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, erfptr, dag_record_size + pad)) == 0) { -
lib/format_legacy.c
rab4cb04 rd8f02df 152 152 packet->type = RT_DATA_LEGACY_ETH; 153 153 break; 154 default: 155 assert(0); 154 156 } 155 157 -
lib/format_pcap.c
rd5879cc rd8f02df 161 161 pcap_close(INPUT.pcap); 162 162 INPUT.pcap=NULL; 163 164 return 0; 163 165 } 164 166 … … 260 262 packet->payload = (void *)pcappkt; 261 263 262 assert(pcaphdr->caplen >=0 && pcaphdr->caplen<=65536);264 assert(pcaphdr->caplen<=65536); 263 265 } 264 266 … … 388 390 struct pcap_pkthdr *pcapptr = 0; 389 391 pcapptr = (struct pcap_pkthdr *)packet->header; 390 assert(pcapptr->caplen >=0 && pcapptr->caplen<=65536);392 assert(pcapptr->caplen<=65536); 391 393 return pcapptr->caplen; 392 394 } -
lib/format_rt.c
rab4cb04 rd8f02df 374 374 struct libtrace_packet_t *packet) { 375 375 376 char buf[RP_BUFSIZE];377 int read_required = 0;378 376 rt_header_t pkt_hdr; 379 char msg_buf[RP_BUFSIZE];380 377 int pkt_size = 0; 381 378 -
lib/format_wag.c
rab4cb04 rd8f02df 185 185 assert(OPTIONS.zlib.level>=0 186 186 && OPTIONS.zlib.level<=9); 187 break;187 return 0; 188 188 #else 189 189 case TRACE_OPTION_OUTPUT_COMPRESS: … … 204 204 { 205 205 close(INPUT.fd); 206 207 return 0; 206 208 } 207 209 … … 224 226 225 227 static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) { 226 int numbytes; 227 int framesize; 228 size_t framesize; 228 229 char *buf_ptr = (char *)buffer; 229 230 int to_read = 0; 230 231 uint16_t magic = 0; 231 uint16_t lctr = 0;232 232 233 233 assert(libtrace); -
lib/libtrace.h
r0d768c8 rd8f02df 765 765 */ 766 766 SIMPLE_FUNCTION 767 int trace_get_capture_length(const libtrace_packet_t *packet);767 size_t trace_get_capture_length(const libtrace_packet_t *packet); 768 768 769 769 /** Get the size of the packet as it was seen on the wire. … … 774 774 */ 775 775 SIMPLE_FUNCTION 776 int trace_get_wire_length(const libtrace_packet_t *packet);776 size_t trace_get_wire_length(const libtrace_packet_t *packet); 777 777 778 778 /** Get the length of the capture framing headers. … … 785 785 */ 786 786 SIMPLE_FUNCTION 787 int trace_get_framing_length(const libtrace_packet_t *packet);787 size_t trace_get_framing_length(const libtrace_packet_t *packet); 788 788 789 789 /** Truncate ("snap") the packet at the suggested length -
lib/trace.c
rd5879cc rd8f02df 292 292 libtrace->filter = NULL; 293 293 libtrace->snaplen = 0; 294 libtrace->started=false; 294 295 295 296 for (i = 0; i < nformats; i++) { … … 330 331 331 332 libtrace->fifo = create_tracefifo(1048576); 333 if (!libtrace->fifo) { 334 trace_set_err(libtrace,ENOMEM,"Could not allocate memory for fifo"); 335 free(scan); 336 return libtrace; 337 } 332 338 assert(libtrace->fifo); 333 339 free(scan); 334 libtrace->started=false;335 340 trace_set_err(libtrace,0,""); 336 341 return libtrace; … … 594 599 memcpy(dest->header,packet->header,trace_get_framing_length(packet)); 595 600 memcpy(dest->payload,packet->payload,trace_get_capture_length(packet)); 601 602 return dest; 596 603 } 597 604 … … 631 638 do { 632 639 packet->size=libtrace->format->read_packet(libtrace,packet); 633 if (packet->size== -1 || packet->size==0)640 if (packet->size==(size_t)-1 || packet->size==0) 634 641 return packet->size; 635 642 if (libtrace->filter) { … … 1169 1176 } 1170 1177 1171 int trace_get_capture_length(const struct libtrace_packet_t *packet) {1178 size_t trace_get_capture_length(const libtrace_packet_t *packet) { 1172 1179 1173 1180 assert(packet->size>0 && packet->size<65536); … … 1188 1195 * not be the same as the Capture Len. 1189 1196 */ 1190 int trace_get_wire_length(const struct libtrace_packet_t *packet){1197 size_t trace_get_wire_length(const libtrace_packet_t *packet){ 1191 1198 assert(packet->size>0 && packet->size<65536); 1192 1199 … … 1207 1214 */ 1208 1215 SIMPLE_FUNCTION 1209 int trace_get_framing_length(const libtrace_packet_t *packet) {1216 size_t trace_get_framing_length(const libtrace_packet_t *packet) { 1210 1217 if (packet->trace->format->get_framing_length) { 1211 1218 return packet->trace->format->get_framing_length(packet);
Note: See TracChangeset
for help on using the changeset viewer.