Free the string you "g_strdup()"ed, rather than handing "g_free()" the
[obnox/wireshark/wip.git] / packet-rwall.c
1 /* packet-rwall.c
2  *
3  * Ethereal - Network traffic analyzer
4  * By Gerald Combs <gerald@ethereal.com>
5  * Copyright 1998 Gerald Combs
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  */
21
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25
26
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
29 #endif
30
31
32 #include "packet-rpc.h"
33 #include "packet-rwall.h"
34
35 static int proto_rwall = -1;
36 static int hf_rwall_message = -1;
37
38 static gint ett_rwall = -1;
39
40 static int
41 dissect_rwall_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
42 {
43         offset = dissect_rpc_string(tvb, pinfo, tree, hf_rwall_message, offset, NULL);
44         
45         return offset;
46 }
47
48 static const vsff rwall_proc[] = {
49         { RWALL_WALL,   "RWALL",
50                 dissect_rwall_call,     NULL },
51         { 0,    NULL,   NULL,   NULL }
52 };
53
54
55 void
56 proto_register_rwall(void)
57 {
58         static hf_register_info hf[] = {
59                 { &hf_rwall_message, {
60                         "Message", "rwall.message", FT_STRING, BASE_DEC,
61                         NULL, 0, "Message" }},
62         };
63
64         static gint *ett[] = {
65                 &ett_rwall,
66         };
67
68         proto_rwall = proto_register_protocol("Remote Wall protocol",
69             "RWALL", "rwall");
70         proto_register_field_array(proto_rwall, hf, array_length(hf));
71         proto_register_subtree_array(ett, array_length(ett));
72 }
73
74 void
75 proto_reg_handoff_rwall(void)
76 {
77         /* Register the protocol as RPC */
78         rpc_init_prog(proto_rwall, RWALL_PROGRAM, ett_rwall);
79         /* Register the procedure tables */
80         rpc_init_proc_table(RWALL_PROGRAM, 1, rwall_proc);
81 }
82
83