summaryrefslogtreecommitdiff
path: root/print-udp.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2017-11-18 11:52:52 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2017-11-18 13:56:40 +0100
commit577621026df8d4a33a34d4e125f9ec964fc0e53c (patch)
treea25ed4b22461cbb115c9e112935c28bcd57406bc /print-udp.c
parent0e854b0937199956478686ae610ff9f794aafc6b (diff)
downloadtcpdump-577621026df8d4a33a34d4e125f9ec964fc0e53c.tar.gz
Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()
It indicates clearly that these macros are used to extract big-endian integral values.
Diffstat (limited to 'print-udp.c')
-rw-r--r--print-udp.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/print-udp.c b/print-udp.c
index 262917fb..d3af575c 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -103,24 +103,24 @@ vat_print(netdissect_options *ndo, const void *hdr, register const struct udphdr
u_int ts;
ND_TCHECK_16BITS((const u_int *)hdr);
- ts = EXTRACT_16BITS(hdr);
+ ts = EXTRACT_BE_16BITS(hdr);
if ((ts & 0xf060) != 0) {
/* probably vt */
ND_TCHECK_16BITS(&up->uh_ulen);
ND_PRINT((ndo, "udp/vt %u %d / %d",
- (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up)),
+ (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up)),
ts & 0x3ff, ts >> 10));
} else {
/* probably vat */
uint32_t i0, i1;
ND_TCHECK_32BITS(&((const u_int *)hdr)[0]);
- i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]);
+ i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
ND_TCHECK_32BITS(&((const u_int *)hdr)[1]);
- i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]);
+ i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
ND_TCHECK_16BITS(&up->uh_ulen);
ND_PRINT((ndo, "udp/vat %u c%d %u%s",
- (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
+ (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
i0 & 0xffff,
i1, i0 & 0x800000? "*" : ""));
/* audio format */
@@ -145,11 +145,11 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
const char * ptype;
ND_TCHECK_32BITS(&((const u_int *)hdr)[0]);
- i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]);
+ i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
ND_TCHECK_32BITS(&((const u_int *)hdr)[1]);
- i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]);
+ i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
ND_TCHECK_16BITS(&up->uh_ulen);
- dlen = EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
+ dlen = EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
ip += 2;
len >>= 2;
len -= 2;
@@ -181,12 +181,12 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
i1));
if (ndo->ndo_vflag) {
ND_TCHECK_32BITS(&((const u_int *)hdr)[2]);
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&((const u_int *)hdr)[2])));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&((const u_int *)hdr)[2])));
if (hasopt) {
u_int i2, optlen;
do {
ND_TCHECK_32BITS(ip);
- i2 = EXTRACT_32BITS(ip);
+ i2 = EXTRACT_BE_32BITS(ip);
optlen = (i2 >> 16) & 0xff;
if (optlen == 0 || optlen > len) {
ND_PRINT((ndo, " !opt"));
@@ -199,7 +199,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
if (hasext) {
u_int i2, extlen;
ND_TCHECK_32BITS(ip);
- i2 = EXTRACT_32BITS(ip);
+ i2 = EXTRACT_BE_32BITS(ip);
extlen = (i2 & 0xffff) + 1;
if (extlen > len) {
ND_PRINT((ndo, " !ext"));
@@ -209,7 +209,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
}
ND_TCHECK_32BITS(ip);
if (contype == 0x1f) /*XXX H.261 */
- ND_PRINT((ndo, " 0x%04x", EXTRACT_32BITS(ip) >> 16));
+ ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_32BITS(ip) >> 16));
}
trunc:
@@ -230,8 +230,8 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
if ((const u_char *)(rh + 1) > ep)
goto trunc;
ND_TCHECK(*rh);
- len = (EXTRACT_16BITS(&rh->rh_len) + 1) * 4;
- flags = EXTRACT_16BITS(&rh->rh_flags);
+ len = (EXTRACT_BE_16BITS(&rh->rh_len) + 1) * 4;
+ flags = EXTRACT_BE_16BITS(&rh->rh_flags);
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
@@ -240,15 +240,15 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
ND_PRINT((ndo, " [%d]", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
if ((const u_char *)(sr + 1) > ep)
goto trunc;
ND_TCHECK(*sr);
- ts = (double)(EXTRACT_32BITS(&sr->sr_ntp.upper)) +
- ((double)(EXTRACT_32BITS(&sr->sr_ntp.lower)) /
- 4294967296.0);
- ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_32BITS(&sr->sr_ts),
- EXTRACT_32BITS(&sr->sr_np), EXTRACT_32BITS(&sr->sr_nb)));
+ ts = (double)(EXTRACT_BE_32BITS(&sr->sr_ntp.upper)) +
+ ((double)(EXTRACT_BE_32BITS(&sr->sr_ntp.lower)) /
+ 4294967296.0);
+ ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_32BITS(&sr->sr_ts),
+ EXTRACT_BE_32BITS(&sr->sr_np), EXTRACT_BE_32BITS(&sr->sr_nb)));
rr = (const struct rtcp_rr *)(sr + 1);
break;
case RTCP_PT_RR:
@@ -257,18 +257,18 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
ND_PRINT((ndo, " [%d]", len));
rr = (const struct rtcp_rr *)(rh + 1);
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
break;
case RTCP_PT_SDES:
ND_PRINT((ndo, " sdes %d", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
cnt = 0;
break;
case RTCP_PT_BYE:
ND_PRINT((ndo, " bye %d", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
cnt = 0;
break;
default:
@@ -283,13 +283,13 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
goto trunc;
ND_TCHECK(*rr);
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rr->rr_srcid)));
- ts = (double)(EXTRACT_32BITS(&rr->rr_lsr)) / 65536.;
- dts = (double)(EXTRACT_32BITS(&rr->rr_dlsr)) / 65536.;
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rr->rr_srcid)));
+ ts = (double)(EXTRACT_BE_32BITS(&rr->rr_lsr)) / 65536.;
+ dts = (double)(EXTRACT_BE_32BITS(&rr->rr_dlsr)) / 65536.;
ND_PRINT((ndo, " %ul %us %uj @%.2f+%.2f",
- EXTRACT_32BITS(&rr->rr_nl) & 0x00ffffff,
- EXTRACT_32BITS(&rr->rr_ls),
- EXTRACT_32BITS(&rr->rr_dv), ts, dts));
+ EXTRACT_BE_32BITS(&rr->rr_nl) & 0x00ffffff,
+ EXTRACT_BE_32BITS(&rr->rr_ls),
+ EXTRACT_BE_32BITS(&rr->rr_dv), ts, dts));
}
return (hdr + len);
@@ -390,8 +390,8 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
goto trunc;
}
- sport = EXTRACT_16BITS(&up->uh_sport);
- dport = EXTRACT_16BITS(&up->uh_dport);
+ sport = EXTRACT_BE_16BITS(&up->uh_sport);
+ dport = EXTRACT_BE_16BITS(&up->uh_dport);
if (length < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
@@ -402,7 +402,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
udpipaddr_print(ndo, ip, sport, dport);
goto trunc;
}
- ulen = EXTRACT_16BITS(&up->uh_ulen);
+ ulen = EXTRACT_BE_16BITS(&up->uh_ulen);
if (ulen < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
ND_PRINT((ndo, "truncated-udplength %d", ulen));
@@ -437,7 +437,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
case PT_RPC:
rp = (const struct sunrpc_msg *)(up + 1);
- direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
if (direction == SUNRPC_CALL)
sunrpc_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
@@ -508,15 +508,15 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
rp = (const struct sunrpc_msg *)(up + 1);
if (ND_TTEST(rp->rm_direction)) {
- direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
- ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
nfsreq_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
- ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
nfsreply_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
@@ -539,7 +539,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
* TCP does, and we do so for UDP-over-IPv6.
*/
if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) {
- udp_sum = EXTRACT_16BITS(&up->uh_sum);
+ udp_sum = EXTRACT_BE_16BITS(&up->uh_sum);
if (udp_sum == 0) {
ND_PRINT((ndo, "[no cksum] "));
} else if (ND_TTEST2(cp[0], length)) {
@@ -557,7 +557,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
/* for IPv6, UDP checksum is mandatory */
if (ND_TTEST2(cp[0], length)) {
sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));
- udp_sum = EXTRACT_16BITS(&up->uh_sum);
+ udp_sum = EXTRACT_BE_16BITS(&up->uh_sum);
if (sum != 0) {
ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ",