MQTT client test with W5200 ethernet shield

Dependents:   IBMIoTClientEthernetExample_W5200

Fork of W5500Interface by W5500-Ethernet-Interface Makers

DNSClient/DNSClient.h

Committer:
hillkim7
Date:
2014-12-25
Revision:
11:313e091ab3f9
Parent:
0:e11e8793c3ce

File content as of revision 11:313e091ab3f9:

// 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 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;
    const char* m_hostname;
private:
    enum MyNetDnsState
    {
        MYNETDNS_START,
        MYNETDNS_PROCESSING, //Req has not completed
        MYNETDNS_NOTFOUND,
        MYNETDNS_ERROR,
        MYNETDNS_OK
    };
    MyNetDnsState m_state;
    UDPSocket *m_udp;
};