Added mount dissector.
[obnox/wireshark/wip.git] / packet-mount.c
1 /* packet-mount.c
2  * Routines for mount dissection
3  *
4  * $Id: packet-mount.c,v 1.1 1999/11/11 21:21:59 nneul Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@unicom.net>
8  * Copyright 1998 Gerald Combs
9  *
10  * Copied from packet-smb.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 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31
32 #ifdef HAVE_SYS_TYPES_H
33 #include <sys/types.h>
34 #endif
35
36
37 #include "packet-rpc.h"
38 #include "packet-mount.h"
39
40 static int proto_mount = -1;
41 static int hf_mount_path = -1;
42
43 /* Dissect a unmount call */
44 int dissect_unmount_call(const u_char *pd, int offset, frame_data *fd,
45         proto_tree *tree)
46 {
47         if ( tree )
48         {
49                 offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_mount_path);
50         }
51         
52         return offset;
53 }
54
55 /* proc number, "proc name", dissect_request, dissect_reply */
56 /* NULL as function pointer means: take the generic one. */
57
58 const vsff mount_proc[] = {
59     { 0, "NULL", NULL, NULL },
60     { MOUNTPROC_MOUNT,   "MOUNT",      
61                 NULL, NULL },
62     { MOUNTPROC_UNMOUNT, "UNMOUNT",        
63                 dissect_unmount_call, NULL },
64     { 0, NULL, NULL, NULL }
65 };
66 /* end of mount version 1 */
67
68
69 void
70 proto_register_mount(void)
71 {
72         static hf_register_info hf[] = {
73                 { &hf_mount_path, {
74                         "Path", "mount.path", FT_STRING, BASE_DEC,
75                         NULL, 0, "Path" }},
76         };
77
78         proto_mount = proto_register_protocol("Mount Service", "mount");
79         proto_register_field_array(proto_mount, hf, array_length(hf));
80
81         /* Register the protocol as RPC */
82         rpc_init_prog(proto_mount, MOUNT_PROGRAM, ETT_MOUNT);
83         /* Register the procedure tables */
84         rpc_init_proc_table(MOUNT_PROGRAM, 1, mount_proc);
85 }
86