12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103 |
- #ifndef BLE_SERIALIZATION_H__
- #define BLE_SERIALIZATION_H__
- #include "nordic_common.h"
- #include "nrf_error.h"
- #include <stdint.h>
- #include <stddef.h>
- #include "cond_field_serialization.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum
- {
- SER_PKT_TYPE_CMD = 0,
- SER_PKT_TYPE_RESP,
- SER_PKT_TYPE_EVT,
- SER_PKT_TYPE_DTM_CMD,
- SER_PKT_TYPE_DTM_RESP,
- SER_PKT_TYPE_GENERIC_CMD,
- #if defined(ANT_STACK_SUPPORT_REQD)
- SER_PKT_TYPE_ANT_CMD,
- SER_PKT_TYPE_ANT_RESP,
- SER_PKT_TYPE_ANT_EVT,
- #endif
- SER_PKT_TYPE_MAX
- } ser_pkt_type_t;
- typedef enum
- {
- SER_GENERIC_CMD_RESET,
- SER_GENERIC_CMD_SOFT_RESET
- } ser_generic_cmd_t;
- #define LOW16(a) ((uint16_t)((a & 0x0000FFFF) >> 0))
- #define HIGH16(a) ((uint16_t)((a & 0xFFFF0000) >> 16))
- #define SER_ERR_CODE_SIZE 4
- #define SER_PKT_TYPE_SIZE 1
- #define SER_OP_CODE_SIZE 1
- #define SER_PKT_TYPE_POS 0
- #define SER_PKT_OP_CODE_POS (SER_PKT_TYPE_SIZE)
- #define SER_PKT_DATA_POS (SER_PKT_TYPE_SIZE + SER_OP_CODE_SIZE)
- #define SER_CMD_OP_CODE_POS 0
- #define SER_CMD_DATA_POS (SER_OP_CODE_SIZE)
- #define SER_CMD_HEADER_SIZE (SER_OP_CODE_SIZE)
- #define SER_CMD_RSP_HEADER_SIZE (SER_OP_CODE_SIZE + SER_ERR_CODE_SIZE)
- #define SER_CMD_RSP_STATUS_CODE_POS (SER_OP_CODE_SIZE)
- #define SER_EVT_ID_SIZE 2
- #define SER_EVT_ID_POS 0
- #define SER_EVT_HEADER_SIZE (SER_EVT_ID_SIZE)
- #define SER_EVT_CONN_HANDLE_SIZE 2
- #if defined(ANT_STACK_SUPPORT_REQD)
- #define SER_ANT_EVT_ID_SIZE 2
- #define SER_ANT_EVT_ID_POS 0
- #define SER_ANT_EVT_HEADER_SIZE (SER_ANT_EVT_ID_SIZE)
- #endif
- #define SER_DTM_CMD_OP_CODE_POS 0
- #define SER_DTM_CMD_DATA_POS 1
- #define SER_DTM_RESP_OP_CODE_POS 1
- #define SER_DTM_RESP_STATUS_POS 2
- #define SER_FIELD_PRESENT 0x01
- #define SER_FIELD_NOT_PRESENT 0x00
- #define SER_ASSERTS_ENABLED 1
- #define SER_ERROR_CHECK(expr, error_code) do { if (!(expr)) return (error_code); } while (0)
- #ifdef SER_ASSERTS_ENABLED
- #define SER_ASSERT(expr, error_code) SER_ERROR_CHECK(expr, error_code)
- #define SER_ASSERT_VOID_RETURN(expr) do { if (!(expr)) return; } while (0)
- #define SER_ASSERT_LENGTH_LEQ(len, maxlen) \
- SER_ASSERT((len) <= (maxlen), NRF_ERROR_INVALID_LENGTH)
- #define SER_ASSERT_LENGTH_EQ(actual_len, expected_len) \
- SER_ASSERT((actual_len) == (expected_len), NRF_ERROR_INVALID_LENGTH)
- #define SER_ASSERT_NOT_NULL(ptr) SER_ASSERT((ptr) != NULL, NRF_ERROR_NULL)
- #else
- #define SER_ASSERT(expr, error_code)
- #define SER_ASSERT_VOID_RETURN(expr)
- #define SER_ASSERT_LENGTH_LEQ(len, maxlen) UNUSED_VARIABLE(maxlen)
- #define SER_ASSERT_LENGTH_EQ(actual_len, expected_len)
- #define SER_ASSERT_NOT_NULL(ptr)
- #endif
- #if defined(BLE_GATT_MTU_SIZE_DEFAULT) && !defined(GATT_MTU_SIZE_DEFAULT)
- #define GATT_MTU_SIZE_DEFAULT BLE_GATT_MTU_SIZE_DEFAULT
- #endif
- #define BLE_GATTC_HANDLE_COUNT_LEN_MAX ((GATT_MTU_SIZE_DEFAULT - 1) / 2)
- #define SUB1(X) (((X)>0) ? ((X)-1) : (X))
- static inline void static_force_impl_castable_p_void(void const * const p) {}
- #define STATIC_FORCE_PP(PP) static_force_impl_castable_p_void(*(PP))
- typedef uint32_t (*field_ext_decoder_handler_t)(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint32_t * const p_ext_length,
- void * p_field);
- #define SER_PUSH_uint8(P_VAR) do { \
- err_code = uint8_t_enc((P_VAR), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_uint16(P_VAR) do { \
- err_code = uint16_t_enc((P_VAR), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_uint32(P_VAR) do { \
- err_code = uint32_t_enc((P_VAR), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_int8(P_VAR) SER_PUSH_uint8(P_VAR)
- #define SER_PUSH_int16(P_VAR) SER_PUSH_uint16(P_VAR)
- #define SER_PUSH_int32(P_VAR) SER_PUSH_uint32(P_VAR)
- #define SER_PUSH_uint8array(P_DATA, LEN) do { \
- err_code = uint8_vector_enc((P_DATA), (LEN), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_len8data(P_DATA, LEN) do { \
- err_code = len8data_enc((P_DATA), (LEN), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_len16data(P_DATA, LEN) do { \
- err_code = len16data_enc((P_DATA), (LEN), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_len16data16(P_DATA, LEN) do { \
- err_code = count16_cond_data16_enc((P_DATA), (LEN), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_buf(P_DATA, LEN) do { \
- err_code = buf_enc((P_DATA), (LEN), p_buf, buf_len, p_index); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_FIELD(P_VAR, P_ENCODER) do { \
- err_code = field_enc((P_VAR), p_buf, buf_len, p_index, (P_ENCODER)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PUSH_FIELD_ARRAY(P_ARRAY, P_ENCODER, COUNT) do { \
- for (uint32_t _idx = 0; _idx < (COUNT); ++_idx) \
- { \
- SER_PUSH_FIELD(&((P_ARRAY)[_idx]),P_ENCODER);\
- } \
- } while (0)
- #define SER_PUSH_COND(P_VAR, P_ENCODER) do { \
- err_code = cond_field_enc((P_VAR), p_buf, buf_len, p_index, (P_ENCODER)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_uint8(P_VAR) do { \
- err_code = uint8_t_dec(p_buf, packet_len, p_index, (P_VAR)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_uint16(P_VAR) do { \
- err_code = uint16_t_dec(p_buf, packet_len, p_index, (P_VAR)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_uint32(P_VAR) do { \
- err_code = uint32_t_dec(p_buf, packet_len, p_index, (P_VAR)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_int8(P_VAR) SER_PULL_uint8(P_VAR)
- #define SER_PULL_int16(P_VAR) SER_PULL_uint16(P_VAR)
- #define SER_PULL_int32(P_VAR) SER_PULL_uint32(P_VAR)
- #define SER_PULL_uint8array(P_DATA, LEN) do { \
- err_code = uint8_vector_dec(p_buf, packet_len, p_index, (P_DATA), (LEN)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_len8data(PP_DATA, LEN) do { \
- STATIC_FORCE_PP(PP_DATA); \
- err_code = len8data_dec(p_buf, packet_len, p_index, (PP_DATA), (LEN)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_len16data(PP_DATA, P_LEN) do { \
- STATIC_FORCE_PP(PP_DATA); \
- err_code = len16data_dec(p_buf, packet_len, p_index, (PP_DATA), (P_LEN)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_len16data16(PP_DATA, P_LEN) do { \
- STATIC_FORCE_PP(PP_DATA); \
- err_code = count16_cond_data16_dec(p_buf, packet_len, p_index, (PP_DATA), (P_LEN)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_buf(PP_DATA, OUT_BUF_LEN, LEN) do { \
- STATIC_FORCE_PP(PP_DATA); \
- err_code = buf_dec(p_buf, packet_len, p_index, (PP_DATA), (OUT_BUF_LEN), (LEN)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_FIELD(P_VAR, P_DECODER) do { \
- err_code = field_dec(p_buf, packet_len, p_index, (P_VAR), (P_DECODER)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_PULL_FIELD_ARRAY(P_ARRAY, P_DECODER, COUNT) do { \
- for (uint32_t _idx = 0; _idx < (COUNT); ++_idx) \
- { \
- SER_PULL_FIELD(&((P_ARRAY)[_idx]),P_DECODER); \
- } \
- } while (0)
- #define SER_PULL_COND(PP_VAR, P_DECODER) do { \
- STATIC_FORCE_PP(PP_VAR); \
- err_code = cond_field_dec(p_buf, packet_len, p_index, (void * *)(PP_VAR), (P_DECODER)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- } while (0)
- #define SER_STRUCT_ENC_BEGIN(STRUCT_TYPE) \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_index); \
- SER_ASSERT_NOT_NULL(p_void_struct); \
- STRUCT_TYPE * p_struct = (STRUCT_TYPE *) p_void_struct; \
- uint32_t err_code = NRF_SUCCESS
- #define SER_STRUCT_ENC_END return err_code
- #define SER_STRUCT_DEC_BEGIN(STRUCT_TYPE) \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_index); \
- SER_ASSERT_NOT_NULL(p_void_struct); \
- STRUCT_TYPE * p_struct = (STRUCT_TYPE *) p_void_struct; \
- uint32_t err_code = NRF_SUCCESS; \
- uint32_t packet_len = buf_len
- #define SER_STRUCT_DEC_END return err_code
- #define SER_REQ_ENC_BEGIN(OPCODE) \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_buf_len); \
- \
- uint32_t index = 0; \
- uint32_t * const p_index = &index; \
- uint32_t err_code = NRF_SUCCESS; \
- uint32_t buf_len = *p_buf_len; \
- \
- uint8_t opcode = (OPCODE); \
- SER_PUSH_uint8(&opcode)
- #define SER_REQ_ENC_END \
- *p_buf_len = index; \
- return NRF_SUCCESS \
- #define SER_RSP_DEC_RESULT_ONLY(OPCODE) \
- return ser_ble_cmd_rsp_dec(p_buf, packet_len, (OPCODE), p_result_code)
- #define SER_RSP_DEC_BEGIN(OPCODE) \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_result_code); \
- uint32_t err_code = NRF_SUCCESS; \
- uint32_t index = 0; \
- uint32_t * const p_index = &index; \
-
- \
- err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, (OPCODE), p_result_code); \
- \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- if (*p_result_code != NRF_SUCCESS) \
- { \
- SER_ASSERT_LENGTH_EQ(index, packet_len); \
- return NRF_SUCCESS; \
- }
- #define SER_RSP_DEC_END \
- \
- SER_ASSERT_LENGTH_EQ(index, packet_len); \
- return err_code
- #define SER_REQ_DEC_BEGIN(OPCODE) \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT(packet_len>0, NRF_ERROR_INVALID_PARAM); \
- uint32_t index = 0; \
- uint32_t * const p_index = &index; \
- uint32_t err_code = NRF_SUCCESS; \
- SER_ASSERT(p_buf[index] == (OPCODE), NRF_ERROR_INVALID_PARAM); \
- (void)err_code; \
- (void)p_index; \
- ++index
- #define SER_REQ_DEC_END \
- SER_ASSERT_LENGTH_EQ(index, packet_len); \
- return NRF_SUCCESS
- #define SER_RSP_ENC_BEGIN(OPCODE) \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_buf_len); \
- uint32_t index = 0; \
- uint32_t * const p_index = &index; \
- uint32_t err_code = NRF_SUCCESS; \
- uint32_t buf_len = *p_buf_len; \
-
- \
- uint8_t opcode = (OPCODE); \
- SER_PUSH_uint8(&opcode); \
- SER_PUSH_uint32(&return_code); \
- \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- if (return_code != NRF_SUCCESS) \
- { \
- SER_RSP_ENC_END; \
- }
- #define SER_RSP_ENC_RESULT_ONLY(OPCODE) \
- return ser_ble_cmd_rsp_status_code_enc((OPCODE), return_code, p_buf, p_buf_len)
- #define SER_RSP_ENC_END \
- *p_buf_len = index; \
- return NRF_SUCCESS
- #define SER_EVT_ENC_BEGIN(EVT_HEADER) \
- SER_ASSERT_NOT_NULL(p_event); \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_buf_len); \
- SER_ASSERT(p_event->header.evt_id == (EVT_HEADER), NRF_ERROR_INVALID_PARAM); \
- uint32_t index = 0; \
- uint32_t * p_index = &index; \
- uint32_t buf_len = *p_buf_len; \
- uint32_t err_code = NRF_SUCCESS; \
- uint16_t evt_header = (EVT_HEADER); \
- \
- SER_PUSH_uint16(&evt_header)
- #define SER_EVT_ENC_END \
- *p_buf_len = index; \
- return err_code
- #define SER_EVT_DEC_BEGIN(EVT_CODE, EVT_GROUP, EVT_NAME) \
- uint32_t err_code = NRF_SUCCESS; \
- uint32_t index = 0; \
- uint32_t * p_index = &index; \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_event_len); \
- \
- \
- \
- uint32_t evt_struct_len = \
- offsetof(ble_evt_t, evt.EVT_GROUP##_evt.params) \
- - offsetof(ble_evt_t, evt) \
- + sizeof(ble_##EVT_GROUP##_evt_##EVT_NAME##_t); \
- SER_ASSERT_LENGTH_LEQ(evt_struct_len, *p_event_len); \
- *p_event_len -= evt_struct_len; \
- \
- \
- uint32_t evt_extended_len = 0; \
- (void) evt_extended_len; \
- p_event->header.evt_id = EVT_CODE
- #define SER_EVT_DEC_BEGIN_NO_STRUCT(EVT_CODE, EVT_GROUP) \
- uint32_t err_code = NRF_SUCCESS; \
- uint32_t index = 0; \
- uint32_t * p_index = &index; \
- SER_ASSERT_NOT_NULL(p_buf); \
- SER_ASSERT_NOT_NULL(p_event_len); \
- \
- \
- \
- uint32_t evt_struct_len = \
- offsetof(ble_evt_t, evt.EVT_GROUP##_evt.params) \
- - offsetof(ble_evt_t, evt) ; \
- SER_ASSERT_LENGTH_LEQ(evt_struct_len, *p_event_len); \
- *p_event_len -= evt_struct_len; \
- \
- \
- uint32_t evt_extended_len = 0; \
- (void) evt_extended_len; \
- p_event->header.evt_id = EVT_CODE
- #define SER_EVT_DEC_END \
- SER_ASSERT_LENGTH_EQ(index, packet_len); \
- \
- \
- *p_event_len = evt_struct_len + evt_extended_len; \
- return NRF_SUCCESS
- #define SER_PULL_FIELD_EXTENDED(P_VAR, P_DECODER) \
- do \
- { \
- uint32_t field_ext_len = *p_event_len; \
- err_code = field_ext_dec(p_buf, packet_len, p_index, &field_ext_len, (P_VAR), (P_DECODER)); \
- SER_ASSERT(err_code == NRF_SUCCESS, err_code); \
- *p_event_len -= field_ext_len; \
- evt_extended_len += field_ext_len; \
- } while (0) \
- uint32_t ser_ble_cmd_rsp_status_code_enc(uint8_t op_code,
- uint32_t command_status,
- uint8_t * const p_buf,
- uint32_t * const p_buf_len);
- uint32_t ser_ble_cmd_rsp_result_code_dec(uint8_t const * const p_buf,
- uint32_t * const p_pos,
- uint32_t packet_len,
- uint8_t op_code,
- uint32_t * const p_result_code);
- uint32_t ser_ble_cmd_rsp_dec(uint8_t const * const p_buf,
- uint32_t packet_len,
- uint8_t op_code,
- uint32_t * const p_result_code);
- static inline uint32_t field_enc(void const * const p_field,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- field_encoder_handler_t fp_field_encoder)
- {
- SER_ASSERT_NOT_NULL(fp_field_encoder);
- SER_ASSERT_NOT_NULL(p_field);
- return fp_field_encoder(p_field, p_buf, buf_len, p_index);
- }
- static inline uint32_t field_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- void * const p_field,
- field_decoder_handler_t fp_field_decoder)
- {
- SER_ASSERT_NOT_NULL(fp_field_decoder);
- SER_ASSERT_NOT_NULL(p_field);
- return fp_field_decoder(p_buf, buf_len, p_index, p_field);
- }
- static inline uint32_t field_ext_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint32_t * const p_ext_length,
- void * const p_field,
- field_ext_decoder_handler_t fp_field_decoder)
- {
- SER_ASSERT_NOT_NULL(fp_field_decoder);
- SER_ASSERT_NOT_NULL(p_field);
- return fp_field_decoder(p_buf, buf_len, p_index, p_ext_length, p_field);
- }
- uint32_t uint16_t_enc(const void * const p_field,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t uint16_t_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- void * p_field);
- void uint16_dec(uint8_t const * const p_buf,
- uint32_t packet_len,
- uint32_t * const index,
- uint16_t * const value);
- uint32_t uint8_t_enc(const void * const p_field,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t uint8_t_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- void * p_field);
- void uint8_dec(uint8_t const * const p_buf,
- uint32_t packet_len,
- uint32_t * const index,
- uint8_t * const value);
- void int8_dec(uint8_t const * const p_buf,
- uint32_t packet_len,
- uint32_t * const index,
- int8_t * const value);
- uint32_t len8data_enc(uint8_t const * const p_data,
- uint8_t const dlen,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t len8data_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint8_t * * const pp_data,
- uint8_t * const p_len);
- uint32_t len16data_enc(uint8_t const * const p_data,
- uint16_t const dlen,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t len16data_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint8_t * * const pp_data,
- uint16_t * const p_dlen);
- uint32_t count16_cond_data16_enc(uint16_t const * const p_data,
- uint16_t const count,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t count16_cond_data16_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint16_t * * const pp_data,
- uint16_t * const p_count);
- uint32_t cond_len16_cond_data_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint8_t * * const pp_data,
- uint16_t * * const pp_len);
- uint32_t op_status_enc(uint8_t op_code,
- uint32_t return_code,
- uint8_t * const p_buff,
- uint32_t * const p_buff_len,
- uint32_t * const p_index);
- uint32_t op_status_cond_uint16_enc(uint8_t op_code,
- uint32_t return_code,
- uint16_t value,
- uint8_t * const p_buff,
- uint32_t * const p_buff_len,
- uint32_t * const p_index);
- uint32_t buf_enc(uint8_t const * const p_data,
- uint16_t const dlen,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t buf_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint8_t * * const pp_data,
- uint16_t data_len,
- uint16_t dlen);
- uint32_t uint32_t_enc(void const * const p_field,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t uint32_t_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- void * p_field);
- uint32_t uint8_vector_enc(uint8_t const * const p_data,
- uint16_t const dlen,
- uint8_t * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index);
- uint32_t uint8_vector_dec(uint8_t const * const p_buf,
- uint32_t buf_len,
- uint32_t * const p_index,
- uint8_t * const p_data,
- uint16_t dlen);
- #ifdef __cplusplus
- }
- #endif
- #endif
|