From 281e9d71408deb6e8c5046c746c2e97002b0e7fe Mon Sep 17 00:00:00 2001 From: bms Date: Wed, 31 Mar 2004 09:17:26 +0000 Subject: Import tcpdump 3.8.3, from http://www.tcpdump.org/releases/tcpdump-3.8.3.tar.gz --- contrib/tcpdump/print-sunrpc.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'contrib/tcpdump/print-sunrpc.c') diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c index 968a68c..3ac556a 100644 --- a/contrib/tcpdump/print-sunrpc.c +++ b/contrib/tcpdump/print-sunrpc.c @@ -20,33 +20,30 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.39.6.1 2002/06/01 23:51:16 guy Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.43.2.2 2003/11/16 08:51:47 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include -#include -#include - -#include +#include #include #ifdef HAVE_RPC_RPCENT_H #include #endif +#ifndef WIN32 #include +#endif /* WIN32 */ -#include -#include #include #include #include "interface.h" #include "addrtoname.h" +#include "extract.h" #include "ip.h" #ifdef INET6 @@ -82,11 +79,11 @@ sunrpcrequest_print(register const u_char *bp, register u_int length, if (!nflag) { snprintf(srcid, sizeof(srcid), "0x%x", - (u_int32_t)ntohl(rp->rm_xid)); + EXTRACT_32BITS(&rp->rm_xid)); strlcpy(dstid, "sunrpc", sizeof(dstid)); } else { snprintf(srcid, sizeof(srcid), "0x%x", - (u_int32_t)ntohl(rp->rm_xid)); + EXTRACT_32BITS(&rp->rm_xid)); snprintf(dstid, sizeof(dstid), "0x%x", PMAPPORT); } @@ -111,23 +108,23 @@ sunrpcrequest_print(register const u_char *bp, register u_int length, } printf(" %s", tok2str(proc2str, " proc #%u", - (u_int32_t)ntohl(rp->rm_call.cb_proc))); - x = ntohl(rp->rm_call.cb_rpcvers); + EXTRACT_32BITS(&rp->rm_call.cb_proc))); + x = EXTRACT_32BITS(&rp->rm_call.cb_rpcvers); if (x != 2) printf(" [rpcver %u]", x); - switch (ntohl(rp->rm_call.cb_proc)) { + switch (EXTRACT_32BITS(&rp->rm_call.cb_proc)) { case PMAPPROC_SET: case PMAPPROC_UNSET: case PMAPPROC_GETPORT: case PMAPPROC_CALLIT: - x = ntohl(rp->rm_call.cb_prog); + x = EXTRACT_32BITS(&rp->rm_call.cb_prog); if (!nflag) printf(" %s", progstr(x)); else printf(" %u", x); - printf(".%u", (u_int32_t)ntohl(rp->rm_call.cb_vers)); + printf(".%u", EXTRACT_32BITS(&rp->rm_call.cb_vers)); break; } } @@ -136,16 +133,22 @@ static char * progstr(prog) u_int32_t prog; { +#ifndef WIN32 register struct rpcent *rp; +#endif static char buf[32]; - static int lastprog = 0; + static u_int32_t lastprog = 0; if (lastprog != 0 && prog == lastprog) return (buf); +#ifndef WIN32 rp = getrpcbynumber(prog); if (rp == NULL) +#endif /* WIN32 */ (void) snprintf(buf, sizeof(buf), "#%u", prog); +#ifndef WIN32 else strlcpy(buf, rp->r_name, sizeof(buf)); +#endif return (buf); } -- cgit v1.1