Changeset 9c6aa95
- Timestamp:
- 10/07/05 17:31:17 (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:
- 9daf398
- Parents:
- 5c88a60
- Location:
- lib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/fifo.c
rb5cd711 r9c6aa95 69 69 70 70 static void increment_pointer(struct tracefifo_t *fifo, enum which_t which, int amount); 71 static void set_pointer(struct tracefifo_t *fifo, enum which_t which, int location);71 static void set_pointer(struct tracefifo_t *fifo, enum which_t which, unsigned int location); 72 72 static size_t tracefifo_compare(struct tracefifo_t *fifo, enum which_t first, enum which_t second); 73 73 static int tracefifo_read_generic(struct tracefifo_t *fifo, void *buffer, size_t len, enum which_t which, char update); … … 115 115 } 116 116 117 void tracefifo_flush(struct tracefifo_t *fifo ) {117 void tracefifo_flush(struct tracefifo_t *fifo __attribute__((unused))) { 118 118 // do nothing 119 119 return; 120 120 } 121 121 122 static void set_pointer(struct tracefifo_t *fifo, enum which_t which, int location) {122 static void set_pointer(struct tracefifo_t *fifo, enum which_t which, unsigned int location) { 123 123 assert(fifo); 124 124 assert(which == IN || which == OUT || which == ACK); 125 assert(location >= 0);126 125 127 126 assert(location <= fifo->length); … … 212 211 assert(fifo); 213 212 assert(buffer); 214 assert(len >= 0);215 213 216 214 oldptr = fifo->datamap[which]; … … 237 235 assert(fifo); 238 236 assert(buffer); 239 assert(len >= 0);240 237 241 238 if (tracefifo_free(fifo) < len) { … … 260 257 assert(fifo); 261 258 assert(buffer); 262 assert(len >= 0);263 259 if (tracefifo_compare(fifo,IN,OUT) < len) { 264 260 return 0; … … 270 266 assert(fifo); 271 267 assert(buffer); 272 assert(len >= 0);273 268 if (tracefifo_compare(fifo,OUT,ACK) < len) { 274 269 return 0; … … 279 274 int tracefifo_out_update(struct tracefifo_t *fifo, size_t len){ 280 275 assert(fifo); 281 assert(len >= 0);282 276 if (tracefifo_compare(fifo,IN,OUT) < len) { 283 277 return 0; … … 289 283 int tracefifo_ack_update(struct tracefifo_t *fifo, size_t len){ 290 284 assert(fifo); 291 assert(len >= 0);292 285 if (tracefifo_compare(fifo,OUT,ACK) < len) { 293 286 return 0; -
lib/format_erf.c
rdfc2673 r9c6aa95 28 28 * 29 29 */ 30 #define _GNU_SOURCE 30 31 31 32 #include "config.h" … … 58 59 #include <getopt.h> 59 60 #include <stdio.h> 61 #include <string.h> 62 #include <stdlib.h> 60 63 61 64 /* Catch undefined O_LARGEFILE on *BSD etc */ … … 174 177 static int erf_init_input(struct libtrace_t *libtrace) { 175 178 struct stat buf; 176 struct hostent *he;177 struct sockaddr_in remote;178 179 struct sockaddr_un unix_sock; 179 180 libtrace->format_data = (struct libtrace_format_data_t *) … … 338 339 break; 339 340 default: 340 printf("Bad argument to erf: %s\n", opt );341 printf("Bad argument to erf: %s\n", optarg); 341 342 // maybe spit out some help here 342 343 return -1; … … 372 373 #endif 373 374 free(libtrace->format_data); 375 return 0; 374 376 } 375 377 376 378 static int rtclient_fin_input(struct libtrace_t *libtrace) { 377 379 close(INPUT.fd); 380 return 0; 378 381 } 379 382 … … 385 388 #endif 386 389 free(libtrace->format_data); 390 391 return 0; 387 392 } 388 393 … … 455 460 int numbytes; 456 461 int size; 457 char buf[RP_BUFSIZE];458 dag_record_t *erfptr;459 462 void *buffer = packet->buffer; 460 463 void *buffer2 = buffer; … … 495 498 static int rtclient_read(struct libtrace_t *libtrace, void *buffer, size_t len) { 496 499 int numbytes; 497 static short lctr = 0;498 struct dag_record_t *erfptr = 0;499 int rlen;500 500 501 501 if (buffer == 0) … … 527 527 int size = 0; 528 528 char buf[RP_BUFSIZE]; 529 dag_record_t *erfptr = 0;530 529 int read_required = 0; 531 530 … … 719 718 } 720 719 721 static int rtclient_get_fd( struct libtrace_packet_t *packet) {720 static int rtclient_get_fd(const struct libtrace_packet_t *packet) { 722 721 return packet->trace->format_data->input.fd; 723 722 } 724 723 725 static int erf_get_fd( struct libtrace_packet_t *packet) {724 static int erf_get_fd(const struct libtrace_packet_t *packet) { 726 725 return packet->trace->format_data->input.fd; 727 726 } -
lib/format_helper.c
r39b37d2 r9c6aa95 33 33 #include "config.h" 34 34 35 #include <stdlib.h> 36 #include <stdio.h> 37 #include <string.h> 35 38 #ifdef HAVE_INTTYPES_H 36 39 # include <inttypes.h> … … 119 122 120 123 if (!trace->event.packet.buffer) { 121 trace->event.packet.buffer = malloc(4096);124 trace->event.packet.buffer = (void *)malloc(4096); 122 125 trace->event.packet.size= 123 126 trace_read_packet(trace,packet); -
lib/format_pcap.c
rb69afb1 r9c6aa95 46 46 #include <assert.h> 47 47 #include <stdio.h> 48 #include <stdlib.h> 49 #include <string.h> 48 50 49 51 #if HAVE_PCAP_BPF_H … … 157 159 158 160 static int pcap_init_output(struct libtrace_out_t *libtrace) { 159 char errbuf[PCAP_ERRBUF_SIZE];160 struct stat buf;161 161 libtrace->format_data = (struct libtrace_format_data_out_t *) 162 162 malloc(sizeof(struct libtrace_format_data_out_t)); … … 185 185 } 186 186 187 static int pcapint_init_output(struct libtrace_out_t *libtrace ) {187 static int pcapint_init_output(struct libtrace_out_t *libtrace __attribute__((unused))) { 188 188 return -1; 189 189 } … … 201 201 } 202 202 203 static int pcapint_fin_output(struct libtrace_out_t *libtrace ) {203 static int pcapint_fin_output(struct libtrace_out_t *libtrace __attribute__((unused))) { 204 204 return -1; 205 205 } … … 218 218 219 219 static int pcap_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { 220 const u_char *pcappkt;221 220 int pcapbytes = 0; 222 221 … … 260 259 } 261 260 262 static int pcapint_write_packet(struct libtrace_out_t *libtrace, struct libtrace_packet_t *packet) { 263 void *link = trace_get_link(packet); 264 261 static int pcapint_write_packet(struct libtrace_out_t *libtrace __attribute__((unused)), struct libtrace_packet_t *packet __attribute__((unused))) { 262 // void *link = trace_get_link(packet); 263 264 return 0; 265 265 } 266 266 … … 379 379 } 380 380 381 static int pcap_get_fd( struct libtrace_packet_t *packet) {381 static int pcap_get_fd(const struct libtrace_packet_t *packet) { 382 382 return pcap_fileno(packet->trace->format_data->input.pcap); 383 383 } -
lib/format_template.c
r1974620 r9c6aa95 33 33 #include "format_helper.h" 34 34 #include "config.h" 35 #include "stdlib.h" 35 36 36 37 #ifdef HAVE_INTTYPES_H … … 110 111 } 111 112 112 static size_t template_set_capture_length( conststruct libtrace_packet_t *packet,size_t size) {113 static size_t template_set_capture_length(struct libtrace_packet_t *packet,size_t size) { 113 114 return -1; 114 115 } -
lib/format_wag.c
rb69afb1 r9c6aa95 29 29 */ 30 30 31 #define _GNU_SOURCE 31 32 #include "libtrace.h" 32 33 #include "libtrace_int.h" … … 59 60 #include <netdb.h> 60 61 #include <stdio.h> 62 #include <string.h> 63 #include <stdlib.h> 61 64 62 65 #ifdef HAVE_LIMITS_H … … 120 123 static int wag_init_input(struct libtrace_t *libtrace) { 121 124 struct stat buf; 122 struct hostent *he;123 struct sockaddr_in remote;124 125 struct sockaddr_un unix_sock; 125 126 libtrace->format_data = (struct libtrace_format_data_t *) … … 225 226 break; 226 227 default: 227 printf("Bad argument to wag: %s\n", opt );228 printf("Bad argument to wag: %s\n", optarg); 228 229 return -1; 229 230 } … … 248 249 fclose(INPUT.file); 249 250 #endif 251 return 0; 250 252 } 251 253 … … 256 258 fclose(OUTPUT.file); 257 259 #endif 260 return 0; 258 261 } 259 262 260 263 static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) { 261 264 int numbytes; 262 static short lctr = 0;263 int rlen;264 265 assert(libtrace); 265 assert(len >= 0);266 266 267 267 if (buffer == 0) … … 312 312 char buf[RP_BUFSIZE]; 313 313 int read_required = 0; 314 struct wag_frame_hdr *waghdr = 0;315 314 316 315 void *buffer = 0; … … 389 388 } 390 389 391 static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet ) {390 static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet __attribute__((unused))) { 392 391 return TRACE_TYPE_80211; 393 392 } … … 435 434 } 436 435 } 437 static intwag_help() {436 static void wag_help() { 438 437 printf("wag format module: $Revision$\n"); 439 438 printf("Supported input URIs:\n"); … … 448 447 printf("\tnone\n"); 449 448 printf("\n"); 450 451 449 } 452 450 -
lib/libtrace_int.h
rae8196e r9c6aa95 165 165 int (*get_wire_length)(const struct libtrace_packet_t *packet); 166 166 size_t (*truncate_packet)(struct libtrace_packet_t *packet,size_t size); 167 int (*get_fd)( struct libtrace_packet_t *packet);167 int (*get_fd)(const struct libtrace_packet_t *packet); 168 168 struct libtrace_eventobj_t (*trace_event)(struct libtrace_t *trace, struct libtrace_packet_t *packet); 169 169 void (*help)(); -
lib/pcap_dump_flush.c
r5c88a60 r9c6aa95 7 7 # include <pcap-int.h> 8 8 #else 9 # error "Need pcap-int.h for declaration of pcap_t"9 //# error "Need pcap-int.h for declaration of pcap_t" 10 10 #endif 11 11 #include <string.h> -
lib/trace.c
rdf6ae1f r9c6aa95 241 241 char *uridata = 0; 242 242 int i = 0; 243 struct stat buf;243 //struct stat buf; 244 244 245 245 trace_err.err_num = E_NOERROR; … … 433 433 parse_cmd(opt_string, &opt_argc, opt_argv, MAXOPTS); 434 434 435 if (libtrace->format->config_output) 435 if (libtrace->format->config_output) { 436 436 return libtrace->format->config_output(libtrace, opt_argc, opt_argv); 437 437 } 438 return -1; 438 439 } 439 440 … … 491 492 return libtrace->format->read_packet(libtrace,packet); 492 493 } 494 return -1; 493 495 } 494 496 … … 508 510 return libtrace->format->write_packet(libtrace, packet); 509 511 } 510 512 return -1; 511 513 } 512 514 … … 555 557 if (eth->type == 0x0008) { 556 558 ipptr=(void*)eth->data; 557 } else if (eth->type = 0x0081) {559 } else if (eth->type == 0x0081) { 558 560 // VLAN 559 561 if ((*(uint16_t *)(eth + 16)) == 0x0008) { … … 892 894 */ 893 895 double trace_get_seconds(const struct libtrace_packet_t *packet) { 894 double seconds ;895 uint64_t ts ;896 double seconds = 0.0; 897 uint64_t ts = 0; 896 898 struct timeval tv; 897 899 … … 1206 1208 * @author Daniel Lawson 1207 1209 */ 1208 int8_t trace_get_server_port(uint8_t protocol , uint16_t source, uint16_t dest) {1210 int8_t trace_get_server_port(uint8_t protocol __attribute__((unused)), uint16_t source, uint16_t dest) { 1209 1211 /* 1210 1212 * * If the ports are equal, return DEST … … 1218 1220 * * flip a coin. 1219 1221 */ 1220 1221 uint16_t server, client; 1222 1222 1223 1223 /* equal */ 1224 if (source == client)1224 if (source == dest) 1225 1225 return USE_DEST; 1226 1226
Note: See TracChangeset
for help on using the changeset viewer.