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