wiretap: have the file's time stamp resolution be a dump parameter.
Add a tsprec value to the wtap_dump_params structure, giving the per-file time stamp precision. In wtap_dump_init_dumper(), when constructing a dummy IDB for files that don't have one, fill in the tsprecision and time_units_per_second values based on the tsprec value in the wtap_dump_params structure. Change-Id: I3708b144d4d0ac0dfbe32bd1c16768a75c942141 Reviewed-on: https://code.wireshark.org/review/37979 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
f8efccc3cc
commit
c68d36b173
|
@ -124,6 +124,7 @@ void ImportTextDialog::convertTextFile() {
|
|||
wtap_dump_params_init(¶ms, NULL);
|
||||
params.encap = import_info_.encapsulation;
|
||||
params.snaplen = import_info_.max_frame_length;
|
||||
params.tsprec = WTAP_TSPREC_USEC; /* XXX - support other precisions? */
|
||||
/* Use a random name for the temporary import buffer */
|
||||
import_info_.wdh = wtap_dump_open_tempfile(&tmpname, "import", WTAP_FILE_TYPE_SUBTYPE_PCAPNG, WTAP_UNCOMPRESSED, ¶ms, &err);
|
||||
capfile_name_.append(tmpname ? tmpname : "temporary file");
|
||||
|
|
|
@ -2328,7 +2328,37 @@ wtap_dump_init_dumper(int file_type_subtype, wtap_compression_type compression_t
|
|||
descr = wtap_block_create(WTAP_BLOCK_IF_DESCR);
|
||||
descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(descr);
|
||||
descr_mand->wtap_encap = params->encap;
|
||||
descr_mand->time_units_per_second = 1000000; /* default microsecond resolution */
|
||||
descr_mand->tsprecision = params->tsprec;
|
||||
switch (params->tsprec) {
|
||||
|
||||
case WTAP_TSPREC_SEC:
|
||||
descr_mand->time_units_per_second = 1;
|
||||
break;
|
||||
|
||||
case WTAP_TSPREC_DSEC:
|
||||
descr_mand->time_units_per_second = 10;
|
||||
break;
|
||||
|
||||
case WTAP_TSPREC_CSEC:
|
||||
descr_mand->time_units_per_second = 100;
|
||||
break;
|
||||
|
||||
case WTAP_TSPREC_MSEC:
|
||||
descr_mand->time_units_per_second = 1000;
|
||||
break;
|
||||
|
||||
case WTAP_TSPREC_USEC:
|
||||
descr_mand->time_units_per_second = 1000000;
|
||||
break;
|
||||
|
||||
case WTAP_TSPREC_NSEC:
|
||||
descr_mand->time_units_per_second = 1000000000;
|
||||
break;
|
||||
|
||||
default:
|
||||
descr_mand->time_units_per_second = 1000000; /* default microsecond resolution */
|
||||
break;
|
||||
}
|
||||
snaplen = params->snaplen;
|
||||
if (snaplen == 0) {
|
||||
/*
|
||||
|
|
|
@ -420,6 +420,7 @@ wtap_dump_params_init(wtap_dump_params *params, wtap *wth)
|
|||
|
||||
params->encap = wtap_file_encap(wth);
|
||||
params->snaplen = wtap_snapshot_length(wth);
|
||||
params->tsprec = wtap_file_tsprec(wth);
|
||||
params->shb_hdrs = wtap_file_get_shb_for_new_file(wth);
|
||||
params->idb_inf = wtap_file_get_idb_info(wth);
|
||||
params->nrb_hdrs = wtap_file_get_nrb_for_new_file(wth);
|
||||
|
|
|
@ -1565,6 +1565,7 @@ typedef struct addrinfo_lists {
|
|||
typedef struct wtap_dump_params {
|
||||
int encap; /**< Per-file packet encapsulation, or WTAP_ENCAP_PER_PACKET */
|
||||
int snaplen; /**< Per-file snapshot length (what if it's per-interface?) */
|
||||
int tsprec; /**< Per-file time stamp precision */
|
||||
GArray *shb_hdrs; /**< The section header block(s) information, or NULL. */
|
||||
wtapng_iface_descriptions_t *idb_inf; /**< The interface description information, or NULL. */
|
||||
GArray *nrb_hdrs; /**< The name resolution blocks(s) comment/custom_opts information, or NULL. */
|
||||
|
|
Loading…
Reference in New Issue