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