subfield.h
Go to the documentation of this file.
1 /*
2  * libasterix
3  * Copyright [2013-2020] SinoATC <http://www.sinoatc.com>.
4  * All Rights Reserved.
5  *
6  * NOTICE: All information contained herein is, and remains
7  * the property of SinoATC and its suppliers, if any.
8  * The intellectual and technical concepts contained herein
9  * are proprietary to Aerosys Corporation and its suppliers and may be
10  * covered by U.S. and Foreign Patents, patents in process,
11  * and are protected by trade secret or copyright law.
12  * Dissemination of this information or reproduction of this material
13  * is strictly forbidden unless prior written permission is obtained
14  * from SinoATC.
15  */
16 
23 #ifndef LIBASTERIX_SUBFIELD_H
24 #define LIBASTERIX_SUBFIELD_H
25 
26 #include "fspec.h"
27 #include "dataitem.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
46 #define AST_MAP_SUBFIELD_TYPE_EX(category_name, category_value, dataitem, subfield) \
47  I ## category_name ## _ ## dataitem ## _ ## S ## subfield = category_value ## dataitem ## 0 ## subfield,
48 
52 typedef enum _ast_subfield_type_t
53 {
54  INULLFIELD = 0,
55 
56  //For CAT001~CAT009
57 #define AST_MAP_SUBFIELD_TYPE(category, dataitem, subfield) AST_MAP_SUBFIELD_TYPE_EX(00 ## category, category, dataitem, subfield)
58 
59  //Dataitem I004/100
66 
67  //Dataitem I004/120
72 
73  //Dataitem I004/170
84 
85  //Dataitem I004/171
96 
97  //For CAT010~CAT099
98 #undef AST_MAP_SUBFIELD_TYPE
99 #define AST_MAP_SUBFIELD_TYPE(category, dataitem, subfield) AST_MAP_SUBFIELD_TYPE_EX(0 ## category, category, dataitem, subfield)
100 
101  //Dataitem I021/110
104 
105  //Dataitem I021/220
110 
111  //Dataitem I021/295
135 
136  //Dataitem I034/050
144 
145  //Dataitem I034/060
153 
154  //Dataitem I048/120
157 
158  //Dataitem I048/130
166 
167  //Dataitem I062/110
175 
176  //Dataitem I062/290
187 
188  //Dataitem I062/295
220 
221  //Dataitem I062/340
228 
229  //Dataitem I062/380
258 
259  //Dataitem I062/390
278 
279  //Dataitem I062/500
288 
290 
292 typedef struct _ast_subfield_t
293 {
294  bool existing;
295 
296  const unsigned char* data;
297  size_t size;
298 
300 
301  bool valid;
303 
305 #define AST_MAX_SUBFIELD_SIZE 32
306 
308 AST_API size_t ast_subfield_get_size(const unsigned char* buffer, const size_t bufsize, const ast_subfield_type_t type);
309 
311 AST_API const char* ast_subfield_get_id(const ast_subfield_type_t type);
312 
314 AST_API const char* ast_subfield_get_name(const ast_subfield_type_t type);
315 
317 #define AST_SUBFIELD_SUMMARY_PREFERED_CHARS summary_size
318 
320 AST_API void ast_subfield_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di, const ast_subfield_type_t type);
321 
323 AST_API void ast_subfield_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di, const ast_subfield_type_t type);
324 
326 #define AST_SUBFIELD_BIN_HTML_PREFERED_CHARS (AST_MAX_SUBFIELD_SIZE * 128 + 64)
327 
333 AST_API void ast_subfield_get_bin_html(char* html, const size_t html_size, const ast_subfield_t sf);
334 
362 #define AST_MAX_SUBFIELDS 35
363 
365 typedef struct _ast_dataitem_subfields_t
366 {
367  bool valid;
368 
371  size_t n_subfields;
373 
375 AST_API size_t ast_dataitem_subfields_get_size(const unsigned char* buffer, const size_t bufsize, const ast_dataitem_type_t dataitem);
376 
379 
382 
384 AST_API void ast_dataitem_subfields_get_summary(char* summary, const size_t summary_size, const ast_dataitem_t di);
385 
387 AST_API void ast_dataitem_subfields_get_detail_html(char* detail, const size_t detail_size, const ast_dataitem_t di);
388 
392 #ifdef __cplusplus
393  }
394 #endif // extern "C"
395 
396 #endif //LIBASTERIX_SUBFIELD_H
397 
398 // vim:set ft=c sw=2 sts=2 fenc=utf8:
ast_subfield_type_t
Definition of subfield id in each dataitem.
Definition: subfield.h:52
bool existing
Definition: subfield.h:294
bool valid
True if subfield is correctlly decoded.
Definition: subfield.h:301
const char * ast_subfield_get_id(const ast_subfield_type_t type)
Get ID string of subfield.
bool valid
Definition: subfield.h:367
#define AST_API
Definition: platform.h:63
ast_dataitem_subfields_t ast_dataitem_subfields_decode(const ast_dataitem_t di)
Decode function.
Null subfield.
Definition: subfield.h:54
void ast_subfield_get_bin_html(char *html, const size_t html_size, const ast_subfield_t sf)
Function to get a html snippet of the raw subfield data in binary format.
ast_subfield_type_t type
Type of subfield.
Definition: subfield.h:299
size_t ast_subfield_get_size(const unsigned char *buffer, const size_t bufsize, const ast_subfield_type_t type)
Get size of subfield.
Implementation of Field SPECification (FSPEC) concept defined by ASTERIX.
size_t n_subfields
Definition: subfield.h:371
#define AST_MAP_SUBFIELD_TYPE(category, dataitem, subfield)
Definition: subfield.h:99
Subfield struct.
Definition: subfield.h:292
Definition: fspec.h:36
Implementation of Dataitem concept defined by ASTERIX.
size_t ast_dataitem_subfields_get_size(const unsigned char *buffer, const size_t bufsize, const ast_dataitem_type_t dataitem)
Get size function.
const char * ast_subfield_get_name(const ast_subfield_type_t type)
Get name of subfield.
ast_fspec_t fspec
Definition: subfield.h:369
void ast_dataitem_subfields_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di)
Get detail function.
const unsigned char * data
Address of subfield.
Definition: subfield.h:296
Dataitem.
Definition: dataitem.h:422
void ast_subfield_get_detail_html(char *detail, const size_t detail_size, const ast_dataitem_t di, const ast_subfield_type_t type)
Get detail of subfield, in html format.
size_t size
Size of subfield.
Definition: subfield.h:297
ast_dataitem_type_t
Definition of data item id in each category.
Definition: dataitem.h:67
#define AST_MAX_SUBFIELDS
Definition: subfield.h:362
size_t ast_dataitem_subfields_get_number(const ast_dataitem_type_t type)
Get number of subfields function.
void ast_dataitem_subfields_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di)
Get summary funciton.
void ast_subfield_get_summary(char *summary, const size_t summary_size, const ast_dataitem_t di, const ast_subfield_type_t type)
Get summary of subfield.
Data Item - Subfields.
Definition: subfield.h:365