cc3000 hostdriver with the mbed socket interface

Dependents:   cc3000_hello_world_demo cc3000_simple_socket_demo cc3000_ntp_demo cc3000_ping_demo ... more

Revision:
45:50ab13d8f2dc
Parent:
34:1ad18123bf11
--- a/Socket/Endpoint.cpp	Sun Oct 13 11:46:21 2013 +0200
+++ b/Socket/Endpoint.cpp	Wed Nov 06 17:56:25 2013 +0100
@@ -23,7 +23,7 @@
  #include "cc3000.h"
 
 /* Copied from lwip */
-static char *inet_ntoa_r(const in_addr addr, char *buf, int buflen)
+static char *cc3000_inet_ntoa_r(const in_addr addr, char *buf, int buflen)
 {
   uint32_t s_addr;
   char inv[3];
@@ -78,7 +78,6 @@
 int Endpoint::set_address(const char* host, const int port) {
     reset_address();
 
-    int resolveRetCode;
     char address[5];
     char *p_address = address;
 
@@ -92,18 +91,23 @@
     std::memset(_ipAddress,0,sizeof(_ipAddress));
 
     if (result != 4) {
+ #ifndef CC3000_TINY_DRIVER
         //Resolve DNS address or populate hard-coded IP address
         uint32_t address_integer;
+        int resolveRetCode;
         resolveRetCode = _cc3000_module->_socket.gethostbyname((uint8_t *)host, strlen(host) , &address_integer);
 
         if ((resolveRetCode > -1) && (0 != address_integer)) {
             _remote_host.sin_addr.s_addr = htonl(address_integer);
-            inet_ntoa_r(_remote_host.sin_addr, _ipAddress, sizeof(_ipAddress));
+            cc3000_inet_ntoa_r(_remote_host.sin_addr, _ipAddress, sizeof(_ipAddress));
         } else {
             // Failed to resolve the address
             DBG_SOCKET("Failed to resolve the hostname : %s",host);
             return (-1);
         }
+#else
+        return -1;
+#endif
     } else {
         std::memcpy((char*)&_remote_host.sin_addr.s_addr, p_address, 4);
     }
@@ -124,7 +128,7 @@
 
 char* Endpoint::get_address() {
     if ((_ipAddress[0] == '\0') && (_remote_host.sin_addr.s_addr != 0))
-            inet_ntoa_r(_remote_host.sin_addr, _ipAddress, sizeof(_ipAddress));
+            cc3000_inet_ntoa_r(_remote_host.sin_addr, _ipAddress, sizeof(_ipAddress));
     return _ipAddress;
 }