Microchip® Advanced Software Framework

winc3400/iperf_server_example/iperf.h File Reference

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_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
Enumerator
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 
Enumerator
MODE_TCP_CLIENT 
MODE_TCP_SERVER 
MODE_UDP_CLIENT 
MODE_UDP_SERVER 
MODE_TCP_CLIENT 
MODE_TCP_SERVER 
MODE_UDP_CLIENT 
MODE_UDP_SERVER 

NMI_API void IperfInit ( void  )
NMI_API sint8 IperfRemoteSocketClose ( void  )
void IperfSocketEventHandler ( SOCKET  sock,
uint8  u8Msg,
void *  pvMsg 
)

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  )

struct sockaddr_in udp_client_addr