2 * Routines for t125 packet dissection
3 * Copyright 2007, Ronnie Sahlberg
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.
32 #include <epan/packet.h>
34 #include <epan/asn1.h>
35 #include "packet-ber.h"
36 #include "packet-per.h"
38 #include "packet-t124.h"
40 #define PNAME "MULTIPOINT-COMMUNICATION-SERVICE T.125"
41 #define PSNAME "T.125"
45 /* Initialize the protocol and registered fields */
46 static int proto_t125 = -1;
47 static proto_tree *top_tree = NULL;
48 #include "packet-t125-hf.c"
50 /* Initialize the subtree pointers */
51 static int ett_t125 = -1;
53 static int hf_t125_connectData = -1;
54 static int hf_t125_heur = -1;
56 #include "packet-t125-ett.c"
58 static heur_dissector_list_t t125_heur_subdissector_list;
60 #include "packet-t125-fn.c"
63 dissect_t125(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree)
65 proto_item *item = NULL;
66 proto_tree *tree = NULL;
71 top_tree = parent_tree;
73 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.125");
74 col_clear(pinfo->cinfo, COL_INFO);
76 item = proto_tree_add_item(parent_tree, proto_t125, tvb, 0, tvb_length(tvb), ENC_NA);
77 tree = proto_item_add_subtree(item, ett_t125);
79 get_ber_identifier(tvb, 0, &class, &pc, &tag);
81 if ( (class==BER_CLASS_APP) && (tag>=101) && (tag<=104) ){
82 dissect_ConnectMCSPDU_PDU(tvb, pinfo, tree);
84 t124_set_top_tree(top_tree);
85 dissect_DomainMCSPDU_PDU(tvb, pinfo, tree);
88 return tvb_length(tvb);
92 dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree)
97 guint32 choice_index = 100;
100 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
103 get_ber_identifier(tvb, 0, &class, &pc, &tag);
105 dissect_per_constrained_integer(tvb, 0, &asn1_ctx,
106 NULL, hf_t125_heur, 0, 42,
107 &choice_index, FALSE);
109 /* is this strong enough ? */
110 if ( ((class==BER_CLASS_APP) && ((tag>=101) && (tag<=104))) ||
111 (choice_index <=42)) {
113 dissect_t125(tvb, pinfo, parent_tree);
122 /*--- proto_register_t125 -------------------------------------------*/
123 void proto_register_t125(void) {
126 static hf_register_info hf[] = {
127 { &hf_t125_connectData,
128 { "connectData", "t125.connectData",
129 FT_NONE, BASE_NONE, NULL, 0,
132 { "heuristic", "t125.heuristic",
133 FT_UINT32, BASE_DEC, NULL, 0,
135 #include "packet-t125-hfarr.c"
138 /* List of subtrees */
139 static gint *ett[] = {
141 #include "packet-t125-ettarr.c"
144 /* Register protocol */
145 proto_t125 = proto_register_protocol(PNAME, PSNAME, PFNAME);
146 /* Register fields and subtrees */
147 proto_register_field_array(proto_t125, hf, array_length(hf));
148 proto_register_subtree_array(ett, array_length(ett));
150 register_heur_dissector_list("t125", &t125_heur_subdissector_list);
152 new_register_dissector("t125", dissect_t125, proto_t125);
156 /*--- proto_reg_handoff_t125 ---------------------------------------*/
157 void proto_reg_handoff_t125(void) {
159 heur_dissector_add("cotp", dissect_t125_heur, proto_t125);
160 heur_dissector_add("cotp_is", dissect_t125_heur, proto_t125);