Remove "text2pcap-scanner.obj" and "tools\lemon\lemon.obj" when a "nmake
[obnox/wireshark/wip.git] / packet-hclnfsd.c
1 /* packet-hclnfsd.c
2  * Routines for hclnfsd (Hummingbird NFS Daemon) dissection
3  * Copyright 2001, Mike Frisch <frisch@hummingbird.com>
4  *
5  * $Id: packet-hclnfsd.c,v 1.7 2001/06/18 02:17:46 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * Copied from packet-ypserv.c
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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-hclnfsd.h"
40
41 static int proto_hclnfsd = -1;
42
43 static int hf_hclnfsd_request_type = -1;
44 static int hf_hclnfsd_device = -1;
45 static int hf_hclnfsd_login = -1;
46 static int hf_hclnfsd_lockname = -1;
47 static int hf_hclnfsd_unknown_data = -1;
48 static int hf_hclnfsd_lockowner = -1;
49 static int hf_hclnfsd_printername = -1;
50 static int hf_hclnfsd_filename = -1;
51 static int hf_hclnfsd_fileext = -1;
52 static int hf_hclnfsd_grpname = -1;
53 static int hf_hclnfsd_hostname = -1;
54 static int hf_hclnfsd_username = -1;
55 static int hf_hclnfsd_queuename = -1;
56 static int hf_hclnfsd_queuecomment = -1;
57 static int hf_hclnfsd_queuestatus = -1;
58 static int hf_hclnfsd_numphysicalprinters = -1;
59 static int hf_hclnfsd_printqueuenumber = -1;
60 static int hf_hclnfsd_printparams = -1;
61 static int hf_hclnfsd_status = -1;
62 static int hf_hclnfsd_sequence = -1;
63 static int hf_hclnfsd_server_ip = -1;
64 static int hf_hclnfsd_host_ip = -1;
65 static int hf_hclnfsd_gid = -1;
66 static int hf_hclnfsd_uid = -1;
67 static int hf_hclnfsd_cookie = -1;
68 static int hf_hclnfsd_mode = -1;
69 static int hf_hclnfsd_access = -1;
70 static int hf_hclnfsd_exclusive = -1;
71 static int hf_hclnfsd_offset = -1;
72 static int hf_hclnfsd_length = -1;
73 static int hf_hclnfsd_jobstatus = -1;
74 static int hf_hclnfsd_timesubmitted = -1;
75 static int hf_hclnfsd_size = -1;
76 static int hf_hclnfsd_copies = -1;
77
78 static gint ett_hclnfsd = -1;
79 static gint ett_hclnfsd_gids = -1;
80 static gint ett_hclnfsd_groups = -1;
81 static gint ett_hclnfsd_uids = -1;
82 static gint ett_hclnfsd_usernames = -1;
83 static gint ett_hclnfsd_printqueues = -1;
84 static gint ett_hclnfsd_printjob = -1;
85
86
87 /* defined in 'packet-nfs.c' */
88 extern int
89 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *name);
90
91
92 static int
93 dissect_hclnfsd_gids(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
94 {
95         guint32 ngids, ngids_i, gid;
96         proto_tree *gidtree = NULL;
97         proto_item *giditem = NULL;
98
99
100         ngids = tvb_get_ntohl(tvb, offset);
101         if (tree)
102         {
103                 giditem = proto_tree_add_text(tree, tvb, offset, 4, "GIDs: %d", 
104                         ngids);
105                 if (giditem)
106                         gidtree = proto_item_add_subtree(giditem, ett_hclnfsd_gids);
107         }
108         offset += 4;
109
110         if (gidtree)
111         {
112                 for (ngids_i = 0; ngids_i < ngids; ngids_i++)
113                 {
114                         gid = tvb_get_ntohl(tvb, offset + (4 * ngids_i));
115                         proto_tree_add_text(gidtree, tvb, offset + (4 * ngids_i), 4, 
116                                 "GID: %d", gid);
117                 }
118         }
119         offset += 4 * ngids;
120
121         return offset;
122 }
123
124 static int
125 dissect_hclnfsd_spool_inquire_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
126 {
127         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_status, offset);
128
129         offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "spool filehandle");
130
131         return offset;
132 }
133
134
135 static int
136 dissect_hclnfsd_spool_file_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
137 {
138         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_printername, offset, NULL);
139
140         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_filename, offset, NULL);
141
142         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_fileext, offset);
143
144         return offset;
145 }
146
147
148 static const value_string names_request_type[] = {
149 #define HCLNFSD_DISK_REQUEST 4
150         { HCLNFSD_DISK_REQUEST, "DISK" },
151 #define HCLNFSD_PRINT_REQUEST 3
152         { HCLNFSD_PRINT_REQUEST, "PRINTER" },
153         { 0, NULL }
154 };
155
156
157 static int
158 dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
159 {
160         guint32 request_type;
161         guint32 ip;
162
163         ip = tvb_get_ntohl(tvb, offset);
164         ip=((ip&0x000000ff)<<24)|((ip&0x0000ff00)<<8)|((ip&0x00ff0000)>>8)|((ip&0xff000000)>>24);
165         proto_tree_add_ipv4(tree, hf_hclnfsd_server_ip, tvb, offset, 4, ip);
166         offset += 4;
167
168         request_type = tvb_get_ntohl(tvb, offset);
169         if (tree)
170                 proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
171                         4, request_type);
172         offset += 4;
173
174         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_device, offset, NULL);
175
176         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_login, offset, NULL);
177
178         return offset;
179 }
180
181
182 static int
183 dissect_hclnfsd_authorize_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
184 {
185         guint32 status;
186
187         status = tvb_get_ntohl(tvb, offset);
188         if (!tree) 
189                 return offset;
190         offset += 4;
191
192         if (status != 0)
193                 return offset;
194
195         proto_tree_add_uint(tree, hf_hclnfsd_status, tvb, offset, 4, status);
196
197         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_uid, offset);
198
199         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_gid, offset);
200
201         offset = dissect_hclnfsd_gids(tvb, offset, pinfo, tree);
202
203         return offset;
204 }
205
206 static int
207 dissect_hclnfsd_grp_name_to_numb_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
208 {
209         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_grpname, offset, NULL);
210
211         return offset;
212 }
213
214 static int
215 dissect_hclnfsd_grp_name_to_numb_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
216 {
217         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_gid, offset);
218         
219         return offset;
220 }
221
222
223 static int
224 dissect_hclnfsd_grp_to_number_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
225 {
226
227         offset = dissect_hclnfsd_gids(tvb, offset, pinfo, tree);
228
229         return offset;
230 }
231
232
233 static int
234 dissect_hclnfsd_grp_to_number_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
235 {
236         guint32 ngrpnames, ngrpnames_i;
237         proto_tree *grptree = NULL;
238         proto_item *grpitem = NULL;
239
240         ngrpnames = tvb_get_ntohl(tvb, offset);
241         if (tree)
242         {
243                 grpitem = proto_tree_add_text(tree, tvb, offset, 4, "Groups: %d",
244                         ngrpnames);
245
246                 if (grpitem)
247                         grptree = proto_item_add_subtree(grpitem, ett_hclnfsd_groups);
248         }
249         offset += 4;
250
251         if (!grptree)
252                 return offset;
253
254         for (ngrpnames_i = 0; ngrpnames_i < ngrpnames ; ngrpnames_i++)
255                 offset = dissect_rpc_string(tvb, pinfo, grptree, 
256                         hf_hclnfsd_grpname, offset, NULL);
257         
258         return offset;
259 }
260
261
262 static int
263 dissect_hclnfsd_return_host_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
264 {
265         guint32 ip;
266
267         ip = tvb_get_ntohl(tvb, offset);
268         ip=((ip&0x000000ff)<<24)|((ip&0x0000ff00)<<8)|((ip&0x00ff0000)>>8)|((ip&0xff000000)>>24);
269         proto_tree_add_ipv4(tree, hf_hclnfsd_host_ip, tvb, offset, 4, ip);
270         offset += 4;
271
272         return offset;
273 }
274
275
276 static int
277 dissect_hclnfsd_return_host_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
278 {
279         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_hostname, offset, NULL);
280
281         return offset;
282 }
283
284
285 static int
286 dissect_hclnfsd_uid_to_name_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
287 {
288         guint32 nuids, nuids_i;
289         proto_tree *uidtree = NULL;
290         proto_item *uiditem = NULL;
291
292         nuids = tvb_get_ntohl(tvb, offset);
293         if (tree)
294         {
295                 uiditem = proto_tree_add_text(tree, tvb, offset, 4, "UIDs: %d",
296                         nuids);
297
298                 if (uiditem)
299                         uidtree = proto_item_add_subtree(uiditem, ett_hclnfsd_uids);
300         }
301         offset += 4;
302
303         if (!uidtree)
304                 return offset;
305
306         for (nuids_i = 0; nuids_i < nuids; nuids_i++)
307                 offset = dissect_rpc_uint32(tvb, pinfo, uidtree, hf_hclnfsd_uid, offset);
308
309         return offset;
310 }
311
312
313 static int
314 dissect_hclnfsd_uid_to_name_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
315 {
316         guint32 nusers, nusers_i;
317         proto_tree *usertree = NULL;
318         proto_item *useritem = NULL;
319
320         nusers = tvb_get_ntohl(tvb, offset);
321         if (tree)
322         {
323                 useritem = proto_tree_add_text(tree, tvb, offset, 4, "UIDs: %d",
324                         nusers);
325
326                 if (useritem)
327                         usertree = proto_item_add_subtree(useritem, ett_hclnfsd_usernames);
328         }
329         offset += 4;
330
331         if (!usertree)
332                 return offset;
333
334         for (nusers_i = 0; nusers_i < nusers; nusers_i++)
335                 offset = dissect_rpc_string(tvb, pinfo, usertree, 
336                         hf_hclnfsd_username, offset, NULL);
337
338         return offset;
339 }
340
341
342 static int
343 dissect_hclnfsd_name_to_uid_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
344 {
345         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_username, offset, NULL);
346
347         return offset;
348 }
349
350
351 static int
352 dissect_hclnfsd_name_to_uid_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
353 {
354         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_uid, offset);
355
356         return offset;
357 }
358
359
360 static int
361 dissect_hclnfsd_share_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
362 {
363         guint32 request_type;
364
365         request_type = tvb_get_ntohl(tvb, offset);
366         if (tree)
367                 proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
368                         4, request_type);
369         offset += 4;
370
371         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_cookie, offset);
372
373         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
374
375         offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "Filehandle");
376
377         offset = dissect_rpc_data(tvb, pinfo, tree, hf_hclnfsd_unknown_data, offset);
378
379         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_mode, offset);
380
381         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_access, offset);
382
383         offset += 4;    /* skip last 4 UNUSED bytes */
384
385         return offset;
386 }
387
388
389 static int
390 dissect_hclnfsd_share_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
391 {
392         guint32 request_type;
393
394         request_type = tvb_get_ntohl(tvb, offset);
395         if (tree)
396                 proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
397                         4, request_type);
398         offset += 4;
399
400         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_cookie, offset);
401         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_status, offset);
402         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_sequence, offset);
403
404         return offset;
405 }
406
407
408 static int
409 dissect_hclnfsd_unshare_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
410 {
411         return dissect_hclnfsd_share_call(tvb, offset, pinfo, tree);
412 }
413
414
415 static int
416 dissect_hclnfsd_unshare_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
417 {
418         return dissect_hclnfsd_share_reply(tvb, offset, pinfo, tree);
419 }
420
421
422 static int
423 dissect_hclnfsd_lock_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
424 {
425         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_status, offset);
426         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_cookie, offset);
427         offset += 4; /* skip unused uint */
428
429         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_exclusive, offset);
430
431         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
432
433         offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "Filehandle");
434
435         offset = dissect_rpc_data(tvb, pinfo, tree, hf_hclnfsd_lockowner, offset);
436
437         offset += 4;  /* unused, skip */
438
439         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_offset, offset);
440
441         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_length, offset);
442
443         return offset;
444 }
445
446
447 static int
448 dissect_hclnfsd_lock_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
449 {
450         guint request_type;
451
452         request_type = tvb_get_ntohl(tvb, offset);
453         if (tree)
454                 proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
455                         4, request_type);
456         offset += 4;
457
458         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_cookie, offset);
459         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_status, offset);
460
461         return offset;
462 }
463
464
465 static int
466 dissect_hclnfsd_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
467 {
468         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
469
470         offset += 4;  /* skip unused */
471
472         return offset;
473 }
474
475
476 static int
477 dissect_hclnfsd_unlock_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
478 {
479         offset += 4;  /* skip unused */
480
481         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_cookie, offset);
482
483         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_lockname, offset, NULL);
484
485         offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "Filehandle");
486
487         offset = dissect_rpc_data(tvb, pinfo, tree, hf_hclnfsd_unknown_data, offset);
488
489         offset += 4;  /* skip unused */
490
491         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_offset, offset);
492         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_length, offset);
493         
494         return offset;
495 }
496
497
498 static int
499 dissect_hclnfsd_unlock_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
500 {
501         return dissect_hclnfsd_lock_reply(tvb, offset, pinfo, tree);
502 }
503
504
505 static int
506 dissect_hclnfsd_get_printers_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
507 {
508         guint nqueues, nqueues_i;
509         proto_item *queuesitem = NULL;
510         proto_tree *queuestree = NULL;
511
512         nqueues = tvb_get_ntohl(tvb, offset);
513         if (tree)
514         {
515                 queuesitem = proto_tree_add_text(tree, tvb, offset, 4,
516                         "Print Queues: %d", nqueues);
517
518                 if (queuesitem)
519                         queuestree = proto_item_add_subtree(queuesitem, 
520                                 ett_hclnfsd_printqueues);
521         }
522         offset += 4;
523
524         if (!queuestree)
525                 return offset;
526
527         for (nqueues_i = 0; nqueues_i < nqueues; nqueues_i++)
528         {
529                 /* create new item for print queue */
530                 offset = dissect_rpc_string(tvb, pinfo, tree, 
531                         hf_hclnfsd_queuename, offset, NULL);
532
533                 /* create subtree on new item with print queue comment */
534                 offset = dissect_rpc_string(tvb, pinfo, tree, 
535                         hf_hclnfsd_queuecomment, offset, NULL);
536         }
537
538         return offset;
539 }
540
541
542 static int
543 dissect_hclnfsd_get_printq_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
544 {
545         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_queuename, offset, NULL);
546
547         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_username, offset, NULL);
548
549         return offset;
550 }
551
552
553 static int
554 dissect_hclnfsd_get_printq_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
555 {
556         guint datafollows, jobid;
557         proto_item *queueitem = NULL;
558         proto_tree *queuetree = NULL;
559         proto_item *jobitem;
560         proto_tree *jobtree;
561
562         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_printqueuenumber, offset);
563
564         offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_queuecomment, offset, NULL);
565
566         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_queuestatus, offset);
567
568         offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_numphysicalprinters, offset);
569
570         datafollows = tvb_get_ntohl(tvb, offset);
571         if (tree)
572         {
573                 queueitem = proto_tree_add_text(tree, tvb, offset, 4, 
574                         "Print Jobs: %d", datafollows);
575                 if (queueitem)
576                         queuetree = proto_item_add_subtree(queueitem, ett_hclnfsd_printqueues);
577         }
578         offset += 4;
579
580         if (!queuetree)
581                 return offset;
582         
583         while (datafollows)
584         {
585                 jobid = tvb_get_ntohl(tvb, offset);
586                 jobitem = proto_tree_add_text(queuetree, tvb, offset, 4, "Job ID: %d",
587                         jobid);
588                 offset += 4;
589
590                 jobtree = proto_item_add_subtree(jobitem, ett_hclnfsd_printjob);
591                         
592                 offset = dissect_rpc_string(tvb, pinfo, tree, 
593                         hf_hclnfsd_username, offset, NULL);
594
595                 offset = dissect_rpc_string(tvb, pinfo, tree, 
596                         hf_hclnfsd_printparams, offset, NULL);
597
598                 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_queuestatus, offset);
599
600                 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_jobstatus, offset);
601                 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_timesubmitted, offset);
602                 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_size, offset);
603                 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_hclnfsd_copies, offset);
604                 offset = dissect_rpc_string(tvb, pinfo, tree, 
605                         hf_hclnfsd_queuecomment, offset, NULL);
606
607                 datafollows = tvb_get_ntohl(tvb, offset);
608                 offset += 4;
609         }
610
611         return offset;
612 }
613
614
615 /* proc number, "proc name", dissect_request, dissect_reply */
616 /* NULL as function pointer means: take the generic one. */
617
618 static const vsff hclnfsd1_proc[] = {
619     { HCLNFSDPROC_NULL, "NULL", 
620                 NULL, NULL },
621     { HCLNFSDPROC_SPOOL_INQUIRE, "SPOOL_INQUIRE",
622                 dissect_hclnfsd_spool_inquire_call, NULL }, 
623     { HCLNFSDPROC_SPOOL_FILE, "SPOOL_FILE",
624                 dissect_hclnfsd_spool_file_call, NULL }, 
625     { HCLNFSDPROC_AUTHORIZE, "AUTHORIZE",
626                 dissect_hclnfsd_authorize_call, dissect_hclnfsd_authorize_reply }, 
627     { HCLNFSDPROC_GRP_NAME_TO_NUMB, "GRP_NAME_TO_NUMB",
628                 dissect_hclnfsd_grp_name_to_numb_call, dissect_hclnfsd_grp_name_to_numb_reply }, 
629     { HCLNFSDPROC_GRP_TO_NUMBER, "GRP_TO_NUMBER",
630                 dissect_hclnfsd_grp_to_number_call, dissect_hclnfsd_grp_to_number_reply },
631     { HCLNFSDPROC_RETURN_HOST, "RETURN_HOST",
632                 dissect_hclnfsd_return_host_call, dissect_hclnfsd_return_host_reply }, 
633     { HCLNFSDPROC_UID_TO_NAME, "UID_TO_NAME",
634                 dissect_hclnfsd_uid_to_name_call, dissect_hclnfsd_uid_to_name_reply }, 
635     { HCLNFSDPROC_NAME_TO_UID, "NAME_TO_UID",
636                 dissect_hclnfsd_name_to_uid_call, dissect_hclnfsd_name_to_uid_reply }, 
637     { HCLNFSDPROC_SHARE, "SHARE",
638                 dissect_hclnfsd_share_call, dissect_hclnfsd_share_reply }, 
639     { HCLNFSDPROC_UNSHARE, "UNSHARE",
640                 dissect_hclnfsd_unshare_call, dissect_hclnfsd_unshare_reply }, 
641     { HCLNFSDPROC_LOCK, "LOCK",
642                 dissect_hclnfsd_lock_call, dissect_hclnfsd_lock_reply }, 
643     { HCLNFSDPROC_REMOVE, "REMOVE",
644                 dissect_hclnfsd_remove_call, NULL }, 
645     { HCLNFSDPROC_UNLOCK, "UNLOCK",
646                 dissect_hclnfsd_unlock_call, dissect_hclnfsd_unlock_reply }, 
647     { HCLNFSDPROC_GET_PRINTERS, "GET_PRINTERS",
648                 NULL, dissect_hclnfsd_get_printers_reply }, 
649     { HCLNFSDPROC_GET_PRINTQ, "GET_PRINTQ",
650                 dissect_hclnfsd_get_printq_call, dissect_hclnfsd_get_printq_reply }, 
651     { HCLNFSDPROC_CANCEL_PRJOB, "CANCEL_PRJOB",
652                 NULL, NULL }, 
653     { HCLNFSDPROC_ZAP_LOCKS, "ZAP_LOCKS",
654                 NULL, NULL }, 
655     { 0, NULL, NULL, NULL }
656 };
657 /* end of hclnfsd version 1 */
658
659
660 void
661 proto_register_hclnfsd(void)
662 {
663 #if 0
664         static struct true_false_string okfailed = { "Ok", "Failed" };
665         static struct true_false_string yesno = { "Yes", "No" };
666 #endif
667                 
668         static hf_register_info hf[] = {
669                 { &hf_hclnfsd_request_type, {
670                         "Request Type", "hclnfsd.request_type", FT_UINT32, BASE_DEC,
671                         VALS(names_request_type), 0, "Request Type", HFILL }},
672
673                 { &hf_hclnfsd_device, {
674                         "Device", "hclnfsd.device", FT_STRING, BASE_DEC,
675                         NULL, 0, "Device", HFILL }},
676
677                 { &hf_hclnfsd_login, {
678                         "Login Text", "hclnfsd.logintext", FT_STRING, BASE_DEC,
679                         NULL, 0, "Login Text", HFILL }},
680
681                 { &hf_hclnfsd_lockname, {
682                         "Lockname", "hclnfsd.lockname", FT_STRING, BASE_DEC,
683                         NULL, 0, "Lockname", HFILL }},
684
685                 { &hf_hclnfsd_unknown_data, {
686                         "Unknown", "hclnfsd.unknown_data", FT_BYTES, BASE_DEC,
687                         NULL, 0, "Data", HFILL }},
688
689                 { &hf_hclnfsd_lockowner, {
690                         "Lockowner", "hclnfsd.lockowner", FT_BYTES, BASE_DEC,
691                         NULL, 0, "Lockowner", HFILL }},
692
693                 { &hf_hclnfsd_printername, {
694                         "Printer Name", "hclnfsd.printername", FT_STRING, BASE_DEC,
695                         NULL, 0, "Printer name", HFILL }},
696
697                 { &hf_hclnfsd_filename, {
698                         "Filename", "hclnfsd.filename", FT_STRING, BASE_DEC,
699                         NULL, 0, "Filename", HFILL }},
700
701                 { &hf_hclnfsd_fileext, {
702                         "File Extension", "hclnfsd.fileext", FT_UINT32, BASE_DEC,
703                         NULL, 0, "File Extension", HFILL }},
704
705                 { &hf_hclnfsd_grpname, {
706                         "Group", "hclnfsd.group", FT_STRING, BASE_DEC,
707                         NULL, 0, "Group", HFILL }},
708
709                 { &hf_hclnfsd_hostname, {
710                         "Hostname", "hclnfsd.hostname", FT_STRING, BASE_DEC,
711                         NULL, 0, "Hostname", HFILL }},
712
713                 { &hf_hclnfsd_username, {
714                         "Username", "hclnfsd.username", FT_STRING, BASE_DEC,
715                         NULL, 0, "Username", HFILL }},
716
717                 { &hf_hclnfsd_queuename, {
718                         "Name", "hclnfsd.printqueuename", FT_STRING, BASE_DEC,
719                         NULL, 0, "Print Queue Name", HFILL }},
720
721                 { &hf_hclnfsd_queuecomment, {
722                         "Comment", "hclnfsd.printqueuecomment", FT_STRING, BASE_DEC,
723                         NULL, 0, "Print Queue Comment", HFILL }},
724
725                 { &hf_hclnfsd_printparams, {
726                         "Print Parameters", "hclnfsd.printparameters", FT_STRING, BASE_DEC,
727                         NULL, 0, "Print Parameters", HFILL }},
728
729                 { &hf_hclnfsd_status, {
730                         "Status", "hclnfsd.status", FT_UINT32, BASE_DEC,
731                         NULL, 0, "Status", HFILL }},
732
733                 { &hf_hclnfsd_uid, {
734                         "UID", "hclnfsd.uid", FT_UINT32, BASE_DEC,
735                         NULL, 0, "User ID", HFILL }},
736
737                 { &hf_hclnfsd_sequence, {
738                         "Sequence", "hclnfsd.sequence", FT_UINT32, BASE_HEX,
739                         NULL, 0, "Sequence", HFILL }},
740
741                 { &hf_hclnfsd_cookie, {
742                         "Cookie", "hclnfsd.cookie", FT_UINT32, BASE_HEX,
743                         NULL, 0, "Cookie", HFILL }},
744
745                 { &hf_hclnfsd_mode, {
746                         "Mode", "hclnfsd.mode", FT_UINT32, BASE_DEC,
747                         NULL, 0, "Mode", HFILL }},
748
749                 { &hf_hclnfsd_access, {
750                         "Access", "hclnfsd.access", FT_UINT32, BASE_DEC,
751                         NULL, 0, "Access", HFILL }},
752
753                 { &hf_hclnfsd_exclusive, {
754                         "Exclusive", "hclnfsd.exclusive", FT_UINT32, BASE_DEC,
755                         NULL, 0, "Exclusive", HFILL }},
756
757                 { &hf_hclnfsd_offset, {
758                         "Offset", "hclnfsd.offset", FT_UINT32, BASE_DEC,
759                         NULL, 0, "Offset", HFILL }},
760
761                 { &hf_hclnfsd_length, {
762                         "Length", "hclnfsd.length", FT_UINT32, BASE_DEC,
763                         NULL, 0, "Length", HFILL }},
764
765                 { &hf_hclnfsd_queuestatus, {
766                         "Queue Status", "hclnfsd.queuestatus", FT_UINT32, BASE_DEC,
767                         NULL, 0, "Queue Status", HFILL }},
768
769                 { &hf_hclnfsd_printqueuenumber, {
770                         "Print Queue Number", "hclnfsd.pqn", FT_UINT32, BASE_DEC,
771                         NULL, 0, "Print Queue Number", HFILL }},
772
773                 { &hf_hclnfsd_numphysicalprinters, {
774                         "Number of Physical Printers", "hclnfsd.npp", FT_UINT32, BASE_DEC,
775                         NULL, 0, "Number of Physical Printers", HFILL }},
776
777                 { &hf_hclnfsd_jobstatus, {
778                         "Job Status", "hclnfsd.jobstatus", FT_UINT32, BASE_DEC,
779                         NULL, 0, "Job Status", HFILL }},
780
781                 { &hf_hclnfsd_timesubmitted, {
782                         "Time Submitted", "hclnfsd.timesubmitted", FT_UINT32, BASE_DEC,
783                         NULL, 0, "Time Submitted", HFILL }},
784
785                 { &hf_hclnfsd_size, {
786                         "Size", "hclnfsd.size", FT_UINT32, BASE_DEC,
787                         NULL, 0, "Size", HFILL }},
788
789                 { &hf_hclnfsd_copies, {
790                         "Copies", "hclnfsd.copies", FT_UINT32, BASE_DEC,
791                         NULL, 0, "Copies", HFILL }},
792
793                 { &hf_hclnfsd_gid, {
794                         "GID", "hclnfsd.gid", FT_UINT32, BASE_DEC,
795                         NULL, 0, "Group ID", HFILL }},
796
797                 { &hf_hclnfsd_server_ip, {
798                         "Server IP", "hclnfsd.server_ip", FT_IPv4, BASE_DEC,
799                         NULL, 0, "Server IP", HFILL }},
800
801                 { &hf_hclnfsd_host_ip, {
802                         "Host IP", "hclnfsd.host_ip", FT_IPv4, BASE_DEC,
803                         NULL, 0, "Host IP", HFILL }},
804         };
805         static gint *ett[] = {
806                 &ett_hclnfsd,
807                 &ett_hclnfsd_gids,
808                 &ett_hclnfsd_groups,
809                 &ett_hclnfsd_uids,
810                 &ett_hclnfsd_usernames,
811                 &ett_hclnfsd_printqueues,
812                 &ett_hclnfsd_printjob,
813         };
814
815         proto_hclnfsd = proto_register_protocol("Hummingbird NFS Daemon", 
816                 "HCLNFSD", "hclnfsd");
817         proto_register_field_array(proto_hclnfsd, hf, array_length(hf));
818         proto_register_subtree_array(ett, array_length(ett));
819 }
820
821 void
822 proto_reg_handoff_hclnfsd(void)
823 {
824         /* Register the protocol as RPC */
825         rpc_init_prog(proto_hclnfsd, HCLNFSD_PROGRAM, ett_hclnfsd);
826
827         /* Register the procedure tables */
828         rpc_init_proc_table(HCLNFSD_PROGRAM, 1, hclnfsd1_proc);
829 }