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>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include <epan/packet.h>
34 #include <epan/to_str.h>
35 #include <epan/etypes.h>
36 #include <epan/conversation.h>
37 #include "packet-scsi.h"
38 #include "packet-fc.h"
39 #include "packet-ipfc.h"
40 #include "packet-llc.h"
42 /* Initialize the protocol and registered fields */
43 static int proto_ipfc
= -1;
44 static int hf_ipfc_network_da
= -1;
45 static int hf_ipfc_network_sa
= -1;
47 /* Initialize the subtree pointers */
48 static gint ett_ipfc
= -1;
49 static dissector_handle_t llc_handle
;
52 capture_ipfc (const guchar
*pd
, int len
, packet_counts
*ld
)
54 if (!BYTES_ARE_IN_FRAME(0, len
, 16)) {
59 capture_llc(pd
, 16, len
, ld
);
63 dissect_ipfc (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
66 /* Set up structures needed to add the protocol subtree and manage it */
68 proto_tree
*ipfc_tree
;
72 /* Make entries in Protocol column and Info column on summary display */
73 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "IP/FC");
76 ti
= proto_tree_add_protocol_format (tree
, proto_ipfc
, tvb
, offset
, 16,
77 "IP Over FC Network_Header");
78 ipfc_tree
= proto_item_add_subtree (ti
, ett_ipfc
);
80 proto_tree_add_string (ipfc_tree
, hf_ipfc_network_da
, tvb
, offset
, 8,
81 tvb_fcwwn_to_str (tvb
, offset
));
82 proto_tree_add_string (ipfc_tree
, hf_ipfc_network_sa
, tvb
, offset
+8, 8,
83 tvb_fcwwn_to_str (tvb
, offset
+8));
86 next_tvb
= tvb_new_subset_remaining (tvb
, 16);
87 call_dissector(llc_handle
, next_tvb
, pinfo
, tree
);
90 /* Register the protocol with Wireshark */
92 /* this format is require because a script is used to build the C function
93 that calls all the protocol registration.
97 proto_register_ipfc (void)
100 /* Setup list of header fields See Section 1.6.1 for details*/
101 static hf_register_info hf
[] = {
102 { &hf_ipfc_network_da
,
103 {"Network DA", "ipfc.nh.da", FT_STRING
, BASE_NONE
, NULL
,
105 { &hf_ipfc_network_sa
,
106 {"Network SA", "ipfc.nh.sa", FT_STRING
, BASE_NONE
, NULL
,
110 /* Setup protocol subtree array */
111 static gint
*ett
[] = {
115 /* Register the protocol name and description */
116 proto_ipfc
= proto_register_protocol("IP Over FC", "IPFC", "ipfc");
118 /* Required function calls to register the header fields and subtrees used */
119 proto_register_field_array(proto_ipfc
, hf
, array_length(hf
));
120 proto_register_subtree_array(ett
, array_length(ett
));
123 /* If this dissector uses sub-dissector registration add a registration routine.
124 This format is required because a script is used to find these routines and
125 create the code that calls these routines.
128 proto_reg_handoff_ipfc (void)
130 dissector_handle_t ipfc_handle
;
132 ipfc_handle
= create_dissector_handle (dissect_ipfc
, proto_ipfc
);
133 dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC
, ipfc_handle
);
135 llc_handle
= find_dissector ("llc");