These tests verify API and operation of the WiFi socket functions.
◆ WIFI_SocketCreate()
void WIFI_SocketCreate |
( |
void |
| ) |
|
The test function WIFI_SocketCreate verifies the WiFi Driver SocketCreate function:
int32_t (*SocketCreate) (int32_t af, int32_t type, int32_t protocol);
Create socket test:
- Check function parameters
- Create multiple stream sockets
- Gradually close stream sockets and create datagram sockets
- Close datagram sockets
◆ WIFI_SocketBind()
void WIFI_SocketBind |
( |
void |
| ) |
|
The test function WIFI_SocketBind verifies the WiFi Driver SocketBind function:
int32_t (*SocketBind) (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port);
Stream socket test:
- Create stream socket
- Check function parameters
- Bind stream socket
- Bind socket second time
- Create 2nd stream socket
- Bind 2nd socket, used port
- Bind 2nd socket, unused port
- Close stream sockets
- Bind closed socket
Datagram socket test:
- Create datagram socket
- Bind datagram socket
- Bind socket second time
- Create 2nd datagram socket
- Bind 2nd socket, used port
- Bind 2nd socket, unused port
- Close datagram socket
- Bind closed socket
◆ WIFI_SocketListen()
void WIFI_SocketListen |
( |
void |
| ) |
|
The test function WIFI_SocketListen verifies the WiFi Driver SocketListen function:
int32_t (*SocketListen) (int32_t socket, int32_t backlog);
Stream socket test 1:
- Create stream socket
- Bind socket
- Check function parameters
- Start listening
- Start listening 2nd time
- Close socket
Stream socket test 2:
- Create stream socket
- Start listening, unbound socket
- Close socket
- Start listening, closed socket
Datagram socket test:
- Create datagram socket
- Bind socket
- Start listening
- Close socket
◆ WIFI_SocketAccept()
void WIFI_SocketAccept |
( |
void |
| ) |
|
The test function WIFI_SocketAccept verifies the WiFi Driver SocketAccept function:
int32_t (*SocketAccept) (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port);
Stream socket test:
- Create stream socket
- Bind socket
- Start listening
- Check function parameters
- Accept connection, NULL parameters
- Receive ServerId on accepted socket
- Close accepted socket
- Accept connection again, return IP address and port
- Receive ServerId on accepted socket
- Receive again, server closed connection
- Close accepted socket
- Close listening socket
- Accept again, closed socket
Datagram socket test:
- Create datagram socket
- Bind socket
- Start listening
- Accept connection, provide return parameters for IP address and port
- Receive ServerId on socket
- Close socket
◆ WIFI_SocketAccept_nbio()
void WIFI_SocketAccept_nbio |
( |
void |
| ) |
|
The test case WIFI_SocketAccept_nbio verifies the WiFi Driver SocketAccept function running in non-blocking mode.
Stream socket test:
- Create stream socket
- Set non-blocking mode
- Bind socket
- Start listening
- Check function parameters
- Accept connection, NULL parameters
- Receive ServerId on accepted socket
- Close accepted socket
- Accept connection again, return IP address and port
- Receive ServerId on accepted socket
- Receive again, server closed connection
- Close accepted socket
- Close listening socket
- Accept again, closed socket
◆ WIFI_SocketConnect()
void WIFI_SocketConnect |
( |
void |
| ) |
|
The test function WIFI_SocketConnect verifies the WiFi Driver SocketConnect function:
int32_t (*SocketConnect) (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port);
Stream socket test 1:
- Create stream socket
- Check function parameters
- Connect to server, blocking mode
- Connect again, already connected
- Bind connected socket
- Close socket
- Connect on closed socket
Stream socket test 2:
- Create stream socket
- Connect to server, connection rejected
- Close socket
Stream socket test 3:
- Create stream socket
- Connect to server, non-responding or non-existent
- Close socket
Stream socket test 4:
- Create stream socket
- Bind socket
- Start listening
- Connect to server, blocking mode
- Close socket
Datagram socket test:
- Create datagram socket
- Bind socket
- Check function parameters
- Connect to server, enable address filtering
- Connect to unspecified address, disable filtering
- Close socket
- Connect again, closed socket
◆ WIFI_SocketConnect_nbio()
void WIFI_SocketConnect_nbio |
( |
void |
| ) |
|
The test case WIFI_SocketConnect_nbio verifies the WiFi Driver SocketConnect function running in non-blocking mode.
Stream socket test 1:
- Create stream socket
- Set non-blocking mode
- Check function parameters
- Connect to server, non-blocking mode
- Connect again, already connected
- Bind connected socket
- Close socket
- Connect on closed socket
Stream socket test 2:
- Create stream socket
- Set non-blocking mode
- Connect to server, connection rejected
- Close socket
Stream socket test 3:
- Create stream socket
- Set non-blocking mode
- Connect to server, non-responding or non-existent
- Close socket
Stream socket test 4:
- Create stream socket
- Set non-blocking mode
- Bind socket
- Start listening
- Connect to server, non-blocking mode
- Close socket
◆ WIFI_SocketRecv()
void WIFI_SocketRecv |
( |
void |
| ) |
|
Test case WIFI_SocketRecv verifies the WiFi Driver SocketRecv function:
int32_t (*SocketRecv) (int32_t socket, void *buf, uint32_t len);
Stream socket test 1:
- Create stream socket
- Connect to Chargen server
- Check function parameters
- Receive data in blocking mode
- Close socket
- Receive again, closed socket
Stream socket test 2:
- Create stream socket
- Receive data, created socket
- Bind socket
- Receive data, bound socket
- Start listening
- Receive data, listening socket
- Close socket
Stream socket test 3:
- Create stream socket
- Connect to Discard server
- Set receive timeout to 1 sec
- Receive data, timeout expires
- Close socket
◆ WIFI_SocketRecv_nbio()
void WIFI_SocketRecv_nbio |
( |
void |
| ) |
|
Test case WIFI_SocketRecv_nbio verifies the WiFi Driver SocketRecv function running in non-blocking mode.
Stream socket test 1:
- Create stream socket
- Set non-blocking mode
- Connect to Chargen server
- Check function parameters
- Receive data in non-blocking mode
- Close socket
- Receive again, closed socket
Stream socket test 2:
- Create stream socket
- Set non-blocking mode
- Receive data, created socket
- Bind socket
- Receive data, bound socket
- Start listening
- Receive data, listening socket
- Close socket
Stream socket test 3:
- Create stream socket
- Set non-blocking mode
- Connect to Discard server
- Receive data for 1 sec, timeout expires
- Close socket
◆ WIFI_SocketRecvFrom()
void WIFI_SocketRecvFrom |
( |
void |
| ) |
|
The test function WIFI_SocketRecvFrom verifies the WiFi Driver SocketRecvFrom function:
int32_t (*SocketRecvFrom) (int32_t socket, void *buf, uint32_t len, uint8_t *ip, uint32_t *ip_len, uint16_t *port);
Datagram socket test 1:
- Create datagram socket
- Connect to Chargen server
- Check function parameters
- Receive data in blocking mode
- Set receive timeout to 1 sec
- Receive again, timeout expires
- Close socket
- Receive again, closed socket
◆ WIFI_SocketRecvFrom_nbio()
void WIFI_SocketRecvFrom_nbio |
( |
void |
| ) |
|
The test case WIFI_SocketRecvFrom_nbio verifies the WiFi Driver SocketRecvFrom function running in non-blocking mode.
Datagram socket test 1:
- Create datagram socket
- Set non-blocking mode
- Connect to Chargen server
- Check function parameters
- Receive data in non-blocking mode
- Receive again, timeout expires
- Close socket
- Receive again, closed socket
◆ WIFI_SocketSend()
void WIFI_SocketSend |
( |
void |
| ) |
|
The test function WIFI_SocketSend verifies the WiFi Driver SocketSend function:
int32_t (*SocketSend) (int32_t socket, const void *buf, uint32_t len);
Stream socket test 1:
- Create stream socket
- Connect to server, blocking mode
- Check function parameters
- Send data, blocking mode
- Close socket
- Send again, closed socket
Stream socket test 2:
- Create stream socket
- Connect to server, blocking mode
- Send ESC data, server disconnects
- Send again, disconnected socket
- Close socket
Stream socket test 3:
- Create stream socket
- Send data, created socket
- Bind socket
- Send data, bound socket
- Start listening
- Send data, listening socket
- Close socket
- Send again, closed socket
◆ WIFI_SocketSendTo()
void WIFI_SocketSendTo |
( |
void |
| ) |
|
The test function WIFI_SocketSend verifies the WiFi Driver SocketSendTo function:
int32_t (*SocketSendTo) (int32_t socket, const void *buf, uint32_t len, const uint8_t *ip, uint32_t ip_len, uint16_t port);
Datagram socket test:
- Create datagram socket
- Check function parameters
- Send data, blocking mode
- Receive echo data, verify if the same
- Close socket
- Send again, closed socket
◆ WIFI_SocketGetSockName()
void WIFI_SocketGetSockName |
( |
void |
| ) |
|
The test function WIFI_SocketGetSockName verifies the WiFi Driver SocketGetSockName function:
int32_t (*SocketGetSockName) (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port);
Stream socket test 1:
- Create stream socket
- Connect to server, blocking mode
- Check function parameters
- Get socket name
- Close socket
- Get socket name again, closed socket
Stream socket test 1:
- Create stream socket
- Get socket name, not bound
- Bind socket
- Get socket name, bound
- Close socket
Datagram socket test 1:
- Create datagram socket
- Connect to server, enable packet filtering
- Check function parameters
- Get socket name
- Close socket
- Get socket name again, closed socket
Datagram socket test 1:
- Create datagram socket
- Get socket name, not bound
- Bind socket
- Get socket name, bound
- Close socket
◆ WIFI_SocketGetPeerName()
void WIFI_SocketGetPeerName |
( |
void |
| ) |
|
The test function WIFI_SocketGetPeerName verifies the WiFi Driver SocketGetPeerName function:
int32_t (*SocketGetPeerName) (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port);
Stream socket test 1:
- Create stream socket
- Connect to server, blocking mode
- Check function parameters
- Get peer name
- Close socket
- Get peer name, closed socket
Stream socket test 2:
- Create stream socket
- Get peer name, created socket
- Bind socket
- Get peer name, bound socket
- Start listening
- Get peer name, listening socket
- Close socket
Datagram socket test:
- Create datagram socket
- Connect to server, enable packet filtering
- Check function parameters
- Get peer name
- Close socket
- Get peer name, closed socket
◆ WIFI_SocketGetOpt()
void WIFI_SocketGetOpt |
( |
void |
| ) |
|
The test function WIFI_SocketGetOpt verifies the WiFi Driver SocketGetOpt function:
int32_t (*SocketGetOpt) (int32_t socket, int32_t opt_id, void *opt_val, uint32_t *opt_len);
Stream socket test:
- Create stream socket
- Check function parameters
- Get socket options
- Close socket
- Get socket options again, closed socket
Datagram socket test:
- Create datagram socket
- Get socket type
- Close socket
- Get socket type
◆ WIFI_SocketSetOpt()
void WIFI_SocketSetOpt |
( |
void |
| ) |
|
The test function WIFI_SocketSetOpt verifies the WiFi Driver SocketSetOpt function:
int32_t (*SocketSetOpt) (int32_t socket, int32_t opt_id, const void *opt_val, uint32_t opt_len);
Stream socket test:
- Create stream socket
- Check function parameters
- Set socket options
- Close socket
- Set socket option again, closed socket
Datagram socket test:
- Create datagram socket
- Set socket options
- Close socket
- Set socket option again, closed socket
◆ WIFI_SocketClose()
void WIFI_SocketClose |
( |
void |
| ) |
|
The test function WIFI_SocketClose verifies the WiFi Driver SocketClose function:
int32_t (*SocketClose) (int32_t socket);
Stream socket test 1:
- Create stream socket
- Bind socket
- Connect to server
- Check function parameters
- Close socket
- Close socket again
Stream socket test 2:
- Create stream socket
- Bind socket
- Start listening
- Close socket
- Close socket again
Datagram socket test:
- Create datagram socket
- Bind socket
- Check function parameters
- Close socket
- Close socket again
◆ WIFI_SocketGetHostByName()
void WIFI_SocketGetHostByName |
( |
void |
| ) |
|
The test function WIFI_SocketGetHostByName the WiFi Driver SocketGetHostByName function:
int32_t (*SocketGetHostByName) (const char *name, int32_t af, uint8_t *ip, uint32_t *ip_len);
Function test:
- Check function parameters
- Resolve host
- Resolve non-existent host
- Note
- This test requires internet connectivity to DNS server.
◆ WIFI_Ping()
The test function WIFI_Ping verifies the WiFi Driver Ping function:
int32_t (*Ping) (const uint8_t *ip, uint32_t ip_len);
Function test:
- Check function parameters
- Ping host