Revert "[ST02.2] Use the getters of DnsHeader"

Revert submission 1387135-st02

Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process

Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets

Change-Id: Ia35cb3e21cd90e036a07018e2d9c1ee662ce86a2
This commit is contained in:
Remi NGUYEN VAN
2022-09-08 11:01:05 +00:00
parent ec2b24784f
commit c7043880ef
3 changed files with 5 additions and 5 deletions

View File

@@ -1512,7 +1512,7 @@ public class EthernetTetheringTest {
final TestDnsPacket dnsQuery = TestDnsPacket.getTestDnsPacket(buf);
assertNotNull(dnsQuery);
Log.d(TAG, "Forwarded UDP source port: " + udpHeader.srcPort + ", DNS query id: "
+ dnsQuery.getHeader().getId());
+ dnsQuery.getHeader().id);
// [2] Send DNS reply.
// DNS server --> upstream --> dnsmasq forwarding --> downstream --> tethered device
@@ -1522,7 +1522,7 @@ public class EthernetTetheringTest {
final Inet4Address remoteIp = (Inet4Address) TEST_IP4_DNS;
final Inet4Address tetheringUpstreamIp = (Inet4Address) TEST_IP4_ADDR.getAddress();
sendDownloadPacketDnsV4(remoteIp, tetheringUpstreamIp, DNS_PORT,
(short) udpHeader.srcPort, (short) dnsQuery.getHeader().getId(), tester);
(short) udpHeader.srcPort, (short) dnsQuery.getHeader().id, tester);
}
private <T> List<T> toList(T... array) {

View File

@@ -544,7 +544,7 @@ public final class DnsResolver {
DnsAddressAnswer(@NonNull byte[] data) throws ParseException {
super(data);
if ((mHeader.getFlags() & (1 << 15)) == 0) {
if ((mHeader.flags & (1 << 15)) == 0) {
throw new ParseException("Not an answer packet");
}
if (mHeader.getRecordCount(QDSECTION) == 0) {

View File

@@ -200,13 +200,13 @@ public class DnsResolverTest {
super(data);
// Check QR field.(query (0), or a response (1)).
if ((mHeader.getFlags() & (1 << 15)) == 0) {
if ((mHeader.flags & (1 << 15)) == 0) {
throw new DnsParseException("Not an answer packet");
}
}
int getRcode() {
return mHeader.getFlags() & 0x0F;
return mHeader.rcode;
}
int getANCount() {