WIZNet W5500 with additional enhancements
Fork of WIZnetInterface by
Socket/DNSClient.h
- Committer:
- Helmut Tschemernjak
- Date:
- 2017-10-12
- Revision:
- 38:67e763cdde02
- Parent:
- 34:7d44648ec5f2
File content as of revision 38:67e763cdde02:
// DNSClient.h 2013/4/5
#pragma once
#include "UDPSocket.h"
class DNSClient {
public:
DNSClient(const char* hostname = NULL);
DNSClient(Endpoint* pHost);
virtual ~DNSClient();
bool lookup(const char* hostname = NULL, uint32_t dnsServer = 0);
uint32_t ip;
protected:
void poll();
void callback();
int response(uint8_t buf[], int size);
int query(uint8_t buf[], int size, const char* hostname);
void resolve(const char* hostname);
uint8_t m_id[2];
Timer m_interval;
int m_retry;
private:
enum MyNetDnsState
{
MYNETDNS_START,
MYNETDNS_PROCESSING, //Req has not completed
MYNETDNS_NOTFOUND,
MYNETDNS_ERROR,
MYNETDNS_OK
};
MyNetDnsState m_state;
UDPSocket *m_udp;
const char* m_hostname;
uint32_t m_dnsServer;
};
Helmut Tschemernjak
