W5200(WIZ820io) network interface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MyNetDnsRequest.h Source File

MyNetDnsRequest.h

00001 // MyNetDnsRequest.h 2012/4/19
00002 #ifndef MYNETDNSREQUEST_H
00003 #define MYNETDNSREQUEST_H
00004 #include "if/net/netdnsrequest.h"
00005 #include "UDPSocket.h"
00006  
00007 class MyNetDnsRequest : public NetDnsRequest {
00008 public:
00009     MyNetDnsRequest(const char* hostname);
00010     MyNetDnsRequest(Host* pHost);
00011     virtual ~MyNetDnsRequest();
00012     virtual void poll();
00013     virtual void close();
00014 protected:
00015     void callback(UDPSocketEvent e);
00016     int response(uint8_t buf[], int size);
00017     int query(uint8_t buf[], int size, const char* hostname);
00018     void resolve(const char* hostname);
00019     uint8_t m_id[2];
00020     Timer m_interval;
00021     int m_retry;
00022 private:
00023     enum MyNetDnsState
00024     {
00025         MYNETDNS_START,
00026         MYNETDNS_PROCESSING, //Req has not completed
00027         MYNETDNS_NOTFOUND,
00028         MYNETDNS_ERROR,
00029         MYNETDNS_OK
00030     };
00031     MyNetDnsState m_state;
00032     bool m_cbFired;
00033     bool m_closing;
00034     UDPSocket *m_udp;
00035 };
00036 #endif //MYNETDNSREQUEST_H