- Timestamp:
- 08/04/05 17:42:41 (17 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:
- df2dff9
- Parents:
- 77bd94f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
ref55d05 rda8b03e 64 64 #define CONNINFO libtrace->format_data->conn_info 65 65 #define INPUT libtrace->format_data->input 66 #define OUTPUT libtrace->format_data->output 66 67 #define DAG libtrace->format_data->dag 68 #define OPTIONS libtrace->format_data->options 67 69 struct libtrace_format_data_t { 68 70 union { … … 275 277 calloc(1,sizeof(struct libtrace_format_data_out_t)); 276 278 277 libtrace->format_data->options.erf.level = 1;278 asprintf(&filemode,"wb%d", libtrace->format_data->options.erf.level);279 OPTIONS.erf.level = 1; 280 asprintf(&filemode,"wb%d",OPTIONS.erf.level); 279 281 280 282 if (!strncmp(libtrace->uridata,"-",1)) { … … 314 316 // extract conn_info from uridata 315 317 if (strlen(uridata) == 0) { 316 libtrace->conn_info.rt.hostname = NULL;317 libtrace->conn_info.rt.port = COLLECTOR_PORT;318 CONNINFO.rt.hostname = NULL; 319 CONNINFO.rt.port = COLLECTOR_PORT; 318 320 } 319 321 else { 320 322 if ((scan = strchr(uridata,':')) == NULL) { 321 libtrace->conn_info.rt.hostname =323 CONNINFO.rt.hostname = 322 324 NULL; 323 libtrace->conn_info.rt.port =325 CONNINFO.rt.port = 324 326 atoi(uridata); 325 327 } else { 326 libtrace->format_data->conn_info.rt.hostname =328 CONNINFO.rt.hostname = 327 329 (char *)strndup(uridata, 328 330 (scan - uridata)); 329 libtrace->format_data->conn_info.rt.port =331 CONNINFO.rt.port = 330 332 atoi(++scan); 331 333 } … … 333 335 334 336 335 libtrace->format_data->output.rtserver =336 rtserver_create( libtrace->format_data->conn_info.rt.hostname,337 libtrace->format_data->conn_info.rt.port);338 if (! libtrace->format_data->output.rtserver)337 OUTPUT.rtserver = 338 rtserver_create(CONNINFO.rt.hostname, 339 CONNINFO.rt.port); 340 if (!OUTPUT.rtserver) 339 341 return 0; 340 342 … … 343 345 static int erf_config_output(struct libtrace_out_t *libtrace, int argc, char *argv[]) { 344 346 int opt; 345 int level = libtrace->format_data->options.erf.level;347 int level = OPTIONS.erf.level; 346 348 optind = 1; 347 349 … … 357 359 } 358 360 } 359 if (level != libtrace->format_data->options.erf.level) {361 if (level != OPTIONS.erf.level) { 360 362 if (level > 9 || level < 0) { 361 363 // retarded level choice … … 363 365 364 366 } else { 365 libtrace->format_data->options.erf.level = level;367 OPTIONS.erf.level = level; 366 368 return gzsetparams(libtrace->format_data->output.file, level, Z_DEFAULT_STRATEGY); 367 369 } … … 533 535 534 536 static int rtclient_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { 535 int numbytes ;536 int size ;537 int numbytes = 0; 538 int size = 0; 537 539 char buf[RP_BUFSIZE]; 538 dag_record_t *erfptr ;540 dag_record_t *erfptr = 0; 539 541 int read_required = 0; 540 542 541 543 void *buffer = 0; 544 545 packet->trace = libtrace; 542 546 buffer = packet->buffer; 543 547 … … 548 552 return numbytes; 549 553 } 550 assert(libtrace->fifo);551 554 fifo_write(libtrace->fifo,buf,numbytes); 552 555 read_required = 0; … … 568 571 } 569 572 size = ntohs(((dag_record_t *)buffer)->rlen); 570 573 571 574 // read in the full packet 572 575 if ((numbytes = fifo_out_read(libtrace->fifo, … … 666 669 dag_record_t *erfptr = 0; 667 670 erfptr = (dag_record_t *)packet->buffer; 668 printf("%d\n",erfptr->type);669 671 switch (erfptr->type) { 670 672 case TYPE_ETH: return TRACE_TYPE_ETH;
Note: See TracChangeset
for help on using the changeset viewer.