Library to resolve text URLs to IP addresses (IPv4)

Dependents:   NetworkSocketAPI NetworkSocketAPI Nucleo-AWS-IoT-mbed

Revision:
9:16e5208cc4ef
Parent:
7:cbe1ef566314
Child:
10:0fe2c42a0261
--- a/DnsQuery.cpp	Thu Feb 25 04:05:53 2016 -0600
+++ b/DnsQuery.cpp	Sun Feb 28 11:23:59 2016 -0600
@@ -98,7 +98,7 @@
         return false;
     
     int packetlen = /* size of HEADER structure */ 12 + /* size of QUESTION Structure */5 + len + 1;
-    char *packet = new char[packetlen]; /* this is the UDP packet to send to the DNS */
+    uint8_t *packet = new uint8_t[packetlen]; /* this is the UDP packet to send to the DNS */
     if (packet == NULL)
         return false;
     
@@ -149,7 +149,7 @@
     }
     delete packet;
     
-    packet = new char [1024];
+    packet = new uint8_t [1024];
     
     //  Receive the answer from DNS
     int response_length = 0;
@@ -182,7 +182,7 @@
 }
 
 
-bool DnsQuery::resolve(char* resp, char* ipaddress)
+bool DnsQuery::resolve(unsigned char* resp, char* ipaddress)
 {
     
     int ID = (((int)resp[0]) <<8) + resp[1];
@@ -215,7 +215,7 @@
     return false;
 }
 
-bool DnsQuery::parseRR(char *resp, int& c, char* adr )
+bool DnsQuery::parseRR(uint8_t *resp, int& c, char* adr )
 {
     int n = 0;
     while( (n=resp[c++]) != 0) {