Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-at-rl.c
blob0d9fabdc7df0039d5a52708cded3a5fc9d800345
1 /* packet-at-rl.c
2 * Dissector for Allied Telesis Resiliency Link Frames
4 * Copyright (c) 2024 by Martin Mayer <martin.mayer@m2-it-solutions.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
14 #include <epan/etypes.h>
15 #include <epan/packet.h>
17 void proto_register_at_rl(void);
18 void proto_reg_handoff_at_rl(void);
20 static dissector_handle_t at_rl_handle;
22 static int proto_at_rl;
24 #define AT_RL_FRAME_LEN 18
26 /* Fields */
27 static int hf_at_rl_sequence;
28 static int hf_at_rl_master;
29 static int hf_at_rl_padding;
30 static int hf_at_rl_vcsid;
31 static int hf_at_rl_role_change;
33 static int ett_at_rl;
35 static int
36 dissect_at_rl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
39 /* Check if packet is destined to the Allied Telesis address (01:00:CD:FA:1B:AC) */
40 uint8_t dst_mac[6] = {0x01, 0x00, 0xCD, 0xFA, 0x1B, 0xAC};
41 address dst_addr = ADDRESS_INIT_NONE;
42 set_address(&dst_addr, AT_ETHER, sizeof(dst_mac), &dst_mac);
44 if(!addresses_equal(&pinfo->dl_dst, &dst_addr))
45 return 0;
47 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AT RL");
48 col_clear(pinfo->cinfo,COL_INFO);
49 col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u, VCS-ID: %u",
50 tvb_get_uint32(tvb, 0, ENC_BIG_ENDIAN),
51 tvb_get_uint16(tvb, 12, ENC_BIG_ENDIAN));
53 /* Frame has fixed length, so we can directly set tree and reported length (padding will most likely be added) */
54 tvb_set_reported_length(tvb, AT_RL_FRAME_LEN);
56 proto_item *ti = proto_tree_add_item(tree, proto_at_rl, tvb, 0, AT_RL_FRAME_LEN, ENC_NA);
57 proto_tree *at_rl_tree = proto_item_add_subtree(ti, ett_at_rl);
59 int offset = 0;
60 proto_tree_add_item(at_rl_tree, hf_at_rl_sequence, tvb, offset, 4, ENC_BIG_ENDIAN);
61 offset += 4;
63 proto_tree_add_item(at_rl_tree, hf_at_rl_master, tvb, offset, 6, ENC_NA);
64 offset += 6;
66 proto_tree_add_item(at_rl_tree, hf_at_rl_padding, tvb, offset, 2, ENC_NA);
67 offset += 2;
69 proto_tree_add_item(at_rl_tree, hf_at_rl_vcsid, tvb, offset, 2, ENC_BIG_ENDIAN);
70 offset += 2;
72 proto_tree_add_item(at_rl_tree, hf_at_rl_role_change, tvb, offset, 4, ENC_TIME_SECS);
74 return AT_RL_FRAME_LEN;
77 void
78 proto_register_at_rl(void)
80 static hf_register_info hf[] = {
81 { &hf_at_rl_sequence,
82 { "Sequence No.", "atrl.sequence",
83 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
85 { &hf_at_rl_master,
86 { "Active Master", "atrl.master",
87 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }
89 { &hf_at_rl_padding,
90 { "Padding", "atrl.padding",
91 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
93 { &hf_at_rl_vcsid,
94 { "Virtual Chassis Stack ID", "atrl.vcsid",
95 FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }
97 { &hf_at_rl_role_change,
98 { "Last Role Change", "atrl.role_change",
99 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }
103 static int *ett[] = {
104 &ett_at_rl
107 proto_at_rl = proto_register_protocol ("Allied Telesis Resiliency Link", "AT RL", "atrl");
109 proto_register_field_array(proto_at_rl, hf, array_length(hf));
110 proto_register_subtree_array(ett, array_length(ett));
112 at_rl_handle = register_dissector("atrl", dissect_at_rl, proto_at_rl);
115 void
116 proto_reg_handoff_at_rl(void)
118 dissector_add_uint("ethertype", ETHERTYPE_ATRL, at_rl_handle);
122 * Editor modelines - https://www.wireshark.org/tools/modelines.html
124 * Local variables:
125 * c-basic-offset: 4
126 * tab-width: 8
127 * indent-tabs-mode: nil
128 * End:
130 * vi: set shiftwidth=4 tabstop=8 expandtab:
131 * :indentSize=4:tabSize=8:noTabs=true: