Check whether the array of procedure hf values has an element for the
[obnox/wireshark/wip.git] / packet-dcerpc-ubikdisk.c
1 /* packet-dcerpc-ubikdisk.c\r
2  *\r
3  * Routines for dcerpc UBIK Disk routines\r
4  * Copyright 2002, Jaime Fournier <jafour1@yahoo.com>\r
5  * This information is based off the released idl files from opengroup.\r
6  * ftp://ftp.opengroup.org/pub/dce122/dce/src/file.tar.gz file/ncsubik/ubikdisk_proc.idl\r
7  *\r
8  * $Id: packet-dcerpc-ubikdisk.c,v 1.1 2002/09/12 08:55:42 sahlberg Exp $\r
9  *\r
10  * Ethereal - Network traffic analyzer\r
11  * By Gerald Combs <gerald@ethereal.com>\r
12  * Copyright 1998 Gerald Combs\r
13  *\r
14  * This program is free software; you can redistribute it and/or\r
15  * modify it under the terms of the GNU General Public License\r
16  * as published by the Free Software Foundation; either version 2\r
17  * of the License, or (at your option) any later version.\r
18  *\r
19  * This program is distributed in the hope that it will be useful,\r
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
22  * GNU General Public License for more details.\r
23  *\r
24  * You should have received a copy of the GNU General Public License\r
25  * along with this program; if not, write to the Free Software\r
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
27  */\r
28 \r
29 #ifdef HAVE_CONFIG_H\r
30 #include "config.h"\r
31 #endif\r
32 \r
33 \r
34 #ifdef HAVE_SYS_TYPES_H\r
35 #include <sys/types.h>\r
36 #endif\r
37 \r
38 #include <string.h>\r
39 \r
40 #include <glib.h>\r
41 #include <epan/packet.h>\r
42 #include "packet-dcerpc.h"\r
43 \r
44 \r
45 static int proto_ubikdisk = -1;\r
46 static int hf_ubikdisk_opnum = -1;\r
47 \r
48 \r
49 static gint ett_ubikdisk = -1;\r
50 \r
51 \r
52 static e_uuid_t uuid_ubikdisk = { 0x4d37f2dd, 0xed43, 0x0002, { 0x02, 0xc0, 0x37, 0xcf, 0x1e, 0x00, 0x00, 0x00 } };\r
53 static guint16  ver_ubikdisk = 4;\r
54 \r
55 \r
56 static dcerpc_sub_dissector ubikdisk_dissectors[] = {\r
57         {  0, "Begin", NULL, NULL},\r
58         {  1, "Commit", NULL, NULL},\r
59         {  2, "Lock", NULL, NULL},\r
60         {  3, "Write", NULL, NULL},\r
61         {  4, "GetVersion", NULL, NULL},\r
62         {  5, "GetFile", NULL, NULL},\r
63         {  6, "SendFile", NULL, NULL},\r
64         {  7, "Abort", NULL, NULL},\r
65         {  8, "ReleaseLocks", NULL, NULL},\r
66         {  9, "Truncate", NULL, NULL},\r
67         { 10, "Probe", NULL, NULL},\r
68         { 11, "GetServerInterfaces", NULL, NULL},\r
69         { 12, "BulkUpdate", NULL, NULL},\r
70         { 0, NULL, NULL, NULL }\r
71 };\r
72 \r
73 static const value_string ubikdisk_opnum_vals[] = {\r
74         {  0, "Begin" },\r
75         {  1, "Commit" },\r
76         {  2, "Lock" },\r
77         {  3, "Write" },\r
78         {  4, "GetVersion" },\r
79         {  5, "GetFile" },\r
80         {  6, "SendFile" },\r
81         {  7, "Abort" },\r
82         {  8, "ReleaseLocks" },\r
83         {  9, "Truncate" },\r
84         { 10, "Probe" },\r
85         { 11, "GetServerInterfaces" },\r
86         { 12, "BulkUpdate" },\r
87         { 0, NULL }\r
88 };\r
89 \r
90 \r
91 void\r
92 proto_register_ubikdisk (void)\r
93 {\r
94         static hf_register_info hf[] = {\r
95           { &hf_ubikdisk_opnum,\r
96             { "Operation", "ubikdisk.opnum", FT_UINT16, BASE_DEC,\r
97               VALS(ubikdisk_opnum_vals), 0x0, "Operation", HFILL }}\r
98         };\r
99 \r
100         static gint *ett[] = {\r
101                 &ett_ubikdisk,\r
102         };\r
103         proto_ubikdisk = proto_register_protocol ("DCE/RPC FLDB UBIK TRANSFER", "UBIKDISK", "ubikdisk");\r
104         proto_register_field_array (proto_ubikdisk, hf, array_length (hf));\r
105         proto_register_subtree_array (ett, array_length (ett));\r
106 }\r
107 \r
108 void\r
109 proto_reg_handoff_ubikdisk (void)\r
110 {\r
111         /* Register the protocol as dcerpc */\r
112         dcerpc_init_uuid (proto_ubikdisk, ett_ubikdisk, &uuid_ubikdisk, ver_ubikdisk, ubikdisk_dissectors, hf_ubikdisk_opnum);\r
113 }\r