|
CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains definitions and functions that are common to test applications. More...
#include "test_common.h"#include "cdi_baseline_profile_01_00_api.h"#include "cdi_baseline_profile_02_00_api.h"#include <assert.h>#include <stdlib.h>Data Structures | |
| struct | CommandLineState |
Macros | |
| #define | MAX_CMD_TOKENS_IN_FILE (10000) |
| The maximum number of command line tokens allowed in a text file when using the @ command line option. | |
| #define | TestConsoleLog SimpleConsoleLog |
| Define TestConsoleLog. | |
Functions | |
| static int | FormatFileString (char *file_buffer_str, const char **cmd_array) |
| A helper function that takes in a string of command-line tokens derived from a file. It will parse the string and store the token substrings into an array of the format identical to the command-line parameter, argv_ptr. | |
| static bool | FileToString (const char *file_name_str, CdiFileID file_handle, char **file_buffer_str) |
| A helper function that reads the contents of a file into a buffer. | |
| static bool | CopyFileContentsToBuffer (const char *file_name_str, char **file_buffer_str) |
| This function attempts to take the file buffer and create and array of command strings. If successful, it will substitute the command-line parameters, argc and argv_ptr. | |
| static bool | CommandsFromFile (char **file_buffer_str, const char **cmd_array_ptr, int *argc, const char ***argv_ptr) |
| This function attempts to open and read file into a buffer. If the buffer contains valid command parameters, it will substitute the command-line parameters, argc and argv_ptr. | |
| void | SimpleConsoleLog (CdiLogLevel log_level, const char *format_str,...) |
| bool | TestStringToInt (const char *str, int *num_ptr, char **ret_end_str) |
| bool | TestCommandLineParserCreate (int *argc_ptr, const char ***argv_ptr, CommandLineHandle *ret_handle) |
| void | TestCommandLineParserDestroy (CommandLineHandle handle) |
| void | TestLogAVMChanges (uint16_t stream_identifier, int payload_size, CdiAvmConfig *config_ptr, const CdiAvmBaselineConfig *baseline_config_ptr, CdiAvmBaselineConfig *last_baseline_config_ptr) |
This file contains definitions and functions that are common to test applications.
|
static |
This function attempts to open and read file into a buffer. If the buffer contains valid command parameters, it will substitute the command-line parameters, argc and argv_ptr.
| file_buffer_str | Pointer to a string that will hold the file contents. |
| argc | Pointer to the number of command-line arguments. |
| argv_ptr | Pointer to the array of string from the command-line arguments. |
| cmd_array_ptr | Pointer to the array of strings that will be used in place of the arguments in argv_ptr. |
|
static |
This function attempts to take the file buffer and create and array of command strings. If successful, it will substitute the command-line parameters, argc and argv_ptr.
| file_name_str | A string that represents the file name. |
| file_buffer_str | Pointer to a string that holds the file contents. |
|
static |
A helper function that reads the contents of a file into a buffer.
| file_name_str | A string that represents the file name. |
| file_handle | The handle of the file to open/read. |
| file_buffer_str | Pointer to a string that will hold the file contents. |
|
static |
A helper function that takes in a string of command-line tokens derived from a file. It will parse the string and store the token substrings into an array of the format identical to the command-line parameter, argv_ptr.
| file_buffer_str | The string of command-line tokens. |
| cmd_array | Pointer to the resulting array of strings. |
| void SimpleConsoleLog | ( | CdiLogLevel | log_level, |
| const char * | format_str, | ||
| ... ) |
Not using the console logger, so implement this API here so it can be used from within test_common.c and test applications that use this file.
| log_level | The log level for this message. |
| format_str | Format string specifier. |
| ... | The remaining parameters contain a variable length list of arguments. |
| bool TestCommandLineParserCreate | ( | int * | argc_ptr, |
| const char *** | argv_ptr, | ||
| CommandLineHandle * | ret_handle ) |
Create an instance of a command line parser.
| argc_ptr | Pointer to number of command line arguments. |
| argv_ptr | Pointer pointer to array of pointers to command line arguments. |
| ret_handle | Address where to write returned handle of parser. |
| void TestCommandLineParserDestroy | ( | CommandLineHandle | handle | ) |
Destroy an instance of the command line parser.
| handle | Instance handle returned from TestCommandLineParserCreate(). |
| void TestLogAVMChanges | ( | uint16_t | stream_identifier, |
| int | payload_size, | ||
| CdiAvmConfig * | config_ptr, | ||
| const CdiAvmBaselineConfig * | baseline_config_ptr, | ||
| CdiAvmBaselineConfig * | last_baseline_config_ptr ) |
| stream_identifier | |
| payload_size | |
| config_ptr | |
| baseline_config_ptr | |
| last_baseline_config_ptr |
| bool TestStringToInt | ( | const char * | str, |
| int * | num_ptr, | ||
| char ** | ret_end_str ) |
Convert a string to an integer.
| str | Pointer to string to convert. |
| num_ptr | Address where to write converted integer value. |
| ret_end_str | Optional address where to write pointer to string after last character parsed. |