OSFI-C  3.9.3
OpenSF Integration Library
OSFIC.h File Reference

OSFI-C public API header. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  osfiParameter
 
struct  osfi_timevalue
 

Macros

#define MAX_LENGTH_FILE_NAME   255
 
#define MAX_LENGTH_STRING   255
 
#define MAX_PARAMETER_FIELD_SIZE   255
 
#define MAX_PARAMETER_NAME_SIZE   255
 
#define MAX_PARAMETER_DESC_SIZE   255
 
#define MAX_LOG_SIZE   1000
 
#define OSFI_NO_RETURN   /* Below C11: nothing */
 

Typedefs

typedef struct osfi_timevalue osfi_timevalue_t
 

Enumerations

enum  ParamType {
  ParamInteger = 1 , ParamDouble , ParamBoolean , ParamString ,
  ParamFile , ParamFolder , ParamTime
}
 
enum  osfi_confm_val_res { OSFI_CONFM_VAL_PASSED = 1 , OSFI_CONFM_VAL_INVALID , OSFI_CONFM_VAL_ERRORS }
 

Functions

void osfiLoggerError (const char *format,...)
 
void osfiLoggerWarning (const char *format,...)
 
void osfiLoggerInfo (const char *format,...)
 
void osfiLoggerDebug (const char *format,...)
 
void osfiLoggerProgress (int n, int m)
 
void osfiLoggerFinishExecution (int errorCode)
 
void osfiLoggerQuality (const char *name, const char *value)
 
void osfiLoggerQualityDouble (const char *name, double value)
 
int osfiCLP (int argc, char *argv[])
 
void osfiCLPGetConfFile (char *fileName, int *length)
 
void osfiCLPGetConfFiles (char *confFiles[], int *noFiles)
 
void osfiCLPGetInputFiles (char *inputFiles[], int *noFiles)
 
void osfiCLPGetOutputFiles (char *outputFiles[], int *noFiles)
 
int osfiConFMParamReader (const char *fileName, const char *schemaName)
 
bool osfiConFMReadConfigFile (const char *fileName)
 
enum osfi_confm_val_res osfiConFMValidateAgainst (const char *schemaFile)
 
void osfiConFMPrintParameters ()
 
int osfiTimevalue_cmp (const osfi_timevalue_t *a, const osfi_timevalue_t *b)
 
void osfiConFMGetIntegerValue (int *value, const char *paramName)
 
void osfiConFMGetDoubleValue (double *value, const char *paramName)
 
void osfiConFMGetTimeValue (osfi_timevalue_t *value, const char *paramName)
 
bool osfiConFMGetBoolValue (const char *paramName)
 
void osfiConFMGetFileValue (char *param, int *length, const char *paramName)
 
void osfiConFMGetStringValue (char *param, int *length, const char *paramName)
 
void osfiConFMGetParameter (osfiParameter *param, const char *paramName)
 
void osfiConFMPrintParameter (const char *paramName)
 
void osfiConFMGetVectorDoubleValues (double *doubleList, int *size, const char *paramName)
 
void osfiConFMGetVectorIntegerValues (int *intList, int *size, const char *paramName)
 
void osfiConFMGetVectorTimeValues (osfi_timevalue_t *list, int *size, const char *paramName)
 
void osfiConFMGetVectorStringValues (char *stringList[], int *size, const char *paramName)
 
void osfiConFMGetVectorFileValues (char *fileList[], int *size, const char *paramName)
 
void osfiConFMGetVectorBooleanValues (bool *boolList, int *size, const char *paramName)
 
