file-pcapng: add encoding arg to option dissector callback

This commit is contained in:
Martin Mathieson 2023-02-08 21:29:45 +00:00 committed by Martin Mathieson
parent 843da72f86
commit 7ce7af124a
3 changed files with 10 additions and 6 deletions

View File

@ -142,7 +142,8 @@ static
void dissect_darwin_process_info_option(proto_tree *option_tree, proto_item *option_item,
packet_info *pinfo, tvbuff_t *tvb, int offset,
int unknown_option_hf,
guint32 option_code, guint32 option_length)
guint32 option_code, guint32 option_length,
guint encoding _U_)
{
char *str;
e_guid_t uuid;
@ -202,17 +203,17 @@ proto_register_pcapng_darwin_process_info(void)
{ &hf_pcapng_darwin_process_id,
{ "Darwin Process ID", "pcapng.darwin.process_id",
FT_UINT32, BASE_DEC_HEX, NULL, 0x00,
"Process ID for Darwin Proces Info", HFILL }
"Process ID for Darwin Process Info", HFILL }
},
{ &hf_pcapng_option_darwin_process_name,
{ "Darwin Process Name", "pcapng.darwin.process_name",
FT_STRING, BASE_NONE, NULL, 0x00,
"Process name for Darwin Proces Info", HFILL }
"Process name for Darwin Process Info", HFILL }
},
{ &hf_pcapng_option_darwin_process_uuid,
{ "Darwin Process UUID", "pcapng.darwin.process_uuid",
FT_GUID, BASE_NONE, NULL, 0x00,
"Process UUID for Darwin Proces Info", HFILL }
"Process UUID for Darwin Process Info", HFILL }
},
};

View File

@ -561,6 +561,7 @@ gint dissect_options(proto_tree *tree, packet_info *pinfo,
option_item = proto_tree_add_item(options_tree, hf_pcapng_option, tvb, offset, -1, ENC_NA);
option_tree = proto_item_add_subtree(option_item, ett_pcapng_option);
/* TODO: could have done this once outside of loop? */
switch (block_type) {
case BLOCK_SECTION_HEADER:
hfj_pcapng_option_code = hf_pcapng_option_code_section_header;
@ -1239,7 +1240,7 @@ gint dissect_options(proto_tree *tree, packet_info *pinfo,
/* Use local block handling if available */
if (p_local_block_callback) {
p_local_block_callback->option_dissector(option_tree, option_item, pinfo, tvb, offset,
hf_pcapng_option_data, option_code, option_length);
hf_pcapng_option_data, option_code, option_length, encoding);
}
else {
proto_tree_add_item(option_tree, hf_pcapng_option_data, tvb, offset, option_length, ENC_NA);
@ -1247,6 +1248,7 @@ gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += option_length;
}
/* Pad this option out to next 4 bytes */
if ((option_length % 4) != 0) {
proto_item_set_len(option_item, option_length + 2 * 2 + (4 - option_length % 4));
option_length = 4 - option_length % 4;

View File

@ -28,7 +28,8 @@ typedef void (local_block_dissect_t)(proto_tree *tree, packet_info *pinfo, tvbuf
typedef void (local_block_option_dissect_t)(proto_tree *option_tree, proto_item *option_item,
packet_info *pinfo, tvbuff_t *tvb, int offset,
int unknown_option_hf,
guint32 option_code, guint32 option_length);
guint32 option_code, guint32 option_length,
guint encoding);
typedef struct {
const char* name;