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.
32 #include "packet-h248.h"
33 #define PNAME "H.248 3GPP"
34 #define PSNAME "H2483GPP"
35 #define PFNAME "h2483gpp"
37 #include "packet-isup.h"
41 * 3GPP TS 29.232 -- 15.1.1
43 static int hf_h248_package_3GUP = -1;
45 static int hf_h248_package_3GUP_Mode = -1;
46 static int hf_h248_package_3GUP_UPversions = -1;
47 static int hf_h248_package_3GUP_delerrsdu = -1;
48 static int hf_h248_package_3GUP_interface = -1;
49 static int hf_h248_package_3GUP_initdir = -1;
51 static gint ett_h248_package_3GUP = -1;
53 static gboolean implicit = FALSE;
55 static const value_string h248_3GUP_properties_vals[] = {
57 { 0x0002, "Versions" },
58 { 0x0003, "delerrsdu" },
59 { 0x0004, "interface" },
60 { 0x0005, "initdir" },
64 static const value_string h248_3GUP_Mode_vals[] = {
65 { 0x00000001, "Transparent mode" },
66 { 0x00000002, "Support mode for predefined SDU sizes" },
70 static const value_string h248_3GUP_upversions_vals[] = {
71 { 0x01, "Version 1" },
72 { 0x02, "Version 2" },
73 { 0x03, "Version 3" },
74 { 0x04, "Version 4" },
75 { 0x05, "Version 5" },
76 { 0x06, "Version 6" },
77 { 0x07, "Version 7" },
78 { 0x08, "Version 8" },
79 { 0x09, "Version 9" },
80 { 0x0A, "Version 10" },
81 { 0x0B, "Version 11" },
82 { 0x0C, "Version 12" },
83 { 0x0D, "Version 13" },
84 { 0x0E, "Version 14" },
85 { 0x0F, "Version 15" },
86 { 0x10, "Version 16" },
90 static const value_string h248_3GUP_delerrsdu_vals[] = {
93 { 0x0003, "Not Applicable" },
97 static const value_string h248_3GUP_interface_vals[] = {
98 { 0x0001, "RAN (Iu interface)" },
99 { 0x0002, "CN (Nb interface)" },
103 static const value_string h248_3GUP_initdir_vals[] = {
104 { 0x0001, "Incoming" },
105 { 0x0002, "Outgoing" },
109 static const value_string h248_3GUP_parameters[] _U_ = {
111 { 0x0002, "UPversions" },
112 { 0x0003, "Delivery of erroneous SDUs" },
113 { 0x0004, "Interface" },
114 { 0x0005, "Initialisation Direction" },
118 static const h248_pkg_param_t h248_package_3GUP_properties[] = {
119 { 0x0001, &hf_h248_package_3GUP_Mode, h248_param_ber_integer, &implicit },
120 { 0x0002, &hf_h248_package_3GUP_UPversions, h248_param_ber_integer, &implicit },
121 { 0x0003, &hf_h248_package_3GUP_delerrsdu, h248_param_ber_integer, &implicit },
122 { 0x0004, &hf_h248_package_3GUP_interface, h248_param_ber_integer, &implicit },
123 { 0x0005, &hf_h248_package_3GUP_initdir, h248_param_ber_integer, &implicit },
124 { 0x0000, NULL, NULL, NULL }
127 static const h248_package_t h248_package_3GUP = {
129 &hf_h248_package_3GUP,
130 &ett_h248_package_3GUP,
131 h248_3GUP_properties_vals,
135 h248_package_3GUP_properties,
143 * Circuit Switched Data package
144 * 3GPP TS 29.232 -- 15.2.1
147 static int hf_h248_package_3GCSD = -1;
149 static int hf_h248_package_3GCSD_plmnbc = -1;
150 static int hf_h248_package_3GCSD_gsmchancod = -1;
151 static int hf_h248_pkg_3GCSD_evt_protres = -1;
152 static int hf_h248_pkg_3GCSD_evt_protres_result = -1;
153 static int hf_h248_pkg_3GCSD_evt_protres_cause = -1;
154 static int hf_h248_pkg_3GCSD_evt_ratechg = -1;
155 static int hf_h248_pkg_3GCSD_evt_ratechg_rate = -1;
156 static int hf_h248_pkg_3GCSD_sig_actprot = -1;
157 static int hf_h248_pkg_3GCSD_actprot_sig_localpeer = -1;
159 static gint ett_h248_package_3GCSD = -1;
160 static gint ett_h248_3GCSD_evt_protres = -1;
161 static gint ett_h248_3GCSD_evt_ratechg = -1;
162 static gint ett_pkg_3GCSD_sig_actprot = -1;
164 static const value_string h248_3GCSD_properties_vals[] = {
166 { 0x0002, "gsmchancod"},
170 static const value_string h248_3GCSD_signals_vals[] _U_ = {
171 { 0x0001, "actprot" },
175 static const value_string h248_3GCSD_signal_actprot_vals[] = {
176 { 0x0001, "localpeer" },
180 static const value_string h248_3GCSD_events_vals[] _U_ = {
181 { 0x0001, "protres"},
182 { 0x0002, "ratechg"},
186 static const value_string h248_3GCSD_event_protres_vals[] = {
192 static const value_string h248_3GCSD_event_ratechg_vals[] = {
197 static const value_string h248_3GCSD_evt_protres_result_vals[] = {
203 static const value_string h248_3GCSD_evt_protres_cause_vals[] = {
209 static const value_string h248_3GCSD_actprot_sig_localpeer_vals[] = {
215 static const h248_pkg_param_t h248_package_3GCSD_props[] = {
216 { 0x0001, &hf_h248_package_3GCSD_plmnbc, h248_param_ber_octetstring, &implicit},
217 { 0x0002, &hf_h248_package_3GCSD_gsmchancod, h248_param_ber_octetstring, &implicit },
218 { 0x0000, NULL, NULL, NULL }
221 static const h248_pkg_param_t h248_pkg_3GCSD_evt_protres_params[] = {
222 { 0x0001, &hf_h248_pkg_3GCSD_evt_protres_result, h248_param_ber_integer, &implicit },
223 { 0x0002, &hf_h248_pkg_3GCSD_evt_protres_cause, h248_param_ber_integer, &implicit },
224 { 0, NULL, NULL, NULL}
227 static const h248_pkg_param_t h248_pkg_3GCSD_evt_ratechg_params[] = {
228 { 0x0001, &hf_h248_pkg_3GCSD_evt_ratechg_rate, h248_param_ber_integer, &implicit },
229 { 0, NULL, NULL, NULL}
232 static const h248_pkg_evt_t h248_package_3GCSD_evts[] = {
233 { 0x0001, &hf_h248_pkg_3GCSD_evt_protres, &ett_h248_3GCSD_evt_protres, h248_pkg_3GCSD_evt_protres_params, h248_3GCSD_event_protres_vals},
234 { 0x0002, &hf_h248_pkg_3GCSD_evt_ratechg, &ett_h248_3GCSD_evt_ratechg, h248_pkg_3GCSD_evt_ratechg_params, h248_3GCSD_event_ratechg_vals},
235 { 0, NULL, NULL, NULL,NULL}
238 static const h248_pkg_param_t h248_pkg_3GCSD_actprot_sig_params[] = {
239 { 0x0001, &hf_h248_pkg_3GCSD_actprot_sig_localpeer, h248_param_ber_integer, &implicit },
240 { 0, NULL, NULL, NULL}
243 static const h248_pkg_sig_t h248_package_3GCSD_sigs[] = {
244 { 0x0010, &hf_h248_pkg_3GCSD_sig_actprot, &ett_pkg_3GCSD_sig_actprot, h248_pkg_3GCSD_actprot_sig_params, h248_3GCSD_signal_actprot_vals },
245 { 0, NULL, NULL, NULL,NULL}
248 static const h248_package_t h248_package_3GCSD = {
250 &hf_h248_package_3GCSD,
251 &ett_h248_package_3GCSD,
252 h248_3GCSD_properties_vals,
256 h248_package_3GCSD_props,
257 h248_package_3GCSD_sigs,
258 h248_package_3GCSD_evts,
265 * 3GPP TS 29.232 -- 15.2.2
267 static int hf_h248_package_3GTFO = -1;
269 static int hf_h248_pkg_3GTFO_evt_codec_modify = -1;
270 static int hf_h248_pkg_3GTFO_evt_distant_codec_list = -1;
271 static int hf_h248_pkg_3GTFO_evt_status = -1;
272 static int hf_h248_pkg_3GTFO_enable = -1;
273 static int hf_h248_pkg_3GTFO_codeclist = -1;
274 static int hf_h248_pkg_3GTFO_evt_codec_modify_optimalcodec = -1;
275 static int hf_h248_pkg_3GTFO_evt_distant_codec_list_distlist = -1;
276 static int hf_h248_pkg_3GTFO_evt_status_tfostatus = -1;
278 static gint ett_h248_package_3GTFO = -1;
279 static gint ett_h248_3GTFO_evt_status = -1;
280 static gint ett_h248_3GTFO_evt_distant_codec_list = -1;
281 static gint ett_h248_3GTFO_evt_codec_modify = -1;
282 static gint ett_h248_3GTFO_codec_list = -1;
283 static gint ett_h248_3GTFO_codec = -1;
286 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_) {
287 tvbuff_t* sub_tvb = NULL;
293 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
295 get_ber_identifier(tvb, 0, &class, &pc, &tag);
297 /* XXX: is this enough to guess it? */
298 if ((tag==BER_UNI_TAG_OCTETSTRING)) {
299 dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, 0, hfid, &sub_tvb );
302 proto_tree* pt = proto_item_add_subtree(asn1_ctx.created_item, ett_h248_3GTFO_codec);
303 dissect_codec_mode(pt, sub_tvb, 0, tvb_length(tvb));
306 proto_tree_add_item(tree,hfid,tvb,0,-1,FALSE);
311 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_) {
312 tvbuff_t* sub_tvb = NULL;
318 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
320 get_ber_identifier(tvb, 0, &class, &pc, &tag);
322 if ((tag==BER_UNI_TAG_OCTETSTRING)) {
323 dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, 0, hfid, &sub_tvb );
326 proto_tree* pt = proto_item_add_subtree(asn1_ctx.created_item,ett_h248_3GTFO_codec_list);
327 int len = tvb_length(sub_tvb);
330 offset = dissect_codec_mode(pt, sub_tvb, offset, len);
331 } while(offset < len);
334 proto_tree_add_item(tree,hfid,tvb,0,-1,FALSE);
339 static const value_string h248_package_3GTFO_props_vals[] = {
345 static const value_string h248_pkg_3GTFO_evt_codec_modify_params_vals[] = {
351 static const value_string h248_pkg_3GTFO_evt_distant_codec_list_params_vals[] = {
356 static const value_string h248_pkg_3GTFO_evt_status_params_vals[] = {
362 static const value_string h248_package_3GTFO_evts_vals[] = {
364 {12,"distant_codec_list"},
369 static const value_string tfoenable_vals[] = {
375 static const h248_pkg_param_t h248_package_3GTFO_props[] = {
376 { 0x0001, &hf_h248_pkg_3GTFO_enable, h248_param_ber_integer, &implicit },
377 { 0x0002, &hf_h248_pkg_3GTFO_codeclist, dissect_3GTFO_codec_list, NULL }, /* Sub-list of Octet string Q.765.5 + TS 26.103 .*/
378 { 0, NULL, NULL, NULL}
382 static const h248_pkg_param_t h248_pkg_3GTFO_evt_codec_modify_params[] = {
383 { 0x0011, &hf_h248_pkg_3GTFO_evt_codec_modify_optimalcodec, dissect_3GTFO_codec_mode, NULL }, /* Q.765.5 + TS 26.103 .*/
384 { 0, NULL, NULL, NULL}
388 static const h248_pkg_param_t h248_pkg_3GTFO_evt_distant_codec_list_params[] = {
389 { 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 .*/
390 { 0, NULL, NULL, NULL}
393 static const h248_pkg_param_t h248_pkg_3GTFO_evt_status_params[] = {
394 { 0x0001, &hf_h248_pkg_3GTFO_evt_status_tfostatus, h248_param_ber_boolean, &implicit },
395 { 0, NULL, NULL, NULL}
398 static const h248_pkg_evt_t h248_package_3GTFO_evts[] = {
399 { 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},
400 { 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},
401 { 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},
402 { 0, NULL, NULL, NULL,NULL}
405 static const h248_package_t h248_package_3GTFO = {
407 &hf_h248_package_3GTFO,
408 &ett_h248_package_3GTFO,
409 h248_package_3GTFO_props_vals,
411 h248_package_3GTFO_evts_vals,
413 h248_package_3GTFO_props,
415 h248_package_3GTFO_evts,
419 * 3G Expanded Call Progress Tones Generator Package
420 * 3GPP TS 29.232 -- 15.2.3
423 * Modification Of Link Characteristics Bearer Capability
424 * 3GPP TS 29.232 -- 15.2.4
427 * Enhanced Circuit Switched Data package
428 * 3GPP TS 29.232 -- 15.2.5
431 * Cellular Text telephone Modem Text Transport
432 * 3GPP TS 29.232 -- 15.2.6
435 * IP transport package
436 * 3GPP TS 29.232 -- 15.2.7
439 * Flexible Tone Generator Package
440 * 3GPP TS 29.232 -- 15.2.8
444 * 3GPP TS 29.232 -- 15.2.9
447 * ASCI Group call package
448 * 3GPP TS 29.232 -- 15.2.10
452 void proto_register_h248_3gpp(void) {
453 static hf_register_info hf[] = {
454 { &hf_h248_package_3GUP_Mode,
455 { "Mode", "h248.package_3GUP.Mode",
456 FT_UINT32, BASE_DEC, VALS(h248_3GUP_Mode_vals), 0,
458 { &hf_h248_package_3GUP_UPversions,
459 { "UPversions", "h248.package_3GUP.upversions",
460 FT_UINT32, BASE_DEC, VALS(h248_3GUP_upversions_vals), 0,
462 { &hf_h248_package_3GUP_delerrsdu,
463 { "Delivery of erroneous SDUs", "h248.package_3GUP.delerrsdu",
464 FT_UINT32, BASE_DEC, VALS(h248_3GUP_delerrsdu_vals), 0,
466 { &hf_h248_package_3GUP_interface,
467 { "Interface", "h248.package_3GUP.interface",
468 FT_UINT32, BASE_DEC, VALS(h248_3GUP_interface_vals), 0,
470 { &hf_h248_package_3GUP_initdir,
471 { "Initialisation Direction", "h248.package_3GUP.initdir",
472 FT_UINT32, BASE_DEC, VALS(h248_3GUP_initdir_vals), 0,
476 { &hf_h248_package_3GCSD,
477 { "CSD Package", "h248.package_3GCSD",
478 FT_BYTES, BASE_NONE, NULL, 0,
479 "Circuit Switched Data Package", HFILL }},
480 { &hf_h248_package_3GCSD_plmnbc,
481 { "PLMN Bearer Capability", "h248.package_3GCSD.plmnbc",
482 FT_BYTES, BASE_NONE, NULL, 0,
483 "The PLMN Bearer Capability", HFILL }},
484 { &hf_h248_package_3GCSD_gsmchancod,
485 { "GSM channel coding", "h248.package_3GCSD.gsmchancod",
486 FT_BYTES, BASE_NONE, NULL, 0,
487 "Channel information needed for GSM", HFILL }},
488 { &hf_h248_pkg_3GCSD_evt_protres,
489 { "Protocol Negotiation Result", "h248.package_3GCSD.protres",
490 FT_BYTES, BASE_NONE, NULL, 0,
491 "This event is used to report the result of the protocol negotiation", HFILL }},
492 { &hf_h248_pkg_3GCSD_evt_protres_result,
493 { "Negotiation Result", "h248.package_3GCSD.protres.result",
494 FT_UINT32, BASE_DEC, VALS(h248_3GCSD_evt_protres_result_vals), 0,
495 "reports whether the protocol negotiation has been successful", HFILL }},
496 { &hf_h248_pkg_3GCSD_evt_protres_cause,
497 { "Possible Failure Cause", "h248.package_3GCSD.protres.cause",
498 FT_UINT32, BASE_DEC, VALS(h248_3GCSD_evt_protres_cause_vals), 0,
499 "indicates the possible failure cause", HFILL }},
500 { &hf_h248_pkg_3GCSD_evt_ratechg,
501 { "Rate Change", "h248.package_3GCSD.ratechg",
502 FT_BYTES, BASE_NONE, NULL, 0,
503 "This event is used to report a rate change", HFILL }},
504 { &hf_h248_pkg_3GCSD_evt_ratechg_rate,
505 { "New Rate", "h248.package_3GCSD.ratechg.rate",
506 FT_UINT32, BASE_DEC, NULL, 0,
507 "reports the new rate for the termination", HFILL }},
508 { &hf_h248_pkg_3GCSD_sig_actprot,
509 { "Activate Protocol", "h248.package_3GCSD.actprot",
510 FT_BYTES, BASE_NONE, NULL, 0,
511 "Activate the higher layer protocol", HFILL }},
512 { &hf_h248_pkg_3GCSD_actprot_sig_localpeer,
513 { "Local Peer Role", "h248.package_3GCSD.actprot.localpeer",
514 FT_UINT32, BASE_DEC, VALS(h248_3GCSD_actprot_sig_localpeer_vals), 0,
515 "It is used to inform the modem whether it should act as originating or terminating peer", HFILL }},
518 { &hf_h248_package_3GTFO,
519 { "Tandem Free Operation", "h248.package_3GTFO",
520 FT_BYTES, BASE_NONE, NULL, 0,
521 "This package defines events and properties for Tandem Free Operation (TFO) control", HFILL }},
522 { &hf_h248_pkg_3GTFO_enable,
523 { "TFO Activity Control", "h248.package_3GTFO.tfoenable",
524 FT_UINT32, BASE_DEC, VALS(tfoenable_vals), 0,
525 "Defines if TFO is enabled or not", HFILL }},
526 { &hf_h248_pkg_3GTFO_codeclist,
527 { "TFO Codec List", "h248.package_3GTFO.codeclist",
528 FT_BYTES, BASE_NONE, NULL, 0,
529 "List of codecs for use in TFO protocol", HFILL }},
531 { &hf_h248_pkg_3GTFO_evt_codec_modify,
532 { "Optimal Codec Event", "h248.package_3GTFO.codec_modify",
533 FT_BYTES, BASE_NONE, NULL, 0,
534 "The event is used to notify the MGC that TFO negotiation has resulted in an optimal codec type being proposed", HFILL }},
535 { &hf_h248_pkg_3GTFO_evt_codec_modify_optimalcodec,
536 { "Optimal Codec Type", "h248.package_3GTFO.codec_modify.optimalcodec",
537 FT_BYTES, BASE_NONE, NULL, 0,
538 "indicates which is the proposed codec type for TFO", HFILL }},
540 { &hf_h248_pkg_3GTFO_evt_distant_codec_list,
541 { "Codec List Event", "h248.package_3GTFO.distant_codec_list",
542 FT_BYTES, BASE_NONE, NULL, 0,
543 "The event is used to notify the MGC of the distant TFO partner's supported codec list", HFILL }},
545 { &hf_h248_pkg_3GTFO_evt_distant_codec_list_distlist,
546 { "Distant Codec List", "h248.package_3GTFO.distant_codec_list.distlist",
547 FT_BYTES, BASE_NONE, NULL, 0,
548 "indicates the codec list for TFO", HFILL }},
550 { &hf_h248_pkg_3GTFO_evt_status,
551 { "TFO Status Event", "h248.package_3GTFO.status",
552 FT_BYTES, BASE_NONE, NULL, 0,
553 "The event is used to notify the MGC that a TFO link has been established or broken", HFILL }},
554 { &hf_h248_pkg_3GTFO_evt_status_tfostatus,
555 { "TFO Status", "h248.package_3GTFO.status.tfostatus",
556 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
557 "reports whether TFO has been established or broken", HFILL }},
560 static gint *ett[] = {
561 &ett_h248_package_3GUP,
562 &ett_h248_package_3GCSD,
563 &ett_h248_3GCSD_evt_protres,
564 &ett_h248_3GCSD_evt_ratechg,
565 &ett_h248_package_3GTFO,
566 &ett_h248_3GTFO_evt_status,
567 &ett_h248_3GTFO_evt_distant_codec_list,
568 &ett_h248_3GTFO_evt_codec_modify,
569 &ett_h248_3GTFO_codec_list,
570 &ett_h248_3GTFO_codec
573 hf_h248_package_3GUP = proto_register_protocol(PNAME, PSNAME, PFNAME);
575 proto_register_field_array(hf_h248_package_3GUP, hf, array_length(hf));
577 proto_register_subtree_array(ett, array_length(ett));
579 h248_register_package(&h248_package_3GUP);
580 h248_register_package(&h248_package_3GCSD);
581 h248_register_package(&h248_package_3GTFO);