hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
ifx-ndef-record.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 Infineon Technologies AG
2// SPDX-License-Identifier: MIT
3
8#ifndef IFX_NDEF_RECORD_H
9#define IFX_NDEF_RECORD_H
10
11#include <stddef.h>
12#include <stdint.h>
13#include "infineon/ifx-error.h"
14#include "infineon/ifx-utils.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* Macro definitions */
21/* Definitions of function identifiers */
22
26#define IFX_RECORD_SET UINT8_C(0x01)
27
31#define IFX_RECORD_GET UINT8_C(0x02)
32
36#define IFX_RECORD_REGISTER UINT8_C(0x03)
37
41#define IFX_RECORD_RETRIEVE UINT8_C(0x04)
42
46#define IFX_RECORD_DEREGISTER UINT8_C(0x05)
47
51#define IFX_RECORD_DATA_FIELD_NA UINT8_C(0xF1)
52
56#define IFX_RECORD_HEADER_MASK_SR_FLAG UINT8_C(0x10)
57
61#define IFX_RECORD_HEADER_MASK_ID_FLAG UINT8_C(0x08)
62
66#define IFX_RECORD_TNF_MASK UINT8_C(0x27)
67
71#define IFX_RECORD_TNF_TYPE_KNOWN UINT8_C(0x01)
72
76#define IFX_RECORD_TNF_TYPE_MEDIA UINT8_C(0x02)
77
81#define IFX_RECORD_TNF_TYPE_EXT UINT8_C(0x04)
82
83/* enum definitions */
84
98
102typedef struct
103{
104 uint8_t tnf;
105 uint8_t type_length;
106 uint32_t
108 uint8_t id_length;
109 uint8_t *type;
110 uint8_t *id;
111 uint8_t
114
115/* function prototype declarations */
116
125typedef ifx_status_t (*ifx_record_encoder_t)(const void *record_details,
126 uint8_t **payload,
127 uint32_t *payload_length);
128
137typedef ifx_status_t (*ifx_record_decoder_t)(const uint8_t *payload,
138 uint32_t payload_length,
139 void *record_details);
140
149typedef ifx_status_t (*ifx_record_deinit_t)(void *record_data);
150
151/* Structure definitions */
152
169
175
180typedef struct
181{
182 uint8_t *type;
183 uint32_t type_length;
187
188/* public functions */
189
200 const ifx_blob_t *record_id);
201
212 ifx_blob_t *record_id);
213
227ifx_status_t ifx_ndef_record_retrieve_handle(uint8_t tnf, const uint8_t *type,
228 uint32_t type_length,
229 ifx_record_handle_t *handle);
230
248
257
266
277 uint32_t number_of_records);
278
279#ifdef __cplusplus
280}
281
282#endif /* __cplusplus */
283#endif /* IFX_NDEF_RECORD_H */
Infineon specific error code creation and parsing.
uint32_t ifx_status_t
Custom return code type used by all Infineon host software libraries.
Definition ifx-error.h:91
ifx_status_t ifx_ndef_record_dispose(ifx_record_handle_t *record_handle)
This method will free-up the internally allocated memory of a record.
ifx_status_t(* ifx_record_decoder_t)(const uint8_t *payload, uint32_t payload_length, void *record_details)
Function prototype declaration for specific record decode operation.
ifx_status_t ifx_ndef_record_release_resource(void)
This method will free-up the internally allocated memory for ndef registered records.
ifx_status_t ifx_ndef_record_set_record_id(ifx_record_handle_t *handle, const ifx_blob_t *record_id)
Sets the record ID to the handle of record.
ifx_ndef_record_type
Defines list of available record types.
@ IFX_RECORD_TYPE_BT
@ IFX_RECORD_TYPE_URI
@ IFX_RECORD_MAX
@ IFX_RECORD_TYPE_ALT_CARRIER
@ IFX_RECORD_TYPE_BLE
@ IFX_RECORD_TYPE_ERROR
@ IFX_RECORD_TYPE_HANDOVER_SELECT
ifx_status_t ifx_ndef_record_get_record_id(const ifx_record_handle_t *handle, ifx_blob_t *record_id)
Gets the record ID from the handle of record.
ifx_status_t(* ifx_record_init_handler_t)(ifx_record_handle_t *handle)
Function prototype declarations that map to creation of new record handle APIs.
ifx_status_t ifx_ndef_record_retrieve_handle(uint8_t tnf, const uint8_t *type, uint32_t type_length, ifx_record_handle_t *handle)
Retrieves the record handle for the given type of record type information.
ifx_status_t ifx_ndef_record_register_handle(ifx_record_init_t *init_handler)
Register a new record service to the record init handler list based on the type data.
ifx_status_t(* ifx_record_encoder_t)(const void *record_details, uint8_t **payload, uint32_t *payload_length)
Function prototype declaration for specific record encode operation.
ifx_status_t(* ifx_record_deinit_t)(void *record_data)
Function prototype declaration for specific record's data release memory operation.
ifx_status_t ifx_ndef_record_dispose_list(ifx_record_handle_t *record_handles, uint32_t number_of_records)
This method will free-up the internally allocated memory for the list of records.
Provides utility functions and macros.
Data storage for data and data length where both are required as parameters.
Definition ifx-utils.h:189
Data storage for NDEF Records.
Defines the handle for specific record type.
ifx_record_deinit_t deinit_record
ifx_record_encoder_t encode_record
ifx_record_decoder_t decode_record
This Structure holds record's type information and function pointer which retrieves record handle bas...
ifx_record_init_handler_t get_handle