Rename the fn_printX() functions to nd_printX()

The functions are: nd_print, nd_printztn, nd_printn and nd_printzp.
Trying to make it clearer that they currently have to be used only on part
of the packet buffer.
Update some comments.
This commit is contained in:
Francois-Xavier Le Bail 2018-04-30 12:52:10 +02:00
parent f7530ee4d5
commit 3e3e6d2ef4
32 changed files with 83 additions and 80 deletions

View File

@ -331,10 +331,10 @@ extern void signed_relts_print(netdissect_options *, int32_t);
extern void unsigned_relts_print(netdissect_options *, uint32_t);
extern void fn_print_char(netdissect_options *, u_char);
extern int fn_print(netdissect_options *, const u_char *, const u_char *);
extern u_int fn_printztn(netdissect_options *ndo, const u_char *, u_int, 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 int nd_print(netdissect_options *, const u_char *, const u_char *);
extern u_int nd_printztn(netdissect_options *ndo, const u_char *, u_int, const u_char *);
extern int nd_printn(netdissect_options *, const u_char *, u_int, const u_char *);
extern int nd_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
/*
* Flags for txtproto_print().

View File

@ -402,7 +402,7 @@ struct meshcntl_t {
#define PRINT_SSID(p) \
if (p.ssid_present) { \
ND_PRINT(" ("); \
fn_print(ndo, p.ssid.ssid, NULL); \
nd_print(ndo, p.ssid.ssid, NULL); \
ND_PRINT(")"); \
}

View File

@ -238,7 +238,7 @@ aoev1_query_print(netdissect_options *ndo,
ND_TCHECK_LEN(cp, cslen);
if (cslen) {
ND_PRINT("\n\tConfig String (length %u): ", cslen);
if (fn_printn(ndo, cp, cslen, ndo->ndo_snapend))
if (nd_printn(ndo, cp, cslen, ndo->ndo_snapend))
goto trunc;
}
return;

View File

@ -217,7 +217,7 @@ auth_print(netdissect_options *ndo, const u_char *pptr)
pptr++;
ND_PRINT(", Password: ");
/* the length is equal to the password length plus three */
if (fn_printn(ndo, pptr, auth_len - 3,
if (nd_printn(ndo, pptr, auth_len - 3,
ndo->ndo_snapend))
goto trunc;
break;

View File

@ -2955,7 +2955,7 @@ bgp_notification_print(netdissect_options *ndo,
else {
ND_TCHECK_LEN(tptr + 1, shutdown_comm_length);
ND_PRINT(", Shutdown Communication (length: %u): \"", shutdown_comm_length);
(void)fn_printn(ndo, tptr+1, shutdown_comm_length, NULL);
(void)nd_printn(ndo, tptr+1, shutdown_comm_length, NULL);
ND_PRINT("\"");
remainder_offset += shutdown_comm_length + 1;
}

View File

@ -361,8 +361,8 @@ bootp_print(netdissect_options *ndo,
ND_TCHECK_1(bp->bp_sname); /* check first char only */
if (EXTRACT_U_1(bp->bp_sname)) {
ND_PRINT("\n\t sname \"");
if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname),
ndo->ndo_snapend)) {
if (nd_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname),
ndo->ndo_snapend)) {
ND_PRINT("\"");
ND_PRINT("%s", tstr + 1);
return;
@ -372,8 +372,8 @@ bootp_print(netdissect_options *ndo,
ND_TCHECK_1(bp->bp_file); /* check first char only */
if (EXTRACT_U_1(bp->bp_file)) {
ND_PRINT("\n\t file \"");
if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file),
ndo->ndo_snapend)) {
if (nd_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file),
ndo->ndo_snapend)) {
ND_PRINT("\"");
ND_PRINT("%s", tstr + 1);
return;
@ -712,7 +712,7 @@ rfc1048_print(netdissect_options *ndo,
case 'a':
/* ASCII strings */
ND_PRINT("\"");
if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) {
if (nd_printn(ndo, bp, len, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}
@ -853,7 +853,7 @@ rfc1048_print(netdissect_options *ndo,
ND_PRINT("%u/%u ", EXTRACT_U_1(bp), EXTRACT_U_1(bp + 1));
bp += 2;
ND_PRINT("\"");
if (fn_printn(ndo, bp, len - 3, ndo->ndo_snapend)) {
if (nd_printn(ndo, bp, len - 3, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}
@ -876,7 +876,7 @@ rfc1048_print(netdissect_options *ndo,
len--;
if (type == 0) {
ND_PRINT("\"");
if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) {
if (nd_printn(ndo, bp, len, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}
@ -922,7 +922,7 @@ rfc1048_print(netdissect_options *ndo,
case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */
case AGENT_SUBOPTION_REMOTE_ID:
case AGENT_SUBOPTION_SUBSCRIBER_ID:
if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend))
if (nd_printn(ndo, bp, suboptlen, ndo->ndo_snapend))
goto trunc;
break;
@ -1020,7 +1020,7 @@ rfc1048_print(netdissect_options *ndo,
break;
}
ND_PRINT("\"");
if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) {
if (nd_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}

View File

@ -149,7 +149,7 @@ cdp_print(netdissect_options *ndo,
if (!ndo->ndo_vflag)
ND_PRINT(", Device-ID ");
ND_PRINT("'");
(void)fn_printn(ndo, tptr, len, NULL);
(void)nd_printn(ndo, tptr, len, NULL);
ND_PRINT("'");
break;
case 0x02: /* Address */
@ -158,7 +158,7 @@ cdp_print(netdissect_options *ndo,
break;
case 0x03: /* Port-ID */
ND_PRINT("'");
(void)fn_printn(ndo, tptr, len, NULL);
(void)nd_printn(ndo, tptr, len, NULL);
ND_PRINT("'");
break;
case 0x04: /* Capabilities */
@ -181,7 +181,7 @@ cdp_print(netdissect_options *ndo,
break;
case 0x06: /* Platform */
ND_PRINT("'");
(void)fn_printn(ndo, tptr, len, NULL);
(void)nd_printn(ndo, tptr, len, NULL);
ND_PRINT("'");
break;
case 0x07: /* Prefixes */
@ -192,7 +192,7 @@ cdp_print(netdissect_options *ndo,
break;
case 0x09: /* VTP Mgmt Domain - CDPv2 */
ND_PRINT("'");
(void)fn_printn(ndo, tptr, len, NULL);
(void)nd_printn(ndo, tptr, len, NULL);
ND_PRINT("'");
break;
case 0x0a: /* Native VLAN ID - CDPv2 */
@ -251,7 +251,7 @@ cdp_print(netdissect_options *ndo,
break;
case 0x14: /* System Name - not documented */
ND_PRINT("'");
(void)fn_printn(ndo, tptr, len, NULL);
(void)nd_printn(ndo, tptr, len, NULL);
ND_PRINT("'");
break;
case 0x16: /* System Object ID - not documented */
@ -264,7 +264,7 @@ cdp_print(netdissect_options *ndo,
ND_PRINT("0x%02x", EXTRACT_U_1(tptr));
if (len > 1) {
ND_PRINT("/");
(void)fn_printn(ndo, tptr + 1, len - 1, NULL);
(void)nd_printn(ndo, tptr + 1, len - 1, NULL);
}
break;
default:

View File

@ -744,7 +744,7 @@ dhcp6opt_print(netdissect_options *ndo,
label_len = EXTRACT_U_1(tp);
tp++;
if (label_len < remain_len - 1) {
(void)fn_printn(ndo, tp, label_len, NULL);
(void)nd_printn(ndo, tp, label_len, NULL);
tp += label_len;
remain_len -= (label_len + 1);
if(EXTRACT_U_1(tp)) ND_PRINT(".");
@ -764,7 +764,7 @@ dhcp6opt_print(netdissect_options *ndo,
}
tp = (const u_char *)(dh6o + 1);
ND_PRINT("=");
(void)fn_printn(ndo, tp, (u_int)optlen, NULL);
(void)nd_printn(ndo, tp, (u_int)optlen, NULL);
ND_PRINT(")");
break;

View File

@ -218,7 +218,7 @@ ns_nprint(netdissect_options *ndo,
return(NULL);
}
} else {
if (fn_printn(ndo, cp, l, ndo->ndo_snapend))
if (nd_printn(ndo, cp, l, ndo->ndo_snapend))
return(NULL);
}
@ -249,7 +249,7 @@ ns_cprint(netdissect_options *ndo,
return (NULL);
i = EXTRACT_U_1(cp);
cp++;
if (fn_printn(ndo, cp, i, ndo->ndo_snapend))
if (nd_printn(ndo, cp, i, ndo->ndo_snapend))
return (NULL);
return (cp + i);
}
@ -548,7 +548,7 @@ ns_rprint(netdissect_options *ndo,
case T_UNSPECA: /* One long string */
if (!ND_TTEST_LEN(cp, len))
return(NULL);
if (fn_printn(ndo, cp, len, ndo->ndo_snapend))
if (nd_printn(ndo, cp, len, ndo->ndo_snapend))
return(NULL);
break;

View File

@ -90,7 +90,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
switch (type) {
case DTP_DOMAIN_TLV:
ND_PRINT(", ");
fn_printzp(ndo, tptr+4, len-4, pptr+length);
nd_printzp(ndo, tptr+4, len-4, pptr+length);
break;
case DTP_STATUS_TLV:

View File

@ -126,8 +126,8 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len)
unsigned_relts_print(ndo, EXTRACT_U_1(hp->hsrp_holdtime));
ND_PRINT(" priority=%u", EXTRACT_U_1(hp->hsrp_priority));
ND_PRINT(" auth=\"");
if (fn_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata),
ndo->ndo_snapend)) {
if (nd_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata),
ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}

View File

@ -189,7 +189,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length)
ND_PRINT("'");
goto trunc;
}
if (fn_printzp(ndo, ipx, 48, ndo->ndo_snapend)) {
if (nd_printzp(ndo, ipx, 48, ndo->ndo_snapend)) {
ND_PRINT("'");
goto trunc;
}

View File

@ -1398,7 +1398,7 @@ isis_print_mcid(netdissect_options *ndo,
ND_TCHECK_SIZE(mcid);
ND_PRINT("ID: %u, Name: ", EXTRACT_U_1(mcid->format_id));
if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
if (nd_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
goto trunc;
ND_PRINT("\n\t Lvl: %u", EXTRACT_BE_U_2(mcid->revision_lvl));
@ -2846,7 +2846,7 @@ isis_print(netdissect_options *ndo,
switch (EXTRACT_U_1(tptr)) {
case ISIS_SUBTLV_AUTH_SIMPLE:
if (fn_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend))
if (nd_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend))
goto trunc;
break;
case ISIS_SUBTLV_AUTH_MD5:
@ -2974,7 +2974,7 @@ isis_print(netdissect_options *ndo,
case ISIS_TLV_HOSTNAME:
ND_PRINT("\n\t Hostname: ");
if (fn_printzp(ndo, tptr, tmp, ndo->ndo_snapend))
if (nd_printzp(ndo, tptr, tmp, ndo->ndo_snapend))
goto trunc;
break;

View File

@ -958,7 +958,7 @@ lldp_private_iana_print(netdissect_options *ndo,
switch (subtype) {
case LLDP_IANA_SUBTYPE_MUDURL:
ND_PRINT("\n\t MUD-URL=");
(void)fn_printn(ndo, tptr+4, tlv_len-4, NULL);
(void)nd_printn(ndo, tptr+4, tlv_len-4, NULL);
break;
default:
hexdump=TRUE;

View File

@ -492,7 +492,7 @@ parsefn(netdissect_options *ndo,
/* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
dp += ((len + 3) & ~3) / sizeof(*dp);
ND_PRINT("\"");
if (fn_printn(ndo, cp, len, ndo->ndo_snapend)) {
if (nd_printn(ndo, cp, len, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}

View File

@ -300,7 +300,7 @@ ntp_time_print(netdissect_options *ndo,
break;
case PRIM_REF:
if (fn_printn(ndo, (const u_char *)&(bp->refid), 4, ndo->ndo_snapend))
if (nd_printn(ndo, (const u_char *)&(bp->refid), 4, ndo->ndo_snapend))
goto trunc;
break;

View File

@ -688,7 +688,7 @@ olsr_print(netdissect_options *ndo,
else
ND_PRINT(", address %s, name \"",
ipaddr_string(ndo, msg_data));
(void)fn_printn(ndo, msg_data + addr_size, name_entry_len, NULL);
(void)nd_printn(ndo, msg_data + addr_size, name_entry_len, NULL);
ND_PRINT("\"");
msg_data += addr_size + name_entry_len + name_entry_padding;

View File

@ -895,7 +895,7 @@ of10_bsn_message_print(netdissect_options *ndo,
cp += 4;
/* data */
ND_PRINT(", data '");
if (fn_printn(ndo, cp, len - 8, ep)) {
if (nd_printn(ndo, cp, len - 8, ep)) {
ND_PRINT("'");
goto trunc;
}
@ -916,7 +916,7 @@ of10_bsn_message_print(netdissect_options *ndo,
/* already checked that len >= 4 */
/* data */
ND_PRINT(", data '");
if (fn_printn(ndo, cp, len - 4, ep)) {
if (nd_printn(ndo, cp, len - 4, ep)) {
ND_PRINT("'");
goto trunc;
}
@ -1158,7 +1158,7 @@ of10_phy_ports_print(netdissect_options *ndo,
/* name */
ND_TCHECK_LEN(cp, OFP_MAX_PORT_NAME_LEN);
ND_PRINT(", name '");
fn_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN);
nd_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN);
ND_PRINT("'");
cp += OFP_MAX_PORT_NAME_LEN;
@ -1840,31 +1840,31 @@ of10_desc_stats_reply_print(netdissect_options *ndo,
/* mfr_desc */
ND_TCHECK_LEN(cp, DESC_STR_LEN);
ND_PRINT("\n\t mfr_desc '");
fn_print(ndo, cp, cp + DESC_STR_LEN);
nd_print(ndo, cp, cp + DESC_STR_LEN);
ND_PRINT("'");
cp += DESC_STR_LEN;
/* hw_desc */
ND_TCHECK_LEN(cp, DESC_STR_LEN);
ND_PRINT("\n\t hw_desc '");
fn_print(ndo, cp, cp + DESC_STR_LEN);
nd_print(ndo, cp, cp + DESC_STR_LEN);
ND_PRINT("'");
cp += DESC_STR_LEN;
/* sw_desc */
ND_TCHECK_LEN(cp, DESC_STR_LEN);
ND_PRINT("\n\t sw_desc '");
fn_print(ndo, cp, cp + DESC_STR_LEN);
nd_print(ndo, cp, cp + DESC_STR_LEN);
ND_PRINT("'");
cp += DESC_STR_LEN;
/* serial_num */
ND_TCHECK_LEN(cp, SERIAL_NUM_LEN);
ND_PRINT("\n\t serial_num '");
fn_print(ndo, cp, cp + SERIAL_NUM_LEN);
nd_print(ndo, cp, cp + SERIAL_NUM_LEN);
ND_PRINT("'");
cp += SERIAL_NUM_LEN;
/* dp_desc */
ND_TCHECK_LEN(cp, DESC_STR_LEN);
ND_PRINT("\n\t dp_desc '");
fn_print(ndo, cp, cp + DESC_STR_LEN);
nd_print(ndo, cp, cp + DESC_STR_LEN);
ND_PRINT("'");
return cp + DESC_STR_LEN;
@ -2012,7 +2012,7 @@ of10_table_stats_reply_print(netdissect_options *ndo,
/* name */
ND_TCHECK_LEN(cp, OFP_MAX_TABLE_NAME_LEN);
ND_PRINT(", name '");
fn_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN);
nd_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN);
ND_PRINT("'");
cp += OFP_MAX_TABLE_NAME_LEN;
/* wildcards */

View File

@ -562,7 +562,7 @@ handle_ctrl_proto(netdissect_options *ndo,
/* RFC 1661 says this is intended to be human readable */
if (len > 8) {
ND_PRINT("\n\t Message\n\t ");
if (fn_printn(ndo, tptr + 4, len - 4, ndo->ndo_snapend))
if (nd_printn(ndo, tptr + 4, len - 4, ndo->ndo_snapend))
goto trunc;
}
break;

View File

@ -205,7 +205,7 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
*/
#define RESP_PRINT_SEGMENT(_ndo, _bp, _len) \
ND_PRINT(" \""); \
if (fn_printn(_ndo, _bp, _len, _ndo->ndo_snapend)) \
if (nd_printn(_ndo, _bp, _len, _ndo->ndo_snapend)) \
goto trunc; \
fn_print_char(_ndo, '"');

View File

@ -233,7 +233,7 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p,
remaining -= sizeof(*eh);
if (auth_type == 2) {
ND_PRINT("\n\t Simple Text Authentication data: ");
if (fn_printzp(ndo, p, RIP_AUTHLEN, p + remaining))
if (nd_printzp(ndo, p, RIP_AUTHLEN, p + remaining))
return (0);
} else if (auth_type == 3) {
const struct rip_auth_crypto_v2 *ch;

View File

@ -353,9 +353,9 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
if (text_length) {
if (pdu_len < tlen + text_length)
goto invalid;
/* fn_printn() makes the bounds check */
/* nd_printn() makes the bounds check */
ND_PRINT("%sError text: ", indent_string(indent+2));
if (fn_printn(ndo, tptr + tlen, text_length, ndo->ndo_snapend))
if (nd_printn(ndo, tptr + tlen, text_length, ndo->ndo_snapend))
goto trunc;
}
}

View File

@ -771,7 +771,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
goto trunc; \
bp += sizeof(uint32_t); \
ND_PRINT(" \""); \
if (fn_printn(ndo, bp, _i, ndo->ndo_snapend)) \
if (nd_printn(ndo, bp, _i, ndo->ndo_snapend)) \
goto trunc; \
ND_PRINT("\""); \
bp += ((_i + sizeof(uint32_t) - 1) / sizeof(uint32_t)) * sizeof(uint32_t); \
@ -869,7 +869,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
} \
s[(MAX)] = '\0'; \
ND_PRINT(" \""); \
fn_print(ndo, s, NULL); \
nd_print(ndo, s, NULL); \
ND_PRINT("\""); \
}
@ -1190,7 +1190,7 @@ acl_print(netdissect_options *ndo,
goto finish;
s += n;
ND_PRINT(" +{");
fn_print(ndo, (u_char *)user, NULL);
nd_print(ndo, (u_char *)user, NULL);
ND_PRINT(" ");
ACLOUT(acl);
ND_PRINT("}");
@ -1204,7 +1204,7 @@ acl_print(netdissect_options *ndo,
goto finish;
s += n;
ND_PRINT(" -{");
fn_print(ndo, (u_char *)user, NULL);
nd_print(ndo, (u_char *)user, NULL);
ND_PRINT(" ");
ACLOUT(acl);
ND_PRINT("}");

View File

@ -705,7 +705,7 @@ asn1_print_string(netdissect_options *ndo, struct be *elem)
p = elem->data.str;
if (printable) {
ND_PRINT("\"");
if (fn_printn(ndo, p, asnlen, ndo->ndo_snapend)) {
if (nd_printn(ndo, p, asnlen, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}

View File

@ -292,7 +292,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
ND_PRINT("\n\tv3len %u, ", EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET));
ND_TCHECK_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12);
ND_PRINT("MCID Name ");
if (fn_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend))
if (nd_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend))
goto trunc;
ND_PRINT(", rev %u,"
"\n\t\tdigest %08x%08x%08x%08x, ",
@ -366,7 +366,7 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
ND_PRINT("\n\tv4len %u, ", EXTRACT_BE_U_2(ptr + offset));
ND_PRINT("AUXMCID Name ");
if (fn_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32,
if (nd_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32,
ndo->ndo_snapend))
goto trunc;
ND_PRINT(", Rev %u,\n\t\tdigest %08x%08x%08x%08x",

View File

@ -121,7 +121,7 @@ tftp_print(netdissect_options *ndo,
ND_PRINT(" ");
/* Print filename */
ND_PRINT("\"");
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend);
ND_PRINT("\"");
if (ui == 0)
goto trunc;
@ -132,7 +132,7 @@ tftp_print(netdissect_options *ndo,
if (length == 0)
goto trunc; /* no mode */
ND_PRINT(" ");
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend);
if (ui == 0)
goto trunc;
bp += ui;
@ -143,7 +143,7 @@ tftp_print(netdissect_options *ndo,
ND_TCHECK_1(bp);
if (EXTRACT_U_1(bp) != '\0')
ND_PRINT(" ");
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend);
if (ui == 0)
goto trunc;
bp += ui;
@ -157,7 +157,7 @@ tftp_print(netdissect_options *ndo,
ND_TCHECK_1(bp);
if (EXTRACT_U_1(bp) != '\0')
ND_PRINT(" ");
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend);
if (ui == 0)
goto trunc;
bp += ui;
@ -186,7 +186,7 @@ tftp_print(netdissect_options *ndo,
if (length == 0)
goto trunc; /* no error message */
ND_PRINT(" \"");
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend);
ND_PRINT("\"");
if (ui == 0)
goto trunc;

View File

@ -139,7 +139,7 @@ timed_print(netdissect_options *ndo,
break;
}
ND_PRINT(" name ");
if (fn_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
if (nd_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
goto trunc;
return;

View File

@ -155,12 +155,12 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length)
case UDLD_PORT_ID_TLV:
case UDLD_DEVICE_NAME_TLV:
ND_PRINT(", ");
fn_printzp(ndo, tptr, len, NULL);
nd_printzp(ndo, tptr, len, NULL);
break;
case UDLD_ECHO_TLV:
ND_PRINT(", ");
(void)fn_printn(ndo, tptr, len, NULL);
(void)nd_printn(ndo, tptr, len, NULL);
break;
case UDLD_MESSAGE_INTERVAL_TLV:

View File

@ -171,7 +171,7 @@ vrrp_print(netdissect_options *ndo,
if (version == 2 && auth_type == VRRP_AUTH_SIMPLE) { /* simple text password */
ND_TCHECK_1(bp + 7);
ND_PRINT(" auth \"");
if (fn_printn(ndo, bp, 8, ndo->ndo_snapend)) {
if (nd_printn(ndo, bp, 8, ndo->ndo_snapend)) {
ND_PRINT("\"");
goto trunc;
}

View File

@ -150,7 +150,7 @@ vtp_print (netdissect_options *ndo,
ND_PRINT(" [invalid MgmtD Len %u]", mgmtd_len);
return;
}
fn_printzp(ndo, tptr + 4, mgmtd_len, NULL);
nd_printzp(ndo, tptr + 4, mgmtd_len, NULL);
ND_PRINT(", %s: %u",
tok2str(vtp_header_values, "Unknown", type),
EXTRACT_U_1(tptr + 2));
@ -267,7 +267,7 @@ vtp_print (netdissect_options *ndo,
if (len < 4*((name_len + 3)/4))
goto trunc;
ND_TCHECK_LEN(tptr, name_len);
fn_printzp(ndo, tptr, name_len, NULL);
nd_printzp(ndo, tptr, name_len, NULL);
/*
* Vlan names are aligned to 32-bit boundaries.

View File

@ -205,7 +205,7 @@ wb_id(netdissect_options *ndo,
cp = (const char *)(io + nid);
if (ND_TTEST_LEN(cp, len)) {
ND_PRINT("\"");
fn_print(ndo, (const u_char *)cp, (const u_char *)cp + len);
nd_print(ndo, (const u_char *)cp, (const u_char *)cp + len);
ND_PRINT("\"");
}

View File

@ -87,13 +87,14 @@ fn_print_char(netdissect_options *ndo, u_char c)
}
/*
* Print out a null-terminated filename (or other ASCII string).
* Print out a null-terminated filename (or other ASCII string), part of
* the packet buffer.
* If ep is NULL, assume no truncation check is needed.
* Return true if truncated.
* Stop at ep (if given) or before the null char, whichever is first.
*/
int
fn_print(netdissect_options *ndo,
nd_print(netdissect_options *ndo,
const u_char *s, const u_char *ep)
{
int ret;
@ -114,13 +115,13 @@ fn_print(netdissect_options *ndo,
/*
* Print out a null-terminated filename (or other ASCII string) from
* a fixed-length buffer.
* a fixed-length buffer, part of the packet buffer.
* If ep is NULL, assume no truncation check is needed.
* Return the number of bytes of string processed, including the
* terminating null, if not truncated. Return 0 if truncated.
*/
u_int
fn_printztn(netdissect_options *ndo,
nd_printztn(netdissect_options *ndo,
const u_char *s, u_int n, const u_char *ep)
{
u_int bytes;
@ -156,13 +157,14 @@ fn_printztn(netdissect_options *ndo,
}
/*
* Print out a counted filename (or other ASCII string).
* Print out a counted filename (or other ASCII string), part of
* the packet buffer.
* If ep is NULL, assume no truncation check is needed.
* Return true if truncated.
* Stop at ep (if given) or after n bytes, whichever is first.
*/
int
fn_printn(netdissect_options *ndo,
nd_printn(netdissect_options *ndo,
const u_char *s, u_int n, const u_char *ep)
{
u_char c;
@ -177,14 +179,15 @@ fn_printn(netdissect_options *ndo,
}
/*
* Print out a null-padded filename (or other ASCII string).
* Print out a null-padded filename (or other ASCII string), part of
* the packet buffer.
* If ep is NULL, assume no truncation check is needed.
* Return true if truncated.
* Stop at ep (if given) or after n bytes or before the null char,
* whichever is first.
*/
int
fn_printzp(netdissect_options *ndo,
nd_printzp(netdissect_options *ndo,
const u_char *s, u_int n,
const u_char *ep)
{