2 * Routines for X.511 (X.500 Directory Asbtract Service) and X.519 DAP 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/prefs.h>
33 #include <epan/conversation.h>
34 #include <epan/oids.h>
35 #include <epan/asn1.h>
40 #include "packet-ber.h"
41 #include "packet-acse.h"
42 #include "packet-ros.h"
44 #include "packet-x509if.h"
45 #include "packet-x509af.h"
46 #include "packet-x509sat.h"
47 #include "packet-crmf.h"
49 #include "packet-dsp.h"
50 #include "packet-disp.h"
51 #include "packet-dap.h"
52 #include <epan/strutil.h>
54 /* we don't have a separate dissector for X519 -
55 most of DAP is defined in X511 */
56 #define PNAME "X.519 Directory Access Protocol"
60 static guint global_dap_tcp_port = 102;
61 static dissector_handle_t tpkt_handle;
62 void prefs_register_dap(void); /* forward declaration for use in preferences registration */
65 /* Initialize the protocol and registered fields */
69 #include "packet-dap-hf.c"
71 /* Initialize the subtree pointers */
72 static gint ett_dap = -1;
73 #include "packet-dap-ett.c"
75 #include "packet-dap-val.h"
77 #include "packet-dap-table.c" /* operation and error codes */
79 #include "packet-dap-fn.c"
81 #include "packet-dap-table11.c" /* operation argument/result dissectors */
82 #include "packet-dap-table21.c" /* error dissector */
84 static const ros_info_t dap_ros_info = {
88 dap_opr_code_string_vals,
90 dap_err_code_string_vals,
95 /*--- proto_register_dap -------------------------------------------*/
96 void proto_register_dap(void) {
99 static hf_register_info hf[] =
101 #include "packet-dap-hfarr.c"
104 /* List of subtrees */
105 static gint *ett[] = {
107 #include "packet-dap-ettarr.c"
109 module_t *dap_module;
111 /* Register protocol */
112 proto_dap = proto_register_protocol(PNAME, PSNAME, PFNAME);
114 /* Register fields and subtrees */
115 proto_register_field_array(proto_dap, hf, array_length(hf));
116 proto_register_subtree_array(ett, array_length(ett));
118 /* Register our configuration options for DAP, particularly our port */
120 dap_module = prefs_register_protocol_subtree("OSI/X.500", proto_dap, prefs_register_dap);
122 prefs_register_uint_preference(dap_module, "tcp.port", "DAP TCP Port",
123 "Set the port for DAP operations (if other"
124 " than the default of 102)",
125 10, &global_dap_tcp_port);
130 /*--- proto_reg_handoff_dap --- */
131 void proto_reg_handoff_dap(void) {
133 /* #include "packet-dap-dis-tab.c" */
135 /* APPLICATION CONTEXT */
137 oid_add_from_string("id-ac-directory-access","2.5.3.1");
139 /* ABSTRACT SYNTAXES */
141 /* Register DAP with ROS (with no use of RTSE) */
142 register_ros_protocol_info("2.5.9.1", &dap_ros_info, 0, "id-as-directory-access", FALSE);
144 /* remember the tpkt handler for change in preferences */
145 tpkt_handle = find_dissector("tpkt");
147 /* AttributeValueAssertions */
148 x509if_register_fmt(hf_dap_equality, "=");
149 x509if_register_fmt(hf_dap_greaterOrEqual, ">=");
150 x509if_register_fmt(hf_dap_lessOrEqual, "<=");
151 x509if_register_fmt(hf_dap_approximateMatch, "=~");
153 x509if_register_fmt(hf_dap_present, "= *");
158 void prefs_register_dap(void) {
159 static guint tcp_port = 0;
161 /* de-register the old port */
162 /* port 102 is registered by TPKT - don't undo this! */
163 if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
164 dissector_delete("tcp.port", tcp_port, tpkt_handle);
166 /* Set our port number for future use */
167 tcp_port = global_dap_tcp_port;
169 if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
170 dissector_add("tcp.port", global_dap_tcp_port, tpkt_handle);