2 * Routines for X.711 CMIP packet dissection
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
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.
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
37 #include "packet-ber.h"
38 #include "packet-acse.h"
39 #include "packet-x509if.h"
40 #include "packet-cmip.h"
42 #define PNAME "X711 CMIP"
46 /* XXX some stuff we need until we can get rid of it */
47 #include "packet-ses.h"
48 #include "packet-pres.h"
50 /* Initialize the protocol and registered fields */
52 static int hf_cmip_actionType_OID = -1;
53 static int hf_cmip_eventType_OID = -1;
54 static int hf_cmip_attributeId_OID = -1;
55 static int hf_cmip_errorId_OID = -1;
56 static int hf_DiscriminatorConstruct = -1;
57 static int hf_Destination = -1;
58 static int hf_NameBinding = -1;
59 static int hf_ObjectClass = -1;
60 static int hf_OperationalState = -1;
61 #include "packet-cmip-hf.c"
63 /* Initialize the subtree pointers */
64 static gint ett_cmip = -1;
65 #include "packet-cmip-ett.c"
67 static guint32 opcode;
69 static int opcode_type;
70 #define OPCODE_INVOKE 1
71 #define OPCODE_RETURN_RESULT 2
72 #define OPCODE_RETURN_ERROR 3
73 #define OPCODE_REJECT 4
75 static int attributeform;
76 #define ATTRIBUTE_LOCAL_FORM 0
77 #define ATTRIBUTE_GLOBAL_FORM 1
78 static const char *attribute_identifier_id;
80 static const char *attributevalueassertion_id;
82 static const char *object_identifier_id;
84 static int objectclassform;
85 #define OBJECTCLASS_LOCAL_FORM 0
86 #define OBJECTCLASS_GLOBAL_FORM 1
87 static const char *objectclass_identifier_id;
89 #include "packet-cmip-fn.c"
93 dissect_cmip_attribute_35(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
96 dissect_cmip_OperationalState(FALSE, tvb, 0, pinfo, parent_tree, hf_OperationalState);
101 dissect_cmip_attribute_55(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
104 dissect_cmip_Destination(FALSE, tvb, 0, pinfo, parent_tree,hf_Destination);
109 dissect_cmip_attribute_56(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
112 dissect_cmip_DiscriminatorConstruct(FALSE, tvb, 0, pinfo, parent_tree, hf_DiscriminatorConstruct);
117 dissect_cmip_attribute_63(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
120 dissect_cmip_NameBinding(FALSE, tvb, 0, pinfo, parent_tree, hf_NameBinding);
125 dissect_cmip_attribute_65(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
128 dissect_cmip_ObjectClass(FALSE, tvb, 0, pinfo, parent_tree, hf_ObjectClass);
133 /* XXX this one should be broken out later and moved into the conformance file */
135 dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
137 static struct SESSION_DATA_STRUCTURE* session = NULL;
138 proto_item *item = NULL;
139 proto_tree *tree = NULL;
142 /* do we have spdu type from the session dissector? */
143 if( !pinfo->private_data ){
145 proto_tree_add_text(tree, tvb, 0, -1,
146 "Internal error:can't get spdu type from session dissector.");
150 session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
151 if(session->spdu_type == 0 ){
153 proto_tree_add_text(tree, tvb, 0, -1,
154 "Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
161 item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, FALSE);
162 tree = proto_item_add_subtree(item, ett_cmip);
165 if (check_col(pinfo->cinfo, COL_PROTOCOL))
166 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMIP");
167 if (check_col(pinfo->cinfo, COL_INFO))
168 col_clear(pinfo->cinfo, COL_INFO);
169 switch(session->spdu_type){
170 case SES_CONNECTION_REQUEST:
171 case SES_CONNECTION_ACCEPT:
175 dissect_cmip_CMIPUserInfo(FALSE,tvb,0,pinfo,tree,-1);
178 dissect_cmip_CMIPAbortInfo(FALSE,tvb,0,pinfo,tree,-1);
180 case SES_DATA_TRANSFER:
181 dissect_cmip_ROS(FALSE,tvb,0,pinfo,tree,-1);
188 /*--- proto_register_cmip ----------------------------------------------*/
189 void proto_register_cmip(void) {
192 static hf_register_info hf[] = {
193 { &hf_cmip_actionType_OID,
194 { "actionType", "cmip.actionType_OID",
195 FT_STRING, BASE_NONE, NULL, 0,
196 "actionType", HFILL }},
197 { &hf_cmip_eventType_OID,
198 { "eventType", "cmip.eventType_OID",
199 FT_STRING, BASE_NONE, NULL, 0,
200 "eventType", HFILL }},
201 { &hf_cmip_attributeId_OID,
202 { "attributeId", "cmip.attributeId_OID",
203 FT_STRING, BASE_NONE, NULL, 0,
204 "attributeId", HFILL }},
205 { &hf_cmip_errorId_OID,
206 { "errorId", "cmip.errorId_OID",
207 FT_STRING, BASE_NONE, NULL, 0,
209 { &hf_DiscriminatorConstruct,
210 { "DiscriminatorConstruct", "cmip.DiscriminatorConstruct",
211 FT_UINT32, BASE_DEC, NULL, 0,
214 { "Destination", "cmip.Destination",
215 FT_UINT32, BASE_DEC, NULL, 0,
218 { "NameBinding", "cmip.NameBinding",
219 FT_STRING, BASE_NONE, NULL, 0,
222 { "ObjectClass", "cmip.ObjectClass",
223 FT_UINT32, BASE_DEC, VALS(cmip_ObjectClass_vals), 0,
225 { &hf_OperationalState,
226 { "OperationalState", "cmip.OperationalState",
227 FT_UINT32, BASE_DEC, VALS(cmip_OperationalState_vals), 0,
230 #include "packet-cmip-hfarr.c"
233 /* List of subtrees */
234 static gint *ett[] = {
236 #include "packet-cmip-ettarr.c"
239 /* Register protocol */
240 proto_cmip = proto_register_protocol(PNAME, PSNAME, PFNAME);
242 /* Register fields and subtrees */
243 proto_register_field_array(proto_cmip, hf, array_length(hf));
244 proto_register_subtree_array(ett, array_length(ett));
249 /*--- proto_reg_handoff_cmip -------------------------------------------*/
250 void proto_reg_handoff_cmip(void) {
251 register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip");
252 register_ber_oid_dissector("2.9.1.1.4", dissect_cmip, proto_cmip, "joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)");
253 register_ber_oid_dissector("2.9.3.2.7.35", dissect_cmip_attribute_35, proto_cmip, "smi2AttributeID (7) operationalState(35)");
254 register_ber_oid_dissector("2.9.3.2.7.55", dissect_cmip_attribute_55, proto_cmip, "smi2AttributeID (7) destination(55)");
255 register_ber_oid_dissector("2.9.3.2.7.56", dissect_cmip_attribute_56, proto_cmip, "smi2AttributeID (7) discriminatorConstruct(56)");
256 register_ber_oid_dissector("2.9.3.2.7.63", dissect_cmip_attribute_63, proto_cmip, "smi2AttributeID (7) nameBinding(63)");
257 register_ber_oid_dissector("2.9.3.2.7.65", dissect_cmip_attribute_65, proto_cmip, "smi2AttributeID (7) objectClass(65)");
259 register_ber_oid_name("2.9.3.2.3.4","eventForwardingDiscriminator(4)");
260 register_ber_oid_name("2.9.1.1.4","joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)");