2 * Routines for Decoding Network_Header for IP-over-FC when we only
3 * capture the frame starting at the Network_Header (as opposed to
4 * when we have the full FC frame).
6 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include <epan/packet.h>
30 #include <wiretap/wtap.h>
31 #include <epan/to_str.h>
33 #include "packet-ipfc.h"
34 #include "packet-llc.h"
36 void proto_register_ipfc(void);
37 void proto_reg_handoff_ipfc(void);
39 /* Initialize the protocol and registered fields */
40 static int proto_ipfc = -1;
41 static int hf_ipfc_network_da = -1;
42 static int hf_ipfc_network_sa = -1;
44 /* Initialize the subtree pointers */
45 static gint ett_ipfc = -1;
46 static dissector_handle_t llc_handle;
49 capture_ipfc (const guchar *pd, int len, packet_counts *ld)
51 if (!BYTES_ARE_IN_FRAME(0, len, 16)) {
56 capture_llc(pd, 16, len, ld);
60 dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
63 /* Set up structures needed to add the protocol subtree and manage it */
65 proto_tree *ipfc_tree;
69 /* Make entries in Protocol column and Info column on summary display */
70 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/FC");
73 ti = proto_tree_add_protocol_format (tree, proto_ipfc, tvb, offset, 16,
74 "IP Over FC Network_Header");
75 ipfc_tree = proto_item_add_subtree (ti, ett_ipfc);
77 proto_tree_add_item (ipfc_tree, hf_ipfc_network_da, tvb, offset, 8, ENC_NA);
78 proto_tree_add_item (ipfc_tree, hf_ipfc_network_sa, tvb, offset+8, 8, ENC_NA);
81 next_tvb = tvb_new_subset_remaining (tvb, 16);
82 call_dissector(llc_handle, next_tvb, pinfo, tree);
83 return tvb_captured_length(tvb);
86 /* Register the protocol with Wireshark */
88 /* this format is require because a script is used to build the C function
89 that calls all the protocol registration.
93 proto_register_ipfc (void)
96 /* Setup list of header fields See Section 1.6.1 for details*/
97 static hf_register_info hf[] = {
98 { &hf_ipfc_network_da,
99 {"Network DA", "ipfc.nh.da", FT_FCWWN, BASE_NONE, NULL,
101 { &hf_ipfc_network_sa,
102 {"Network SA", "ipfc.nh.sa", FT_FCWWN, BASE_NONE, NULL,
106 /* Setup protocol subtree array */
107 static gint *ett[] = {
111 /* Register the protocol name and description */
112 proto_ipfc = proto_register_protocol("IP Over FC", "IPFC", "ipfc");
114 /* Required function calls to register the header fields and subtrees used */
115 proto_register_field_array(proto_ipfc, hf, array_length(hf));
116 proto_register_subtree_array(ett, array_length(ett));
119 /* If this dissector uses sub-dissector registration add a registration routine.
120 This format is required because a script is used to find these routines and
121 create the code that calls these routines.
124 proto_reg_handoff_ipfc (void)
126 dissector_handle_t ipfc_handle;
128 ipfc_handle = new_create_dissector_handle (dissect_ipfc, proto_ipfc);
129 dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC, ipfc_handle);
131 llc_handle = find_dissector ("llc");
135 * Editor modelines - http://www.wireshark.org/tools/modelines.html
140 * indent-tabs-mode: nil
143 * vi: set shiftwidth=4 tabstop=8 expandtab:
144 * :indentSize=4:tabSize=8:noTabs=true: