WIZlib Library API  ver 1.0
WIZlib Library API User Menual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
socket.h
Go to the documentation of this file.
1 
12 #ifndef _SOCKET_H
13 #define _SOCKET_H
14 
15 //#include "common/common.h"
16 
17 //****** Doxygen Description is moved to doxygen document folder *****
18 #define SOCKSTAT_CLOSED -1
19 #define SOCKSTAT_INIT 0
20 #define SOCKSTAT_LISTEN 1
21 #define SOCKSTAT_SYNSENT 2
22 #define SOCKSTAT_SYNRECV 3
23 #define SOCKSTAT_ESTABLISHED 4
24 #define SOCKSTAT_FIN_WAIT 5
25 #define SOCKSTAT_CLOSING 6
26 #define SOCKSTAT_TIME_WAIT 7
27 #define SOCKSTAT_CLOSE_WAIT 8
28 #define SOCKSTAT_LAST_ACK 9
29 #define SOCKSTAT_UDP 10
30 
31 #define SOCKERR_BUSY -1
32 #define SOCKERR_NOT_TCP -2
33 #define SOCKERR_NOT_UDP -3
34 #define SOCKERR_WRONG_ARG -4
35 #define SOCKERR_WRONG_STATUS -5
36 #define SOCKERR_CLOSED -6
37 #define SOCKERR_CLOSE_WAIT -7
38 #define SOCKERR_FIN_WAIT -8
39 #define SOCKERR_NOT_ESTABLISHED -9
40 #define SOCKERR_WINDOW_FULL -10
41 #define SOCKERR_TIME_OUT -11
42 #define SOCKERR_NULL_SRC_IP -12
43 #define SOCKERR_BUF_NOT_ENOUGH -13
44 #define SOCKERR_NOT_SPECIFIED -14
45 
50 typedef enum { // 0 is not used (zero means just ignore dhcp config this time)
53 } dhcp_mode;
54 
59 typedef enum {
60  //NI_MAC_ADDR, //< Indicate MAC Address // Uncomment if needed
66 
71 typedef struct wiz_NetInfo_t
72 {
73  uint8 mac[6];
74  uint8 ip[4];
75  uint8 sn[4];
76  uint8 gw[4];
77  uint8 dns[4];
79 } wiz_NetInfo;
80 
81 void device_init(uint8 *tx_size, uint8 *rx_size);
82 void device_SW_reset(void);
83 void device_mem_init(uint8 *tx_size, uint8 *rx_size);
84 void SetNetInfo(wiz_NetInfo *netinfo);
85 void ClsNetInfo(netinfo_member member);
86 void GetNetInfo(wiz_NetInfo *netinfo);
87 void GetDstInfo(uint8 s, uint8 *dstip, uint16 *dstport);
88 void SetSocketOption(uint8 option_type, uint16 option_value);
89 int8 GetTCPSocketStatus(uint8 s);
90 int8 GetUDPSocketStatus(uint8 s);
91 uint16 GetSocketTxFreeBufferSize(uint8 s);
92 uint16 GetSocketRxRecvBufferSize(uint8 s);
93 
94 int8 TCPServerOpen(uint8 s, uint16 port);
95 int8 TCPClientOpen(uint8 s, uint16 sport, uint8 *dip, uint16 dport);
96 int8 TCPCltOpenNB(uint8 s, uint16 sport, uint8 *dip, uint16 dport);
97 int8 TCPConnChk(uint8 s);
98 int8 TCPClose(uint8 s);
99 int8 TCPCloseNB(uint8 s);
100 int8 TCPCloseCHK(uint8 s);
101 int8 TCPClsRcvCHK(uint8 s);
102 int32 TCPSend(uint8 s, const int8 *buf, uint16 len);
103 int8 TCPSendNB(uint8 s, const int8 *buf, uint16 len);
104 int32 TCPReSend(uint8 s);
105 int8 TCPReSendNB(uint8 s);
106 int32 TCPSendCHK(uint8 s);
107 int32 TCPRecv(uint8 s, int8 *buf, uint16 len);
108 int8 UDPOpen(uint8 s, uint16 port);
109 int8 UDPClose(uint8 s);
110 int32 UDPSend(uint8 s, const int8 *buf, uint16 len, uint8 *addr, uint16 port);
111 int32 UDPSendNB(uint8 s, const int8 *buf, uint16 len, uint8 *addr, uint16 port);
112 int8 UDPSendCHK(uint8 s);
113 int32 UDPRecv(uint8 s, int8 *buf, uint16 len, uint8 *addr, uint16 *port);
114 
115 
116 #endif //_SOCKET_H
117 
118 
119 
120 
121