Clean up the code. Manage the reconnection. Use the lwip error, insted
[bertos.git] / bertos / net / tcp_socket.h
index 095321ee43ad8c122003ce77eba0520a466f7014..0791c187864ba3cd4910f3f4b637ce96781cee49 100644 (file)
 #include <lwip/netif.h>
 #include <lwip/ip_addr.h>
 
-#define ERR_TCP_NOTCONN    BV(0);
-#define ERR_CONN_RESET     BV(1);
-#define ERR_CONN_CLOSE     BV(2);
-#define ERR_RECV_DATA      BV(3);
-
-
 typedef struct TcpSocket
 {
        KFile fd;
        struct netconn *sock;
+       struct netbuf *rx_buf_conn;
+       size_t remaning_data_len;
+
        struct ip_addr *local_addr;
        struct ip_addr *remote_addr;
        uint16_t port;
-       uint16_t error;
+
+       int error;
 } TcpSocket;
 
 #define KFT_TCPSOCKET MAKE_ID('T', 'S', 'C', 'K')
@@ -70,7 +68,6 @@ INLINE TcpSocket *TCPSOCKET_CAST(KFile *fd)
        return (TcpSocket *)fd;
 }
 
-
 void tcpsocket_init(TcpSocket *socket, struct ip_addr *local_addr, struct ip_addr *remote_addr, uint16_t port);
 
 #endif /* NET_TCP_SOCKET_H */