/src/wireshark/epan/dissectors/packet-snaeth.c
Line | Count | Source |
1 | | /* packet-snaeth.c |
2 | | * Routines for SNA-over-Ethernet (Ethernet type 80d5) |
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 | | #include <epan/etypes.h> |
15 | | |
16 | | /* |
17 | | * See |
18 | | * |
19 | | * http://www.cisco.com/univercd/cc/td/doc/product/software/ssr90/rpc_r/18059.pdf |
20 | | */ |
21 | | void proto_register_snaeth(void); |
22 | | void proto_reg_handoff_snaeth(void); |
23 | | |
24 | | static int proto_snaeth; |
25 | | static int hf_snaeth_len; |
26 | | static int hf_snaeth_padding; |
27 | | |
28 | | static int ett_snaeth; |
29 | | |
30 | | static dissector_handle_t llc_handle; |
31 | | static dissector_handle_t snaeth_handle; |
32 | | |
33 | | static int |
34 | | dissect_snaeth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
35 | 0 | { |
36 | 0 | proto_tree *snaeth_tree; |
37 | 0 | proto_item *snaeth_ti; |
38 | 0 | uint16_t len; |
39 | 0 | tvbuff_t *next_tvb; |
40 | |
|
41 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNAETH"); |
42 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "SNA over Ethernet"); |
43 | | |
44 | | /* length */ |
45 | 0 | len = tvb_get_ntohs(tvb, 0); |
46 | |
|
47 | 0 | if (tree) { |
48 | 0 | snaeth_ti = proto_tree_add_item(tree, proto_snaeth, tvb, 0, 3, |
49 | 0 | ENC_NA); |
50 | 0 | snaeth_tree = proto_item_add_subtree(snaeth_ti, ett_snaeth); |
51 | 0 | proto_tree_add_uint(snaeth_tree, hf_snaeth_len, tvb, 0, 2, len); |
52 | 0 | proto_tree_add_item(snaeth_tree, hf_snaeth_padding, tvb, 2, 1, ENC_BIG_ENDIAN); |
53 | 0 | } |
54 | | |
55 | | /* |
56 | | * Adjust the length of this tvbuff to include only the SNA-over- |
57 | | * Ethernet header and data. |
58 | | */ |
59 | 0 | set_actual_length(tvb, 3 + len); |
60 | | |
61 | | /* |
62 | | * Rest of packet starts with an 802.2 LLC header. |
63 | | */ |
64 | 0 | next_tvb = tvb_new_subset_remaining(tvb, 3); |
65 | 0 | call_dissector(llc_handle, next_tvb, pinfo, tree); |
66 | 0 | return tvb_captured_length(tvb); |
67 | 0 | } |
68 | | |
69 | | void |
70 | | proto_register_snaeth(void) |
71 | 15 | { |
72 | 15 | static hf_register_info hf[] = { |
73 | 15 | { &hf_snaeth_len, |
74 | 15 | { "Length", "snaeth.len", FT_UINT16, BASE_DEC, NULL, 0x0, |
75 | 15 | "Length of LLC payload", HFILL }}, |
76 | 15 | { &hf_snaeth_padding, |
77 | 15 | { "Padding", "snaeth.padding", FT_UINT8, BASE_HEX, NULL, 0x0, |
78 | 15 | NULL, HFILL }}, |
79 | 15 | }; |
80 | 15 | static int *ett[] = { |
81 | 15 | &ett_snaeth, |
82 | 15 | }; |
83 | | |
84 | 15 | proto_snaeth = proto_register_protocol("SNA-over-Ethernet", |
85 | 15 | "SNAETH", "snaeth"); |
86 | 15 | proto_register_field_array(proto_snaeth, hf, array_length(hf)); |
87 | 15 | proto_register_subtree_array(ett, array_length(ett)); |
88 | | |
89 | 15 | snaeth_handle = register_dissector("snaeth", dissect_snaeth, proto_snaeth); |
90 | 15 | } |
91 | | |
92 | | void |
93 | | proto_reg_handoff_snaeth(void) |
94 | 15 | { |
95 | | /* |
96 | | * Get handle for the LLC dissector. |
97 | | */ |
98 | 15 | llc_handle = find_dissector_add_dependency("llc", proto_snaeth); |
99 | | |
100 | 15 | dissector_add_uint("ethertype", ETHERTYPE_SNA, snaeth_handle); |
101 | 15 | } |
102 | | |
103 | | /* |
104 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
105 | | * |
106 | | * Local variables: |
107 | | * c-basic-offset: 8 |
108 | | * tab-width: 8 |
109 | | * indent-tabs-mode: t |
110 | | * End: |
111 | | * |
112 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
113 | | * :indentSize=8:tabSize=8:noTabs=false: |
114 | | */ |