#include "strerror.h"
#endif
-#ifdef NEED_GETOPT_H
-#include "getopt.h"
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+#include "wsgetopt.h"
#endif
#include <glib.h>
*/
static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_as_protocol>";
-static guint32 cum_bytes = 0;
+static guint32 cum_bytes;
static nstime_t first_ts;
static nstime_t prev_dis_ts;
static nstime_t prev_cap_ts;
{
char *init_progfile_dir_error;
int opt, i;
- extern char *optarg;
gboolean arg_error = FALSE;
#ifdef _WIN32
load_wpcap();
#endif
- init_cap_file(&cfile);
+ cap_file_init(&cfile);
/* Print format defaults to this. */
print_format = PR_FMT_TEXT;
ptr += bytes_read;
}
- bytes_read = 0;
phdr->ts.secs = hdr.ts_sec;
phdr->ts.nsecs = hdr.ts_usec * 1000;
phdr->caplen = bytes_needed = hdr.incl_len;
/* If we're going to print packet information, or we're going to
run a read filter, or we're going to process taps, set up to
do a dissection and do so. */
- frame_data_init(&fdata, cf->count, &cf->elapsed_time, whdr, offset,
- &cum_bytes, &first_ts, &prev_dis_ts, &prev_cap_ts);
+ frame_data_init(&fdata, cf->count, whdr, offset, cum_bytes);
passed = TRUE;
create_proto_tree = TRUE;
tap_queue_init(&edt);
- printf("%lu", (unsigned long int)cf->count);
+ printf("%lu", (unsigned long int) cf->count);
+
+ frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
+ &first_ts, &prev_dis_ts, &prev_cap_ts);
/* We only need the columns if we're printing packet info but we're
*not* verbose; in verbose mode, we print the protocol tree, not
tap_push_tapped_queue(&edt);
+ frame_data_set_after_dissect(&fdata, &cum_bytes, &prev_dis_ts);
+
for(i = 0; i < n_rfilters; i++) {
/* Run the read filter if we have one. */
if (rfcodes[i])
};
}
-char* base_display_e_to_string(base_display_e bd)
+static char* absolute_time_display_e_to_string(absolute_time_display_e atd)
+{
+ switch(atd) {
+ case ABSOLUTE_TIME_LOCAL:
+ return "ABSOLUTE_TIME_LOCAL";
+ case ABSOLUTE_TIME_UTC:
+ return "ABSOLUTE_TIME_UTC";
+ default:
+ return "n.a.";
+ }
+}
+
+static char* base_display_e_to_string(base_display_e bd)
{
switch(bd) {
case BASE_NONE:
exit(1);
}
- printf("%u %s %s - ",
- g_cmd_line_index,
- ftenum_to_string(hfi),
- base_display_e_to_string(hfi->display));
+ switch (hfi->type) {
+
+ case FT_ABSOLUTE_TIME:
+ printf("%u %s %s - ",
+ g_cmd_line_index,
+ ftenum_to_string(hfi),
+ absolute_time_display_e_to_string(hfi->display));
+ break;
+ break;
+
+ default:
+ printf("%u %s %s - ",
+ g_cmd_line_index,
+ ftenum_to_string(hfi),
+ base_display_e_to_string(hfi->display));
+ break;
+ }
rs=g_malloc(sizeof(pci_t));
rs->hf_index=hfi->id;