Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of WIZnetInterface by
Socket/DNSClient.h@38:67e763cdde02, 2017-10-12 (annotated)
- Committer:
- Helmut Tschemernjak
- Date:
- Thu Oct 12 12:19:11 2017 +0200
- Revision:
- 38:67e763cdde02
- Parent:
- 34:7d44648ec5f2
Enable Interrupts for all sockets by default.
Added a Soft-Reset in the reset() functions which works perfect
when no Reset line is connected.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Soohwan Kim |
0:6f28332c466f | 1 | // DNSClient.h 2013/4/5 |
| Soohwan Kim |
0:6f28332c466f | 2 | #pragma once |
| Soohwan Kim |
0:6f28332c466f | 3 | |
| Soohwan Kim |
0:6f28332c466f | 4 | #include "UDPSocket.h" |
| Soohwan Kim |
0:6f28332c466f | 5 | |
| Soohwan Kim |
0:6f28332c466f | 6 | class DNSClient { |
| Soohwan Kim |
0:6f28332c466f | 7 | public: |
| Soohwan Kim |
0:6f28332c466f | 8 | DNSClient(const char* hostname = NULL); |
| Soohwan Kim |
0:6f28332c466f | 9 | DNSClient(Endpoint* pHost); |
| Soohwan Kim |
0:6f28332c466f | 10 | virtual ~DNSClient(); |
| Helmut Tschemernjak | 34:7d44648ec5f2 | 11 | bool lookup(const char* hostname = NULL, uint32_t dnsServer = 0); |
| Soohwan Kim |
0:6f28332c466f | 12 | uint32_t ip; |
| Soohwan Kim |
0:6f28332c466f | 13 | protected: |
| Soohwan Kim |
0:6f28332c466f | 14 | void poll(); |
| Soohwan Kim |
0:6f28332c466f | 15 | void callback(); |
| Soohwan Kim |
0:6f28332c466f | 16 | int response(uint8_t buf[], int size); |
| Soohwan Kim |
0:6f28332c466f | 17 | int query(uint8_t buf[], int size, const char* hostname); |
| Soohwan Kim |
0:6f28332c466f | 18 | void resolve(const char* hostname); |
| Soohwan Kim |
0:6f28332c466f | 19 | uint8_t m_id[2]; |
| Soohwan Kim |
0:6f28332c466f | 20 | Timer m_interval; |
| Soohwan Kim |
0:6f28332c466f | 21 | int m_retry; |
| Soohwan Kim |
0:6f28332c466f | 22 | private: |
| Soohwan Kim |
0:6f28332c466f | 23 | enum MyNetDnsState |
| Soohwan Kim |
0:6f28332c466f | 24 | { |
| Soohwan Kim |
0:6f28332c466f | 25 | MYNETDNS_START, |
| Soohwan Kim |
0:6f28332c466f | 26 | MYNETDNS_PROCESSING, //Req has not completed |
| Soohwan Kim |
0:6f28332c466f | 27 | MYNETDNS_NOTFOUND, |
| Soohwan Kim |
0:6f28332c466f | 28 | MYNETDNS_ERROR, |
| Soohwan Kim |
0:6f28332c466f | 29 | MYNETDNS_OK |
| Soohwan Kim |
0:6f28332c466f | 30 | }; |
| Soohwan Kim |
0:6f28332c466f | 31 | MyNetDnsState m_state; |
| Soohwan Kim |
0:6f28332c466f | 32 | UDPSocket *m_udp; |
| Helmut Tschemernjak | 34:7d44648ec5f2 | 33 | const char* m_hostname; |
| Helmut Tschemernjak | 34:7d44648ec5f2 | 34 | uint32_t m_dnsServer; |
| Soohwan Kim |
0:6f28332c466f | 35 | }; |
| Soohwan Kim |
0:6f28332c466f | 36 |
