hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
Data Structures | Macros | Functions
ifx-record-error.h File Reference

Model interface to create error record types and get/set record fields. More...

#include <stddef.h>
#include <stdint.h>
#include "infineon/ifx-error.h"
#include "infineon/ifx-utils.h"

Go to the source code of this file.

Data Structures

struct  ifx_record_error_t
 Structure defines error record details such as error reason and data. More...
 

Macros

#define IFX_RECORD_ERROR_SET   UINT8_C(0x01)
 Identifier for model set error record ID.
 
#define IFX_RECORD_ERROR_GET   UINT8_C(0x02)
 Identifier for model get error record ID.
 
#define IFX_RECORD_ERROR_RELEASE_MEMORY   UINT8_C(0x03)
 Identifier for model error record release memory.
 
#define IFX_RECORD_ERROR_TYPE   {0x65, 0x72, 0x72}
 Type information for error record 'err'.
 

Functions

ifx_status_t ifx_record_error_new (ifx_record_handle_t *handle)
 Creates an error record and handle of the created record. This handle holds the values of the record needed for encode and decode operations.
 
ifx_status_t ifx_record_error_set_reason (ifx_record_handle_t *handle, uint8_t error_reason)
 Sets the error reason in the error record details for the given record handle.
 
ifx_status_t ifx_record_error_set_error_data (ifx_record_handle_t *handle, const ifx_blob_t *error)
 Sets the error data in the error record details for the given record handle.
 
ifx_status_t ifx_record_error_get_reason (const ifx_record_handle_t *handle, uint8_t *error_reason)
 Gets an error reason of an error record from the given record handle.
 
ifx_status_t ifx_record_error_get_error_data (const ifx_record_handle_t *handle, ifx_blob_t *error)
 Gets an error data of an error record from the given record handle.
 

Detailed Description

Model interface to create error record types and get/set record fields.

This record is used only by the handover select and not intended to use for any other records.

Definition in file ifx-record-error.h.

Macro Definition Documentation

◆ IFX_RECORD_ERROR_GET

#define IFX_RECORD_ERROR_GET   UINT8_C(0x02)

Identifier for model get error record ID.

Definition at line 33 of file ifx-record-error.h.

◆ IFX_RECORD_ERROR_RELEASE_MEMORY

#define IFX_RECORD_ERROR_RELEASE_MEMORY   UINT8_C(0x03)

Identifier for model error record release memory.

Definition at line 38 of file ifx-record-error.h.

◆ IFX_RECORD_ERROR_SET

#define IFX_RECORD_ERROR_SET   UINT8_C(0x01)

Identifier for model set error record ID.

Definition at line 28 of file ifx-record-error.h.

◆ IFX_RECORD_ERROR_TYPE

#define IFX_RECORD_ERROR_TYPE   {0x65, 0x72, 0x72}

Type information for error record 'err'.

Definition at line 43 of file ifx-record-error.h.

Function Documentation

◆ ifx_record_error_get_error_data()

ifx_status_t ifx_record_error_get_error_data ( const ifx_record_handle_t * handle,
ifx_blob_t * error )

Gets an error data of an error record from the given record handle.

Parameters
[in]handlePointer to the record handle obtained while creating the record.
[out]errorPointer to error data.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the get operation is successful
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_RECORD_INVALIDIf record type is invalid
IFX_OUT_OF_MEMORYIf memory allocation is invalid

◆ ifx_record_error_get_reason()

ifx_status_t ifx_record_error_get_reason ( const ifx_record_handle_t * handle,
uint8_t * error_reason )

Gets an error reason of an error record from the given record handle.

Parameters
[in]handlePointer to the record handle obtained while creating the record.
[out]error_reasonPointer to the error reason that defines failure cause of the handover selector.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the get operation is successful
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_RECORD_INVALIDIf record type is invalid

◆ ifx_record_error_new()

ifx_status_t ifx_record_error_new ( ifx_record_handle_t * handle)

Creates an error record and handle of the created record. This handle holds the values of the record needed for encode and decode operations.

Parameters
[out]handleHandle of the created error record.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the record creation operation is successful
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORYIf memory allocation fails

◆ ifx_record_error_set_error_data()

ifx_status_t ifx_record_error_set_error_data ( ifx_record_handle_t * handle,
const ifx_blob_t * error )

Sets the error data in the error record details for the given record handle.

Parameters
[out]handlePointer to the record handle obtained while creating the record.
[in]errorPointer to error data.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the set operation is successful
IFX_OUT_OF_MEMORYIf memory allocation is invalid
IFX_RECORD_INVALIDIf record type is invalid

◆ ifx_record_error_set_reason()

ifx_status_t ifx_record_error_set_reason ( ifx_record_handle_t * handle,
uint8_t error_reason )

Sets the error reason in the error record details for the given record handle.

Parameters
[out]handlePointer to the record handle obtained while creating the record.
[in]error_reasonError reason that defines the failure cause of the handover selector.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the set operation is successful
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_RECORD_INVALIDIf record type is invalid