]> The Tcpdump Group git mirrors - tcpdump/commitdiff
NDOize the rest of util.c
authorDenis Ovsienko <[email protected]>
Mon, 14 Apr 2014 06:53:46 +0000 (10:53 +0400)
committerDenis Ovsienko <[email protected]>
Mon, 14 Apr 2014 06:53:46 +0000 (10:53 +0400)
20 files changed:
interface.h
netdissect.h
print-802_11.c
print-bootp.c
print-cdp.c
print-domain.c
print-hsrp.c
print-ipx.c
print-nfs.c
print-ntp.c
print-olsr.c
print-openflow-1.0.c
print-ppp.c
print-rx.c
print-snmp.c
print-tftp.c
print-timed.c
print-vrrp.c
print-wb.c
util.c

index 27563683b5a48ed587ac738d4e013c33ff2a6cb9..37053496eb577907df3f416b1e52969d624b76bf 100644 (file)
@@ -117,9 +117,6 @@ extern int32_t thiszone;    /* seconds offset from gmt to local time */
 /* Bail if "var" was not captured */
 #define TCHECK(var) TCHECK2(var, sizeof(var))
 
 /* Bail if "var" was not captured */
 #define TCHECK(var) TCHECK2(var, sizeof(var))
 
-extern int fn_print(const u_char *, const u_char *);
-extern int fn_printn(const u_char *, u_int, const u_char *);
-extern int fn_printzp(const u_char *, u_int, const u_char *);
 extern int mask2plen(u_int32_t);
 extern const char *tok2strary_internal(const char **, int, const char *, int);
 #define        tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
 extern int mask2plen(u_int32_t);
 extern const char *tok2strary_internal(const char **, int, const char *, int);
 #define        tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
index cbc8bbc1f89d7b3a8d7a97d93107f79e41eaedca..f1374e444432f5e1529e7a46f3892b8786b9a356 100644 (file)
@@ -255,8 +255,9 @@ struct netdissect_options {
 extern void ts_print(netdissect_options *, const struct timeval *);
 extern void relts_print(netdissect_options *, int);
 
 extern void ts_print(netdissect_options *, const struct timeval *);
 extern void relts_print(netdissect_options *, int);
 
-extern int fn_print(const u_char *, const u_char *);
-extern int fn_printn(const u_char *, u_int, const u_char *);
+extern int fn_print(netdissect_options *, const u_char *, const u_char *);
+extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *);
+extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
 extern const char *tok2str(const struct tok *, const char *, int);
 
 #if 0
 extern const char *tok2str(const struct tok *, const char *, int);
 
 #if 0
index 45534041536bc97783529604f25315be37f5a7f0..c94cc0dda955980d1107ab76af12df7b5d100eb2 100644 (file)
@@ -697,7 +697,7 @@ struct radiotap_state
 #define PRINT_SSID(p) \
        if (p.ssid_present) { \
                ND_PRINT((ndo, " (")); \
 #define PRINT_SSID(p) \
        if (p.ssid_present) { \
                ND_PRINT((ndo, " (")); \
-               fn_print(p.ssid.ssid, NULL); \
+               fn_print(ndo, p.ssid.ssid, NULL); \
                ND_PRINT((ndo, ")")); \
        }
 
                ND_PRINT((ndo, ")")); \
        }
 
