Deleted Added
full compact
parsenfsfh.c (98527) parsenfsfh.c (127675)
1/*
2 * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation,
3 * Western Research Laboratory. All rights reserved.
4 * Copyright (c) 2001 Compaq Computer Corporation. All rights reserved.
5 *
6 * Permission to use, copy, and modify this software and its
7 * documentation is hereby granted only under the following terms and
8 * conditions. Both the above copyright notice and this permission

--- 25 unchanged lines hidden (view full) ---

34/*
35 * parsenfsfh.c - portable parser for NFS file handles
36 * uses all sorts of heuristics
37 *
38 * Jeffrey C. Mogul
39 * Digital Equipment Corporation
40 * Western Research Laboratory
41 *
1/*
2 * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation,
3 * Western Research Laboratory. All rights reserved.
4 * Copyright (c) 2001 Compaq Computer Corporation. All rights reserved.
5 *
6 * Permission to use, copy, and modify this software and its
7 * documentation is hereby granted only under the following terms and
8 * conditions. Both the above copyright notice and this permission

--- 25 unchanged lines hidden (view full) ---

34/*
35 * parsenfsfh.c - portable parser for NFS file handles
36 * uses all sorts of heuristics
37 *
38 * Jeffrey C. Mogul
39 * Digital Equipment Corporation
40 * Western Research Laboratory
41 *
42 * $FreeBSD: head/contrib/tcpdump/parsenfsfh.c 98527 2002-06-21 00:49:02Z fenner $
42 * $FreeBSD: head/contrib/tcpdump/parsenfsfh.c 127675 2004-03-31 14:57:24Z bms $
43 */
44
45#ifndef lint
43 */
44
45#ifndef lint
46static const char rcsid[] =
47 "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.23 2001/09/17 21:57:53 fenner Exp $ (LBL)";
46static const char rcsid[] _U_ =
47 "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.25.2.2 2003/11/16 08:51:07 guy Exp $ (LBL)";
48#endif
49
50#ifdef HAVE_CONFIG_H
51#include "config.h"
52#endif
53
48#endif
49
50#ifdef HAVE_CONFIG_H
51#include "config.h"
52#endif
53
54#include <sys/types.h>
55#include <sys/time.h>
54#include <tcpdump-stdinc.h>
56
55
57#include <ctype.h>
58#include <stdio.h>
59#include <string.h>
60
61#include "interface.h"
62#include "nfsfh.h"
63
64/*
65 * This routine attempts to parse a file handle (in network byte order),

--- 39 unchanged lines hidden (view full) ---

105#define make_uint48(msb,b,c,d,e,lsb)\
106 ((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24) + ((b)<<32) + ((msb)<<40))
107#else
108 /* on 32-bit systems ignore high-order bits */
109#define make_uint48(msb,b,c,d,e,lsb)\
110 ((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24))
111#endif
112
56#include <stdio.h>
57#include <string.h>
58
59#include "interface.h"
60#include "nfsfh.h"
61
62/*
63 * This routine attempts to parse a file handle (in network byte order),

--- 39 unchanged lines hidden (view full) ---

103#define make_uint48(msb,b,c,d,e,lsb)\
104 ((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24) + ((b)<<32) + ((msb)<<40))
105#else
106 /* on 32-bit systems ignore high-order bits */
107#define make_uint48(msb,b,c,d,e,lsb)\
108 ((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24))
109#endif
110
113static int is_UCX(unsigned char *);
111static int is_UCX(const unsigned char *);
114
115void
116Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
112
113void
114Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
117register caddr_t *fh;
115register const unsigned char *fh;
118int len;
119my_fsid *fsidp;
120ino_t *inop;
121const char **osnamep; /* if non-NULL, return OS name here */
122const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */
123int ourself; /* true if file handle was generated on this host */
124{
116int len;
117my_fsid *fsidp;
118ino_t *inop;
119const char **osnamep; /* if non-NULL, return OS name here */
120const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */
121int ourself; /* true if file handle was generated on this host */
122{
125 register unsigned char *fhp = (unsigned char *)fh;
123 register const unsigned char *fhp = fh;
126 u_int32_t temp;
127 int fhtype = FHT_UNKNOWN;
128 int i;
129
130 if (ourself) {
131 /* File handle generated on this host, no need for guessing */
132#if defined(IRIX40)
133 fhtype = FHT_IRIX4;

--- 299 unchanged lines hidden (view full) ---

433 * Is this a VMS UCX file handle?
434 * Check for:
435 * (1) leading code byte [XXX not yet]
436 * (2) followed by string of printing chars & spaces
437 * (3) followed by string of nulls
438 */
439static int
440is_UCX(fhp)
124 u_int32_t temp;
125 int fhtype = FHT_UNKNOWN;
126 int i;
127
128 if (ourself) {
129 /* File handle generated on this host, no need for guessing */
130#if defined(IRIX40)
131 fhtype = FHT_IRIX4;

--- 299 unchanged lines hidden (view full) ---

431 * Is this a VMS UCX file handle?
432 * Check for:
433 * (1) leading code byte [XXX not yet]
434 * (2) followed by string of printing chars & spaces
435 * (3) followed by string of nulls
436 */
437static int
438is_UCX(fhp)
441unsigned char *fhp;
439const unsigned char *fhp;
442{
443 register int i;
444 int seen_null = 0;
445
446 for (i = 1; i < 14; i++) {
447 if (isprint(fhp[i])) {
448 if (seen_null)
449 return(0);

--- 13 unchanged lines hidden ---
440{
441 register int i;
442 int seen_null = 0;
443
444 for (i = 1; i < 14; i++) {
445 if (isprint(fhp[i])) {
446 if (seen_null)
447 return(0);

--- 13 unchanged lines hidden ---