ASTERIX data block processing. More...

Collaboration diagram for Data Block:

Data Structures

struct  ast_datablock_t
 Datablock. More...
struct  ast_datablock_ex_t
 Extracted datablock. More...

Macros

#define AST_MAX_DATARECORDS   64
 Maximum number of data records in a data block.

Functions

ast_datablock_t ast_datablock_decode (const unsigned char *const buffer, const size_t bufsize, const ast_uap_t uap)
 Datablock decode function.
ast_datablock_t ast_datablock_smart_decode (const unsigned char *const buffer, const size_t bufsize)
 Datablock smart decode function.
ast_datablock_t ast_datablock_encode (unsigned char *const buffer, const size_t bufsize, const ast_datablock_ex_t xdb)
 Datablock encode function.
ast_datablock_t ast_datablock_modify (unsigned char *const buffer, const size_t bufsize, const ast_datablock_t src, const ast_datarecord_modifier_t mod)
 Datablock modify function.

Detailed Description

ASTERIX data block processing.

Description:
A data block is the unit of exchange in ASTERIX. It consists of a one-octet data Category, a two-octet length field, and one or more data records composed according to the User Application Profile (UAP) of the Category.

Macro Definition Documentation

◆ AST_MAX_DATARECORDS

#define AST_MAX_DATARECORDS   64

Maximum number of data records in a data block.

Function Documentation

◆ ast_datablock_decode()

ast_datablock_t ast_datablock_decode ( const unsigned char *const buffer,
const size_t bufsize,
const ast_uap_t uap )

Datablock decode function.

Parameters
bufferBuffer to read datablock data
bufsizeBuffer size
uapUser application profile (UAP) used to decode data

This function will read and check data against specified uap, and return decoded datablock. If data can be successfully decoded, the returned datablock will be marked as "valid". If any error occurs, the returned datablock will be marked as "invalid".

Examples
example.c.

◆ ast_datablock_encode()

ast_datablock_t ast_datablock_encode ( unsigned char *const buffer,
const size_t bufsize,
const ast_datablock_ex_t xdb )

Datablock encode function.

Parameters
bufferBuffer to write encoded datablock data
bufsizeBuffer size
xdbExtracted datablock container
Returns
Encoded datablock

This function will check datarecords contained in xdb, encode them and write encoded data to buffer. If all datarecords are successfully encoded, the returned datablock will be marked as "valid". If any error occurs, the returned datablock will be marked as "invalid".

Examples
example.c.

◆ ast_datablock_modify()

ast_datablock_t ast_datablock_modify ( unsigned char *const buffer,
const size_t bufsize,
const ast_datablock_t src,
const ast_datarecord_modifier_t mod )

Datablock modify function.

Parameters
bufferBuffer to write modified datablock data
bufsizeBuffer size
srcSource datablock to be modified
modData record modifier applied to every data record
Returns
Modified datablock

This function applies the data record modifier to every data record of the source datablock and writes the modified data to buffer. If all datarecords are successfully modified, the returned datablock will be marked as "valid". If any error occurs, the returned datablock will be marked as "invalid".

Examples
example.c.

◆ ast_datablock_smart_decode()

ast_datablock_t ast_datablock_smart_decode ( const unsigned char *const buffer,
const size_t bufsize )

Datablock smart decode function.

Parameters
bufferBuffer to read datablock data
bufsizeBuffer size

This function will read and decode data by using a automatically selected UAP, and return decoded datablock. If data can be successfully decoded, the returned datablock will be marked as "valid". If any error occurs, the returned datablock will be marked as "invalid".