23 #ifndef LIBASTERIX_DATAITEM_H 24 #define LIBASTERIX_DATAITEM_H 47 #define AST_MAP_DATAITEM_TYPE_EX(category_name, category_value, dataitem_name, dataitem_value) \ 48 I ## category_name ## _ ## dataitem_name = category_value ## dataitem_value, 53 #define SPF 999 //Special purpose field (SPF) maps to 999 54 #define REF 998 //Reserved extension filed (REF) maps to 998 56 #define A02 902 //Dataitem I021/130 version 0.24 ~ 0.26 57 #define A03 903 //Dataitem I021/040 prior version 0.26 58 #define A04 904 //Dataitem I021/131 prior version 0.26 59 #define A05 905 //Dataitem I021/090 prior version 0.26 60 #define A06 906 //Dataitem I021/210 prior version 0.26 61 #define A07 907 //Dataitem I021/271 version 1.0 ~ 2.1 62 #define A08 908 //Dateitem I021/200 prior version 0.26 67 typedef enum _ast_dataitem_type_t
72 #define AST_MAP_DATAITEM_TYPE(category, dataitem) AST_MAP_DATAITEM_TYPE_EX(00 ## category, category, dataitem, dataitem) 146 #undef AST_MAP_DATAITEM_TYPE 147 #define AST_MAP_DATAITEM_TYPE(category, dataitem) AST_MAP_DATAITEM_TYPE_EX(0 ## category, category, dataitem, dataitem) 393 #undef AST_MAP_DATAITEM_TYPE 394 #define AST_MAP_DATAITEM_TYPE(category, dataitem) AST_MAP_DATAITEM_TYPE_EX(category, category, dataitem, dataitem) 422 typedef struct _ast_dataitem_t
433 typedef struct _ast_dataitem_ex_t
450 #define AST_MAX_DATAITEM_SIZE 1024 498 #define AST_DATAITEM_SUMMARY_PREFERED_CHARS 256 512 #define AST_DATAITEM_HEX_STR_PREFERED_CHARS (AST_MAX_DATAITEM_SIZE * 3) 523 #define AST_DATAITEM_HEX_HTML_PREFERED_CHARS (AST_MAX_DATAITEM_SIZE * 12 + 128) 533 #define AST_DATAITEM_BIN_STR_PREFERED_CHARS (AST_MAX_DATAITEM_SIZE * 9) 544 #define AST_DATAITEM_BIN_HTML_PREFERED_CHARS (AST_MAX_DATAITEM_SIZE * 128 + 64) 554 #define AST_DATAITEM_DETAIL_HTML_PREFERED_CHARS (AST_DATAITEM_HEX_HTML_PREFERED_CHARS + AST_DATAITEM_BIN_HTML_PREFERED_CHARS + 20480) 585 #endif //LIBASTERIX_DATAITEM_H size_t ast_dataitem_get_size_fixed_3_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_fixed_1_byte(const unsigned char *buffer, const size_t bufsize)
void ast_dataitem_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Function to get summary of one dataitem.
Extracted dataitem.
Definition: dataitem.h:433
size_t ast_dataitem_get_size_var_5_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_fixed_8_byte(const unsigned char *buffer, const size_t bufsize)
#define A06
Definition: dataitem.h:60
#define AST_MAP_DATAITEM_TYPE_EX(category_name, category_value, dataitem_name, dataitem_value)
Macro used to map dataitem type.
Definition: dataitem.h:47
size_t ast_dataitem_get_size_rep_3_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size(const unsigned char *buffer, const size_t bufsize, const ast_dataitem_type_t type)
Function to get size of one dataitem.
size_t ast_dataitem_get_size_rep_256_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_rep_4_byte(const unsigned char *buffer, const size_t bufsize)
#define AST_MAP_DATAITEM_TYPE(category, dataitem)
Definition: dataitem.h:394
ast_dataitem_t ast_dataitem_copy(unsigned char *const buffer, const size_t bufsize, const ast_dataitem_t src)
Copy data item to binary buffer.
void ast_dataitem_get_hex_str(char *string, const size_t string_size, ast_dataitem_t di)
Function to get raw dataitem data in hexadecimal format.
size_t ast_dataitem_get_size_var_6_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_var_1_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_var_23_byte(const unsigned char *buffer, const size_t bufsize)
Null (Empty) dataitem.
Definition: dataitem.h:69
#define A04
Definition: dataitem.h:58
size_t ast_dataitem_get_size_fixed_7_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_rep_1_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_var_3_byte(const unsigned char *buffer, const size_t bufsize)
ast_dataitem_type_t type
Type of data item.
Definition: dataitem.h:435
#define A03
Definition: dataitem.h:57
size_t ast_dataitem_get_size_var_4_byte(const unsigned char *buffer, const size_t bufsize)
#define SPF
Definition: dataitem.h:53
size_t ast_dataitem_get_size_fixed_9_byte(const unsigned char *buffer, const size_t bufsize)
void * data
Pointer to extracted data of individual dataitem.
Definition: dataitem.h:437
const char * ast_dataitem_type_to_str(const ast_dataitem_type_t type)
Convert from ast_dataitem_type_t to C string.
size_t ast_dataitem_get_size_fixed_2_byte(const unsigned char *buffer, const size_t bufsize)
const char * ast_dataitem_get_name(const ast_dataitem_type_t type)
Function to get name of one dataitem.
void ast_dataitem_get_hex_html(char *html, const size_t html_size, const ast_dataitem_t di)
Function to get a html snippet of the raw dataitem data in hexadecimal format.
size_t ast_dataitem_get_size_fixed_4_byte(const unsigned char *buffer, const size_t bufsize)
ast_dataitem_t ast_dataitem_encode(unsigned char *const buffer, const size_t bufsize, const ast_dataitem_ex_t xdi)
Encode.
void ast_dataitem_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Function to get a html snippet of detailed description of dataitem.
#define A02
Definition: dataitem.h:56
size_t ast_dataitem_get_size_fixed_6_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_fixed(const unsigned char *buffer, const size_t bufsize, const size_t fix_size)
Utility funciton to get fixed dataitem size.
size_t ast_dataitem_get_size_fixed_12_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_rep_64_byte(const unsigned char *buffer, const size_t bufsize)
void ast_dataitem_get_bin_str(char *string, const size_t string_size, const ast_dataitem_t di)
Function to get raw dataitem data in binary format.
const unsigned char * data
Address of data item.
Definition: dataitem.h:424
ast_dataitem_t ast_dataitem_decode(const unsigned char *buffer, const size_t bufsize, const ast_dataitem_type_t type)
Decode data item from binary data.
Dataitem.
Definition: dataitem.h:422
#define A07
Definition: dataitem.h:61
#define REF
Definition: dataitem.h:54
#define A08
Definition: dataitem.h:62
ast_dataitem_type_t
Definition of data item id in each category.
Definition: dataitem.h:67
#define A05
Definition: dataitem.h:59
size_t ast_dataitem_get_size_variable(const unsigned char *buffer, const size_t bufsize, const size_t max_size)
Utility funciton to get FX extendable dataitem size.
ast_dataitem_type_t type
Type of data item.
Definition: dataitem.h:427
size_t size
Size of data item.
Definition: dataitem.h:425
size_t ast_dataitem_get_size_rep_8_byte(const unsigned char *buffer, const size_t bufsize)
bool valid
True when data item is valid, means it's correctlly decoded/encoded.
Definition: dataitem.h:429
void ast_dataitem_get_detail_html_dummy(char *detail, const size_t detail_size, const ast_dataitem_t di)
Dummy get detail function.
size_t ast_dataitem_get_size_var_2_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_rep_2_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_fixed_5_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_repeat(const unsigned char *buffer, const size_t bufsize, const size_t unit_size)
Utility function to get repeated dataitem size.
size_t ast_dataitem_get_size_rep_15_byte(const unsigned char *buffer, const size_t bufsize)
size_t ast_dataitem_get_size_var_unlimited(const unsigned char *buffer, const size_t bufsize)
void ast_dataitem_get_bin_html(char *html, const size_t html_size, const ast_dataitem_t di)
Function to get a html snippet of the raw dataitem data in binary format.