Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
[metze/wireshark/wip.git] / epan / dissectors / packet-ncs.c
1 /* packet-ncs.c
2  * Routines for Novell Cluster Services
3  * Greg Morris <gmorris@novell.com>
4  * Copyright (c) Novell, Inc. 2002-2005
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24
25
26 #include "config.h"
27
28 #include <epan/packet.h>
29 #include <epan/ipproto.h>
30
31 void proto_register_ncs(void);
32 void proto_reg_handoff_ncs(void);
33
34 static gint ett_ncs = -1;
35
36 static int proto_ncs = -1;
37
38 static int hf_panning_id = -1;
39 static int hf_incarnation = -1;
40
41 static void
42 dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
43 {
44     proto_tree      *ncs_tree = NULL;
45     proto_item      *ti;
46
47     if (tree) {
48         ti = proto_tree_add_item(tree, proto_ncs, tvb, 0, -1, ENC_NA);
49         ncs_tree = proto_item_add_subtree(ti, ett_ncs);
50     }
51
52
53     col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCS");
54     col_set_str(pinfo->cinfo, COL_INFO, "Novell Cluster Services Heartbeat");
55
56     proto_tree_add_item(ncs_tree, hf_panning_id, tvb, 4, 4, ENC_BIG_ENDIAN);
57     proto_tree_add_item(ncs_tree, hf_incarnation, tvb, 8, 4, ENC_BIG_ENDIAN);
58 }
59
60 void
61 proto_register_ncs(void)
62 {
63   static hf_register_info hf[] = {
64
65     { &hf_panning_id,
66       { "Panning ID",           "ncs.pan_id",           FT_UINT32, BASE_HEX,    NULL, 0x0,
67         NULL, HFILL }},
68
69     { &hf_incarnation,
70       { "Incarnation",          "ncs.incarnation",              FT_UINT32, BASE_HEX,    NULL, 0x0,
71         NULL, HFILL }},
72
73   };
74   static gint *ett[] = {
75     &ett_ncs,
76   };
77
78   proto_ncs = proto_register_protocol("Novell Cluster Services",
79                                        "NCS", "ncs");
80   proto_register_field_array(proto_ncs, hf, array_length(hf));
81   proto_register_subtree_array(ett, array_length(ett));
82 }
83
84
85
86 void
87 proto_reg_handoff_ncs(void)
88 {
89   dissector_handle_t ncs_handle;
90
91   ncs_handle = create_dissector_handle(dissect_ncs, proto_ncs);
92   dissector_add_uint("ip.proto", IP_PROTO_NCS_HEARTBEAT, ncs_handle);
93 }