/src/wireshark/epan/dissectors/packet-pcapng_block.c
Line | Count | Source |
1 | | /* packet-pcapng_block.c |
2 | | * Dissector to handle pcapng file-type-specific blocks. |
3 | | * |
4 | | * Wireshark - Network traffic analyzer |
5 | | * By Gerald Combs <gerald@wireshark.org> |
6 | | * Copyright 1998 Gerald Combs |
7 | | * |
8 | | * SPDX-License-Identifier: GPL-2.0-or-later |
9 | | */ |
10 | | |
11 | | #include "config.h" |
12 | | |
13 | | #include <epan/packet.h> |
14 | | |
15 | | #include <wiretap/wtap.h> |
16 | | |
17 | | void proto_register_pcapng_block(void); |
18 | | void event_register_pcapng_block(void); |
19 | | void proto_reg_handoff_pcapng_block(void); |
20 | | void event_reg_handoff_pcapng_block(void); |
21 | | |
22 | | static dissector_handle_t pcapng_block_handle; |
23 | | |
24 | | static int proto_pcapng_block; |
25 | | |
26 | | static dissector_table_t pcapng_block_type_dissector_table; |
27 | | |
28 | | static int |
29 | | dissect_pcapng_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
30 | 0 | { |
31 | | /* |
32 | | * Call the dissector for the block type of this block, if there |
33 | | * is one. |
34 | | */ |
35 | 0 | if (!dissector_try_uint(pcapng_block_type_dissector_table, |
36 | 0 | pinfo->rec->rec_header.ft_specific_header.record_type, tvb, pinfo, tree)) { |
37 | | /* |
38 | | * There isn't one; just do a minimal display. |
39 | | */ |
40 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "PCAPNG"); |
41 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "Pcapng block, type %u", |
42 | 0 | pinfo->rec->rec_header.ft_specific_header.record_type); |
43 | |
|
44 | 0 | proto_tree_add_item(tree, proto_pcapng_block, tvb, 0, -1, ENC_NA); |
45 | 0 | } |
46 | 0 | return tvb_captured_length(tvb); |
47 | 0 | } |
48 | | |
49 | | static void common_register_pcapng_block(void) |
50 | 15 | { |
51 | 15 | proto_pcapng_block = proto_register_protocol("Pcapng block", "PCAPNG", "pcapng"); |
52 | 15 | pcapng_block_type_dissector_table = register_dissector_table("pcapng.block_type", |
53 | 15 | "pcapng block type", proto_pcapng_block, FT_UINT32, BASE_DEC); |
54 | | |
55 | 15 | pcapng_block_handle = register_dissector("pcapng", dissect_pcapng_block, |
56 | 15 | proto_pcapng_block); |
57 | 15 | } |
58 | | |
59 | | void proto_register_pcapng_block(void) |
60 | 15 | { |
61 | 15 | common_register_pcapng_block(); |
62 | 15 | } |
63 | | |
64 | | void event_register_pcapng_block(void) |
65 | 0 | { |
66 | 0 | common_register_pcapng_block(); |
67 | 0 | } |
68 | | |
69 | | static void common_reg_handoff_pcapng_block(void) |
70 | 15 | { |
71 | 15 | dissector_add_uint("wtap_fts_rec", wtap_pcapng_file_type_subtype(), |
72 | 15 | pcapng_block_handle); |
73 | 15 | } |
74 | | |
75 | | void |
76 | | proto_reg_handoff_pcapng_block(void) |
77 | 15 | { |
78 | 15 | common_reg_handoff_pcapng_block(); |
79 | 15 | } |
80 | | |
81 | | void |
82 | | event_reg_handoff_pcapng_block(void) |
83 | 0 | { |
84 | 0 | common_reg_handoff_pcapng_block(); |
85 | 0 | } |
86 | | |
87 | | /* |
88 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
89 | | * |
90 | | * Local variables: |
91 | | * c-basic-offset: 8 |
92 | | * tab-width: 8 |
93 | | * indent-tabs-mode: t |
94 | | * End: |
95 | | * |
96 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
97 | | * :indentSize=8:tabSize=8:noTabs=false: |
98 | | */ |