FIXUP: WIP: verification_trailer
[wireshark-wip.git] / epan / dissectors / packet-portmap.c
blob7b54de41029a7ae1e83f02312c0341f943d9a86f
1 /* packet-portmap.c
2 * Routines for portmap dissection
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * Copied from packet-smb.c
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "config.h"
31 #include "packet-rpc.h"
32 #include "packet-portmap.h"
33 #include <epan/ipproto.h>
34 #include <epan/conversation.h>
35 #include <epan/packet_info.h>
38 * See:
40 * RFC 1833, "Binding Protocols for ONC RPC Version 2".
43 static int proto_portmap = -1;
44 static int hf_portmap_procedure_v1 = -1;
45 static int hf_portmap_procedure_v2 = -1;
46 static int hf_portmap_procedure_v3 = -1;
47 static int hf_portmap_procedure_v4 = -1;
48 static int hf_portmap_proto = -1;
49 static int hf_portmap_prog = -1;
50 static int hf_portmap_proc = -1;
51 static int hf_portmap_version = -1;
52 static int hf_portmap_port = -1;
53 static int hf_portmap_answer = -1;
54 static int hf_portmap_args = -1;
55 static int hf_portmap_result = -1;
56 static int hf_portmap_rpcb = -1;
57 static int hf_portmap_rpcb_prog = -1;
58 static int hf_portmap_rpcb_version = -1;
59 static int hf_portmap_rpcb_netid = -1;
60 static int hf_portmap_rpcb_addr = -1;
61 static int hf_portmap_rpcb_owner = -1;
62 static int hf_portmap_uaddr = -1;
65 static gint ett_portmap = -1;
66 static gint ett_portmap_rpcb = -1;
67 static gint ett_portmap_entry = -1;
69 static dissector_handle_t rpc_handle;
71 /* Dissect a getport call */
72 static int
73 dissect_getport_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
74 proto_tree *tree, void* data)
76 guint32 proto, version;
77 guint32 prog;
78 const char *prog_name;
79 const char *proto_name;
81 /* make sure we remember protocol type until the reply packet */
82 if(!pinfo->fd->flags.visited){
83 rpc_call_info_value *rpc_call=(rpc_call_info_value *)data;
84 if(rpc_call){
85 proto = tvb_get_ntohl(tvb, offset+8);
86 if(proto==IP_PROTO_UDP){ /* only do this for UDP */
87 rpc_call->private_data=(void *)PT_UDP;
92 /* program */
93 prog = tvb_get_ntohl(tvb, offset+0);
94 prog_name = rpc_prog_name(prog);
95 proto_tree_add_uint_format_value(tree, hf_portmap_prog, tvb,
96 offset, 4, prog, "%s (%u)",
97 prog_name, prog);
98 col_append_fstr(pinfo->cinfo, COL_INFO, " %s(%u)", prog_name, prog);
100 proto_item_append_text(tree, " GETPORT Call %s(%u)", prog_name, prog);
102 /* version */
103 version = tvb_get_ntohl(tvb, offset+4);
104 proto_tree_add_item(tree, hf_portmap_version, tvb,
105 offset+4, 4, ENC_BIG_ENDIAN);
106 col_append_fstr(pinfo->cinfo, COL_INFO, " V:%d", version);
109 proto_item_append_text(tree, " Version:%d", version);
112 /* protocol */
113 proto = tvb_get_ntohl(tvb, offset+8);
114 proto_name = ipprotostr(proto);
115 proto_tree_add_uint_format(tree, hf_portmap_proto, tvb,
116 offset+8, 4, proto, "Proto: %s (%u)", proto_name, proto);
117 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", proto_name);
119 proto_item_append_text(tree, " %s", proto_name);
121 /* port */
122 proto_tree_add_item(tree, hf_portmap_port, tvb,
123 offset+12, 4, ENC_BIG_ENDIAN);
125 return offset+16;
128 static int
129 dissect_getport_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
130 proto_tree *tree, void* data)
132 guint32 portx;
134 /* we might have learnt a <ipaddr><protocol><port> mapping for ONC-RPC*/
135 if(!pinfo->fd->flags.visited){
136 rpc_call_info_value *rpc_call=(rpc_call_info_value *)data;
137 /* only do this for UDP, TCP does not need anything like this */
138 if(rpc_call && (GPOINTER_TO_UINT(rpc_call->private_data)==PT_UDP) ){
139 guint32 port;
140 port=tvb_get_ntohl(tvb, offset);
141 if(port){
142 conversation_t *conv;
143 conv=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, (port_type)rpc_call->private_data, port, 0, NO_ADDR_B|NO_PORT_B);
144 if(!conv){
145 conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, (port_type)rpc_call->private_data, port, 0, NO_ADDR2|NO_PORT2);
147 conversation_set_dissector(conv, rpc_handle);
152 portx = tvb_get_ntohl(tvb, offset);
153 offset = dissect_rpc_uint32(tvb, tree, hf_portmap_port,
154 offset);
155 proto_item_append_text(tree, " GETPORT Reply Port:%d", portx);
156 if(portx){
157 col_append_fstr(pinfo->cinfo, COL_INFO, " Port:%d", portx);
158 proto_item_append_text(tree, " Port:%d", portx);
159 } else {
160 col_append_str(pinfo->cinfo, COL_INFO, " PROGRAM_NOT_AVAILABLE");
161 proto_item_append_text(tree, " PROGRAM_NOT_AVAILABLE");
164 return offset;
167 /* Dissect a 'set' call */
168 static int
169 dissect_set_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
170 proto_tree *tree, void* data _U_)
172 guint32 proto;
173 guint32 prog;
175 if ( tree )
177 prog = tvb_get_ntohl(tvb, offset+0);
178 proto_tree_add_uint_format_value(tree, hf_portmap_prog, tvb,
179 offset, 4, prog, "%s (%d)",
180 rpc_prog_name(prog), prog);
181 proto_tree_add_item(tree, hf_portmap_version, tvb,
182 offset+4, 4, ENC_BIG_ENDIAN);
184 proto = tvb_get_ntohl(tvb, offset+8);
185 proto_tree_add_uint_format(tree, hf_portmap_proto,tvb,
186 offset+8, 4, proto, "Proto: %s (%d)", ipprotostr(proto), proto);
188 proto_tree_add_item(tree, hf_portmap_port, tvb,
189 offset+12, 4, ENC_BIG_ENDIAN);
192 return offset+16;
195 /* Dissect a 'unset' call */
196 static int
197 dissect_unset_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
198 proto_tree *tree, void* data _U_)
200 guint32 proto;
201 guint32 prog;
203 if ( tree )
205 prog = tvb_get_ntohl(tvb, offset+0);
206 proto_tree_add_uint_format_value(tree, hf_portmap_prog, tvb,
207 offset, 4, prog, "%s (%d)",
208 rpc_prog_name(prog), prog);
209 proto_tree_add_item(tree, hf_portmap_version, tvb,
210 offset+4, 4, ENC_BIG_ENDIAN);
212 proto = tvb_get_ntohl(tvb, offset+8);
213 proto_tree_add_uint(tree, hf_portmap_proto, tvb,
214 offset+8, 4, proto);
216 proto_tree_add_item(tree, hf_portmap_port, tvb,
217 offset+12, 4, ENC_BIG_ENDIAN);
220 return offset+16;
223 static int
224 dissect_set_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
225 proto_tree *tree, void* data _U_)
227 offset = dissect_rpc_bool(tvb, tree, hf_portmap_answer,
228 offset);
229 return offset;
232 static int
233 dissect_dump_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
234 proto_tree *tree, void* data _U_)
236 int prog, version, proto, port;
237 proto_item *ti, *subtree;
239 prog = tvb_get_ntohl(tvb, offset+0);
240 version = tvb_get_ntohl(tvb, offset+4);
241 proto = tvb_get_ntohl(tvb, offset+8);
242 port = tvb_get_ntohl(tvb, offset+12);
243 if ( tree )
245 ti = proto_tree_add_text(tree, tvb, offset, 16,
246 "Map Entry: %s (%u) V%d",
247 rpc_prog_name(prog), prog, version);
248 subtree = proto_item_add_subtree(ti, ett_portmap_entry);
250 proto_tree_add_uint_format_value(subtree, hf_portmap_prog, tvb,
251 offset+0, 4, prog,
252 "%s (%u)", rpc_prog_name(prog), prog);
253 proto_tree_add_uint(subtree, hf_portmap_version, tvb,
254 offset+4, 4, version);
255 proto_tree_add_uint_format_value(subtree, hf_portmap_proto, tvb,
256 offset+8, 4, proto,
257 "%s (0x%02x)", ipprotostr(proto), proto);
258 proto_tree_add_uint(subtree, hf_portmap_port, tvb,
259 offset+12, 4, port);
261 offset += 16;
262 return offset;
265 static int
266 dissect_dump_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
267 proto_tree *tree, void* data _U_)
269 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
270 dissect_dump_entry);
271 return offset;
274 /* Dissect a callit call */
275 static int
276 dissect_callit_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
277 proto_tree *tree, void* data _U_)
279 guint32 prog, vers, proc;
281 prog = tvb_get_ntohl(tvb, offset+0);
282 if ( tree )
284 proto_tree_add_uint_format_value(tree, hf_portmap_prog, tvb,
285 offset, 4, prog, "%s (%u)",
286 rpc_prog_name(prog), prog);
289 vers = tvb_get_ntohl(tvb, offset+4);
290 if ( tree )
292 proto_tree_add_uint(tree, hf_portmap_version, tvb,
293 offset+4, 4, vers);
296 proc = tvb_get_ntohl(tvb, offset+8);
297 if ( tree )
299 proto_tree_add_uint_format_value(tree, hf_portmap_proc, tvb,
300 offset+8, 4, proc, "%s (%u)",
301 rpc_proc_name(prog, vers, proc), proc);
304 offset += 12;
306 /* Dissect the arguments for this procedure.
307 Make the columns non-writable, so the dissector won't change
308 them out from under us. */
309 col_set_writable(pinfo->cinfo, FALSE);
310 offset = dissect_rpc_indir_call(tvb, pinfo, tree, offset,
311 hf_portmap_args, prog, vers, proc);
313 return offset;
316 /* Dissect a callit reply */
317 static int
318 dissect_callit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
319 proto_tree *tree, void* data _U_)
321 if ( tree )
323 proto_tree_add_item(tree, hf_portmap_port, tvb,
324 offset, 4, ENC_BIG_ENDIAN);
326 offset += 4;
328 /* Dissect the result of this procedure.
329 Make the columns non-writable, so the dissector won't change
330 them out from under us. */
331 col_set_writable(pinfo->cinfo, FALSE);
332 offset = dissect_rpc_indir_reply(tvb, pinfo, tree, offset,
333 hf_portmap_result, hf_portmap_prog, hf_portmap_version,
334 hf_portmap_proc);
336 return offset;
339 /* proc number, "proc name", dissect_request, dissect_reply */
340 /* NULL as function pointer means: type of arguments is "void". */
341 static const vsff portmap1_proc[] = {
342 { PORTMAPPROC_NULL, "NULL", NULL, NULL },
343 { PORTMAPPROC_SET, "SET", NULL, NULL },
344 { PORTMAPPROC_UNSET, "UNSET", NULL, NULL },
345 { PORTMAPPROC_GETPORT, "GETPORT", NULL, NULL },
346 { PORTMAPPROC_DUMP, "DUMP", NULL, NULL },
347 { PORTMAPPROC_CALLIT, "CALLIT", NULL, NULL },
348 { 0, NULL, NULL, NULL }
350 static const value_string portmap1_proc_vals[] = {
351 { PORTMAPPROC_NULL, "NULL" },
352 { PORTMAPPROC_SET, "SET" },
353 { PORTMAPPROC_UNSET, "UNSET" },
354 { PORTMAPPROC_GETPORT, "GETPORT" },
355 { PORTMAPPROC_DUMP, "DUMP" },
356 { PORTMAPPROC_CALLIT, "CALLIT" },
357 { 0, NULL }
359 /* end of Portmap version 1 */
361 static const vsff portmap2_proc[] = {
362 { PORTMAPPROC_NULL, "NULL",
363 NULL, NULL },
364 { PORTMAPPROC_SET, "SET",
365 dissect_set_call, dissect_set_reply },
366 { PORTMAPPROC_UNSET, "UNSET",
367 dissect_unset_call, dissect_set_reply },
368 { PORTMAPPROC_GETPORT, "GETPORT",
369 dissect_getport_call, dissect_getport_reply },
370 { PORTMAPPROC_DUMP, "DUMP",
371 NULL, dissect_dump_reply },
372 { PORTMAPPROC_CALLIT, "CALLIT",
373 dissect_callit_call, dissect_callit_reply },
374 { 0, NULL, NULL, NULL }
376 static const value_string portmap2_proc_vals[] = {
377 { PORTMAPPROC_NULL, "NULL" },
378 { PORTMAPPROC_SET, "SET" },
379 { PORTMAPPROC_UNSET, "UNSET" },
380 { PORTMAPPROC_GETPORT, "GETPORT" },
381 { PORTMAPPROC_DUMP, "DUMP" },
382 { PORTMAPPROC_CALLIT, "CALLIT" },
383 { 0, NULL }
385 /* end of Portmap version 2 */
388 /* RFC 1833, Page 3 */
389 static int
390 dissect_rpcb(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
392 proto_item* rpcb_item = NULL;
393 proto_tree* rpcb_tree = NULL;
394 int old_offset = offset;
395 guint32 prog;
397 if (tree) {
398 rpcb_item = proto_tree_add_item(tree, hf_portmap_rpcb, tvb,
399 offset, -1, ENC_NA);
400 if (rpcb_item)
401 rpcb_tree = proto_item_add_subtree(rpcb_item, ett_portmap_rpcb);
404 prog = tvb_get_ntohl(tvb, offset);
405 if (rpcb_tree)
406 proto_tree_add_uint_format_value(rpcb_tree, hf_portmap_rpcb_prog, tvb,
407 offset, 4, prog,
408 "%s (%u)", rpc_prog_name(prog), prog);
409 offset += 4;
411 offset = dissect_rpc_uint32(tvb, rpcb_tree,
412 hf_portmap_rpcb_version, offset);
413 offset = dissect_rpc_string(tvb, rpcb_tree,
414 hf_portmap_rpcb_netid, offset, NULL);
415 offset = dissect_rpc_string(tvb, rpcb_tree,
416 hf_portmap_rpcb_addr, offset, NULL);
417 offset = dissect_rpc_string(tvb, rpcb_tree,
418 hf_portmap_rpcb_owner, offset, NULL);
420 /* now we know, that rpcb is shorter */
421 if (rpcb_item) {
422 proto_item_set_len(rpcb_item, offset - old_offset);
425 return offset;
430 /* RFC 1833, Page 7 */
431 static int
432 dissect_rpcb3_getaddr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
433 proto_tree *tree, void* data _U_)
435 offset = dissect_rpcb(tvb, offset, pinfo, tree, data);
437 return offset;
441 /* RFC 1833, Page 7 */
442 static int
443 dissect_rpcb3_getaddr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
444 proto_tree *tree, void* data _U_)
446 offset = dissect_rpc_string(tvb, tree,
447 hf_portmap_uaddr, offset, NULL);
449 return offset;
453 /* RFC 1833, Page 7 */
454 static int
455 dissect_rpcb3_dump_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
456 proto_tree *tree, void* data _U_)
458 offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_rpcb);
459 return offset;
462 /* RFC 1833, page 4 */
463 static int
464 dissect_rpcb_rmtcallres(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
465 proto_tree *tree, void* data _U_)
467 /* Dissect the remote universal address. */
468 offset = dissect_rpc_string(tvb, tree,
469 hf_portmap_rpcb_addr, offset, NULL);
471 /* Dissect the result of this procedure.
472 Make the columns non-writable, so the dissector won't change
473 them out from under us. */
474 col_set_writable(pinfo->cinfo, FALSE);
475 offset = dissect_rpc_indir_reply(tvb, pinfo, tree, offset,
476 hf_portmap_result, hf_portmap_prog, hf_portmap_version,
477 hf_portmap_proc);
479 return offset;
483 /* Portmapper version 3, RFC 1833, Page 7 */
484 static const vsff portmap3_proc[] = {
485 { RPCBPROC_NULL, "NULL",
486 NULL, NULL },
487 { RPCBPROC_SET, "SET",
488 NULL, NULL },
489 { RPCBPROC_UNSET, "UNSET",
490 NULL, NULL },
491 { RPCBPROC_GETADDR, "GETADDR",
492 dissect_rpcb3_getaddr_call, dissect_rpcb3_getaddr_reply},
493 { RPCBPROC_DUMP, "DUMP",
494 NULL, dissect_rpcb3_dump_reply },
495 { RPCBPROC_CALLIT, "CALLIT",
496 dissect_callit_call, dissect_rpcb_rmtcallres },
497 { RPCBPROC_GETTIME, "GETTIME",
498 NULL, NULL },
499 { RPCBPROC_UADDR2TADDR, "UADDR2TADDR",
500 NULL, NULL },
501 { RPCBPROC_TADDR2UADDR, "TADDR2UADDR",
502 NULL, NULL },
503 { 0, NULL, NULL, NULL }
505 static const value_string portmap3_proc_vals[] = {
506 { RPCBPROC_NULL, "NULL" },
507 { RPCBPROC_SET, "SET" },
508 { RPCBPROC_UNSET, "UNSET" },
509 { RPCBPROC_GETADDR, "GETADDR" },
510 { RPCBPROC_DUMP, "DUMP" },
511 { RPCBPROC_CALLIT, "CALLIT" },
512 { RPCBPROC_GETTIME, "GETTIME" },
513 { RPCBPROC_UADDR2TADDR, "UADDR2TADDR" },
514 { RPCBPROC_TADDR2UADDR, "TADDR2UADDR" },
515 { 0, NULL }
517 /* end of Portmap version 3 */
520 /* Portmapper version 4, RFC 1833, Page 8 */
521 static const vsff portmap4_proc[] = {
522 { RPCBPROC_NULL, "NULL",
523 NULL, NULL },
524 { RPCBPROC_SET, "SET",
525 NULL, NULL },
526 { RPCBPROC_UNSET, "UNSET",
527 NULL, NULL },
528 { RPCBPROC_GETADDR, "GETADDR",
529 dissect_rpcb3_getaddr_call, dissect_rpcb3_getaddr_reply},
530 { RPCBPROC_DUMP, "DUMP",
531 NULL, dissect_rpcb3_dump_reply },
532 { RPCBPROC_BCAST, "BCAST",
533 dissect_callit_call, dissect_rpcb_rmtcallres },
534 { RPCBPROC_GETTIME, "GETTIME",
535 NULL, NULL },
536 { RPCBPROC_UADDR2TADDR, "UADDR2TADDR",
537 NULL, NULL },
538 { RPCBPROC_TADDR2UADDR, "TADDR2UADDR",
539 NULL, NULL },
540 { RPCBPROC_GETVERSADDR, "GETVERSADDR",
541 NULL, NULL },
542 { RPCBPROC_INDIRECT, "INDIRECT",
543 dissect_callit_call, dissect_rpcb_rmtcallres },
544 { RPCBPROC_GETADDRLIST, "GETADDRLIST",
545 NULL, NULL },
546 { RPCBPROC_GETSTAT, "GETSTAT",
547 NULL, NULL },
548 { 0, NULL, NULL, NULL }
550 static const value_string portmap4_proc_vals[] = {
551 { RPCBPROC_NULL, "NULL" },
552 { RPCBPROC_SET, "SET" },
553 { RPCBPROC_UNSET, "UNSET" },
554 { RPCBPROC_GETADDR, "GETADDR" },
555 { RPCBPROC_DUMP, "DUMP" },
556 { RPCBPROC_BCAST, "BCAST" },
557 { RPCBPROC_GETTIME, "GETTIME" },
558 { RPCBPROC_UADDR2TADDR, "UADDR2TADDR" },
559 { RPCBPROC_TADDR2UADDR, "TADDR2UADDR" },
560 { RPCBPROC_GETVERSADDR, "GETVERSADDR" },
561 { RPCBPROC_INDIRECT, "INDIRECT" },
562 { RPCBPROC_GETADDRLIST, "GETADDRLIST" },
563 { RPCBPROC_GETSTAT, "GETSTAT" },
564 { 0, NULL }
566 /* end of Portmap version 4 */
568 void
569 proto_register_portmap(void)
571 static hf_register_info hf[] = {
572 { &hf_portmap_procedure_v1, {
573 "V1 Procedure", "portmap.procedure_v1", FT_UINT32, BASE_DEC,
574 VALS(portmap1_proc_vals), 0, NULL, HFILL }},
575 { &hf_portmap_procedure_v2, {
576 "V2 Procedure", "portmap.procedure_v2", FT_UINT32, BASE_DEC,
577 VALS(portmap2_proc_vals), 0, NULL, HFILL }},
578 { &hf_portmap_procedure_v3, {
579 "V3 Procedure", "portmap.procedure_v3", FT_UINT32, BASE_DEC,
580 VALS(portmap3_proc_vals), 0, NULL, HFILL }},
581 { &hf_portmap_procedure_v4, {
582 "V4 Procedure", "portmap.procedure_v4", FT_UINT32, BASE_DEC,
583 VALS(portmap4_proc_vals), 0, NULL, HFILL }},
584 { &hf_portmap_prog, {
585 "Program", "portmap.prog", FT_UINT32, BASE_DEC,
586 NULL, 0, NULL, HFILL }},
587 { &hf_portmap_port, {
588 "Port", "portmap.port", FT_UINT32, BASE_DEC,
589 NULL, 0, NULL, HFILL }},
590 { &hf_portmap_proc, {
591 "Procedure", "portmap.proc", FT_UINT32, BASE_DEC,
592 NULL, 0, NULL, HFILL }},
593 { &hf_portmap_proto, {
594 "Protocol", "portmap.proto", FT_UINT32, BASE_DEC,
595 NULL, 0, NULL, HFILL }},
596 { &hf_portmap_version, {
597 "Version", "portmap.version", FT_UINT32, BASE_DEC,
598 NULL, 0, NULL, HFILL }},
599 { &hf_portmap_answer, {
600 "Answer", "portmap.answer", FT_BOOLEAN, BASE_NONE,
601 NULL, 0x0, NULL, HFILL }},
602 { &hf_portmap_args, {
603 "Arguments", "portmap.args", FT_BYTES, BASE_NONE,
604 NULL, 0, NULL, HFILL }},
605 { &hf_portmap_result, {
606 "Result", "portmap.result", FT_BYTES, BASE_NONE,
607 NULL, 0, NULL, HFILL }},
608 { &hf_portmap_rpcb, {
609 "RPCB", "portmap.rpcb", FT_NONE, BASE_NONE,
610 NULL, 0, NULL, HFILL }},
611 { &hf_portmap_rpcb_prog, {
612 "Program", "portmap.rpcb.prog", FT_UINT32, BASE_DEC,
613 NULL, 0, NULL, HFILL }},
614 { &hf_portmap_rpcb_version, {
615 "Version", "portmap.rpcb.version", FT_UINT32, BASE_DEC,
616 NULL, 0, NULL, HFILL }},
617 { &hf_portmap_rpcb_netid, {
618 "Network Id", "portmap.rpcb.netid", FT_STRING, BASE_NONE,
619 NULL, 0, NULL, HFILL }},
620 { &hf_portmap_rpcb_addr, { /* address in rpcb structure in request */
621 "Universal Address", "portmap.rpcb.addr", FT_STRING, BASE_NONE,
622 NULL, 0, NULL, HFILL }},
623 { &hf_portmap_rpcb_owner, {
624 "Owner of this Service", "portmap.rpcb.owner", FT_STRING, BASE_NONE,
625 NULL, 0, NULL, HFILL }},
626 { &hf_portmap_uaddr, { /* address in RPCBPROC_GETADDR reply */
627 "Universal Address", "portmap.uaddr", FT_STRING, BASE_NONE,
628 NULL, 0, NULL, HFILL }},
630 static gint *ett[] = {
631 &ett_portmap,
632 &ett_portmap_rpcb,
633 &ett_portmap_entry
636 proto_portmap = proto_register_protocol("Portmap", "Portmap", "portmap");
637 proto_register_field_array(proto_portmap, hf, array_length(hf));
638 proto_register_subtree_array(ett, array_length(ett));
641 void
642 proto_reg_handoff_portmap(void)
644 /* Register the protocol as RPC */
645 rpc_init_prog(proto_portmap, PORTMAP_PROGRAM, ett_portmap);
646 /* Register the procedure tables */
647 rpc_init_proc_table(PORTMAP_PROGRAM, 1, portmap1_proc, hf_portmap_procedure_v1);
648 rpc_init_proc_table(PORTMAP_PROGRAM, 2, portmap2_proc, hf_portmap_procedure_v2);
649 rpc_init_proc_table(PORTMAP_PROGRAM, 3, portmap3_proc, hf_portmap_procedure_v3);
650 rpc_init_proc_table(PORTMAP_PROGRAM, 4, portmap4_proc, hf_portmap_procedure_v4);
651 rpc_handle = find_dissector("rpc");