Skip to content

Commit 7d13c51

Browse files
author
Laurent Louf
committed
Add the type and class as members of the DNS class for an eventual future use.
1 parent 15ceed0 commit 7d13c51

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

libraries/DNSServer/src/DNSServer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ void DNSServer::processNextRequest()
6060
if (_buffer == NULL) return;
6161
_udp.read(_buffer, _currentPacketSize);
6262
_dnsHeader = (DNSHeader*) _buffer;
63+
_type = (uint16_t) ( (_buffer[_currentPacketSize - 4] << 8) + _buffer[_currentPacketSize - 3] ) ;
64+
_class = (uint16_t) ( (_buffer[_currentPacketSize - 2] << 8) + _buffer[_currentPacketSize - 1] ) ;
6365

6466
if (_dnsHeader->QR == DNS_QR_QUERY &&
6567
_dnsHeader->OPCode == DNS_OPCODE_QUERY &&

libraries/DNSServer/src/DNSServer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class DNSServer
8787
DNSHeader* _dnsHeader;
8888
uint32_t _ttl;
8989
DNSReplyCode _errorReplyCode;
90+
uint16_t _type ;
91+
uint16_t _class ;
9092

9193
void downcaseAndRemoveWwwPrefix(String &domainName);
9294
String getDomainNameWithoutWwwPrefix();

0 commit comments

Comments
 (0)