Changeset 65a5900
- Timestamp:
- 02/17/06 15:06:59 (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:
- 548a9c2
- Parents:
- 3d4d52d
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
r3d4d52d r65a5900 147 147 #ifdef HAVE_DAG 148 148 static int dag_init_input(struct libtrace_t *libtrace) { 149 struct stat buf;150 149 libtrace->format_data = (struct libtrace_format_data_t *) 151 150 malloc(sizeof(struct libtrace_format_data_t)); 152 151 } 152 153 static int dag_start_input(struct libtrace_t *libtrace) { 154 struct stat buf; 153 155 if (stat(packet->trace->uridata) == -1) { 154 156 trace_set_err(errno,"stat(%s)",libtrace->uridata); … … 203 205 malloc(sizeof(struct libtrace_format_data_t)); 204 206 207 } 208 209 static int erf_start_input(struct libtrace_t *libtrace) 210 { 205 211 libtrace->format_data->input.file = trace_open_file(libtrace); 206 212 … … 800 806 erf_init_input, /* init_input */ 801 807 NULL, /* config_input */ 802 NULL,/* start_input */808 erf_start_input, /* start_input */ 803 809 NULL, /* pause_input */ 804 810 erf_init_output, /* init_output */ … … 834 840 dag_init_input, /* init_input */ 835 841 NULL, /* config_input */ 836 NULL, /* start_output */842 dag_start_input, /* start_input */ 837 843 NULL, /* init_output */ 838 844 NULL, /* config_output */ -
lib/trace.c
r3d4d52d r65a5900 423 423 libtrace->format->pause_input(libtrace); 424 424 libtrace->started=false; 425 return 0; 426 } 427 428 int trace_config(libtrace_t *libtrace, 429 trace_option_t option, 430 void *value) 431 { 432 int ret; 433 if (libtrace->format->config_input) { 434 ret=libtrace->format->config_input(libtrace,option,value); 435 if (ret==0) 436 return 0; 437 } 438 switch(option) { 439 case TRACE_OPTION_SNAPLEN: 440 libtrace->snaplen=*(int*)value; 441 break; 442 case TRACE_OPTION_FILTER: 443 libtrace->filter=value; 444 break; 445 case TRACE_OPTION_PROMISC: 446 trace_set_err(TRACE_ERR_OPTION_UNAVAIL, 447 "Promisc mode is not supported by this format module"); 448 return -1; 449 default: 450 trace_set_err(TRACE_ERR_UNKNOWN_OPTION, 451 "Unknown option %i", option); 452 return -1; 453 } 425 454 return 0; 426 455 } … … 1514 1543 void trace_set_err(int errcode,const char *msg,...) 1515 1544 { 1545 char buf[256]; 1516 1546 va_list va; 1517 1547 va_start(va,msg); 1518 1548 trace_err.err_num=errcode; 1519 vsnprintf(trace_err.problem,sizeof(trace_err.problem),msg,va); 1549 if (errcode>0) { 1550 vsnprintf(buf,sizeof(buf),msg,va); 1551 snprintf(trace_err.problem,sizeof(trace_err.problem), 1552 "%s: %s",buf,strerror(errno)); 1553 } else { 1554 vsnprintf(trace_err.problem,sizeof(trace_err.problem),msg,va); 1555 } 1520 1556 va_end(va); 1521 1557 }
Note: See TracChangeset
for help on using the changeset viewer.