#include <string.h> and/or #include <stdio.h> not needed.
[obnox/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  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
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.
16  *
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.
21  *
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26  
27  
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <epan/packet.h>
33 #include <epan/ipproto.h>
34
35 static gint ett_ncs = -1;
36
37 static int proto_ncs = -1;
38
39 static int hf_panning_id = -1;
40 static int hf_incarnation = -1;
41
42 static void
43 dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
44 {
45     proto_tree      *ncs_tree = NULL;
46     proto_item      *ti;
47     
48     if (tree) {
49         ti = proto_tree_add_item(tree, proto_ncs, tvb, 0, -1, FALSE);
50         ncs_tree = proto_item_add_subtree(ti, ett_ncs);
51     }
52
53
54     col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCS");
55     col_set_str(pinfo->cinfo, COL_INFO, "Novell Cluster Services Heartbeat");
56
57     proto_tree_add_item(ncs_tree, hf_panning_id, tvb, 4, 4, FALSE);
58     proto_tree_add_item(ncs_tree, hf_incarnation, tvb, 8, 4, FALSE);
59 }
60
61 void
62 proto_register_ncs(void)
63 {
64   static hf_register_info hf[] = {
65
66     { &hf_panning_id,
67       { "Panning ID",           "ncs.pan_id",           FT_UINT32, BASE_HEX,    NULL, 0x0,
68         NULL, HFILL }},
69
70     { &hf_incarnation,
71       { "Incarnation",          "ncs.incarnation",              FT_UINT32, BASE_HEX,    NULL, 0x0,
72         NULL, HFILL }},
73
74   };
75   static gint *ett[] = {
76     &ett_ncs,
77   };
78
79   proto_ncs = proto_register_protocol("Novell Cluster Services",
80                                        "NCS", "ncs");
81   proto_register_field_array(proto_ncs, hf, array_length(hf));
82   proto_register_subtree_array(ett, array_length(ett));
83 }
84
85
86
87 void
88 proto_reg_handoff_ncs(void)
89 {
90   dissector_handle_t ncs_handle;
91
92   ncs_handle = create_dissector_handle(dissect_ncs, proto_ncs);
93   dissector_add("ip.proto", IP_PROTO_NCS_HEARTBEAT, ncs_handle);
94 }