diff options
author | guy <guy> | 2004-12-27 00:41:29 +0000 |
---|---|---|
committer | guy <guy> | 2004-12-27 00:41:29 +0000 |
commit | af0a0390800cfa503d499b77a1545639284ebbc6 (patch) | |
tree | baf46552e1af0202f779610380b739ec74c4b3bc /print-sunrpc.c | |
parent | 5561f2117cbcadfa9f82ea5f7e44cf789203df26 (diff) | |
download | tcpdump-af0a0390800cfa503d499b77a1545639284ebbc6.tar.gz |
Have our own headers to declare the format of ONC (Sun) RPC messages on
the wire; the definitions in many systems use u_long, which is 64 bits
long on many platforms - that's OK for in-memory structures, but it
doesn't match what's on the wire. Use headers based on the Sun ones,
but use u_int32_t for fields, and otherwise make the structures match
what's on the wire, and change some names to avoid collision with
<rpc/rpc.h>, which print-sunrpc.c includes to declare "getrpcbynumber()"
and the structure it returns.
Record whether "getrpcbynumber()" is found, and use it only if it's
found, rather than basing the decisison on whether we're building for
Win32 or not.
Diffstat (limited to 'print-sunrpc.c')
-rw-r--r-- | print-sunrpc.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/print-sunrpc.c b/print-sunrpc.c index b0a3a2d0..58e6112a 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.45 2003-11-16 09:36:39 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.46 2004-12-27 00:41:31 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -30,13 +30,12 @@ static const char rcsid[] _U_ = #include <tcpdump-stdinc.h> +#ifdef HAVE_GETRPCBYNUMBER #include <rpc/rpc.h> #ifdef HAVE_RPC_RPCENT_H #include <rpc/rpcent.h> -#endif -#ifndef WIN32 -#include <rpc/pmap_prot.h> -#endif /* WIN32 */ +#endif /* HAVE_RPC_RPCENT_H */ +#endif /* HAVE_GETRPCBYNUMBER */ #include <stdio.h> #include <string.h> @@ -50,6 +49,10 @@ static const char rcsid[] _U_ = #include "ip6.h" #endif +#include "rpc_auth.h" +#include "rpc_msg.h" +#include "pmap_prot.h" + static struct tok proc2str[] = { { PMAPPROC_NULL, "null" }, { PMAPPROC_SET, "set" }, @@ -67,7 +70,7 @@ void sunrpcrequest_print(register const u_char *bp, register u_int length, register const u_char *bp2) { - register const struct rpc_msg *rp; + register const struct sunrpc_msg *rp; register const struct ip *ip; #ifdef INET6 register const struct ip6_hdr *ip6; @@ -75,7 +78,7 @@ sunrpcrequest_print(register const u_char *bp, register u_int length, u_int32_t x; char srcid[20], dstid[20]; /*fits 32bit*/ - rp = (struct rpc_msg *)bp; + rp = (struct sunrpc_msg *)bp; if (!nflag) { snprintf(srcid, sizeof(srcid), "0x%x", @@ -133,7 +136,7 @@ static char * progstr(prog) u_int32_t prog; { -#ifndef WIN32 +#ifdef HAVE_GETRPCBYNUMBER register struct rpcent *rp; #endif static char buf[32]; @@ -141,12 +144,12 @@ progstr(prog) if (lastprog != 0 && prog == lastprog) return (buf); -#ifndef WIN32 +#ifdef HAVE_GETRPCBYNUMBER rp = getrpcbynumber(prog); if (rp == NULL) -#endif /* WIN32 */ +#endif (void) snprintf(buf, sizeof(buf), "#%u", prog); -#ifndef WIN32 +#ifdef HAVE_GETRPCBYNUMBER else strlcpy(buf, rp->r_name, sizeof(buf)); #endif |