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 #include "packet-cmip-hf.c"
58 /* Initialize the subtree pointers */
59 static gint ett_cmip = -1;
60 #include "packet-cmip-ett.c"
62 static guint32 opcode;
64 static int opcode_type;
65 #define OPCODE_INVOKE 1
66 #define OPCODE_RETURN_RESULT 2
67 #define OPCODE_RETURN_ERROR 3
68 #define OPCODE_REJECT 4
70 static int attributeform;
71 #define ATTRIBUTE_LOCAL_FORM 0
72 #define ATTRIBUTE_GLOBAL_FORM 1
73 static char attribute_identifier_id[BER_MAX_OID_STR_LEN];
75 static char object_identifier_id[BER_MAX_OID_STR_LEN];
77 static int objectclassform;
78 #define OBJECTCLASS_LOCAL_FORM 0
79 #define OBJECTCLASS_GLOBAL_FORM 1
80 static char objectclass_identifier_id[BER_MAX_OID_STR_LEN];
82 #include "packet-cmip-fn.c"
84 /* XXX this one should be broken out later and moved into the conformance file */
86 dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
88 static struct SESSION_DATA_STRUCTURE* session = NULL;
89 proto_item *item = NULL;
90 proto_tree *tree = NULL;
93 /* do we have spdu type from the session dissector? */
94 if( !pinfo->private_data ){
96 proto_tree_add_text(tree, tvb, 0, -1,
97 "Internal error:can't get spdu type from session dissector.");
101 session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
102 if(session->spdu_type == 0 ){
104 proto_tree_add_text(tree, tvb, 0, -1,
105 "Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
112 item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, FALSE);
113 tree = proto_item_add_subtree(item, ett_cmip);
116 if (check_col(pinfo->cinfo, COL_PROTOCOL))
117 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMIP");
118 if (check_col(pinfo->cinfo, COL_INFO))
119 col_clear(pinfo->cinfo, COL_INFO);
120 switch(session->spdu_type){
121 case SES_CONNECTION_REQUEST:
122 case SES_CONNECTION_ACCEPT:
126 dissect_cmip_CMIPUserInfo(FALSE,tvb,0,pinfo,tree,-1);
129 dissect_cmip_CMIPAbortInfo(FALSE,tvb,0,pinfo,tree,-1);
131 case SES_DATA_TRANSFER:
132 dissect_cmip_ROS(FALSE,tvb,0,pinfo,tree,-1);
139 /*--- proto_register_cmip ----------------------------------------------*/
140 void proto_register_cmip(void) {
143 static hf_register_info hf[] = {
144 { &hf_cmip_actionType_OID,
145 { "actionType", "cmip.actionType_OID",
146 FT_STRING, BASE_NONE, NULL, 0,
147 "actionType", HFILL }},
148 { &hf_cmip_eventType_OID,
149 { "eventType", "cmip.eventType_OID",
150 FT_STRING, BASE_NONE, NULL, 0,
151 "eventType", HFILL }},
152 { &hf_cmip_attributeId_OID,
153 { "attributeId", "cmip.attributeId_OID",
154 FT_STRING, BASE_NONE, NULL, 0,
155 "attributeId", HFILL }},
156 { &hf_cmip_errorId_OID,
157 { "errorId", "cmip.errorId_OID",
158 FT_STRING, BASE_NONE, NULL, 0,
160 #include "packet-cmip-hfarr.c"
163 /* List of subtrees */
164 static gint *ett[] = {
166 #include "packet-cmip-ettarr.c"
169 /* Register protocol */
170 proto_cmip = proto_register_protocol(PNAME, PSNAME, PFNAME);
172 /* Register fields and subtrees */
173 proto_register_field_array(proto_cmip, hf, array_length(hf));
174 proto_register_subtree_array(ett, array_length(ett));
179 /*--- proto_reg_handoff_cmip -------------------------------------------*/
180 void proto_reg_handoff_cmip(void) {
181 register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip");