test/throughput/throughput_types.h

/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#ifndef THROUGHPUT_TYPES
#define THROUGHPUT_TYPES
#include "gos.h"
#define MAX_IP_ADDRESS_STRING (16)
typedef enum
{
CLIENT,
SERVER,
NUM_SYSTEMS
} context_type_t;
typedef enum
{
THROUGHPUT_TCP,
THROUGHPUT_UDP,
THROUGHPUT_NUM_PROTOCOLS
} throughput_protocol_t;
typedef struct
{
throughput_protocol_t proto;
/* for server - listenning port, for client - remote server port */
uint16_t port;
/* ip of the remote server, applicable for tcp client context only */
char ip[MAX_IP_ADDRESS_STRING];
/* how often the throughput results get updated */
uint16_t update_interval_ms;
/* duration of the test in seconds */
uint32_t time_s;
} throughput_settings_t;
typedef enum
{
UNINITIALISED,
IDLE,
TRANSFERRING,
} context_status_t;
typedef struct
{
uint16_t seq_number;
} throughput_packet_header_t;
typedef struct
{
context_type_t type;
throughput_settings_t settings;
gos_thread_t thread;
context_status_t status;
gos_handle_t handle;
uint32_t transferred;
uint32_t reported;
uint8_t* thread_stack_ptr;
uint32_t interval_count;
uint32_t last_get_report_time;
uint8_t exit;
} throughput_context_t;
#endif