24#define LIB_PROTOCOL UINT8_C(0x20)
30#define IFX_PROTOCOL_ACTIVATE UINT8_C(0x01)
36#define IFX_PROTOCOL_TRANSMIT UINT8_C(0x02)
42#define IFX_PROTOCOL_RECEIVE UINT8_C(0x03)
47#define IFX_PROTOCOL_RECEIVE_LEN_UNKOWN SIZE_MAX
53#define IFX_PROTOCOL_LAYER_INITIALIZE UINT8_C(0x04)
59#define IFX_PROTOCOL_TRANSCEIVE UINT8_C(0x05)
65#define IFX_PROTOCOL_STACK_INVALID UINT8_C(0x01)
86 size_t *response_len);
104 size_t *response_len);
119 ifx_protocol_t *self,
const uint8_t *data,
size_t data_len,
120 uint8_t **response,
size_t *response_len);
139 size_t data_len, uint8_t **response,
140 size_t *response_len);
170 size_t *response_len);
Infineon specific error code creation and parsing.
uint32_t ifx_status_t
Custom return code type used by all Infineon host software libraries.
void(* ifx_protocol_destroy_callback_t)(ifx_protocol_t *self)
Protocol layer specific destructor.
ifx_status_t(* ifx_protocol_transmit_callback_t)(ifx_protocol_t *self, const uint8_t *data, size_t data_len)
Protocol layer specific transmit function.
ifx_status_t(* ifx_protocol_transceive_callback_t)(ifx_protocol_t *self, const uint8_t *data, size_t data_len, uint8_t **response, size_t *response_len)
Protocol layer specific transceive (send + receive) function.
ifx_status_t(* ifx_protocol_receive_callback_t)(ifx_protocol_t *self, size_t expected_len, uint8_t **response, size_t *response_len)
Protocol layer specific receive function.
ifx_status_t(* ifx_protocol_activate_callback_t)(ifx_protocol_t *self, uint8_t **response, size_t *response_len)
Protocol layer specific secure element activation function.
ifx_status_t ifx_protocol_layer_initialize(ifx_protocol_t *self)
Initializes Protocol object by setting all members to valid values.
Generic protocol struct for building ISO/OSI layer stack.
ifx_protocol_activate_callback_t _activate
Private protocol activation function for negotiating protocol specific parameters.
ifx_logger_t * _logger
Private member for optional Logger.
ifx_protocol_transceive_callback_t _transceive
Private function for sending and receiving data at once.
ifx_protocol_destroy_callback_t _destructor
Private destructor if further cleanup is necessary.
ifx_status_t ifx_protocol_activate(ifx_protocol_t *self, uint8_t **response, size_t *response_len)
Activates secure element and performs protocol negotiation.
ifx_protocol_receive_callback_t _receive
Private function for receiving data.
ifx_status_t ifx_protocol_transceive(ifx_protocol_t *self, const uint8_t *data, size_t data_len, uint8_t **response, size_t *response_len)
Sends data via Protocol and reads back response.
ifx_protocol_transmit_callback_t _transmit
Private function for sending data.
void * _properties
Private member for generic properties as void*.
ifx_protocol_t * _base
Private base layer in ISO/OSI stack.
void ifx_protocol_destroy(ifx_protocol_t *self)
Frees memory associated with Protocol object (but not object itself).
uint64_t _layer_id
Private layer identification to verify that correct protocol layer called member functions.
void ifx_protocol_set_logger(ifx_protocol_t *self, ifx_logger_t *logger)
Sets Logger to be used by Protocol.