no chance
Fork of WIZnet_Library by
WIZnetInterface/DNSClient/DNSClient.h@4:3c94b1ba5411, 2014-10-16 (annotated)
- Committer:
- slawcio
- Date:
- Thu Oct 16 09:35:53 2014 +0000
- Revision:
- 4:3c94b1ba5411
- Parent:
- 0:b72d22e10709
W5100
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jbkim | 0:b72d22e10709 | 1 | // DNSClient.h 2013/4/5 |
jbkim | 0:b72d22e10709 | 2 | #pragma once |
jbkim | 0:b72d22e10709 | 3 | |
jbkim | 0:b72d22e10709 | 4 | #include "UDPSocket.h" |
jbkim | 0:b72d22e10709 | 5 | |
jbkim | 0:b72d22e10709 | 6 | class DNSClient { |
jbkim | 0:b72d22e10709 | 7 | public: |
jbkim | 0:b72d22e10709 | 8 | DNSClient(const char* hostname = NULL); |
jbkim | 0:b72d22e10709 | 9 | DNSClient(Endpoint* pHost); |
jbkim | 0:b72d22e10709 | 10 | virtual ~DNSClient(); |
jbkim | 0:b72d22e10709 | 11 | bool lookup(const char* hostname = NULL); |
jbkim | 0:b72d22e10709 | 12 | uint32_t ip; |
jbkim | 0:b72d22e10709 | 13 | protected: |
jbkim | 0:b72d22e10709 | 14 | void poll(); |
jbkim | 0:b72d22e10709 | 15 | void callback(); |
jbkim | 0:b72d22e10709 | 16 | int response(uint8_t buf[], int size); |
jbkim | 0:b72d22e10709 | 17 | int query(uint8_t buf[], int size, const char* hostname); |
jbkim | 0:b72d22e10709 | 18 | void resolve(const char* hostname); |
jbkim | 0:b72d22e10709 | 19 | uint8_t m_id[2]; |
jbkim | 0:b72d22e10709 | 20 | Timer m_interval; |
jbkim | 0:b72d22e10709 | 21 | int m_retry; |
jbkim | 0:b72d22e10709 | 22 | const char* m_hostname; |
jbkim | 0:b72d22e10709 | 23 | private: |
jbkim | 0:b72d22e10709 | 24 | enum MyNetDnsState |
jbkim | 0:b72d22e10709 | 25 | { |
jbkim | 0:b72d22e10709 | 26 | MYNETDNS_START, |
jbkim | 0:b72d22e10709 | 27 | MYNETDNS_PROCESSING, //Req has not completed |
jbkim | 0:b72d22e10709 | 28 | MYNETDNS_NOTFOUND, |
jbkim | 0:b72d22e10709 | 29 | MYNETDNS_ERROR, |
jbkim | 0:b72d22e10709 | 30 | MYNETDNS_OK |
jbkim | 0:b72d22e10709 | 31 | }; |
jbkim | 0:b72d22e10709 | 32 | MyNetDnsState m_state; |
jbkim | 0:b72d22e10709 | 33 | UDPSocket *m_udp; |
jbkim | 0:b72d22e10709 | 34 | }; |
jbkim | 0:b72d22e10709 | 35 |