1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
4 /* ../../tools/asn2wrs.py -b -L -p idmp -c ./idmp.cnf -s ./packet-idmp-template -D . -O ../../epan/dissectors IDMProtocolSpecification.asn CommonProtocolSpecification.asn */
6 /* Input file: packet-idmp-template.c */
8 #line 1 "../../asn1/idmp/packet-idmp-template.c"
10 * Routines for X.519 Internet Directly Mapped Procotol (IDMP) packet dissection
13 * Wireshark - Network traffic analyzer
14 * By Gerald Combs <gerald@wireshark.org>
15 * Copyright 1998 Gerald Combs
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 #include <epan/packet.h>
36 #include <epan/prefs.h>
37 #include <epan/wmem/wmem.h>
38 #include <epan/reassemble.h>
39 #include <epan/conversation.h>
40 #include <epan/oids.h>
41 #include <epan/asn1.h>
42 #include <epan/ipproto.h>
44 #include <epan/dissectors/packet-tcp.h>
46 #include "packet-ber.h"
47 #include "packet-ros.h"
48 #include "packet-x509ce.h"
50 #include <epan/strutil.h>
52 #define PNAME "X.519 Internet Directly Mapped Protocol"
56 void proto_register_idmp(void);
57 void proto_reg_handoff_idm(void);
58 static void prefs_register_idmp(void); /* forward declaration for use in preferences registration */
59 void register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name);
61 static gboolean idmp_desegment = TRUE;
62 static guint global_idmp_tcp_port = 1102; /* made up for now */
63 static gboolean idmp_reassemble = TRUE;
64 static guint tcp_port = 0;
65 static dissector_handle_t idmp_handle = NULL;
67 static proto_tree *top_tree = NULL;
68 static const char *protocolID = NULL;
69 static const char *saved_protocolID = NULL;
70 static guint32 opcode = -1;
72 /* Initialize the protocol and registered fields */
75 static int hf_idmp_version = -1;
76 static int hf_idmp_final = -1;
77 static int hf_idmp_length = -1;
78 static int hf_idmp_PDU = -1;
80 static reassembly_table idmp_reassembly_table;
82 static int hf_idmp_fragments = -1;
83 static int hf_idmp_fragment = -1;
84 static int hf_idmp_fragment_overlap = -1;
85 static int hf_idmp_fragment_overlap_conflicts = -1;
86 static int hf_idmp_fragment_multiple_tails = -1;
87 static int hf_idmp_fragment_too_long_fragment = -1;
88 static int hf_idmp_fragment_error = -1;
89 static int hf_idmp_fragment_count = -1;
90 static int hf_idmp_reassembled_in = -1;
91 static int hf_idmp_reassembled_length = -1;
93 static gint ett_idmp_fragment = -1;
94 static gint ett_idmp_fragments = -1;
96 static const fragment_items idmp_frag_items = {
97 /* Fragment subtrees */
100 /* Fragment fields */
103 &hf_idmp_fragment_overlap,
104 &hf_idmp_fragment_overlap_conflicts,
105 &hf_idmp_fragment_multiple_tails,
106 &hf_idmp_fragment_too_long_fragment,
107 &hf_idmp_fragment_error,
108 &hf_idmp_fragment_count,
109 /* Reassembled in field */
110 &hf_idmp_reassembled_in,
111 /* Reassembled length field */
112 &hf_idmp_reassembled_length,
113 /* Reassembled data field */
120 static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, int op, proto_tree *tree, struct SESSION_DATA_STRUCTURE *session)
122 if(session != NULL) {
124 if((!saved_protocolID) && (op == (ROS_OP_BIND | ROS_OP_RESULT))) {
125 /* save for subsequent operations - should be into session data */
126 saved_protocolID = wmem_strdup(wmem_file_scope(), protocolID);
130 session->ros_op = op;
131 offset = call_ros_oid_callback(saved_protocolID ? saved_protocolID : protocolID, tvb, offset, pinfo, tree, session);
139 /*--- Included file: packet-idmp-hf.c ---*/
140 #line 1 "../../asn1/idmp/packet-idmp-hf.c"
141 static int hf_idmp_bind = -1; /* IdmBind */
142 static int hf_idmp_bindResult = -1; /* IdmBindResult */
143 static int hf_idmp_bindError = -1; /* IdmBindError */
144 static int hf_idmp_request = -1; /* Request */
145 static int hf_idmp_idm_result = -1; /* IdmResult */
146 static int hf_idmp_idm_error = -1; /* Error */
147 static int hf_idmp_reject = -1; /* IdmReject */
148 static int hf_idmp_unbind = -1; /* Unbind */
149 static int hf_idmp_abort = -1; /* Abort */
150 static int hf_idmp_startTLS = -1; /* StartTLS */
151 static int hf_idmp_tLSResponse = -1; /* TLSResponse */
152 static int hf_idmp_protocolID = -1; /* OBJECT_IDENTIFIER */
153 static int hf_idmp_callingAETitle = -1; /* GeneralName */
154 static int hf_idmp_calledAETitle = -1; /* GeneralName */
155 static int hf_idmp_bind_argument = -1; /* Bind_argument */
156 static int hf_idmp_respondingAETitle = -1; /* GeneralName */
157 static int hf_idmp_bind_result = -1; /* Bind_result */
158 static int hf_idmp_bind_errcode = -1; /* Bind_errcode */
159 static int hf_idmp_aETitleError = -1; /* T_aETitleError */
160 static int hf_idmp_bind_error = -1; /* Bind_error */
161 static int hf_idmp_invokeID = -1; /* INTEGER */
162 static int hf_idmp_opcode = -1; /* Code */
163 static int hf_idmp_argument = -1; /* T_argument */
164 static int hf_idmp_idm_invokeID = -1; /* InvokeId */
165 static int hf_idmp_result = -1; /* T_result */
166 static int hf_idmp_errcode = -1; /* T_errcode */
167 static int hf_idmp_error = -1; /* T_error */
168 static int hf_idmp_reason = -1; /* T_reason */
169 static int hf_idmp_local = -1; /* T_local */
170 static int hf_idmp_global = -1; /* OBJECT_IDENTIFIER */
171 static int hf_idmp_present = -1; /* INTEGER */
172 static int hf_idmp_absent = -1; /* NULL */
174 /*--- End of included file: packet-idmp-hf.c ---*/
175 #line 131 "../../asn1/idmp/packet-idmp-template.c"
177 /* Initialize the subtree pointers */
178 static gint ett_idmp = -1;
180 /*--- Included file: packet-idmp-ett.c ---*/
181 #line 1 "../../asn1/idmp/packet-idmp-ett.c"
182 static gint ett_idmp_IDM_PDU = -1;
183 static gint ett_idmp_IdmBind = -1;
184 static gint ett_idmp_IdmBindResult = -1;
185 static gint ett_idmp_IdmBindError = -1;
186 static gint ett_idmp_Request = -1;
187 static gint ett_idmp_IdmResult = -1;
188 static gint ett_idmp_Error = -1;
189 static gint ett_idmp_IdmReject = -1;
190 static gint ett_idmp_Code = -1;
191 static gint ett_idmp_InvokeId = -1;
193 /*--- End of included file: packet-idmp-ett.c ---*/
194 #line 135 "../../asn1/idmp/packet-idmp-template.c"
197 /*--- Included file: packet-idmp-fn.c ---*/
198 #line 1 "../../asn1/idmp/packet-idmp-fn.c"
202 dissect_idmp_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
203 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &protocolID);
211 dissect_idmp_Bind_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
212 struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data;
214 return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_ARGUMENT), top_tree, session);
221 static const ber_sequence_t IdmBind_sequence[] = {
222 { &hf_idmp_protocolID , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_idmp_OBJECT_IDENTIFIER },
223 { &hf_idmp_callingAETitle , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_x509ce_GeneralName },
224 { &hf_idmp_calledAETitle , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_x509ce_GeneralName },
225 { &hf_idmp_bind_argument , BER_CLASS_CON, 2, 0, dissect_idmp_Bind_argument },
226 { NULL, 0, 0, 0, NULL }
230 dissect_idmp_IdmBind(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
231 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
232 IdmBind_sequence, hf_index, ett_idmp_IdmBind);
240 dissect_idmp_Bind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
241 struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data;
243 return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_RESULT), top_tree, session);
250 static const ber_sequence_t IdmBindResult_sequence[] = {
251 { &hf_idmp_protocolID , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_idmp_OBJECT_IDENTIFIER },
252 { &hf_idmp_respondingAETitle, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_x509ce_GeneralName },
253 { &hf_idmp_bind_result , BER_CLASS_CON, 1, 0, dissect_idmp_Bind_result },
254 { NULL, 0, 0, 0, NULL }
258 dissect_idmp_IdmBindResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
259 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
260 IdmBindResult_sequence, hf_index, ett_idmp_IdmBindResult);
268 dissect_idmp_Bind_errcode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
275 static const value_string idmp_T_aETitleError_vals[] = {
276 { 0, "callingAETitleNotAccepted" },
277 { 1, "calledAETitleNotRecognized" },
283 dissect_idmp_T_aETitleError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
284 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
293 dissect_idmp_Bind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
294 struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data;
296 return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND| ROS_OP_ERROR), top_tree, session);
303 static const ber_sequence_t IdmBindError_sequence[] = {
304 { &hf_idmp_protocolID , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_idmp_OBJECT_IDENTIFIER },
305 { &hf_idmp_bind_errcode , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_idmp_Bind_errcode },
306 { &hf_idmp_respondingAETitle, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_x509ce_GeneralName },
307 { &hf_idmp_aETitleError , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_idmp_T_aETitleError },
308 { &hf_idmp_bind_error , BER_CLASS_CON, 1, 0, dissect_idmp_Bind_error },
309 { NULL, 0, 0, 0, NULL }
313 dissect_idmp_IdmBindError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
314 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
315 IdmBindError_sequence, hf_index, ett_idmp_IdmBindError);
323 dissect_idmp_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
324 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
333 dissect_idmp_T_local(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
334 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
341 static const value_string idmp_Code_vals[] = {
347 static const ber_choice_t Code_choice[] = {
348 { 0, &hf_idmp_local , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_idmp_T_local },
349 { 1, &hf_idmp_global , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_idmp_OBJECT_IDENTIFIER },
350 { 0, NULL, 0, 0, 0, NULL }
354 dissect_idmp_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
355 offset = dissect_ber_choice(actx, tree, tvb, offset,
356 Code_choice, hf_index, ett_idmp_Code,
365 dissect_idmp_T_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
366 struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data;
368 return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_ARGUMENT | opcode), top_tree, session);
375 static const ber_sequence_t Request_sequence[] = {
376 { &hf_idmp_invokeID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_idmp_INTEGER },
377 { &hf_idmp_opcode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_idmp_Code },
378 { &hf_idmp_argument , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_idmp_T_argument },
379 { NULL, 0, 0, 0, NULL }
383 dissect_idmp_Request(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
384 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
385 Request_sequence, hf_index, ett_idmp_Request);
393 dissect_idmp_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
394 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
400 static const value_string idmp_InvokeId_vals[] = {
406 static const ber_choice_t InvokeId_choice[] = {
407 { 0, &hf_idmp_present , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_idmp_INTEGER },
408 { 1, &hf_idmp_absent , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_idmp_NULL },
409 { 0, NULL, 0, 0, 0, NULL }
413 dissect_idmp_InvokeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
414 offset = dissect_ber_choice(actx, tree, tvb, offset,
415 InvokeId_choice, hf_index, ett_idmp_InvokeId,
424 dissect_idmp_T_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
425 struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data;
427 return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_RESULT | opcode), top_tree, session);
434 static const ber_sequence_t IdmResult_sequence[] = {
435 { &hf_idmp_idm_invokeID , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_idmp_InvokeId },
436 { &hf_idmp_opcode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_idmp_Code },
437 { &hf_idmp_result , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_idmp_T_result },
438 { NULL, 0, 0, 0, NULL }
442 dissect_idmp_IdmResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
443 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
444 IdmResult_sequence, hf_index, ett_idmp_IdmResult);
452 dissect_idmp_T_errcode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
461 dissect_idmp_T_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
468 static const ber_sequence_t Error_sequence[] = {
469 { &hf_idmp_invokeID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_idmp_INTEGER },
470 { &hf_idmp_errcode , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_idmp_T_errcode },
471 { &hf_idmp_error , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_idmp_T_error },
472 { NULL, 0, 0, 0, NULL }
476 dissect_idmp_Error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
477 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
478 Error_sequence, hf_index, ett_idmp_Error);
484 static const value_string idmp_T_reason_vals[] = {
485 { 0, "mistypedPDU" },
486 { 1, "duplicateInvokeIDRequest" },
487 { 2, "unsupportedOperationRequest" },
488 { 3, "unknownOperationRequest" },
489 { 4, "mistypedArgumentRequest" },
490 { 5, "resourceLimitationRequest" },
491 { 6, "unknownInvokeIDResult" },
492 { 7, "mistypedResultRequest" },
493 { 8, "unknownInvokeIDError" },
494 { 9, "unknownError" },
495 { 10, "mistypedParameterError" },
501 dissect_idmp_T_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
502 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
509 static const ber_sequence_t IdmReject_sequence[] = {
510 { &hf_idmp_invokeID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_idmp_INTEGER },
511 { &hf_idmp_reason , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_idmp_T_reason },
512 { NULL, 0, 0, 0, NULL }
516 dissect_idmp_IdmReject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
517 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
518 IdmReject_sequence, hf_index, ett_idmp_IdmReject);
526 dissect_idmp_Unbind(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
527 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
533 static const value_string idmp_Abort_vals[] = {
534 { 0, "mistypedPDU" },
535 { 1, "unboundRequest" },
537 { 3, "resourceLimitation" },
538 { 4, "connectionFailed" },
539 { 5, "invalidProtocol" },
540 { 6, "reasonNotSpecified" },
546 dissect_idmp_Abort(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
547 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
556 dissect_idmp_StartTLS(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
557 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
563 static const value_string idmp_TLSResponse_vals[] = {
565 { 1, "operationsError" },
566 { 2, "protocolError" },
567 { 3, "unavailable" },
573 dissect_idmp_TLSResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
574 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
581 static const value_string idmp_IDM_PDU_vals[] = {
592 { 10, "tLSResponse" },
596 static const ber_choice_t IDM_PDU_choice[] = {
597 { 0, &hf_idmp_bind , BER_CLASS_CON, 0, 0, dissect_idmp_IdmBind },
598 { 1, &hf_idmp_bindResult , BER_CLASS_CON, 1, 0, dissect_idmp_IdmBindResult },
599 { 2, &hf_idmp_bindError , BER_CLASS_CON, 2, 0, dissect_idmp_IdmBindError },
600 { 3, &hf_idmp_request , BER_CLASS_CON, 3, 0, dissect_idmp_Request },
601 { 4, &hf_idmp_idm_result , BER_CLASS_CON, 4, 0, dissect_idmp_IdmResult },
602 { 5, &hf_idmp_idm_error , BER_CLASS_CON, 5, 0, dissect_idmp_Error },
603 { 6, &hf_idmp_reject , BER_CLASS_CON, 6, 0, dissect_idmp_IdmReject },
604 { 7, &hf_idmp_unbind , BER_CLASS_CON, 7, 0, dissect_idmp_Unbind },
605 { 8, &hf_idmp_abort , BER_CLASS_CON, 8, 0, dissect_idmp_Abort },
606 { 9, &hf_idmp_startTLS , BER_CLASS_CON, 9, 0, dissect_idmp_StartTLS },
607 { 10, &hf_idmp_tLSResponse , BER_CLASS_CON, 10, 0, dissect_idmp_TLSResponse },
608 { 0, NULL, 0, 0, 0, NULL }
612 dissect_idmp_IDM_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
613 offset = dissect_ber_choice(actx, tree, tvb, offset,
614 IDM_PDU_choice, hf_index, ett_idmp_IDM_PDU,
621 /*--- End of included file: packet-idmp-fn.c ---*/
622 #line 137 "../../asn1/idmp/packet-idmp-template.c"
625 register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name)
627 /* just register with ROS for now */
628 register_ros_protocol_info(oid, rinfo, proto, name, FALSE);
632 static int dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
639 struct SESSION_DATA_STRUCTURE session;
642 fragment_head *fd_head;
643 conversation_t *conv;
646 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
648 conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
649 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
651 /* Found a conversation, also use index for the generated dst_ref */
652 dst_ref = conv->index;
655 /* save parent_tree so subdissectors can create new top nodes */
656 top_tree=parent_tree;
658 item = proto_tree_add_item(parent_tree, proto_idmp, tvb, 0, -1, ENC_NA);
659 tree = proto_item_add_subtree(item, ett_idmp);
661 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDMP");
663 /* now check the segment fields */
665 proto_tree_add_item(tree, hf_idmp_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset++;
666 proto_tree_add_item(tree, hf_idmp_final, tvb, offset, 1, ENC_BIG_ENDIAN);
667 idmp_final = tvb_get_guint8(tvb, offset); offset++;
668 proto_tree_add_item(tree, hf_idmp_length, tvb, offset, 4, ENC_BIG_ENDIAN);
669 idmp_length = tvb_get_ntohl(tvb, offset); offset += 4;
671 asn1_ctx.private_data = &session;
673 if(idmp_reassemble) {
675 pinfo->fragmented = !idmp_final;
677 col_append_fstr(pinfo->cinfo, COL_INFO, " [%sIDMP fragment, %u byte%s]",
678 idmp_final ? "Final " : "" ,
679 idmp_length, plurality(idmp_length, "", "s"));
681 fd_head = fragment_add_seq_next(&idmp_reassembly_table, tvb, offset,
682 pinfo, dst_ref, NULL,
683 idmp_length, !idmp_final);
685 if(fd_head && fd_head->next) {
686 proto_tree_add_text(tree, tvb, offset, (idmp_length) ? -1 : 0,
687 "IDMP segment data (%u byte%s)", idmp_length,
688 plurality(idmp_length, "", "s"));
691 /* This is the last segment */
692 tvb = process_reassembled_data (tvb, offset, pinfo,
693 "Reassembled IDMP", fd_head, &idmp_frag_items, NULL, tree);
695 } else if (pinfo->fd->num != fd_head->reassembled_in) {
696 /* Add a "Reassembled in" link if not reassembled in this frame */
697 proto_tree_add_uint (tree, hf_idmp_reassembled_in,
698 tvb, 0, 0, fd_head->reassembled_in);
705 col_append_fstr(pinfo->cinfo, COL_INFO, " [IDMP fragment, %u byte%s, IDMP reassembly not enabled]",
706 idmp_length, plurality(idmp_length, "", "s"));
708 proto_tree_add_text(tree, tvb, offset, (idmp_length) ? -1 : 0,
709 "IDMP segment data (%u byte%s) (IDMP reassembly not enabled)", idmp_length,
710 plurality(idmp_length, "", "s"));
713 /* not reassembling - just dissect */
715 asn1_ctx.private_data = &session;
716 dissect_idmp_IDM_PDU(FALSE, tvb, offset, &asn1_ctx, tree, hf_idmp_PDU);
719 return tvb_length(tvb);
722 static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
726 len = tvb_get_ntohl(tvb, offset + 2);
731 static int dissect_idmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
733 tcp_dissect_pdus(tvb, pinfo, parent_tree, idmp_desegment, 0, get_idmp_pdu_len, dissect_idmp, data);
734 return tvb_length(tvb);
737 static void idmp_reassemble_init (void)
739 reassembly_table_init (&idmp_reassembly_table,
740 &addresses_reassembly_table_functions);
742 saved_protocolID = NULL;
745 /*--- proto_register_idmp -------------------------------------------*/
746 void proto_register_idmp(void)
749 static hf_register_info hf[] = {
751 { "version", "idmp.version",
752 FT_INT8, BASE_DEC, NULL, 0,
753 "idmp.INTEGER", HFILL }},
755 { "final", "idmp.final",
756 FT_BOOLEAN, BASE_NONE, NULL, 0,
757 "idmp.BOOLEAN", HFILL }},
759 { "length", "idmp.length",
760 FT_INT32, BASE_DEC, NULL, 0,
761 "idmp.INTEGER", HFILL }},
763 { "IDM-PDU", "idmp.pdu",
764 FT_UINT32, BASE_DEC, VALS(idmp_IDM_PDU_vals), 0,
765 "idmp.PDU", HFILL }},
766 /* Fragment entries */
767 { &hf_idmp_fragments,
768 { "IDMP fragments", "idmp.fragments", FT_NONE, BASE_NONE,
769 NULL, 0x00, NULL, HFILL } },
771 { "IDMP fragment", "idmp.fragment", FT_FRAMENUM, BASE_NONE,
772 NULL, 0x00, NULL, HFILL } },
773 { &hf_idmp_fragment_overlap,
774 { "IDMP fragment overlap", "idmp.fragment.overlap", FT_BOOLEAN,
775 BASE_NONE, NULL, 0x00, NULL, HFILL } },
776 { &hf_idmp_fragment_overlap_conflicts,
777 { "IDMP fragment overlapping with conflicting data",
778 "idmp.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE,
779 NULL, 0x00, NULL, HFILL } },
780 { &hf_idmp_fragment_multiple_tails,
781 { "IDMP has multiple tail fragments",
782 "idmp.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE,
783 NULL, 0x00, NULL, HFILL } },
784 { &hf_idmp_fragment_too_long_fragment,
785 { "IDMP fragment too long", "idmp.fragment.too_long_fragment",
786 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
787 { &hf_idmp_fragment_error,
788 { "IDMP defragmentation error", "idmp.fragment.error", FT_FRAMENUM,
789 BASE_NONE, NULL, 0x00, NULL, HFILL } },
790 { &hf_idmp_fragment_count,
791 { "IDMP fragment count", "idmp.fragment.count", FT_UINT32, BASE_DEC,
792 NULL, 0x00, NULL, HFILL } },
793 { &hf_idmp_reassembled_in,
794 { "Reassembled IDMP in frame", "idmp.reassembled.in", FT_FRAMENUM, BASE_NONE,
795 NULL, 0x00, "This IDMP packet is reassembled in this frame", HFILL } },
796 { &hf_idmp_reassembled_length,
797 { "Reassembled IDMP length", "idmp.reassembled.length", FT_UINT32, BASE_DEC,
798 NULL, 0x00, "The total length of the reassembled payload", HFILL } },
801 /*--- Included file: packet-idmp-hfarr.c ---*/
802 #line 1 "../../asn1/idmp/packet-idmp-hfarr.c"
804 { "bind", "idmp.bind_element",
805 FT_NONE, BASE_NONE, NULL, 0,
807 { &hf_idmp_bindResult,
808 { "bindResult", "idmp.bindResult_element",
809 FT_NONE, BASE_NONE, NULL, 0,
810 "IdmBindResult", HFILL }},
811 { &hf_idmp_bindError,
812 { "bindError", "idmp.bindError_element",
813 FT_NONE, BASE_NONE, NULL, 0,
814 "IdmBindError", HFILL }},
816 { "request", "idmp.request_element",
817 FT_NONE, BASE_NONE, NULL, 0,
819 { &hf_idmp_idm_result,
820 { "result", "idmp.result_element",
821 FT_NONE, BASE_NONE, NULL, 0,
822 "IdmResult", HFILL }},
823 { &hf_idmp_idm_error,
824 { "error", "idmp.error_element",
825 FT_NONE, BASE_NONE, NULL, 0,
828 { "reject", "idmp.reject_element",
829 FT_NONE, BASE_NONE, NULL, 0,
830 "IdmReject", HFILL }},
832 { "unbind", "idmp.unbind_element",
833 FT_NONE, BASE_NONE, NULL, 0,
836 { "abort", "idmp.abort",
837 FT_UINT32, BASE_DEC, VALS(idmp_Abort_vals), 0,
840 { "startTLS", "idmp.startTLS_element",
841 FT_NONE, BASE_NONE, NULL, 0,
843 { &hf_idmp_tLSResponse,
844 { "tLSResponse", "idmp.tLSResponse",
845 FT_UINT32, BASE_DEC, VALS(idmp_TLSResponse_vals), 0,
847 { &hf_idmp_protocolID,
848 { "protocolID", "idmp.protocolID",
849 FT_OID, BASE_NONE, NULL, 0,
850 "OBJECT_IDENTIFIER", HFILL }},
851 { &hf_idmp_callingAETitle,
852 { "callingAETitle", "idmp.callingAETitle",
853 FT_UINT32, BASE_DEC, VALS(x509ce_GeneralName_vals), 0,
854 "GeneralName", HFILL }},
855 { &hf_idmp_calledAETitle,
856 { "calledAETitle", "idmp.calledAETitle",
857 FT_UINT32, BASE_DEC, VALS(x509ce_GeneralName_vals), 0,
858 "GeneralName", HFILL }},
859 { &hf_idmp_bind_argument,
860 { "argument", "idmp.argument_element",
861 FT_NONE, BASE_NONE, NULL, 0,
862 "Bind_argument", HFILL }},
863 { &hf_idmp_respondingAETitle,
864 { "respondingAETitle", "idmp.respondingAETitle",
865 FT_UINT32, BASE_DEC, VALS(x509ce_GeneralName_vals), 0,
866 "GeneralName", HFILL }},
867 { &hf_idmp_bind_result,
868 { "result", "idmp.result_element",
869 FT_NONE, BASE_NONE, NULL, 0,
870 "Bind_result", HFILL }},
871 { &hf_idmp_bind_errcode,
872 { "errcode", "idmp.errcode_element",
873 FT_NONE, BASE_NONE, NULL, 0,
874 "Bind_errcode", HFILL }},
875 { &hf_idmp_aETitleError,
876 { "aETitleError", "idmp.aETitleError",
877 FT_UINT32, BASE_DEC, VALS(idmp_T_aETitleError_vals), 0,
879 { &hf_idmp_bind_error,
880 { "error", "idmp.error_element",
881 FT_NONE, BASE_NONE, NULL, 0,
882 "Bind_error", HFILL }},
884 { "invokeID", "idmp.invokeID",
885 FT_INT32, BASE_DEC, NULL, 0,
888 { "opcode", "idmp.opcode",
889 FT_UINT32, BASE_DEC, VALS(idmp_Code_vals), 0,
892 { "argument", "idmp.argument_element",
893 FT_NONE, BASE_NONE, NULL, 0,
895 { &hf_idmp_idm_invokeID,
896 { "invokeID", "idmp.invokeID",
897 FT_UINT32, BASE_DEC, VALS(idmp_InvokeId_vals), 0,
900 { "result", "idmp.result_element",
901 FT_NONE, BASE_NONE, NULL, 0,
904 { "errcode", "idmp.errcode_element",
905 FT_NONE, BASE_NONE, NULL, 0,
908 { "error", "idmp.error_element",
909 FT_NONE, BASE_NONE, NULL, 0,
912 { "reason", "idmp.reason",
913 FT_UINT32, BASE_DEC, VALS(idmp_T_reason_vals), 0,
916 { "local", "idmp.local",
917 FT_INT32, BASE_DEC, NULL, 0,
920 { "global", "idmp.global",
921 FT_OID, BASE_NONE, NULL, 0,
922 "OBJECT_IDENTIFIER", HFILL }},
924 { "present", "idmp.present",
925 FT_INT32, BASE_DEC, NULL, 0,
928 { "absent", "idmp.absent_element",
929 FT_NONE, BASE_NONE, NULL, 0,
932 /*--- End of included file: packet-idmp-hfarr.c ---*/
933 #line 315 "../../asn1/idmp/packet-idmp-template.c"
936 /* List of subtrees */
937 static gint *ett[] = {
942 /*--- Included file: packet-idmp-ettarr.c ---*/
943 #line 1 "../../asn1/idmp/packet-idmp-ettarr.c"
946 &ett_idmp_IdmBindResult,
947 &ett_idmp_IdmBindError,
955 /*--- End of included file: packet-idmp-ettarr.c ---*/
956 #line 323 "../../asn1/idmp/packet-idmp-template.c"
958 module_t *idmp_module;
960 /* Register protocol */
961 proto_idmp = proto_register_protocol(PNAME, PSNAME, PFNAME);
963 /* Register fields and subtrees */
964 proto_register_field_array(proto_idmp, hf, array_length(hf));
965 proto_register_subtree_array(ett, array_length(ett));
967 new_register_dissector("idmp", dissect_idmp_tcp, proto_idmp);
969 register_init_routine (&idmp_reassemble_init);
971 /* Register our configuration options for IDMP, particularly our port */
973 idmp_module = prefs_register_protocol_subtree("OSI/X.500", proto_idmp, prefs_register_idmp);
975 prefs_register_bool_preference(idmp_module, "desegment_idmp_messages",
976 "Reassemble IDMP messages spanning multiple TCP segments",
977 "Whether the IDMP dissector should reassemble messages spanning multiple TCP segments."
978 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
981 prefs_register_bool_preference(idmp_module, "reassemble",
982 "Reassemble segmented IDMP datagrams",
983 "Whether segmented IDMP datagrams should be reassembled."
984 " To use this option, you must also enable"
985 " \"Allow subdissectors to reassemble TCP streams\""
986 " in the TCP protocol settings.", &idmp_reassemble);
988 prefs_register_uint_preference(idmp_module, "tcp.port", "IDMP TCP Port",
989 "Set the port for Internet Directly Mapped Protocol requests/responses",
990 10, &global_idmp_tcp_port);
995 /*--- proto_reg_handoff_idm --- */
996 void proto_reg_handoff_idm(void) {
998 /* remember the idm handler for change in preferences */
999 idmp_handle = find_dissector(PFNAME);
1005 prefs_register_idmp(void)
1008 /* de-register the old port */
1009 /* port 102 is registered by TPKT - don't undo this! */
1011 dissector_delete_uint("tcp.port", tcp_port, idmp_handle);
1013 /* Set our port number for future use */
1014 tcp_port = global_idmp_tcp_port;
1016 if((tcp_port > 0) && idmp_handle)
1017 dissector_add_uint("tcp.port", global_idmp_tcp_port, idmp_handle);