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