Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-lge_monitor.c
bloba7c8a54d9a308d0f313f44fef2799038946a8f7f
1 /* packet-lge_monitor.c
2 * Routines for LGE Monitor packet dissection
3 * Copyright 2006, Anders Broman <anders.broman[at]ericsson.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 * LGE Monitor is a trace tool from Nortel.
14 #include "config.h"
16 #include <epan/packet.h>
18 void proto_reg_handoff_lge_monitor(void);
19 void proto_register_lge_monitor(void);
21 static dissector_handle_t lge_monitor_handle;
23 /* Initialize the protocol and registered fields */
24 static int proto_lge_monitor;
26 static int hf_lge_monitor_dir;
27 static int hf_lge_monitor_prot;
28 static int hf_lge_monitor_length;
29 static int hf_lge_monitor_data;
31 /* Initialize the subtree pointers */
32 static int ett_lge_monitor;
33 static int ett_lge_header;
35 static dissector_handle_t mtp3_handle, m3ua_handle, sccp_handle, sctp_handle;
37 static const value_string lge_monitor_dir_vals[] = {
38 { 0x00, "TX(Transmit Message Signaling Unit)" },
39 { 0x01, "RX(Receive Message Signaling Unit)" },
40 { 0, NULL }
43 static const value_string lge_monitor_prot_vals[] = {
44 { 0x00, "MTP-3(Message Transfer Part 3)" },
45 { 0x01, "SCCP(Signaling Connection Control Part)"},
46 { 0x02, "SCTP(Stream Control Transmission Protocol)"},
47 { 0x03, "M3UA(MTP-3 User Adaptation)"},
48 { 0, NULL }
51 #define LGEMON_PROTO_HEADER_LENGTH 12
53 /* Code to actually dissect the packets */
54 static int
55 dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
57 int offset = 0;
58 uint32_t lge_monitor_proto_id;
59 tvbuff_t* next_tvb = NULL;
60 proto_tree* header_tree;
62 /* Set up structures needed to add the protocol subtree and manage it */
63 proto_item *ti;
64 proto_tree *lge_monitor_tree;
66 /* Make entries in Protocol column and Info column on summary display */
67 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LGE Monitor");
69 ti = proto_tree_add_item(tree, proto_lge_monitor, tvb, 0, LGEMON_PROTO_HEADER_LENGTH, ENC_NA);
70 lge_monitor_tree = proto_item_add_subtree(ti, ett_lge_monitor);
72 header_tree = proto_tree_add_subtree(lge_monitor_tree, tvb, offset, LGEMON_PROTO_HEADER_LENGTH, ett_lge_header, NULL, "LGE Monitor PDU");
73 proto_tree_add_item(header_tree, hf_lge_monitor_dir, tvb, offset, 4, ENC_BIG_ENDIAN);
74 offset += 4;
75 lge_monitor_proto_id = tvb_get_ntohl(tvb,offset);
76 proto_tree_add_item(header_tree, hf_lge_monitor_prot, tvb, offset, 4, ENC_BIG_ENDIAN);
77 offset += 4;
78 proto_tree_add_item(header_tree, hf_lge_monitor_length, tvb, offset, 4, ENC_BIG_ENDIAN);
79 offset += 4;
81 next_tvb = tvb_new_subset_remaining(tvb, offset);
83 switch (lge_monitor_proto_id){
84 case 0: /* MTP3 */
85 call_dissector(mtp3_handle, next_tvb, pinfo, tree);
86 break;
87 case 1: /* SCCP */
88 call_dissector(sccp_handle, next_tvb, pinfo, tree);
89 break;
90 case 2: /* SCTP */
91 call_dissector(sctp_handle, next_tvb, pinfo, tree);
92 break;
93 case 3: /* M3UA */
94 call_dissector(m3ua_handle, next_tvb, pinfo, tree);
95 break;
96 default:
97 proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_data, tvb, offset, -1, ENC_NA);
98 break;
100 return tvb_captured_length(tvb);
104 void
105 proto_reg_handoff_lge_monitor(void)
107 dissector_add_for_decode_as_with_preference("udp.port", lge_monitor_handle);
108 mtp3_handle = find_dissector_add_dependency("mtp3", proto_lge_monitor);
109 m3ua_handle = find_dissector_add_dependency("m3ua", proto_lge_monitor);
110 sccp_handle = find_dissector_add_dependency("sccp", proto_lge_monitor);
111 sctp_handle = find_dissector_add_dependency("sctp", proto_lge_monitor);
114 void
115 proto_register_lge_monitor(void)
118 /* Setup list of header fields */
119 static hf_register_info hf[] = {
120 { &hf_lge_monitor_dir,
121 { "Direction", "lge_monitor.dir",
122 FT_UINT32, BASE_DEC, VALS(lge_monitor_dir_vals), 0x0,
123 NULL, HFILL }
125 { &hf_lge_monitor_prot,
126 { "Protocol Identifier", "lge_monitor.prot",
127 FT_UINT32, BASE_DEC, VALS(lge_monitor_prot_vals), 0x0,
128 NULL, HFILL }
130 { &hf_lge_monitor_length,
131 { "Payload Length", "lge_monitor.length",
132 FT_UINT32, BASE_DEC, NULL, 0x0,
133 NULL, HFILL }
135 { &hf_lge_monitor_data,
136 { "LGE Monitor data", "lge_monitor.monitor_data",
137 FT_BYTES, BASE_NONE, NULL, 0x0,
138 NULL, HFILL }
142 /* Setup protocol subtree array */
143 static int *ett[] = {
144 &ett_lge_monitor,
145 &ett_lge_header
148 /* Register the protocol name and description */
149 proto_lge_monitor = proto_register_protocol("LGE Monitor","LGE_Monitor", "lge_monitor");
151 /* Required function calls to register the header fields and subtrees used */
152 proto_register_field_array(proto_lge_monitor, hf, array_length(hf));
153 proto_register_subtree_array(ett, array_length(ett));
155 /* Register the dissector */
156 lge_monitor_handle = register_dissector("lge_monitor", dissect_lge_monitor, proto_lge_monitor);
160 * Editor modelines - https://www.wireshark.org/tools/modelines.html
162 * Local variables:
163 * c-basic-offset: 8
164 * tab-width: 8
165 * indent-tabs-mode: t
166 * End:
168 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
169 * :indentSize=8:tabSize=8:noTabs=false: