Use the new split between protocol registration and protocol handoff
[obnox/wireshark/wip.git] / packet-nlm.c
1 /* packet-nlm.c
2  * Routines for nlm dissection
3  *
4  * $Id: packet-nlm.c,v 1.5 2000/04/04 06:46:26 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * Copied from packet-mount.c
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
33 #ifdef HAVE_SYS_TYPES_H
34 #include <sys/types.h>
35 #endif
36
37
38 #include "packet-rpc.h"
39 #include "packet-nlm.h"
40
41
42 static int proto_nlm = -1;
43
44 static gint ett_nlm = -1;
45
46 /* proc number, "proc name", dissect_request, dissect_reply */
47 /* NULL as function pointer means: take the generic one. */
48 /* NLM protocol version 3 */
49 const vsff nlm3_proc[] = {
50         { 0,    "NULL",         NULL,   NULL },
51         { 1,    "TEST",         NULL,   NULL },
52         { 2,    "LOCK",         NULL,   NULL },
53         { 3,    "CANCEL",       NULL,   NULL },
54         { 4,    "UNLOCK",       NULL,   NULL },
55         { 5,    "GRANTED",      NULL,   NULL },
56         { 6,    "TEST_MSG",     NULL,   NULL },
57         { 7,    "LOCK_MSG",     NULL,   NULL },
58         { 8,    "CANCEL_MSG",   NULL,   NULL },
59         { 9,    "UNLOCK_MSG",   NULL,   NULL },
60         { 10,   "GRANTED_MSG",  NULL,   NULL },
61         { 11,   "TEST_RES",     NULL,   NULL },
62         { 12,   "LOCK_RES",     NULL,   NULL },
63         { 13,   "CANCEL_RES",   NULL,   NULL },
64         { 14,   "UNLOCK_RES",   NULL,   NULL },
65         { 15,   "GRANTED_RES",  NULL,   NULL },
66         { 20,   "SHARE",        NULL,   NULL },
67         { 21,   "UNSHARE",      NULL,   NULL },
68         { 22,   "NM_LOCK",      NULL,   NULL },
69         { 23,   "FREE_ALL",     NULL,   NULL },
70         { 0,    NULL,           NULL,   NULL }
71 };
72 /* end of NLM protocol version 3 */
73
74
75 void
76 proto_register_nlm(void)
77 {
78         static gint *ett[] = {
79                 &ett_nlm,
80         };
81
82         proto_nlm = proto_register_protocol("Network Lock Manager Protocol", "nlm");
83         proto_register_subtree_array(ett, array_length(ett));
84 }
85
86 void
87 proto_reg_handoff_nlm(void)
88 {
89         /* Register the protocol as RPC */
90         rpc_init_prog(proto_nlm, NLM_PROGRAM, ett_nlm);
91         /* Register the procedure table */
92         rpc_init_proc_table(NLM_PROGRAM, 3, nlm3_proc);
93 }