Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-lge_monitor.c
Line
Count
Source
1
/* packet-lge_monitor.c
2
 * Routines for LGE Monitor packet dissection
3
 * Copyright 2006, Anders Broman <anders.broman[at]ericsson.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 *
11
 * LGE Monitor is a trace tool from Nortel.
12
 */
13
14
#include "config.h"
15
16
#include <epan/packet.h>
17
18
void proto_reg_handoff_lge_monitor(void);
19
void proto_register_lge_monitor(void);
20
21
static dissector_handle_t lge_monitor_handle;
22
23
/* Initialize the protocol and registered fields */
24
static int proto_lge_monitor;
25
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;
30
31
/* Initialize the subtree pointers */
32
static int ett_lge_monitor;
33
static int ett_lge_header;
34
35
static dissector_handle_t mtp3_handle, m3ua_handle, sccp_handle, sctp_handle;
36
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 }
41
};
42
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 }
49
};
50
51
0
#define LGEMON_PROTO_HEADER_LENGTH 12
52
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_)
56
0
{
57
0
  unsigned offset = 0;
58
0
  uint32_t lge_monitor_proto_id;
59
0
  tvbuff_t* next_tvb = NULL;
60
0
  proto_tree* header_tree;
61
62
/* Set up structures needed to add the protocol subtree and manage it */
63
0
  proto_item *ti;
64
0
  proto_tree *lge_monitor_tree;
65
66
/* Make entries in Protocol column and Info column on summary display */
67
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "LGE Monitor");
68
69
0
  ti = proto_tree_add_item(tree, proto_lge_monitor, tvb, 0, LGEMON_PROTO_HEADER_LENGTH, ENC_NA);
70
0
  lge_monitor_tree = proto_item_add_subtree(ti, ett_lge_monitor);
71
72
0
  header_tree = proto_tree_add_subtree(lge_monitor_tree, tvb, offset, LGEMON_PROTO_HEADER_LENGTH, ett_lge_header, NULL, "LGE Monitor PDU");
73
0
  proto_tree_add_item(header_tree, hf_lge_monitor_dir, tvb, offset, 4, ENC_BIG_ENDIAN);
74
0
  offset += 4;
75
0
  lge_monitor_proto_id = tvb_get_ntohl(tvb,offset);
76
0
  proto_tree_add_item(header_tree, hf_lge_monitor_prot, tvb, offset, 4, ENC_BIG_ENDIAN);
77
0
  offset += 4;
78
0
  proto_tree_add_item(header_tree, hf_lge_monitor_length, tvb, offset, 4, ENC_BIG_ENDIAN);
79
0
  offset += 4;
80
81
0
  next_tvb = tvb_new_subset_remaining(tvb, offset);
82
83
0
  switch (lge_monitor_proto_id){
84
0
  case 0: /* MTP3 */
85
0
    call_dissector(mtp3_handle, next_tvb, pinfo, tree);
86
0
    break;
87
0
  case 1: /* SCCP */
88
0
    call_dissector(sccp_handle, next_tvb, pinfo, tree);
89
0
    break;
90
0
  case 2: /* SCTP */
91
0
    call_dissector(sctp_handle, next_tvb, pinfo, tree);
92
0
    break;
93
0
  case 3: /* M3UA */
94
0
    call_dissector(m3ua_handle, next_tvb, pinfo, tree);
95
0
    break;
96
0
  default:
97
0
    proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_data, tvb, offset, -1, ENC_NA);
98
0
    break;
99
0
  }
100
0
  return tvb_captured_length(tvb);
101
0
}
102
103
104
void
105
proto_reg_handoff_lge_monitor(void)
106
16
{
107
16
  dissector_add_for_decode_as_with_preference("udp.port", lge_monitor_handle);
108
16
  mtp3_handle  = find_dissector_add_dependency("mtp3", proto_lge_monitor);
109
16
  m3ua_handle  = find_dissector_add_dependency("m3ua", proto_lge_monitor);
110
16
  sccp_handle  = find_dissector_add_dependency("sccp", proto_lge_monitor);
111
16
  sctp_handle  = find_dissector_add_dependency("sctp", proto_lge_monitor);
112
16
}
113
114
void
115
proto_register_lge_monitor(void)
116
16
{
117
118
/* Setup list of header fields  */
119
16
  static hf_register_info hf[] = {
120
16
    { &hf_lge_monitor_dir,
121
16
      { "Direction",           "lge_monitor.dir",
122
16
      FT_UINT32, BASE_DEC, VALS(lge_monitor_dir_vals), 0x0,
123
16
      NULL, HFILL }
124
16
    },
125
16
    { &hf_lge_monitor_prot,
126
16
      { "Protocol Identifier",           "lge_monitor.prot",
127
16
      FT_UINT32, BASE_DEC, VALS(lge_monitor_prot_vals), 0x0,
128
16
      NULL, HFILL }
129
16
    },
130
16
    { &hf_lge_monitor_length,
131
16
      { "Payload Length",           "lge_monitor.length",
132
16
      FT_UINT32, BASE_DEC, NULL, 0x0,
133
16
      NULL, HFILL }
134
16
    },
135
16
    { &hf_lge_monitor_data,
136
16
      { "LGE Monitor data",           "lge_monitor.monitor_data",
137
16
      FT_BYTES, BASE_NONE, NULL, 0x0,
138
16
      NULL, HFILL }
139
16
    },
140
16
  };
141
142
/* Setup protocol subtree array */
143
16
  static int *ett[] = {
144
16
    &ett_lge_monitor,
145
16
    &ett_lge_header
146
16
  };
147
148
/* Register the protocol name and description */
149
16
  proto_lge_monitor = proto_register_protocol("LGE Monitor","LGE_Monitor", "lge_monitor");
150
151
/* Required function calls to register the header fields and subtrees used */
152
16
  proto_register_field_array(proto_lge_monitor, hf, array_length(hf));
153
16
  proto_register_subtree_array(ett, array_length(ett));
154
155
/* Register the dissector */
156
16
  lge_monitor_handle = register_dissector("lge_monitor", dissect_lge_monitor, proto_lge_monitor);
157
16
}
158
159
/*
160
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
161
 *
162
 * Local variables:
163
 * c-basic-offset: 8
164
 * tab-width: 8
165
 * indent-tabs-mode: t
166
 * End:
167
 *
168
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
169
 * :indentSize=8:tabSize=8:noTabs=false:
170
 */