2 * Routines for UA/UDP (Universal Alcatel over UDP) packet dissection.
3 * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.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
14 #include <epan/packet.h>
16 #include "packet-uaudp.h"
18 void proto_register_ua_msg(void);
19 void proto_reg_handoff_ua_msg(void);
20 /*-----------------------------------------------------------------------------
22 ---------------------------------------------------------------------------*/
25 static dissector_table_t ua_opcode_dissector_table
;
28 static int proto_ua_msg
;
29 static int ett_ua_msg
;
31 static dissector_handle_t noe_handle
;
32 static dissector_handle_t ua3g_handle
;
34 static void uadecode(e_ua_direction direction
,
42 switch (opcode
& 0x7f) /* suppression of the CP bit */
47 call_dissector(noe_handle
,
48 tvb_new_subset_length(tvb
, offset
, length
),
60 case 0x07: /* Only UA NOE */
61 case 0x08: /* Only UA NOE */
75 case 0x1F: /* case 0x9F */
80 case 0x24: /* Only IP NOE */
81 case 0x25: /* Only IP NOE */
87 case 0x2B: /* Only UA NOE */
93 case 0x32: /* Only UA NOE */
96 case 0x36: /* IP Phone */
121 case 0x50: /* Only UA NOE */
123 call_dissector_with_data(ua3g_handle
,
124 tvb_new_subset_length(tvb
, offset
, length
),
131 /* add text to the frame "INFO" column */
132 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - UA3G Message ERR: Opcode (0x%02x) Unknown", tvb_get_uint8(tvb
, (offset
+ 2)));
134 call_data_dissector(tvb_new_subset_length(tvb
, offset
, length
),
144 /*-----------------------------------------------------------------------------
146 ---------------------------------------------------------------------------*/
147 static void _dissect_ua_msg(tvbuff_t
*tvb
,
150 e_ua_direction direction
)
153 proto_item
*ua_msg_item
;
154 proto_tree
*ua_msg_tree
;
156 ua_msg_item
= proto_tree_add_protocol_format(tree
, proto_ua_msg
, tvb
, 0, -1,
157 "Universal Alcatel Protocol, %s",
158 ((direction
== SYS_TO_TERM
) ?
159 "System -> Terminal" : "Terminal -> System"));
161 ua_msg_tree
= proto_item_add_subtree(ua_msg_item
, ett_ua_msg
);
163 while (tvb_offset_exists(tvb
, offset
))
165 int length
= tvb_get_letohs(tvb
, offset
) + 2;
166 int opcode
= tvb_get_uint8(tvb
, offset
+2);
168 uadecode(direction
, ua_msg_tree
, pinfo
, tvb
, offset
, opcode
, length
);
175 static int dissect_ua_sys_to_term(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
177 _dissect_ua_msg(tvb
, pinfo
, tree
, SYS_TO_TERM
);
178 return tvb_captured_length(tvb
);
181 static int dissect_ua_term_to_sys(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
183 _dissect_ua_msg(tvb
, pinfo
, tree
, TERM_TO_SYS
);
184 return tvb_captured_length(tvb
);
188 /*-----------------------------------------------------------------------------
189 DISSECTORS REGISTRATION FUNCTIONS
190 ---------------------------------------------------------------------------*/
192 void proto_register_ua_msg(void)
199 /* UA dissector registration */
200 proto_ua_msg
= proto_register_protocol("Universal Alcatel Protocol", "UA", "ua");
202 register_dissector("ua_sys_to_term", dissect_ua_sys_to_term
, proto_ua_msg
);
203 register_dissector("ua_term_to_sys", dissect_ua_term_to_sys
, proto_ua_msg
);
205 /* Common subtree array registration */
206 proto_register_subtree_array(ett
, array_length(ett
));
209 void proto_reg_handoff_ua_msg(void)
212 dissector_handle_t handle_ua_msg
;
214 /* hooking of UA on UAUDP */
215 /* XXX: The following is NG since the same 'pattern' is added twice */
216 handle_ua_msg
= find_dissector("ua_sys_to_term");
217 dissector_add_uint("uaudp.opcode", UAUDP_DATA
, handle_ua_msg
);
219 handle_ua_msg
= find_dissector("ua_term_to_sys");
220 dissector_add_uint("uaudp.opcode", UAUDP_DATA
, handle_ua_msg
);
222 /* For hooking dissectors to UA */
223 ua_opcode_dissector_table
=
224 register_dissector_table("ua.opcode",
231 noe_handle
= find_dissector_add_dependency("noe", proto_ua_msg
);
232 ua3g_handle
= find_dissector_add_dependency("ua3g", proto_ua_msg
);
237 * Editor modelines - https://www.wireshark.org/tools/modelines.html
242 * indent-tabs-mode: nil
245 * vi: set shiftwidth=4 tabstop=8 expandtab:
246 * :indentSize=4:tabSize=8:noTabs=true: