W5500 driver for mbed OS 5

Dependents:   http-webserver-example mbed-os-example-sockets

Fork of W5500Interface by Sergei G

Committer:
Bongjun
Date:
Thu Aug 09 08:10:27 2018 +0000
Revision:
6:e2ab76b2be07
changes for mbed OS 5 web server example; - add internal W5500 instance; - changes for web server example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bongjun 6:e2ab76b2be07 1 // DNSClient.h 2013/4/5
Bongjun 6:e2ab76b2be07 2 #pragma once
Bongjun 6:e2ab76b2be07 3
Bongjun 6:e2ab76b2be07 4 #include "UDPSocket.h"
Bongjun 6:e2ab76b2be07 5
Bongjun 6:e2ab76b2be07 6 //#define DBG_DNS 1
Bongjun 6:e2ab76b2be07 7
Bongjun 6:e2ab76b2be07 8 class DNSClient {
Bongjun 6:e2ab76b2be07 9 public:
Bongjun 6:e2ab76b2be07 10 DNSClient();
Bongjun 6:e2ab76b2be07 11 DNSClient(NetworkStack *ns, const char* hostname = NULL);
Bongjun 6:e2ab76b2be07 12 DNSClient(NetworkStack *ns, SocketAddress* pHost);
Bongjun 6:e2ab76b2be07 13
Bongjun 6:e2ab76b2be07 14 int setup(NetworkStack *ns);
Bongjun 6:e2ab76b2be07 15
Bongjun 6:e2ab76b2be07 16 virtual ~DNSClient();
Bongjun 6:e2ab76b2be07 17 bool lookup(const char* hostname);
Bongjun 6:e2ab76b2be07 18 bool set_server(const char* serverip, int port=53);
Bongjun 6:e2ab76b2be07 19 uint32_t get_ip() {return m_ip;}
Bongjun 6:e2ab76b2be07 20 const char* get_ip_address() {return m_ipaddr;}
Bongjun 6:e2ab76b2be07 21
Bongjun 6:e2ab76b2be07 22 protected:
Bongjun 6:e2ab76b2be07 23 void poll();
Bongjun 6:e2ab76b2be07 24 void callback();
Bongjun 6:e2ab76b2be07 25 int response(uint8_t buf[], int size);
Bongjun 6:e2ab76b2be07 26 int query(uint8_t buf[], int size, const char* hostname);
Bongjun 6:e2ab76b2be07 27 void resolve(const char* hostname);
Bongjun 6:e2ab76b2be07 28 uint8_t m_id[2];
Bongjun 6:e2ab76b2be07 29 Timer m_interval;
Bongjun 6:e2ab76b2be07 30 int m_retry;
Bongjun 6:e2ab76b2be07 31 const char* m_hostname;
Bongjun 6:e2ab76b2be07 32
Bongjun 6:e2ab76b2be07 33 private:
Bongjun 6:e2ab76b2be07 34 enum MyNetDnsState
Bongjun 6:e2ab76b2be07 35 {
Bongjun 6:e2ab76b2be07 36 MYNETDNS_START,
Bongjun 6:e2ab76b2be07 37 MYNETDNS_PROCESSING, //Req has not completed
Bongjun 6:e2ab76b2be07 38 MYNETDNS_NOTFOUND,
Bongjun 6:e2ab76b2be07 39 MYNETDNS_ERROR,
Bongjun 6:e2ab76b2be07 40 MYNETDNS_OK
Bongjun 6:e2ab76b2be07 41 };
Bongjun 6:e2ab76b2be07 42 MyNetDnsState m_state;
Bongjun 6:e2ab76b2be07 43 UDPSocket *m_udp;
Bongjun 6:e2ab76b2be07 44 NetworkStack *m_ns;
Bongjun 6:e2ab76b2be07 45
Bongjun 6:e2ab76b2be07 46 uint32_t m_ip;
Bongjun 6:e2ab76b2be07 47 char m_ipaddr[24];
Bongjun 6:e2ab76b2be07 48 };