Mateusz Jaskula
/
KL25Z_TangoIO
KL25 driver for Tango Control System
DNSClient/DNSClient.h@0:5d27c333afa6, 2014-08-25 (annotated)
- Committer:
- jskl
- Date:
- Mon Aug 25 12:00:15 2014 +0000
- Revision:
- 0:5d27c333afa6
Initial Release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jskl | 0:5d27c333afa6 | 1 | // DNSClient.h 2013/4/5 |
jskl | 0:5d27c333afa6 | 2 | #pragma once |
jskl | 0:5d27c333afa6 | 3 | |
jskl | 0:5d27c333afa6 | 4 | #include "UDPSocket.h" |
jskl | 0:5d27c333afa6 | 5 | |
jskl | 0:5d27c333afa6 | 6 | class DNSClient { |
jskl | 0:5d27c333afa6 | 7 | public: |
jskl | 0:5d27c333afa6 | 8 | DNSClient(const char* hostname = NULL); |
jskl | 0:5d27c333afa6 | 9 | DNSClient(Endpoint* pHost); |
jskl | 0:5d27c333afa6 | 10 | virtual ~DNSClient(); |
jskl | 0:5d27c333afa6 | 11 | bool lookup(const char* hostname = NULL); |
jskl | 0:5d27c333afa6 | 12 | uint32_t ip; |
jskl | 0:5d27c333afa6 | 13 | protected: |
jskl | 0:5d27c333afa6 | 14 | void poll(); |
jskl | 0:5d27c333afa6 | 15 | void callback(); |
jskl | 0:5d27c333afa6 | 16 | int response(uint8_t buf[], int size); |
jskl | 0:5d27c333afa6 | 17 | int query(uint8_t buf[], int size, const char* hostname); |
jskl | 0:5d27c333afa6 | 18 | void resolve(const char* hostname); |
jskl | 0:5d27c333afa6 | 19 | uint8_t m_id[2]; |
jskl | 0:5d27c333afa6 | 20 | Timer m_interval; |
jskl | 0:5d27c333afa6 | 21 | int m_retry; |
jskl | 0:5d27c333afa6 | 22 | const char* m_hostname; |
jskl | 0:5d27c333afa6 | 23 | private: |
jskl | 0:5d27c333afa6 | 24 | enum MyNetDnsState |
jskl | 0:5d27c333afa6 | 25 | { |
jskl | 0:5d27c333afa6 | 26 | MYNETDNS_START, |
jskl | 0:5d27c333afa6 | 27 | MYNETDNS_PROCESSING, //Req has not completed |
jskl | 0:5d27c333afa6 | 28 | MYNETDNS_NOTFOUND, |
jskl | 0:5d27c333afa6 | 29 | MYNETDNS_ERROR, |
jskl | 0:5d27c333afa6 | 30 | MYNETDNS_OK |
jskl | 0:5d27c333afa6 | 31 | }; |
jskl | 0:5d27c333afa6 | 32 | MyNetDnsState m_state; |
jskl | 0:5d27c333afa6 | 33 | UDPSocket *m_udp; |
jskl | 0:5d27c333afa6 | 34 | }; |
jskl | 0:5d27c333afa6 | 35 |