Library to resolve text URLs to IP addresses (IPv4)

Dependents:   NetworkSocketAPI NetworkSocketAPI Nucleo-AWS-IoT-mbed

Revision:
1:5d978992a518
Parent:
0:fff4b9055396
Child:
2:12d08f0f20cf
--- a/DnsQuery.h	Tue Jul 14 20:48:12 2015 +0000
+++ b/DnsQuery.h	Fri Jul 24 22:43:25 2015 +0000
@@ -18,8 +18,8 @@
 #ifndef __DNSQUERY_H__
 #define __DNSQUERY_H__
 
-#include "Endpoint.h"
-#include "UDPSocket.h"
+#include "SocketInterface.h"
+
 typedef struct {
     union {
         struct {
@@ -62,7 +62,7 @@
       * @param wifi : A valid pointer to a Wifi Object, which can be used to obtain a UDP socket object.
       * @param dnsip : A valid pointer which holds the IPAddress of the DNS server to query.
       */
-    DnsQuery(IPADDRESS_t* dnsip);
+    DnsQuery(SocketInterface* sock);
     
     
     /** Function gethostbyname implements the functionality to query a domain name server for an IP-Address of a given hostname.
@@ -70,21 +70,22 @@
       * @param ipaddress : a reference to a IPADDRESS_t object which will receive the resolved IP Address of the host in question.
       * @returns true if successfull, or false otherwise.
       */
-    static bool gethostbyname(char* hostname, IPADDRESS_t &ipaddress);
+    bool gethostbyname(const char* hostname, IPADDRESS_t &ipaddress);
     /** Function gethostbyname implements the functionality to query a domain name server for an IP-Address of a given hostname.
       * @param hostname : the hostname of interest as a string.
       * @param ipaddress : a reference to a IPADDRESS_t object which will receive the resolved IP Address of the host in question.
       * @returns true if successfull, or false otherwise.
       */
-    bool getIP(char* hostname, IPADDRESS_t &ipaddress);
+    bool getIP(const char* hostname, IPADDRESS_t &ipaddress);
 protected:
     bool resolve(char* resp, IPADDRESS_t &ipaddress);
     bool parseRR(char *resp, int& c, IPADDRESS_t& adr );
 
 protected:
-    Endpoint* _endpoint;
     IPADDRESS_t _dnsip;
     char* _string_ip;
+    SocketInterface* socket;
+    
 };
 
 #endif // __DNSQUERY_H__
\ No newline at end of file