WINC3400 iperf.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "socket/include/socket.h"
Data Structures | |
struct | app_status |
struct | client_hdr |
struct | server_hdr |
struct | tstrIperfInit |
struct | UDP_datagram |
Macros | |
#define | HEADER_VERSION1 0x80000000 |
iPerf Settings More... | |
#define | IPERF_BUFFER_SIZE ((IPERF_RX_BUFFER_SIZE > IPERF_TX_BUFFER_SIZE) ? IPERF_RX_BUFFER_SIZE : IPERF_TX_BUFFER_SIZE) |
#define | IPERF_RX_BUFFER_SIZE 1600 |
#define | IPERF_TX_BUFFER_SIZE 1400 |
#define | IPERF_WIFI_M2M_SERVER_IP 0xFFFFFFFF |
#define | IPERF_WIFI_M2M_SERVER_PORT (5001) |
#define | IPERF_WIFI_M2M_WLAN_AUTH M2M_WIFI_SEC_WPA_PSK |
Security type. More... | |
#define | IPERF_WIFI_M2M_WLAN_PSK "12345678" |
Password for Destination SSID. More... | |
#define | IPERF_WIFI_M2M_WLAN_SSID "DEMO_AP" |
Wi-Fi Settings. More... | |
#define | RUN_NOW 0x00000001 |
#define | TEST_STATE_TCP_RX 4 |
#define | TEST_STATE_TCP_TX 3 |
#define | TEST_STATE_UDP_RX 2 |
#define | TEST_STATE_UDP_TX 1 |
Typedefs | |
typedef struct app_status | app_status |
typedef struct client_hdr | client_hdr |
typedef struct server_hdr | server_hdr |
typedef struct UDP_datagram | UDP_datagram |
Enumerations | |
enum | app_mode { MODE_UNDEF, MODE_INIT, MODE_INIT_DONE, MODE_START, MODE_RUN, MODE_WAIT, MODE_FINISHED, MODE_STOP, MODE_UNDEF, MODE_INIT, MODE_INIT_DONE, MODE_START, MODE_RUN, MODE_WAIT, MODE_FINISHED, MODE_STOP } |
enum | tenuNMI_IperfMode { MODE_TCP_CLIENT, MODE_TCP_SERVER, MODE_UDP_CLIENT, MODE_UDP_SERVER, MODE_TCP_CLIENT, MODE_TCP_SERVER, MODE_UDP_CLIENT, MODE_UDP_SERVER } |
Functions | |
NMI_API sint8 | IperfCreate (tstrIperfInit *pstrIperfInit, bool bIsPaused) |
NMI_API void | IperfInit (void) |
NMI_API void | IperfPrintStats (SOCKET sock) |
NMI_API sint8 | IperfRemoteSocketClose (void) |
NMI_API sint8 | IperfSocketClose (SOCKET sock) |
void | IperfSocketEventHandler (SOCKET sock, uint8 u8Msg, void *pvMsg) |
void | IperfTCP_Client_SendTestPacket (void) |
NMI_API void | IperfUpdate (void) |
Variables | |
struct sockaddr_in | udp_client_addr |
#define HEADER_VERSION1 0x80000000 |
iPerf Settings
#define IPERF_BUFFER_SIZE ((IPERF_RX_BUFFER_SIZE > IPERF_TX_BUFFER_SIZE) ? IPERF_RX_BUFFER_SIZE : IPERF_TX_BUFFER_SIZE) |
#define IPERF_RX_BUFFER_SIZE 1600 |
#define IPERF_TX_BUFFER_SIZE 1400 |
#define IPERF_WIFI_M2M_SERVER_IP 0xFFFFFFFF |
#define IPERF_WIFI_M2M_SERVER_PORT (5001) |
#define IPERF_WIFI_M2M_WLAN_AUTH M2M_WIFI_SEC_WPA_PSK |
Security type.
#define IPERF_WIFI_M2M_WLAN_PSK "12345678" |
Password for Destination SSID.
#define IPERF_WIFI_M2M_WLAN_SSID "DEMO_AP" |
Wi-Fi Settings.
Destination SSID
#define RUN_NOW 0x00000001 |
#define TEST_STATE_TCP_RX 4 |
#define TEST_STATE_TCP_TX 3 |
#define TEST_STATE_UDP_RX 2 |
#define TEST_STATE_UDP_TX 1 |
typedef struct app_status app_status |
typedef struct client_hdr client_hdr |
typedef struct server_hdr server_hdr |
typedef struct UDP_datagram UDP_datagram |
enum app_mode |
enum tenuNMI_IperfMode |
NMI_API sint8 IperfCreate | ( | tstrIperfInit * | pstrIperfInit, |
bool | bIsPaused | ||
) |
References IperfTCP_ClientStart(), IperfTCP_ServerStart(), IperfUDP_ClientStart(), IperfUDP_ServerStart(), M2M_ERR_FAIL, MODE_TCP_CLIENT, MODE_TCP_SERVER, MODE_UDP_CLIENT, MODE_UDP_SERVER, tstrIperfInit::operating_mode, printf, and ret.
Referenced by main().
NMI_API void IperfInit | ( | void | ) |
References tstrIperfUdpMsg::gau8MsgBuffer, gu8NumSockets, IPERF_BUFFER_SIZE, and m2m_memset().
Referenced by main().
References IPERF_MAX_UDP_STATE, IperfCalculateBandwidthKbps(), IperfPrintUdpServerStats(), MODE_INIT, MODE_STOP, printf, tstrIperfSocketInfo::strRxBytes, tstrIperfSocketInfo::strTxBytes, tcp_serv_pack_recv, TEST_STATE_TCP_RX, TEST_STATE_TCP_TX, TEST_STATE_UDP_RX, TEST_STATE_UDP_TX, tstrIperfUint64::u32H, u32msTicks, tstrIperfSocketInfo::u32TimeStart, app_status::udp_client, and app_status::udp_server.
Referenced by IperfSocketClose(), IperfSocketEventHandler(), IperfSocketStop(), and IperfUpdate().
References close(), i, IPERF_MAX_UDP_STATE, IperfDecrementTimerUse(), IperfPrintStats(), IperfSocketClose(), M2M_ERR_FAIL, m2m_memset(), MAX_SOCKET, printf, TCP_SOCK_MAX, TEST_STATE_TCP_RX, and TEST_STATE_UDP_RX.
Referenced by IperfSocketClose(), IperfSocketEventHandler(), IperfSocketStop(), IperfUpdate(), and main().
References _htonl, _htons, _ntohl, _ntohs, accept(), AF_INET, tstrIperfSocketInfo::bIsActive, tstrIperfUdpState::bIsActive, clientIPAddress, server_hdr::datagrams, server_hdr::error_cnt, client_hdr::flags, server_hdr::flags, tstrIperfUdpMsg::gau8MsgBuffer, gu32IPAddress, HEADER_VERSION1, UDP_datagram::id, inet_ntoa(), IPERF_MAX_UDP_STATE, IPERF_RX_BUFFER_SIZE, IperfAddUint64(), IperfCalculateBandwidthKbps(), IperfDecrementTimerUse(), IperfIncrementTimerUse(), IperfPrintStats(), IperfPrintUdpServerStats(), IperfSocketClose(), IperfTCP_SendTestPacket(), server_hdr::jitter1, server_hdr::jitter2, M2M_ERR, m2m_memset(), M2M_SUCCESS, m2m_wifi_yield(), MAX_SOCKET, MODE_FINISHED, MODE_INIT, MODE_RUN, MODE_START, MODE_WAIT, NBIT31, ntohl(), NULL, server_hdr::outorder_cnt, printf, tstrSocketRecvMsg::pu8Buffer, recv(), recvfrom(), ret, RUN_NOW, tstrSocketRecvMsg::s16BufferSize, tstrIperfSocketInfo::s32PktCount, tstrSocketConnectMsg::s8Error, in_addr::s_addr, sendto(), sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, tstrSocketAcceptMsg::sock, SOCK_ERR_BUFFER_FULL, SOCKET_MSG_ACCEPT, SOCKET_MSG_BIND, SOCKET_MSG_CONNECT, SOCKET_MSG_RECV, SOCKET_MSG_RECVFROM, SOCKET_MSG_SEND, tstrIperfSocketInfo::sockParent, tstrIperfUdpState::sockParent, tstrSocketBindMsg::status, server_hdr::stop_sec, server_hdr::stop_usec, tstrSocketAcceptMsg::strAddr, tstrSocketRecvMsg::strRemoteAddr, tstrIperfSocketInfo::strRxBytes, tstrIperfUdpState::strRxBytes, tstrIperfUdpServerMsg::strUdpDatagram, tstrIperfUdpServerMsg::strUdpServerHdr, app_status::tcp_client, app_status::tcp_server, TEST_STATE_TCP_RX, TEST_STATE_TCP_TX, TEST_STATE_UDP_RX, TEST_STATE_UDP_TX, server_hdr::total_len1, server_hdr::total_len2, tstrIperfSocketInfo::u16Port, tstrIperfUdpState::u16Port, tstrSocketRecvMsg::u16RemainingSize, tstrIperfUdpState::u16RxMissingPktsLastPeriod, tstrIperfUdpState::u16RxPktsLastPeriod, tstrIperfSocketInfo::u32BytesLastPeriod, tstrIperfUdpState::u32BytesLastPeriod, tstrIperfUint64::u32H, tstrIperfSocketInfo::u32IPAddress, tstrIperfUint64::u32L, tstrIperfSocketInfo::u32LastStatsTime, tstrIperfUdpState::u32LastStatsTime, u32msTicks, tstrIperfUdpState::u32NextRxSeqNum, tstrIperfSocketInfo::u32PktByteCount, tstrIperfSocketInfo::u32PktLength, tstrIperfUdpState::u32RxMissingPkts, tstrIperfSocketInfo::u32RxPkts, tstrIperfUdpState::u32RxPkts, tstrIperfSocketInfo::u32TimeStart, tstrIperfUdpState::u32TimeStart, tstrIperfSocketInfo::u32TxSQN, tstrIperfSocketInfo::u8PktsOutstanding, tstrIperfSocketInfo::u8State, udp_client_addr, app_status::udp_server, and udp_server_sock.
Referenced by main().
void IperfTCP_Client_SendTestPacket | ( | void | ) |
References IperfIncrementTimerUse(), IperfTCP_SendTestPacket(), and tcp_client_sock.
Referenced by main().
NMI_API void IperfUpdate | ( | void | ) |
References tstrIperfSocketInfo::bIsActive, tstrIperfUdpState::bIsActive, tstrIperfSocketInfo::bIsPaused, tstrIperfUdpMsg::gau8MsgBuffer, i, IPERF_MAX_UDP_STATE, IPERF_RX_BUFFER_SIZE, IperfPrintStats(), IperfSocketClose(), IperfUDP_SendTestPacket(), IperfUDP_WriteFIN(), j, M2M_SUCCESS, MAX_SOCKET, NULL, printf, recvfrom(), tstrIperfSocketInfo::s32PktCount, tstrIperfSocketInfo::sockParent, tstrIperfUdpState::sockParent, TCP_SOCK_MAX, TEST_STATE_TCP_RX, TEST_STATE_TCP_TX, TEST_STATE_UDP_RX, TEST_STATE_UDP_TX, tstrIperfSocketInfo::u16MsPeriod, tstrIperfUdpState::u16RxMissingPktsLastPeriod, tstrIperfUdpState::u16RxPktsLastPeriod, tstrIperfSocketInfo::u32BytesLastPeriod, tstrIperfUdpState::u32BytesLastPeriod, u32LastStatsTime, tstrIperfSocketInfo::u32LastTransmission, u32msTicks, tstrIperfSocketInfo::u32TimeStart, tstrIperfUdpState::u32TimeStart, tstrIperfSocketInfo::u8PktsOutstanding, and tstrIperfSocketInfo::u8State.
Referenced by main().
struct sockaddr_in udp_client_addr |