summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-sunrpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcpdump/print-sunrpc.c')
-rw-r--r--contrib/tcpdump/print-sunrpc.c37
1 files changed, 20 insertions, 17 deletions
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 <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
+#include <tcpdump-stdinc.h>
#include <rpc/rpc.h>
#ifdef HAVE_RPC_RPCENT_H
#include <rpc/rpcent.h>
#endif
+#ifndef WIN32
#include <rpc/pmap_prot.h>
+#endif /* WIN32 */
-#include <ctype.h>
-#include <netdb.h>
#include <stdio.h>
#include <string.h>
#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);
}
OpenPOWER on IntegriCloud