diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-05-17 14:04:04 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-05-17 21:04:55 +0000 |
commit | 2262c06f41d3529fa461eb6401fa06e81d38dfdd (patch) | |
tree | 3c9b07ce89370433c2db91a52b9a812e3373b553 /wiretap | |
parent | 6a19c7ca0e22fbae38c157456ae6519fcdba2627 (diff) |
Correctly write out the isb_startime and isb_endtime options.
They're not marshalled as a 64-bit integer in pcapng files, they're
marshelled as 2 32-bit integers, the first of which is the upper 64 bits
of the value and the second of which is the lower 64 bits of the value.
Bug: 12349
Change-Id: I2bde51ac11b2518ef2ddaecf43672c984f26081a
Reviewed-on: https://code.wireshark.org/review/15492
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/wtap_opttypes.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c index 7e3b4837c5..2e7016b78c 100644 --- a/wiretap/wtap_opttypes.c +++ b/wiretap/wtap_opttypes.c @@ -497,6 +497,21 @@ gboolean wtap_opttype_write_data_uint64(struct wtap_dumper* wdh, wtap_option_typ return TRUE; } +gboolean wtap_opttype_write_data_uint64_timestamp(struct wtap_dumper* wdh, wtap_option_type* data, int *err) +{ + guint32 high, low; + + high = (guint32)(data->uint64val >> 32); + low = (guint32)(data->uint64val >> 0); + if (!wtap_dump_file_write(wdh, &high, sizeof(guint32), err)) + return FALSE; + wdh->bytes_dumped += 4; + if (!wtap_dump_file_write(wdh, &low, sizeof(guint32), err)) + return FALSE; + wdh->bytes_dumped += 4; + return TRUE; +} + int wtap_optionblock_set_option_uint8(wtap_optionblock_t block, guint option_id, guint8 value) { wtap_optblock_value_t* opt_value = wtap_optionblock_get_option(block, option_id); @@ -683,8 +698,8 @@ static void nrb_create(wtap_optionblock_t block) static void isb_create(wtap_optionblock_t block) { static wtap_optblock_reg_t comment_option = {"opt_comment", "Optional comment", WTAP_OPTTYPE_STRING, wtap_opttype_write_size_string, wtap_opttype_write_data_string, {0}, {0}}; - static wtap_optblock_reg_t starttime_option = {"start_time", "Start Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64, {0}, {0}}; - static wtap_optblock_reg_t endtime_option = {"end_time", "End Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64, {0}, {0}}; + static wtap_optblock_reg_t starttime_option = {"start_time", "Start Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64_timestamp, {0}, {0}}; + static wtap_optblock_reg_t endtime_option = {"end_time", "End Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64_timestamp, {0}, {0}}; static wtap_optblock_reg_t rcv_pkt_option = {"recv", "Receive Packets", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not_minus1, wtap_opttype_write_data_uint64, {0}, {0}}; static wtap_optblock_reg_t drop_pkt_option = {"drop", "Dropped Packets", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not_minus1, wtap_opttype_write_data_uint64, {0}, {0}}; static wtap_optblock_reg_t filteraccept_option = {"filter_accept", "Filter Accept", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not_minus1, wtap_opttype_write_data_uint64, {0}, {0}}; |