WIZnetInterface using namespace

Dependents:   DualNetworkInterface-Basic

Fork of WIZnetInterface by WIZnet

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DNSClient.hpp Source File

DNSClient.hpp

00001 // DNSClient.h 2013/4/5
00002 #pragma once
00003 
00004 #include "UDPSocket.hpp"
00005 
00006 namespace wiznet_space {
00007 
00008 class DNSClient {
00009 public:
00010     DNSClient(const char* hostname = NULL);
00011     DNSClient(Endpoint* pHost);
00012     virtual ~DNSClient();
00013     bool lookup(const char* hostname = NULL);
00014     uint32_t ip;
00015 protected:
00016     void poll();
00017     void callback();
00018     int response(uint8_t buf[], int size);
00019     int query(uint8_t buf[], int size, const char* hostname);
00020     void resolve(const char* hostname);
00021     uint8_t m_id[2];
00022     Timer m_interval;
00023     int m_retry;
00024     const char* m_hostname;
00025 private:
00026     enum MyNetDnsState
00027     {
00028         MYNETDNS_START,
00029         MYNETDNS_PROCESSING, //Req has not completed
00030         MYNETDNS_NOTFOUND,
00031         MYNETDNS_ERROR,
00032         MYNETDNS_OK
00033     };
00034     MyNetDnsState m_state;
00035     UDPSocket *m_udp;
00036 };
00037 
00038 }