2 * Routines for M3 Application Protocol packet dissection
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Reference: 3GPP TS 36.444 v11.0.0
30 #include <epan/packet.h>
32 #include <epan/strutil.h>
33 #include <epan/asn1.h>
34 #include <epan/sctpppids.h>
36 #include "packet-ber.h"
37 #include "packet-per.h"
38 #include "packet-e212.h"
39 #include "packet-gtpv2.h"
40 #include "packet-ntp.h"
42 #define PNAME "M3 Application Protocol"
46 void proto_register_m3ap(void);
47 void proto_reg_handoff_m3ap(void);
49 /* M3AP uses port 36444 as recommended by IANA. */
50 #define M3AP_PORT 36444
51 static dissector_handle_t m3ap_handle
=NULL
;
53 #include "packet-m3ap-val.h"
55 /* Initialize the protocol and registered fields */
56 static int proto_m3ap
= -1;
58 static int hf_m3ap_Absolute_Time_ofMBMS_Data_value
= -1;
59 static int hf_m3ap_IPAddress
= -1;
61 #include "packet-m3ap-hf.c"
63 /* Initialize the subtree pointers */
64 static int ett_m3ap
= -1;
66 #include "packet-m3ap-ett.c"
74 /* Global variables */
75 static guint32 ProcedureCode
;
76 static guint32 ProtocolIE_ID
;
77 static guint32 ProtocolExtensionID
;
78 static int global_m3ap_port
= M3AP_PORT
;
79 static guint32 message_type
;
81 /* Dissector tables */
82 static dissector_table_t m3ap_ies_dissector_table
;
83 static dissector_table_t m3ap_extension_dissector_table
;
84 static dissector_table_t m3ap_proc_imsg_dissector_table
;
85 static dissector_table_t m3ap_proc_sout_dissector_table
;
86 static dissector_table_t m3ap_proc_uout_dissector_table
;
88 static int dissect_ProtocolIEFieldValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
89 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
90 static int dissect_InitiatingMessageValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
91 static int dissect_SuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
92 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
94 #include "packet-m3ap-fn.c"
96 static int dissect_ProtocolIEFieldValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
98 return (dissector_try_uint(m3ap_ies_dissector_table
, ProtocolIE_ID
, tvb
, pinfo
, tree
)) ? tvb_length(tvb
) : 0;
101 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
103 return (dissector_try_uint(m3ap_extension_dissector_table
, ProtocolIE_ID
, tvb
, pinfo
, tree
)) ? tvb_length(tvb
) : 0;
106 static int dissect_InitiatingMessageValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
108 return (dissector_try_uint(m3ap_proc_imsg_dissector_table
, ProcedureCode
, tvb
, pinfo
, tree
)) ? tvb_length(tvb
) : 0;
111 static int dissect_SuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
113 return (dissector_try_uint(m3ap_proc_sout_dissector_table
, ProcedureCode
, tvb
, pinfo
, tree
)) ? tvb_length(tvb
) : 0;
116 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
118 return (dissector_try_uint(m3ap_proc_uout_dissector_table
, ProcedureCode
, tvb
, pinfo
, tree
)) ? tvb_length(tvb
) : 0;
123 dissect_m3ap(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
125 proto_item
*m3ap_item
= NULL
;
126 proto_tree
*m3ap_tree
= NULL
;
128 /* make entry in the Protocol column on summary display */
129 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, PNAME
);
131 /* create the m3ap protocol tree */
133 m3ap_item
= proto_tree_add_item(tree
, proto_m3ap
, tvb
, 0, -1, ENC_NA
);
134 m3ap_tree
= proto_item_add_subtree(m3ap_item
, ett_m3ap
);
136 dissect_M3AP_PDU_PDU(tvb
, pinfo
, m3ap_tree
, NULL
);
139 /*--- proto_register_m3ap -------------------------------------------*/
140 void proto_register_m3ap(void) {
143 static hf_register_info hf
[] = {
144 { &hf_m3ap_Absolute_Time_ofMBMS_Data_value
,
145 { "Absolute-Time-ofMBMS-Data-value", "m3ap.Absolute_Time_ofMBMS_Data_value",
146 FT_STRING
, BASE_NONE
, NULL
, 0,
149 { &hf_m3ap_IPAddress
,
150 { "IPAddress", "m3ap.IPAddress",
151 FT_IPv6
, BASE_NONE
, NULL
, 0,
155 #include "packet-m3ap-hfarr.c"
158 /* List of subtrees */
159 static gint
*ett
[] = {
161 #include "packet-m3ap-ettarr.c"
165 /* Register protocol */
166 proto_m3ap
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
167 /* Register fields and subtrees */
168 proto_register_field_array(proto_m3ap
, hf
, array_length(hf
));
169 proto_register_subtree_array(ett
, array_length(ett
));
171 /* Register dissector tables */
172 m3ap_ies_dissector_table
= register_dissector_table("m3ap.ies", "M3AP-PROTOCOL-IES", FT_UINT32
, BASE_DEC
);
173 m3ap_extension_dissector_table
= register_dissector_table("m3ap.extension", "M3AP-PROTOCOL-EXTENSION", FT_UINT32
, BASE_DEC
);
174 m3ap_proc_imsg_dissector_table
= register_dissector_table("m3ap.proc.imsg", "M3AP-ELEMENTARY-PROCEDURE InitiatingMessage", FT_UINT32
, BASE_DEC
);
175 m3ap_proc_sout_dissector_table
= register_dissector_table("m3ap.proc.sout", "M3AP-ELEMENTARY-PROCEDURE SuccessfulOutcome", FT_UINT32
, BASE_DEC
);
176 m3ap_proc_uout_dissector_table
= register_dissector_table("m3ap.proc.uout", "M3AP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_UINT32
, BASE_DEC
);
180 /*--- proto_reg_handoff_m3ap ---------------------------------------*/
182 proto_reg_handoff_m3ap(void)
184 static gboolean inited
= FALSE
;
185 static guint SctpPort
;
188 m3ap_handle
= create_dissector_handle(dissect_m3ap
, proto_m3ap
);
189 dissector_add_uint("sctp.ppi", PROTO_3GPP_M3AP_PROTOCOL_ID
, m3ap_handle
);
191 #include "packet-m3ap-dis-tab.c"
192 dissector_add_uint("m3ap.extension", 17, new_create_dissector_handle(dissect_AllocationAndRetentionPriority_PDU
, proto_m3ap
));
196 dissector_delete_uint("sctp.port", SctpPort
, m3ap_handle
);
200 SctpPort
= global_m3ap_port
;
202 dissector_add_uint("sctp.port", SctpPort
, m3ap_handle
);