]> The Tcpdump Group git mirrors - tcpdump/blobdiff - addrtoname.c
Update .gitignore for other configurations
[tcpdump] / addrtoname.c
index d43daac81f6bbb4590ffa5b40bd446a4b89f22b8..cdf8cee0d56043e4b8bf80b4345337c1537c8579 100644 (file)
@@ -269,7 +269,7 @@ extern cap_channel_t *capdns;
  *
  * NOTE: ap is *NOT* necessarily part of the packet data (not even if
  * this is being called with the "ipaddr_string()" macro), so you
- * *CANNOT* use the ND_TCHECK{2}/ND_TTEST{2} macros on it.  Furthermore,
+ * *CANNOT* use the ND_TCHECK_* or ND_TTEST_* macros on it.  Furthermore,
  * even in cases where it *is* part of the packet data, the caller
  * would still have to check for a null return value, even if it's
  * just printing the return value with "%s" - not all versions of
@@ -563,7 +563,7 @@ lookup_protoid(netdissect_options *ndo, const u_char *pi)
 }
 
 const char *
-etheraddr_string(netdissect_options *ndo, const u_char *ep)
+etheraddr_string(netdissect_options *ndo, const uint8_t *ep)
 {
        int i;
        char *cp;
@@ -610,7 +610,7 @@ etheraddr_string(netdissect_options *ndo, const u_char *ep)
 }
 
 const char *
-le64addr_string(netdissect_options *ndo, const u_char *ep)
+le64addr_string(netdissect_options *ndo, const uint8_t *ep)
 {
        const unsigned int len = 8;
        u_int i;
@@ -641,7 +641,7 @@ le64addr_string(netdissect_options *ndo, const u_char *ep)
 }
 
 const char *
-linkaddr_string(netdissect_options *ndo, const u_char *ep,
+linkaddr_string(netdissect_options *ndo, const uint8_t *ep,
                const unsigned int type, const unsigned int len)
 {
        u_int i;
@@ -676,38 +676,9 @@ linkaddr_string(netdissect_options *ndo, const u_char *ep,
        return (tp->bs_name);
 }
 
-const char *
-etherproto_string(netdissect_options *ndo, u_short port)
-{
-       char *cp;
-       struct hnamemem *tp;
-       uint32_t i = port;
-       char buf[sizeof("0000")];
-
-       for (tp = &eprototable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
-               if (tp->addr == i)
-                       return (tp->name);
-
-       tp->addr = i;
-       tp->nxt = newhnamemem(ndo);
-
-       cp = buf;
-       NTOHS(port);
-       *cp++ = hex[port >> 12 & 0xf];
-       *cp++ = hex[port >> 8 & 0xf];
-       *cp++ = hex[port >> 4 & 0xf];
-       *cp++ = hex[port & 0xf];
-       *cp++ = '\0';
-       tp->name = strdup(buf);
-       if (tp->name == NULL)
-               (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
-                                 "etherproto_string: strdup(buf)");
-       return (tp->name);
-}
-
 #define ISONSAP_MAX_LENGTH 20
 const char *
-isonsap_string(netdissect_options *ndo, const u_char *nsap,
+isonsap_string(netdissect_options *ndo, const uint8_t *nsap,
               u_int nsap_length)
 {
        u_int nsap_idx;
@@ -731,7 +702,7 @@ isonsap_string(netdissect_options *ndo, const u_char *nsap,
                *cp++ = hex[*nsap++ & 0xf];
                if (((nsap_idx & 1) == 0) &&
                     (nsap_idx + 1 < nsap_length)) {
-                       *cp++ = '.';
+                       *cp++ = '.';
                }
        }
        *cp = '\0';