Clean up the code. Manage the reconnection. Use the lwip error, insted
[bertos.git] / bertos / net / tcp_socket.h
index 4022b4e6318bb8c8e3f508c7c7ee165547a8507c..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;
+
        int error;
-       size_t remaning_data_len;
-       struct netbuf *rx_buf_conn;
 } TcpSocket;
 
 #define KFT_TCPSOCKET MAKE_ID('T', 'S', 'C', 'K')
@@ -72,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 */