2 * Routine to dissect OSI ISO 8571 FTAM Protocol packets
3 * based on the ASN.1 specification from http://www.itu.int/ITU-T/asn1/database/iso/8571-4/1988/
5 * also based on original handwritten dissector by
6 * Yuriy Sidelnikov <YSidelnikov@hotmail.com>
8 * Anders Broman and Ronnie Sahlberg 2005 - 2006
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include <epan/packet.h>
37 #include <epan/conversation.h>
38 #include <epan/oid_resolv.h>
39 #include <epan/asn1.h>
44 #include "packet-ber.h"
45 #include "packet-acse.h"
46 #include "packet-ftam.h"
48 #define PNAME "ISO 8571 FTAM"
52 /* Initialize the protocol and registered fields */
55 static const char *object_identifier_id;
56 /* Declare the function to avoid a compiler warning */
57 static int dissect_ftam_OR_Set(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
59 #include "packet-ftam-hf.c"
61 /* Initialize the subtree pointers */
62 static gint ett_ftam = -1;
63 #include "packet-ftam-ett.c"
65 #include "packet-ftam-fn.c"
68 * Dissect FTAM PDUs inside a PPDU.
71 dissect_ftam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
75 proto_item *item=NULL;
76 proto_tree *tree=NULL;
79 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
82 item = proto_tree_add_item(parent_tree, proto_ftam, tvb, 0, -1, FALSE);
83 tree = proto_item_add_subtree(item, ett_ftam);
85 if (check_col(pinfo->cinfo, COL_PROTOCOL))
86 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FTAM");
87 if (check_col(pinfo->cinfo, COL_INFO))
88 col_clear(pinfo->cinfo, COL_INFO);
90 while (tvb_reported_length_remaining(tvb, offset) > 0){
92 offset=dissect_ftam_PDU(FALSE, tvb, offset, &asn1_ctx, tree, -1);
93 if(offset == old_offset){
94 proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte FTAM PDU");
95 offset = tvb_length(tvb);
102 /*--- proto_register_ftam -------------------------------------------*/
103 void proto_register_ftam(void) {
106 static hf_register_info hf[] =
108 #include "packet-ftam-hfarr.c"
111 /* List of subtrees */
112 static gint *ett[] = {
114 #include "packet-ftam-ettarr.c"
117 /* Register protocol */
118 proto_ftam = proto_register_protocol(PNAME, PSNAME, PFNAME);
119 register_dissector("ftam", dissect_ftam, proto_ftam);
120 /* Register fields and subtrees */
121 proto_register_field_array(proto_ftam, hf, array_length(hf));
122 proto_register_subtree_array(ett, array_length(ett));
127 /*--- proto_reg_handoff_ftam --- */
128 void proto_reg_handoff_ftam(void) {
129 register_ber_oid_dissector("1.0.8571.1.1", dissect_ftam, proto_ftam,"iso-ftam(1)");
130 register_ber_oid_dissector("1.0.8571.2.1", dissect_ftam, proto_ftam,"ftam-pci(1)");
131 register_ber_oid_dissector("1.3.14.5.2.2", dissect_ftam, proto_ftam,"NIST file directory entry abstract syntax");
133 /* Unstructured text file document type FTAM-1 */
134 add_oid_str_name("1.0.8571.5.1","ISO FTAM unstructured text");
135 add_oid_str_name("1.0.8571.5.2","ISO FTAM sequential text");
136 add_oid_str_name("1.0.8571.2.3","FTAM unstructured text abstract syntax");
137 add_oid_str_name("1.0.8571.2.4","FTAM sequential text abstract syntax");
138 add_oid_str_name("1.0.8571.2.5","FTAM simple-hierarchy");
139 add_oid_str_name("1.0.8571.3.1","FTAM hierarchical file model");
140 add_oid_str_name("1.0.8571.4.1","FTAM unstructured constraint set");
142 /* Unstructured text file document type FTAM-3 */
143 add_oid_str_name("1.0.8571.5.3","ISO FTAM unstructured binary");
144 add_oid_str_name("1.0.8571.2.4","FTAM unstructured binary abstract syntax");
146 /* Filedirectory file document type NBS-9 */
147 add_oid_str_name("1.3.14.5.5.9","NBS-9 FTAM file directory file");
149 /* Filedirectory file document type NBS-9 (WITH OLD NIST OIDs)*/
150 add_oid_str_name("1.3.9999.1.5.9","NBS-9-OLD FTAM file directory file");
151 add_oid_str_name("1.3.9999.1.2.2","NIST file directory entry abstract syntax");