2 * Routines for X.413 (P7) 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/oids.h>
34 #include <epan/asn1.h>
39 #include "packet-ber.h"
40 #include "packet-acse.h"
41 #include "packet-ros.h"
42 #include "packet-rtse.h"
44 #include "packet-x411.h"
45 #include <epan/strutil.h>
47 #define PNAME "X.413 Message Store Service"
51 static guint global_p7_tcp_port = 102;
52 static dissector_handle_t tpkt_handle;
53 static const char *object_identifier_id = NULL; /* attribute identifier */
56 void prefs_register_p7(void); /* forward declaration for use in preferences registration */
59 /* Initialize the protocol and registered fields */
62 #include "packet-p7-hf.c"
64 /* Initialize the subtree pointers */
65 static gint ett_p7 = -1;
66 #include "packet-p7-ett.c"
68 #include "packet-p7-val.h"
70 #include "packet-p7-table.c" /* operation and error codes */
72 #include "packet-p7-fn.c"
74 #include "packet-p7-table11.c" /* operation argument/result dissectors */
75 #include "packet-p7-table21.c" /* error dissector */
77 static const ros_info_t p7_ros_info = {
81 p7_opr_code_string_vals,
83 p7_err_code_string_vals,
88 /*--- proto_register_p7 -------------------------------------------*/
89 void proto_register_p7(void) {
92 static hf_register_info hf[] =
94 #include "packet-p7-hfarr.c"
97 /* List of subtrees */
98 static gint *ett[] = {
100 #include "packet-p7-ettarr.c"
104 /* Register protocol */
105 proto_p7 = proto_register_protocol(PNAME, PSNAME, PFNAME);
107 /* Register fields and subtrees */
108 proto_register_field_array(proto_p7, hf, array_length(hf));
109 proto_register_subtree_array(ett, array_length(ett));
111 /* Register our configuration options for P7, particularly our port */
113 p7_module = prefs_register_protocol_subtree("OSI/X.400", proto_p7, prefs_register_p7);
115 prefs_register_uint_preference(p7_module, "tcp.port", "P7 TCP Port",
116 "Set the port for P7 operations (if other"
117 " than the default of 102)",
118 10, &global_p7_tcp_port);
123 /*--- proto_reg_handoff_p7 --- */
124 void proto_reg_handoff_p7(void) {
126 #include "packet-p7-dis-tab.c"
128 /* APPLICATION CONTEXT */
130 oid_add_from_string("id-ac-ms-access","2.6.0.1.11");
131 oid_add_from_string("id-ac-ms-reliable-access","2.6.0.1.12");
133 /* ABSTRACT SYNTAXES */
135 /* Register P7 with ROS (with no use of RTSE) */
136 register_ros_protocol_info("2.6.0.2.9", &p7_ros_info, 0, "id-as-ms", FALSE);
137 register_ros_protocol_info("2.6.0.2.5", &p7_ros_info, 0, "id-as-mrse", FALSE);
138 register_ros_protocol_info("2.6.0.2.1", &p7_ros_info, 0, "id-as-msse", FALSE);
140 /* remember the tpkt handler for change in preferences */
141 tpkt_handle = find_dissector("tpkt");
145 void prefs_register_p7(void) {
146 static guint tcp_port = 0;
148 /* de-register the old port */
149 /* port 102 is registered by TPKT - don't undo this! */
150 if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
151 dissector_delete("tcp.port", tcp_port, tpkt_handle);
153 /* Set our port number for future use */
154 tcp_port = global_p7_tcp_port;
156 if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
157 dissector_add("tcp.port", global_p7_tcp_port, tpkt_handle);