index 7d08e22e3fcea539b6a21eaf8e5cadb75477a5ac..5e7e9a999edb38b67396236c0f7f3b692d24dcbc 100644 (file)
@@ -131,7 +131,7 @@ bootp_print(netdissect_options *ndo,
        ND_TCHECK2(bp->bp_sname[0], 1);         /* check first char only */
        if (*bp->bp_sname) {
                ND_PRINT((ndo, "\n\t  sname \""));
        ND_TCHECK2(bp->bp_sname[0], 1);         /* check first char only */
        if (*bp->bp_sname) {
                ND_PRINT((ndo, "\n\t  sname \""));
-               if (fn_print(bp->bp_sname, ndo->ndo_snapend)) {
+               if (fn_print(ndo, bp->bp_sname, ndo->ndo_snapend)) {
                        ND_PRINT((ndo, "\""));
                        ND_PRINT((ndo, "%s", tstr + 1));
                        return;
                        ND_PRINT((ndo, "\""));
                        ND_PRINT((ndo, "%s", tstr + 1));
                        return;
@@ -141,7 +141,7 @@ bootp_print(netdissect_options *ndo,
        ND_TCHECK2(bp->bp_file[0], 1);          /* check first char only */
        if (*bp->bp_file) {
                ND_PRINT((ndo, "\n\t  file \""));
        ND_TCHECK2(bp->bp_file[0], 1);          /* check first char only */
        if (*bp->bp_file) {
                ND_PRINT((ndo, "\n\t  file \""));
-               if (fn_print(bp->bp_file, ndo->ndo_snapend)) {
+               if (fn_print(ndo, bp->bp_file, ndo->ndo_snapend)) {
                        ND_PRINT((ndo, "\""));
                        ND_PRINT((ndo, "%s", tstr + 1));
                        return;
                        ND_PRINT((ndo, "\""));
                        ND_PRINT((ndo, "%s", tstr + 1));
                        return;
@@ -475,7 +475,7 @@ rfc1048_print(netdissect_options *ndo,
                case 'a':
                        /* ascii strings */
                        ND_PRINT((ndo, "\""));
                case 'a':
                        /* ascii strings */
                        ND_PRINT((ndo, "\""));
-                       if (fn_printn(bp, len, ndo->ndo_snapend)) {
+                       if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) {
                                ND_PRINT((ndo, "\""));
                                goto trunc;
                        }
                                ND_PRINT((ndo, "\""));
                                goto trunc;
                        }
@@ -617,7 +617,7 @@ rfc1048_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, "%u/%u ", *bp, *(bp+1)));
                                bp += 2;
                                ND_PRINT((ndo, "\""));
                                        ND_PRINT((ndo, "%u/%u ", *bp, *(bp+1)));
                                bp += 2;
                                ND_PRINT((ndo, "\""));
-                               if (fn_printn(bp, len - 3, ndo->ndo_snapend)) {
+                               if (fn_printn(ndo, bp, len - 3, ndo->ndo_snapend)) {
                                        ND_PRINT((ndo, "\""));
                                        goto trunc;
                                }
                                        ND_PRINT((ndo, "\""));
                                        goto trunc;
                                }
@@ -639,7 +639,7 @@ rfc1048_print(netdissect_options *ndo,
                                len--;
                                if (type == 0) {
                                        ND_PRINT((ndo, "\""));
                                len--;
                                if (type == 0) {
                                        ND_PRINT((ndo, "\""));
-                                       if (fn_printn(bp, len, ndo->ndo_snapend)) {
+                                       if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) {
                                                ND_PRINT((ndo, "\""));
                                                goto trunc;
                                        }
                                                ND_PRINT((ndo, "\""));
                                                goto trunc;
                                        }
@@ -684,7 +684,7 @@ rfc1048_print(netdissect_options *ndo,
                                        case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */
                                        case AGENT_SUBOPTION_REMOTE_ID:
                                        case AGENT_SUBOPTION_SUBSCRIBER_ID:
                                        case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */
                                        case AGENT_SUBOPTION_REMOTE_ID:
                                        case AGENT_SUBOPTION_SUBSCRIBER_ID:
-                                               fn_printn(bp, suboptlen, NULL);
+                                               fn_printn(ndo, bp, suboptlen, NULL);
                                                break;
 
                                        default:
                                                break;
 
                                        default:
index 353ce4c1ed0db0a8554cd3b6080b7ec3bc34dcd4..bb27f0fde332a26c6ae454042312b59bd8e6af29 100644 (file)
@@ -130,7 +130,7 @@ cdp_print(netdissect_options *ndo,
                         if (!ndo->ndo_vflag)
                             ND_PRINT((ndo, ", Device-ID "));
                         ND_PRINT((ndo, "'"));
                         if (!ndo->ndo_vflag)
                             ND_PRINT((ndo, ", Device-ID "));
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x02: /* Address */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x02: /* Address */
@@ -139,7 +139,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x03: /* Port-ID */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x03: /* Port-ID */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x04: /* Capabilities */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x04: /* Capabilities */
@@ -158,7 +158,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x06: /* Platform */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x06: /* Platform */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x07: /* Prefixes */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x07: /* Prefixes */
@@ -169,7 +169,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x09: /* VTP Mgmt Domain  - not documented */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x09: /* VTP Mgmt Domain  - not documented */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x0a: /* Native VLAN ID - not documented */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x0a: /* Native VLAN ID - not documented */
@@ -199,7 +199,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x14: /* System Name - not documented */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x14: /* System Name - not documented */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x16: /* System Object ID - not documented */
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x16: /* System Object ID - not documented */
@@ -210,7 +210,7 @@ cdp_print(netdissect_options *ndo,
                        ND_PRINT((ndo, "0x%02x", *(tptr)));
                        if (len > 1) {
                                ND_PRINT((ndo, "/"));
                        ND_PRINT((ndo, "0x%02x", *(tptr)));
                        if (len > 1) {
                                ND_PRINT((ndo, "/"));
-                               fn_printn(tptr + 1, len - 1, NULL);
+                               fn_printn(ndo, tptr + 1, len - 1, NULL);
                        }
                        break;
                     default:
                        }
                        break;
                     default:
index 001195680f68a54088a9bb4e2c324fb3b8cb4972..45db5c73b14aa638ed90113075e4cb122acda3fe 100644 (file)
@@ -205,7 +205,7 @@ ns_nprint(netdissect_options *ndo,
                                        return(NULL);
                                }
                        } else {
                                        return(NULL);
                                }
                        } else {
-                               if (fn_printn(cp, l, ndo->ndo_snapend))
+                               if (fn_printn(ndo, cp, l, ndo->ndo_snapend))
                                        return(NULL);
                        }
 
                                        return(NULL);
                        }
 
@@ -236,7 +236,7 @@ ns_cprint(netdissect_options *ndo,
        if (!ND_TTEST2(*cp, 1))
                return (NULL);
        i = *cp++;
        if (!ND_TTEST2(*cp, 1))
                return (NULL);
        i = *cp++;
-       if (fn_printn(cp, i, ndo->ndo_snapend))
+       if (fn_printn(ndo, cp, i, ndo->ndo_snapend))
                return (NULL);
        return (cp + i);
 }
                return (NULL);
        return (cp + i);
 }
@@ -535,7 +535,7 @@ ns_rprint(netdissect_options *ndo,
        case T_UNSPECA:         /* One long string */
                if (!ND_TTEST2(*cp, len))
                        return(NULL);
        case T_UNSPECA:         /* One long string */
                if (!ND_TTEST2(*cp, len))
                        return(NULL);
-               if (fn_printn(cp, len, ndo->ndo_snapend))
+               if (fn_printn(ndo, cp, len, ndo->ndo_snapend))
                        return(NULL);
                break;
 
                        return(NULL);
                break;
 
index ddc912c9cff556b56f3701d87dc78ffc49e5ce3c..9b8e70e41be17e000a3f2fe2ad4d7385c488685b 100644 (file)
@@ -121,7 +121,7 @@ hsrp_print(netdissect_options *ndo, register const u_int8_t *bp, register u_int
                relts_print(ndo, hp->hsrp_holdtime);
                ND_PRINT((ndo, " priority=%d", hp->hsrp_priority));
                ND_PRINT((ndo, " auth=\""));
                relts_print(ndo, hp->hsrp_holdtime);
                ND_PRINT((ndo, " priority=%d", hp->hsrp_priority));
                ND_PRINT((ndo, " auth=\""));
-               if (fn_printn(hp->hsrp_authdata, sizeof(hp->hsrp_authdata),
+               if (fn_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata),
                    ndo->ndo_snapend)) {
                        ND_PRINT((ndo, "\""));
                        goto trunc;
                    ndo->ndo_snapend)) {
                        ND_PRINT((ndo, "\""));
                        goto trunc;
index 32e38908d435ab14375b7dff0255654c085e4de8..ea5a6545aa6b51eda685d1159c1b3654bf801eda 100644 (file)
@@ -178,7 +178,7 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length)
        for (i = 0; i < 8 && length > 0; i++) {
            ND_TCHECK(ipx[0]);
            ND_PRINT((ndo, " %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0])))));
        for (i = 0; i < 8 && length > 0; i++) {
            ND_TCHECK(ipx[0]);
            ND_PRINT((ndo, " %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0])))));
-           if (fn_printzp((u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
+           if (fn_printzp(ndo, (u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
                ND_PRINT((ndo, "'"));
                goto trunc;
            }
                ND_PRINT((ndo, "'"));
                goto trunc;
            }
index 6da4a31670b6a48c905c0b076111e907307efd4a..79b194d60548d47163a3b70b9f2a699a35d98dc6 100644 (file)
@@ -500,7 +500,7 @@ parsefn(netdissect_options *ndo,
        /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
        dp += ((len + 3) & ~3) / sizeof(*dp);
        ND_PRINT((ndo, "\""));
        /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
        dp += ((len + 3) & ~3) / sizeof(*dp);
        ND_PRINT((ndo, "\""));
-       if (fn_printn(cp, len, ndo->ndo_snapend)) {
+       if (fn_printn(ndo, cp, len, ndo->ndo_snapend)) {
                ND_PRINT((ndo, "\""));
                goto trunc;
        }
                ND_PRINT((ndo, "\""));
                goto trunc;
        }
index 93268ac017b50b024d98cb93a156df099cbdc81f..d2f5146029105926cd15f2d1c5408b2c167e04a2 100644 (file)
@@ -261,7 +261,7 @@ ntp_print(netdissect_options *ndo,
                break;
 
        case PRIM_REF:
                break;
 
        case PRIM_REF:
-               if (fn_printn((u_char *)&(bp->refid), 4, ndo->ndo_snapend))
+               if (fn_printn(ndo, (u_char *)&(bp->refid), 4, ndo->ndo_snapend))
                        goto trunc;
                break;
 
                        goto trunc;
                break;
 
index 34300a4474ef8e76e90579a7babbfc76d67bb458..f1b9003224e2bf142efa59636f031494ae0763b1 100644 (file)
@@ -591,7 +591,7 @@ olsr_print(netdissect_options *ndo,
 #endif
                     ND_PRINT((ndo, ", address %s, name \"",
                             ipaddr_string(ndo, msg_data)));
 #endif
                     ND_PRINT((ndo, ", address %s, name \"",
                             ipaddr_string(ndo, msg_data)));
-                fn_printn(msg_data + addr_size, name_entry_len, NULL);
+                fn_printn(ndo, msg_data + addr_size, name_entry_len, NULL);
                 ND_PRINT((ndo, "\""));
 
                 msg_data += addr_size + name_entry_len + name_entry_padding;
                 ND_PRINT((ndo, "\""));
 
                 msg_data += addr_size + name_entry_len + name_entry_padding;
index e8be4017c2f0d2588b13c88a8559ec57a1515316..a26f2dc0cdb32a9208d72103ab59d1fc05d5c0c6 100644 (file)
@@ -697,7 +697,7 @@ of10_phy_ports_print(netdissect_options *ndo,
                /* name */
                ND_TCHECK2(*cp, OFP_MAX_PORT_NAME_LEN);
                ND_PRINT((ndo, ", name '"));
                /* name */
                ND_TCHECK2(*cp, OFP_MAX_PORT_NAME_LEN);
                ND_PRINT((ndo, ", name '"));
-               fn_print(cp, cp + OFP_MAX_PORT_NAME_LEN);
+               fn_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN);
                ND_PRINT((ndo, "'"));
                cp += OFP_MAX_PORT_NAME_LEN;
 
                ND_PRINT((ndo, "'"));
                cp += OFP_MAX_PORT_NAME_LEN;
 
@@ -1363,31 +1363,31 @@ of10_desc_stats_reply_print(netdissect_options *ndo,
        /* mfr_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  mfr_desc '"));
        /* mfr_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  mfr_desc '"));
-       fn_print(cp, cp + DESC_STR_LEN);
+       fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* hw_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  hw_desc '"));
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* hw_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  hw_desc '"));
-       fn_print(cp, cp + DESC_STR_LEN);
+       fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* sw_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  sw_desc '"));
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* sw_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  sw_desc '"));
-       fn_print(cp, cp + DESC_STR_LEN);
+       fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* serial_num */
        ND_TCHECK2(*cp, SERIAL_NUM_LEN);
        ND_PRINT((ndo, "\n\t  serial_num '"));
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* serial_num */
        ND_TCHECK2(*cp, SERIAL_NUM_LEN);
        ND_PRINT((ndo, "\n\t  serial_num '"));
-       fn_print(cp, cp + SERIAL_NUM_LEN);
+       fn_print(ndo, cp, cp + SERIAL_NUM_LEN);
        ND_PRINT((ndo, "'"));
        cp += SERIAL_NUM_LEN;
        /* dp_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  dp_desc '"));
        ND_PRINT((ndo, "'"));
        cp += SERIAL_NUM_LEN;
        /* dp_desc */
        ND_TCHECK2(*cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  dp_desc '"));
-       fn_print(cp, cp + DESC_STR_LEN);
+       fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        return cp + DESC_STR_LEN;
 
        ND_PRINT((ndo, "'"));
        return cp + DESC_STR_LEN;
 
@@ -1532,7 +1532,7 @@ of10_table_stats_reply_print(netdissect_options *ndo,
                /* name */
                ND_TCHECK2(*cp, OFP_MAX_TABLE_NAME_LEN);
                ND_PRINT((ndo, ", name '"));
                /* name */
                ND_TCHECK2(*cp, OFP_MAX_TABLE_NAME_LEN);
                ND_PRINT((ndo, ", name '"));
-               fn_print(cp, cp + OFP_MAX_TABLE_NAME_LEN);
+               fn_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN);
                ND_PRINT((ndo, "'"));
                cp += OFP_MAX_TABLE_NAME_LEN;
                /* wildcards */
                ND_PRINT((ndo, "'"));
                cp += OFP_MAX_TABLE_NAME_LEN;
                /* wildcards */
index 0b70eed5135285358098ae6c051b11131202ba0e..5a59195e35f55f227879bdd85d21a1e06154c6e1 100644 (file)
@@ -548,7 +548,7 @@ handle_ctrl_proto(netdissect_options *ndo,
                /* RFC 1661 says this is intended to be human readable */
                if (len > 8) {
                        ND_PRINT((ndo, "\n\t  Message\n\t    "));
                /* RFC 1661 says this is intended to be human readable */
                if (len > 8) {
                        ND_PRINT((ndo, "\n\t  Message\n\t    "));
-                       if (fn_printn(tptr + 4, len - 4, ndo->ndo_snapend))
+                       if (fn_printn(ndo, tptr + 4, len - 4, ndo->ndo_snapend))
                                goto trunc;
                }
                break;
                                goto trunc;
                }
                break;
index af80c40d7fa3827d62b7bd43b0834d86113f64be..24045755b9b7d4dfc11f956d79c6e51a05f83e6e 100644 (file)
@@ -759,7 +759,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
                                goto trunc; \
                        bp += sizeof(int32_t); \
                        ND_PRINT((ndo, " \"")); \
                                goto trunc; \
                        bp += sizeof(int32_t); \
                        ND_PRINT((ndo, " \"")); \
-                       if (fn_printn(bp, i, ndo->ndo_snapend)) \
+                       if (fn_printn(ndo, bp, i, ndo->ndo_snapend)) \
                                goto trunc; \
                        ND_PRINT((ndo, "\"")); \
                        bp += ((i + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t); \
                                goto trunc; \
                        ND_PRINT((ndo, "\"")); \
                        bp += ((i + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t); \
@@ -857,7 +857,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
                        } \
                        s[(MAX)] = '\0'; \
                        ND_PRINT((ndo, " \"")); \
                        } \
                        s[(MAX)] = '\0'; \
                        ND_PRINT((ndo, " \"")); \
-                       fn_print(s, NULL); \
+                       fn_print(ndo, s, NULL); \
                        ND_PRINT((ndo, "\"")); \
                }
 
                        ND_PRINT((ndo, "\"")); \
                }
 
@@ -1179,7 +1179,7 @@ acl_print(netdissect_options *ndo,
                        goto finish;
                s += n;
                ND_PRINT((ndo, " +{"));
                        goto finish;
                s += n;
                ND_PRINT((ndo, " +{"));
-               fn_print((u_char *)user, NULL);
+               fn_print(ndo, (u_char *)user, NULL);
                ND_PRINT((ndo, " "));
                ACLOUT(acl);
                ND_PRINT((ndo, "}"));
                ND_PRINT((ndo, " "));
                ACLOUT(acl);
                ND_PRINT((ndo, "}"));
@@ -1193,7 +1193,7 @@ acl_print(netdissect_options *ndo,
                        goto finish;
                s += n;
                ND_PRINT((ndo, " -{"));
                        goto finish;
                s += n;
                ND_PRINT((ndo, " -{"));
-               fn_print((u_char *)user, NULL);
+               fn_print(ndo, (u_char *)user, NULL);
                ND_PRINT((ndo, " "));
                ACLOUT(acl);
                ND_PRINT((ndo, "}"));
                ND_PRINT((ndo, " "));
                ACLOUT(acl);
                ND_PRINT((ndo, "}"));
index 3b14f9ec27a62eee0b12f93c377e05f1dab75b3f..ba326018c28f176f297c2f18404be68a1ebc466b 100644 (file)
@@ -782,7 +782,7 @@ asn1_print(netdissect_options *ndo,
                p = elem->data.str;
                if (printable) {
                        ND_PRINT((ndo, "\""));
                p = elem->data.str;
                if (printable) {
                        ND_PRINT((ndo, "\""));
-                       if (fn_printn(p, asnlen, ndo->ndo_snapend)) {
+                       if (fn_printn(ndo, p, asnlen, ndo->ndo_snapend)) {
                                ND_PRINT((ndo, "\""));
                                goto trunc;
                        }
                                ND_PRINT((ndo, "\""));
                                goto trunc;
                        }
index 5f47d4768915fdd56d1771049ba72ca2bfcd130f..9b88e74f1022767590a3c52fefd9f59fc843c0f6 100644 (file)
@@ -136,7 +136,7 @@ tftp_print(netdissect_options *ndo,
                /* Print filename or first option */
                if (opcode != OACK)
                        ND_PRINT((ndo, "\""));
                /* Print filename or first option */
                if (opcode != OACK)
                        ND_PRINT((ndo, "\""));
-               i = fn_print(p, ndo->ndo_snapend);
+               i = fn_print(ndo, p, ndo->ndo_snapend);
                if (opcode != OACK)
                        ND_PRINT((ndo, "\""));
 
                if (opcode != OACK)
                        ND_PRINT((ndo, "\""));
 
@@ -147,7 +147,7 @@ tftp_print(netdissect_options *ndo,
                        p++;
                        if (*p != '\0') {
                                ND_PRINT((ndo, " "));
                        p++;
                        if (*p != '\0') {
                                ND_PRINT((ndo, " "));
-                               fn_print(p, ndo->ndo_snapend);
+                               fn_print(ndo, p, ndo->ndo_snapend);
                        }
                }
 
                        }
                }
 
@@ -167,7 +167,7 @@ tftp_print(netdissect_options *ndo,
                ND_PRINT((ndo, " %s \"", tok2str(err2str, "tftp-err-#%d \"",
                                       EXTRACT_16BITS(&tp->th_code))));
                /* Print error message string */
                ND_PRINT((ndo, " %s \"", tok2str(err2str, "tftp-err-#%d \"",
                                       EXTRACT_16BITS(&tp->th_code))));
                /* Print error message string */
-               i = fn_print((const u_char *)tp->th_data, ndo->ndo_snapend);
+               i = fn_print(ndo, (const u_char *)tp->th_data, ndo->ndo_snapend);
                ND_PRINT((ndo, "\""));
                if (i)
                        goto trunc;
                ND_PRINT((ndo, "\""));
                if (i)
                        goto trunc;
index efbdd1969382a9b2667c8b4d155795e0907e2094..b3f53216d26442b1220c60d0a748bda7338b93bb 100644 (file)
@@ -138,7 +138,7 @@ timed_print(netdissect_options *ndo,
        }
        ND_TCHECK(tsp->tsp_name);
        ND_PRINT((ndo, " name "));
        }
        ND_TCHECK(tsp->tsp_name);
        ND_PRINT((ndo, " name "));
-       if (fn_print((u_char *)tsp->tsp_name, (u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
+       if (fn_print(ndo, (u_char *)tsp->tsp_name, (u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
                goto trunc;
        return;
 
                goto trunc;
        return;
 
index 610a84a550aeff65cb49b92580c9d4fa886ea6f9..4e5da1455a6b89023e8d65f0b0ad9e5472a5e86b 100644 (file)
@@ -169,7 +169,7 @@ vrrp_print(netdissect_options *ndo,
                if (version == 2 && auth_type == VRRP_AUTH_SIMPLE) { /* simple text password */
                        ND_TCHECK(bp[7]);
                        ND_PRINT((ndo, " auth \""));
                if (version == 2 && auth_type == VRRP_AUTH_SIMPLE) { /* simple text password */
                        ND_TCHECK(bp[7]);
                        ND_PRINT((ndo, " auth \""));
-                       if (fn_printn(bp, 8, ndo->ndo_snapend)) {
+                       if (fn_printn(ndo, bp, 8, ndo->ndo_snapend)) {
                                ND_PRINT((ndo, "\""));
                                goto trunc;
                        }
                                ND_PRINT((ndo, "\""));
                                goto trunc;
                        }
index 3b7f11e26d4d771d8962a937d8abd3fd249d0d4b..29e829102c41e417defc0ffeb030bb308c5c09ed 100644 (file)
@@ -204,7 +204,7 @@ wb_id(netdissect_options *ndo,
        cp = (char *)(io + nid);
        if ((u_char *)cp + len <= ndo->ndo_snapend) {
                ND_PRINT((ndo, "\""));
        cp = (char *)(io + nid);
        if ((u_char *)cp + len <= ndo->ndo_snapend) {
                ND_PRINT((ndo, "\""));
-               (void)fn_print((u_char *)cp, (u_char *)cp + len);
+               fn_print(ndo, (u_char *)cp, (u_char *)cp + len);
                ND_PRINT((ndo, "\""));
        }
 
                ND_PRINT((ndo, "\""));
        }
 
diff --git a/util.c b/util.c
index f71f0e8acfbf179ffc1ab63fcdacdef937f22147..c07bc3a7ad7ea63fdfdb0f64fb6e2afebf8999d3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -45,7 +45,8 @@
  * Return true if truncated.
  */
 int
  * Return true if truncated.
  */
 int
-fn_print(register const u_char *s, register const u_char *ep)
+fn_print(netdissect_options *ndo,
+         register const u_char *s, register const u_char *ep)
 {
        register int ret;
        register u_char c;
 {
        register int ret;
        register u_char c;
@@ -59,14 +60,13 @@ fn_print(register const u_char *s, register const u_char *ep)
                }
                if (!ND_ISASCII(c)) {
                        c = ND_TOASCII(c);
                }
                if (!ND_ISASCII(c)) {
                        c = ND_TOASCII(c);
-                       putchar('M');
-                       putchar('-');
+                       ND_PRINT((ndo, "M-"));
                }
                if (!ND_ISPRINT(c)) {
                        c ^= 0x40;      /* DEL to ?, others to alpha */
                }
                if (!ND_ISPRINT(c)) {
                        c ^= 0x40;      /* DEL to ?, others to alpha */
-                       putchar('^');
+                       ND_PRINT((ndo, "^"));
                }
                }
-               putchar(c);
+               ND_PRINT((ndo, "%c", c));
        }
        return(ret);
 }
        }
        return(ret);
 }
@@ -77,8 +77,8 @@ fn_print(register const u_char *s, register const u_char *ep)
  * Return true if truncated.
  */
 int
  * Return true if truncated.
  */
 int
-fn_printn(register const u_char *s, register u_int n,
-         register const u_char *ep)
+fn_printn(netdissect_options *ndo,
+          register const u_char *s, register u_int n, register const u_char *ep)
 {
        register u_char c;
 
 {
        register u_char c;
 
@@ -87,14 +87,13 @@ fn_printn(register const u_char *s, register u_int n,
                c = *s++;
                if (!ND_ISASCII(c)) {
                        c = ND_TOASCII(c);
                c = *s++;
                if (!ND_ISASCII(c)) {
                        c = ND_TOASCII(c);
-                       putchar('M');
-                       putchar('-');
+                       ND_PRINT((ndo, "M-"));
                }
                if (!ND_ISPRINT(c)) {
                        c ^= 0x40;      /* DEL to ?, others to alpha */
                }
                if (!ND_ISPRINT(c)) {
                        c ^= 0x40;      /* DEL to ?, others to alpha */
-                       putchar('^');
+                       ND_PRINT((ndo, "^"));
                }
                }
-               putchar(c);
+               ND_PRINT((ndo, "%c", c));
        }
        return (n == 0) ? 0 : 1;
 }
        }
        return (n == 0) ? 0 : 1;
 }
@@ -105,8 +104,9 @@ fn_printn(register const u_char *s, register u_int n,
  * Return true if truncated.
  */
 int
  * Return true if truncated.
  */
 int
-fn_printzp(register const u_char *s, register u_int n,
-         register const u_char *ep)
+fn_printzp(netdissect_options *ndo,
+           register const u_char *s, register u_int n,
+           register const u_char *ep)
 {
        register int ret;
        register u_char c;
 {
        register int ret;
        register u_char c;
@@ -121,14 +121,13 @@ fn_printzp(register const u_char *s, register u_int n,
                }
                if (!ND_ISASCII(c)) {
                        c = ND_TOASCII(c);
                }
                if (!ND_ISASCII(c)) {
                        c = ND_TOASCII(c);
-                       putchar('M');
-                       putchar('-');
+                       ND_PRINT((ndo, "M-"));
                }
                if (!ND_ISPRINT(c)) {
                        c ^= 0x40;      /* DEL to ?, others to alpha */
                }
                if (!ND_ISPRINT(c)) {
                        c ^= 0x40;      /* DEL to ?, others to alpha */
-                       putchar('^');
+                       ND_PRINT((ndo, "^"));
                }
                }
-               putchar(c);
+               ND_PRINT((ndo, "%c", c));
        }
        return (n == 0) ? 0 : ret;
 }
        }
        return (n == 0) ? 0 : ret;
 }