diff options
author | Nathan Neulinger <nneul@umr.edu> | 1999-11-11 21:22:00 +0000 |
---|---|---|
committer | Nathan Neulinger <nneul@umr.edu> | 1999-11-11 21:22:00 +0000 |
commit | 59bffe6e97d173586046f2205acf94a712643b2f (patch) | |
tree | eae35a570c67cf23c47c12709447482c9f1b3a6a /packet-portmap.c | |
parent | 1d554ab6c9ab6d5383f02f7b10bd775bda8fcefc (diff) |
Added mount dissector.
Added stat dissector.
Enhancements to portmap dissector.
Added rpc_prog_name function to packet-rpc to retrieve the name of an
rpc program. This should likely eventually be modified to use the
/etc/rpc or rpc.bynumber NIS maps in addition to the programs that
are registered within ethereal.
svn path=/trunk/; revision=1016
Diffstat (limited to 'packet-portmap.c')
-rw-r--r-- | packet-portmap.c | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/packet-portmap.c b/packet-portmap.c index e6ffb4321d..3f69f5d510 100644 --- a/packet-portmap.c +++ b/packet-portmap.c @@ -1,7 +1,7 @@ /* packet-portmap.c * Routines for portmap dissection * - * $Id: packet-portmap.c,v 1.4 1999/11/11 20:18:46 nneul Exp $ + * $Id: packet-portmap.c,v 1.5 1999/11/11 21:21:59 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -43,40 +43,46 @@ static int hf_portmap_prog = -1; static int hf_portmap_proc = -1; static int hf_portmap_version = -1; static int hf_portmap_port = -1; +static int hf_portmap_answer = -1; /* Dissect a getport call */ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 proto; - if ( !BYTES_ARE_IN_FRAME(offset, 12)) return offset; + guint32 prog; + if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) { - proto_tree_add_item(tree, hf_portmap_prog, - offset, 4, pntohl(&pd[offset+0])); + prog = pntohl(&pd[offset+0]); + proto_tree_add_item_format(tree, hf_portmap_prog, + offset, 4, prog, "Program: %s (%d)", + rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); proto = pntohl(&pd[offset+8]); proto_tree_add_item_format(tree, hf_portmap_proto, offset+8, 4, proto, "Proto: %s (%d)", ipprotostr(proto), proto); + + proto_tree_add_item(tree, hf_portmap_port, + offset+12, 4, pntohl(&pd[offset+12])); } - return offset+12; + return offset+16; } int dissect_getport_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; if ( tree ) { - if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; - proto_tree_add_item(tree, hf_portmap_port, offset, 4, pntohl(&pd[offset+0])); } - return offset; + return offset+=4; } /* Dissect a 'set' call */ @@ -84,12 +90,15 @@ int dissect_set_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 proto; + guint32 prog; if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) { - proto_tree_add_item(tree, hf_portmap_prog, - offset, 4, pntohl(&pd[offset+0])); + prog = pntohl(&pd[offset+0]); + proto_tree_add_item_format(tree, hf_portmap_prog, + offset, 4, prog, "Program: %s (%d)", + rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); @@ -109,12 +118,15 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 proto; + guint32 prog; if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) { - proto_tree_add_item(tree, hf_portmap_prog, - offset, 4, pntohl(&pd[offset+0])); + prog = pntohl(&pd[offset+0]); + proto_tree_add_item_format(tree, hf_portmap_prog, + offset, 4, prog, "Program: %s (%d)", + rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); @@ -129,6 +141,19 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, return offset+16; } +int dissect_set_reply(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree) +{ + if ( tree ) + { + if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; + + proto_tree_add_item(tree, hf_portmap_answer, + offset, 4, pntohl(&pd[offset+0])); + offset += 4; + } + return offset; +} /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ @@ -147,9 +172,9 @@ const vsff portmap2_proc[] = { { PORTMAPPROC_NULL, "NULL", NULL, NULL }, { PORTMAPPROC_SET, "SET", - dissect_set_call, NULL }, + dissect_set_call, dissect_set_reply }, { PORTMAPPROC_UNSET, "UNSET", - dissect_unset_call, NULL }, + dissect_unset_call, dissect_set_reply }, { PORTMAPPROC_GETPORT, "GETPORT", dissect_getport_call, dissect_getport_reply }, { PORTMAPPROC_DUMP, "DUMP", @@ -180,6 +205,9 @@ proto_register_portmap(void) { &hf_portmap_version, { "Version", "portmap.version", FT_UINT32, BASE_DEC, NULL, 0, "Version" }}, + { &hf_portmap_answer, { + "Answer", "portmap.answer", FT_BOOLEAN, BASE_DEC, + NULL, 0, "Answer" }}, }; proto_portmap = proto_register_protocol("Portmap", "portmap"); |