ioLibrary for Cortex M series
|
Socket Driver Header File - Common. More...
Go to the source code of this file.
Macros | |
#define | WINDOWFULL_MAX_RETRY_NUM 3 |
#define | WINDOWFULL_WAIT_TIME 1000 |
#define | SOCKSTAT_CLOSED -1 |
#define | SOCKSTAT_INIT 0 |
#define | SOCKSTAT_LISTEN 1 |
#define | SOCKSTAT_SYNSENT 2 |
#define | SOCKSTAT_SYNRECV 3 |
#define | SOCKSTAT_ESTABLISHED 4 |
#define | SOCKSTAT_FIN_WAIT 5 |
#define | SOCKSTAT_CLOSING 6 |
#define | SOCKSTAT_TIME_WAIT 7 |
#define | SOCKSTAT_CLOSE_WAIT 8 |
#define | SOCKSTAT_LAST_ACK 9 |
#define | SOCKSTAT_UDP 10 |
#define | SOCKERR_BUSY -1 |
#define | SOCKERR_NOT_TCP -2 |
#define | SOCKERR_NOT_UDP -3 |
#define | SOCKERR_WRONG_ARG -4 |
#define | SOCKERR_WRONG_STATUS -5 |
#define | SOCKERR_CLOSED -6 |
#define | SOCKERR_CLOSE_WAIT -7 |
#define | SOCKERR_FIN_WAIT -8 |
#define | SOCKERR_NOT_ESTABLISHED -9 |
#define | SOCKERR_WINDOW_FULL -10 |
#define | SOCKERR_TIME_OUT -11 |
#define | SOCKERR_NULL_SRC_IP -12 |
#define | SOCKERR_BUF_NOT_ENOUGH -13 |
#define | SOCKERR_NOT_SPECIFIED -14 |
Functions | |
int8_t | TCPServerOpen (uint8_t s, uint16_t port) |
int8_t | TCPClientOpen (uint8_t s, uint16_t sport, uint8_t *dip, uint16_t dport) |
int8_t | TCPCltOpenNB (uint8_t s, uint16_t sport, uint8_t *dip, uint16_t dport) |
int8_t | TCPConnChk (uint8_t s) |
int8_t | TCPDisconnect (uint8_t s) |
int8_t | TCPClose (uint8_t s) |
int8_t | TCPCloseNB (uint8_t s) |
int8_t | TCPCloseCHK (uint8_t s) |
int8_t | TCPClsRcvCHK (uint8_t s) |
int32_t | TCPSend (uint8_t s, const int8_t *buf, uint16_t len) |
int8_t | TCPSendNB (uint8_t s, const int8_t *buf, uint16_t len) |
int32_t | TCPReSend (uint8_t s) |
int8_t | TCPReSendNB (uint8_t s) |
int32_t | TCPSendCHK (uint8_t s) |
int32_t | TCPRecv (uint8_t s, int8_t *buf, uint16_t len) |
int8_t | UDPOpen (uint8_t s, uint16_t port) |
int8_t | UDPClose (uint8_t s) |
int32_t | UDPSend (uint8_t s, const int8_t *buf, uint16_t len, uint8_t *addr, uint16_t port) |
int32_t | UDPSendNB (uint8_t s, const int8_t *buf, uint16_t len, uint8_t *addr, uint16_t port) |
int8_t | UDPSendCHK (uint8_t s) |
int32_t | UDPRecv (uint8_t s, int8_t *buf, uint16_t len, uint8_t *addr, uint16_t *port) |
Socket Driver Header File - Common.
Definition in file socket.h.
#define WINDOWFULL_MAX_RETRY_NUM 3 |
Definition at line 17 of file socket.h.
Referenced by TCPReSendNB().
#define WINDOWFULL_WAIT_TIME 1000 |
Definition at line 18 of file socket.h.
Referenced by TCPReSendNB().
#define SOCKSTAT_CLOSED -1 |
Definition at line 21 of file socket.h.
Referenced by GetTCPSocketStatus(), and GetUDPSocketStatus().
#define SOCKSTAT_INIT 0 |
Definition at line 22 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_LISTEN 1 |
Definition at line 23 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_SYNSENT 2 |
Definition at line 24 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_SYNRECV 3 |
Definition at line 25 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_ESTABLISHED 4 |
Definition at line 26 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_FIN_WAIT 5 |
Definition at line 27 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_CLOSING 6 |
Definition at line 28 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_TIME_WAIT 7 |
Definition at line 29 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_CLOSE_WAIT 8 |
Definition at line 30 of file socket.h.
Referenced by GetTCPSocketStatus(), loopback_tcpc(), and loopback_tcps().
#define SOCKSTAT_LAST_ACK 9 |
Definition at line 31 of file socket.h.
Referenced by GetTCPSocketStatus().
#define SOCKSTAT_UDP 10 |
Definition at line 32 of file socket.h.
Referenced by GetUDPSocketStatus().
#define SOCKERR_BUSY -1 |
Definition at line 34 of file socket.h.
Referenced by sockwatch_run(), TCPClientOpen(), TCPClose(), TCPClsRcvCHK(), TCPConnChk(), TCPReSend(), TCPReSendNB(), TCPSend(), TCPSendCHK(), TCPSendNB(), UDPSend(), and UDPSendCHK().
#define SOCKERR_NOT_TCP -2 |
Definition at line 35 of file socket.h.
Referenced by GetTCPSocketStatus(), loopback_tcpc(), loopback_tcps(), TCPCloseCHK(), TCPCloseNB(), TCPClsRcvCHK(), TCPCltOpenNB(), TCPConnChk(), TCPDisconnect(), TCPRecv(), TCPReSendNB(), TCPSendNB(), and TCPServerOpen().
#define SOCKERR_NOT_UDP -3 |
Definition at line 36 of file socket.h.
Referenced by GetUDPSocketStatus(), loopback_udp(), UDPClose(), UDPOpen(), UDPRecv(), and UDPSendNB().
#define SOCKERR_WRONG_ARG -4 |
Definition at line 37 of file socket.h.
Referenced by TCPCltOpenNB(), TCPRecv(), TCPSendNB(), UDPRecv(), and UDPSendNB().
#define SOCKERR_WRONG_STATUS -5 |
Definition at line 38 of file socket.h.
Referenced by GetTCPSocketStatus(), GetUDPSocketStatus(), TCPCloseNB(), and TCPServerOpen().
#define SOCKERR_CLOSED -6 |
Definition at line 39 of file socket.h.
Referenced by loopback_tcpc(), loopback_tcps(), loopback_udp(), TCPRecv(), TCPReSendNB(), TCPSendCHK(), TCPSendNB(), UDPRecv(), and UDPSendNB().
#define SOCKERR_FIN_WAIT -8 |
Definition at line 41 of file socket.h.
Referenced by TCPReSendNB(), and TCPSendNB().
#define SOCKERR_NOT_ESTABLISHED -9 |
Definition at line 42 of file socket.h.
Referenced by TCPRecv(), TCPReSendNB(), and TCPSendNB().
#define SOCKERR_WINDOW_FULL -10 |
Definition at line 43 of file socket.h.
Referenced by loopback_tcpc(), loopback_tcps(), and TCPReSendNB().
#define SOCKERR_TIME_OUT -11 |
Definition at line 44 of file socket.h.
Referenced by loopback_udp(), TCPConnChk(), and UDPSendCHK().
#define SOCKERR_NULL_SRC_IP -12 |
Definition at line 45 of file socket.h.
Referenced by TCPCltOpenNB(), and UDPSendNB().
int8_t TCPServerOpen | ( | uint8_t | s, |
uint16_t | port | ||
) |
Definition at line 25 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, DBGA, ERRA, getSn_CR(), getSn_MR(), getSn_SR(), RET_OK, setSn_CR(), setSn_MR(), setSn_PORT(), Sn_CR_LISTEN, Sn_CR_OPEN, Sn_MR_TCP, SOCK_INIT, SOCKERR_NOT_TCP, SOCKERR_WRONG_STATUS, and TCPClose().
Referenced by loopback_tcps().
int8_t TCPClientOpen | ( | uint8_t | s, |
uint16_t | sport, | ||
uint8_t * | dip, | ||
uint16_t | dport | ||
) |
Definition at line 54 of file socket.c.
References DBG, RET_OK, SOCKERR_BUSY, TCPCltOpenNB(), and TCPConnChk().
Referenced by loopback_tcpc().
int8_t TCPCltOpenNB | ( | uint8_t | s, |
uint16_t | sport, | ||
uint8_t * | dip, | ||
uint16_t | dport | ||
) |
Definition at line 69 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, DBGA, ERR, ERRA, getSIPR(), getSn_CR(), getSn_SR(), getSUBR(), RET_OK, setSn_CR(), setSn_DIPR(), setSn_DPORT(), setSn_MR(), setSn_PORT(), Sn_CR_CONNECT, Sn_CR_OPEN, Sn_MR_TCP, SOCKERR_NOT_TCP, SOCKERR_NULL_SRC_IP, SOCKERR_WRONG_ARG, and TCPClose().
Referenced by TCPClientOpen().
int8_t TCPConnChk | ( | uint8_t | s) |
Definition at line 125 of file socket.c.
References _WIZCHIP_SOCK_NUM_, ERRA, getSn_IR(), getSn_SR(), RET_OK, setSn_IR(), Sn_IR_TIMEOUT, SOCK_ESTABLISHED, SOCKERR_BUSY, SOCKERR_NOT_TCP, and SOCKERR_TIME_OUT.
Referenced by sockwatch_run(), and TCPClientOpen().
int8_t TCPDisconnect | ( | uint8_t | s) |
Definition at line 149 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, ERR, ERRA, getSn_CR(), RET_NOK, RET_OK, setSn_CR(), Sn_CR_DISCON, and SOCKERR_NOT_TCP.
int8_t TCPClose | ( | uint8_t | s) |
Definition at line 165 of file socket.c.
References DBG, RET_OK, SOCKERR_BUSY, TCPCloseCHK(), and TCPCloseNB().
Referenced by loopback_tcpc(), loopback_tcps(), loopback_udp(), TCPCltOpenNB(), TCPSendCHK(), and TCPServerOpen().
int8_t TCPCloseNB | ( | uint8_t | s) |
Definition at line 180 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, ERRA, getSn_CR(), getSn_SR(), RET_OK, setSn_CR(), Sn_CR_DISCON, SOCK_CLOSED, SOCKERR_NOT_TCP, and SOCKERR_WRONG_STATUS.
Referenced by TCPClose().
int8_t TCPCloseCHK | ( | uint8_t | s) |
Definition at line 196 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, ERRA, getSn_CR(), getSn_SR(), RET_OK, setSn_CR(), setSn_IR(), Sn_CR_CLOSE, SOCK_CLOSED, and SOCKERR_NOT_TCP.
Referenced by sockwatch_run(), and TCPClose().
int8_t TCPClsRcvCHK | ( | uint8_t | s) |
Definition at line 217 of file socket.c.
References _WIZCHIP_SOCK_NUM_, ERRA, getSn_CR(), getSn_SR(), RET_OK, setSn_CR(), setSn_IR(), Sn_CR_CLOSE, SOCK_CLOSE_WAIT, SOCK_CLOSED, SOCKERR_BUSY, and SOCKERR_NOT_TCP.
Referenced by sockwatch_run().
int32_t TCPSend | ( | uint8_t | s, |
const int8_t * | buf, | ||
uint16_t | len | ||
) |
Definition at line 239 of file socket.c.
References RET_OK, SOCKERR_BUSY, TCPSendCHK(), and TCPSendNB().
Referenced by loopback_tcpc(), and loopback_tcps().
int8_t TCPSendNB | ( | uint8_t | s, |
const int8_t * | buf, | ||
uint16_t | len | ||
) |
Definition at line 257 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, ERR, ERRA, getSn_CR(), getSn_MR(), getSn_SR(), getSn_TX_RD(), getSn_TxMAX(), GetSocketTxFreeBufferSize(), init_windowfull_retry_cnt(), RET_OK, setSn_CR(), Sn_CR_SEND, Sn_MR_TCP, SOCK_CLOSE_WAIT, SOCK_CLOSED, SOCK_ESTABLISHED, SOCK_FIN_WAIT, SOCKERR_BUSY, SOCKERR_CLOSED, SOCKERR_FIN_WAIT, SOCKERR_NOT_ESTABLISHED, SOCKERR_NOT_TCP, SOCKERR_WRONG_ARG, and wiz_send_data().
Referenced by TCPSend().
int32_t TCPReSend | ( | uint8_t | s) |
Definition at line 289 of file socket.c.
References RET_OK, SOCKERR_BUSY, TCPReSendNB(), and TCPSendCHK().
Referenced by loopback_tcpc(), and loopback_tcps().
int8_t TCPReSendNB | ( | uint8_t | s) |
Definition at line 307 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, ERRA, getSn_CR(), getSn_MR(), getSn_SR(), getSn_TX_RD(), incr_windowfull_retry_cnt(), RET_OK, setSn_CR(), Sn_CR_SEND, Sn_MR_TCP, SOCK_CLOSE_WAIT, SOCK_CLOSED, SOCK_ESTABLISHED, SOCK_FIN_WAIT, SOCKERR_BUSY, SOCKERR_CLOSED, SOCKERR_FIN_WAIT, SOCKERR_NOT_ESTABLISHED, SOCKERR_NOT_TCP, SOCKERR_WINDOW_FULL, WINDOWFULL_MAX_RETRY_NUM, WINDOWFULL_WAIT_TIME, wizpf_get_systick(), and wizpf_tick_elapse().
Referenced by TCPReSend().
int32_t TCPSendCHK | ( | uint8_t | s) |
Definition at line 336 of file socket.c.
References DBG, getSn_IR(), getSn_SR(), getSn_TX_RD(), setSn_IR(), Sn_IR_SENDOK, SOCK_CLOSED, SOCKERR_BUSY, SOCKERR_CLOSED, and TCPClose().
Referenced by sockwatch_run(), TCPReSend(), and TCPSend().
int32_t TCPRecv | ( | uint8_t | s, |
int8_t * | buf, | ||
uint16_t | len | ||
) |
Definition at line 354 of file socket.c.
References _WIZCHIP_SOCK_NUM_, ERR, ERRA, getSn_CR(), getSn_MR(), getSn_SR(), GetSocketRxRecvBufferSize(), setSn_CR(), Sn_CR_RECV, Sn_MR_TCP, SOCK_CLOSE_WAIT, SOCK_CLOSED, SOCK_ESTABLISHED, SOCKERR_CLOSE_WAIT, SOCKERR_CLOSED, SOCKERR_NOT_ESTABLISHED, SOCKERR_NOT_TCP, SOCKERR_WRONG_ARG, and wiz_recv_data().
Referenced by loopback_tcpc(), and loopback_tcps().
int8_t UDPOpen | ( | uint8_t | s, |
uint16_t | port | ||
) |
Definition at line 385 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, DBGA, ERRA, getSn_CR(), getSn_MR(), getSn_SR(), RET_OK, setSn_CR(), setSn_MR(), setSn_PORT(), Sn_CR_OPEN, Sn_MR_UDP, SOCKERR_NOT_UDP, and UDPClose().
Referenced by loopback_udp().
int8_t UDPClose | ( | uint8_t | s) |
Definition at line 410 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, ERRA, getSn_CR(), RET_OK, setSn_CR(), setSn_IR(), Sn_CR_CLOSE, and SOCKERR_NOT_UDP.
Referenced by loopback_tcpc(), loopback_tcps(), loopback_udp(), and UDPOpen().
int32_t UDPSend | ( | uint8_t | s, |
const int8_t * | buf, | ||
uint16_t | len, | ||
uint8_t * | addr, | ||
uint16_t | port | ||
) |
Definition at line 424 of file socket.c.
References RET_OK, SOCKERR_BUSY, UDPSendCHK(), and UDPSendNB().
Referenced by loopback_udp().
int32_t UDPSendNB | ( | uint8_t | s, |
const int8_t * | buf, | ||
uint16_t | len, | ||
uint8_t * | addr, | ||
uint16_t | port | ||
) |
Definition at line 439 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, DBGA, ERR, ERRA, getSIPR(), getSn_CR(), getSn_MR(), getSn_SR(), getSn_TxMAX(), getSUBR(), setSn_CR(), setSn_DIPR(), setSn_DPORT(), Sn_CR_SEND, Sn_MR_UDP, SOCK_CLOSED, SOCK_UDP, SOCKERR_CLOSED, SOCKERR_NOT_UDP, SOCKERR_NULL_SRC_IP, SOCKERR_WRONG_ARG, and wiz_send_data().
Referenced by UDPSend().
int8_t UDPSendCHK | ( | uint8_t | s) |
Definition at line 491 of file socket.c.
References DBG, getSn_IR(), RET_OK, setSn_IR(), Sn_IR_SENDOK, Sn_IR_TIMEOUT, SOCKERR_BUSY, and SOCKERR_TIME_OUT.
Referenced by sockwatch_run(), and UDPSend().
int32_t UDPRecv | ( | uint8_t | s, |
int8_t * | buf, | ||
uint16_t | len, | ||
uint8_t * | addr, | ||
uint16_t * | port | ||
) |
Definition at line 509 of file socket.c.
References _WIZCHIP_SOCK_NUM_, DBG, DBGA, ERR, ERRA, getSn_CR(), getSn_MR(), getSn_SR(), GetSocketRxRecvBufferSize(), setSn_CR(), Sn_CR_RECV, Sn_MR_MACRAW, Sn_MR_UDP, SOCK_CLOSED, SOCK_UDP, SOCKERR_CLOSED, SOCKERR_NOT_SPECIFIED, SOCKERR_NOT_UDP, SOCKERR_WRONG_ARG, wiz_recv_data(), and wiz_recv_ignore().
Referenced by loopback_udp().