WINC1500 iperf.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "asf.h"
#include "iperf.h"
#include "driver/include/m2m_wifi.h"
#include "socket/include/socket.h"
#include "conf_winc.h"
Data Structures | |
struct | tstrIperfSocketInfo |
struct | tstrIperfUdpMsg |
struct | tstrIperfUdpServerMsg |
struct | tstrIperfUdpState |
struct | tstrIperfUint64 |
Macros | |
#define | IPERF_MAX_UDP_STATE 4 |
Variables | |
uint32 | clientIPAddress |
static tstrIperfSocketInfo | gastrIperfSocketInfo [MAX_SOCKET] |
static tstrIperfUdpState | gastrIperfUdpState [IPERF_MAX_UDP_STATE] |
static tstrIperfUdpMsg | gstrRxMsgBuffer |
static tstrIperfUdpMsg | gstrTxMsgBuffer |
static tstrIperfUdpServerMsg | gstrTxSrvMsg |
uint32 | gu32IPAddress |
static uint8 | gu8NumSockets |
app_status | iperf_app_stat |
static client_hdr | iperf_tcp_serv |
SOCKET | tcp_client_sock |
uint32_t | tcp_serv_pack_recv |
static uint32_t | u32LastStatsTime |
static uint32_t | u32msTicks |
uint32_t | udp_serv_pack_recv |
SOCKET | udp_server_sock |
#define IPERF_MAX_UDP_STATE 4 |
Referenced by IperfPrintStats(), IperfSocketClose(), IperfSocketEventHandler(), and IperfUpdate().
|
static |
References ptr.
Referenced by IperfSocketEventHandler(), IperfUDP_SendTestPacket(), and status_callback().
|
static |
References u32msTicks.
Referenced by IperfIncrementTimerUse().
|
static |
References tstrIperfUint64::u32H, and tstrIperfUint64::u32L.
Referenced by IperfSocketEventHandler(), IperfTCP_SendTestPacket(), and IperfUDP_SendTestPacket().
|
static |
References n, tstrIperfUint64::u32H, and tstrIperfUint64::u32L.
Referenced by IperfPrintStats(), IperfPrintUdpServerStats(), and IperfSocketEventHandler().
NMI_API sint8 IperfCreate | ( | tstrIperfInit * | pstrIperfInit, |
bool | bIsPaused | ||
) |
Referenced by main().
|
static |
References gu8NumSockets, M2M_ERR, and nm_bsp_stop_1ms_timer().
Referenced by IperfSocketClose(), and IperfSocketEventHandler().
|
static |
References gu8NumSockets, Iperf1msTimerCB(), nm_bsp_start_1ms_timer(), u32LastStatsTime, and u32msTicks.
Referenced by IperfSocketEventHandler(), IperfTCP_Client_SendTestPacket(), and IperfUDP_ClientStart().
Referenced by IperfSocketClose(), IperfSocketEventHandler(), IperfSocketStop(), and IperfUpdate().
References IperfCalculateBandwidthKbps(), printf, tstrIperfUdpState::strRxBytes, tstrIperfUint64::u32H, u32msTicks, tstrIperfUdpState::u32TimeStart, and udp_serv_pack_recv.
Referenced by IperfPrintStats(), and IperfSocketEventHandler().
Referenced by IperfSocketClose(), IperfSocketEventHandler(), IperfSocketStop(), IperfUpdate(), and main().
References IperfPrintStats(), IperfSocketClose(), M2M_SUCCESS, tstrIperfSocketInfo::s32PktCount, and TEST_STATE_UDP_TX.
Referenced by IperfStop().
References _htons, AF_INET, tstrIperfSocketInfo::bIsActive, tstrIperfSocketInfo::bIsPaused, i, IperfTCP_SendTestPacket(), IperfUDP_SendTestPacket(), M2M_SUCCESS, MAX_SOCKET, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, TEST_STATE_TCP_TX, TEST_STATE_UDP_TX, tstrIperfSocketInfo::u16Port, tstrIperfSocketInfo::u32IPAddress, tstrIperfSocketInfo::u32LastStatsTime, tstrIperfSocketInfo::u32LastTransmission, u32msTicks, tstrIperfSocketInfo::u32TimeStart, and tstrIperfSocketInfo::u8State.
References i, IperfSocketStop(), M2M_ERR_FAIL, M2M_SUCCESS, and MAX_SOCKET.
void IperfTCP_Client_SendTestPacket | ( | void | ) |
Referenced by main().
|
static |
References _htonl, _htons, AF_INET, tstrIperfSocketInfo::bIsActive, tstrIperfSocketInfo::bIsPaused, connect(), tstrIperfInit::ip, M2M_ERR_FAIL, m2m_memset(), M2M_SUCCESS, tstrIperfInit::packet_len, tstrIperfInit::packets_to_send, tstrIperfInit::port, printf, tstrIperfSocketInfo::s32PktCount, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_STREAM, socket(), SOCKET_FLAGS_SSL, tcp_client_sock, TEST_STATE_TCP_TX, tstrIperfInit::tls, tstrIperfSocketInfo::u16Port, tstrIperfSocketInfo::u32IPAddress, tstrIperfSocketInfo::u32PktLength, and tstrIperfSocketInfo::u8State.
Referenced by IperfCreate().
References tstrIperfUdpMsg::gau8MsgBuffer, IperfAddUint64(), M2M_ERR, ret, send(), SOCK_ERR_BUFFER_FULL, tstrIperfSocketInfo::strTxBytes, tstrIperfSocketInfo::u32BytesLastPeriod, tstrIperfSocketInfo::u32LastStatsTime, u32msTicks, tstrIperfSocketInfo::u32PktLength, tstrIperfSocketInfo::u32TimeStart, tstrIperfSocketInfo::u32TxSQN, and tstrIperfSocketInfo::u8PktsOutstanding.
Referenced by IperfSocketEventHandler(), IperfStart(), and IperfTCP_Client_SendTestPacket().
|
static |
References _htons, accept(), AF_INET, bind(), tstrIperfSocketInfo::bIsActive, gu32IPAddress, listen(), M2M_ERR_FAIL, m2m_memset(), M2M_SUCCESS, NULL, tstrIperfInit::port, printf, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_STREAM, socket(), tstrIperfSocketInfo::sockParent, TCP_SOCK_MAX, TEST_STATE_TCP_RX, tstrIperfSocketInfo::u16Port, tstrIperfSocketInfo::u32IPAddress, and tstrIperfSocketInfo::u8State.
Referenced by IperfCreate().
|
static |
References _htonl, _htons, AF_INET, tstrIperfSocketInfo::bIsActive, tstrIperfSocketInfo::bIsPaused, tstrIperfInit::data_rate, tstrIperfInit::ip, IperfIncrementTimerUse(), IperfUDP_SendTestPacket(), M2M_ERR_FAIL, m2m_memset(), M2M_SUCCESS, MODE_START, tstrIperfInit::packet_len, tstrIperfInit::packets_to_send, tstrIperfInit::port, tstrIperfSocketInfo::s32PktCount, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_DGRAM, socket(), TEST_STATE_UDP_TX, tstrIperfSocketInfo::u16MsPeriod, tstrIperfSocketInfo::u16Port, tstrIperfSocketInfo::u32IPAddress, tstrIperfSocketInfo::u32LastStatsTime, tstrIperfSocketInfo::u32LastTransmission, u32msTicks, tstrIperfSocketInfo::u32PktLength, tstrIperfSocketInfo::u32TimeStart, tstrIperfSocketInfo::u8PktsOutstanding, tstrIperfSocketInfo::u8State, and app_status::udp_client.
Referenced by IperfCreate().
|
static |
References _htonl, client_hdr::flags, gu32IPAddress, UDP_datagram::id, inet_ntoa(), IperfAddUint64(), M2M_ERR, M2M_ERR_FAIL, M2M_SUCCESS, NULL, printf, ret, tstrIperfSocketInfo::s32PktCount, send(), sendto(), SOCK_ERR_BUFFER_FULL, tstrIperfUdpMsg::strUdpClientHdr, tstrIperfUdpMsg::strUdpDatagram, TEST_STATE_UDP_TX, UDP_datagram::tv_sec, UDP_datagram::tv_usec, tstrIperfSocketInfo::u32BytesLastPeriod, u32msTicks, tstrIperfSocketInfo::u32PktLength, and tstrIperfSocketInfo::u32TxSQN.
Referenced by IperfStart(), IperfUDP_ClientStart(), and IperfUpdate().
|
static |
References _htons, AF_INET, bind(), tstrIperfSocketInfo::bIsActive, gu32IPAddress, M2M_ERR_FAIL, m2m_memset(), M2M_SUCCESS, tstrIperfInit::port, printf, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_DGRAM, socket(), TEST_STATE_UDP_RX, tstrIperfSocketInfo::u16Port, tstrIperfSocketInfo::u32IPAddress, and tstrIperfSocketInfo::u8State.
Referenced by IperfCreate().
References _htonl, client_hdr::flags, UDP_datagram::id, send(), tstrIperfUdpMsg::strUdpClientHdr, tstrIperfUdpMsg::strUdpDatagram, UDP_datagram::tv_sec, UDP_datagram::tv_usec, and u32msTicks.
Referenced by IperfUpdate().
|
static |
Referenced by IperfSocketEventHandler().
uint32 clientIPAddress |
Referenced by IperfSocketEventHandler(), and main().
|
static |
|
static |
|
static |
|
static |
|
static |
uint32 gu32IPAddress |
|
static |
Referenced by IperfDecrementTimerUse(), IperfIncrementTimerUse(), and IperfInit().
app_status iperf_app_stat |
|
static |
SOCKET tcp_client_sock |
Referenced by IperfTCP_Client_SendTestPacket(), and IperfTCP_ClientStart().
uint32_t tcp_serv_pack_recv |
Referenced by IperfPrintStats(), and main().
|
static |
Referenced by IperfIncrementTimerUse(), and IperfUpdate().
|
static |
uint32_t udp_serv_pack_recv |
Referenced by IperfPrintUdpServerStats(), and main().
SOCKET udp_server_sock |
Referenced by IperfSocketEventHandler(), and main().