void osfiConFMGetLeafVectorDoubleValues (double *doubleList, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorIntegerValues (int *intList, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorTimeValues (osfi_timevalue_t *list, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorStringValues (char *stringList[], int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorFileValues (char *fileList[], int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetLeafVectorBooleanValues (bool *boolList, int *size, const char *paramName, int node[], int depth)
 
void osfiConFMGetMatrixStringValues (char *stringMatrix[], int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixFileValues (char *fileMatrix[], int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixBooleanValues (bool *booleanMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMfileExist (bool *booleanMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixDoubleValues (double *doubleMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixIntegerValues (int *intMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetMatrixTimeValues (osfi_timevalue_t *intMatrix, int *rows, int *columns, const char *paramName)
 
void osfiConFMGetDimension (const char *paramName, int index, int *size)
 
void osfiConFMGetNodeDimension (const char *paramName, int node[], int depth, int *size)
 
bool osfiConFMIsLeaf (const char *paramName, int node[], int depth)
 
int osfiConFMGetRows (const char *paramName)
 
int osfiConFMGetColumns (const char *paramName)
 
bool osfiConFMExistParameter (const char *paramName)
 
ParamType osfiConFMGetElementType (const char *paramName)
 
bool osfiConFMIsArray (const char *paramName)
 
int osfiCommonClose ()
 

Detailed Description

OSFI-C public API header.

Macro Definition Documentation

◆ OSFI_NO_RETURN

#define OSFI_NO_RETURN   /* Below C11: nothing */

If supported by the compiler, indicates that the function so annotated never returns.

Typedef Documentation

◆ osfi_timevalue_t

Representation of the value of a TIME parameter (see enum ParamType and its value ParamTime). The range of each field is according to the CCSDS ASCII time code "A" format.

Warning
The ranges mentioned here are for exposition only, they are not checked.
Note
This type is layout-compatible with the OSFI-C++ type osfi::confm::TimeValue.

Enumeration Type Documentation

◆ osfi_confm_val_res

Return values for the osfiConFMValidateAgainst function.

Enumerator
OSFI_CONFM_VAL_PASSED 

Validation ran and passed.

OSFI_CONFM_VAL_INVALID 

Validation ran but the document did not validate against the schema.

OSFI_CONFM_VAL_ERRORS 

Validation failed to run due to any error (e.g. schema not found).

◆ ParamType

enum ParamType

Internal definition of parameter types

Enumerator
ParamInteger 

Integral number, with the value range of int32_t.

ParamDouble 

Floating point number, in decimal representation with the range of IEEE754 binary64.

ParamBoolean 

Truth value. Per the E2E-ICD, only TRUE or FALSE are accepted, capitalized.

ParamString 

A string composed of alphanumeric, punctuation or whitespace characters (but excluding control characters e.g. "\n") with length ranging from 0 to 255.

ParamFile 

Path to a file. If relative, it is resolved against the configured base directory, which, following the E2E-ICD, is read from the enviroment variable "E2E_HOME".

ParamFolder 

Path to a folder, with the same rules as ParamFile.

ParamTime 

Timecode formatted as CCSDS ASCII time format with milli- or micro-second precision.

Note
Notwithstanding the E2E-ICD, OSFI allows up to nanosecond precision.
See also
osfi_timevalue_t

Function Documentation

◆ osfiCLP()

int osfiCLP ( int  argc,
char *  argv[] 
)

CLP Initializer. Needs the command line arguments.

Parameters
argc- number of arguments
argv- list of array of characters
Returns
FALSE (zero) in case of error, nonzero otherwise

◆ osfiCLPGetConfFile()

void osfiCLPGetConfFile ( char *  fileName,
int *  length 
)

Gets the name of the configuration file. Configuration file can be "" if no configuration file is passed.

Parameters
fileName- pointer to the memory where the file name will be stored.
length- pointer to an integer where the file name length will be stored.
Deprecated:
Modules with a single configuration file are deprecated

◆ osfiCLPGetConfFiles()

void osfiCLPGetConfFiles ( char *  confFiles[],
int *  noFiles 
)

Gets the list of configuration files.

Parameters
confFiles- pointer to the structure where configuration file names will be stored.
noFiles- pointer to an integer where number of configuration files will be stored.

◆ osfiCLPGetInputFiles()

void osfiCLPGetInputFiles ( char *  inputFiles[],
int *  noFiles 
)

Gets the list of input files.

Parameters
inputFiles- pointer to the structure where input file names will be stored.
noFiles- pointer to an integer where number of input files will be stored.

◆ osfiCLPGetOutputFiles()

void osfiCLPGetOutputFiles ( char *  outputFiles[],
int *  noFiles 
)

Gets the list of output files.

Parameters
outputFiles- pointer to the structure where output file names are stored.
noFiles- pointer to an integer where number of output files will be stored.

◆ osfiCommonClose()

int osfiCommonClose ( )

Close the OSFI parameter and Command Line parsers

Returns
FALSE (zero) if errors have occurred, nonzero otherwise.

◆ osfiConFMExistParameter()

bool osfiConFMExistParameter ( const char *  paramName)

Checks the existence of a parameter within a configuration file.

Parameters
paramNameParameter name (full path and name)
Returns
boolean True if the parameter exists False otherwise.

◆ osfiConFMfileExist()

void osfiConFMfileExist ( bool *  booleanMatrix,
int *  rows,
int *  columns,
const char *  paramName 
)

Checks the presence of the files specified within a FILE parameter.

Parameters
booleanMatrix- Pointer to the boolean structure where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetBoolValue()

bool osfiConFMGetBoolValue ( const char *  paramName)

Gets the value of the parameter as a boolean type.

Parameters
paramName- Complete name of the parameter.
Returns
TRUE if value = "TRUE", FALSE either way

◆ osfiConFMGetColumns()

int osfiConFMGetColumns ( const char *  paramName)

Gets an integer with the columns dimension of the parameter.

Parameters
paramName- Parameter name (full path and name).
Returns
int Integer with the number of columns

◆ osfiConFMGetDimension()

void osfiConFMGetDimension ( const char *  paramName,
int  index,
int *  size 
)

Gets an integer with the dimension of the parameter specified by index.

Parameters
paramName- Parameter name (full path and name).
index- Integer specifying the dimension that want to be returned. 0:rows 1:columns.
size- Pointer to integer where the dimension will be stored.

◆ osfiConFMGetDoubleValue()

void osfiConFMGetDoubleValue ( double *  value,
const char *  paramName 
)

Gets the value of the parameter as a double type.

Parameters
value- Pointer to the double where value will be stored.
paramName- Complete name of the parameter

◆ osfiConFMGetElementType()

ParamType osfiConFMGetElementType ( const char *  paramName)

Returns the element type of the given parameter, or a default value if not found.

◆ osfiConFMGetFileValue()

void osfiConFMGetFileValue ( char *  param,
int *  length,
const char *  paramName 
)

Gets the value of the parameter as a file type.

Parameters
param- Pointer to memory where file name will be stored.
length- Pointer to an integer where file name length will be stored.
paramName- Complete name of the parameter.

◆ osfiConFMGetIntegerValue()

void osfiConFMGetIntegerValue ( int *  value,
const char *  paramName 
)

Gets the value of the parameter as an integer type.

Parameters
value- Pointer to the integer where value will be stored.
paramName- Complete name of the parameter

◆ osfiConFMGetLeafVectorBooleanValues()

void osfiConFMGetLeafVectorBooleanValues ( bool *  boolList,
int *  size,
const char *  paramName,
int  node[],
int  depth 
)

Gets the value of the parameter as a vector of boolean values.

Parameters
boolList- Pointer to the boolean structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetLeafVectorDoubleValues()

void osfiConFMGetLeafVectorDoubleValues ( double *  doubleList,
int *  size,
const char *  paramName,
int  node[],
int  depth 
)

Gets the value of the parameter as a vector of double values.

Parameters
doubleList- Pointer to the double structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetLeafVectorFileValues()

void osfiConFMGetLeafVectorFileValues ( char *  fileList[],
int *  size,
const char *  paramName,
int  node[],
int  depth 
)

Gets the value of the parameter as a vector of file names.

Parameters
fileList- Pointer to the char structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetLeafVectorIntegerValues()

void osfiConFMGetLeafVectorIntegerValues ( int *  intList,
int *  size,
const char *  paramName,
int  node[],
int  depth 
)

Gets the value of the parameter as a vector of integer values.

Parameters
intList- Pointer to the integer structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetLeafVectorStringValues()

void osfiConFMGetLeafVectorStringValues ( char *  stringList[],
int *  size,
const char *  paramName,
int  node[],
int  depth 
)

Gets the value of the parameter as a vector of string values.

Parameters
stringList- Pointer to the char structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetLeafVectorTimeValues()

void osfiConFMGetLeafVectorTimeValues ( osfi_timevalue_t list,
int *  size,
const char *  paramName,
int  node[],
int  depth 
)

Gets the value of the parameter as a vector of timecode values.

Parameters
intList- Pointer to the array where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetMatrixBooleanValues()

void osfiConFMGetMatrixBooleanValues ( bool *  booleanMatrix,
int *  rows,
int *  columns,
const char *  paramName 
)

Gets the value of the parameter as a matrix of boolean values.

Parameters
booleanMatrix- Pointer to the boolean structure where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetMatrixDoubleValues()

void osfiConFMGetMatrixDoubleValues ( double *  doubleMatrix,
int *  rows,
int *  columns,
const char *  paramName 
)

Gets the value of the parameter as a matrix of double values.

Parameters
doubleMatrix- Pointer to the double structure where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetMatrixFileValues()

void osfiConFMGetMatrixFileValues ( char *  fileMatrix[],
int *  rows,
int *  columns,
const char *  paramName 
)

Gets the value of the parameter as a matrix of double values.

Parameters
fileMatrix- Pointer to the double structure where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetMatrixIntegerValues()

void osfiConFMGetMatrixIntegerValues ( int *  intMatrix,
int *  rows,
int *  columns,
const char *  paramName 
)

Gets the value of the parameter as a matrix of integer values.

Parameters
intMatrix- Pointer to the integer structure where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetMatrixStringValues()

void osfiConFMGetMatrixStringValues ( char *  stringMatrix[],
int *  rows,
int *  columns,
const char *  paramName 
)

Gets the value of the parameter as a matrix of string values.

Parameters
stringMatrix- Pointer to the char structure where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetMatrixTimeValues()

void osfiConFMGetMatrixTimeValues ( osfi_timevalue_t intMatrix,
int *  rows,
int *  columns,
const char *  paramName 
)

Gets the value of the parameter as a matrix of timecode values.

Parameters
intMatrix- Pointer to the array where parameter values will be stored.
rows- Pointer to integer where the number of rows will be stored.
columns- Pointer to integer where the number of columns will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetParameter()

void osfiConFMGetParameter ( osfiParameter param,
const char *  paramName 
)

Gets a parameter structure corresponding with the first occurrence of a parameter name into a configuration file.

Parameters
param- Pointer to osfiParameter structure where parameter fields will be stored.
paramName- Parameter name (full path and name)

◆ osfiConFMGetRows()

int osfiConFMGetRows ( const char *  paramName)

Gets an integer with the rows dimension of the parameter.

Parameters
paramName- Parameter name (full path and name).
Returns
int Integer with the number of rows.

◆ osfiConFMGetStringValue()

void osfiConFMGetStringValue ( char *  param,
int *  length,
const char *  paramName 
)

Gets the value of the parameter as a string type.

Parameters
param- Pointer to memory where string will be stored.
length- Pointer to an integer where string length will be stored.
paramName- Complete name of the parameter.

◆ osfiConFMGetTimeValue()

void osfiConFMGetTimeValue ( osfi_timevalue_t value,
const char *  paramName 
)

Gets the value of the parameter as a time code.

Parameters
value- Pointer to the timevalue variable where value will be stored.
paramName- Complete name of the parameter

◆ osfiConFMGetVectorBooleanValues()

void osfiConFMGetVectorBooleanValues ( bool *  boolList,
int *  size,
const char *  paramName 
)

Gets the value of the parameter as a vector of boolean values.

Parameters
boolList- Pointer to the boolean structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetVectorDoubleValues()

void osfiConFMGetVectorDoubleValues ( double *  doubleList,
int *  size,
const char *  paramName 
)

Gets the value of the parameter as a vector of double values.

Parameters
doubleList- Pointer to the double structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetVectorFileValues()

void osfiConFMGetVectorFileValues ( char *  fileList[],
int *  size,
const char *  paramName 
)

Gets the value of the parameter as a vector of file names.

Parameters
fileList- Pointer to the char structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetVectorIntegerValues()

void osfiConFMGetVectorIntegerValues ( int *  intList,
int *  size,
const char *  paramName 
)

Gets the value of the parameter as a vector of integer values.

Parameters
intList- Pointer to the integer structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetVectorStringValues()

void osfiConFMGetVectorStringValues ( char *  stringList[],
int *  size,
const char *  paramName 
)

Gets the value of the parameter as a vector of string values.

Parameters
stringList- Pointer to the char structure where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMGetVectorTimeValues()

void osfiConFMGetVectorTimeValues ( osfi_timevalue_t list,
int *  size,
const char *  paramName 
)

Gets the value of the parameter as a vector of timecode values.

Parameters
list- Pointer to the array where parameter values will be stored.
size- Pointer to integer where vector size will be stored.
paramName- Parameter name (full path and name).

◆ osfiConFMIsArray()

bool osfiConFMIsArray ( const char *  paramName)

Returns true if the named parameter is of ARRAY type. Note that MATRIX parameters are not considered ARRAY-typed.

◆ osfiConFMParamReader()

int osfiConFMParamReader ( const char *  fileName,
const char *  schemaName 
)

Creates an instance of the ParamReader class, parses a given configuration XML file and stores every valid parameter.

Validating agains an XSD schema is optional.

Parameters
fileName- Configuration XML file
schemaName- Configuration XSD schema
Returns
FALSE (0) if errors occurred, nonzero otherwise
Deprecated:
because it maps to the deprecated two-argument ParamReader constructor

◆ osfiConFMPrintParameter()

void osfiConFMPrintParameter ( const char *  paramName)

Prints out to standard output a textual description of the parameter.

Parameters
paramName- Parameter name (full path and name).

◆ osfiConFMPrintParameters()

void osfiConFMPrintParameters ( )

Prints a textual representation of the list of Parameters on screen.

◆ osfiConFMReadConfigFile()

bool osfiConFMReadConfigFile ( const char *  fileName)

Creates an instance of the ParamReader class, parses a given configuration XML file and stores every valid parameter.

Parameters
fileName- Configuration XML file
Returns
false if errors occurred, nonzero otherwise

◆ osfiConFMValidateAgainst()

enum osfi_confm_val_res osfiConFMValidateAgainst ( const char *  schemaFile)

Performs validation of the XML file for the current set of parameters against a schema document.

Parameters
schemaFileXSD file to use. If NULL, the schema is assumed to be referenced in the XML itself.

◆ osfiLoggerDebug()

void osfiLoggerDebug ( const char *  format,
  ... 
)

Shows a formatted debug message, if the environment variable "DEBUG_MODE" is equal to "On". First time this function is called, checks the declaration of that variable. If it is not declared, presents a warning message and assumes it as "Off".

Parameters
format- text of the message

◆ osfiLoggerError()

void osfiLoggerError ( const char *  format,
  ... 
)

Shows a formatted error message.

Parameters
format- text of the message

◆ osfiLoggerFinishExecution()

void osfiLoggerFinishExecution ( int  errorCode)

Shows an information message and exits the program execution with an specific error code.

Parameters
errorCode- Code of error to exit with.
Warning
This call never returns and causes termination of the program.

◆ osfiLoggerInfo()

void osfiLoggerInfo ( const char *  format,
  ... 
)

Shows a formatted information message.

Parameters
format- text of the message

◆ osfiLoggerProgress()

void osfiLoggerProgress ( int  n,
int  m 
)

Shows a formatted progress message.

Parameters
n- current step number
m- maximum number of steps.

◆ osfiLoggerQuality()

void osfiLoggerQuality ( const char *  name,
const char *  value 
)

Shows a formatted message reporting a quality indicator

Parameters
name- Name of the quality indicator
value- String associated to the quality indicator pointed by name

◆ osfiLoggerQualityDouble()

void osfiLoggerQualityDouble ( const char *  name,
double  value 
)

Shows a formated message reporting a quality indicator

Parameters
name- Name of the quality indicator
value- Double associated to the quality indicator pointed by name

◆ osfiLoggerWarning()

void osfiLoggerWarning ( const char *  format,
  ... 
)

Shows a formatted warning message.

Parameters
format- text of the message

◆ osfiTimevalue_cmp()

int osfiTimevalue_cmp ( const osfi_timevalue_t a,
const osfi_timevalue_t b 
)

Comparison function between osfi_timevalue_t instances.

Parameters
a,bValues to compare. NULL pointers compare as less-than any non-NULL value.
Returns
int Negative if a<b, zero if a==b, positive if a>b