Implementation of the NetworkSocketAPI for LWIP

Dependencies:   lwip-eth lwip-sys lwip

Dependents:   HelloLWIPInterface HelloLWIPInterfaceNonBlocking LWIPInterfaceTests SimpleHTTPExample ... more

Revision:
4:a7349bd7776c
Parent:
3:774869068511
Child:
5:2c7d2186543c
--- a/LWIPInterface.cpp	Mon Feb 29 22:58:45 2016 +0000
+++ b/LWIPInterface.cpp	Mon Feb 29 23:01:54 2016 +0000
@@ -148,31 +148,10 @@
     return mac_addr;
 }
 
-
-/** LWIPSocket class
- *  Implementation of the TCP SocketInterface for LWIP
- */
-class LWIPSocket : public SocketInterface
-{
-public:
-    LWIPSocket(int fd) : fd(fd) {}
-
-    // Implementation of SocketInterface
-    virtual int32_t open(const char *ip, uint16_t port);
-    virtual int32_t close();
-
-    virtual int32_t send(const void *data, uint32_t size);
-    virtual int32_t recv(void *data, uint32_t size);
-
-    int fd;
-};
-
-
 SocketInterface *LWIPInterface::createSocket(ns_protocol_t proto)
 {
     int type = (proto == NS_UDP) ? SOCK_DGRAM : SOCK_STREAM;
     int fd = lwip_socket(AF_INET, type, 0);
-
     if (fd < 0) {
         return 0;
     }
@@ -190,7 +169,7 @@
 
 
 // TCP SocketInterface implementation
-int32_t LWIPSocket::open(const char *ip, uint16_t port)
+int32_t LWIPInterface::LWIPSocket::open(const char *ip, uint16_t port)
 {
     struct sockaddr_in host;
     memset(&host, 0, sizeof host);
@@ -205,12 +184,12 @@
     return 0;
 }
 
-int32_t LWIPSocket::close()
+int32_t LWIPInterface::LWIPSocket::close()
 {
     return 0;
 }
 
-int32_t LWIPSocket::send(const void *voiddata, uint32_t size)
+int32_t LWIPInterface::LWIPSocket::send(const void *voiddata, uint32_t size)
 {
     uint8_t *data = (uint8_t *)voiddata;
     uint32_t writtenLen = 0;
@@ -230,7 +209,7 @@
     return 0;
 }
 
-int32_t LWIPSocket::recv(void *data, uint32_t size)
+int32_t LWIPInterface::LWIPSocket::recv(void *data, uint32_t size)
 {
     int ret = lwip_recv(fd, data, size, MSG_DONTWAIT);