386 #if defined(__cplusplus) 397 #if defined(_DLL) && defined(LBM_EXPORT_SYMS) 398 #define LBMPDMExpDLL __declspec(dllexport) 399 #elif defined(LBM_STATIC_LIB) 402 #define LBMPDMExpDLL __declspec(dllimport) 404 #elif defined(__TANDEM) 405 #if defined(LBM_EXPORT_SYMS) 406 #define LBMPDMExpDLL export$ 408 #define LBMPDMExpDLL import$ 415 #if !defined(DONT_TYPEDEF_INT_T) 416 typedef __int8 int8_t;
417 typedef __int16 int16_t;
418 typedef __int32 int32_t;
419 typedef __int64 int64_t;
421 typedef unsigned __int8 uint8_t;
422 typedef unsigned __int16 uint16_t;
423 typedef unsigned __int32 uint32_t;
424 typedef unsigned __int64 uint64_t;
427 #if (_MSC_VER < 1900) 431 #define PRId64 "I64d" 435 #define PRIu64 "I64u" 439 #define PRIx64 "I64x" 445 #define SCNd64 "I64d" 449 #define SCNu64 "I64u" 450 #define SCNx64 "I64x" 456 #include <inttypes.h> 478 #include <inttypes.h> 523 struct lbmpdm_msg_strct_t;
528 struct lbmpdm_defn_stct_t;
574 struct lbmpdm_iter_stct_t;
580 #define PDM_FALSE (uint8_t) 0 583 #define PDM_TRUE (uint8_t) 1 586 #define PDM_FIELD_INFO_FLAG_REQ 0x1 589 #define PDM_FIELD_INFO_FLAG_FIXED_STR_LEN 0x2 592 #define PDM_FIELD_INFO_FLAG_NUM_ARR_ELEM 0x4 595 #define PDM_MSG_FLAG_VAR_OR_OPT_FLDS_SET 0x1 598 #define PDM_MSG_FLAG_INCL_DEFN 0x2 601 #define PDM_MSG_FLAG_USE_MSG_DEFN_IF_NEEDED 0x4 604 #define PDM_MSG_FLAG_TRY_LOAD_DEFN_FROM_CACHE 0x8 607 #define PDM_MSG_FLAG_NEED_BYTE_SWAP 0x10 610 #define PDM_MSG_FLAG_DEL_DEFN_WHEN_REPLACED 0x20 613 #define PDM_MSG_VER_POLICY_EXACT 0 616 #define PDM_MSG_VER_POLICY_BEST 1 619 #define PDM_SUCCESS 0 622 #define PDM_FAILURE -1 625 #define PDM_ERR_FIELD_IS_NULL 1 628 #define PDM_ERR_NO_MORE_FIELDS 2 631 #define PDM_ERR_INSUFFICIENT_BUFFER_LENGTH 3 634 #define PDM_ERR_EINVAL 4 637 #define PDM_ERR_FIELD_NOT_FOUND 5 640 #define PDM_ERR_MSG_INVALID 6 643 #define PDM_ERR_DEFN_INVALID 7 646 #define PDM_ERR_NOMEM 8 649 #define PDM_ERR_REQ_FIELD_NOT_SET 9 652 #define PDM_ERR_CREATE_SECTION 10 655 #define PDM_ERR_CREATE_BUFFER 11 658 #define PDM_INTERNAL_TYPE_INVALID -1 661 #define PDM_TYPE_BOOLEAN 0 664 #define PDM_TYPE_INT8 1 667 #define PDM_TYPE_UINT8 2 670 #define PDM_TYPE_INT16 3 673 #define PDM_TYPE_UINT16 4 676 #define PDM_TYPE_INT32 5 679 #define PDM_TYPE_UINT32 6 682 #define PDM_TYPE_INT64 7 685 #define PDM_TYPE_UINT64 8 688 #define PDM_TYPE_FLOAT 9 691 #define PDM_TYPE_DOUBLE 10 694 #define PDM_TYPE_DECIMAL 11 697 #define PDM_TYPE_TIMESTAMP 12 700 #define PDM_TYPE_FIX_STRING 13 703 #define PDM_TYPE_STRING 14 706 #define PDM_TYPE_FIX_UNICODE 15 709 #define PDM_TYPE_UNICODE 16 712 #define PDM_TYPE_BLOB 17 715 #define PDM_TYPE_MESSAGE 18 718 #define PDM_TYPE_BOOLEAN_ARR 19 721 #define PDM_TYPE_INT8_ARR 20 724 #define PDM_TYPE_UINT8_ARR 21 727 #define PDM_TYPE_INT16_ARR 22 730 #define PDM_TYPE_UINT16_ARR 23 733 #define PDM_TYPE_INT32_ARR 24 736 #define PDM_TYPE_UINT32_ARR 25 739 #define PDM_TYPE_INT64_ARR 26 742 #define PDM_TYPE_UINT64_ARR 27 745 #define PDM_TYPE_FLOAT_ARR 28 748 #define PDM_TYPE_DOUBLE_ARR 29 751 #define PDM_TYPE_DECIMAL_ARR 30 754 #define PDM_TYPE_TIMESTAMP_ARR 31 757 #define PDM_TYPE_FIX_STRING_ARR 32 760 #define PDM_TYPE_STRING_ARR 33 763 #define PDM_TYPE_FIX_UNICODE_ARR 34 766 #define PDM_TYPE_UNICODE_ARR 35 769 #define PDM_TYPE_BLOB_ARR 36 772 #define PDM_TYPE_MESSAGE_ARR 37 775 #define PDM_DEFN_STR_FIELD_NAMES 0 778 #define PDM_DEFN_INT_FIELD_NAMES 1 781 #define PDM_ITER_INVALID_FIELD_HANDLE -1 1272 #if defined(__cplusplus) LBMPDMExpDLL int8_t lbmpdm_defn_get_msg_vers_major(lbmpdm_defn_t *defn)
Gets the message major version number from the definition.
LBMPDMExpDLL int32_t lbmpdm_defn_get_field_info_int_name(lbmpdm_defn_t *defn, lbmpdm_field_handle_t handle)
Gets the integer field name from a given definition's field handle.
uint32_t num_arr_elem
Definition: lbmpdm.h:543
LBMPDMExpDLL int lbmpdm_iter_create(lbmpdm_iter_t **iter, lbmpdm_msg_t *message)
Creates a pdm iterator to iterate through the fields in a message.
LBMPDMExpDLL int8_t lbmpdm_defn_get_msg_vers_minor(lbmpdm_defn_t *defn)
Gets the message minor version number from the definition.
LBMPDMExpDLL const char * lbmpdm_errmsg()
Return an ASCII string containing the error message last encountered by this thread.
LBMPDMExpDLL int lbmpdm_iter_get_current_field_value_vec(lbmpdm_iter_t *iter, void *value, size_t len[], size_t *num_arr_elem)
Gets an array of field values from the iterator's current field.
int32_t lbmpdm_field_handle_t
Type representing a handle to a message field. Field handles are returned when adding a field to a de...
Definition: lbmpdm.h:493
LBMPDMExpDLL int lbmpdm_iter_set_msg(lbmpdm_iter_t *iter, lbmpdm_msg_t *message)
Sets the message used to step through by this iterator.
LBMPDMExpDLL int lbmpdm_defn_create(lbmpdm_defn_t **defn, int32_t num_fields, int32_t id, int8_t vrs_mjr, int8_t vrs_mnr, uint8_t field_names_type)
Create a definition, with the passed number of fields. The num_fields is required to be at least 1...
uint32_t fixed_str_len
Definition: lbmpdm.h:541
LBMPDMExpDLL uint8_t lbmpdm_iter_is_current_set(lbmpdm_iter_t *iter)
Checks to see if the current field is set.
LBMPDMExpDLL int lbmpdm_msg_and_defn_delete(lbmpdm_msg_t *message)
Delete an lbmpdm_msg_t object and all associated resources (including the defn) This deletes a previo...
LBMPDMExpDLL int lbmpdm_msg_remove_field_value(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle)
Removes a field value from a message (marking it unset)
LBMPDMExpDLL int32_t lbmpdm_defn_get_id(lbmpdm_defn_t *defn)
Gets the id of the definition.
LBMPDMExpDLL int lbmpdm_msg_delete(lbmpdm_msg_t *message)
Delete an lbmpdm_msg_t object and all associated resources (except the defn) This deletes a previousl...
uint32_t num_arr_elem
Definition: lbmpdm.h:564
LBMPDMExpDLL uint8_t lbmpdm_msg_is_field_set(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle)
Gets whether or not the field value has been set.
LBMPDMExpDLL int lbmpdm_field_value_stct_delete(lbmpdm_field_value_t *field_value)
Deletes the allocated resources inside the field value struct. This does NOT free the actual field va...
LBMPDMExpDLL int lbmpdm_defn_deserialize(lbmpdm_defn_t *defn, const char *bufptr, uint32_t buflen, uint8_t swap_bytes)
Deserialize the associated buffer into a newly created defn.
LBMPDMExpDLL uint8_t lbmpdm_defn_get_field_names_type(lbmpdm_defn_t *defn)
Gets the field names type (either PDM_DEFN_STR_FIELD_NAMES or PDM_DEFN_INT_FIELD_NAMES) from the defi...
LBMPDMExpDLL int lbmpdm_iter_first(lbmpdm_iter_t *iter)
Sets the iterator back to the first field.
LBMPDMExpDLL int lbmpdm_msg_create(lbmpdm_msg_t **message, lbmpdm_defn_t *defn, uint32_t flags)
creates a message with the specified definition
LBMPDMExpDLL lbmpdm_defn_t * lbmpdm_msg_get_defn(const lbmpdm_msg_t *message)
Gets a pointer to the message definition.
Attribute struct to be passed along with the name when adding field info to a definition.
Definition: lbmpdm.h:536
struct lbmpdm_defn_stct_t lbmpdm_defn_t
Structure to hold a pdm definition.
Definition: lbmpdm.h:531
struct lbmpdm_msg_stct_t lbmpdm_msg_t
Structure to hold a pdm message.
Definition: lbmpdm.h:526
LBMPDMExpDLL int lbmpdm_msg_get_field_value_vec(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle, void *value, size_t len[], size_t *num_arr_elem)
Gets an array of field values from the message.
LBMPDMExpDLL uint8_t lbmpdm_iter_has_next(lbmpdm_iter_t *iter)
Checks to see if the iterator has another field to step to.
LBMPDMExpDLL uint8_t lbmpdm_defn_is_finalized(lbmpdm_defn_t *defn)
Gets whether or not the definition has been finalized (either PDM_TRUE or PDM_FALSE).
LBMPDMExpDLL uint32_t lbmpdm_defn_get_length(lbmpdm_defn_t *defn)
Gets the exact length of the serialized defn. This can be used to allocate a buffer of the exact leng...
LBMPDMExpDLL lbmpdm_field_handle_t lbmpdm_defn_get_field_handle_by_int_name(lbmpdm_defn_t *defn, int32_t int_name)
Retrieve a field handle from a definition via name.
LBMPDMExpDLL int lbmpdm_msg_unset_incl_defn_flag(lbmpdm_msg_t *message)
Unsets the message include definition flag.
LBMPDMExpDLL char * lbmpdm_msg_get_data(lbmpdm_msg_t *message)
Serialize a message to a buffer and return the buffer. The message that is passed in is serialized in...
LBMPDMExpDLL int lbmpdm_cache_struct_find(lbmpdm_defn_t **defn, int32_t id)
find a given definition structure by id and return the structure for it. Returns PDM_FAILURE for noth...
LBMPDMExpDLL int lbmpdm_msg_serialize(lbmpdm_msg_t *message, char *buffer)
Serialize a message to a buffer. The message that is passed in is serialized into the caller's suppli...
int32_t tv_usecs
Definition: lbmpdm.h:520
LBMPDMExpDLL int lbmpdm_msg_deserialize(lbmpdm_msg_t *message, const char *bufptr, uint32_t buflen)
Deserialize the associated buffer into a newly created message.
LBMPDMExpDLL lbmpdm_field_handle_t lbmpdm_defn_add_field_info_by_str_name(lbmpdm_defn_t *defn, const char *str_name, int16_t type, lbmpdm_field_info_attr_t *info_attr)
adds field info to the definition by string name
LBMPDMExpDLL lbmpdm_field_handle_t lbmpdm_iter_get_current(lbmpdm_iter_t *iter)
Gets the current field handle from the iterator.
LBMPDMExpDLL int lbmpdm_defn_finalize(lbmpdm_defn_t *defn)
make this definition final. This needs to be done before using it in a message.
LBMPDMExpDLL int32_t lbmpdm_defn_get_num_fields(lbmpdm_defn_t *defn)
Gets the number of fields in the definition.
LBMPDMExpDLL int lbmpdm_msg_set_field_value_vec(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle, void *value, size_t len[], size_t num_arr_elem)
Sets an array of field values in a message.
size_t len
Definition: lbmpdm.h:560
LBMPDMExpDLL uint32_t lbmpdm_msg_get_length(const lbmpdm_msg_t *message)
Gets the exact length of the serialized message. This can be used to allocate a buffer of the exact l...
LBMPDMExpDLL int lbmpdm_msg_get_field_value_stct(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle, lbmpdm_field_value_t *field_value)
Populates a field value struct with the value from the message.
int8_t exp
Definition: lbmpdm.h:507
LBMPDMExpDLL int lbmpdm_cache_struct_remove_by_version(int32_t id, uint8_t vers_major, uint8_t vers_minor)
delete a definition structure from the cache by its id and version. Does not error if the structure d...
LBMPDMExpDLL const char * lbmpdm_defn_get_field_info_str_name(lbmpdm_defn_t *defn, lbmpdm_field_handle_t handle)
Gets the string field name from a given definition's field handle.
LBMPDMExpDLL int lbmpdm_msg_get_field_value(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle, void *value, size_t *len)
Gets a field value from the message.
LBMPDMExpDLL lbmpdm_field_handle_t lbmpdm_defn_get_field_handle_by_str_name(lbmpdm_defn_t *defn, const char *str_name)
Retrieve a field handle from a definition via name.
char * value
Definition: lbmpdm.h:562
LBMPDMExpDLL int lbmpdm_iter_create_from_field_handle(lbmpdm_iter_t **iter, lbmpdm_msg_t *message, lbmpdm_field_handle_t field_handle)
Creates a pdm iterator to iterate through the fields in a message starting at a particular field...
Structure to hold a timestamp value.
Definition: lbmpdm.h:516
LBMPDMExpDLL int lbmpdm_iter_next(lbmpdm_iter_t *iter)
Steps the iterator to the next first field.
char ** value_arr
Definition: lbmpdm.h:568
LBMPDMExpDLL int lbmpdm_errnum()
Return the error number last encountered by this thread.
LBMPDMExpDLL int lbmpdm_defn_serialize(lbmpdm_defn_t *defn, char *buffer, uint32_t *defn_len)
Serialize a defn to a buffer. In normal usage this is not needed as the defn is either known in advan...
LBMPDMExpDLL int lbmpdm_cache_struct_add(lbmpdm_defn_t *defn)
add a definition structure to the cache. It is assumed that the structure has a unique id...
LBMPDMExpDLL int lbmpdm_cache_clear_all()
nuke the whole cache, this deletes all the structures within the cache as well.
LBMPDMExpDLL int lbmpdm_iter_set_current_field_value_vec(lbmpdm_iter_t *iter, void *value, size_t len[], size_t num_arr_elem)
Sets the current field values to the passed array of values.
LBMPDMExpDLL int lbmpdm_cache_struct_remove(int32_t id)
delete a definition structure from the cache. Does not error if the structure doesn't exist...
LBMPDMExpDLL int16_t lbmpdm_defn_get_field_info_type(lbmpdm_defn_t *defn, lbmpdm_field_handle_t handle)
Gets the PDM field type from a given definition's field handle.
LBMPDMExpDLL int lbmpdm_msg_set_field_value(lbmpdm_msg_t *message, lbmpdm_field_handle_t handle, void *value, size_t len)
Sets a field value in a message.
LBMPDMExpDLL lbmpdm_field_handle_t lbmpdm_defn_add_field_info_by_int_name(lbmpdm_defn_t *defn, int32_t int_name, int16_t type, lbmpdm_field_info_attr_t *info_attr)
adds field info to the definition by integer name
LBMPDMExpDLL int lbmpdm_iter_get_current_field_value(lbmpdm_iter_t *iter, void *value, size_t *len)
Gets a field value from the iterator's current field.
LBMPDMExpDLL int lbmpdm_defn_delete(lbmpdm_defn_t *defn)
delete a given definition.
int32_t tv_secs
Definition: lbmpdm.h:518
LBMPDMExpDLL int lbmpdm_msg_set_incl_defn_flag(lbmpdm_msg_t *message)
Sets the message include definition flag.
uint16_t field_type
Definition: lbmpdm.h:554
LBMPDMExpDLL int lbmpdm_iter_set_current_field_value(lbmpdm_iter_t *iter, void *value, size_t len)
Sets the current field value to the value passed in.
size_t * len_arr
Definition: lbmpdm.h:566
LBMPDMExpDLL int lbmpdm_cache_struct_find_by_version(lbmpdm_defn_t **defn, int32_t id, uint8_t vers_major, uint8_t vers_minor)
find a given definition structure by id, major version, and minor version and return the structure fo...
LBMPDMExpDLL int lbmpdm_cache_init(uint32_t cache_size)
initialize the cache for a given number of buckets. If 0 is given the the cache will default...
LBMPDMExpDLL int lbmpdm_iter_delete(lbmpdm_iter_t *iter)
Deletes the iterator.
uint8_t is_fixed
Definition: lbmpdm.h:558
int64_t mant
Definition: lbmpdm.h:505
uint8_t is_array
Definition: lbmpdm.h:556
Structure to hold a scaled decimal number. A scaled decimal number consists of a mantissa and an exp...
Definition: lbmpdm.h:503
struct lbmpdm_iter_stct_t lbmpdm_iter_t
Iterator structure that is used to traverse the fields of a message.
Definition: lbmpdm.h:577
#define LBMPDMExpDLL
PDM API function return codes.
Definition: lbmpdm.h:411
uint8_t req
Definition: lbmpdm.h:539
Field value struct that can be populated with a field value when passed to the lbmpdm_msg_get_field_v...
Definition: lbmpdm.h:552