1 /* packet-nbap-template.c
2 * Routines for UMTS Node B Application Part(NBAP) packet dissection
3 * Copyright 2005, 2009 Anders Broman <anders.broman@ericsson.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * Ref: 3GPP TS 25.433 version 6.6.0 Release 6
34 #include <epan/packet.h>
35 #include <epan/sctpppids.h>
36 #include <epan/asn1.h>
38 #include "packet-per.h"
41 /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
42 #pragma warning(disable:4146)
45 #define PNAME "UTRAN Iub interface NBAP signalling"
49 #include "packet-nbap-val.h"
51 /* Initialize the protocol and registered fields */
52 static int proto_nbap = -1;
53 static int hf_nbap_transportLayerAddress_ipv4 = -1;
54 static int hf_nbap_transportLayerAddress_ipv6 = -1;
56 #include "packet-nbap-hf.c"
58 /* Initialize the subtree pointers */
59 static int ett_nbap = -1;
60 static int ett_nbap_TransportLayerAddress = -1;
62 #include "packet-nbap-ett.c"
64 /* Global variables */
65 static guint32 ProcedureCode;
66 static guint32 ProtocolIE_ID;
67 static guint32 ddMode;
68 static const gchar *ProcedureID;
70 /* Dissector tables */
71 static dissector_table_t nbap_ies_dissector_table;
72 static dissector_table_t nbap_extension_dissector_table;
73 static dissector_table_t nbap_proc_imsg_dissector_table;
74 static dissector_table_t nbap_proc_sout_dissector_table;
75 static dissector_table_t nbap_proc_uout_dissector_table;
77 static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
78 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
79 static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
80 static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
81 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
83 #include "packet-nbap-fn.c"
85 static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
87 return (dissector_try_uint_new(nbap_ies_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, FALSE)) ? tvb_length(tvb) : 0;
90 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
92 return (dissector_try_uint_new(nbap_extension_dissector_table, ProtocolIE_ID, tvb, pinfo, tree, FALSE)) ? tvb_length(tvb) : 0;
95 static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
97 if (!ProcedureID) return 0;
98 return (dissector_try_string(nbap_proc_imsg_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
101 static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
103 if (!ProcedureID) return 0;
104 return (dissector_try_string(nbap_proc_sout_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
107 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
109 if (!ProcedureID) return 0;
110 return (dissector_try_string(nbap_proc_uout_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0;
114 dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
116 proto_item *nbap_item = NULL;
117 proto_tree *nbap_tree = NULL;
119 /* make entry in the Protocol column on summary display */
120 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBAP");
122 /* create the nbap protocol tree */
123 nbap_item = proto_tree_add_item(tree, proto_nbap, tvb, 0, -1, FALSE);
124 nbap_tree = proto_item_add_subtree(nbap_item, ett_nbap);
126 dissect_NBAP_PDU_PDU(tvb, pinfo, nbap_tree);
129 /*--- proto_register_nbap -------------------------------------------*/
130 void proto_register_nbap(void) {
134 static hf_register_info hf[] = {
135 { &hf_nbap_transportLayerAddress_ipv4,
136 { "transportLayerAddress IPv4", "nbap.transportLayerAddress_ipv4",
137 FT_IPv4, BASE_NONE, NULL, 0,
139 { &hf_nbap_transportLayerAddress_ipv6,
140 { "transportLayerAddress IPv6", "nbap.transportLayerAddress_ipv6",
141 FT_IPv6, BASE_NONE, NULL, 0,
144 #include "packet-nbap-hfarr.c"
147 /* List of subtrees */
148 static gint *ett[] = {
150 &ett_nbap_TransportLayerAddress,
151 #include "packet-nbap-ettarr.c"
155 /* Register protocol */
156 proto_nbap = proto_register_protocol(PNAME, PSNAME, PFNAME);
157 /* Register fields and subtrees */
158 proto_register_field_array(proto_nbap, hf, array_length(hf));
159 proto_register_subtree_array(ett, array_length(ett));
161 /* Register dissector */
162 register_dissector("nbap", dissect_nbap, proto_nbap);
164 /* Register dissector tables */
165 nbap_ies_dissector_table = register_dissector_table("nbap.ies", "NBAP-PROTOCOL-IES", FT_UINT32, BASE_DEC);
166 nbap_extension_dissector_table = register_dissector_table("nbap.extension", "NBAP-PROTOCOL-EXTENSION", FT_UINT32, BASE_DEC);
167 nbap_proc_imsg_dissector_table = register_dissector_table("nbap.proc.imsg", "NBAP-ELEMENTARY-PROCEDURE InitiatingMessage", FT_STRING, BASE_NONE);
168 nbap_proc_sout_dissector_table = register_dissector_table("nbap.proc.sout", "NBAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", FT_STRING, BASE_NONE);
169 nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE);
174 /*--- proto_reg_handoff_nbap ---------------------------------------*/
176 proto_reg_handoff_nbap(void)
178 dissector_handle_t nbap_handle;
180 nbap_handle = find_dissector("nbap");
181 dissector_add_uint("sctp.ppi", NBAP_PAYLOAD_PROTOCOL_ID, nbap_handle);
182 dissector_add_handle("sctp.port", nbap_handle); /* for "decode-as" */
184 #include "packet-nbap-dis-tab.c"