CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
test_args.h File Reference

The declarations in this header file correspond to the definitions in test_args.c. More...

#include <stdbool.h>
#include "cdi_baseline_profile_01_00_api.h"
#include "cdi_baseline_profile_02_00_api.h"
#include "cdi_core_api.h"
#include "cdi_logger_api.h"
#include "cdi_os_api.h"
#include "cdi_utility_api.h"

Go to the source code of this file.

Data Structures

struct  StreamSettings
 A structure that holds all the settings for a stream as set from the command line. More...
 
struct  TestSettings
 A structure that holds all the test settings for a connection as set from the command line. More...
 
struct  GlobalTestSettings
 A structure that holds all of the global test settings set from the command-line. More...
 

Macros

#define OPTARG_INVALID_CORE   (-1)
 An impossible number for a CPU core number that can be used to detect an invalid core setting.
 
#define DEFAULT_NUM_LOOPS   (1)
 The default number of loops the test application will run.
 
#define RUN_FOREVER_VALUE   (0)
 The default number of loops the test application will run.
 
#define MAX_CHARACTERS_LOG_COMPONENTS   (256)
 The maximum characters for the log components string.
 
#define MAX_CHARACTERS_CONNECTION_INFO   (20)
 The maximum characters for the log components string.
 
#define PCR_VIDEO_SAMPLE_RATE   (90000)
 ST 2110 Specifies a 90kHz sample rate for video and ancillary data.
 

Typedefs

typedef struct TestConnectionInfo TestConnectionInfo
 Forward reference. Contains connection state and test settings.
 

Enumerations

enum  TestPatternType {
  kTestPatternSame , kTestPatternInc , kTestPatternSHR , kTestPatternSHL ,
  kTestPatternNone , kTestPatternIgnore
}
 
enum  TestOptionNames {
  kTestOptionLogSingleFile , kTestOptionLogMultipleFiles , kTestOptionUseStderr , kTestOptionMultiWindowConsole ,
  kTestOptionConnectionName , kTestOptionTransmit , kTestOptionReceive , kTestOptionAVMAutoRx ,
  kTestOptionAVMVideo , kTestOptionAVMAudio , kTestOptionAVMAncillary , kTestOptionStreamID ,
  kTestOptionConfigSkip , kTestOptionKeepAlive , kTestOptionAdapter , kTestOptionBufferType ,
  kTestOptionLocalIP , kTestOptionDestPort , kTestOptionRemoteIP , kTestOptionBindIP ,
  kTestOptionShareThread , kTestOptionCore , kTestOptionPayloadSize , kTestOptionNumTransactions ,
  kTestOptionRate , kTestOptionTxTimeout , kTestOptionRxBufferDelay , kTestOptionPattern ,
  kTestOptionPatternStart , kTestOptionUseRiffFile , kTestOptionFileRead , kTestOptionFileWrite ,
  kTestOptionNewConnection , kTestOptionNewConnectionMultipleEndpoints , kTestOptionNewStream , kTestOptionConnectionTimeout ,
  kTestOptionLogLevel , kTestOptionLogComponent , kTestOptionLogTimestamps , kTestOptionNumLoops ,
  kTestOptionStatsConfigPeriod , kTestOptionStatsConfigCloudWatch , kTestOptionNoPayloadUserData , kTestOptionHelp ,
  kTestOptionHelpVideo , kTestOptionHelpAudio , kTestOptionHelpRiff , kTestOptionHelpStats ,
  kTestOptionVersion
}
 
enum  ProgramExecutionStatus { kProgramExecutionStatusContinue , kProgramExecutionStatusExitOk , kProgramExecutionStatusExitError }
 

Functions

void PrintTestSettings (const TestSettings *const test_settings_ptr, const int num_connections)
 
void LogComponentToString (const CdiEnumStringKey *key_array, char *log_component_str, CdiLogComponent *log_component_ptr)
 A function that turns selected log components into a string of log components delimited by the '|' character.
 
ProgramExecutionStatus GetArgs (int argc, const char **argv_ptr, TestSettings *test_settings_ptr, int *num_connections_found)
 

Detailed Description

The declarations in this header file correspond to the definitions in test_args.c.

Enumeration Type Documentation

◆ ProgramExecutionStatus

Enumerated type that can be used to indicate whether the program should exit and whether it should do so with a 0 or a 1 exit status.

Enumerator
kProgramExecutionStatusContinue 

The program should continue to run.

kProgramExecutionStatusExitOk 

The program should exit successfully (exit code of 0).

kProgramExecutionStatusExitError 

The program should exit and indicate a failure (exit code of 1).

◆ TestOptionNames

Enum for the list of test command line options. NOTE: Must keep in sync with OptDef my_options[] table in test_args.c.

◆ TestPatternType

Enum for test pattern types. This list kept in sync with patterns_array[].

Function Documentation

◆ GetArgs()

ProgramExecutionStatus GetArgs ( int argc,
const char ** argv_ptr,
TestSettings * test_settings_ptr,
int * num_connections_found )

A helper function that takes in command-line arguments, sanitizes them for syntax and correctness, and then assigns them to the test_settings data structure.

Parameters
argcThe system command line argument count variable.
argv_ptrThe pointer to the system command line arguments array.
test_settings_ptrPointer to an array of test settings data structures we will modify.
num_connections_foundPointer to the number of connections found.
Returns
ProgramExecutionStatus to indicate whether the program should continue and if not, what exit status to have.

◆ LogComponentToString()

void LogComponentToString ( const CdiEnumStringKey * key_array,
char * log_component_str,
CdiLogComponent * log_component_ptr )

A function that turns selected log components into a string of log components delimited by the '|' character.

Parameters
key_arrayArray of log component (enum, string) items.
log_component_strA pointer to the buffer that the resulting log component string will be held.
log_component_ptrA pointer to the array of selected log components; this is held in the global_test_settings structure.

◆ PrintTestSettings()

void PrintTestSettings ( const TestSettings *const test_settings_ptr,
const int num_connections )

Pretty-print the test settings.

Parameters
test_settings_ptrPointer to the test settings struct.
num_connectionsThe number of connections in the test_settings array.