2014-05-25 00:35:08 +00:00
|
|
|
/* packet-pcapng.c
|
2018-01-09 00:38:10 +00:00
|
|
|
* Dissector to handle pcapng file-type-specific blocks.
|
2014-05-25 00:37:52 +00:00
|
|
|
*
|
2014-05-25 00:35:08 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-05-25 00:35:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
#include <wiretap/wtap.h>
|
|
|
|
|
2014-08-15 07:51:03 +00:00
|
|
|
void proto_register_pcapng_block(void);
|
|
|
|
void proto_reg_handoff_pcapng_block(void);
|
|
|
|
|
2014-05-25 00:35:08 +00:00
|
|
|
static int proto_pcapng_block = -1;
|
|
|
|
|
|
|
|
static dissector_table_t pcapng_block_type_dissector_table;
|
|
|
|
|
2015-11-18 01:16:06 +00:00
|
|
|
static int
|
|
|
|
dissect_pcapng_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2014-05-25 00:35:08 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Call the dissector for the block type of this block, if there
|
|
|
|
* is one.
|
|
|
|
*/
|
|
|
|
if (!dissector_try_uint(pcapng_block_type_dissector_table,
|
2018-02-09 00:19:12 +00:00
|
|
|
pinfo->rec->rec_header.ft_specific_header.record_type, tvb, pinfo, tree)) {
|
2014-05-25 00:35:08 +00:00
|
|
|
/*
|
|
|
|
* There isn't one; just do a minimal display.
|
|
|
|
*/
|
2018-01-09 00:38:10 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PCAPNG");
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Pcapng block, type %u",
|
2018-02-09 00:19:12 +00:00
|
|
|
pinfo->rec->rec_header.ft_specific_header.record_type);
|
2014-05-25 00:35:08 +00:00
|
|
|
|
|
|
|
proto_tree_add_item(tree, proto_pcapng_block, tvb, 0, -1, ENC_NA);
|
|
|
|
}
|
2015-11-18 01:16:06 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2014-05-25 00:35:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void proto_register_pcapng_block(void)
|
|
|
|
{
|
2018-01-09 00:38:10 +00:00
|
|
|
proto_pcapng_block = proto_register_protocol("Pcapng block",
|
|
|
|
"PCAPNG", "pcapng");
|
2014-05-25 00:35:08 +00:00
|
|
|
pcapng_block_type_dissector_table = register_dissector_table("pcapng.block_type",
|
2018-01-09 00:38:10 +00:00
|
|
|
"pcapng block type", proto_pcapng_block, FT_UINT32, BASE_DEC);
|
2014-05-25 00:35:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_pcapng_block(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t pcapng_block_handle;
|
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
pcapng_block_handle = create_dissector_handle(dissect_pcapng_block,
|
2014-05-25 00:35:08 +00:00
|
|
|
proto_pcapng_block);
|
|
|
|
dissector_add_uint("wtap_fts_rec", WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
|
|
|
|
pcapng_block_handle);
|
|
|
|
}
|
2014-08-15 17:04:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|