W5500 driver for mbed OS 5

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

Fork of W5500Interface by Sergei G

Revision:
11:5118c2bff025
Parent:
10:925201b1603f
Child:
12:3a5f5b5ae5f8
--- a/W5500Interface.h	Mon Aug 13 02:30:22 2018 +0000
+++ b/W5500Interface.h	Mon Aug 13 08:11:02 2018 +0000
@@ -24,6 +24,7 @@
 #include "W5500.h"
 //#include "rtos.h"
 #include "PinNames.h"
+#include "DNSClient.h"
  
 // Arduino pin defaults for convenience
 #if !defined(W5500_SPI_MOSI)
@@ -84,9 +85,19 @@
      *  @return             IP address of the interface or null if not yet connected
      */
     virtual const char *get_ip_address();
-    virtual const char *get_netmask();
+     /** Get the local gateway
+     *
+     *  @return         Null-terminated representation of the local gateway
+     *                  or null if no network mask has been recieved
+     */
     virtual const char *get_gateway();
 
+    /** Get the local network mask
+     *
+     *  @return         Null-terminated representation of the local network mask
+     *                  or null if no network mask has been recieved
+     */
+    virtual const char *get_netmask();
  
     /** Get MAC address and fill mac with it. 
     */
@@ -96,6 +107,27 @@
      *  @return             MAC address of the interface
      */
     virtual const char *get_mac_address();
+    
+
+	bool setDnsServerIP(const char* ip_address);
+
+    /** Translates a hostname to an IP address with specific version
+     *
+     *  The hostname may be either a domain name or an IP address. If the
+     *  hostname is an IP address, no network transactions will be performed.
+     *
+     *  If no stack-specific DNS resolution is provided, the hostname
+     *  will be resolve using a UDP socket on the stack.
+     *
+     *  @param address  Destination for the host SocketAddress
+     *  @param host     Hostname to resolve
+     *  @param version  IP version of address to resolve, NSAPI_UNSPEC indicates
+     *                  version is chosen by the stack (defaults to NSAPI_UNSPEC)
+     *  @return         0 on success, negative error code on failure
+     */
+    //using NetworkInterface::gethostbyname;
+    virtual nsapi_error_t gethostbyname(const char *host,
+            SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);    
 	
 protected:
     /** Opens a socket
@@ -283,6 +315,8 @@
     struct w5500_socket w5500_sockets[MAX_SOCK_NUM];
     w5500_socket* get_sock(int fd);
     void init_socks();
+
+	DNSClient  dns;
 /*	
 	Thread *_daemon;
     void daemon();