Fork of original library, increased Tx buffer to 16kB
Dependents: W5500-SNTPClient-example
DNSClient/DNSClient.h@0:e9275bdfa393, 2019-05-02 (annotated)
- Committer:
- star297
- Date:
- Thu May 02 20:47:25 2019 +0000
- Revision:
- 0:e9275bdfa393
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
star297 | 0:e9275bdfa393 | 1 | // DNSClient.h 2013/4/5 |
star297 | 0:e9275bdfa393 | 2 | #pragma once |
star297 | 0:e9275bdfa393 | 3 | |
star297 | 0:e9275bdfa393 | 4 | #include "UDPSocket.h" |
star297 | 0:e9275bdfa393 | 5 | |
star297 | 0:e9275bdfa393 | 6 | class DNSClient { |
star297 | 0:e9275bdfa393 | 7 | public: |
star297 | 0:e9275bdfa393 | 8 | DNSClient(const char* hostname = NULL); |
star297 | 0:e9275bdfa393 | 9 | DNSClient(Endpoint* pHost); |
star297 | 0:e9275bdfa393 | 10 | virtual ~DNSClient(); |
star297 | 0:e9275bdfa393 | 11 | bool lookup(const char* hostname = NULL); |
star297 | 0:e9275bdfa393 | 12 | uint32_t ip; |
star297 | 0:e9275bdfa393 | 13 | protected: |
star297 | 0:e9275bdfa393 | 14 | void poll(); |
star297 | 0:e9275bdfa393 | 15 | void callback(); |
star297 | 0:e9275bdfa393 | 16 | int response(uint8_t buf[], int size); |
star297 | 0:e9275bdfa393 | 17 | int query(uint8_t buf[], int size, const char* hostname); |
star297 | 0:e9275bdfa393 | 18 | void resolve(const char* hostname); |
star297 | 0:e9275bdfa393 | 19 | uint8_t m_id[2]; |
star297 | 0:e9275bdfa393 | 20 | Timer m_interval; |
star297 | 0:e9275bdfa393 | 21 | int m_retry; |
star297 | 0:e9275bdfa393 | 22 | const char* m_hostname; |
star297 | 0:e9275bdfa393 | 23 | private: |
star297 | 0:e9275bdfa393 | 24 | enum MyNetDnsState |
star297 | 0:e9275bdfa393 | 25 | { |
star297 | 0:e9275bdfa393 | 26 | MYNETDNS_START, |
star297 | 0:e9275bdfa393 | 27 | MYNETDNS_PROCESSING, //Req has not completed |
star297 | 0:e9275bdfa393 | 28 | MYNETDNS_NOTFOUND, |
star297 | 0:e9275bdfa393 | 29 | MYNETDNS_ERROR, |
star297 | 0:e9275bdfa393 | 30 | MYNETDNS_OK |
star297 | 0:e9275bdfa393 | 31 | }; |
star297 | 0:e9275bdfa393 | 32 | MyNetDnsState m_state; |
star297 | 0:e9275bdfa393 | 33 | UDPSocket *m_udp; |
star297 | 0:e9275bdfa393 | 34 | }; |