2 * Routines for decoding IP over InfiniBand (IPoIB) packet disassembly
3 * See: http://tools.ietf.org/html/rfc4391#section-6
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <epan/packet.h>
27 #include <epan/etypes.h>
28 #include <wiretap/wtap.h>
30 void proto_register_ipoib(void);
31 void proto_reg_handoff_ipoib(void);
33 static int proto_ipoib = -1;
34 static int hf_type = -1;
35 static int hf_reserved = -1;
37 static gint ett_raw = -1;
39 static dissector_handle_t arp_handle;
40 static dissector_handle_t ip_handle;
41 static dissector_handle_t ipv6_handle;
44 dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
51 /* load the top pane info. This should be overwritten by
52 the next protocol in the stack */
53 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPoIB");
54 col_set_str(pinfo->cinfo, COL_INFO, "IP over Infiniband");
56 /* populate a tree in the second pane with the IPoIB header data */
58 ti = proto_tree_add_item (tree, proto_ipoib, tvb, 0, 4, ENC_NA);
59 fh_tree = proto_item_add_subtree(ti, ett_raw);
61 proto_tree_add_item(fh_tree, hf_type, tvb, 0, 2, ENC_BIG_ENDIAN);
62 proto_tree_add_item(fh_tree, hf_reserved, tvb, 2, 2, ENC_BIG_ENDIAN);
65 next_tvb = tvb_new_subset_remaining(tvb, 4);
67 type = tvb_get_ntohs(tvb, 0);
70 call_dissector(ip_handle, next_tvb, pinfo, tree);
73 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
76 case ETHERTYPE_REVARP:
77 call_dissector(arp_handle, next_tvb, pinfo, tree);
82 return tvb_captured_length(tvb);
86 proto_register_ipoib(void)
88 static hf_register_info hf[] = {
90 { "Type", "ipoib.type",
91 FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
94 { "Reserved", "ipoib.reserved",
95 FT_UINT16, BASE_HEX, NULL, 0x0,
99 static gint *ett[] = {
103 proto_ipoib = proto_register_protocol("IP over Infiniband", "IPoIB", "ipoib");
104 proto_register_field_array(proto_ipoib, hf, array_length(hf));
105 proto_register_subtree_array(ett, array_length(ett));
109 proto_reg_handoff_ipoib(void)
111 dissector_handle_t ipoib_handle;
114 * Get handles for the ARP, IP and IPv6 dissectors.
116 arp_handle = find_dissector("arp");
117 ip_handle = find_dissector("ip");
118 ipv6_handle = find_dissector("ipv6");
120 ipoib_handle = new_create_dissector_handle(dissect_ipoib, proto_ipoib);
121 dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_IB, ipoib_handle);
125 * Editor modelines - http://www.wireshark.org/tools/modelines.html
130 * indent-tabs-mode: nil
133 * ex: set shiftwidth=2 tabstop=8 expandtab:
134 * :indentSize=2:tabSize=8:noTabs=true: