Changeset ffc8c8d for lib/trace.c
- Timestamp:
- 08/11/05 11:30:41 (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:
- 4d5a9a7
- Parents:
- a8ba977
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/trace.c
r3dcc2e2 rffc8c8d 113 113 #endif 114 114 115 //#if HAVE_PCAP_H116 //# include <pcap.h>117 //# ifdef HAVE_PCAP_INT_H118 //# include <pcap-int.h>119 //# endif120 //#endif121 122 //#ifdef HAVE_ZLIB_H123 //# include <zlib.h>124 //#endif125 126 127 //#include "wag.h"128 129 //#ifdef HAVE_DAG_API130 //# include "dagnew.h"131 //# include "dagapi.h"132 //#else133 //# include "dagformat.h"134 //#endif135 136 115 #include "libtrace_int.h" 137 116 #include "format_helper.h" 138 //#include "format/format_list.h"139 117 #include <err.h> 140 118 141 119 #define MAXOPTS 1024 142 120 143 //typedef enum {SOCKET, TRACE, STDIN, DEVICE, INTERFACE, RT } source_t;144 145 //typedef enum {ERF, PCAP, PCAPINT, DAG, RTCLIENT, WAG, WAGINT } format_e_t;146 147 //typedef enum {RTSERVER, GZERF } output_t;148 121 #if HAVE_BPF 149 122 /** A type encapsulating a bpf filter … … 158 131 #endif 159 132 160 // Error codes 161 enum {E_NOERROR, E_BAD_FORMAT, E_NO_INIT, E_NO_INIT_OUT, E_URI_LONG, E_URI_NOCOLON }; 162 163 static struct { 164 int err_num; // error code 165 char *problem; // the format, uri etc that caused the error for reporting purposes 166 } trace_err; 133 167 134 168 135 struct libtrace_format_t **format_list = 0; … … 216 183 fprintf(stderr, "%s: A uri must contain at least one colon e.g. format:destination\n", caller); 217 184 break; 185 case E_INIT_FAILED: 186 fprintf(stderr, "%s: libtrace failed to initialise (%s)\n",caller,trace_err.problem); 187 218 188 default: 219 189 fprintf(stderr, "Unkown errcode %d\n",trace_err.err_num); … … 310 280 311 281 if (libtrace->format->init_input) { 312 libtrace->format->init_input( libtrace); 282 if (!libtrace->format->init_input( libtrace)) { 283 trace_err.err_num = E_INIT_FAILED; 284 trace_err.problem = scan; 285 return 0; 286 } 313 287 } else { 314 288 trace_err.err_num = E_NO_INIT; … … 382 356 383 357 if (libtrace->format->init_output) { 384 libtrace->format->init_output( libtrace); 358 if(!libtrace->format->init_output( libtrace)) { 359 return 0; 360 } 385 361 } else { 386 362 trace_err.err_num = E_NO_INIT_OUT; … … 460 436 461 437 if (!libtrace) { 462 fprintf(stderr," Oi!You called trace_read_packet() with a NULL libtrace parameter!\n");438 fprintf(stderr,"You called trace_read_packet() with a NULL libtrace parameter!\n"); 463 439 } 464 440 assert(libtrace);
Note: See TracChangeset
for help on using the changeset viewer.