2 * Routines for t124 packet dissection
3 * Copyright 2010, Graeme Lunt
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/conversation.h>
33 #include <epan/asn1.h>
34 #include "packet-per.h"
35 #include "packet-ber.h"
36 #include "packet-t124.h"
39 /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
40 #pragma warning(disable:4146)
43 #define PNAME "GENERIC-CONFERENCE-CONTROL T.124"
44 #define PSNAME "T.124"
47 /* Initialize the protocol and registered fields */
48 static int proto_t124 = -1;
49 static proto_tree *top_tree = NULL;
51 #include "packet-t124-hf.c"
53 /* Initialize the subtree pointers */
54 static int ett_t124 = -1;
55 static int ett_t124_connectGCCPDU = -1;
57 static int hf_t124_ConnectData = -1;
58 static int hf_t124_connectGCCPDU = -1;
59 static int hf_t124_DomainMCSPDU_PDU = -1;
61 static guint32 channelId = -1;
63 static const char *t124Identifier = NULL; /* extensions identifier */
64 static tvbuff_t *t124NSIdentifier = NULL; /* extensions non-standard identifier */
65 static dissector_table_t t124_ns_dissector_table=NULL;
66 static dissector_table_t t124_sd_dissector_table=NULL;
68 #include "packet-t124-ett.c"
70 #include "packet-t124-fn.c"
72 static const per_sequence_t t124Heur_sequence[] = {
73 { &hf_t124_t124Identifier , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t124_Key },
78 register_t124_ns_dissector(const char *nsKey, dissector_t dissector, int proto)
80 dissector_handle_t dissector_handle;
82 dissector_handle=create_dissector_handle(dissector, proto);
83 dissector_add_string("t124.ns", nsKey, dissector_handle);
86 void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId, dissector_t dissector, int proto)
88 /* XXX: we should keep the sub-dissectors list per conversation
89 as the same channels may be used.
90 While we are just using RDP over T.124, then we can get away with it.
93 dissector_handle_t dissector_handle;
95 dissector_handle=create_dissector_handle(dissector, proto);
96 dissector_add_uint("t124.sd", channelId, dissector_handle);
100 guint32 t124_get_last_channelId(void)
105 void t124_set_top_tree(proto_tree *tree)
110 int dissect_DomainMCSPDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
113 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
115 offset = dissect_t124_DomainMCSPDU(tvb, offset, &asn1_ctx, tree, hf_t124_DomainMCSPDU_PDU);
116 offset += 7; offset >>= 3;
121 dissect_t124_new(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, void *data _U_)
123 proto_item *item = NULL;
124 proto_tree *tree = NULL;
127 top_tree = parent_tree;
129 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.125");
130 col_clear(pinfo->cinfo, COL_INFO);
132 item = proto_tree_add_item(parent_tree, proto_t124, tvb, 0, tvb_length(tvb), ENC_NA);
133 tree = proto_item_add_subtree(item, ett_t124);
135 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
136 dissect_t124_ConnectData(tvb, 0, &asn1_ctx, tree, hf_t124_ConnectData);
138 return tvb_length(tvb);
142 dissect_t124(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree)
144 dissect_t124_new(tvb, pinfo, parent_tree, NULL);
148 dissect_t124_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, void *data _U_)
152 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
154 t124Identifier = NULL;
156 (void) dissect_per_sequence(tvb, 0, &asn1_ctx, NULL, -1, -1, t124Heur_sequence);
158 if((t124Identifier != NULL) &&
159 (strcmp(t124Identifier, "0.0.20.124.0.1") == 0)) {
161 dissect_t124(tvb, pinfo, parent_tree);
168 /*--- proto_register_t124 -------------------------------------------*/
169 void proto_register_t124(void) {
172 static hf_register_info hf[] = {
173 { &hf_t124_ConnectData,
174 { "ConnectData", "t124.ConnectData",
175 FT_NONE, BASE_NONE, NULL, 0,
177 { &hf_t124_connectGCCPDU,
178 { "connectGCCPDU", "t124.connectGCCPDU",
179 FT_UINT32, BASE_DEC, VALS(t124_ConnectGCCPDU_vals), 0,
181 { &hf_t124_DomainMCSPDU_PDU,
182 { "DomainMCSPDU", "t124.DomainMCSPDU",
183 FT_UINT32, BASE_DEC, VALS(t124_DomainMCSPDU_vals), 0,
185 #include "packet-t124-hfarr.c"
188 /* List of subtrees */
189 static gint *ett[] = {
191 &ett_t124_connectGCCPDU,
192 #include "packet-t124-ettarr.c"
195 /* Register protocol */
196 proto_t124 = proto_register_protocol(PNAME, PSNAME, PFNAME);
197 /* Register fields and subtrees */
198 proto_register_field_array(proto_t124, hf, array_length(hf));
199 proto_register_subtree_array(ett, array_length(ett));
201 t124_ns_dissector_table = register_dissector_table("t124.ns", "T.124 H.221 Non Standard Dissectors", FT_STRING, BASE_NONE);
202 t124_sd_dissector_table = register_dissector_table("t124.sd", "T.124 H.221 Send Data Dissectors", FT_UINT32, BASE_HEX);
204 new_register_dissector("t124", dissect_t124_new, proto_t124);
209 proto_reg_handoff_t124(void) {
211 register_ber_oid_dissector("0.0.20.124.0.1", dissect_t124, proto_t124, "Generic Conference Control");
213 heur_dissector_add("t125", dissect_t124_heur, proto_t124);