376 #if defined(__cplusplus) 387 #if defined(_DLL) && defined(LBM_EXPORT_SYMS) 388 #define LBMPDMExpDLL __declspec(dllexport) 389 #elif defined(LBM_STATIC_LIB) 392 #define LBMPDMExpDLL __declspec(dllimport) 394 #elif defined(__TANDEM) 395 #if defined(LBM_EXPORT_SYMS) 396 #define LBMPDMExpDLL export$ 398 #define LBMPDMExpDLL import$ 405 #if !defined(DONT_TYPEDEF_INT_T) 406 typedef __int8 int8_t;
407 typedef __int16 int16_t;
408 typedef __int32 int32_t;
409 typedef __int64 int64_t;
411 typedef unsigned __int8 uint8_t;
412 typedef unsigned __int16 uint16_t;
413 typedef unsigned __int32 uint32_t;
414 typedef unsigned __int64 uint64_t;
420 #define PRId64 "I64d" 424 #define PRIu64 "I64u" 428 #define PRIx64 "I64x" 434 #define SCNd64 "I64d" 438 #define SCNu64 "I64u" 439 #define SCNx64 "I64x" 442 #include <inttypes.h> 464 #include <inttypes.h> 509 struct lbmpdm_msg_strct_t;
514 struct lbmpdm_defn_stct_t;
560 struct lbmpdm_iter_stct_t;
566 #define PDM_FALSE (uint8_t) 0 569 #define PDM_TRUE (uint8_t) 1 572 #define PDM_FIELD_INFO_FLAG_REQ 0x1 575 #define PDM_FIELD_INFO_FLAG_FIXED_STR_LEN 0x2 578 #define PDM_FIELD_INFO_FLAG_NUM_ARR_ELEM 0x4 581 #define PDM_MSG_FLAG_VAR_OR_OPT_FLDS_SET 0x1 584 #define PDM_MSG_FLAG_INCL_DEFN 0x2 587 #define PDM_MSG_FLAG_USE_MSG_DEFN_IF_NEEDED 0x4 590 #define PDM_MSG_FLAG_TRY_LOAD_DEFN_FROM_CACHE 0x8 593 #define PDM_MSG_FLAG_NEED_BYTE_SWAP 0x10 596 #define PDM_MSG_FLAG_DEL_DEFN_WHEN_REPLACED 0x20 599 #define PDM_MSG_VER_POLICY_EXACT 0 602 #define PDM_MSG_VER_POLICY_BEST 1 605 #define PDM_SUCCESS 0 608 #define PDM_FAILURE -1 611 #define PDM_ERR_FIELD_IS_NULL 1 614 #define PDM_ERR_NO_MORE_FIELDS 2 617 #define PDM_ERR_INSUFFICIENT_BUFFER_LENGTH 3 620 #define PDM_ERR_EINVAL 4 623 #define PDM_ERR_FIELD_NOT_FOUND 5 626 #define PDM_ERR_MSG_INVALID 6 629 #define PDM_ERR_DEFN_INVALID 7 632 #define PDM_ERR_NOMEM 8 635 #define PDM_ERR_REQ_FIELD_NOT_SET 9 638 #define PDM_ERR_CREATE_SECTION 10 641 #define PDM_ERR_CREATE_BUFFER 11 644 #define PDM_INTERNAL_TYPE_INVALID -1 647 #define PDM_TYPE_BOOLEAN 0 650 #define PDM_TYPE_INT8 1 653 #define PDM_TYPE_UINT8 2 656 #define PDM_TYPE_INT16 3 659 #define PDM_TYPE_UINT16 4 662 #define PDM_TYPE_INT32 5 665 #define PDM_TYPE_UINT32 6 668 #define PDM_TYPE_INT64 7 671 #define PDM_TYPE_UINT64 8 674 #define PDM_TYPE_FLOAT 9 677 #define PDM_TYPE_DOUBLE 10 680 #define PDM_TYPE_DECIMAL 11 683 #define PDM_TYPE_TIMESTAMP 12 686 #define PDM_TYPE_FIX_STRING 13 689 #define PDM_TYPE_STRING 14 692 #define PDM_TYPE_FIX_UNICODE 15 695 #define PDM_TYPE_UNICODE 16 698 #define PDM_TYPE_BLOB 17 701 #define PDM_TYPE_MESSAGE 18 704 #define PDM_TYPE_BOOLEAN_ARR 19 707 #define PDM_TYPE_INT8_ARR 20 710 #define PDM_TYPE_UINT8_ARR 21 713 #define PDM_TYPE_INT16_ARR 22 716 #define PDM_TYPE_UINT16_ARR 23 719 #define PDM_TYPE_INT32_ARR 24 722 #define PDM_TYPE_UINT32_ARR 25 725 #define PDM_TYPE_INT64_ARR 26 728 #define PDM_TYPE_UINT64_ARR 27 731 #define PDM_TYPE_FLOAT_ARR 28 734 #define PDM_TYPE_DOUBLE_ARR 29 737 #define PDM_TYPE_DECIMAL_ARR 30 740 #define PDM_TYPE_TIMESTAMP_ARR 31 743 #define PDM_TYPE_FIX_STRING_ARR 32 746 #define PDM_TYPE_STRING_ARR 33 749 #define PDM_TYPE_FIX_UNICODE_ARR 34 752 #define PDM_TYPE_UNICODE_ARR 35 755 #define PDM_TYPE_BLOB_ARR 36 758 #define PDM_TYPE_MESSAGE_ARR 37 761 #define PDM_DEFN_STR_FIELD_NAMES 0 764 #define PDM_DEFN_INT_FIELD_NAMES 1 767 #define PDM_ITER_INVALID_FIELD_HANDLE -1 1258 #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:529
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:479
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:527
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:550
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:522
struct lbmpdm_defn_stct_t lbmpdm_defn_t
Structure to hold a pdm definition.
Definition: lbmpdm.h:517
struct lbmpdm_msg_stct_t lbmpdm_msg_t
Structure to hold a pdm message.
Definition: lbmpdm.h:512
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:506
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:546
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:493
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:548
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:502
LBMPDMExpDLL int lbmpdm_iter_next(lbmpdm_iter_t *iter)
Steps the iterator to the next first field.
char ** value_arr
Definition: lbmpdm.h:554
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:504
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:540
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:552
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:544
int64_t mant
Definition: lbmpdm.h:491
uint8_t is_array
Definition: lbmpdm.h:542
Structure to hold a scaled decimal number. A scaled decimal number consists of a mantissa and an exp...
Definition: lbmpdm.h:489
struct lbmpdm_iter_stct_t lbmpdm_iter_t
Iterator structure that is used to traverse the fields of a message.
Definition: lbmpdm.h:563
#define LBMPDMExpDLL
PDM API function return codes.
Definition: lbmpdm.h:401
uint8_t req
Definition: lbmpdm.h:525
Field value struct that can be populated with a field value when passed to the lbmpdm_msg_get_field_v...
Definition: lbmpdm.h:538