Changeset cd7eec7
- Timestamp:
- 05/16/06 14:37:22 (15 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:
- abc66e7
- Parents:
- da34e20
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/Makefile.am
re5f1431 rcd7eec7 7 7 format_rt.c format_helper.c format_helper.h format_pcapfile.c \ 8 8 parse_cmd.c parse_cmd.h libtrace_int.h lt_inttypes.h \ 9 linktypes.c protocols.c libtraceio.h 9 linktypes.c protocols.c libtraceio.h format_duck.c 10 10 if HAVE_NETPACKET_PACKET_H 11 11 libtrace_la_SOURCES+=format_linux.c -
lib/format_erf.c
rda34e20 rcd7eec7 104 104 uint32_t duck_freq; 105 105 uint32_t last_pkt; 106 libtrace_t *dummy_ rt;106 libtrace_t *dummy_duck; 107 107 } duck; 108 108 … … 183 183 184 184 DUCK.last_duck = 0; 185 DUCK.duck_freq = 60; /** 5 minutes */185 DUCK.duck_freq = 0; 186 186 DUCK.last_pkt = 0; 187 DUCK.dummy_ rt= NULL;187 DUCK.dummy_duck = NULL; 188 188 189 189 return 0; 190 190 } 191 191 192 static int dag_config_input(libtrace_t *libtrace, trace_option_t option, 193 void *data) { 194 switch(option) { 195 case TRACE_META_FREQ: 196 DUCK.duck_freq = *(int *)data; 197 return 0; 198 case TRACE_OPTION_SNAPLEN: 199 /* Surely we can set this?? Fall through for now*/ 200 201 case TRACE_OPTION_PROMISC: 202 /* DAG already operates in a promisc fashion */ 203 204 case TRACE_OPTION_FILTER: 205 206 default: 207 trace_set_err(libtrace, TRACE_ERR_UNKNOWN_OPTION, 208 "Unknown or unsupported option: %i", 209 option); 210 return -1; 211 } 212 assert (0); 213 } 192 214 #endif 193 215 … … 436 458 /* dag pause input implicitly called to cleanup before this */ 437 459 dag_close(INPUT.fd); 438 if (DUCK.dummy_ rt)439 trace_destroy_dead(DUCK.dummy_ rt);460 if (DUCK.dummy_duck) 461 trace_destroy_dead(DUCK.dummy_duck); 440 462 free(libtrace->format_data); 441 463 return 0; /* success */ … … 500 522 packet->type = RT_DUCK_2_4; 501 523 packet->size = sizeof(duck_inf); 502 if (!DUCK.dummy_rt) 503 DUCK.dummy_rt = trace_create_dead("rt:localhost:3434"); 504 packet->trace = DUCK.dummy_rt; 524 if (!DUCK.dummy_duck) 525 DUCK.dummy_duck = trace_create_dead("duck:dummy"); 526 packet->trace = DUCK.dummy_duck; 527 return packet->size; 505 528 } 506 529 #else … … 541 564 packet->type = RT_DUCK_2_5; 542 565 packet->size = sizeof(duckinf_t); 543 if (!DUCK.dummy_rt) 544 DUCK.dummy_rt = trace_create_dead("rt:localhost:3434"); 545 packet->trace = DUCK.dummy_rt; 566 if (!DUCK.dummy_duck) 567 DUCK.dummy_duck = trace_create_dead("rt:localhost:3434"); 568 packet->trace = DUCK.dummy_duck; 569 return packet->size; 546 570 } 547 571 #endif … … 843 867 assert(OUTPUT.file); 844 868 869 if (!packet->header) { 870 //trace_set_err_output(libtrace, TRACE_ERR_BAD_PACKET, 871 // "Packet has no header - probably an RT packet"); 872 return -1; 873 } 874 845 875 pad = erf_get_padding(packet); 846 876 … … 1065 1095 TRACE_FORMAT_ERF, 1066 1096 dag_init_input, /* init_input */ 1067 NULL,/* config_input */1097 dag_config_input, /* config_input */ 1068 1098 dag_start_input, /* start_input */ 1069 1099 dag_pause_input, /* pause_input */ -
lib/format_linux.c
r431548c5 rcd7eec7 188 188 * emulating it 189 189 */ 190 break; 191 case TRACE_META_FREQ: 192 /* No meta-data for this format */ 190 193 break; 191 194 /* Avoid default: so that future options will cause a warning -
lib/format_pcap.c
rda34e20 rcd7eec7 138 138 case TRACE_OPTION_PROMISC: 139 139 /* can't do promisc on a trace! fall thru */ 140 case TRACE_META_FREQ: 141 /* No meta data for this format */ 140 142 default: 141 143 trace_set_err(libtrace,TRACE_ERR_UNKNOWN_OPTION, … … 195 197 DATA(libtrace)->promisc=*(int*)data; 196 198 return 0; 199 case TRACE_META_FREQ: 200 /* No meta-data for this format */ 197 201 default: 198 202 trace_set_err(libtrace,TRACE_ERR_UNKNOWN_OPTION, -
lib/format_rt.c
rda34e20 rcd7eec7 84 84 int buf_filled; 85 85 86 86 libtrace_t *dummy_duck; 87 87 libtrace_t *dummy_erf; 88 88 libtrace_t *dummy_pcap; … … 192 192 libtrace->format_data = malloc(sizeof(struct rt_format_data_t)); 193 193 194 RT_INFO->dummy_duck = NULL; 194 195 RT_INFO->dummy_erf = NULL; 195 196 RT_INFO->dummy_pcap = NULL; … … 252 253 253 254 } 255 if (RT_INFO->dummy_duck) 256 trace_destroy_dead(RT_INFO->dummy_duck); 257 254 258 if (RT_INFO->dummy_erf) 255 259 trace_destroy_dead(RT_INFO->dummy_erf); … … 360 364 361 365 switch (packet->type) { 366 case RT_DUCK_2_4: 367 case RT_DUCK_2_5: 368 if (!RT_INFO->dummy_duck) { 369 RT_INFO->dummy_duck = trace_create_dead("duck:dummy"); 370 } 371 packet->trace = RT_INFO->dummy_duck; 372 break; 362 373 case RT_DATA_ERF: 363 374 if (!RT_INFO->dummy_erf) { … … 375 386 case RT_DATA_LEGACY_ATM: 376 387 case RT_DATA_LEGACY_POS: 388 case RT_DATA_LINUX_NATIVE: 377 389 printf("Sending legacy over RT is currently not supported\n"); 378 390 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, "Legacy packet cannot be sent over rt"); … … 502 514 switch(packet->type) { 503 515 case RT_STATUS: 504 case RT_DUCK:505 516 if (rt_read(libtrace, &packet->buffer, 506 517 pkt_size,1) != 507 518 pkt_size) { 508 519 printf("Error receiving status packet\n"); 520 return -1; 521 } 522 packet->header = 0; 523 packet->payload = packet->buffer; 524 break; 525 case RT_DUCK_2_4: 526 case RT_DUCK_2_5: 527 if (rt_read(libtrace, &packet->buffer, 528 pkt_size, 1) != 529 pkt_size) { 530 printf("Error receiving DUCK packet\n"); 531 return -1; 532 } 533 if (rt_set_format(libtrace, packet) < 0) { 509 534 return -1; 510 535 } … … 525 550 printf("Bad rt type for client receipt: %d\n", 526 551 packet->type); 552 return -1; 527 553 } 528 554 } … … 539 565 static int rt_get_capture_length(const libtrace_packet_t *packet) { 540 566 switch (packet->type) { 541 case RT_DUCK_2_4:542 return sizeof(duck2_4_t);543 case RT_DUCK_2_5:544 return sizeof(duck2_5_t);545 567 case RT_STATUS: 546 568 return sizeof(rt_status_t); -
lib/libtrace.h.in
r83445f0 rcd7eec7 533 533 TRACE_OPTION_SNAPLEN, /**< Number of bytes captured */ 534 534 TRACE_OPTION_PROMISC, /**< Capture packets to other hosts */ 535 TRACE_OPTION_FILTER /**< Apply this filter to all packets recieved */ 535 TRACE_OPTION_FILTER, /**< Apply this filter to all packets recieved */ 536 TRACE_META_FREQ /**< Frequency of meta-data information, e.g. DUCK packets */ 536 537 } trace_option_t; 537 538 … … 1218 1219 TRACE_FORMAT_LEGACY_POS =7, 1219 1220 TRACE_FORMAT_LEGACY_ETH =8, 1220 TRACE_FORMAT_LINUX_NATIVE =9 1221 TRACE_FORMAT_LINUX_NATIVE =9, 1222 TRACE_FORMAT_DUCK =10 1221 1223 }; 1222 1224 -
lib/rt_protocol.h
rda34e20 rcd7eec7 219 219 } duck2_5_t; 220 220 221 /* 221 222 typedef struct rt_duck_2_4 { 222 223 duck2_4_t duck; … … 226 227 duck2_5_t duck; 227 228 } rt_duck_2_5_t; 228 229 #endif 229 */ 230 231 #endif -
lib/trace.c
r83445f0 rcd7eec7 220 220 { 221 221 if (!formats_list) { 222 duck_constructor(); 222 223 erf_constructor(); 223 224 legacy_constructor(); … … 535 536 trace_set_err(libtrace,TRACE_ERR_OPTION_UNAVAIL, 536 537 "Promisc mode is not supported by this format module"); 538 return -1; 539 case TRACE_META_FREQ: 540 trace_set_err(libtrace, TRACE_ERR_OPTION_UNAVAIL, 541 "This format does not support meta-data gathering"); 537 542 return -1; 538 543 } -
test/Makefile
raf1e721 rcd7eec7 25 25 26 26 test-format-all: test-format 27 @for i in erf pcap wtf pcapfile ; do \27 @for i in erf pcap wtf pcapfile duck; do \ 28 28 echo \* $$i; \ 29 29 LD_LIBRARY_PATH=$(libdir) \ … … 42 42 @LD_LIBRARY_PATH=$(libdir) ./test-convert wtf pcap 43 43 @LD_LIBRARY_PATH=$(libdir) ./test-convert wtf wtf 44 @LD_LIBRARY_PATH=$(libdir) ./test-convert duck duck 44 45 45 46 clean: -
test/test-convert.c
r8f851f3 rcd7eec7 80 80 if (!strcmp(type,"pcapfile")) 81 81 return "pcapfile:traces/100_packets.pcap"; 82 if (!strcmp(type, "duck")) 83 return "duck:traces/100_packets.duck"; 82 84 return "unknown"; 83 85 } … … 90 92 if (!strcmp(type,"wtf")) 91 93 return "wtf:traces/wed.out.wtf"; 94 if (!strcmp(type,"duck")) 95 return "duck:traces/100_packets.out.duck"; 92 96 return "unknown"; 93 97 } -
test/test-format.c
r8f851f3 rcd7eec7 71 71 if (!strcmp(type,"pcapfile")) 72 72 return "pcapfile:traces/100_packets.pcap"; 73 if (!strcmp(type, "duck")) 74 return "duck:traces/100_packets.duck"; 73 75 return "unknown"; 74 76 } … … 92 94 93 95 if (strcmp(argv[1],"rtclient")==0) expected=101; 94 96 95 97 level=0; 96 98 -
tools/tracesplit/tracesplit.c
r5ad7ad0 rcd7eec7 136 136 } 137 137 138 pktcount++;139 138 if (output && pktcount%count==0) { 140 139 trace_destroy_output(output); … … 142 141 } 143 142 143 pktcount++; 144 144 totbytes+=trace_get_capture_length(packet); 145 145 if (output && totbytes-totbyteslast>=bytes) {
Note: See TracChangeset
for help on using the changeset viewer.