From 8c5d809280904562aee082e2eab4ceb9f8523d9d Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Sun, 10 Mar 2013 22:55:21 +0100 Subject: Updates to WiFi shield firmware. --- firmwares/wifishield/wifiHD/src/ard_tcp.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'firmwares/wifishield/wifiHD/src/ard_tcp.h') diff --git a/firmwares/wifishield/wifiHD/src/ard_tcp.h b/firmwares/wifishield/wifiHD/src/ard_tcp.h index 010b976..7d0bf7b 100644 --- a/firmwares/wifishield/wifiHD/src/ard_tcp.h +++ b/firmwares/wifishield/wifiHD/src/ard_tcp.h @@ -15,6 +15,18 @@ typedef void (ard_tcp_done_cb_t)(void *opaque, int result); #define TTCP_MODE_TRANSMIT 0 #define TTCP_MODE_RECEIVE 1 +#define MAX_MODE_NUM 2 + +#define GET_TCP_MODE(X) ((X!=NULL)?((struct ttcp*)(X))->mode:0) +#define IS_VALID_SOCK(SOCK) ((SOCK>=0)&&(SOCKudp:0) + +// Maximum number of client connection accepted by server +#define MAX_CLIENT_ACCEPTED 4 +#define NO_VALID_ID -1 +#define GET_FIRST_CLIENT_TCP(TTCP) ((TTCP!=NULL)?TTCP->tpcb[0] : NULL) +#define GET_CLIENT_TCP(TTCP,ID) (((TTCP!=NULL)&&(ID>=0)&&(IDtpcb[ID] : NULL) + typedef struct ttcp { @@ -39,9 +51,11 @@ typedef struct ttcp { uint32_t tid; /* TCP specific */ - struct tcp_pcb* tpcb; + struct tcp_pcb* tpcb[MAX_CLIENT_ACCEPTED]; struct tcp_pcb* lpcb; char* payload; + uint8_t tcp_poll_retries; + bool pending_close[MAX_CLIENT_ACCEPTED]; /* UDP specific */ int udp_started; @@ -62,10 +76,22 @@ uint8_t getModeTcp(void* p); int sendTcpData(void* p, uint8_t* buf, uint16_t len); +int sendUdpData(void* p, uint8_t* buf, uint16_t len); + uint8_t isDataSent(void* p ); cmd_state_t cmd_ttcp(int argc, char* argv[], void* ctx); +int8_t setNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb, uint8_t id); + +int8_t insertNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb); + +int8_t removeNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb); + +bool cleanNewClientConn(struct ttcp* _ttcp); + +int8_t getNewClientConnId(struct ttcp* _ttcp, struct tcp_pcb *newpcb); + void closeConnections(); #endif -- cgit v1.2.3-18-g5258