print-sunrpc.c (127675) | print-sunrpc.c (146778) |
---|---|
1/* 2 * Copyright (c) 1992, 1993, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 4 unchanged lines hidden (view full) --- 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * | 1/* 2 * Copyright (c) 1992, 1993, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 4 unchanged lines hidden (view full) --- 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * |
21 * $FreeBSD: head/contrib/tcpdump/print-sunrpc.c 127675 2004-03-31 14:57:24Z bms $ | 21 * $FreeBSD: head/contrib/tcpdump/print-sunrpc.c 146778 2005-05-29 19:09:28Z sam $ |
22 */ 23 24#ifndef lint 25static const char rcsid[] _U_ = | 22 */ 23 24#ifndef lint 25static const char rcsid[] _U_ = |
26 "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.43.2.2 2003/11/16 08:51:47 guy Exp $ (LBL)"; | 26 "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.46 2004/12/27 00:41:31 guy Exp $ (LBL)"; |
27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include <tcpdump-stdinc.h> 34 | 27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include <tcpdump-stdinc.h> 34 |
35#ifdef HAVE_GETRPCBYNUMBER |
|
35#include <rpc/rpc.h> 36#ifdef HAVE_RPC_RPCENT_H 37#include <rpc/rpcent.h> | 36#include <rpc/rpc.h> 37#ifdef HAVE_RPC_RPCENT_H 38#include <rpc/rpcent.h> |
38#endif 39#ifndef WIN32 40#include <rpc/pmap_prot.h> 41#endif /* WIN32 */ | 39#endif /* HAVE_RPC_RPCENT_H */ 40#endif /* HAVE_GETRPCBYNUMBER */ |
42 43#include <stdio.h> 44#include <string.h> 45 46#include "interface.h" 47#include "addrtoname.h" 48#include "extract.h" 49 50#include "ip.h" 51#ifdef INET6 52#include "ip6.h" 53#endif 54 | 41 42#include <stdio.h> 43#include <string.h> 44 45#include "interface.h" 46#include "addrtoname.h" 47#include "extract.h" 48 49#include "ip.h" 50#ifdef INET6 51#include "ip6.h" 52#endif 53 |
54#include "rpc_auth.h" 55#include "rpc_msg.h" 56 |
|
55static struct tok proc2str[] = { 56 { PMAPPROC_NULL, "null" }, 57 { PMAPPROC_SET, "set" }, 58 { PMAPPROC_UNSET, "unset" }, 59 { PMAPPROC_GETPORT, "getport" }, 60 { PMAPPROC_DUMP, "dump" }, 61 { PMAPPROC_CALLIT, "call" }, 62 { 0, NULL } 63}; 64 65/* Forwards */ 66static char *progstr(u_int32_t); 67 68void 69sunrpcrequest_print(register const u_char *bp, register u_int length, 70 register const u_char *bp2) 71{ | 57static struct tok proc2str[] = { 58 { PMAPPROC_NULL, "null" }, 59 { PMAPPROC_SET, "set" }, 60 { PMAPPROC_UNSET, "unset" }, 61 { PMAPPROC_GETPORT, "getport" }, 62 { PMAPPROC_DUMP, "dump" }, 63 { PMAPPROC_CALLIT, "call" }, 64 { 0, NULL } 65}; 66 67/* Forwards */ 68static char *progstr(u_int32_t); 69 70void 71sunrpcrequest_print(register const u_char *bp, register u_int length, 72 register const u_char *bp2) 73{ |
72 register const struct rpc_msg *rp; | 74 register const struct sunrpc_msg *rp; |
73 register const struct ip *ip; 74#ifdef INET6 75 register const struct ip6_hdr *ip6; 76#endif 77 u_int32_t x; 78 char srcid[20], dstid[20]; /*fits 32bit*/ 79 | 75 register const struct ip *ip; 76#ifdef INET6 77 register const struct ip6_hdr *ip6; 78#endif 79 u_int32_t x; 80 char srcid[20], dstid[20]; /*fits 32bit*/ 81 |
80 rp = (struct rpc_msg *)bp; | 82 rp = (struct sunrpc_msg *)bp; |
81 82 if (!nflag) { 83 snprintf(srcid, sizeof(srcid), "0x%x", 84 EXTRACT_32BITS(&rp->rm_xid)); 85 strlcpy(dstid, "sunrpc", sizeof(dstid)); 86 } else { 87 snprintf(srcid, sizeof(srcid), "0x%x", 88 EXTRACT_32BITS(&rp->rm_xid)); --- 41 unchanged lines hidden (view full) --- 130 break; 131 } 132} 133 134static char * 135progstr(prog) 136 u_int32_t prog; 137{ | 83 84 if (!nflag) { 85 snprintf(srcid, sizeof(srcid), "0x%x", 86 EXTRACT_32BITS(&rp->rm_xid)); 87 strlcpy(dstid, "sunrpc", sizeof(dstid)); 88 } else { 89 snprintf(srcid, sizeof(srcid), "0x%x", 90 EXTRACT_32BITS(&rp->rm_xid)); --- 41 unchanged lines hidden (view full) --- 132 break; 133 } 134} 135 136static char * 137progstr(prog) 138 u_int32_t prog; 139{ |
138#ifndef WIN32 | 140#ifdef HAVE_GETRPCBYNUMBER |
139 register struct rpcent *rp; 140#endif 141 static char buf[32]; 142 static u_int32_t lastprog = 0; 143 144 if (lastprog != 0 && prog == lastprog) 145 return (buf); | 141 register struct rpcent *rp; 142#endif 143 static char buf[32]; 144 static u_int32_t lastprog = 0; 145 146 if (lastprog != 0 && prog == lastprog) 147 return (buf); |
146#ifndef WIN32 | 148#ifdef HAVE_GETRPCBYNUMBER |
147 rp = getrpcbynumber(prog); 148 if (rp == NULL) | 149 rp = getrpcbynumber(prog); 150 if (rp == NULL) |
149#endif /* WIN32 */ | 151#endif |
150 (void) snprintf(buf, sizeof(buf), "#%u", prog); | 152 (void) snprintf(buf, sizeof(buf), "#%u", prog); |
151#ifndef WIN32 | 153#ifdef HAVE_GETRPCBYNUMBER |
152 else 153 strlcpy(buf, rp->r_name, sizeof(buf)); 154#endif 155 return (buf); 156} | 154 else 155 strlcpy(buf, rp->r_name, sizeof(buf)); 156#endif 157 return (buf); 158} |