5 * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
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 #include "packet-h248.h"
29 #define PNAME "H.248 3GPP"
30 #define PSNAME "H2483GPP"
31 #define PFNAME "h2483gpp"
33 #include "packet-isup.h"
37 * 3GPP TS 29.232 -- 15.1.1
39 static int hf_h248_package_3GUP = -1;
41 static int hf_h248_package_3GUP_Mode = -1;
42 static int hf_h248_package_3GUP_UPversions = -1;
43 static int hf_h248_package_3GUP_delerrsdu = -1;
44 static int hf_h248_package_3GUP_interface = -1;
45 static int hf_h248_package_3GUP_initdir = -1;
47 static gint ett_h248_package_3GUP = -1;
49 static gboolean implicit = FALSE;
51 static const value_string h248_3GUP_properties_vals[] = {
53 { 0x0002, "Versions" },
54 { 0x0003, "delerrsdu" },
55 { 0x0004, "interface" },
56 { 0x0005, "initdir" },
60 static const value_string h248_3GUP_Mode_vals[] = {
61 { 0x00000001, "Transparent mode" },
62 { 0x00000002, "Support mode for predefined SDU sizes" },
66 static const value_string h248_3GUP_upversions_vals[] = {
67 { 0x01, "Version 1" },
68 { 0x02, "Version 2" },
69 { 0x03, "Version 3" },
70 { 0x04, "Version 4" },
71 { 0x05, "Version 5" },
72 { 0x06, "Version 6" },
73 { 0x07, "Version 7" },
74 { 0x08, "Version 8" },
75 { 0x09, "Version 9" },
76 { 0x0A, "Version 10" },
77 { 0x0B, "Version 11" },
78 { 0x0C, "Version 12" },
79 { 0x0D, "Version 13" },
80 { 0x0E, "Version 14" },
81 { 0x0F, "Version 15" },
82 { 0x10, "Version 16" },
86 static const value_string h248_3GUP_delerrsdu_vals[] = {
89 { 0x0003, "Not Applicable" },
93 static const value_string h248_3GUP_interface_vals[] = {
94 { 0x0001, "RAN (Iu interface)" },
95 { 0x0002, "CN (Nb interfac)" },
99 static const value_string h248_3GUP_initdir_vals[] = {
100 { 0x0001, "Incoming" },
101 { 0x0002, "Outgoing" },
105 static const value_string h248_3GUP_parameters[] _U_ = {
107 { 0x0002, "UPversions" },
108 { 0x0003, "Delivery of erroneous SDUs" },
109 { 0x0004, "Interface" },
110 { 0x0005, "Initialisation Direction" },
114 static const h248_pkg_param_t h248_package_3GUP_properties[] = {
115 { 0x0001, &hf_h248_package_3GUP_Mode, h248_param_ber_integer, &implicit },
116 { 0x0002, &hf_h248_package_3GUP_UPversions, h248_param_ber_integer, &implicit },
117 { 0x0003, &hf_h248_package_3GUP_delerrsdu, h248_param_ber_integer, &implicit },
118 { 0x0004, &hf_h248_package_3GUP_interface, h248_param_ber_integer, &implicit },
119 { 0x0005, &hf_h248_package_3GUP_initdir, h248_param_ber_integer, &implicit },
120 { 0x0000, NULL, NULL, NULL }
123 static const h248_package_t h248_package_3GUP = {
125 &hf_h248_package_3GUP,
126 &ett_h248_package_3GUP,
127 h248_3GUP_properties_vals,
131 h248_package_3GUP_properties,
139 * Circuit Switched Data package
140 * 3GPP TS 29.232 -- 15.2.1
143 static int hf_h248_package_3GCSD = -1;
145 static int hf_h248_package_3GCSD_plmnbc = -1;
146 static int hf_h248_package_3GCSD_gsmchancod = -1;
147 static int hf_h248_pkg_3GCSD_evt_protres = -1;
148 static int hf_h248_pkg_3GCSD_evt_protres_result = -1;
149 static int hf_h248_pkg_3GCSD_evt_protres_cause = -1;
150 static int hf_h248_pkg_3GCSD_evt_ratechg = -1;
151 static int hf_h248_pkg_3GCSD_evt_ratechg_rate = -1;
152 static int hf_h248_pkg_3GCSD_sig_actprot = -1;
153 static int hf_h248_pkg_3GCSD_actprot_sig_localpeer = -1;
155 static gint ett_h248_package_3GCSD = -1;
156 static gint ett_h248_3GCSD_evt_protres = -1;
157 static gint ett_h248_3GCSD_evt_ratechg = -1;
158 static gint ett_pkg_3GCSD_sig_actprot = -1;
160 static const value_string h248_3GCSD_properties_vals[] = {
162 { 0x0002, "gsmchancod"},
166 static const value_string h248_3GCSD_signals_vals[] _U_ = {
167 { 0x0001, "actprot" },
171 static const value_string h248_3GCSD_signal_actprot_vals[] = {
172 { 0x0001, "localpeer" },
176 static const value_string h248_3GCSD_events_vals[] _U_ = {
177 { 0x0001, "protres"},
178 { 0x0002, "ratechg"},
182 static const value_string h248_3GCSD_event_protres_vals[] = {
188 static const value_string h248_3GCSD_event_ratechg_vals[] = {
193 static const value_string h248_3GCSD_evt_protres_result_vals[] = {
199 static const value_string h248_3GCSD_evt_protres_cause_vals[] = {
205 static const value_string h248_3GCSD_actprot_sig_localpeer_vals[] = {
211 static const h248_pkg_param_t h248_package_3GCSD_props[] = {
212 { 0x0001, &hf_h248_package_3GCSD_plmnbc, h248_param_ber_octetstring, &implicit},
213 { 0x0002, &hf_h248_package_3GCSD_gsmchancod, h248_param_ber_octetstring, &implicit },
214 { 0x0000, NULL, NULL, NULL }
217 static const h248_pkg_param_t h248_pkg_3GCSD_evt_protres_params[] = {
218 { 0x0001, &hf_h248_pkg_3GCSD_evt_protres_result, h248_param_ber_integer, &implicit },
219 { 0x0002, &hf_h248_pkg_3GCSD_evt_protres_cause, h248_param_ber_integer, &implicit },
220 { 0, NULL, NULL, NULL}
223 static const h248_pkg_param_t h248_pkg_3GCSD_evt_ratechg_params[] = {
224 { 0x0001, &hf_h248_pkg_3GCSD_evt_ratechg_rate, h248_param_ber_integer, &implicit },
225 { 0, NULL, NULL, NULL}
228 static const h248_pkg_evt_t h248_package_3GCSD_evts[] = {
229 { 0x0001, &hf_h248_pkg_3GCSD_evt_protres, &ett_h248_3GCSD_evt_protres, h248_pkg_3GCSD_evt_protres_params, h248_3GCSD_event_protres_vals},
230 { 0x0002, &hf_h248_pkg_3GCSD_evt_ratechg, &ett_h248_3GCSD_evt_ratechg, h248_pkg_3GCSD_evt_ratechg_params, h248_3GCSD_event_ratechg_vals},
231 { 0, NULL, NULL, NULL,NULL}
234 static const h248_pkg_param_t h248_pkg_3GCSD_actprot_sig_params[] = {
235 { 0x0001, &hf_h248_pkg_3GCSD_actprot_sig_localpeer, h248_param_ber_integer, &implicit },
236 { 0, NULL, NULL, NULL}
239 static const h248_pkg_sig_t h248_package_3GCSD_sigs[] = {
240 { 0x0010, &hf_h248_pkg_3GCSD_sig_actprot, &ett_pkg_3GCSD_sig_actprot, h248_pkg_3GCSD_actprot_sig_params, h248_3GCSD_signal_actprot_vals },
241 { 0, NULL, NULL, NULL,NULL}
244 static const h248_package_t h248_package_3GCSD = {
246 &hf_h248_package_3GCSD,
247 &ett_h248_package_3GCSD,
248 h248_3GCSD_properties_vals,
252 h248_package_3GCSD_props,
253 h248_package_3GCSD_sigs,
254 h248_package_3GCSD_evts,
261 * 3GPP TS 29.232 -- 15.2.2
263 static int hf_h248_package_3GTFO = -1;
265 static int hf_h248_pkg_3GTFO_evt_codec_modify = -1;
266 static int hf_h248_pkg_3GTFO_evt_distant_codec_list = -1;
267 static int hf_h248_pkg_3GTFO_evt_status = -1;
268 static int hf_h248_pkg_3GTFO_enable = -1;
269 static int hf_h248_pkg_3GTFO_codeclist = -1;
270 static int hf_h248_pkg_3GTFO_evt_codec_modify_optimalcodec = -1;
271 static int hf_h248_pkg_3GTFO_evt_distant_codec_list_distlist = -1;
272 static int hf_h248_pkg_3GTFO_evt_status_tfostatus = -1;
274 static gint ett_h248_package_3GTFO = -1;
275 static gint ett_h248_3GTFO_evt_status = -1;
276 static gint ett_h248_3GTFO_evt_distant_codec_list = -1;
277 static gint ett_h248_3GTFO_evt_codec_modify = -1;
278 static gint ett_h248_3GTFO_codec_list = -1;
279 static gint ett_h248_3GTFO_codec = -1;
282 static void dissect_3GTFO_codec_mode(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int hfid, h248_curr_info_t* cu _U_, void* ignored _U_) {
283 tvbuff_t* sub_tvb = NULL;
289 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
291 get_ber_identifier(tvb, 0, &class, &pc, &tag);
293 /* XXX: is this enough to guess it? */
294 if ((tag==BER_UNI_TAG_OCTETSTRING)) {
295 dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, 0, hfid, &sub_tvb );
298 proto_tree* pt = proto_item_add_subtree(asn1_ctx.created_item, ett_h248_3GTFO_codec);
299 dissect_codec_mode(pt, sub_tvb, 0, tvb_length(tvb));
302 proto_tree_add_item(tree,hfid,tvb,0,-1,FALSE);
307 static void dissect_3GTFO_codec_list(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int hfid, h248_curr_info_t* cu _U_, void* ignored _U_) {
308 tvbuff_t* sub_tvb = NULL;
314 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
316 get_ber_identifier(tvb, 0, &class, &pc, &tag);
318 if ((tag==BER_UNI_TAG_OCTETSTRING)) {
319 dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, 0, hfid, &sub_tvb );
322 proto_tree* pt = proto_item_add_subtree(asn1_ctx.created_item,ett_h248_3GTFO_codec_list);
323 int len = tvb_length(sub_tvb);
326 offset = dissect_codec_mode(pt, sub_tvb, offset, len);
327 } while(offset < len);
330 proto_tree_add_item(tree,hfid,tvb,0,-1,FALSE);
335 static const value_string h248_package_3GTFO_props_vals[] = {
341 static const value_string h248_pkg_3GTFO_evt_codec_modify_params_vals[] = {
347 static const value_string h248_pkg_3GTFO_evt_distant_codec_list_params_vals[] = {
352 static const value_string h248_pkg_3GTFO_evt_status_params_vals[] = {
358 static const value_string h248_package_3GTFO_evts_vals[] = {
360 {12,"distant_codec_list"},
365 static const value_string tfoenable_vals[] = {
371 static const h248_pkg_param_t h248_package_3GTFO_props[] = {
372 { 0x0001, &hf_h248_pkg_3GTFO_enable, h248_param_ber_integer, &implicit },
373 { 0x0002, &hf_h248_pkg_3GTFO_codeclist, dissect_3GTFO_codec_list, NULL }, /* Sub-list of Octet string Q.765.5 + TS 26.103 .*/
374 { 0, NULL, NULL, NULL}
378 static const h248_pkg_param_t h248_pkg_3GTFO_evt_codec_modify_params[] = {
379 { 0x0011, &hf_h248_pkg_3GTFO_evt_codec_modify_optimalcodec, dissect_3GTFO_codec_mode, NULL }, /* Q.765.5 + TS 26.103 .*/
380 { 0, NULL, NULL, NULL}
384 static const h248_pkg_param_t h248_pkg_3GTFO_evt_distant_codec_list_params[] = {
385 { 0x0013, &hf_h248_pkg_3GTFO_evt_distant_codec_list_distlist, dissect_3GTFO_codec_list, NULL }, /* Sub-list of Octet string Q.765.5 + TS 26.103 .*/
386 { 0, NULL, NULL, NULL}
389 static const h248_pkg_param_t h248_pkg_3GTFO_evt_status_params[] = {
390 { 0x0001, &hf_h248_pkg_3GTFO_evt_status_tfostatus, h248_param_ber_boolean, &implicit },
391 { 0, NULL, NULL, NULL}
394 static const h248_pkg_evt_t h248_package_3GTFO_evts[] = {
395 { 0x0010, &hf_h248_pkg_3GTFO_evt_codec_modify, &ett_h248_3GTFO_evt_codec_modify, h248_pkg_3GTFO_evt_codec_modify_params, h248_pkg_3GTFO_evt_codec_modify_params_vals},
396 { 0x0012, &hf_h248_pkg_3GTFO_evt_distant_codec_list, &ett_h248_3GTFO_evt_distant_codec_list, h248_pkg_3GTFO_evt_distant_codec_list_params, h248_pkg_3GTFO_evt_distant_codec_list_params_vals},
397 { 0x0014, &hf_h248_pkg_3GTFO_evt_status, &ett_h248_3GTFO_evt_status, h248_pkg_3GTFO_evt_status_params, h248_pkg_3GTFO_evt_status_params_vals},
398 { 0, NULL, NULL, NULL,NULL}
401 static const h248_package_t h248_package_3GTFO = {
403 &hf_h248_package_3GTFO,
404 &ett_h248_package_3GTFO,
405 h248_package_3GTFO_props_vals,
407 h248_package_3GTFO_evts_vals,
409 h248_package_3GTFO_props,
411 h248_package_3GTFO_evts,
415 * 3G Expanded Call Progress Tones Generator Package
416 * 3GPP TS 29.232 -- 15.2.3
419 * Modification Of Link Characteristics Bearer Capability
420 * 3GPP TS 29.232 -- 15.2.4
423 * Enhanced Circuit Switched Data package
424 * 3GPP TS 29.232 -- 15.2.5
427 * Cellular Text telephone Modem Text Transport
428 * 3GPP TS 29.232 -- 15.2.6
431 * IP transport package
432 * 3GPP TS 29.232 -- 15.2.7
435 * Flexible Tone Generator Package
436 * 3GPP TS 29.232 -- 15.2.8
440 * 3GPP TS 29.232 -- 15.2.9
443 * ASCI Group call package
444 * 3GPP TS 29.232 -- 15.2.10
448 void proto_register_h248_3gpp(void) {
449 static hf_register_info hf[] = {
450 { &hf_h248_package_3GUP_Mode,
451 { "Mode", "h248.package_3GUP.Mode",
452 FT_UINT32, BASE_DEC, VALS(h248_3GUP_Mode_vals), 0,
454 { &hf_h248_package_3GUP_UPversions,
455 { "UPversions", "h248.package_3GUP.upversions",
456 FT_UINT32, BASE_DEC, VALS(h248_3GUP_upversions_vals), 0,
457 "UPversions", HFILL }},
458 { &hf_h248_package_3GUP_delerrsdu,
459 { "Delivery of erroneous SDUs", "h248.package_3GUP.delerrsdu",
460 FT_UINT32, BASE_DEC, VALS(h248_3GUP_delerrsdu_vals), 0,
461 "Delivery of erroneous SDUs", HFILL }},
462 { &hf_h248_package_3GUP_interface,
463 { "Interface", "h248.package_3GUP.interface",
464 FT_UINT32, BASE_DEC, VALS(h248_3GUP_interface_vals), 0,
465 "Interface", HFILL }},
466 { &hf_h248_package_3GUP_initdir,
467 { "Initialisation Direction", "h248.package_3GUP.initdir",
468 FT_UINT32, BASE_DEC, VALS(h248_3GUP_initdir_vals), 0,
469 "Initialisation Direction", HFILL }},
472 { &hf_h248_package_3GCSD,
473 { "CSD Package", "h248.package_3GCSD",
474 FT_BYTES, BASE_HEX, NULL, 0,
475 "Circuit Switched Data Package", HFILL }},
476 { &hf_h248_package_3GCSD_plmnbc,
477 { "PLMN Bearer Capability", "h248.package_3GCSD.plmnbc",
478 FT_BYTES, BASE_DEC, NULL, 0,
479 "The PLMN Bearer Capability", HFILL }},
480 { &hf_h248_package_3GCSD_gsmchancod,
481 { "GSM channel coding", "h248.package_3GCSD.gsmchancod",
482 FT_BYTES, BASE_DEC, NULL, 0,
483 "Channel information needed for GSM", HFILL }},
484 { &hf_h248_pkg_3GCSD_evt_protres,
485 { "Protocol Negotiation Result", "h248.package_3GCSD.protres",
486 FT_BYTES, BASE_DEC, NULL, 0,
487 "This event is used to report the result of the protocol negotiation", HFILL }},
488 { &hf_h248_pkg_3GCSD_evt_protres_result,
489 { "Negotiation Result", "h248.package_3GCSD.protres.result",
490 FT_UINT32, BASE_DEC, VALS(h248_3GCSD_evt_protres_result_vals), 0,
491 "reports whether the protocol negotiation has been successful", HFILL }},
492 { &hf_h248_pkg_3GCSD_evt_protres_cause,
493 { "Possible Failure Cause", "h248.package_3GCSD.protres.cause",
494 FT_UINT32, BASE_DEC, VALS(h248_3GCSD_evt_protres_cause_vals), 0,
495 "indicates the possible failure cause", HFILL }},
496 { &hf_h248_pkg_3GCSD_evt_ratechg,
497 { "Rate Change", "h248.package_3GCSD.ratechg",
498 FT_BYTES, BASE_DEC, NULL, 0,
499 "This event is used to report a rate change", HFILL }},
500 { &hf_h248_pkg_3GCSD_evt_ratechg_rate,
501 { "New Rate", "h248.package_3GCSD.ratechg.rate",
502 FT_UINT32, BASE_DEC, NULL, 0,
503 "reports the new rate for the termination", HFILL }},
504 { &hf_h248_pkg_3GCSD_sig_actprot,
505 { "Activate Protocol", "h248.package_3GCSD.actprot",
506 FT_BYTES, BASE_DEC, NULL, 0,
507 "Activate the higher layer protocol", HFILL }},
508 { &hf_h248_pkg_3GCSD_actprot_sig_localpeer,
509 { "Local Peer Role", "h248.package_3GCSD.actprot.localpeer",
510 FT_UINT32, BASE_DEC, VALS(h248_3GCSD_actprot_sig_localpeer_vals), 0,
511 "It is used to inform the modem whether it should act as originating or terminating peer", HFILL }},
514 { &hf_h248_package_3GTFO,
515 { "Tandem Free Operation ", "h248.package_3GTFO",
516 FT_BYTES, BASE_HEX, NULL, 0,
517 "This package defines events and properties for Tandem Free Operation (TFO) control", HFILL }},
518 { &hf_h248_pkg_3GTFO_enable,
519 { "TFO Activity Control", "h248.package_3GTFO.tfoenable",
520 FT_UINT32, BASE_DEC, VALS(tfoenable_vals), 0,
521 "Defines if TFO is enabled or not", HFILL }},
522 { &hf_h248_pkg_3GTFO_codeclist,
523 { "TFO Codec List", "h248.package_3GTFO.codeclist",
524 FT_BYTES, BASE_DEC, NULL, 0,
525 "List of codecs for use in TFO protocol", HFILL }},
527 { &hf_h248_pkg_3GTFO_evt_codec_modify,
528 { "Optimal Codec Event", "h248.package_3GTFO.codec_modify",
529 FT_BYTES, BASE_DEC, NULL, 0,
530 "The event is used to notify the MGC that TFO negotiation has resulted in an optimal codec type being proposed", HFILL }},
531 { &hf_h248_pkg_3GTFO_evt_codec_modify_optimalcodec,
532 { "Optimal Codec Type", "h248.package_3GTFO.codec_modify.optimalcodec",
533 FT_BYTES, BASE_DEC, NULL, 0,
534 "indicates which is the proposed codec type for TFO", HFILL }},
536 { &hf_h248_pkg_3GTFO_evt_distant_codec_list,
537 { "Codec List Event", "h248.package_3GTFO.distant_codec_list",
538 FT_BYTES, BASE_DEC, NULL, 0,
539 "The event is used to notify the MGC of the distant TFO partner's supported codec list", HFILL }},
541 { &hf_h248_pkg_3GTFO_evt_distant_codec_list_distlist,
542 { "Distant Codec List", "h248.package_3GTFO.distant_codec_list.distlist",
543 FT_BYTES, BASE_DEC, NULL, 0,
544 "indicates the codec list for TFO", HFILL }},
546 { &hf_h248_pkg_3GTFO_evt_status,
547 { "TFO Status Event", "h248.package_3GTFO.status",
548 FT_BYTES, BASE_DEC, NULL, 0,
549 "The event is used to notify the MGC that a TFO link has been established or broken", HFILL }},
550 { &hf_h248_pkg_3GTFO_evt_status_tfostatus,
551 { "TFO Status", "h248.package_3GTFO.status.tfostatus",
552 FT_BOOLEAN, BASE_DEC, NULL, 0,
553 "reports whether TFO has been established or broken", HFILL }},
556 static gint *ett[] = {
557 &ett_h248_package_3GUP,
558 &ett_h248_package_3GCSD,
559 &ett_h248_3GCSD_evt_protres,
560 &ett_h248_3GCSD_evt_ratechg,
561 &ett_h248_package_3GTFO,
562 &ett_h248_3GTFO_evt_status,
563 &ett_h248_3GTFO_evt_distant_codec_list,
564 &ett_h248_3GTFO_evt_codec_modify,
565 &ett_h248_3GTFO_codec_list,
566 &ett_h248_3GTFO_codec
569 hf_h248_package_3GUP = proto_register_protocol(PNAME, PSNAME, PFNAME);
571 proto_register_field_array(hf_h248_package_3GUP, hf, array_length(hf));
573 proto_register_subtree_array(ett, array_length(ett));
575 h248_register_package(&h248_package_3GUP);
576 h248_register_package(&h248_package_3GCSD);
577 h248_register_package(&h248_package_3GTFO);