1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
4 /* asn2wrs.py -b -q -L -p idmp -c ./idmp.cnf -s ./packet-idmp-template -D . -O ../.. IDMProtocolSpecification.asn CommonProtocolSpecification.asn */
7 * Routines for X.519 Internet Directly Mapped Procotol (IDMP) packet dissection
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
19 #include <epan/packet.h>
20 #include <epan/prefs.h>
21 #include <epan/reassemble.h>
22 #include <epan/conversation.h>
23 #include <epan/oids.h>
24 #include <epan/asn1.h>
25 #include <epan/ipproto.h>
26 #include <epan/strutil.h>
28 #include <wsutil/str_util.h>
29 #include <wsutil/array.h>
31 #include "packet-tcp.h"
33 #include "packet-ber.h"
34 #include "packet-ros.h"
35 #include "packet-x509ce.h"
38 #define PNAME "X.519 Internet Directly Mapped Protocol"
42 void proto_register_idmp(void);
43 void proto_reg_handoff_idm(void);
44 void register_idmp_protocol_info(const char *oid
, const ros_info_t
*rinfo
, int proto _U_
, const char *name
);
46 static bool idmp_desegment
= true;
47 #define IDMP_TCP_PORT 1102 /* made up for now - not IANA registered */
48 static bool idmp_reassemble
= true;
49 static dissector_handle_t idmp_handle
;
51 static proto_tree
*top_tree
;
52 static const char *protocolID
;
53 static const char *saved_protocolID
;
54 static uint32_t opcode
= -1;
56 /* Initialize the protocol and registered fields */
59 static int hf_idmp_version
;
60 static int hf_idmp_final
;
61 static int hf_idmp_length
;
62 static int hf_idmp_PDU
;
64 static reassembly_table idmp_reassembly_table
;
66 static int hf_idmp_fragments
;
67 static int hf_idmp_fragment
;
68 static int hf_idmp_fragment_overlap
;
69 static int hf_idmp_fragment_overlap_conflicts
;
70 static int hf_idmp_fragment_multiple_tails
;
71 static int hf_idmp_fragment_too_long_fragment
;
72 static int hf_idmp_fragment_error
;
73 static int hf_idmp_fragment_count
;
74 static int hf_idmp_reassembled_in
;
75 static int hf_idmp_reassembled_length
;
76 static int hf_idmp_segment_data
;
78 static int ett_idmp_fragment
;
79 static int ett_idmp_fragments
;
81 static const fragment_items idmp_frag_items
= {
82 /* Fragment subtrees */
88 &hf_idmp_fragment_overlap
,
89 &hf_idmp_fragment_overlap_conflicts
,
90 &hf_idmp_fragment_multiple_tails
,
91 &hf_idmp_fragment_too_long_fragment
,
92 &hf_idmp_fragment_error
,
93 &hf_idmp_fragment_count
,
94 /* Reassembled in field */
95 &hf_idmp_reassembled_in
,
96 /* Reassembled length field */
97 &hf_idmp_reassembled_length
,
98 /* Reassembled data field */
105 static int call_idmp_oid_callback(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
, int op
, proto_tree
*tree
, struct SESSION_DATA_STRUCTURE
*session
)
107 if(session
!= NULL
) {
109 /* XXX saved_protocolID should be part of session data */
110 if (!saved_protocolID
) {
111 saved_protocolID
= "[ unknown ]";
115 session
->ros_op
= op
;
116 offset
= call_ros_oid_callback(saved_protocolID
, tvb
, offset
, pinfo
, tree
, session
);
123 static int hf_idmp_bind
; /* IdmBind */
124 static int hf_idmp_bindResult
; /* IdmBindResult */
125 static int hf_idmp_bindError
; /* IdmBindError */
126 static int hf_idmp_request
; /* Request */
127 static int hf_idmp_idm_result
; /* IdmResult */
128 static int hf_idmp_idm_error
; /* Error */
129 static int hf_idmp_reject
; /* IdmReject */
130 static int hf_idmp_unbind
; /* Unbind */
131 static int hf_idmp_abort
; /* Abort */
132 static int hf_idmp_startTLS
; /* StartTLS */
133 static int hf_idmp_tLSResponse
; /* TLSResponse */
134 static int hf_idmp_protocolID
; /* OBJECT_IDENTIFIER */
135 static int hf_idmp_callingAETitle
; /* GeneralName */
136 static int hf_idmp_calledAETitle
; /* GeneralName */
137 static int hf_idmp_bind_argument
; /* Bind_argument */
138 static int hf_idmp_respondingAETitle
; /* GeneralName */
139 static int hf_idmp_bind_result
; /* Bind_result */
140 static int hf_idmp_bind_errcode
; /* Bind_errcode */
141 static int hf_idmp_aETitleError
; /* T_aETitleError */
142 static int hf_idmp_bind_error
; /* Bind_error */
143 static int hf_idmp_invokeID
; /* INTEGER */
144 static int hf_idmp_opcode
; /* Code */
145 static int hf_idmp_argument
; /* T_argument */
146 static int hf_idmp_idm_invokeID
; /* InvokeId */
147 static int hf_idmp_result
; /* T_result */
148 static int hf_idmp_errcode
; /* T_errcode */
149 static int hf_idmp_error
; /* T_error */
150 static int hf_idmp_reason
; /* T_reason */
151 static int hf_idmp_local
; /* T_local */
152 static int hf_idmp_global
; /* OBJECT_IDENTIFIER */
153 static int hf_idmp_present
; /* INTEGER */
154 static int hf_idmp_absent
; /* NULL */
156 /* Initialize the subtree pointers */
158 static int ett_idmp_IDM_PDU
;
159 static int ett_idmp_IdmBind
;
160 static int ett_idmp_IdmBindResult
;
161 static int ett_idmp_IdmBindError
;
162 static int ett_idmp_Request
;
163 static int ett_idmp_IdmResult
;
164 static int ett_idmp_Error
;
165 static int ett_idmp_IdmReject
;
166 static int ett_idmp_Code
;
167 static int ett_idmp_InvokeId
;
172 dissect_idmp_OBJECT_IDENTIFIER(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
173 offset
= dissect_ber_object_identifier_str(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
, &protocolID
);
181 dissect_idmp_Bind_argument(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
182 struct SESSION_DATA_STRUCTURE
*session
= (struct SESSION_DATA_STRUCTURE
*)actx
->private_data
;
184 return call_idmp_oid_callback(tvb
, offset
, actx
->pinfo
, (ROS_OP_BIND
| ROS_OP_ARGUMENT
), top_tree
, session
);
191 static const ber_sequence_t IdmBind_sequence
[] = {
192 { &hf_idmp_protocolID
, BER_CLASS_UNI
, BER_UNI_TAG_OID
, BER_FLAGS_NOOWNTAG
, dissect_idmp_OBJECT_IDENTIFIER
},
193 { &hf_idmp_callingAETitle
, BER_CLASS_CON
, 0, BER_FLAGS_OPTIONAL
, dissect_x509ce_GeneralName
},
194 { &hf_idmp_calledAETitle
, BER_CLASS_CON
, 1, BER_FLAGS_OPTIONAL
, dissect_x509ce_GeneralName
},
195 { &hf_idmp_bind_argument
, BER_CLASS_CON
, 2, 0, dissect_idmp_Bind_argument
},
196 { NULL
, 0, 0, 0, NULL
}
200 dissect_idmp_IdmBind(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
201 protocolID
= saved_protocolID
= NULL
;
202 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
203 IdmBind_sequence
, hf_index
, ett_idmp_IdmBind
);
206 saved_protocolID
= wmem_strdup(wmem_epan_scope(), protocolID
);
214 dissect_idmp_Bind_result(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
215 struct SESSION_DATA_STRUCTURE
*session
= (struct SESSION_DATA_STRUCTURE
*)actx
->private_data
;
217 return call_idmp_oid_callback(tvb
, offset
, actx
->pinfo
, (ROS_OP_BIND
| ROS_OP_RESULT
), top_tree
, session
);
224 static const ber_sequence_t IdmBindResult_sequence
[] = {
225 { &hf_idmp_protocolID
, BER_CLASS_UNI
, BER_UNI_TAG_OID
, BER_FLAGS_NOOWNTAG
, dissect_idmp_OBJECT_IDENTIFIER
},
226 { &hf_idmp_respondingAETitle
, BER_CLASS_CON
, 0, BER_FLAGS_OPTIONAL
, dissect_x509ce_GeneralName
},
227 { &hf_idmp_bind_result
, BER_CLASS_CON
, 1, 0, dissect_idmp_Bind_result
},
228 { NULL
, 0, 0, 0, NULL
}
232 dissect_idmp_IdmBindResult(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
233 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
234 IdmBindResult_sequence
, hf_index
, ett_idmp_IdmBindResult
);
242 dissect_idmp_Bind_errcode(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
249 static const value_string idmp_T_aETitleError_vals
[] = {
250 { 0, "callingAETitleNotAccepted" },
251 { 1, "calledAETitleNotRecognized" },
257 dissect_idmp_T_aETitleError(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
258 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
267 dissect_idmp_Bind_error(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
268 struct SESSION_DATA_STRUCTURE
*session
= (struct SESSION_DATA_STRUCTURE
*)actx
->private_data
;
270 return call_idmp_oid_callback(tvb
, offset
, actx
->pinfo
, (ROS_OP_BIND
| ROS_OP_ERROR
), top_tree
, session
);
277 static const ber_sequence_t IdmBindError_sequence
[] = {
278 { &hf_idmp_protocolID
, BER_CLASS_UNI
, BER_UNI_TAG_OID
, BER_FLAGS_NOOWNTAG
, dissect_idmp_OBJECT_IDENTIFIER
},
279 { &hf_idmp_bind_errcode
, BER_CLASS_ANY
, 0, BER_FLAGS_NOOWNTAG
, dissect_idmp_Bind_errcode
},
280 { &hf_idmp_respondingAETitle
, BER_CLASS_CON
, 0, BER_FLAGS_OPTIONAL
, dissect_x509ce_GeneralName
},
281 { &hf_idmp_aETitleError
, BER_CLASS_UNI
, BER_UNI_TAG_ENUMERATED
, BER_FLAGS_OPTIONAL
|BER_FLAGS_NOOWNTAG
, dissect_idmp_T_aETitleError
},
282 { &hf_idmp_bind_error
, BER_CLASS_CON
, 1, 0, dissect_idmp_Bind_error
},
283 { NULL
, 0, 0, 0, NULL
}
287 dissect_idmp_IdmBindError(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
288 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
289 IdmBindError_sequence
, hf_index
, ett_idmp_IdmBindError
);
297 dissect_idmp_INTEGER(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
298 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
307 dissect_idmp_T_local(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
308 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
315 static const value_string idmp_Code_vals
[] = {
321 static const ber_choice_t Code_choice
[] = {
322 { 0, &hf_idmp_local
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_idmp_T_local
},
323 { 1, &hf_idmp_global
, BER_CLASS_UNI
, BER_UNI_TAG_OID
, BER_FLAGS_NOOWNTAG
, dissect_idmp_OBJECT_IDENTIFIER
},
324 { 0, NULL
, 0, 0, 0, NULL
}
328 dissect_idmp_Code(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
329 offset
= dissect_ber_choice(actx
, tree
, tvb
, offset
,
330 Code_choice
, hf_index
, ett_idmp_Code
,
339 dissect_idmp_T_argument(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
340 struct SESSION_DATA_STRUCTURE
*session
= (struct SESSION_DATA_STRUCTURE
*)actx
->private_data
;
342 return call_idmp_oid_callback(tvb
, offset
, actx
->pinfo
, (ROS_OP_INVOKE
| ROS_OP_ARGUMENT
| opcode
), top_tree
, session
);
349 static const ber_sequence_t Request_sequence
[] = {
350 { &hf_idmp_invokeID
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_idmp_INTEGER
},
351 { &hf_idmp_opcode
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_idmp_Code
},
352 { &hf_idmp_argument
, BER_CLASS_ANY
, 0, BER_FLAGS_NOOWNTAG
, dissect_idmp_T_argument
},
353 { NULL
, 0, 0, 0, NULL
}
357 dissect_idmp_Request(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
358 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
359 Request_sequence
, hf_index
, ett_idmp_Request
);
367 dissect_idmp_NULL(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
368 offset
= dissect_ber_null(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
);
374 static const value_string idmp_InvokeId_vals
[] = {
380 static const ber_choice_t InvokeId_choice
[] = {
381 { 0, &hf_idmp_present
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_idmp_INTEGER
},
382 { 1, &hf_idmp_absent
, BER_CLASS_UNI
, BER_UNI_TAG_NULL
, BER_FLAGS_NOOWNTAG
, dissect_idmp_NULL
},
383 { 0, NULL
, 0, 0, 0, NULL
}
387 dissect_idmp_InvokeId(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
388 offset
= dissect_ber_choice(actx
, tree
, tvb
, offset
,
389 InvokeId_choice
, hf_index
, ett_idmp_InvokeId
,
398 dissect_idmp_T_result(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
399 struct SESSION_DATA_STRUCTURE
*session
= (struct SESSION_DATA_STRUCTURE
*)actx
->private_data
;
401 return call_idmp_oid_callback(tvb
, offset
, actx
->pinfo
, (ROS_OP_INVOKE
| ROS_OP_RESULT
| opcode
), top_tree
, session
);
408 static const ber_sequence_t IdmResult_sequence
[] = {
409 { &hf_idmp_idm_invokeID
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_idmp_InvokeId
},
410 { &hf_idmp_opcode
, BER_CLASS_ANY
/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG
|BER_FLAGS_NOTCHKTAG
, dissect_idmp_Code
},
411 { &hf_idmp_result
, BER_CLASS_ANY
, 0, BER_FLAGS_NOOWNTAG
, dissect_idmp_T_result
},
412 { NULL
, 0, 0, 0, NULL
}
416 dissect_idmp_IdmResult(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
417 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
418 IdmResult_sequence
, hf_index
, ett_idmp_IdmResult
);
426 dissect_idmp_T_errcode(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
435 dissect_idmp_T_error(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
442 static const ber_sequence_t Error_sequence
[] = {
443 { &hf_idmp_invokeID
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_idmp_INTEGER
},
444 { &hf_idmp_errcode
, BER_CLASS_ANY
, 0, BER_FLAGS_NOOWNTAG
, dissect_idmp_T_errcode
},
445 { &hf_idmp_error
, BER_CLASS_ANY
, 0, BER_FLAGS_NOOWNTAG
, dissect_idmp_T_error
},
446 { NULL
, 0, 0, 0, NULL
}
450 dissect_idmp_Error(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
451 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
452 Error_sequence
, hf_index
, ett_idmp_Error
);
458 static const value_string idmp_T_reason_vals
[] = {
459 { 0, "mistypedPDU" },
460 { 1, "duplicateInvokeIDRequest" },
461 { 2, "unsupportedOperationRequest" },
462 { 3, "unknownOperationRequest" },
463 { 4, "mistypedArgumentRequest" },
464 { 5, "resourceLimitationRequest" },
465 { 6, "unknownInvokeIDResult" },
466 { 7, "mistypedResultRequest" },
467 { 8, "unknownInvokeIDError" },
468 { 9, "unknownError" },
469 { 10, "mistypedParameterError" },
475 dissect_idmp_T_reason(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
476 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
483 static const ber_sequence_t IdmReject_sequence
[] = {
484 { &hf_idmp_invokeID
, BER_CLASS_UNI
, BER_UNI_TAG_INTEGER
, BER_FLAGS_NOOWNTAG
, dissect_idmp_INTEGER
},
485 { &hf_idmp_reason
, BER_CLASS_UNI
, BER_UNI_TAG_ENUMERATED
, BER_FLAGS_NOOWNTAG
, dissect_idmp_T_reason
},
486 { NULL
, 0, 0, 0, NULL
}
490 dissect_idmp_IdmReject(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
491 offset
= dissect_ber_sequence(implicit_tag
, actx
, tree
, tvb
, offset
,
492 IdmReject_sequence
, hf_index
, ett_idmp_IdmReject
);
500 dissect_idmp_Unbind(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
501 offset
= dissect_ber_null(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
);
507 static const value_string idmp_Abort_vals
[] = {
508 { 0, "mistypedPDU" },
509 { 1, "unboundRequest" },
511 { 3, "resourceLimitation" },
512 { 4, "connectionFailed" },
513 { 5, "invalidProtocol" },
514 { 6, "reasonNotSpecified" },
520 dissect_idmp_Abort(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
521 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
530 dissect_idmp_StartTLS(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
531 offset
= dissect_ber_null(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
);
537 static const value_string idmp_TLSResponse_vals
[] = {
539 { 1, "operationsError" },
540 { 2, "protocolError" },
541 { 3, "unavailable" },
547 dissect_idmp_TLSResponse(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
548 offset
= dissect_ber_integer(implicit_tag
, actx
, tree
, tvb
, offset
, hf_index
,
555 static const value_string idmp_IDM_PDU_vals
[] = {
566 { 10, "tLSResponse" },
570 static const ber_choice_t IDM_PDU_choice
[] = {
571 { 0, &hf_idmp_bind
, BER_CLASS_CON
, 0, 0, dissect_idmp_IdmBind
},
572 { 1, &hf_idmp_bindResult
, BER_CLASS_CON
, 1, 0, dissect_idmp_IdmBindResult
},
573 { 2, &hf_idmp_bindError
, BER_CLASS_CON
, 2, 0, dissect_idmp_IdmBindError
},
574 { 3, &hf_idmp_request
, BER_CLASS_CON
, 3, 0, dissect_idmp_Request
},
575 { 4, &hf_idmp_idm_result
, BER_CLASS_CON
, 4, 0, dissect_idmp_IdmResult
},
576 { 5, &hf_idmp_idm_error
, BER_CLASS_CON
, 5, 0, dissect_idmp_Error
},
577 { 6, &hf_idmp_reject
, BER_CLASS_CON
, 6, 0, dissect_idmp_IdmReject
},
578 { 7, &hf_idmp_unbind
, BER_CLASS_CON
, 7, 0, dissect_idmp_Unbind
},
579 { 8, &hf_idmp_abort
, BER_CLASS_CON
, 8, 0, dissect_idmp_Abort
},
580 { 9, &hf_idmp_startTLS
, BER_CLASS_CON
, 9, 0, dissect_idmp_StartTLS
},
581 { 10, &hf_idmp_tLSResponse
, BER_CLASS_CON
, 10, 0, dissect_idmp_TLSResponse
},
582 { 0, NULL
, 0, 0, 0, NULL
}
586 dissect_idmp_IDM_PDU(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
587 offset
= dissect_ber_choice(actx
, tree
, tvb
, offset
,
588 IDM_PDU_choice
, hf_index
, ett_idmp_IDM_PDU
,
596 register_idmp_protocol_info(const char *oid
, const ros_info_t
*rinfo
, int proto _U_
, const char *name
)
598 /* just register with ROS for now */
599 register_ros_protocol_info(oid
, rinfo
, proto
, name
, false);
603 static int dissect_idmp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void* data _U_
)
610 struct SESSION_DATA_STRUCTURE session
;
612 uint32_t idmp_length
;
613 fragment_head
*fd_head
;
614 conversation_t
*conv
;
615 uint32_t dst_ref
= 0;
617 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
619 conv
= find_conversation_pinfo(pinfo
, 0);
621 /* Found a conversation, also use index for the generated dst_ref */
622 dst_ref
= conv
->conv_index
;
625 /* save parent_tree so subdissectors can create new top nodes */
626 top_tree
=parent_tree
;
628 item
= proto_tree_add_item(parent_tree
, proto_idmp
, tvb
, 0, -1, ENC_NA
);
629 tree
= proto_item_add_subtree(item
, ett_idmp
);
631 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "IDMP");
633 /* now check the segment fields */
635 proto_tree_add_item(tree
, hf_idmp_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
); offset
++;
636 proto_tree_add_item(tree
, hf_idmp_final
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
637 idmp_final
= tvb_get_uint8(tvb
, offset
); offset
++;
638 proto_tree_add_item(tree
, hf_idmp_length
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
639 idmp_length
= tvb_get_ntohl(tvb
, offset
); offset
+= 4;
641 asn1_ctx
.private_data
= &session
;
643 if(idmp_reassemble
) {
645 pinfo
->fragmented
= !idmp_final
;
647 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " [%sIDMP fragment, %u byte%s]",
648 idmp_final
? "Final " : "" ,
649 idmp_length
, plurality(idmp_length
, "", "s"));
651 fd_head
= fragment_add_seq_next(&idmp_reassembly_table
, tvb
, offset
,
652 pinfo
, dst_ref
, NULL
,
653 idmp_length
, !idmp_final
);
655 if(fd_head
&& fd_head
->next
) {
656 proto_tree_add_item(tree
, hf_idmp_segment_data
, tvb
, offset
, (idmp_length
) ? -1 : 0, ENC_NA
);
659 /* This is the last segment */
660 tvb
= process_reassembled_data (tvb
, offset
, pinfo
,
661 "Reassembled IDMP", fd_head
, &idmp_frag_items
, NULL
, tree
);
663 } else if (pinfo
->num
!= fd_head
->reassembled_in
) {
664 /* Add a "Reassembled in" link if not reassembled in this frame */
665 proto_tree_add_uint (tree
, hf_idmp_reassembled_in
,
666 tvb
, 0, 0, fd_head
->reassembled_in
);
673 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " [IDMP fragment, %u byte%s, IDMP reassembly not enabled]",
674 idmp_length
, plurality(idmp_length
, "", "s"));
676 proto_tree_add_bytes_format_value(tree
, hf_idmp_segment_data
, tvb
, offset
, (idmp_length
) ? -1 : 0,
677 NULL
, "(IDMP reassembly not enabled)");
680 /* not reassembling - just dissect */
682 asn1_ctx
.private_data
= &session
;
683 dissect_idmp_IDM_PDU(false, tvb
, offset
, &asn1_ctx
, tree
, hf_idmp_PDU
);
686 return tvb_captured_length(tvb
);
689 static unsigned get_idmp_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
,
690 int offset
, void *data _U_
)
694 len
= tvb_get_ntohl(tvb
, offset
+ 2);
699 static int dissect_idmp_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void* data
)
701 tcp_dissect_pdus(tvb
, pinfo
, parent_tree
, idmp_desegment
, 0, get_idmp_pdu_len
, dissect_idmp
, data
);
702 return tvb_captured_length(tvb
);
705 static void idmp_reassemble_cleanup(void)
707 protocolID
= NULL
; // packet scoped
708 saved_protocolID
= NULL
; // epan scoped copy of protocolID
712 /*--- proto_register_idmp -------------------------------------------*/
713 void proto_register_idmp(void)
716 static hf_register_info hf
[] = {
718 { "version", "idmp.version",
719 FT_INT8
, BASE_DEC
, NULL
, 0,
720 "idmp.INTEGER", HFILL
}},
722 { "final", "idmp.final",
723 FT_BOOLEAN
, BASE_NONE
, NULL
, 0,
724 "idmp.BOOLEAN", HFILL
}},
726 { "length", "idmp.length",
727 FT_INT32
, BASE_DEC
, NULL
, 0,
728 "idmp.INTEGER", HFILL
}},
730 { "IDM-PDU", "idmp.pdu",
731 FT_UINT32
, BASE_DEC
, VALS(idmp_IDM_PDU_vals
), 0,
732 "idmp.PDU", HFILL
}},
733 /* Fragment entries */
734 { &hf_idmp_fragments
,
735 { "IDMP fragments", "idmp.fragments", FT_NONE
, BASE_NONE
,
736 NULL
, 0x00, NULL
, HFILL
} },
738 { "IDMP fragment", "idmp.fragment", FT_FRAMENUM
, BASE_NONE
,
739 NULL
, 0x00, NULL
, HFILL
} },
740 { &hf_idmp_fragment_overlap
,
741 { "IDMP fragment overlap", "idmp.fragment.overlap", FT_BOOLEAN
,
742 BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
743 { &hf_idmp_fragment_overlap_conflicts
,
744 { "IDMP fragment overlapping with conflicting data",
745 "idmp.fragment.overlap.conflicts", FT_BOOLEAN
, BASE_NONE
,
746 NULL
, 0x00, NULL
, HFILL
} },
747 { &hf_idmp_fragment_multiple_tails
,
748 { "IDMP has multiple tail fragments",
749 "idmp.fragment.multiple_tails", FT_BOOLEAN
, BASE_NONE
,
750 NULL
, 0x00, NULL
, HFILL
} },
751 { &hf_idmp_fragment_too_long_fragment
,
752 { "IDMP fragment too long", "idmp.fragment.too_long_fragment",
753 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
754 { &hf_idmp_fragment_error
,
755 { "IDMP defragmentation error", "idmp.fragment.error", FT_FRAMENUM
,
756 BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
757 { &hf_idmp_fragment_count
,
758 { "IDMP fragment count", "idmp.fragment.count", FT_UINT32
, BASE_DEC
,
759 NULL
, 0x00, NULL
, HFILL
} },
760 { &hf_idmp_reassembled_in
,
761 { "Reassembled IDMP in frame", "idmp.reassembled.in", FT_FRAMENUM
, BASE_NONE
,
762 NULL
, 0x00, "This IDMP packet is reassembled in this frame", HFILL
} },
763 { &hf_idmp_reassembled_length
,
764 { "Reassembled IDMP length", "idmp.reassembled.length", FT_UINT32
, BASE_DEC
,
765 NULL
, 0x00, "The total length of the reassembled payload", HFILL
} },
766 { &hf_idmp_segment_data
,
767 { "IDMP segment data", "idmp.segment_data", FT_BYTES
, BASE_NONE
,
768 NULL
, 0x00, NULL
, HFILL
} },
771 { "bind", "idmp.bind_element",
772 FT_NONE
, BASE_NONE
, NULL
, 0,
774 { &hf_idmp_bindResult
,
775 { "bindResult", "idmp.bindResult_element",
776 FT_NONE
, BASE_NONE
, NULL
, 0,
777 "IdmBindResult", HFILL
}},
778 { &hf_idmp_bindError
,
779 { "bindError", "idmp.bindError_element",
780 FT_NONE
, BASE_NONE
, NULL
, 0,
781 "IdmBindError", HFILL
}},
783 { "request", "idmp.request_element",
784 FT_NONE
, BASE_NONE
, NULL
, 0,
786 { &hf_idmp_idm_result
,
787 { "result", "idmp.result_element",
788 FT_NONE
, BASE_NONE
, NULL
, 0,
789 "IdmResult", HFILL
}},
790 { &hf_idmp_idm_error
,
791 { "error", "idmp.error_element",
792 FT_NONE
, BASE_NONE
, NULL
, 0,
795 { "reject", "idmp.reject_element",
796 FT_NONE
, BASE_NONE
, NULL
, 0,
797 "IdmReject", HFILL
}},
799 { "unbind", "idmp.unbind_element",
800 FT_NONE
, BASE_NONE
, NULL
, 0,
803 { "abort", "idmp.abort",
804 FT_UINT32
, BASE_DEC
, VALS(idmp_Abort_vals
), 0,
807 { "startTLS", "idmp.startTLS_element",
808 FT_NONE
, BASE_NONE
, NULL
, 0,
810 { &hf_idmp_tLSResponse
,
811 { "tLSResponse", "idmp.tLSResponse",
812 FT_UINT32
, BASE_DEC
, VALS(idmp_TLSResponse_vals
), 0,
814 { &hf_idmp_protocolID
,
815 { "protocolID", "idmp.protocolID",
816 FT_OID
, BASE_NONE
, NULL
, 0,
817 "OBJECT_IDENTIFIER", HFILL
}},
818 { &hf_idmp_callingAETitle
,
819 { "callingAETitle", "idmp.callingAETitle",
820 FT_UINT32
, BASE_DEC
, VALS(x509ce_GeneralName_vals
), 0,
821 "GeneralName", HFILL
}},
822 { &hf_idmp_calledAETitle
,
823 { "calledAETitle", "idmp.calledAETitle",
824 FT_UINT32
, BASE_DEC
, VALS(x509ce_GeneralName_vals
), 0,
825 "GeneralName", HFILL
}},
826 { &hf_idmp_bind_argument
,
827 { "argument", "idmp.argument_element",
828 FT_NONE
, BASE_NONE
, NULL
, 0,
829 "Bind_argument", HFILL
}},
830 { &hf_idmp_respondingAETitle
,
831 { "respondingAETitle", "idmp.respondingAETitle",
832 FT_UINT32
, BASE_DEC
, VALS(x509ce_GeneralName_vals
), 0,
833 "GeneralName", HFILL
}},
834 { &hf_idmp_bind_result
,
835 { "result", "idmp.result_element",
836 FT_NONE
, BASE_NONE
, NULL
, 0,
837 "Bind_result", HFILL
}},
838 { &hf_idmp_bind_errcode
,
839 { "errcode", "idmp.errcode_element",
840 FT_NONE
, BASE_NONE
, NULL
, 0,
841 "Bind_errcode", HFILL
}},
842 { &hf_idmp_aETitleError
,
843 { "aETitleError", "idmp.aETitleError",
844 FT_UINT32
, BASE_DEC
, VALS(idmp_T_aETitleError_vals
), 0,
846 { &hf_idmp_bind_error
,
847 { "error", "idmp.error_element",
848 FT_NONE
, BASE_NONE
, NULL
, 0,
849 "Bind_error", HFILL
}},
851 { "invokeID", "idmp.invokeID",
852 FT_INT32
, BASE_DEC
, NULL
, 0,
855 { "opcode", "idmp.opcode",
856 FT_UINT32
, BASE_DEC
, VALS(idmp_Code_vals
), 0,
859 { "argument", "idmp.argument_element",
860 FT_NONE
, BASE_NONE
, NULL
, 0,
862 { &hf_idmp_idm_invokeID
,
863 { "invokeID", "idmp.idmResult.invokeID",
864 FT_UINT32
, BASE_DEC
, VALS(idmp_InvokeId_vals
), 0,
867 { "result", "idmp.result_element",
868 FT_NONE
, BASE_NONE
, NULL
, 0,
871 { "errcode", "idmp.errcode_element",
872 FT_NONE
, BASE_NONE
, NULL
, 0,
875 { "error", "idmp.error_element",
876 FT_NONE
, BASE_NONE
, NULL
, 0,
879 { "reason", "idmp.reason",
880 FT_UINT32
, BASE_DEC
, VALS(idmp_T_reason_vals
), 0,
883 { "local", "idmp.local",
884 FT_INT32
, BASE_DEC
, NULL
, 0,
887 { "global", "idmp.global",
888 FT_OID
, BASE_NONE
, NULL
, 0,
889 "OBJECT_IDENTIFIER", HFILL
}},
891 { "present", "idmp.present",
892 FT_INT32
, BASE_DEC
, NULL
, 0,
895 { "absent", "idmp.absent_element",
896 FT_NONE
, BASE_NONE
, NULL
, 0,
900 /* List of subtrees */
901 static int *ett
[] = {
907 &ett_idmp_IdmBindResult
,
908 &ett_idmp_IdmBindError
,
916 module_t
*idmp_module
;
918 /* Register protocol */
919 proto_idmp
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
921 /* Register fields and subtrees */
922 proto_register_field_array(proto_idmp
, hf
, array_length(hf
));
923 proto_register_subtree_array(ett
, array_length(ett
));
925 idmp_handle
= register_dissector("idmp", dissect_idmp_tcp
, proto_idmp
);
927 register_cleanup_routine (&idmp_reassemble_cleanup
);
928 reassembly_table_register (&idmp_reassembly_table
,
929 &addresses_reassembly_table_functions
);
932 /* Register our configuration options for IDMP, particularly our port */
934 idmp_module
= prefs_register_protocol_subtree("OSI/X.500", proto_idmp
, NULL
);
936 prefs_register_bool_preference(idmp_module
, "desegment_idmp_messages",
937 "Reassemble IDMP messages spanning multiple TCP segments",
938 "Whether the IDMP dissector should reassemble messages spanning multiple TCP segments."
939 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
942 prefs_register_bool_preference(idmp_module
, "reassemble",
943 "Reassemble segmented IDMP datagrams",
944 "Whether segmented IDMP datagrams should be reassembled."
945 " To use this option, you must also enable"
946 " \"Allow subdissectors to reassemble TCP streams\""
947 " in the TCP protocol settings.", &idmp_reassemble
);
951 /*--- proto_reg_handoff_idm --- */
952 void proto_reg_handoff_idm(void) {
953 dissector_add_uint_with_preference("tcp.port", IDMP_TCP_PORT
, idmp_handle
);