aboutsummaryrefslogtreecommitdiff
path: root/print-lwres.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-06-16 17:23:21 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2019-03-26 21:06:24 +0100
commitee68aa36460d7efeca48747f33b7f2adc0900bfb (patch)
tree72c1b65d29301835c0e064b433ea685fc856a68e /print-lwres.c
parent1af20c3adc4dfef93de41d4fcd02f0aeb6bbfd4e (diff)
downloadtcpdump-ee68aa36460d7efeca48747f33b7f2adc0900bfb.tar.gz
Use the new GET_ macros instead of the EXTRACT_ ones
The exceptions are currently: Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer. An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer pointer.
Diffstat (limited to 'print-lwres.c')
-rw-r--r--print-lwres.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/print-lwres.c b/print-lwres.c
index 32024429..a8e83bf5 100644
--- a/print-lwres.c
+++ b/print-lwres.c
@@ -205,7 +205,7 @@ lwres_printname(netdissect_options *ndo,
ND_PRINT(" ");
for (i = 0; i < l; i++) {
- fn_print_char(ndo, EXTRACT_U_1(p));
+ fn_print_char(ndo, GET_U_1(p));
p++;
}
p++; /* skip terminating \0 */
@@ -225,7 +225,7 @@ lwres_printnamelen(netdissect_options *ndo,
if (p + 2 > ndo->ndo_snapend)
goto trunc;
- l = EXTRACT_BE_U_2(p);
+ l = GET_BE_U_2(p);
advance = lwres_printname(ndo, l, p + 2);
if (advance < 0)
goto trunc;
@@ -246,12 +246,12 @@ lwres_printbinlen(netdissect_options *ndo,
p = p0;
if (p + 2 > ndo->ndo_snapend)
goto trunc;
- l = EXTRACT_BE_U_2(p);
+ l = GET_BE_U_2(p);
if (p + 2 + l > ndo->ndo_snapend)
goto trunc;
p += 2;
for (i = 0; i < l; i++) {
- ND_PRINT("%02x", EXTRACT_U_1(p));
+ ND_PRINT("%02x", GET_U_1(p));
p++;
}
return p - p0;
@@ -272,11 +272,11 @@ lwres_printaddr(netdissect_options *ndo,
p = p0;
ap = (const lwres_addr_t *)p;
ND_TCHECK_2(ap->length);
- l = EXTRACT_BE_U_2(ap->length);
+ l = GET_BE_U_2(ap->length);
p += LWRES_ADDR_LEN;
ND_TCHECK_LEN(p, l);
- switch (EXTRACT_BE_U_4(ap->family)) {
+ switch (GET_BE_U_4(ap->family)) {
case 1: /* IPv4 */
if (l < 4)
return -1;
@@ -290,9 +290,9 @@ lwres_printaddr(netdissect_options *ndo,
p += sizeof(nd_ipv6);
break;
default:
- ND_PRINT(" %u/", EXTRACT_BE_U_4(ap->family));
+ ND_PRINT(" %u/", GET_BE_U_4(ap->family));
for (i = 0; i < l; i++) {
- ND_PRINT("%02x", EXTRACT_U_1(p));
+ ND_PRINT("%02x", GET_U_1(p));
p++;
}
}
@@ -320,34 +320,34 @@ lwres_print(netdissect_options *ndo,
ND_TCHECK_2(np->authlength);
ND_PRINT(" lwres");
- v = EXTRACT_BE_U_2(np->version);
+ v = GET_BE_U_2(np->version);
if (ndo->ndo_vflag || v != LWRES_LWPACKETVERSION_0)
ND_PRINT(" v%u", v);
if (v != LWRES_LWPACKETVERSION_0) {
- s = bp + EXTRACT_BE_U_4(np->length);
+ s = bp + GET_BE_U_4(np->length);
goto tail;
}
- response = EXTRACT_BE_U_2(np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE;
+ response = GET_BE_U_2(np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE;
/* opcode and pktflags */
- v = EXTRACT_BE_U_4(np->opcode);
+ v = GET_BE_U_4(np->opcode);
ND_PRINT(" %s%s", tok2str(opcode, "#0x%x", v), response ? "" : "?");
/* pktflags */
- v = EXTRACT_BE_U_2(np->pktflags);
+ v = GET_BE_U_2(np->pktflags);
if (v & ~LWRES_LWPACKETFLAG_RESPONSE)
ND_PRINT("[0x%x]", v);
if (ndo->ndo_vflag > 1) {
ND_PRINT(" ("); /*)*/
- ND_PRINT("serial:0x%x", EXTRACT_BE_U_4(np->serial));
- ND_PRINT(" result:0x%x", EXTRACT_BE_U_4(np->result));
- ND_PRINT(" recvlen:%u", EXTRACT_BE_U_4(np->recvlength));
+ ND_PRINT("serial:0x%x", GET_BE_U_4(np->serial));
+ ND_PRINT(" result:0x%x", GET_BE_U_4(np->result));
+ ND_PRINT(" recvlen:%u", GET_BE_U_4(np->recvlength));
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
- ND_PRINT(" authtype:0x%x", EXTRACT_BE_U_2(np->authtype));
- ND_PRINT(" authlen:%u", EXTRACT_BE_U_2(np->authlength));
+ ND_PRINT(" authtype:0x%x", GET_BE_U_2(np->authtype));
+ ND_PRINT(" authlen:%u", GET_BE_U_2(np->authlength));
}
/*(*/
ND_PRINT(")");
@@ -368,7 +368,7 @@ lwres_print(netdissect_options *ndo,
grbn = NULL;
p = (const u_char *)(np + 1);
- switch (EXTRACT_BE_U_4(np->opcode)) {
+ switch (GET_BE_U_4(np->opcode)) {
case LWRES_OPCODE_NOOP:
s = p;
break;
@@ -379,10 +379,10 @@ lwres_print(netdissect_options *ndo,
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT(" flags:0x%x",
- EXTRACT_BE_U_4(gabn->flags));
+ GET_BE_U_4(gabn->flags));
}
- v = EXTRACT_BE_U_4(gabn->addrtypes);
+ v = GET_BE_U_4(gabn->addrtypes);
switch (v & (LWRES_ADDRTYPE_V4 | LWRES_ADDRTYPE_V6)) {
case LWRES_ADDRTYPE_V4:
ND_PRINT(" IPv4");
@@ -398,7 +398,7 @@ lwres_print(netdissect_options *ndo,
ND_PRINT("[0x%x]", v);
s = p + LWRES_GABNREQUEST_LEN;
- l = EXTRACT_BE_U_2(gabn->namelen);
+ l = GET_BE_U_2(gabn->namelen);
advance = lwres_printname(ndo, l, s);
if (advance < 0)
goto trunc;
@@ -411,7 +411,7 @@ lwres_print(netdissect_options *ndo,
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT(" flags:0x%x",
- EXTRACT_BE_U_4(gnba->flags));
+ GET_BE_U_4(gnba->flags));
}
s = p + LWRES_GNBAREQUEST_LEN;
@@ -428,18 +428,18 @@ lwres_print(netdissect_options *ndo,
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT(" flags:0x%x",
- EXTRACT_BE_U_4(grbn->flags));
+ GET_BE_U_4(grbn->flags));
}
ND_PRINT(" %s", tok2str(ns_type2str, "Type%u",
- EXTRACT_BE_U_2(grbn->rdtype)));
- if (EXTRACT_BE_U_2(grbn->rdclass) != C_IN) {
+ GET_BE_U_2(grbn->rdtype)));
+ if (GET_BE_U_2(grbn->rdclass) != C_IN) {
ND_PRINT(" %s", tok2str(ns_class2str, "Class%u",
- EXTRACT_BE_U_2(grbn->rdclass)));
+ GET_BE_U_2(grbn->rdclass)));
}
s = p + LWRES_GRBNREQUEST_LEN;
- l = EXTRACT_BE_U_2(grbn->namelen);
+ l = GET_BE_U_2(grbn->namelen);
advance = lwres_printname(ndo, l, s);
if (advance < 0)
goto trunc;
@@ -465,7 +465,7 @@ lwres_print(netdissect_options *ndo,
grbn = NULL;
p = (const u_char *)(np + 1);
- switch (EXTRACT_BE_U_4(np->opcode)) {
+ switch (GET_BE_U_4(np->opcode)) {
case LWRES_OPCODE_NOOP:
s = p;
break;
@@ -476,21 +476,21 @@ lwres_print(netdissect_options *ndo,
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT(" flags:0x%x",
- EXTRACT_BE_U_4(gabn->flags));
+ GET_BE_U_4(gabn->flags));
}
- ND_PRINT(" %u/%u", EXTRACT_BE_U_2(gabn->naliases),
- EXTRACT_BE_U_2(gabn->naddrs));
+ ND_PRINT(" %u/%u", GET_BE_U_2(gabn->naliases),
+ GET_BE_U_2(gabn->naddrs));
s = p + LWRES_GABNRESPONSE_LEN;
- l = EXTRACT_BE_U_2(gabn->realnamelen);
+ l = GET_BE_U_2(gabn->realnamelen);
advance = lwres_printname(ndo, l, s);
if (advance < 0)
goto trunc;
s += advance;
/* aliases */
- na = EXTRACT_BE_U_2(gabn->naliases);
+ na = GET_BE_U_2(gabn->naliases);
for (i = 0; i < na; i++) {
advance = lwres_printnamelen(ndo, s);
if (advance < 0)
@@ -499,7 +499,7 @@ lwres_print(netdissect_options *ndo,
}
/* addrs */
- na = EXTRACT_BE_U_2(gabn->naddrs);
+ na = GET_BE_U_2(gabn->naddrs);
for (i = 0; i < na; i++) {
advance = lwres_printaddr(ndo, s);
if (advance < 0)
@@ -514,20 +514,20 @@ lwres_print(netdissect_options *ndo,
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT(" flags:0x%x",
- EXTRACT_BE_U_4(gnba->flags));
+ GET_BE_U_4(gnba->flags));
}
- ND_PRINT(" %u", EXTRACT_BE_U_2(gnba->naliases));
+ ND_PRINT(" %u", GET_BE_U_2(gnba->naliases));
s = p + LWRES_GNBARESPONSE_LEN;
- l = EXTRACT_BE_U_2(gnba->realnamelen);
+ l = GET_BE_U_2(gnba->realnamelen);
advance = lwres_printname(ndo, l, s);
if (advance < 0)
goto trunc;
s += advance;
/* aliases */
- na = EXTRACT_BE_U_2(gnba->naliases);
+ na = GET_BE_U_2(gnba->naliases);
for (i = 0; i < na; i++) {
advance = lwres_printnamelen(ndo, s);
if (advance < 0)
@@ -543,20 +543,20 @@ lwres_print(netdissect_options *ndo,
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT(" flags:0x%x",
- EXTRACT_BE_U_4(grbn->flags));
+ GET_BE_U_4(grbn->flags));
}
ND_PRINT(" %s", tok2str(ns_type2str, "Type%u",
- EXTRACT_BE_U_2(grbn->rdtype)));
- if (EXTRACT_BE_U_2(grbn->rdclass) != C_IN) {
+ GET_BE_U_2(grbn->rdtype)));
+ if (GET_BE_U_2(grbn->rdclass) != C_IN) {
ND_PRINT(" %s", tok2str(ns_class2str, "Class%u",
- EXTRACT_BE_U_2(grbn->rdclass)));
+ GET_BE_U_2(grbn->rdclass)));
}
ND_PRINT(" TTL ");
unsigned_relts_print(ndo,
- EXTRACT_BE_U_4(grbn->ttl));
- ND_PRINT(" %u/%u", EXTRACT_BE_U_2(grbn->nrdatas),
- EXTRACT_BE_U_2(grbn->nsigs));
+ GET_BE_U_4(grbn->ttl));
+ ND_PRINT(" %u/%u", GET_BE_U_2(grbn->nrdatas),
+ GET_BE_U_2(grbn->nsigs));
s = p + LWRES_GRBNRESPONSE_LEN;
advance = lwres_printnamelen(ndo, s);
@@ -565,7 +565,7 @@ lwres_print(netdissect_options *ndo,
s += advance;
/* rdatas */
- na = EXTRACT_BE_U_2(grbn->nrdatas);
+ na = GET_BE_U_2(grbn->nrdatas);
for (i = 0; i < na; i++) {
/* XXX should decode resource data */
advance = lwres_printbinlen(ndo, s);
@@ -575,7 +575,7 @@ lwres_print(netdissect_options *ndo,
}
/* sigs */
- na = EXTRACT_BE_U_2(grbn->nsigs);
+ na = GET_BE_U_2(grbn->nsigs);
for (i = 0; i < na; i++) {
/* XXX how should we print it? */
advance = lwres_printbinlen(ndo, s);
@@ -593,11 +593,11 @@ lwres_print(netdissect_options *ndo,
tail:
/* length mismatch */
- if (EXTRACT_BE_U_4(np->length) != length) {
- ND_PRINT(" [len: %u != %u]", EXTRACT_BE_U_4(np->length),
+ if (GET_BE_U_4(np->length) != length) {
+ ND_PRINT(" [len: %u != %u]", GET_BE_U_4(np->length),
length);
}
- if (!unsupported && s < bp + EXTRACT_BE_U_4(np->length))
+ if (!unsupported && s < bp + GET_BE_U_4(np->length))
ND_PRINT("[extra]");
return;