ioLibrary for Cortex M series
socket.h
Go to the documentation of this file.
1 
13 #ifndef _SOCKET_H
14 #define _SOCKET_H
15 
16 //#include "common/common.h"
17 #define WINDOWFULL_MAX_RETRY_NUM 3
18 #define WINDOWFULL_WAIT_TIME 1000
19 
20 //****** Doxygen Description is moved to doxygen document folder *****
21 #define SOCKSTAT_CLOSED -1
22 #define SOCKSTAT_INIT 0
23 #define SOCKSTAT_LISTEN 1
24 #define SOCKSTAT_SYNSENT 2
25 #define SOCKSTAT_SYNRECV 3
26 #define SOCKSTAT_ESTABLISHED 4
27 #define SOCKSTAT_FIN_WAIT 5
28 #define SOCKSTAT_CLOSING 6
29 #define SOCKSTAT_TIME_WAIT 7
30 #define SOCKSTAT_CLOSE_WAIT 8
31 #define SOCKSTAT_LAST_ACK 9
32 #define SOCKSTAT_UDP 10
33 
34 #define SOCKERR_BUSY -1
35 #define SOCKERR_NOT_TCP -2
36 #define SOCKERR_NOT_UDP -3
37 #define SOCKERR_WRONG_ARG -4
38 #define SOCKERR_WRONG_STATUS -5
39 #define SOCKERR_CLOSED -6
40 #define SOCKERR_CLOSE_WAIT -7
41 #define SOCKERR_FIN_WAIT -8
42 #define SOCKERR_NOT_ESTABLISHED -9
43 #define SOCKERR_WINDOW_FULL -10
44 #define SOCKERR_TIME_OUT -11
45 #define SOCKERR_NULL_SRC_IP -12
46 #define SOCKERR_BUF_NOT_ENOUGH -13
47 #define SOCKERR_NOT_SPECIFIED -14
48 
49 
50 
51 int8_t TCPServerOpen(uint8_t s, uint16_t port);
52 int8_t TCPClientOpen(uint8_t s, uint16_t sport, uint8_t *dip, uint16_t dport);
53 int8_t TCPCltOpenNB(uint8_t s, uint16_t sport, uint8_t *dip, uint16_t dport);
54 int8_t TCPConnChk(uint8_t s);
55 int8_t TCPDisconnect(uint8_t s);
56 int8_t TCPClose(uint8_t s);
57 int8_t TCPCloseNB(uint8_t s);
58 int8_t TCPCloseCHK(uint8_t s);
59 int8_t TCPClsRcvCHK(uint8_t s);
60 int32_t TCPSend(uint8_t s, const int8_t *buf, uint16_t len);
61 int8_t TCPSendNB(uint8_t s, const int8_t *buf, uint16_t len);
62 int32_t TCPReSend(uint8_t s);
63 int8_t TCPReSendNB(uint8_t s);
64 int32_t TCPSendCHK(uint8_t s);
65 int32_t TCPRecv(uint8_t s, int8_t *buf, uint16_t len);
66 int8_t UDPOpen(uint8_t s, uint16_t port);
67 int8_t UDPClose(uint8_t s);
68 int32_t UDPSend(uint8_t s, const int8_t *buf, uint16_t len, uint8_t *addr, uint16_t port);
69 int32_t UDPSendNB(uint8_t s, const int8_t *buf, uint16_t len, uint8_t *addr, uint16_t port);
70 int8_t UDPSendCHK(uint8_t s);
71 int32_t UDPRecv(uint8_t s, int8_t *buf, uint16_t len, uint8_t *addr, uint16_t *port);
72 
73 
74 
75 #endif //_SOCKET_H
76 
77 
78 
79 
80