ASTERIX Field Specification (FSPEC) processing. More...

Collaboration diagram for Field Specification (FSPEC):

Data Structures

struct  ast_fspec_t
 Field Specification (FSPEC). More...

Functions

ast_fspec_t ast_fspec_decode (const unsigned char *const buffer, const size_t bufsize)
 FSPEC decode function.
ast_fspec_t ast_fspec_copy (unsigned char *const buffer, const size_t bufsize, const ast_fspec_t src)
 FSPEC copy function.
bool ast_fspec_is_set (const ast_fspec_t *fspec, const unsigned int frn)
 Test whether a data item is present.
bool ast_fspec_set (unsigned char *const buffer, const size_t bufsize, const unsigned int frn, const bool set)
 Set or clear the presence bit of a data item.

Detailed Description

ASTERIX Field Specification (FSPEC) processing.

Description:
The Field Specification (FSPEC) prefixes a data record and indicates, by one bit per Field Reference Number (FRN), which data items of the UAP are present in the record. The last bit of each FSPEC octet (FX) extends the FSPEC to a following octet.

Function Documentation

◆ ast_fspec_copy()

ast_fspec_t ast_fspec_copy ( unsigned char *const buffer,
const size_t bufsize,
const ast_fspec_t src )

FSPEC copy function.

Parameters
bufferBuffer to write destination FSPEC data
bufsizeBuffer size
srcOriginal FSPEC, must be valid
Returns
Copied FSPEC

This function copies the original FSPEC to the specified buffer. If the FSPEC has been successfully copied, the returned FSPEC will be marked as "valid". If any error occurs, the returned FSPEC will be marked as "invalid".

◆ ast_fspec_decode()

ast_fspec_t ast_fspec_decode ( const unsigned char *const buffer,
const size_t bufsize )

FSPEC decode function.

Parameters
bufferBuffer to read FSPEC data
bufsizeBuffer size
Returns
Decoded FSPEC

This function reads the FSPEC octets (FX extension included) from buffer and counts the data items present. If the FSPEC can be successfully decoded, the returned FSPEC will be marked as "valid". If any error occurs, the returned FSPEC will be marked as "invalid".

◆ ast_fspec_is_set()

bool ast_fspec_is_set ( const ast_fspec_t * fspec,
const unsigned int frn )

Test whether a data item is present.

Parameters
fspecFSPEC to check
frnField Reference Number (FRN) of the data item
Returns
true, if the data item with the given FRN is present

◆ ast_fspec_set()

bool ast_fspec_set ( unsigned char *const buffer,
const size_t bufsize,
const unsigned int frn,
const bool set )

Set or clear the presence bit of a data item.

Parameters
bufferBuffer holding the FSPEC data to modify
bufsizeBuffer size
frnField Reference Number (FRN) of the data item
settrue to set the bit, false to clear it
Returns
true, if the bit has been successfully modified

This function modifies the FSPEC octets in buffer directly; the FX extension bits are not changed.