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 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <epan/packet.h>
18 #include <epan/capture_dissectors.h>
19 #include <epan/to_str.h>
21 #include "packet-llc.h"
23 void proto_register_ipfc(void);
24 void proto_reg_handoff_ipfc(void);
26 static dissector_handle_t ipfc_handle
;
27 static capture_dissector_handle_t ipfc_cap_handle
;
29 /* Initialize the protocol and registered fields */
30 static int proto_ipfc
;
31 static int hf_ipfc_network_da
;
32 static int hf_ipfc_network_sa
;
34 /* Initialize the subtree pointers */
36 static dissector_handle_t llc_handle
;
37 static capture_dissector_handle_t llc_cap_handle
;
40 capture_ipfc (const unsigned char *pd
, int offset _U_
, int len
, capture_packet_info_t
*cpinfo
, const union wtap_pseudo_header
*pseudo_header _U_
)
42 if (!BYTES_ARE_IN_FRAME(0, len
, 16))
45 return call_capture_dissector(llc_cap_handle
, pd
, 16, len
, cpinfo
, pseudo_header
);
49 dissect_ipfc (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
52 /* Set up structures needed to add the protocol subtree and manage it */
54 proto_tree
*ipfc_tree
;
58 /* Make entries in Protocol column and Info column on summary display */
59 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "IP/FC");
62 ti
= proto_tree_add_protocol_format (tree
, proto_ipfc
, tvb
, offset
, 16,
63 "IP Over FC Network_Header");
64 ipfc_tree
= proto_item_add_subtree (ti
, ett_ipfc
);
66 proto_tree_add_item (ipfc_tree
, hf_ipfc_network_da
, tvb
, offset
, 8, ENC_NA
);
67 proto_tree_add_item (ipfc_tree
, hf_ipfc_network_sa
, tvb
, offset
+8, 8, ENC_NA
);
70 next_tvb
= tvb_new_subset_remaining (tvb
, 16);
71 call_dissector(llc_handle
, next_tvb
, pinfo
, tree
);
72 return tvb_captured_length(tvb
);
75 /* Register the protocol with Wireshark */
77 /* this format is require because a script is used to build the C function
78 that calls all the protocol registration.
82 proto_register_ipfc (void)
85 /* Setup list of header fields See Section 1.6.1 for details*/
86 static hf_register_info hf
[] = {
87 { &hf_ipfc_network_da
,
88 {"Network DA", "ipfc.nh.da", FT_FCWWN
, BASE_NONE
, NULL
,
90 { &hf_ipfc_network_sa
,
91 {"Network SA", "ipfc.nh.sa", FT_FCWWN
, BASE_NONE
, NULL
,
95 /* Setup protocol subtree array */
100 /* Register the protocol name and description */
101 proto_ipfc
= proto_register_protocol("IP Over FC", "IPFC", "ipfc");
103 /* Required function calls to register the header fields and subtrees used */
104 proto_register_field_array(proto_ipfc
, hf
, array_length(hf
));
105 proto_register_subtree_array(ett
, array_length(ett
));
107 ipfc_handle
= register_dissector("ipfc", dissect_ipfc
, proto_ipfc
);
108 ipfc_cap_handle
= register_capture_dissector("ipfc", capture_ipfc
, proto_ipfc
);
111 /* If this dissector uses sub-dissector registration add a registration routine.
112 This format is required because a script is used to find these routines and
113 create the code that calls these routines.
116 proto_reg_handoff_ipfc (void)
118 dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC
, ipfc_handle
);
120 llc_handle
= find_dissector_add_dependency("llc", proto_ipfc
);
121 llc_cap_handle
= find_capture_dissector("llc");
123 capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC
, ipfc_cap_handle
);
127 * Editor modelines - https://www.wireshark.org/tools/modelines.html
132 * indent-tabs-mode: nil
135 * vi: set shiftwidth=4 tabstop=8 expandtab:
136 * :indentSize=4:tabSize=8:noTabs=true: