2 * Routines for dissecting Evolved Universal Terrestrial Radio Access Network (EUTRAN);
3 * X2 Application Protocol (X2AP);
4 * 3GPP TS 36.423 packet dissection
5 * Copyright 2007-2008, Anders Broman <anders.broman@ericsson.com>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 * 3GPP TS 36.423 V8.0.0 (2007-12)
36 #include <epan/packet.h>
37 #include <epan/conversation.h>
42 #include <epan/asn1.h>
44 #include "packet-per.h"
47 /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
48 #pragma warning(disable:4146)
51 #define PNAME "EUTRAN X2 Application Protocol (X2AP)"
55 #define SCCP_SSN_X2AP 143
57 #include "packet-x2ap-val.h"
59 /* Initialize the protocol and registered fields */
60 static int proto_x2ap = -1;
62 #include "packet-x2ap-hf.c"
64 /* Initialize the subtree pointers */
65 static int ett_x2ap = -1;
67 #include "packet-x2ap-ett.c"
69 /* Global variables */
70 static guint32 ProcedureCode;
71 static guint32 ProtocolIE_ID;
72 static const gchar *ProcedureID;
74 /* Dissector tables */
75 static dissector_table_t x2ap_ies_dissector_table;
76 static dissector_table_t x2ap_extension_dissector_table;
77 static dissector_table_t x2ap_proc_imsg_dissector_table;
78 static dissector_table_t x2ap_proc_sout_dissector_table;
79 static dissector_table_t x2ap_proc_uout_dissector_table;
81 static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
82 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
83 static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
84 static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
85 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
87 #include "packet-x2ap-fn.c"
89 static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
91 return (dissector_try_port(x2ap_ies_dissector_table, ProtocolIE_ID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
94 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
96 return (dissector_try_port(x2ap_extension_dissector_table, ProtocolIE_ID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
99 static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
101 if (!ProcedureID) return 0;
102 return (dissector_try_string(x2ap_proc_imsg_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
105 static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
107 if (!ProcedureID) return 0;
108 return (dissector_try_string(x2ap_proc_sout_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
111 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
113 if (!ProcedureID) return 0;
114 return (dissector_try_string(x2ap_proc_uout_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
118 dissect_x2ap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
120 proto_item *x2ap_item = NULL;
121 proto_tree *x2ap_tree = NULL;
123 /* make entry in the Protocol column on summary display */
124 if (check_col(pinfo->cinfo, COL_PROTOCOL))
125 col_set_str(pinfo->cinfo, COL_PROTOCOL, "X2AP");
127 /* create the x2ap protocol tree */
128 x2ap_item = proto_tree_add_item(tree, proto_x2ap, tvb, 0, -1, FALSE);
129 x2ap_tree = proto_item_add_subtree(x2ap_item, ett_x2ap);
131 dissect_X2AP_PDU_PDU(tvb, pinfo, x2ap_tree);
134 /*--- proto_register_x2ap -------------------------------------------*/
135 void proto_register_x2ap(void) {
139 static hf_register_info hf[] = {
140 #include "packet-x2ap-hfarr.c"
143 /* List of subtrees */
144 static gint *ett[] = {
146 #include "packet-x2ap-ettarr.c"
150 /* Register protocol */
151 proto_x2ap = proto_register_protocol(PNAME, PSNAME, PFNAME);
152 /* Register fields and subtrees */
153 proto_register_field_array(proto_x2ap, hf, array_length(hf));
154 proto_register_subtree_array(ett, array_length(ett));
156 /* Register dissector */
157 register_dissector("x2ap", dissect_x2ap, proto_x2ap);
159 /* Register dissector tables */
160 x2ap_ies_dissector_table = register_dissector_table("x2ap.ies", "X2AP-PROTOCOL-IES", FT_UINT32, BASE_DEC);
161 x2ap_extension_dissector_table = register_dissector_table("x2ap.extension", "X2AP-PROTOCOL-EXTENSION", FT_UINT32, BASE_DEC);
162 x2ap_proc_imsg_dissector_table = register_dissector_table("x2ap.proc.imsg", "X2AP-ELEMENTARY-PROCEDURE InitiatingMessage", FT_STRING, BASE_NONE);
163 x2ap_proc_sout_dissector_table = register_dissector_table("x2ap.proc.sout", "X2AP-ELEMENTARY-PROCEDURE SuccessfulOutcome", FT_STRING, BASE_NONE);
164 x2ap_proc_uout_dissector_table = register_dissector_table("x2ap.proc.uout", "X2AP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE);
169 /*--- proto_reg_handoff_x2ap ---------------------------------------*/
171 proto_reg_handoff_x2ap(void)
173 dissector_handle_t x2ap_handle;
175 x2ap_handle = find_dissector("x2ap");
176 dissector_add("sctp.port", 0, x2ap_handle);
178 #include "packet-x2ap-dis-tab.c"