A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: udp/dns/dns.cpp
- Revision:
- 47:73af5c0b0dc2
- Parent:
- 43:bc028d5a6424
- Child:
- 59:e0e556c8bd46
--- a/udp/dns/dns.cpp Tue Oct 24 07:01:35 2017 +0000 +++ b/udp/dns/dns.cpp Thu Oct 26 14:50:24 2017 +0000 @@ -7,7 +7,7 @@ #include "log.h" #include "dhcp.h" -void DnsProtocolToString(uint8_t protocol, int size, char* text) +void DnsProtocolString(uint8_t protocol, int size, char* text) { switch (protocol) { @@ -18,7 +18,7 @@ } } -void DnsRecordTypeToString(uint8_t recordtype, int size, char* text) +void DnsRecordTypeString(uint8_t recordtype, int size, char* text) { switch (recordtype) { @@ -30,6 +30,29 @@ default: snprintf(text, size, "%d", recordtype); break; } } +void DnsProtocolLog(uint8_t protocol) +{ + switch (protocol) + { + case DNS_PROTOCOL_UDNS: Log ("DNS "); break; + case DNS_PROTOCOL_MDNS: Log ("MDNS "); break; + case DNS_PROTOCOL_LLMNR: Log ("LLMNR"); break; + default: LogF("%d", protocol); break; + } +} + +void DnsRecordTypeLog(uint8_t recordtype) +{ + switch (recordtype) + { + case DNS_RECORD_A: Log ("A" ); break; + case DNS_RECORD_AAAA: Log ("AAAA"); break; + case DNS_RECORD_PTR: Log ("PTR" ); break; + case DNS_RECORD_TXT: Log ("TXT" ); break; + case DNS_RECORD_SRV: Log ("SRV" ); break; + default: LogF("%d", recordtype); break; + } +} int DnsGetNextProtocol4(int protocol) { switch(protocol)