Fix up a bunch of arguments to "dissect_ber_identifier()" to match its
[obnox/wireshark/wip.git] / epan / dissectors / packet-ypserv.c
1 /* packet-ypserv.c
2  * Routines for ypserv dissection
3  *
4  * $Id$
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * Copied from packet-smb.c
11  *
12  * 2001 Ronnie Sahlberg <See AUTHORS for email>
13  *   Added all remaining dissectors for this protocol
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28  */
29
30 #ifdef HAVE_CONFIG_H
31 #include "config.h"
32 #endif
33
34
35
36 #include "packet-rpc.h"
37 #include "packet-ypserv.h"
38
39 static int proto_ypserv = -1;
40 static int hf_ypserv_procedure_v1 = -1;
41 static int hf_ypserv_procedure_v2 = -1;
42 static int hf_ypserv_domain = -1;
43 static int hf_ypserv_servesdomain = -1;
44 static int hf_ypserv_map = -1;
45 static int hf_ypserv_key = -1;
46 static int hf_ypserv_peer = -1;
47 static int hf_ypserv_more = -1;
48 static int hf_ypserv_ordernum = -1;
49 static int hf_ypserv_transid = -1;
50 static int hf_ypserv_prog = -1;
51 static int hf_ypserv_port = -1;
52 static int hf_ypserv_value = -1;
53 static int hf_ypserv_status = -1;
54 static int hf_ypserv_map_parms = -1;
55 static int hf_ypserv_xfrstat = -1;
56
57 static gint ett_ypserv = -1;
58 static gint ett_ypserv_map_parms = -1;
59
60 static const value_string ypstat[] =
61 {
62         {       1,      "YP_TRUE"       },
63         {       2,      "YP_NOMORE"     },
64         {       0,      "YP_FALSE"      },
65         {       -1,     "YP_NOMAP"      },
66         {       -2,     "YP_NODOM"      },
67         {       -3,     "YP_NOKEY"      },
68         {       -4,     "YP_BADOP"      },
69         {       -5,     "YP_BADDB"      },
70         {       -6,     "YP_YPERR"      },
71         {       -7,     "YP_BADARGS"    },
72         {       -8,     "YP_VERS"       },
73         {       0,      NULL    },
74 };
75
76 static const value_string xfrstat[] =
77 {
78         {       1,      "YPXFR_SUCC"    },
79         {       2,      "YPXFR_AGE"     },
80         {       -1,     "YPXFR_NOMAP"   },
81         {       -2,     "YPXFR_NODOM"   },
82         {       -3,     "YPXFR_RSRC"    },
83         {       -4,     "YPXFR_RPC"     },
84         {       -5,     "YPXFR_MADDR"   },
85         {       -6,     "YPXFR_YPERR"   },
86         {       -7,     "YPXFR_BADARGS" },
87         {       -8,     "YPXFR_DBM"     },
88         {       -9,     "YPXFR_FILE"    },
89         {       -10,    "YPXFR_SKEW"    },
90         {       -11,    "YPXFR_CLEAR"   },
91         {       -12,    "YPXFR_FORCE"   },
92         {       -13,    "YPXFR_XFRERR"  },
93         {       -14,    "YPXFR_REFUSED" },
94         {       0,      NULL    },
95 };
96
97 static int
98 dissect_ypserv_status(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, gint32 *rstatus)
99 {
100         gint32 status;
101         const char *err;
102
103         status=tvb_get_ntohl(tvb, offset);
104         if(rstatus){
105                 *rstatus=status;
106         }
107         offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_status, offset);
108
109         if(status<0){
110                 err=val_to_str(status, ypstat, "Unknown error:%u");
111                 if (check_col(pinfo->cinfo, COL_INFO)) {
112                         col_append_fstr(pinfo->cinfo, COL_INFO," %s", err);
113                 }
114                 proto_item_append_text(tree, " Error:%s", err);
115         }
116
117         return offset;
118 }
119
120 static int
121 dissect_domain_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
122 {
123         proto_item_append_text(tree, " DOMAIN call");
124
125         if ( tree )
126         {
127                 offset = dissect_rpc_string(tvb,tree,hf_ypserv_domain,offset,NULL);
128         }
129
130         return offset;
131 }
132
133 static int
134 dissect_domain_nonack_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
135 {
136         proto_item_append_text(tree, " DOMAIN_NONACK call");
137
138         if ( tree )
139         {
140                 offset = dissect_rpc_string(tvb,tree,hf_ypserv_domain,offset,NULL);
141         }
142
143         return offset;
144 }
145
146 static int
147 dissect_maplist_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
148 {
149         proto_item_append_text(tree, " MAPLIST call");
150
151         if ( tree )
152         {
153                 offset = dissect_rpc_string(tvb,tree,hf_ypserv_domain,offset,NULL);
154         }
155
156         return offset;
157 }
158
159 static int
160 dissect_domain_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
161 {
162         proto_item_append_text(tree, " DOMAIN reply");
163
164         if ( tree )
165         {
166                 proto_tree_add_boolean(tree, hf_ypserv_servesdomain, tvb,
167                         offset, 4, tvb_get_ntohl(tvb,offset));
168         }
169
170         offset += 4;
171         return offset;
172 }
173
174 static int
175 dissect_domain_nonack_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
176 {
177         proto_item_append_text(tree, " DOMAIN_NONACK reply");
178
179         if ( tree )
180         {
181                 proto_tree_add_boolean(tree, hf_ypserv_servesdomain, tvb,
182                         offset, 4, tvb_get_ntohl(tvb,offset));
183         }
184
185         offset += 4;
186         return offset;
187 }
188
189 static int
190 dissect_match_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
191 {
192         char *str;
193
194         proto_item_append_text(tree, " MATCH call");
195
196         /*domain*/
197         offset = dissect_rpc_string(tvb, tree, hf_ypserv_domain, offset, &str);
198         if (check_col(pinfo->cinfo, COL_INFO)) {
199                 col_append_fstr(pinfo->cinfo, COL_INFO," %s/", str);
200         }
201         proto_item_append_text(tree, " %s/", str);
202         g_free(str);
203
204         /*map*/
205         offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, &str);
206         if (check_col(pinfo->cinfo, COL_INFO)) {
207                 col_append_fstr(pinfo->cinfo, COL_INFO,"%s/", str);
208         }
209         proto_item_append_text(tree, "%s/", str);
210         g_free(str);
211
212         /*key*/
213         offset = dissect_rpc_string(tvb, tree, hf_ypserv_key, offset, &str);
214         if (check_col(pinfo->cinfo, COL_INFO)) {
215                 col_append_fstr(pinfo->cinfo, COL_INFO,"%s", str);
216         }
217         proto_item_append_text(tree, "%s", str);
218         g_free(str);
219
220         return offset;
221 }
222
223 static int
224 dissect_match_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
225 {
226         gint32 status;
227         char *str;
228
229         proto_item_append_text(tree, " MATCH reply");
230
231         if ( tree )
232         {
233                 offset = dissect_ypserv_status(tvb, offset, pinfo, tree, &status);
234
235                 if(status>=0){
236                         offset = dissect_rpc_string(tvb, tree, hf_ypserv_value,offset, &str);
237                         if (check_col(pinfo->cinfo, COL_INFO)) {
238                                 col_append_fstr(pinfo->cinfo, COL_INFO," %s", str);
239                         }
240                         proto_item_append_text(tree, " %s", str);
241
242                         g_free(str);
243                 } else {
244                         offset = dissect_rpc_string(tvb, tree, hf_ypserv_value,offset, NULL);
245                 }
246         }
247
248         return offset;
249 }
250
251
252 static int
253 dissect_first_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
254 {
255         proto_item_append_text(tree, " FIRST call");
256
257         /*
258          * XXX - does Sun's "yp.x" lie, and claim that the argument to a
259          * FIRST call is a "ypreq_key" rather than a "ypreq_nokey"?
260          * You presumably need the key for NEXT, as "next" is "next
261          * after some entry", and the key tells you which entry, but
262          * you don't need a key for FIRST, as there's only one entry that
263          * is the first entry.
264          *
265          * The NIS server originally used DBM, which has a "firstkey()"
266          * call, with no argument, and a "nextkey()" argument, with
267          * a key argument.  (Heck, it might *still* use DBM.)
268          *
269          * Given that, and given that at least one FIRST call from a Sun
270          * running Solaris 8 (the Sun on which I'm typing this, in fact)
271          * had a "ypreq_nokey" as the argument, I'm assuming that "yp.x"
272          * is buggy.
273          */
274
275         if ( tree )
276         {
277                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_domain, offset, NULL);
278                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, NULL);
279         }
280
281         return offset;
282 }
283
284
285 static int
286 dissect_first_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
287 {
288         proto_item_append_text(tree, " FIRST reply");
289
290         if ( tree )
291         {
292                 offset = dissect_ypserv_status(tvb, offset, pinfo, tree, NULL);
293
294                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_value, offset, NULL);
295                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_key, offset, NULL);
296         }
297
298         return offset;
299 }
300
301 static int
302 dissect_next_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
303 {
304         proto_item_append_text(tree, " NEXT reply");
305
306         if ( tree )
307         {
308                 offset = dissect_ypserv_status(tvb, offset, pinfo, tree, NULL);
309
310                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_value, offset, NULL);
311                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_key, offset, NULL);
312         }
313
314         return offset;
315 }
316
317
318 static int
319 dissect_next_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
320 {
321         proto_item_append_text(tree, " NEXT call");
322
323         if ( tree )
324         {
325                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_domain, offset, NULL);
326                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, NULL);
327                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_key, offset, NULL);
328         }
329
330         return offset;
331 }
332
333 static int
334 dissect_xfr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
335 {
336         proto_item *sub_item=NULL;
337         proto_tree *sub_tree=NULL;
338         int start_offset = offset;
339
340         proto_item_append_text(tree, " XFR call");
341
342         if(tree){
343                 sub_item = proto_tree_add_item(tree, hf_ypserv_map_parms, tvb,
344                                 offset, -1, FALSE);
345                 if(sub_item)
346                         sub_tree = proto_item_add_subtree(sub_item, ett_ypserv_map_parms);
347         }
348
349         offset = dissect_rpc_string(tvb, sub_tree, hf_ypserv_domain, offset, NULL);
350
351         offset = dissect_rpc_string(tvb, sub_tree, hf_ypserv_map, offset, NULL);
352
353         offset = dissect_rpc_uint32(tvb, sub_tree, hf_ypserv_ordernum, offset);
354
355         offset = dissect_rpc_string(tvb, sub_tree, hf_ypserv_peer, offset, NULL);
356
357         proto_tree_add_item(tree, hf_ypserv_transid, tvb, offset, 4, FALSE);
358         offset += 4;
359
360         offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_prog, offset);
361         offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_port, offset);
362
363         if(sub_item)
364                 proto_item_set_len(sub_item, offset - start_offset);
365
366         return offset;
367 }
368
369 static int
370 dissect_clear_call(tvbuff_t *tvb _U_, int offset, packet_info *pinfo _U_, proto_tree *tree)
371 {
372         proto_item_append_text(tree, " CLEAR call");
373
374         return offset;
375 }
376
377 static int
378 dissect_clear_reply(tvbuff_t *tvb _U_, int offset, packet_info *pinfo _U_, proto_tree *tree)
379 {
380         proto_item_append_text(tree, " CLEAR reply");
381
382         return offset;
383 }
384
385 static int
386 dissect_xfr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
387 {
388         proto_item_append_text(tree, " XFR reply");
389
390         proto_tree_add_item(tree, hf_ypserv_transid, tvb, offset, 4, FALSE);
391         offset += 4;
392
393         offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_xfrstat, offset);
394
395         return offset;
396 }
397
398 static int
399 dissect_order_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
400 {
401         char *str;
402
403         proto_item_append_text(tree, " ORDER call");
404
405         /*domain*/
406         offset = dissect_rpc_string(tvb, tree, hf_ypserv_domain, offset, &str);
407         if (check_col(pinfo->cinfo, COL_INFO)) {
408                 col_append_fstr(pinfo->cinfo, COL_INFO," %s/", str);
409         }
410         proto_item_append_text(tree, " %s/", str);
411         g_free(str);
412
413         /*map*/
414         offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, &str);
415         if (check_col(pinfo->cinfo, COL_INFO)) {
416                 col_append_fstr(pinfo->cinfo, COL_INFO,"%s", str);
417         }
418         proto_item_append_text(tree, "%s", str);
419         g_free(str);
420
421         return offset;
422 }
423
424 static int
425 dissect_all_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
426 {
427         proto_item_append_text(tree, " ALL call");
428
429         offset = dissect_rpc_string(tvb, tree, hf_ypserv_domain, offset, NULL);
430
431         offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, NULL);
432
433         return offset;
434 }
435
436 static int
437 dissect_master_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
438 {
439         proto_item_append_text(tree, " MASTER call");
440
441         offset = dissect_rpc_string(tvb, tree, hf_ypserv_domain, offset, NULL);
442
443         offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, NULL);
444
445         return offset;
446 }
447
448 static int
449 dissect_all_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
450 {
451         guint32 more;
452
453         proto_item_append_text(tree, " ALL reply");
454
455         for (;;) {
456                 more = tvb_get_ntohl(tvb, offset);
457
458                 offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_more, offset);
459                 if (!more)
460                         break;
461                 offset = dissect_ypserv_status(tvb, offset, pinfo, tree, NULL);
462
463                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_value, offset, NULL);
464                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_key, offset, NULL);
465         }
466
467         return offset;
468 }
469
470 static int
471 dissect_master_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
472 {
473         proto_item_append_text(tree, " MASTER reply");
474
475         offset = dissect_ypserv_status(tvb, offset, pinfo, tree, NULL);
476
477         offset = dissect_rpc_string(tvb, tree, hf_ypserv_peer, offset, NULL);
478
479         return offset;
480 }
481
482
483 static int
484 dissect_order_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
485 {
486         guint32 num;
487
488         proto_item_append_text(tree, " ORDER reply");
489
490         offset = dissect_ypserv_status(tvb, offset, pinfo, tree, NULL);
491
492         /*order number*/
493         num=tvb_get_ntohl(tvb, offset);
494         offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_ordernum, offset);
495         if (check_col(pinfo->cinfo, COL_INFO)) {
496                 col_append_fstr(pinfo->cinfo, COL_INFO," 0x%08x", num);
497         }
498         proto_item_append_text(tree, " 0x%08x", num);
499
500         return offset;
501 }
502
503
504 static int
505 dissect_maplist_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
506 {
507         proto_item_append_text(tree, " MAPLIST reply");
508
509         offset = dissect_ypserv_status(tvb, offset, pinfo, tree, NULL);
510         while(tvb_get_ntohl(tvb,offset)){
511                 offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_more, offset);
512                 offset = dissect_rpc_string(tvb, tree, hf_ypserv_map, offset, NULL);
513
514         }
515         offset = dissect_rpc_uint32(tvb, tree, hf_ypserv_more, offset);
516         return offset;
517 }
518
519
520 /* proc number, "proc name", dissect_request, dissect_reply */
521 /* NULL as function pointer means: type of arguments is "void". */
522
523 /* someone please get me a version 1 trace */
524
525 static const vsff ypserv1_proc[] = {
526     { 0, "NULL", NULL, NULL },
527     { YPPROC_DOMAIN, "DOMAIN",
528                 NULL, NULL },
529     { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK",
530                 NULL, NULL },
531     { YPPROC_MATCH, "MATCH",
532                 NULL, NULL },
533     { YPPROC_FIRST, "FIRST",
534                 NULL, NULL },
535     { YPPROC_NEXT,  "NEXT",
536                 NULL, NULL },
537     { YPPROC_XFR,   "XFR",
538                 NULL, NULL },
539     { YPPROC_CLEAR, "CLEAR",
540                 NULL, NULL },
541     { YPPROC_ALL,   "ALL",
542                 NULL, NULL },
543     { YPPROC_MASTER,    "MASTER",
544                 NULL, NULL },
545     { YPPROC_ORDER, "ORDER",
546                 NULL, NULL },
547     { YPPROC_MAPLIST,   "MAPLIST",
548                 NULL, NULL },
549     { 0, NULL, NULL, NULL }
550 };
551
552 static const value_string ypserv1_proc_vals[] = {
553     { YPPROC_DOMAIN, "DOMAIN" },
554     { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK" },
555     { YPPROC_MATCH, "MATCH" },
556     { YPPROC_FIRST, "FIRST" },
557     { YPPROC_NEXT,  "NEXT" },
558     { YPPROC_XFR,   "XFR" },
559     { YPPROC_CLEAR, "CLEAR" },
560     { YPPROC_ALL,   "ALL" },
561     { YPPROC_MASTER,    "MASTER" },
562     { YPPROC_ORDER, "ORDER" },
563     { YPPROC_MAPLIST,   "MAPLIST" },
564     { 0, NULL }
565 };
566
567 /* end of YPServ version 1 */
568
569 /* proc number, "proc name", dissect_request, dissect_reply */
570 /* NULL as function pointer means: type of arguments is "void". */
571
572 static const vsff ypserv2_proc[] = {
573     { 0, "NULL", NULL, NULL },
574     { YPPROC_DOMAIN, "DOMAIN",
575                 dissect_domain_call, dissect_domain_reply },
576     { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK",
577                 dissect_domain_nonack_call, dissect_domain_nonack_reply },
578     { YPPROC_MATCH, "MATCH",
579                 dissect_match_call, dissect_match_reply },
580     { YPPROC_FIRST, "FIRST",
581                 dissect_first_call, dissect_first_reply },
582     { YPPROC_NEXT,  "NEXT",
583                 dissect_next_call, dissect_next_reply },
584     { YPPROC_XFR,   "XFR",
585                 dissect_xfr_call, dissect_xfr_reply },
586     { YPPROC_CLEAR, "CLEAR",
587                 dissect_clear_call, dissect_clear_reply },
588     { YPPROC_ALL,   "ALL",
589                 dissect_all_call, dissect_all_reply },
590     { YPPROC_MASTER,    "MASTER",
591                 dissect_master_call, dissect_master_reply },
592     { YPPROC_ORDER, "ORDER",
593                 dissect_order_call, dissect_order_reply },
594     { YPPROC_MAPLIST,   "MAPLIST",
595                 dissect_maplist_call, dissect_maplist_reply },
596     { 0, NULL, NULL, NULL }
597 };
598
599 static const value_string ypserv2_proc_vals[] = {
600     { YPPROC_DOMAIN, "DOMAIN" },
601     { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK" },
602     { YPPROC_MATCH, "MATCH" },
603     { YPPROC_FIRST, "FIRST" },
604     { YPPROC_NEXT,  "NEXT" },
605     { YPPROC_XFR,   "XFR" },
606     { YPPROC_CLEAR, "CLEAR" },
607     { YPPROC_ALL,   "ALL" },
608     { YPPROC_MASTER,    "MASTER" },
609     { YPPROC_ORDER, "ORDER" },
610     { YPPROC_MAPLIST,   "MAPLIST" },
611     { 0, NULL }
612 };
613
614 /* end of YPServ version 2 */
615
616
617 void
618 proto_register_ypserv(void)
619 {
620         /*static struct true_false_string okfailed = { "Ok", "Failed" };*/
621         static struct true_false_string yesno = { "Yes", "No" };
622
623         static hf_register_info hf[] = {
624                 { &hf_ypserv_procedure_v1, {
625                         "V1 Procedure", "ypserv.procedure_v1", FT_UINT32, BASE_DEC,
626                         VALS(ypserv1_proc_vals), 0, "V1 Procedure", HFILL }},
627                 { &hf_ypserv_procedure_v2, {
628                         "V2 Procedure", "ypserv.procedure_v2", FT_UINT32, BASE_DEC,
629                         VALS(ypserv2_proc_vals), 0, "V2 Procedure", HFILL }},
630                 { &hf_ypserv_domain, {
631                         "Domain", "ypserv.domain", FT_STRING, BASE_DEC,
632                         NULL, 0, "Domain", HFILL }},
633                 { &hf_ypserv_servesdomain, {
634                         "Serves Domain", "ypserv.servesdomain", FT_BOOLEAN, BASE_DEC,
635                         &yesno, 0, "Serves Domain", HFILL }},
636                 { &hf_ypserv_map, {
637                         "Map Name", "ypserv.map", FT_STRING, BASE_DEC,
638                         NULL, 0, "Map Name", HFILL }},
639                 { &hf_ypserv_peer, {
640                         "Peer Name", "ypserv.peer", FT_STRING, BASE_DEC,
641                         NULL, 0, "Peer Name", HFILL }},
642                 { &hf_ypserv_more, {
643                         "More", "ypserv.more", FT_BOOLEAN, BASE_NONE,
644                         &yesno, 0, "More", HFILL }},
645                 { &hf_ypserv_ordernum, {
646                         "Order Number", "ypserv.ordernum", FT_UINT32, BASE_DEC,
647                         NULL, 0, "Order Number for XFR", HFILL }},
648                 { &hf_ypserv_transid, {
649                         "Host Transport ID", "ypserv.transid", FT_IPv4, BASE_DEC,
650                         NULL, 0, "Host Transport ID to use for XFR Callback", HFILL }},
651                 { &hf_ypserv_prog, {
652                         "Program Number", "ypserv.prog", FT_UINT32, BASE_DEC,
653                         NULL, 0, "Program Number to use for XFR Callback", HFILL }},
654                 { &hf_ypserv_port, {
655                         "Port", "ypserv.port", FT_UINT32, BASE_DEC,
656                         NULL, 0, "Port to use for XFR Callback", HFILL }},
657                 { &hf_ypserv_key, {
658                         "Key", "ypserv.key", FT_STRING, BASE_DEC,
659                         NULL, 0, "Key", HFILL }},
660                 { &hf_ypserv_value, {
661                         "Value", "ypserv.value", FT_STRING, BASE_DEC,
662                         NULL, 0, "Value", HFILL }},
663                 { &hf_ypserv_status, {
664                         "Status", "ypserv.status", FT_INT32, BASE_DEC,
665                         VALS(ypstat) , 0, "Status", HFILL }},
666                 { &hf_ypserv_map_parms, {
667                         "YP Map Parameters", "ypserv.map_parms", FT_NONE, BASE_DEC,
668                         NULL, 0, "YP Map Parameters", HFILL }},
669                 { &hf_ypserv_xfrstat, {
670                         "Xfrstat", "ypserv.xfrstat", FT_INT32, BASE_DEC,
671                         VALS(xfrstat), 0, "Xfrstat", HFILL }},
672         };
673         static gint *ett[] = {
674                 &ett_ypserv,
675                 &ett_ypserv_map_parms,
676         };
677
678         proto_ypserv = proto_register_protocol("Yellow Pages Service",
679             "YPSERV", "ypserv");
680         proto_register_field_array(proto_ypserv, hf, array_length(hf));
681         proto_register_subtree_array(ett, array_length(ett));
682 }
683
684 void
685 proto_reg_handoff_ypserv(void)
686 {
687         /* Register the protocol as RPC */
688         rpc_init_prog(proto_ypserv, YPSERV_PROGRAM, ett_ypserv);
689         /* Register the procedure tables */
690         rpc_init_proc_table(YPSERV_PROGRAM, 1, ypserv1_proc,
691             hf_ypserv_procedure_v1);
692         rpc_init_proc_table(YPSERV_PROGRAM, 2, ypserv2_proc,
693             hf_ypserv_procedure_v2);
694 }