1 /* packet-rua-template.c
2 * Routines for UMTS Home Node B RANAP User Adaptation (RUA) packet dissection
3 * Copyright 2010 Neil Piercy, ip.access Limited <Neil.Piercy@ipaccess.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 * Ref: 3GPP TS 25.468 version 8.1.0 Release 8
16 #include <epan/packet.h>
17 #include <epan/sctpppids.h>
18 #include <epan/asn1.h>
19 #include <epan/prefs.h>
20 #include <wsutil/array.h>
22 #include "packet-per.h"
25 /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
26 #pragma warning(disable:4146)
29 #define PNAME "UTRAN Iuh interface RUA signalling"
32 /* Dissector to use SCTP PPID 19 or a configured SCTP port. IANA assigned port = 29169*/
33 #define SCTP_PORT_RUA 29169
35 void proto_register_rua(void);
37 #include "packet-rua-val.h"
39 /* Initialize the protocol and registered fields */
42 #include "packet-rua-hf.c"
44 /* Initialize the subtree pointers */
47 /* initialise sub-dissector handles */
48 static dissector_handle_t ranap_handle
= NULL
;
50 #include "packet-rua-ett.c"
52 /* Global variables */
53 static uint32_t ProcedureCode
;
54 static uint32_t ProtocolIE_ID
;
56 /* Dissector tables */
57 static dissector_table_t rua_ies_dissector_table
;
58 static dissector_table_t rua_extension_dissector_table
;
59 static dissector_table_t rua_proc_imsg_dissector_table
;
60 static dissector_table_t rua_proc_sout_dissector_table
;
61 static dissector_table_t rua_proc_uout_dissector_table
;
63 static dissector_handle_t rua_handle
;
65 static int dissect_ProtocolIEFieldValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
66 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
67 static int dissect_InitiatingMessageValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
68 static int dissect_SuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
69 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
71 void proto_reg_handoff_rua(void);
73 #include "packet-rua-fn.c"
75 static int dissect_ProtocolIEFieldValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
77 return (dissector_try_uint_with_data(rua_ies_dissector_table
, ProtocolIE_ID
, tvb
, pinfo
, tree
, false, NULL
)) ? tvb_captured_length(tvb
) : 0;
80 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
82 return (dissector_try_uint_with_data(rua_extension_dissector_table
, ProtocolIE_ID
, tvb
, pinfo
, tree
, false, NULL
)) ? tvb_captured_length(tvb
) : 0;
85 static int dissect_InitiatingMessageValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
87 return (dissector_try_uint_with_data(rua_proc_imsg_dissector_table
, ProcedureCode
, tvb
, pinfo
, tree
, false, NULL
)) ? tvb_captured_length(tvb
) : 0;
90 static int dissect_SuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
92 return (dissector_try_uint_with_data(rua_proc_sout_dissector_table
, ProcedureCode
, tvb
, pinfo
, tree
, false, NULL
)) ? tvb_captured_length(tvb
) : 0;
95 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
97 return (dissector_try_uint_with_data(rua_proc_uout_dissector_table
, ProcedureCode
, tvb
, pinfo
, tree
, false, NULL
)) ? tvb_captured_length(tvb
) : 0;
101 dissect_rua(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
103 proto_item
*rua_item
= NULL
;
104 proto_tree
*rua_tree
= NULL
;
106 /* make entry in the Protocol column on summary display */
107 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "RUA");
109 /* create the rua protocol tree */
110 rua_item
= proto_tree_add_item(tree
, proto_rua
, tvb
, 0, -1, ENC_NA
);
111 rua_tree
= proto_item_add_subtree(rua_item
, ett_rua
);
113 return dissect_RUA_PDU_PDU(tvb
, pinfo
, rua_tree
, data
);
116 /*--- proto_register_rua -------------------------------------------*/
117 void proto_register_rua(void) {
121 static hf_register_info hf
[] = {
123 #include "packet-rua-hfarr.c"
126 /* List of subtrees */
127 static int *ett
[] = {
129 #include "packet-rua-ettarr.c"
133 /* Register protocol */
134 proto_rua
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
135 /* Register fields and subtrees */
136 proto_register_field_array(proto_rua
, hf
, array_length(hf
));
137 proto_register_subtree_array(ett
, array_length(ett
));
139 /* Register dissector */
140 rua_handle
= register_dissector("rua", dissect_rua
, proto_rua
);
142 /* Register dissector tables */
143 rua_ies_dissector_table
= register_dissector_table("rua.ies", "RUA-PROTOCOL-IES", proto_rua
, FT_UINT32
, BASE_DEC
);
144 rua_extension_dissector_table
= register_dissector_table("rua.extension", "RUA-PROTOCOL-EXTENSION", proto_rua
, FT_UINT32
, BASE_DEC
);
145 rua_proc_imsg_dissector_table
= register_dissector_table("rua.proc.imsg", "RUA-ELEMENTARY-PROCEDURE InitiatingMessage", proto_rua
, FT_UINT32
, BASE_DEC
);
146 rua_proc_sout_dissector_table
= register_dissector_table("rua.proc.sout", "RUA-ELEMENTARY-PROCEDURE SuccessfulOutcome", proto_rua
, FT_UINT32
, BASE_DEC
);
147 rua_proc_uout_dissector_table
= register_dissector_table("rua.proc.uout", "RUA-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", proto_rua
, FT_UINT32
, BASE_DEC
);
149 /* rua_module = prefs_register_protocol(proto_rua, NULL); */
154 /*--- proto_reg_handoff_rua ---------------------------------------*/
156 proto_reg_handoff_rua(void)
158 ranap_handle
= find_dissector_add_dependency("ranap", proto_rua
);
159 dissector_add_uint("sctp.ppi", RUA_PAYLOAD_PROTOCOL_ID
, rua_handle
);
160 dissector_add_uint_with_preference("sctp.port", SCTP_PORT_RUA
, rua_handle
);
161 #include "packet-rua-dis-tab.c"