5 * (c) 2006, Anders Broman <anders.broman@telia.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.
27 * Ref ITU-T Rec. Q.1950 (12/2002)
34 #include "packet-h248.h"
35 #include "packet-isup.h"
37 #define PNAME "H.248 Q.1950 Annex A"
38 #define PSNAME "H248Q1950"
39 #define PFNAME "h248q1950"
41 static int proto_q1950 = -1;
42 static gboolean implicit = FALSE;
44 /* A.3 Bearer characteristics package */
45 static int hf_h248_pkg_BCP = -1;
46 static int hf_h248_pkg_BCP_BNCChar = -1;
48 static int ett_h248_pkg_BCP = -1;
50 static const value_string h248_pkg_BCP_parameters[] _U_ = {
51 { 0x0001, "BNCChar (BNC Characteristics)" },
55 static const value_string h248_pkg_BCP_props_vals[] = {
61 h248_pkg_param_t h248_pkg_BCP_props[] = {
62 { 0x0001, &hf_h248_pkg_BCP_BNCChar, h248_param_ber_integer, &implicit },
63 { 0, NULL, NULL, NULL}
66 /* Packet defenitions */
67 static h248_package_t h248_pkg_BCP = {
71 h248_pkg_BCP_props_vals,
75 h248_pkg_BCP_props, /* Properties */
81 /* A.4 Bearer Network connection cut-through package */
82 static int hf_h248_pkg_BNCCT = -1;
84 static int hf_h248_pkg_BNCCT_prop = -1;
86 static int ett_h248_pkg_BNCCT = -1;
88 static const value_string h248_pkg_BNCCT_parameters[] _U_ = {
89 { 0x0001, "BNC Cut Through Capability" },
93 static const value_string h248_pkg_BNCCT_props_vals[] = {
98 static const value_string h248_pkg_BNCCT_prop_vals[] = {
105 static const h248_pkg_param_t h248_pkg_BNCCT_props[] = {
106 { 0x0001, &hf_h248_pkg_BNCCT_prop, h248_param_ber_integer, &implicit },
107 { 0, NULL, NULL, NULL}
110 /* Packet defenitions */
111 static h248_package_t h248_pkg_BNCCT = {
115 h248_pkg_BNCCT_props_vals,
119 h248_pkg_BNCCT_props, /* Properties */
122 NULL /* statistics */
125 /* A.5 Bearer Reuse Idle Package */
126 static int hf_h248_pkg_RI = -1;
128 static int hf_h248_pkg_RII= -1;
130 static int ett_h248_pkg_RI= -1;
132 static const value_string h248_pkg_RI_parameters[] = {
133 { 0x0001, "Reuse Idle Indication" },
137 static const value_string h248_pkg_RII_vals[] = {
138 {0,"Not_Reuse_Idle"},
144 h248_pkg_param_t h248_pkg_RI_props[] = {
145 { 0x0001, &hf_h248_pkg_RII, h248_param_ber_integer, &implicit },
146 { 0, NULL, NULL, NULL}
149 /* Packet defenitions */
150 static h248_package_t h248_pkg_RI = {
154 h248_pkg_RI_parameters,
158 h248_pkg_RI_props, /* Properties */
161 NULL /* statistics */
165 /* A.5 Bearer Reuse Idle Package */
167 /* A.6 Generic bearer connection package
172 static int hf_h248_pkg_GB= -1;
173 static int hf_h248_pkg_GB_BNCChange= -1;
174 static int hf_h248_pkg_GB_BNCChange_type= -1;
175 static int hf_h248_pkg_GB_EstBNC= -1;
176 static int hf_h248_pkg_GB_ModBNC= -1;
177 static int hf_h248_pkg_GB_RelBNC = -1;
178 static int hf_h248_pkg_GB_RelBNC_Generalcause = -1;
179 static int hf_h248_pkg_GB_RelBNC_Failurecause = -1;
180 static int hf_h248_pkg_GB_RelBNC_Reset = -1;
182 static gint ett_h248_pkg_GB= -1;
183 static gint ett_h248_pkg_GB_EstBNC= -1;
184 static gint ett_h248_pkg_GB_ModBNC= -1;
185 static gint ett_h248_pkg_GB_RelBNC= -1;
186 static gint ett_h248_pkg_GB_BNCChange= -1;
188 static const value_string h248_pkg_GB_events_vals[] = {
189 { 0x0001, "BNCChange" },
194 static const value_string h248_pkg_GB_BNCChange_type_vals[] = {
195 {0x01, "Bearer Established"},
196 {0x02,"Bearer Modified"},
197 {0x03,"Bearer Cut through"},
198 {0x04,"Bearer Modification Failure"},
202 static const value_string h248_pkg_GB_BNCChange_params_vals[] = {
207 static const h248_pkg_param_t h248_pkg_GB_BNCChange_pars[] = {
208 { 0x0001, &hf_h248_pkg_GB_BNCChange_type, h248_param_ber_integer, &implicit },
209 { 0, NULL, NULL, NULL}
212 static const h248_pkg_evt_t h248_pkg_GB_events[] = {
213 { 0x0001, &hf_h248_pkg_GB_BNCChange, &ett_h248_pkg_GB_BNCChange, h248_pkg_GB_BNCChange_pars, h248_pkg_GB_BNCChange_params_vals},
214 { 0, NULL, NULL, NULL, NULL}
217 static const value_string h248_pkg_GB_signals_vals[] = {
218 {0x01, "Establish BNC"},
223 static const value_string h248_pkg_GB_RelBNC_vals[] = {
224 {0x01, "Generalcause"},
225 {0x02,"Failurecause"},
230 static const value_string h248_pkg_GB_RelBNC_Generalcause_vals[] = {
231 {0x01, "Normal Release"},
232 {0x02,"Unavailable Resources"},
233 {0x03,"Failure, Temporary"},
234 {0x04,"Failure, Permanent"},
235 {0x05,"Interworking Error"},
236 {0x06,"Unsupported"},
240 static const h248_pkg_param_t h248_pkg_GB_RelBNC_pars[] = {
241 { 0x0001, &hf_h248_pkg_GB_RelBNC_Generalcause, h248_param_ber_integer, &implicit },
242 { 0x0002, &hf_h248_pkg_GB_RelBNC_Failurecause, h248_param_ber_octetstring, &implicit },
243 { 0x0003, &hf_h248_pkg_GB_RelBNC_Reset, h248_param_ber_boolean, &implicit },
244 { 0, NULL, NULL, NULL}
248 static const h248_pkg_sig_t h248_pkg_GB_signals[] = {
249 { 0x0001,&hf_h248_pkg_GB_EstBNC,&ett_h248_pkg_GB_EstBNC, NULL, NULL},
250 { 0x0002,&hf_h248_pkg_GB_ModBNC,&ett_h248_pkg_GB_ModBNC, NULL, NULL},
251 { 0x0003,&hf_h248_pkg_GB_RelBNC,&ett_h248_pkg_GB_RelBNC, h248_pkg_GB_RelBNC_pars, h248_pkg_GB_RelBNC_vals},
252 { 0, NULL, NULL, NULL, NULL}
255 static h248_package_t h248_pkg_GB = {
260 h248_pkg_GB_signals_vals,
261 h248_pkg_GB_events_vals,
263 NULL, /* Properties */
264 h248_pkg_GB_signals, /* signals */
265 h248_pkg_GB_events, /* events */
266 NULL /* statistics */
270 /* A.7 Bearer control tunnelling package */
271 static dissector_handle_t bctp_dissector = NULL;
273 static int hf_h248_pkg_bt = -1;
274 static int hf_h248_pkg_bt_tind = -1;
275 static int hf_h248_pkg_bt_tunopt = -1;
276 static int hf_h248_pkg_bt_bit = -1;
278 static gint ett_h248_pkg_bt = -1;
279 static gint ett_h248_pkg_bt_tind = -1;
280 static gint ett_h248_pkg_bt_bit= -1;
282 static void dissect_bt_tunneled_proto(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int hfid, h248_curr_info_t* i _U_, void* d _U_) {
283 tvbuff_t* bctp_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, &bctp_tvb);
298 call_dissector(bctp_dissector,bctp_tvb,pinfo,tree);
301 proto_tree_add_item(tree,hfid,tvb,0,-1,FALSE);
308 static const value_string h248_pkg_bt_props_vals[] = {
309 {1,"Tunnelling Options"},
313 static const value_string h248_pkg_bt_tunopt_vals[] _U_ = {
314 {1,"1 (In the same message as the command response to the command which generated the bearer control tunnel)"},
315 {2,"2 (Tunnel message at any time)"},
320 static const h248_pkg_param_t h248_pkg_bt_props[] _U_ = {
321 { 0x0001, &hf_h248_pkg_bt_tunopt, h248_param_ber_integer, &implicit },
322 { 0, NULL, NULL, NULL}
326 static const value_string h248_pkg_bt_evt_vals[] = {
327 {1,"Tunnel indication"},
331 static const value_string h248_pkg_bt_tind_vals[] = {
332 {1,"Tunnel Indication"},
336 static const h248_pkg_param_t h248_pkg_bt_bit_params[] = {
337 { 0x0001, &hf_h248_pkg_bt_bit, dissect_bt_tunneled_proto, &implicit },
338 { 0, NULL, NULL, NULL}
341 static const value_string h248_pkg_bt_sigs_vals[] = {
342 {1,"Bearer Information Tunnel"},
346 static const h248_pkg_evt_t h248_pkg_bt_events[] = {
347 { 0x0001, &hf_h248_pkg_bt_tind, &ett_h248_pkg_bt_tind, h248_pkg_bt_bit_params, h248_pkg_bt_tind_vals},
348 { 0, NULL, NULL, NULL, NULL}
351 static const h248_pkg_sig_t h248_pkg_bt_signals[] = {
352 { 0x0001,&hf_h248_pkg_bt_bit,&ett_h248_pkg_bt_bit, h248_pkg_bt_bit_params, h248_pkg_bt_tind_vals},
353 { 0, NULL, NULL, NULL, NULL}
356 /* Packet defenitions */
357 static h248_package_t h248_pkg_bct = {
361 h248_pkg_bt_props_vals,
362 h248_pkg_bt_sigs_vals,
363 h248_pkg_bt_evt_vals,
365 NULL, /* Properties */
366 h248_pkg_bt_signals, /* signals */
367 h248_pkg_bt_events, /* events */
368 NULL /* statistics */
371 /* A.8 Basic call progress tones generator with directionality */
372 static int hf_h248_pkg_bcg = -1;
373 static int hf_h248_pkg_bcg_sig_bdt_par_btd = -1;
374 static int hf_h248_pkg_bcg_sig_bdt = -1;
375 static int hf_h248_pkg_bcg_sig_brt = -1;
376 static int hf_h248_pkg_bcg_sig_bbt = -1;
377 static int hf_h248_pkg_bcg_sig_bct = -1;
378 static int hf_h248_pkg_bcg_sig_bsit = -1;
379 static int hf_h248_pkg_bcg_sig_bwt = -1;
380 static int hf_h248_pkg_bcg_sig_bpt = -1;
381 static int hf_h248_pkg_bcg_sig_bcw = -1;
382 static int hf_h248_pkg_bcg_sig_bcr = -1;
383 static int hf_h248_pkg_bcg_sig_bpy = -1;
385 static int ett_h248_pkg_bcg = -1;
386 static int ett_h248_pkg_bcg_sig_bdt = -1;
388 static const value_string h248_pkg_bcg_sig_bdt_par_btd_vals[] = {
389 { 0x0001, "ext (External)" },
390 { 0x0002, "int (Internal)" },
391 { 0x0003, "both (Both)" },
395 static h248_pkg_param_t h248_pkg_h248_pkg_bcg_sig_bdt_params[] = {
396 { 0x0001, &hf_h248_pkg_bcg_sig_bdt_par_btd, h248_param_ber_integer, &implicit },
397 { 0, NULL, NULL, NULL}
400 static h248_pkg_sig_t h248_pkg_bcg_signals[] = {
401 /* All the tones have the same parameters */
402 { 0x0040, &hf_h248_pkg_bcg_sig_bdt, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
403 { 0x0041, &hf_h248_pkg_bcg_sig_brt, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
404 { 0x0042, &hf_h248_pkg_bcg_sig_bbt, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
405 { 0x0043, &hf_h248_pkg_bcg_sig_bct, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
406 { 0x0044, &hf_h248_pkg_bcg_sig_bsit, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
407 { 0x0045, &hf_h248_pkg_bcg_sig_bwt, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL},
408 { 0x0046, &hf_h248_pkg_bcg_sig_bpt, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
409 { 0x0047, &hf_h248_pkg_bcg_sig_bcw, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
410 { 0x0048, &hf_h248_pkg_bcg_sig_bcr, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
411 { 0x0049, &hf_h248_pkg_bcg_sig_bpy, &ett_h248_pkg_bcg_sig_bdt, h248_pkg_h248_pkg_bcg_sig_bdt_params, NULL },
412 { 0, NULL, NULL, NULL,NULL}
415 /* Packet defenitions */
416 static h248_package_t h248_pkg_bcg = {
424 NULL, /* Properties */
425 h248_pkg_bcg_signals, /* signals */
427 NULL /* statistics */
431 void proto_reg_handoff_q1950(void) {
432 bctp_dissector = find_dissector("bctp");
436 /* Register dissector */
437 void proto_register_q1950(void) {
438 static hf_register_info hf[] = {
439 /* A.3 Bearer characteristics package */
441 { "BCP (Bearer characteristics package)", "h248.pkg.BCP",
442 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
444 { &hf_h248_pkg_BCP_BNCChar,
445 { "BNCChar (BNC Characteristics)", "h248.pkg.bcp.bncchar",
446 FT_UINT32, BASE_HEX|BASE_EXT_STRING, &bearer_network_connection_characteristics_vals_ext, 0, "BNC Characteristics", HFILL }
449 /* A.4 Bearer Network connection cut-through package */
450 { &hf_h248_pkg_BNCCT,
451 { "BNCCT (Bearer network connection cut-through package)", "h248.pkg.BNCCT",
452 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
454 { &hf_h248_pkg_BNCCT_prop,
455 { "Bearer network connection cut-through capability", "h248.pkg.bcp.bncct",
456 FT_UINT32, BASE_HEX, VALS(h248_pkg_BNCCT_prop_vals), 0, "This property allows the MGC to ask the MG when the cut through of a bearer will occur, early or late.", HFILL }
460 { "GB (Generic bearer connection)", "h248.pkg.GB",
461 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
463 { &hf_h248_pkg_GB_BNCChange,
464 { "BNCChange", "h248.pkg.GB.BNCChang",
465 FT_BYTES, BASE_NONE, NULL, 0, "This event occurs whenever a change to a Bearer Network connection occurs", HFILL }
467 { &hf_h248_pkg_GB_BNCChange_type,
468 { "Type", "h248.pkg.GB.BNCChang.Type",
469 FT_UINT32, BASE_HEX, VALS(h248_pkg_GB_BNCChange_type_vals), 0, NULL, HFILL }
471 { &hf_h248_pkg_GB_EstBNC,
472 { "Type", "h248.pkg.GB.BNCChang.EstBNC",
473 FT_BYTES, BASE_NONE, NULL, 0, "This signal triggers the bearer control function to send bearer establishment signalling", HFILL }
475 { &hf_h248_pkg_GB_ModBNC,
476 { "Type", "h248.pkg.GB.BNCChang.Type",
477 FT_BYTES, BASE_NONE, NULL, 0, "This signal triggers the bearer control function to send bearer modification", HFILL }
479 { &hf_h248_pkg_GB_RelBNC,
480 { "RelBNC", "h248.pkg.GB.BNCChang.RelBNC",
481 FT_BYTES, BASE_NONE, NULL, 0, "This signal triggers the bearer control function to send bearer release", HFILL }
483 { &hf_h248_pkg_GB_RelBNC_Generalcause,
484 { "Generalcause", "h248.pkg.GB.BNCChang.RelBNC.Generalcause",
485 FT_UINT32, BASE_HEX, VALS(h248_pkg_GB_RelBNC_Generalcause_vals), 0, "This indicates the general reason for the Release", HFILL }
487 { &hf_h248_pkg_GB_RelBNC_Failurecause,
488 { "Failurecause", "h248.pkg.GB.BNCChang.RelBNC.Failurecause",
489 FT_BYTES, BASE_NONE, NULL, 0, "The Release Cause is the value generated by the Released equipment", HFILL }
491 { &hf_h248_pkg_GB_RelBNC_Reset,
492 { "RelBNC", "h248.pkg.GB.BNCChang.RelBNC",
493 FT_BOOLEAN, BASE_NONE, NULL, 0x0, "This signal triggers the bearer control function to send bearer release", HFILL }
496 /* A.5 Bearer Network connection cut-through package */
498 { "RI (Reuse idle package)", "h248.pkg.RI",
499 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
502 { "Reuse Idle Indication", "h248.pkg.bcp.rii",
503 FT_UINT32, BASE_HEX, VALS(h248_pkg_RII_vals), 0, "This property indicates that the provided bearer network connection relates to an Idle Bearer.", HFILL }
507 { "BT (Bearer control Tunneling)", "h248.pkg.BT",
508 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
510 { &hf_h248_pkg_bt_tunopt,
511 { "Tunnelling Options", "h248.pkg.BT.TunOpt",
512 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
514 { &hf_h248_pkg_bt_tind,
515 { "tind (Tunnel INDication)", "h248.pkg.BT.TIND",
516 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
518 { &hf_h248_pkg_bt_bit,
519 { "Bearer Information Transport", "h248.pkg.BT.BIT",
520 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
524 /* A.8 Basic call progress tones generator with directionality */
526 { "bcg (Basic call progress tones generator with directionality)", "h248.pkg.bcg",
527 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }
529 { &hf_h248_pkg_bcg_sig_bdt_par_btd,
530 { "btd (Tone Direction)", "h248.pkg.bcp.btd",
531 FT_UINT32, BASE_HEX, VALS(h248_pkg_bcg_sig_bdt_par_btd_vals), 0, NULL, HFILL }
533 { &hf_h248_pkg_bcg_sig_bdt,
534 { "bdt (Dial Tone)", "h248.pkg.bcg.bdt",
535 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
537 { &hf_h248_pkg_bcg_sig_brt,
538 { "brt (Ringing tone)", "h248.pkg.bcg.brt",
539 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
541 { &hf_h248_pkg_bcg_sig_bbt,
542 { "bbt (Busy tone)", "h248.pkg.bcg.bbt",
543 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
545 { &hf_h248_pkg_bcg_sig_bct,
546 { "bct (Congestion tone)", "h248.pkg.bcg.bct",
547 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
549 { &hf_h248_pkg_bcg_sig_bsit,
550 { "bsit (Special information tone)", "h248.pkg.bcg.bsit",
551 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
553 { &hf_h248_pkg_bcg_sig_bwt,
554 { "bwt (Warning tone)", "h248.pkg.bcg.bwt",
555 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
557 { &hf_h248_pkg_bcg_sig_bpt,
558 { "bpt (Payphone recognition tone)", "h248.pkg.bcg.bpt",
559 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
561 { &hf_h248_pkg_bcg_sig_bcw,
562 { "bcw (Call waiting tone)", "h248.pkg.bcg.bcw",
563 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
565 { &hf_h248_pkg_bcg_sig_bcr,
566 { "bcr (Call ringing tone)", "h248.pkg.bcg.bcr",
567 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
569 { &hf_h248_pkg_bcg_sig_bpy,
570 { "bpy (Pay tone)", "h248.pkg.bcg.bpy",
571 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }
575 static gint *ett[] = {
578 &ett_h248_pkg_bt_tind,
579 &ett_h248_pkg_bt_bit,
584 proto_q1950 = proto_register_protocol(PNAME, PSNAME, PFNAME);
586 proto_register_field_array(proto_q1950, hf, array_length(hf));
588 proto_register_subtree_array(ett, array_length(ett));
590 /* Register the packages */
591 h248_register_package(&h248_pkg_BCP);
592 h248_register_package(&h248_pkg_BNCCT);
593 h248_register_package(&h248_pkg_RI);
594 h248_register_package(&h248_pkg_GB);
595 h248_register_package(&h248_pkg_bcg);
596 h248_register_package(&h248_pkg_bct);