2 * Routines for X.711 CMIP packet dissection
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.
31 #include <epan/packet.h>
32 #include <epan/oids.h>
33 #include <epan/asn1.h>
38 #include "packet-ber.h"
39 #include "packet-acse.h"
40 #include "packet-x509if.h"
41 #include "packet-cmip.h"
43 #define PNAME "X711 CMIP"
47 /* XXX some stuff we need until we can get rid of it */
48 #include "packet-ses.h"
49 #include "packet-pres.h"
51 /* Initialize the protocol and registered fields */
53 static int hf_cmip_actionType_OID = -1;
54 static int hf_cmip_eventType_OID = -1;
55 static int hf_cmip_attributeId_OID = -1;
56 static int hf_cmip_errorId_OID = -1;
57 static int hf_DiscriminatorConstruct = -1;
58 static int hf_Destination = -1;
59 static int hf_NameBinding = -1;
60 static int hf_ObjectClass = -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 #include "packet-cmip-table.c"
71 static int opcode_type;
72 #define OPCODE_INVOKE 1
73 #define OPCODE_RETURN_RESULT 2
74 #define OPCODE_RETURN_ERROR 3
75 #define OPCODE_REJECT 4
77 static int attributeform;
78 #define ATTRIBUTE_LOCAL_FORM 0
79 #define ATTRIBUTE_GLOBAL_FORM 1
80 static const char *attribute_identifier_id;
82 static const char *attributevalueassertion_id;
84 static const char *object_identifier_id;
86 static int objectclassform;
87 #define OBJECTCLASS_LOCAL_FORM 0
88 #define OBJECTCLASS_GLOBAL_FORM 1
89 static const char *objectclass_identifier_id;
91 #include "packet-cmip-val.h"
92 #include "packet-cmip-fn.c"
97 /* XXX this one should be broken out later and moved into the conformance file */
99 dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
101 static struct SESSION_DATA_STRUCTURE* session = NULL;
102 proto_item *item = NULL;
103 proto_tree *tree = NULL;
105 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
108 /* do we have spdu type from the session dissector? */
109 if( !pinfo->private_data ){
111 proto_tree_add_text(tree, tvb, 0, -1,
112 "Internal error:can't get spdu type from session dissector.");
116 session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
117 if(session->spdu_type == 0 ){
119 proto_tree_add_text(tree, tvb, 0, -1,
120 "Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
127 item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, FALSE);
128 tree = proto_item_add_subtree(item, ett_cmip);
131 if (check_col(pinfo->cinfo, COL_PROTOCOL))
132 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMIP");
133 if (check_col(pinfo->cinfo, COL_INFO))
134 col_clear(pinfo->cinfo, COL_INFO);
135 switch(session->spdu_type){
136 case SES_CONNECTION_REQUEST:
137 case SES_CONNECTION_ACCEPT:
141 dissect_cmip_CMIPUserInfo(FALSE,tvb,0,&asn1_ctx,tree,-1);
144 dissect_cmip_CMIPAbortInfo(FALSE,tvb,0,&asn1_ctx,tree,-1);
146 case SES_DATA_TRANSFER:
147 dissect_cmip_ROS(FALSE,tvb,0,&asn1_ctx,tree,-1);
154 /*--- proto_register_cmip ----------------------------------------------*/
155 void proto_register_cmip(void) {
158 static hf_register_info hf[] = {
159 { &hf_cmip_actionType_OID,
160 { "actionType", "cmip.actionType_OID",
161 FT_STRING, BASE_NONE, NULL, 0,
163 { &hf_cmip_eventType_OID,
164 { "eventType", "cmip.eventType_OID",
165 FT_STRING, BASE_NONE, NULL, 0,
167 { &hf_cmip_attributeId_OID,
168 { "attributeId", "cmip.attributeId_OID",
169 FT_STRING, BASE_NONE, NULL, 0,
171 { &hf_cmip_errorId_OID,
172 { "errorId", "cmip.errorId_OID",
173 FT_STRING, BASE_NONE, NULL, 0,
175 { &hf_DiscriminatorConstruct,
176 { "DiscriminatorConstruct", "cmip.DiscriminatorConstruct",
177 FT_UINT32, BASE_DEC, NULL, 0,
180 { "Destination", "cmip.Destination",
181 FT_UINT32, BASE_DEC, NULL, 0,
184 { "NameBinding", "cmip.NameBinding",
185 FT_STRING, BASE_NONE, NULL, 0,
188 { "ObjectClass", "cmip.ObjectClass",
189 FT_UINT32, BASE_DEC, VALS(cmip_ObjectClass_vals), 0,
192 #include "packet-cmip-hfarr.c"
195 /* List of subtrees */
196 static gint *ett[] = {
198 #include "packet-cmip-ettarr.c"
201 /* Register protocol */
202 proto_cmip = proto_register_protocol(PNAME, PSNAME, PFNAME);
204 /* Register fields and subtrees */
205 proto_register_field_array(proto_cmip, hf, array_length(hf));
206 proto_register_subtree_array(ett, array_length(ett));
207 #include "packet-cmip-dis-tab.c"
208 oid_add_from_string("discriminatorId(1)","2.9.3.2.7.1");
213 /*--- proto_reg_handoff_cmip -------------------------------------------*/
214 void proto_reg_handoff_cmip(void) {
215 register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip");
216 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)");
218 oid_add_from_string("2.9.3.2.3.1","managedObjectClass(3) alarmRecord(1)");
219 oid_add_from_string("2.9.3.2.3.2","managedObjectClass(3) attributeValueChangeRecord(2)");
220 oid_add_from_string("2.9.3.2.3.3","managedObjectClass(3) discriminator(3)");
221 oid_add_from_string("2.9.3.2.3.4","managedObjectClass(3) eventForwardingDiscriminator(4)");
222 oid_add_from_string("2.9.3.2.3.5","managedObjectClass(3) eventLogRecord(5)");
223 oid_add_from_string("2.9.3.2.3.6","managedObjectClass(3) log(6)");
224 oid_add_from_string("2.9.3.2.3.7","managedObjectClass(3) logRecord(7)");
225 oid_add_from_string("2.9.3.2.3.8","managedObjectClass(3) objectCreationRecord(8)");
226 oid_add_from_string("2.9.3.2.3.9","managedObjectClass(3) objectDeletionRecord(9)");
227 oid_add_from_string("2.9.3.2.3.10","managedObjectClass(3) relationshipChangeRecord(10)");
228 oid_add_from_string("2.9.3.2.3.11","managedObjectClass(3) securityAlarmReportRecord(11)");
229 oid_add_from_string("2.9.3.2.3.12","managedObjectClass(3) stateChangeRecord(12)");
230 oid_add_from_string("2.9.3.2.3.13","managedObjectClass(3) system(13)");
231 oid_add_from_string("2.9.3.2.3.14","managedObjectClass(3) top(14)");
232 oid_add_from_string("2.9.3.2.4.14","administrativeStatePackage(14)");
233 oid_add_from_string("2.9.1.1.4","joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)");
235 /*#include "packet-cmip-dis-tab.c" */