]> The Tcpdump Group git mirrors - tcpdump/blobdiff - parsenfsfh.c
Default to first interface from pcap_findalldevs()
[tcpdump] / parsenfsfh.c
index 923b063a5585bce8740e12c1353c839acfc7dbd2..a2bfc1c42e6928bc8805838e13445eba34568b6e 100644 (file)
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 #include <stdio.h>
 #include <string.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "nfsfh.h"
 
 /*
@@ -78,7 +78,7 @@
 
 #ifdef ultrix
 /* Nasty hack to keep the Ultrix C compiler from emitting bogus warnings */
-#define        XFF(x)  ((u_int32_t)(x))
+#define        XFF(x)  ((uint32_t)(x))
 #else
 #define        XFF(x)  (x)
 #endif
 static int is_UCX(const unsigned char *);
 
 void
-Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
-register const unsigned char *fh;
-int len _U_;
-my_fsid *fsidp;
-u_int32_t *inop;
-const char **osnamep;          /* if non-NULL, return OS name here */
-const char **fsnamep;          /* if non-NULL, return server fs name here (for VMS) */
-int ourself;           /* true if file handle was generated on this host */
+Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
+        uint32_t *inop,
+        const char **osnamep, /* if non-NULL, return OS name here */
+        const char **fsnamep, /* if non-NULL, return server fs name here (for VMS) */
+        int ourself)   /* true if file handle was generated on this host */
 {
        register const unsigned char *fhp = fh;
-       u_int32_t temp;
+       uint32_t temp;
        int fhtype = FHT_UNKNOWN;
        int i;
 
@@ -363,13 +360,13 @@ int ourself;              /* true if file handle was generated on this host */
                if (sizeof(*fsidp) > 14)
                    memset((char *)fsidp, 0, sizeof(*fsidp));
                /* just use the whole thing */
-               memcpy((char *)fsidp, (char *)fh, 14);
+               memcpy((char *)fsidp, (const char *)fh, 14);
            }
            else {
-               u_int32_t tempa[4];     /* at least 16 bytes, maybe more */
+               uint32_t tempa[4];      /* at least 16 bytes, maybe more */
 
                memset((char *)tempa, 0, sizeof(tempa));
-               memcpy((char *)tempa, (char *)fh, 14); /* ensure alignment */
+               memcpy((char *)tempa, (const char *)fh, 14); /* ensure alignment */
                fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
                fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
                fsidp->fsid_code = 0;
@@ -380,7 +377,7 @@ int ourself;                /* true if file handle was generated on this host */
 
            /* Caller must save (and null-terminate?) this value */
            if (fsnamep)
-               *fsnamep = (char *)&(fhp[1]);
+               *fsnamep = (const char *)&(fhp[1]);
 
            if (osnamep)
                *osnamep = "VMS";
@@ -445,14 +442,13 @@ int ourself;              /* true if file handle was generated on this host */
  *     (3) followed by string of nulls
  */
 static int
-is_UCX(fhp)
-const unsigned char *fhp;
+is_UCX(const unsigned char *fhp)
 {
        register int i;
        int seen_null = 0;
 
        for (i = 1; i < 14; i++) {
-           if (isprint(fhp[i])) {
+           if (ND_ISPRINT(fhp[i])) {
                if (seen_null)
                   return(0);
                else