#endif /* HAVE_LIBPCAP */
static int load_cap_file(capture_file *, char *, int);
-static gboolean process_packet(capture_file *cf, long offset,
+static gboolean process_packet(capture_file *cf, gint64 offset,
const struct wtap_pkthdr *whdr, union wtap_pseudo_header *pseudo_header,
const guchar *pd);
static void show_capture_file_io_error(const char *, int, gboolean);
fprintf(output, " -F <output file type> set the output file type, default is libpcap\n");
fprintf(output, " an empty \"-F\" option will list the file types\n");
fprintf(output, " -V add output of packet tree (Packet Details)\n");
+ fprintf(output, " -S display packets even when writing to a file\n");
fprintf(output, " -x add output of hex and ASCII dump (Packet Bytes)\n");
fprintf(output, " -T pdml|ps|psml|text output format of text output (def: text)\n");
- fprintf(output, " -t ad|a|r|d output format of time stamps (def: r: rel. to first)\n");
+ fprintf(output, " -t ad|a|r|d|e output format of time stamps (def: r: rel. to first)\n");
fprintf(output, " -l flush output after each packet\n");
fprintf(output, " -q be more quiet on stdout (e.g. when using statistics)\n");
fprintf(output, " -X <key>:<value> eXtension options, see the man page for details\n");
char badopt;
GLogLevelFlags log_flags;
int status;
+ int optind_initial;
-#define OPTSTRING_INIT "a:b:c:d:Df:F:hi:lLnN:o:pqr:R:s:St:T:vVw:xX:y:z:"
+#define OPTSTRING_INIT "a:b:c:d:Df:F:G:hi:lLnN:o:pqr:R:s:St:T:vVw:xX:y:z:"
#ifdef HAVE_LIBPCAP
#ifdef _WIN32
#define OPTSTRING_WIN32 "B:"
*/
get_credential_info();
+ /*
+ * Now attempt to get the pathname of the plugins.
+ */
+ init_plugin_dir();
+
+ /*
+ * In order to have the -X opts assigned before the wslua machine starts
+ * we need to call getopts before epan_init() gets called.
+ */
+ opterr = 0;
+ optind_initial = optind;
+
+ while ((opt = getopt(argc, argv, optstring)) != -1) {
+ switch (opt) {
+ case 'X':
+ ex_opt_add(optarg);
+ break;
+ default:
+ break;
+ }
+ }
+
+ optind = optind_initial;
+ opterr = 1;
+
/* nothing more than the standard GLib handler, but without a warning */
log_flags =
G_LOG_LEVEL_ERROR|
log_flags,
log_func_ignore, NULL /* user_data */);
- /* initialize memory allocation subsystem */
- ep_init_chunk();
- se_init_chunk();
-
- /* initialize the GUID to name mapping table */
- guids_init();
-
initialize_funnel_ops();
#ifdef HAVE_LIBPCAP
"-G" flag, as the "-G" flag dumps information registered by the
dissectors, and we must do it before we read the preferences, in
case any dissectors register preferences. */
- epan_init(PLUGIN_DIR,register_all_protocols,register_all_protocol_handoffs,
- failure_message,open_failure_message,read_failure_message);
+ epan_init(register_all_protocols, register_all_protocol_handoffs,
+ failure_message, open_failure_message, read_failure_message);
/* Register all tap listeners; we do this before we parse the arguments,
as the "-z" argument can specify a registered tap. */
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL);
+ get_compiled_version_info(comp_info_str, get_epan_compiled_version_info);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str);
+ get_runtime_version_info(runtime_info_str, NULL);
/* Print format defaults to this. */
print_format = PR_FMT_TEXT;
case 'o': /* Override preference from command line */
switch (prefs_set_pref(optarg)) {
+ case PREFS_SET_OK:
+ break;
+
case PREFS_SET_SYNTAX_ERR:
cmdarg_err("Invalid -o flag \"%s\"", optarg);
exit(1);
timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
else if (strcmp(optarg, "d") == 0)
timestamp_set_type(TS_DELTA);
+ else if (strcmp(optarg, "e") == 0)
+ timestamp_set_type(TS_EPOCH);
else {
cmdarg_err("Invalid time stamp type \"%s\"",
optarg);
print_hex = TRUE;
break;
case 'X':
- ex_opt_add(optarg);
break;
case 'z':
/* We won't call the init function for the stat this soon
wtap_dumper *pdh;
int err;
gchar *err_info;
- long data_offset;
+ gint64 data_offset;
char *save_file_string = NULL;
linktype = wtap_file_encap(cf->wth);
static void
fill_in_fdata(frame_data *fdata, capture_file *cf,
- const struct wtap_pkthdr *phdr, long offset)
+ const struct wtap_pkthdr *phdr, gint64 offset)
{
fdata->next = NULL;
fdata->prev = NULL;
}
static gboolean
-process_packet(capture_file *cf, long offset, const struct wtap_pkthdr *whdr,
+process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
union wtap_pseudo_header *pseudo_header, const guchar *pd)
{
frame_data fdata;