/src/wireshark/epan/dissectors/packet-cisco-sm.c
Line | Count | Source |
1 | | /* packet-cisco-sm.c |
2 | | * Routines for Cisco Session Management Protocol dissection |
3 | | * Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to> |
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 | | |
12 | | /* |
13 | | * This is basically a glue dissector for the Cisco SM protocol. It sits |
14 | | * between the RUDP and MTP3 layers between SLTs and MGCs. |
15 | | * |
16 | | * A link to an overview of the technology : |
17 | | * http://www.cisco.com/en/US/products/sw/netmgtsw/ps4883/products_installation_and_configuration_guide_chapter09186a008010950a.html |
18 | | * Link showing debugs of the protocol: |
19 | | * http://www.cisco.com/univercd/cc/td/doc/product/access/sc/rel7/omts/omts_apb.htm#30052 |
20 | | * Scroll down to Backhaul Debug Event/Cause/Reason Codes: |
21 | | * http://www.cisco.com/en/US/docs/ios-xml/ios/debug/command/s1/db-s2.html#GUID-83B6671D-B86F-4B41-819C-85D14F4AACAE |
22 | | * Free/Opensource implementation: |
23 | | * http://yate.null.ro/websvn/filedetails.php?repname=yate&path=%2Ftrunk%2Fmodules%2Fserver%2Fciscosm.cpp |
24 | | */ |
25 | | |
26 | | #include "config.h" |
27 | | |
28 | | #include <epan/packet.h> |
29 | | |
30 | | #define MESSAGE_TYPE_START 0 |
31 | | #define MESSAGE_TYPE_STOP 1 |
32 | | #define MESSAGE_TYPE_ACTIVE 2 |
33 | | #define MESSAGE_TYPE_STANDBY 3 |
34 | | #define MESSAGE_TYPE_Q_HOLD_INVOKE 4 |
35 | | #define MESSAGE_TYPE_Q_HOLD_RESPONSE 5 |
36 | | #define MESSAGE_TYPE_Q_RESUME_INVOKE 6 |
37 | | #define MESSAGE_TYPE_Q_RESUME_RESPONSE 7 |
38 | | #define MESSAGE_TYPE_Q_RESET_INVOKE 8 |
39 | | #define MESSAGE_TYPE_Q_RESET_RESPONSE 9 |
40 | 0 | #define MESSAGE_TYPE_PDU 0x8000 |
41 | | |
42 | | void proto_register_sm(void); |
43 | | void proto_reg_handoff_sm(void); |
44 | | |
45 | | static const value_string sm_message_type_value[] = { |
46 | | { MESSAGE_TYPE_START, "Start Message" }, |
47 | | { MESSAGE_TYPE_STOP, "Stop Message" }, |
48 | | { MESSAGE_TYPE_ACTIVE, "Active Message" }, |
49 | | { MESSAGE_TYPE_STANDBY, "Standby Message" }, |
50 | | { MESSAGE_TYPE_Q_HOLD_INVOKE, "Q_HOLD Invoke Message" }, |
51 | | { MESSAGE_TYPE_Q_HOLD_RESPONSE, "Q_HOLD Response Message" }, |
52 | | { MESSAGE_TYPE_Q_RESUME_INVOKE, "Q_RESUME Invoke Message" }, |
53 | | { MESSAGE_TYPE_Q_RESUME_RESPONSE, "Q_RESUME Response Message" }, |
54 | | { MESSAGE_TYPE_Q_RESET_INVOKE, "Q_RESET Invoke Message" }, |
55 | | { MESSAGE_TYPE_Q_RESET_RESPONSE, "Q_RESET Response Message" }, |
56 | | { MESSAGE_TYPE_PDU, "PDU Message" }, |
57 | | { 0, NULL } |
58 | | }; |
59 | | |
60 | | static const value_string sm_message_type_value_info[] = { |
61 | | { MESSAGE_TYPE_START, "Start" }, |
62 | | { MESSAGE_TYPE_STOP, "Stop" }, |
63 | | { MESSAGE_TYPE_ACTIVE, "Active" }, |
64 | | { MESSAGE_TYPE_STANDBY, "Standby" }, |
65 | | { MESSAGE_TYPE_Q_HOLD_INVOKE, "Q_HOLD Invoke" }, |
66 | | { MESSAGE_TYPE_Q_HOLD_RESPONSE, "Q_HOLD Response" }, |
67 | | { MESSAGE_TYPE_Q_RESUME_INVOKE, "Q_RESUME Invoke" }, |
68 | | { MESSAGE_TYPE_Q_RESUME_RESPONSE, "Q_RESUME Response" }, |
69 | | { MESSAGE_TYPE_Q_RESET_INVOKE, "Q_RESET Invoke" }, |
70 | | { MESSAGE_TYPE_Q_RESET_RESPONSE, "Q_RESET Response" }, |
71 | | { MESSAGE_TYPE_PDU, "PDU" }, |
72 | | { 0, NULL } |
73 | | }; |
74 | | |
75 | | static const value_string sm_alignment_type[] = { |
76 | | { 0x00, "Unknown (probably linkset was already up)"}, |
77 | | { 0x03, "Emergency alignment"}, |
78 | | { 0x04, "Normal alignment"}, |
79 | | { 0x05, "Power On MTP2"}, |
80 | | { 0x06, "Start MTP2"}, |
81 | | { 0, NULL} |
82 | | }; |
83 | | |
84 | | static const value_string sm_backhaul_reason_code[] = { |
85 | | { 0x00, "Layer management request"}, |
86 | | { 0x01, "SUERM (Signal Unit Error Monitor) failure"}, |
87 | | { 0x02, "Excessively long alignment period"}, |
88 | | { 0x03, "T7 timer expired"}, |
89 | | { 0x04, "Physical interface failure"}, |
90 | | { 0x05, "Two or three invalid BSNs"}, |
91 | | { 0x06, "Two or three invalid FIBs"}, |
92 | | { 0x07, "LSSU (Link Status Signal Unit) condition"}, |
93 | | { 0x13, "SIOs (Service Information Octets) received " |
94 | | "in Link State Control (LSC)"}, |
95 | | { 0x14, "Timer T2 expired waiting for SIO"}, |
96 | | { 0x15, "Timer T3 expired waiting for SIE/SIN "}, |
97 | | { 0x16, "SIO received in initial alignment control (IAC)"}, |
98 | | { 0x17, "Proving period failure"}, |
99 | | { 0x18, "Timer T1 expired waiting for FISU (Fill-In Signal Unit)"}, |
100 | | { 0x19, "SIN received in the in-service state"}, |
101 | | { 0x20, "CTS lost"}, |
102 | | { 0x25, "No resources"}, |
103 | | { 0, NULL} |
104 | | }; |
105 | | |
106 | | static const value_string sm_backhaul_event_code[] = { |
107 | | { 0x00, "Local processor outage"}, |
108 | | { 0x01, "Local processor outage recovered"}, |
109 | | { 0x02, "Entered a congested state"}, |
110 | | { 0x03, "Exited a congested state"}, |
111 | | { 0x04, "Physical layer up"}, |
112 | | { 0x05, "Physical layer down"}, |
113 | | { 0x06, "Protocol error"}, |
114 | | { 0x07, "Link is aligned"}, |
115 | | { 0x08, "Link alignment lost"}, |
116 | | { 0x09, "Retransmit buffer full"}, |
117 | | { 0x0a, "Retransmit buffer no longer full"}, |
118 | | { 0x0b, "Negative acknowledgment"}, |
119 | | { 0x0c, "Remote entered congestion"}, |
120 | | { 0x0d, "Remote exited congestion"}, |
121 | | { 0x0e, "Remote entered processor outage"}, |
122 | | { 0x0f, "Remote exited processor outage"}, |
123 | | { 0, NULL} |
124 | | }; |
125 | | |
126 | | static const value_string sm_backhaul_cause_code[] = { |
127 | | { 0x00, "Unknown (default)"}, |
128 | | { 0x01, "Management initiated"}, |
129 | | { 0x02, "Abnormal BSN (backward sequence number)"}, |
130 | | { 0x03, "Abnormal FIB (Forward Indicator Bit)"}, |
131 | | { 0x04, "Congestion discard"}, |
132 | | { 0, NULL} |
133 | | }; |
134 | | |
135 | | static const value_string sm_linkdown_cause_code[] = { |
136 | | { 0x00, "Unknown (default)"}, |
137 | | { 0x01, "Management initiated"}, |
138 | | { 0x03, "Congestion ended"}, |
139 | | { 0, NULL} |
140 | | }; |
141 | | |
142 | | static const value_string sm_retrieval_type[] = { |
143 | | { 0x01, "Request for BSN"}, |
144 | | { 0x02, "Request for MSUs"}, |
145 | | { 0x03, "Request to drop MSUs"}, |
146 | | { 0, NULL} |
147 | | }; |
148 | | |
149 | | static const value_string sm_lsc_state_type[] = { |
150 | | { 0x00, "Set LPO"}, |
151 | | { 0x01, "Clear LPO"}, |
152 | | { 0x02, "Set Emergency"}, |
153 | | { 0x03, "Clear Emergency"}, |
154 | | { 0x04, "Clear Buffers"}, |
155 | | { 0x05, "Clear Transmit Buffer"}, |
156 | | { 0x06, "Clear ReTransmission Buffer"}, |
157 | | { 0x07, "Clear Receive Buffer"}, |
158 | | { 0x08, "Continue"}, |
159 | | { 0x09, "Power On"}, |
160 | | { 0x0a, "Start"}, |
161 | | { 0x0b, "Stop"}, |
162 | | { 0, NULL} |
163 | | }; |
164 | | |
165 | | static const value_string sm_stat_request_type[] = { |
166 | | { 0x00, "Reset"}, |
167 | | { 0x01, "Send & Reset"}, |
168 | | { 0x02, "Send"}, |
169 | | { 0, NULL} |
170 | | }; |
171 | | |
172 | 0 | #define PDU_CONNECT_REQUEST 0x06 |
173 | 0 | #define PDU_CONNECT_CONFIRM 0x07 |
174 | 0 | #define PDU_DISCONNECT_CONFIRM 0x0b |
175 | 0 | #define PDU_DISCONNECT_INDICATION 0x0c |
176 | 0 | #define PDU_MTP3_TO_SLT 0x10 |
177 | 0 | #define PDU_MTP3_FROM_SLT 0x11 |
178 | 0 | #define PDU_RETRIEVAL_REQUEST 0x12 |
179 | 0 | #define PDU_RETRIEVAL_CONFIRM 0x13 |
180 | 0 | #define PDU_LSC_REQUEST 0x20 |
181 | 0 | #define PDU_LSC_CONFIRM 0x21 |
182 | 0 | #define PDU_LSC_INDICATION 0x22 |
183 | 0 | #define PDU_STAT_REQUEST 0x44 |
184 | | |
185 | | static const value_string sm_pdu_type_value[] = { |
186 | | { PDU_CONNECT_REQUEST, "Connect Request"}, |
187 | | { PDU_CONNECT_CONFIRM, "Connect Confirm"}, |
188 | | { 0x0a, "Disconnect Request"}, |
189 | | { PDU_DISCONNECT_CONFIRM, "Disconnect Confirm"}, |
190 | | { PDU_DISCONNECT_INDICATION, "Disconnect Indication Message"}, |
191 | | { PDU_MTP3_TO_SLT, "MSU Request (message to MTP2 link)"}, |
192 | | { PDU_MTP3_FROM_SLT, "MSU Indication (message from MTP2 link)"}, |
193 | | { PDU_RETRIEVAL_REQUEST, "Retrieval Request"}, |
194 | | { PDU_RETRIEVAL_CONFIRM, "Retrieval Confirm"}, |
195 | | { 0x14, "Retrieval Indication"}, |
196 | | { 0x15, "Retrieval Message"}, |
197 | | { PDU_LSC_REQUEST, "Link State Controller Request"}, |
198 | | { PDU_LSC_CONFIRM, "Link State Controller Confirm"}, |
199 | | { PDU_LSC_INDICATION, "Link State Controller Indication"}, |
200 | | { 0x40, "Configuration Request"}, |
201 | | { 0x41, "Configuration Confirm"}, |
202 | | { 0x42, "Status Request"}, |
203 | | { 0x43, "Status Confirm"}, |
204 | | { PDU_STAT_REQUEST, "Statistic Request"}, |
205 | | { 0x45, "Statistic Confirm"}, |
206 | | { 0x46, "Control Request"}, |
207 | | { 0x47, "Control Confirm"}, |
208 | | { 0x50, "Flow Control Request"}, |
209 | | { 0x51, "Flow Control Indication"}, |
210 | | { 0, NULL } |
211 | | }; |
212 | | |
213 | | /* TODO: Change to useful name once known */ |
214 | 0 | #define SM_PROTOCOL_X004 0x0004 /* https://gitlab.com/wireshark/wireshark/-/issues/7188 */ |
215 | | /* RUDP/SM stack called BSM V1 (version 1 versus Version 0 used for SS7). */ |
216 | 0 | #define SM_PROTOCOL_X100 0x0100 |
217 | 0 | #define SM_PROTOCOL_X101 0x0101 |
218 | 0 | #define SM_PROTOCOL_X114 0x0114 |
219 | 0 | #define SM_PROTOCOL_X122 0x0122 |
220 | | |
221 | | |
222 | | /* Initialize the protocol and registered fields */ |
223 | | static int proto_sm; |
224 | | |
225 | | static int hf_sm_sm_msg_type; |
226 | | static int hf_sm_protocol; |
227 | | static int hf_sm_msg_id; |
228 | | static int hf_sm_msg_type; |
229 | | static int hf_sm_channel; |
230 | | static int hf_sm_bearer; |
231 | | static int hf_sm_len; |
232 | | static int hf_sm_ip_addr; |
233 | | static int hf_sm_context; |
234 | | static int hf_sm_eisup_msg_id; |
235 | | static int hf_sm_tag; |
236 | | static int hf_sm_alignment_type; |
237 | | static int hf_sm_backhaul_reason_code; |
238 | | static int hf_sm_backhaul_event_code; |
239 | | static int hf_sm_backhaul_cause_code; |
240 | | static int hf_sm_linkdown_cause_code; |
241 | | static int hf_sm_retrieval_type; |
242 | | static int hf_sm_lsc_state_type; |
243 | | static int hf_sm_stat_request_type; |
244 | | static int hf_sm_bsn_num; |
245 | | |
246 | | /* Initialize the subtree pointers */ |
247 | | static int ett_sm; |
248 | | |
249 | | static dissector_handle_t sdp_handle; |
250 | | static dissector_handle_t mtp3_handle; |
251 | | static dissector_handle_t q931_handle; |
252 | | |
253 | | /* Code to actually dissect the packets */ |
254 | | static int |
255 | | dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
256 | 0 | { |
257 | 0 | proto_item *ti; |
258 | 0 | proto_tree *sm_tree; |
259 | 0 | tvbuff_t *next_tvb = NULL; |
260 | 0 | uint32_t sm_message_type; |
261 | 0 | uint32_t bh_event_code = 0; |
262 | 0 | uint16_t protocol; |
263 | 0 | uint16_t msg_type = 0; |
264 | 0 | uint16_t length; |
265 | 0 | uint16_t tag; |
266 | 0 | int offset = 0; |
267 | |
|
268 | 0 | sm_message_type = tvb_get_ntohl(tvb,offset); |
269 | |
|
270 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "SM"); |
271 | |
|
272 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "Cisco SM Packet (%s)", |
273 | 0 | val_to_str_const(sm_message_type, sm_message_type_value_info,"reserved")); |
274 | |
|
275 | 0 | ti = proto_tree_add_item(tree, proto_sm, tvb, offset, -1, ENC_NA); |
276 | 0 | sm_tree = proto_item_add_subtree(ti, ett_sm); |
277 | |
|
278 | 0 | proto_tree_add_uint_format_value(sm_tree, hf_sm_sm_msg_type, tvb, offset, 4, sm_message_type, |
279 | 0 | "%s (0x%0x)", val_to_str_const(sm_message_type, sm_message_type_value, "reserved"), sm_message_type); |
280 | |
|
281 | 0 | offset = offset + 4; |
282 | 0 | if (sm_message_type == MESSAGE_TYPE_PDU) { |
283 | 0 | proto_tree_add_item_ret_uint16(sm_tree, hf_sm_protocol, tvb, offset, 2, ENC_BIG_ENDIAN, &protocol); |
284 | 0 | offset = offset + 2; |
285 | 0 | switch(protocol){ |
286 | | /* start case RUDP BSM v.1 ---------------------------------------------------------- */ |
287 | 0 | case SM_PROTOCOL_X004: |
288 | 0 | proto_tree_add_item(sm_tree, hf_sm_msg_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
289 | 0 | offset = offset +2; |
290 | 0 | msg_type = tvb_get_ntohs(tvb,offset); |
291 | 0 | proto_tree_add_uint_format_value(sm_tree, hf_sm_msg_type, tvb, offset, 2, msg_type, |
292 | 0 | "%s (0x%0x)", val_to_str_const(msg_type, sm_pdu_type_value, "reserved"), |
293 | 0 | msg_type); |
294 | 0 | msg_type = tvb_get_ntohs(tvb,offset); |
295 | 0 | offset = offset + 2; |
296 | 0 | proto_tree_add_item(sm_tree, hf_sm_channel, tvb, offset, 2, ENC_BIG_ENDIAN); |
297 | 0 | offset = offset + 2; |
298 | 0 | proto_tree_add_item(sm_tree, hf_sm_bearer, tvb, offset, 2, ENC_BIG_ENDIAN); |
299 | 0 | offset = offset +2; |
300 | 0 | proto_tree_add_item_ret_uint16(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN, &length); |
301 | 0 | offset = offset +2; |
302 | 0 | proto_item_set_len(ti, 16); |
303 | |
|
304 | 0 | if (length > 0) { |
305 | 0 | next_tvb = tvb_new_subset_length(tvb, offset, length); |
306 | |
|
307 | 0 | if ((msg_type == PDU_MTP3_TO_SLT || msg_type == PDU_MTP3_FROM_SLT)) { |
308 | 0 | call_dissector(q931_handle, next_tvb, pinfo, tree); |
309 | 0 | } else { |
310 | 0 | call_data_dissector(next_tvb, pinfo, tree); |
311 | 0 | } |
312 | 0 | } |
313 | |
|
314 | 0 | break; |
315 | | /* end case RUDP BSM v.1 ---------------------------------------------------------- */ |
316 | | |
317 | 0 | case SM_PROTOCOL_X100: |
318 | 0 | case SM_PROTOCOL_X122: |
319 | | /* Protocol 0x100/0x122 only contains a length and then an EISUP packet */ |
320 | 0 | proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
321 | 0 | length = tvb_get_ntohs(tvb,offset); |
322 | 0 | offset = offset + 2; |
323 | 0 | proto_item_set_len(ti, 8); |
324 | | |
325 | | /* This should be the EISUP dissector but we haven't got one |
326 | | * right now - so decode it as data for now ... */ |
327 | 0 | next_tvb = tvb_new_subset_length(tvb, offset, length); |
328 | 0 | call_data_dissector(next_tvb, pinfo, sm_tree); |
329 | |
|
330 | 0 | break; |
331 | 0 | case SM_PROTOCOL_X101: |
332 | | /* XXX Reverse engineered so this may not be correct!!! |
333 | | * EISUP - used between Cisco HSI and Cisco PGW devices, |
334 | | * uses RUDP with default port number 8003. |
335 | | * Protocol stack is RUDP->Cisco SM->SDP. |
336 | | * This implementation is PROPRIETARY |
337 | | */ |
338 | 0 | proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
339 | 0 | length = tvb_get_ntohs(tvb,offset); |
340 | 0 | offset = offset + 2; |
341 | 0 | proto_item_set_len(ti, length + offset); |
342 | | /* The next stuff seems to be IP addr */ |
343 | 0 | proto_tree_add_item(sm_tree, hf_sm_ip_addr, tvb, offset, 4, ENC_BIG_ENDIAN); |
344 | 0 | offset = offset + 4; |
345 | | /* This part looks to be the same per session */ |
346 | 0 | proto_tree_add_item(sm_tree, hf_sm_context, tvb, offset, 4, ENC_BIG_ENDIAN); |
347 | 0 | offset = offset +4; |
348 | | /* Some sort of message type? */ |
349 | 0 | proto_tree_add_item(sm_tree, hf_sm_eisup_msg_id, tvb, offset, 1, ENC_BIG_ENDIAN); |
350 | 0 | offset = offset + 1; |
351 | | /* XXX Problem are tags 1 or two bytes???*/ |
352 | 0 | proto_tree_add_item_ret_uint16(sm_tree, hf_sm_tag, tvb, offset, 2, ENC_BIG_ENDIAN, &tag); |
353 | 0 | offset = offset +2; |
354 | 0 | if (tag== 0x01ac) { |
355 | 0 | proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
356 | 0 | length = tvb_get_ntohs(tvb,offset); |
357 | 0 | offset = offset +2; |
358 | 0 | next_tvb = tvb_new_subset_length(tvb, offset, length); |
359 | 0 | call_dissector(sdp_handle, next_tvb, pinfo, sm_tree); |
360 | | /*offset = offset+length;*/ |
361 | |
|
362 | 0 | } |
363 | | /*return;*/ |
364 | 0 | break; |
365 | 0 | case SM_PROTOCOL_X114: |
366 | | /* XXX Reverse enginered so this may not be correct!!! */ |
367 | 0 | proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
368 | 0 | length = tvb_get_ntohs(tvb,offset); |
369 | 0 | offset = offset + 2; |
370 | 0 | proto_item_set_len(ti, length + offset); |
371 | | /* The next stuff seems to be IP addr */ |
372 | 0 | proto_tree_add_item(sm_tree, hf_sm_ip_addr, tvb, offset, 4, ENC_BIG_ENDIAN); |
373 | 0 | offset = offset + 4; |
374 | 0 | proto_tree_add_item(sm_tree, hf_sm_context, tvb, offset, 4, ENC_BIG_ENDIAN); |
375 | 0 | offset = offset +4; |
376 | | /* Some sort of message type? */ |
377 | 0 | proto_tree_add_item(sm_tree, hf_sm_eisup_msg_id, tvb, offset, 1, ENC_BIG_ENDIAN); |
378 | 0 | offset = offset + 1; |
379 | | /* XXX Problem are tags 1 or two bytes???*/ |
380 | 0 | proto_tree_add_item_ret_uint16(sm_tree, hf_sm_tag, tvb, offset, 2, ENC_BIG_ENDIAN, &tag); |
381 | 0 | offset = offset +2; |
382 | 0 | if (tag== 0x01ac) { |
383 | 0 | proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
384 | 0 | length = tvb_get_ntohs(tvb,offset); |
385 | 0 | offset = offset +2; |
386 | 0 | next_tvb = tvb_new_subset_length(tvb, offset, length); |
387 | 0 | call_dissector(sdp_handle, next_tvb, pinfo, sm_tree); |
388 | | /*offset = offset+length;*/ |
389 | |
|
390 | 0 | } |
391 | 0 | break; |
392 | 0 | default: |
393 | 0 | proto_tree_add_item(sm_tree, hf_sm_msg_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
394 | 0 | offset = offset +2; |
395 | 0 | msg_type = tvb_get_ntohs(tvb,offset); |
396 | 0 | proto_tree_add_uint_format_value(sm_tree, hf_sm_msg_type, tvb, offset, 2, msg_type, |
397 | 0 | "%s (0x%0x)", val_to_str_const(msg_type, sm_pdu_type_value, "reserved"), |
398 | 0 | msg_type); |
399 | 0 | msg_type = tvb_get_ntohs(tvb,offset); |
400 | 0 | offset = offset + 2; |
401 | 0 | proto_tree_add_item(sm_tree, hf_sm_channel, tvb, offset, 2, ENC_BIG_ENDIAN); |
402 | 0 | offset = offset + 2; |
403 | 0 | proto_tree_add_item(sm_tree, hf_sm_bearer, tvb, offset, 2, ENC_BIG_ENDIAN); |
404 | 0 | offset = offset +2; |
405 | 0 | proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); |
406 | 0 | length = tvb_get_ntohs(tvb,offset); |
407 | 0 | offset = offset +2; |
408 | 0 | proto_item_set_len(ti, 16); |
409 | |
|
410 | 0 | if (length > 0) { |
411 | 0 | next_tvb = tvb_new_subset_length(tvb, offset, length); |
412 | |
|
413 | 0 | switch (msg_type) { |
414 | 0 | case PDU_MTP3_TO_SLT: |
415 | 0 | case PDU_MTP3_FROM_SLT: |
416 | 0 | call_dissector(mtp3_handle, next_tvb, pinfo, tree); |
417 | 0 | break; |
418 | 0 | case PDU_CONNECT_REQUEST: |
419 | 0 | case PDU_CONNECT_CONFIRM: |
420 | 0 | proto_tree_add_item(sm_tree, hf_sm_alignment_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
421 | 0 | break; |
422 | 0 | case PDU_DISCONNECT_CONFIRM: |
423 | 0 | case PDU_DISCONNECT_INDICATION: |
424 | 0 | proto_tree_add_item(sm_tree, hf_sm_backhaul_reason_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
425 | 0 | break; |
426 | 0 | case PDU_RETRIEVAL_REQUEST: |
427 | 0 | case PDU_RETRIEVAL_CONFIRM: |
428 | 0 | proto_tree_add_item(sm_tree, hf_sm_retrieval_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
429 | 0 | if (msg_type == PDU_RETRIEVAL_CONFIRM && tvb_get_ntohl(tvb,offset) == 0x01) { |
430 | 0 | offset += 4; |
431 | 0 | proto_tree_add_item(sm_tree, hf_sm_bsn_num, tvb, offset, 4, ENC_BIG_ENDIAN); |
432 | 0 | } |
433 | 0 | break; |
434 | 0 | case PDU_LSC_REQUEST: |
435 | 0 | case PDU_LSC_CONFIRM: |
436 | 0 | proto_tree_add_item(sm_tree, hf_sm_lsc_state_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
437 | 0 | break; |
438 | 0 | case PDU_LSC_INDICATION: |
439 | 0 | proto_tree_add_item(sm_tree, hf_sm_backhaul_event_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
440 | 0 | bh_event_code = tvb_get_ntohl(tvb,offset); |
441 | 0 | if (bh_event_code == 0x02 || bh_event_code == 0x04) { |
442 | 0 | offset += 4; |
443 | 0 | proto_tree_add_item(sm_tree, hf_sm_linkdown_cause_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
444 | 0 | } else if (bh_event_code == 0x06) { |
445 | 0 | offset += 4; |
446 | 0 | proto_tree_add_item(sm_tree, hf_sm_backhaul_cause_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
447 | 0 | } |
448 | 0 | break; |
449 | 0 | case PDU_STAT_REQUEST: |
450 | 0 | proto_tree_add_item(sm_tree, hf_sm_stat_request_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
451 | 0 | break; |
452 | 0 | default: |
453 | 0 | call_data_dissector(next_tvb, pinfo, tree); |
454 | 0 | } |
455 | 0 | } |
456 | 0 | } |
457 | 0 | } |
458 | | |
459 | 0 | return tvb_captured_length(tvb); |
460 | 0 | } |
461 | | |
462 | | void |
463 | | proto_register_sm(void) |
464 | 16 | { |
465 | 16 | static hf_register_info hf[] = { |
466 | 16 | { &hf_sm_sm_msg_type, |
467 | 16 | { "SM Message Type", "sm.sm_msg_type", |
468 | 16 | FT_UINT32, BASE_HEX, NULL, 0x0, |
469 | 16 | NULL, HFILL } |
470 | 16 | }, |
471 | 16 | { &hf_sm_protocol, |
472 | 16 | { "Protocol Type", "sm.protocol", |
473 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, |
474 | 16 | NULL, HFILL } |
475 | 16 | }, |
476 | 16 | { &hf_sm_msg_id, |
477 | 16 | { "Message ID", "sm.msgid", |
478 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, |
479 | 16 | NULL, HFILL } |
480 | 16 | }, |
481 | 16 | { &hf_sm_msg_type, |
482 | 16 | { "Message Type", "sm.msg_type", |
483 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, |
484 | 16 | NULL, HFILL } |
485 | 16 | }, |
486 | 16 | { &hf_sm_channel, |
487 | 16 | { "Channel ID", "sm.channel", |
488 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, |
489 | 16 | NULL, HFILL } |
490 | 16 | }, |
491 | 16 | { &hf_sm_bearer, |
492 | 16 | { "Bearer ID", "sm.bearer", |
493 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, |
494 | 16 | NULL, HFILL } |
495 | 16 | }, |
496 | 16 | { &hf_sm_len, |
497 | 16 | { "Length", "sm.len", |
498 | 16 | FT_UINT16, BASE_DEC, NULL, 0x0, |
499 | 16 | NULL, HFILL } |
500 | 16 | }, |
501 | 16 | { &hf_sm_ip_addr, |
502 | 16 | { "IPv4 address","sm.ip_addr", |
503 | 16 | FT_IPv4,BASE_NONE, NULL, 0x0, |
504 | 16 | NULL, HFILL } |
505 | 16 | }, |
506 | 16 | { &hf_sm_context, |
507 | 16 | { "Context","sm.context", |
508 | 16 | FT_UINT32, BASE_DEC, NULL, 0x0, |
509 | 16 | "Context(guesswork!)", HFILL } |
510 | 16 | }, |
511 | 16 | { &hf_sm_eisup_msg_id, |
512 | 16 | { "Message id","sm.eisup_message_id", |
513 | 16 | FT_UINT8, BASE_DEC, NULL, 0x0, |
514 | 16 | "Message id(guesswork!)", HFILL } |
515 | 16 | }, |
516 | 16 | { &hf_sm_tag, |
517 | 16 | { "Tag","sm.tag", |
518 | 16 | FT_UINT16, BASE_DEC, NULL, 0x0, |
519 | 16 | "Tag(guesswork!)", HFILL } |
520 | 16 | }, |
521 | 16 | { &hf_sm_alignment_type, |
522 | 16 | { "Alignment type","sm.connect_type", |
523 | 16 | FT_UINT32, BASE_HEX, VALS(sm_alignment_type), 0x0, |
524 | 16 | NULL, HFILL } |
525 | 16 | }, |
526 | 16 | { &hf_sm_backhaul_reason_code, |
527 | 16 | { "Backhaul reason code","sm.backhaul_reason", |
528 | 16 | FT_UINT32, BASE_HEX, VALS(sm_backhaul_reason_code), 0x0, |
529 | 16 | NULL, HFILL } |
530 | 16 | }, |
531 | 16 | { &hf_sm_backhaul_event_code, |
532 | 16 | { "Backhaul event code","sm.backhaul_event", |
533 | 16 | FT_UINT32, BASE_HEX, VALS(sm_backhaul_event_code), 0x0, |
534 | 16 | NULL, HFILL } |
535 | 16 | }, |
536 | 16 | { &hf_sm_backhaul_cause_code, |
537 | 16 | { "Backhaul cause code","sm.backhaul_cause", |
538 | 16 | FT_UINT32, BASE_HEX, VALS(sm_backhaul_cause_code), 0x0, |
539 | 16 | NULL, HFILL } |
540 | 16 | }, |
541 | 16 | { &hf_sm_linkdown_cause_code, |
542 | 16 | { "Link down cause","sm.linkdown_reason", |
543 | 16 | FT_UINT32, BASE_HEX, VALS(sm_linkdown_cause_code), 0x0, |
544 | 16 | NULL, HFILL } |
545 | 16 | }, |
546 | | |
547 | 16 | { &hf_sm_retrieval_type, |
548 | 16 | { "Retrieval type","sm.retrieval_type", |
549 | 16 | FT_UINT32, BASE_HEX, VALS(sm_retrieval_type), 0x0, |
550 | 16 | NULL, HFILL } |
551 | 16 | }, |
552 | 16 | { &hf_sm_lsc_state_type, |
553 | 16 | { "LSC Request type","sm.lsc_state_type", |
554 | 16 | FT_UINT32, BASE_HEX, VALS(sm_lsc_state_type), 0x0, |
555 | 16 | NULL, HFILL } |
556 | 16 | }, |
557 | 16 | { &hf_sm_stat_request_type, |
558 | 16 | { "Statistic request type","sm.stat_request_type", |
559 | 16 | FT_UINT32, BASE_HEX, VALS(sm_stat_request_type), 0x0, |
560 | 16 | NULL, HFILL } |
561 | 16 | }, |
562 | 16 | { &hf_sm_bsn_num, |
563 | 16 | { "BSN","sm.bsn_num", |
564 | 16 | FT_UINT32, BASE_DEC, NULL, 0x0, |
565 | 16 | NULL, HFILL } |
566 | 16 | }, |
567 | | |
568 | 16 | }; |
569 | | |
570 | | /* Setup protocol subtree array */ |
571 | 16 | static int *ett[] = { |
572 | 16 | &ett_sm, |
573 | 16 | }; |
574 | | |
575 | | /* Register the protocol name and description */ |
576 | 16 | proto_sm = proto_register_protocol("Cisco Session Management", |
577 | 16 | "SM", "sm"); |
578 | | |
579 | 16 | register_dissector("sm", dissect_sm, proto_sm); |
580 | | |
581 | | /* Required function calls to register the header fields and subtrees used */ |
582 | 16 | proto_register_field_array(proto_sm, hf, array_length(hf)); |
583 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
584 | 16 | } |
585 | | |
586 | | void |
587 | | proto_reg_handoff_sm(void) |
588 | 16 | { |
589 | 16 | sdp_handle = find_dissector_add_dependency("sdp", proto_sm); |
590 | 16 | mtp3_handle = find_dissector_add_dependency("mtp3", proto_sm); |
591 | 16 | q931_handle = find_dissector_add_dependency("q931", proto_sm); |
592 | 16 | } |
593 | | |
594 | | /* |
595 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
596 | | * |
597 | | * Local variables: |
598 | | * c-basic-offset: 4 |
599 | | * tab-width: 8 |
600 | | * indent-tabs-mode: nil |
601 | | * End: |
602 | | * |
603 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
604 | | * :indentSize=4:tabSize=8:noTabs=true: |
605 | | */ |