diff --git a/README.md b/README.md index de6264860..72784d06f 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,20 @@ There now also is a [Matrix](https://matrix.to/#/#satdump:altillimity.com) room # Introduction -*Note : This is a very basic "how-to" skipping details and assuming some knowledge of what you are doing. For more details and advanced usecases, please see the detailed documention.* +*Note : This is a very basic "how-to" skipping details and assuming some knowledge of what you are doing. For more details and advanced use cases, please see the detailed documentation.* ## GUI Version ### Offline processing (recorded data) - -![Img](gui_example.png) - Quick-Start : -- Chose the appropriate pipeline for what you want to process +- Choose the appropriate pipeline for what you want to process - Select the input file (baseband, frames, soft symbols...) - Set the appropriate input level (what your file is) - Check settings shown below are right (such as samplerate) - Press "Start"! +![Img](gui_example.png) + ![Img](gui_example2.png) *SatDump demodulating a DVB-S2 Baseband* @@ -31,8 +30,8 @@ Quick-Start : Quick-Start : - Go in the "Recorder" Tab -- Select and start your SDR Devices -- Chose a pipeline +- Select and start your SDR Device +- Choose a pipeline - Start it, and done! - For recording, use the recording tab instead. Both processing and recording can be used at once. @@ -82,7 +81,7 @@ satdump record baseband_name --source airspy --samplerate 6e6 --frequency 1701.3 ### Windows -On Windows the recommend method of running SatDump is getting the latest pre-built release off the [Release](https://github.com/altillimity/SatDump/releases) page, which includes everything you will need to run it. +On Windows the recommended method of running SatDump is getting the latest pre-built release off the [Release](https://github.com/altillimity/SatDump/releases) page, which includes everything you will need to run it. Those builds are made with Visual Studio 2019 for x64, so the appropriate Visual C++ Runtime will be required (though, likely to be already installed). You can get it [here](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0). From there, just run either satdump-ui.exe or satdump.exe (CLI) and everything will work. @@ -99,7 +98,7 @@ Here are some generic (Debian-oriented) build instructions. ``` # Linux: Install dependencies sudo apt install git build-essential cmake g++ pkgconf libfftw3-dev libvolk2-dev libpng-dev libluajit-5.1-dev # Core dependencies. If libvolk2-dev is not available, use libvolk1-dev -sudo apt install libnng-dev # If this packages is not found, follow build instructions below for NNG +sudo apt install libnng-dev # If this package is not found, follow build instructions below for NNG sudo apt install librtlsdr-dev libhackrf-dev libairspy-dev libairspyhf-dev # All libraries required for live processing (optional) sudo apt install libglew-dev libglfw3-dev # Only if you want to build the GUI Version (optional) sudo apt install libzstd-dev # Only if you want to build with ZIQ Recording compression @@ -167,7 +166,7 @@ On Android, the preferred source is F-Droid [INSERT LINK WHEN POSSIBLE]. If this is not an option for you, APKs are also available on the [Release](https://github.com/altillimity/SatDump/releases) page. -Do keep in mind that while pretty much all features are perfectly function on Android, there may be some limitations (either due to the hardware) in some places. For example, not all SDR Devices can be used. +Do keep in mind that while pretty much all features perfectly function on Android, there may be some limitations (either due to the hardware) in some places. For example, not all SDR Devices can be used. Supported SDR devices are : - RTL-SDR - Airspy diff --git a/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder.cpp b/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder.cpp index c915e1800..9d72fbee6 100644 --- a/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder.cpp +++ b/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder.cpp @@ -227,7 +227,7 @@ namespace goes hasImage = true; - if (ImGui::BeginTabItem(std::string("Img " + std::to_string(decMap.first)).c_str())) + if (ImGui::BeginTabItem(std::string("VCID " + std::to_string(decMap.first)).c_str())) { ImGui::Image((void *)(intptr_t)dec->textureID, {200 * ui_scale, 200 * ui_scale}); ImGui::SameLine(); diff --git a/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder_proc.cpp b/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder_proc.cpp index ecdf52a90..5c0da4a8d 100644 --- a/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder_proc.cpp +++ b/plugins/goes_support/goes/hrit/module_goes_lrit_data_decoder_proc.cpp @@ -243,22 +243,21 @@ namespace goes if (file.hasHeader()) { - SegmentIdentificationHeader segment_id_header = file.getHeader(); - if (all_wip_images.count(segment_id_header.image_identifier) == 0) - all_wip_images.insert({segment_id_header.image_identifier, std::make_unique()}); + if (all_wip_images.count(file.vcid) == 0) + all_wip_images.insert({file.vcid, std::make_unique()}); - std::unique_ptr &wip_img = all_wip_images[segment_id_header.image_identifier]; + std::unique_ptr &wip_img = all_wip_images[file.vcid]; wip_img->imageStatus = RECEIVING; - if (segmentedDecoders.count(segment_id_header.image_identifier) == 0) - segmentedDecoders.insert({segment_id_header.image_identifier, SegmentedLRITImageDecoder()}); + if (segmentedDecoders.count(file.vcid) == 0) + segmentedDecoders.insert({file.vcid, SegmentedLRITImageDecoder()}); - SegmentedLRITImageDecoder &segmentedDecoder = segmentedDecoders[segment_id_header.image_identifier]; + SegmentedLRITImageDecoder &segmentedDecoder = segmentedDecoders[file.vcid]; - if (segmentedDecoder.image_id != segment_id_header.image_identifier) + if (segmentedDecoder.image_id != file.vcid) { if (segmentedDecoder.image_id != -1) { @@ -292,7 +291,7 @@ namespace goes segmentedDecoder = SegmentedLRITImageDecoder(segment_id_header.max_segment, image_structure_record.columns_count, image_structure_record.lines_count, - segment_id_header.image_identifier); + file.vcid); segmentedDecoder.filename = current_filename; } diff --git a/plugins/inmarsat_support/CMakeLists.txt b/plugins/inmarsat_support/CMakeLists.txt index b6ec6b35f..962f70b81 100644 --- a/plugins/inmarsat_support/CMakeLists.txt +++ b/plugins/inmarsat_support/CMakeLists.txt @@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.0.0) project(inmarsat_support) -file(GLOB_RECURSE inmarsat_support_CPPS *.cpp) +file(GLOB_RECURSE inmarsat_support_CPPS *.cpp aero/libacars/*.c) add_library(inmarsat_support SHARED ${inmarsat_support_CPPS}) target_link_libraries(inmarsat_support PUBLIC satdump_core) -target_include_directories(inmarsat_support PUBLIC src) +target_include_directories(inmarsat_support PUBLIC src .) if(MSVC) - target_link_libraries(inmarsat_support PUBLIC ws2_32) + target_link_libraries(inmarsat_support PUBLIC ws2_32 zlib.dll) endif() install(TARGETS inmarsat_support DESTINATION share/satdump/plugins) \ No newline at end of file diff --git a/plugins/inmarsat_support/aero/acars_parser.cpp b/plugins/inmarsat_support/aero/acars_parser.cpp index 29b1f8dfd..9cf48a605 100644 --- a/plugins/inmarsat_support/aero/acars_parser.cpp +++ b/plugins/inmarsat_support/aero/acars_parser.cpp @@ -13,7 +13,7 @@ namespace inmarsat return payload.size() > 16 && payload[0] == 0xFF && payload[1] == 0xFF; } - // Yes, I did end peeking in JAERO a bit to figure this + // Yes, I did end up peeking in JAERO a bit to figure this // part out. 0 documentation apparently! ACARSPacket::ACARSPacket(std::vector pkt) { @@ -47,8 +47,6 @@ namespace inmarsat plane_reg += pkt[k] & 0x7F; } - plane_reg.erase(std::remove(plane_reg.begin(), plane_reg.end(), '.'), plane_reg.end()); - if (pkt[15] == 0x02) { has_text = true; @@ -97,6 +95,20 @@ namespace inmarsat return acar; } } + + nlohmann::json parse_libacars(ACARSPacket &pkt, la_msg_dir dir) + { + la_proto_node *node = la_acars_decode_apps(pkt.label.data(), pkt.message.data(), dir); + if (node != NULL) + { + la_vstring *str = la_proto_tree_format_json(NULL, node); + auto v = nlohmann::json::parse(std::string(str->str)); + la_vstring_destroy(str, true); + return v; + } + la_proto_tree_destroy(node); + return nlohmann::json(); + } } } } \ No newline at end of file diff --git a/plugins/inmarsat_support/aero/acars_parser.h b/plugins/inmarsat_support/aero/acars_parser.h index 45f5e904b..fccddd685 100644 --- a/plugins/inmarsat_support/aero/acars_parser.h +++ b/plugins/inmarsat_support/aero/acars_parser.h @@ -6,6 +6,10 @@ #include "pkt_structs.h" #include +#include "libacars/libacars.h" +#include "libacars/acars.h" +#include "libacars/vstring.h" + namespace inmarsat { namespace aero @@ -43,6 +47,8 @@ namespace inmarsat public: std::optional parse(std::vector &payload); }; + + nlohmann::json parse_libacars(ACARSPacket &pkt, la_msg_dir dir); } } } \ No newline at end of file diff --git a/plugins/inmarsat_support/aero/libacars/acars.c b/plugins/inmarsat_support/aero/libacars/acars.c new file mode 100644 index 000000000..65bf7ffd0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/acars.c @@ -0,0 +1,595 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include // memcpy(), strdup() +#ifdef WIN32 +#else +#include // struct timeval +#endif +#include "config.h" // WITH_LIBXML2 +#ifdef WITH_LIBXML2 +#include // xmlBufferPtr, xmlBufferFree() +#endif +#include // la_proto_node, la_proto_tree_find_protocol +#include // la_assert, la_debug_print +#include // la_arinc_parse() +#include // la_media_adv_parse() +#include // la_miam_parse_and_reassemble() +#include // la_crc16_ccitt() +#include // la_vstring, LA_ISPRINTF() +#include // la_json_append_*() +#include // LA_XCALLOC, LA_XFREE, la_prettify_xml +#include // LA_HASH_INIT, la_hash_string() +#include +#include + +#define LA_ACARS_PREAMBLE_LEN 16 // including CRC and DEL, not including SOH +#define DEL 0x7f +#define STX 0x02 +#define ETX 0x03 +#define ETB 0x17 +#define ACK 0x06 +#define NAK 0x15 +#define IS_DOWNLINK_BLK(bid) ((bid) >= '0' && (bid) <= '9') + +#define LA_ACARS_REASM_TABLE_CLEANUP_INTERVAL 1000 + +typedef struct { + struct timeval downlink, uplink; +} la_acars_timeout_profile; + +// Reassembly timers for various ACARS radio bearers. +static la_acars_timeout_profile const timeout_profiles[] = { + [LA_ACARS_BEARER_INVALID] = { + .downlink = { .tv_sec = 0, .tv_usec = 0 }, + .uplink = { .tv_sec = 0, .tv_usec = 0 } + }, + // Note: LA_ACARS_BEARER_VHF applies both to PoA and VDL2. + // ARINC 618 specifies 420 and 90 seconds for VDL2, respectively, + // however these values are too small and would result in many + // incomplete reassemblies, especially in downlink direction. + // PoA timers seem to work better in practice. + [LA_ACARS_BEARER_VHF] = { + .downlink = { .tv_sec = 660, .tv_usec = 0 }, // VGT4 + .uplink = { .tv_sec = 90, .tv_usec = 0 } // VAT4 + }, + [LA_ACARS_BEARER_HFDL] = { + .downlink = { .tv_sec = 1260, .tv_usec = 0 }, // HFGT4 + .uplink = { .tv_sec = 370, .tv_usec = 0 } // HFAT4 + }, + [LA_ACARS_BEARER_SATCOM] = { + .downlink = { .tv_sec = 1260, .tv_usec = 0 }, // SGT4 + .uplink = { .tv_sec = 280, .tv_usec = 0 } // SAT4 + } +}; + +typedef struct { + char *reg, *label, *msg_num; +} la_acars_key; + +static uint32_t la_acars_key_hash(void const *key) { + la_acars_key *k = (la_acars_key *)key; + uint32_t h = la_hash_string(k->reg, LA_HASH_INIT); + h = la_hash_string(k->label, h); + h = la_hash_string(k->msg_num, h); + return h; +} + +static bool la_acars_key_compare(void const *key1, void const *key2) { + la_acars_key const *k1 = key1; + la_acars_key const *k2 = key2; + return (!strcmp(k1->reg, k2->reg) && + !strcmp(k1->label, k2->label) && + !strcmp(k1->msg_num, k2->msg_num)); +} + +static void la_acars_key_destroy(void *ptr) { + if(ptr == NULL) { + return; + } + la_acars_key *key = ptr; + la_debug_print(D_INFO, "DESTROY KEY %s %s %s\n", key->reg, key->label, key->msg_num); + LA_XFREE(key->reg); + LA_XFREE(key->label); + LA_XFREE(key->msg_num); + LA_XFREE(key); +} + +static void *la_acars_tmp_key_get(void const *msg) { + la_assert(msg != NULL); + la_acars_msg const *amsg = msg; + LA_NEW(la_acars_key, key); + key->reg = (char *)amsg->reg; + key->label = (char *)amsg->label; + key->msg_num = (char *)amsg->msg_num; + return (void *)key; +} + +static void *la_acars_key_get(void const *msg) { + la_assert(msg != NULL); + la_acars_msg const *amsg = msg; + LA_NEW(la_acars_key, key); + key->reg = strdup(amsg->reg); + key->label = strdup(amsg->label); + key->msg_num = strdup(amsg->msg_num); + la_debug_print(D_INFO, "ALLOC KEY %s %s %s\n", key->reg, key->label, key->msg_num); + return (void *)key; +} + +static la_reasm_table_funcs acars_reasm_funcs = { + .get_key = la_acars_key_get, + .get_tmp_key = la_acars_tmp_key_get, + .hash_key = la_acars_key_hash, + .compare_keys = la_acars_key_compare, + .destroy_key = la_acars_key_destroy +}; + +la_proto_node *la_acars_apps_parse_and_reassemble(char const *reg, + char const *label, char const *txt, la_msg_dir msg_dir, + la_reasm_ctx *rtables, struct timeval rx_time) { + la_proto_node *ret = NULL; + if(label == NULL || txt == NULL) { + goto end; + } + switch(label[0]) { + case 'A': + switch(label[1]) { + case '6': + case 'A': + if((ret = la_arinc_parse(txt, msg_dir)) != NULL) { + goto end; + } + break; + } + break; + case 'B': + switch(label[1]) { + case '6': + case 'A': + if((ret = la_arinc_parse(txt, msg_dir)) != NULL) { + goto end; + } + break; + } + break; + case 'H': + switch(label[1]) { + case '1': + if((ret = la_arinc_parse(txt, msg_dir)) != NULL) { + goto end; + } + if((ret = la_miam_parse_and_reassemble(reg, txt, rtables, rx_time)) != NULL) { + goto end; + } + break; + } + break; + case 'M': + switch(label[1]) { + case 'A': + if((ret = la_miam_parse_and_reassemble(reg, txt, rtables, rx_time)) != NULL) { + goto end; + } + break; + } + break; + case 'S': + switch(label[1]) { + case 'A': + if((ret = la_media_adv_parse(txt)) != NULL) { + goto end; + } + break; + } + break; + } +end: + return ret; +} + +la_proto_node *la_acars_decode_apps(char const *label, + char const *txt, la_msg_dir msg_dir) { + return la_acars_apps_parse_and_reassemble(NULL, label, txt, msg_dir, + NULL, (struct timeval){ .tv_sec = 0, .tv_usec = 0 }); +} + +#define COPY_IF_NOT_NULL(d, s, l) do { \ + if((d) != NULL && (s) != NULL) { \ + memcpy((d), (s), (l)); \ + } } while(0) + +#define BUF_CLEAR(p, l) do { \ + if((p) != NULL) { \ + memset((p), 0, (l)); \ + } } while(0) + +int la_acars_extract_sublabel_and_mfi(char const *label, la_msg_dir msg_dir, + char const *txt, int len, char *sublabel, char *mfi) { + + if(txt == NULL || label == NULL || strlen(label) < 2) { + return -1; + } + if(msg_dir != LA_MSG_DIR_AIR2GND && msg_dir != LA_MSG_DIR_GND2AIR) { + return -1; + } + + int consumed = 0; + int remaining = len; + char const *ptr = txt; + char const *sublabel_ptr = NULL, *mfi_ptr = NULL; + + BUF_CLEAR(sublabel, 3); + BUF_CLEAR(mfi, 3); + + if(label[0] == 'H' && label[1] == '1') { + if(msg_dir == LA_MSG_DIR_GND2AIR) { + // Note: this algorithm works correctly only for service-related messages + // without SMT header. The header, if present, precedes the "- #" character + // sequence, while this algorithm expects this sequence to appear at the + // start of the message text. However this is not a big deal since the main + // purpose of this routine is to skip initial sublabel/MFI part and return + // a pointer to the beginning of the next layer application payload (eg. + // ARINC-622 ATS message). Right now libacars does not decode any application + // layer protocols transmitted with SMT headers, so it's not a huge issue. + if(remaining >= 5 && strncmp(ptr, "- #", 3) == 0) { + la_debug_print(D_INFO, "Uplink sublabel: %c%c\n", ptr[3], ptr[4]); + sublabel_ptr = ptr + 3; + ptr += 5; consumed += 5; remaining -= 5; + } + } else if(msg_dir == LA_MSG_DIR_AIR2GND) { + if(remaining >= 4 && ptr[0] == '#' && ptr[3] == 'B') { + la_debug_print(D_INFO, "Downlink sublabel: %c%c\n", ptr[1], ptr[2]); + sublabel_ptr = ptr + 1; + ptr += 4; consumed += 4; remaining -= 4; + } + } + // Look for MFI only if sublabel has been found + if(sublabel_ptr == NULL) { + goto end; + } + // MFI format is the same for both directions + if(remaining >= 4 && ptr[0] == '/' && ptr[3] == ' ') { + la_debug_print(D_INFO, "MFI: %c%c\n", ptr[1], ptr[2]); + mfi_ptr = ptr + 1; + ptr += 4; consumed += 4; remaining -= 4; + } + } +end: + COPY_IF_NOT_NULL(sublabel, sublabel_ptr, 2); + COPY_IF_NOT_NULL(mfi, mfi_ptr, 2); + la_debug_print(D_INFO, "consumed %d bytes\n", consumed); + return consumed; +} + +// Note: buf must contain raw ACARS bytes, NOT including initial SOH byte +// (0x01) and including terminating DEL byte (0x7f). +la_proto_node *la_acars_parse_and_reassemble(uint8_t const* buf, int len, la_msg_dir msg_dir, + la_reasm_ctx *rtables, struct timeval rx_time) { + if(buf == NULL) { + return NULL; + } + + la_proto_node *node = la_proto_node_new(); + LA_NEW(la_acars_msg, msg); + node->data = msg; + node->td = &la_DEF_acars_message; + char *buf2 = LA_XCALLOC(len, sizeof(char)); + + msg->err = false; + if(len < LA_ACARS_PREAMBLE_LEN) { + la_debug_print(D_ERROR, "Preamble too short: %u < %u\n", len, LA_ACARS_PREAMBLE_LEN); + goto fail; + } + + if(buf[len-1] != DEL) { + la_debug_print(D_ERROR, "%02x: no DEL byte at end\n", buf[len-1]); + goto fail; + } + len--; + + uint16_t crc = la_crc16_ccitt(buf, len, 0); + la_debug_print(D_INFO, "CRC check result: %04x\n", crc); + len -= 2; + msg->crc_ok = (crc == 0); + + int i = 0; + for(i = 0; i < len; i++) { + buf2[i] = buf[i] & 0x7f; + } + la_debug_print_buf_hex(D_VERBOSE, buf2, len, "After CRC and parity bit removal:\n"); + la_debug_print(D_INFO, "Length: %d\n", len); + + if(buf2[len-1] == ETX) { + msg->final_block = true; + } else if(buf2[len-1] == ETB) { + msg->final_block = false; + } else { + la_debug_print(D_ERROR, "%02x: no ETX/ETB byte at end of text\n", buf2[len-1]); + goto fail; + } + len--; + // Here we have DEL, CRC and ETX/ETB bytes removed. + // There are at least 12 bytes remaining. + + int remaining = len; + char *ptr = buf2; + + msg->mode = *ptr; + ptr++; remaining--; + + memcpy(msg->reg, ptr, 7); + msg->reg[7] = '\0'; + ptr += 7; remaining -= 7; + + msg->ack = *ptr; + ptr++; remaining--; + + // change special values to something printable + if (msg->ack == NAK) { + msg->ack = '!'; + } else if(msg->ack == ACK) { + msg->ack = '^'; + } + + msg->label[0] = *ptr++; + msg->label[1] = *ptr++; + remaining -= 2; + + if (msg->label[1] == 0x7f) { + msg->label[1] = 'd'; + } + msg->label[2] = '\0'; + + msg->block_id = *ptr; + ptr++; remaining--; + + if (msg->block_id == 0) { + msg->block_id = ' '; + } + // If the message direction is unknown, guess it using the block ID character. + if(msg_dir == LA_MSG_DIR_UNKNOWN) { + if(IS_DOWNLINK_BLK(msg->block_id)) { + msg_dir = LA_MSG_DIR_AIR2GND; + } else { + msg_dir = LA_MSG_DIR_GND2AIR; + } + la_debug_print(D_ERROR, "Assuming msg_dir=%d\n", msg_dir); + } + if(remaining < 1) { + // ACARS preamble has been consumed up to this point. + // If this is an uplink with an empty message text, then we are done. + // XXX: we are skipping the reassembly stage here, is this 100% correct? + // If this ever needs to be changed, special care has to be taken for + // empty ACKs (label: _<7F> aka _d), because they have out-of-sequence + // block IDs (X, Y, Z, X, ...). + if(!IS_DOWNLINK_BLK(msg->block_id)) { + msg->txt = strdup(""); + msg->reasm_status = LA_REASM_SKIPPED; + goto end; + } else { + la_debug_print(D_ERROR, "No text field in downlink message\n"); + goto fail; + } + } + // Otherwise we expect STX here. + if(*ptr != STX) { + la_debug_print(D_ERROR, "%02x: No STX byte after preamble\n", *ptr); + goto fail; + } + ptr++; remaining--; + + // Replace NULLs in message text to make it printable + // XXX: Should we replace all nonprintable chars here? + for(i = 0; i < remaining; i++) { + if(ptr[i] == 0) { + ptr[i] = '.'; + } + } + // Extract downlink-specific fields from message text + if (IS_DOWNLINK_BLK(msg->block_id)) { + if(remaining < 10) { + la_debug_print(D_ERROR, "Downlink text field too short: %d < 10\n", remaining); + goto fail; + } + memcpy(msg->msg_num, ptr, 3); + msg->msg_num[3] = '\0'; + msg->msg_num_seq = ptr[3]; + ptr += 4; remaining -= 4; + memcpy(msg->flight_id, ptr, 6); + ptr += 6; remaining -= 6; + } + + // Extract sublabel and MFI if present + int offset = la_acars_extract_sublabel_and_mfi(msg->label, msg_dir, + ptr, remaining, msg->sublabel, msg->mfi); + if(offset > 0) { + ptr += offset; + remaining -= offset; + } + + la_reasm_table *acars_rtable = NULL; + if(rtables != NULL) { // reassembly engine is enabled + acars_rtable = la_reasm_table_lookup(rtables, &la_DEF_acars_message); + if(acars_rtable == NULL) { + acars_rtable = la_reasm_table_new(rtables, &la_DEF_acars_message, + acars_reasm_funcs, LA_ACARS_REASM_TABLE_CLEANUP_INTERVAL); + } + bool down = IS_DOWNLINK_BLK(msg->block_id); + + long int acars_bearer = LA_ACARS_BEARER_INVALID; + (void)la_config_get_int("acars_bearer", &acars_bearer); + if(acars_bearer < LA_ACARS_BEARER_MIN || acars_bearer > LA_ACARS_BEARER_MAX) { + // This bearer will cause reassembly to fail with LA_REASM_INVALID_ARGS + acars_bearer = LA_ACARS_BEARER_INVALID; + } + la_acars_timeout_profile const *timeout_profile = timeout_profiles + acars_bearer; + la_debug_print(D_VERBOSE, "Using timeout profile for bearer %ld (up: %lu dn: %lu)\n", + acars_bearer, + timeout_profile->uplink.tv_sec, + timeout_profile->downlink.tv_sec); + + msg->reasm_status = la_reasm_fragment_add(acars_rtable, + &(la_reasm_fragment_info){ + .msg_info = msg, + .msg_data = (uint8_t *)ptr, + .msg_data_len = remaining, + .total_pdu_len = 0, // not used here + .seq_num = down ? msg->msg_num_seq - 'A' : msg->block_id - 'A', + .seq_num_first = down ? 0 : SEQ_FIRST_NONE, + .seq_num_wrap = down ? SEQ_WRAP_NONE : 'X' - 'A', + .is_final_fragment = msg->final_block, + .rx_time = rx_time, + .reasm_timeout = down ? timeout_profile->downlink : timeout_profile->uplink + }); + } + uint8_t *reassembled_msg = NULL; + if(msg->reasm_status == LA_REASM_COMPLETE && + la_reasm_payload_get(acars_rtable, msg, &reassembled_msg) > 0) { + // reassembled_msg is a newly allocated byte buffer, which is guaranteed to + // be NULL-terminated, so we can cast it to char * directly. + msg->txt = (char *)reassembled_msg; + + } else { // this will also trigger when reassembly engine is disabled + msg->txt = LA_XCALLOC(remaining + 1, sizeof(char)); + if(remaining > 0) { + memcpy(msg->txt, ptr, remaining); + } + } + + if(strlen(msg->txt) > 0) { + bool decode_apps = true; + // If reassembly is enabled and is now in progress (ie. the message is not yet complete), + // then decode_fragments config flag decides whether to decode apps in this message + // or not. + if(rtables != NULL && (msg->reasm_status == LA_REASM_IN_PROGRESS || + msg->reasm_status == LA_REASM_DUPLICATE)) { + (void)la_config_get_bool("decode_fragments", &decode_apps); + } + if(decode_apps) { + node->next = la_acars_apps_parse_and_reassemble(msg->reg, msg->label, + msg->txt, msg_dir, rtables, rx_time); + } + } + goto end; +fail: + msg->err = true; +end: + LA_XFREE(buf2); + return node; +} + +la_proto_node *la_acars_parse(uint8_t const *buf, int len, la_msg_dir msg_dir) { + return la_acars_parse_and_reassemble(buf, len, msg_dir, NULL, + (struct timeval){ .tv_sec = 0, .tv_usec = 0 }); +} + +void la_acars_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_acars_msg const *msg = data; + if(msg->err) { + LA_ISPRINTF(vstr, indent, "-- Unparseable ACARS message\n"); + return; + } + LA_ISPRINTF(vstr, indent, "ACARS%s:\n", msg->crc_ok ? "" : " (warning: CRC error)"); + indent++; + + LA_ISPRINTF(vstr, indent, "Reassembly: %s\n", la_reasm_status_name_get(msg->reasm_status)); + LA_ISPRINTF(vstr, indent, "Reg: %s", msg->reg); + if(IS_DOWNLINK_BLK(msg->block_id)) { + la_vstring_append_sprintf(vstr, " Flight: %s\n", msg->flight_id); + } else { + la_vstring_append_sprintf(vstr, "%s", "\n"); + } + + LA_ISPRINTF(vstr, indent, "Mode: %1c Label: %s Blk id: %c More: %d Ack: %c", + msg->mode, msg->label, msg->block_id, !msg->final_block, msg->ack); + if(IS_DOWNLINK_BLK(msg->block_id)) { + la_vstring_append_sprintf(vstr, " Msg num: %s%c\n", msg->msg_num, msg->msg_num_seq); + } else { + la_vstring_append_sprintf(vstr, "%s", "\n"); + } + if(msg->sublabel[0] != '\0') { + LA_ISPRINTF(vstr, indent, "Sublabel: %s", msg->sublabel); + if(msg->mfi[0] != '\0') { + la_vstring_append_sprintf(vstr, " MFI: %s", msg->mfi); + } + la_vstring_append_sprintf(vstr, "%s", "\n"); + } + if(msg->txt[0] != '\0') { + bool prettify_xml = false; +#ifdef WITH_LIBXML2 + (void)la_config_get_bool("prettify_xml", &prettify_xml); + if(prettify_xml == true) { + xmlBufferPtr xmlbufptr = NULL; + if((xmlbufptr = la_prettify_xml(msg->txt)) != NULL) { + LA_ISPRINTF(vstr, indent, "Message (reformatted):\n"); + la_isprintf_multiline_text(vstr, indent + 1, (char *)xmlbufptr->content); + xmlBufferFree(xmlbufptr); + } else { + // Doesn't look like XML - print it as normal + prettify_xml = false; + } + } +#endif + if(prettify_xml == false) { + LA_ISPRINTF(vstr, indent, "Message:\n"); + la_isprintf_multiline_text(vstr, indent+1, msg->txt); + } + } +} + +void la_acars_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_acars_msg const *msg = data; + la_json_append_bool(vstr, "err", msg->err); + if(msg->err) { + return; + } + la_json_append_bool(vstr, "crc_ok", msg->crc_ok); + la_json_append_bool(vstr, "more", !msg->final_block); + la_json_append_string(vstr, "reg", msg->reg); + la_json_append_char(vstr, "mode", msg->mode); + la_json_append_string(vstr, "label", msg->label); + la_json_append_char(vstr, "blk_id", msg->block_id); + la_json_append_char(vstr, "ack", msg->ack); + if(IS_DOWNLINK_BLK(msg->block_id)) { + la_json_append_string(vstr, "flight", msg->flight_id); + la_json_append_string(vstr, "msg_num", msg->msg_num); + la_json_append_char(vstr, "msg_num_seq", msg->msg_num_seq); + } + if(msg->sublabel[0] != '\0') { + la_json_append_string(vstr, "sublabel", msg->sublabel); + } + if(msg->mfi[0] != '\0') { + la_json_append_string(vstr, "mfi", msg->mfi); + } + la_json_append_string(vstr, "msg_text", msg->txt); +} + +void la_acars_destroy(void *data) { + if(data == NULL) { + return; + } + la_acars_msg *msg = data; + LA_XFREE(msg->txt); + LA_XFREE(data); +} + +la_type_descriptor const la_DEF_acars_message = { + .format_text = la_acars_format_text, + .format_json = la_acars_format_json, + .json_key = "acars", + .destroy = la_acars_destroy +}; + +la_proto_node *la_proto_tree_find_acars(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_acars_message); +} diff --git a/plugins/inmarsat_support/aero/libacars/acars.h b/plugins/inmarsat_support/aero/libacars/acars.h new file mode 100644 index 000000000..57f7545de --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/acars.h @@ -0,0 +1,77 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_ACARS_H +#define LA_ACARS_H 1 +#include +#include +#include // la_proto_node, la_type_descriptor +#include // la_vstring +#include // la_reasm_ctx, la_reasm_status + +#ifdef __cplusplus +extern "C" { +#endif + +// Supported radio link types +// These are the allowed values of "acars_bearer" configuration option + +#define LA_ACARS_BEARER_INVALID 0 // do not use +#define LA_ACARS_BEARER_VHF 1 +#define LA_ACARS_BEARER_HFDL 2 +#define LA_ACARS_BEARER_SATCOM 3 + +#define LA_ACARS_BEARER_MIN 0 +#define LA_ACARS_BEARER_MAX 3 + +typedef struct { + bool crc_ok; + bool err; + bool final_block; + char mode; + char reg[8]; + char ack; + char label[3]; + char sublabel[3]; + char mfi[3]; + char block_id; + char msg_num[4]; + char msg_num_seq; + char flight_id[7]; + la_reasm_status reasm_status; + char *txt; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_acars_msg; + +// acars.c +extern la_type_descriptor const la_DEF_acars_message; +la_proto_node *la_acars_decode_apps(char const *label, + char const *txt, la_msg_dir msg_dir); +la_proto_node *la_acars_apps_parse_and_reassemble(char const *reg, + char const *label, char const *txt, la_msg_dir msg_dir, + la_reasm_ctx *rtables, struct timeval rx_time); +la_proto_node *la_acars_parse_and_reassemble(uint8_t const *buf, int len, la_msg_dir msg_dir, + la_reasm_ctx *rtables, struct timeval rx_time); +la_proto_node *la_acars_parse(uint8_t const *buf, int len, la_msg_dir msg_dir); +int la_acars_extract_sublabel_and_mfi(char const *label, la_msg_dir msg_dir, + char const *txt, int len, char *sublabel, char *mfi); +void la_acars_format_text(la_vstring *vstr, void const *data, int indent); +void la_acars_format_json(la_vstring *vstr, void const *data); +la_proto_node *la_proto_tree_find_acars(la_proto_node *root); +#ifdef __cplusplus +} +#endif +#endif // !LA_ACARS_H diff --git a/plugins/inmarsat_support/aero/libacars/adsc.c b/plugins/inmarsat_support/aero/libacars/adsc.c new file mode 100644 index 000000000..3d919c84d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/adsc.c @@ -0,0 +1,1828 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include // memcpy() +#include // pow(), trunc() +#include // la_debug_print +#include // la_dict +#include // la_bitstream_* +#include // la_msg_dir, la_proto_node, la_proto_tree_find_protocol +#include // la_arinc_imi +#include // la_list_* +#include // la_dict, la_dict_search(), LA_XCALLOC, LA_XFREE +#include // la_vstring, la_vstring_append_sprintf() +#include // la_json_object_*(), la_json_append_*() +#include + +static double la_adsc_coordinate_parse(uint32_t c) { + // extend the 21-bit signed field to 32-bit signed int + struct { signed int coord:21; } s; + int r = s.coord = (int)c; + la_debug_print(D_INFO, "r=%d\n", r); + // Field range is -180 to 180 degrees. + // MSB weight is defined to have a weight of 90 degrees. + // LSB weight is therefore 90/(2^19). + // First, calculate maximum value of the field: + double result = (180.0-90.0/pow(2, 19)); + // Then multiply it by r/max_r + result *= (double)r; + result /= (double)0xfffff; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +static int la_adsc_altitude_parse(uint32_t a) { + struct { signed int alt:16; } s; + int result = s.alt = (int)a; + result *= 4; + la_debug_print(D_INFO, "result: %d\n", result); + return result; +} + +static double la_adsc_timestamp_parse(uint32_t t) { + double result = (double)t * 0.125; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +static double la_adsc_speed_parse(uint32_t s) { + double result = (double)s / 2.0; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +static int la_adsc_vert_speed_parse(uint32_t vs) { + struct { signed int vs:12; } s; + int result = s.vs = (int)vs; + result *= 16; + la_debug_print(D_INFO, "result: %d\n", result); + return result; +} + +static double la_adsc_distance_parse(uint32_t d) { + double result = (double)d / 8.0; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +static double la_adsc_heading_parse(uint32_t h) { + // Heading/track format is the same as latitude/longitude + // except that: + // - the field is 12-bit long (including sign bit) + // - LSB weight is 90/(2^10). + // FIXME: reduce this to a common function + struct { signed int hdg:12; } s; + int r = s.hdg = (int)h; + la_debug_print(D_INFO, "r=%d\n", r); + double result = (180.0-90.0/pow(2, 10)); + result *= (double)r; + result /= (double)0x7ff; + if(result < 0.0) + result += 360.0; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +static double la_adsc_wind_dir_parse(uint32_t w) { + // Wind direction format is the same as latitude/longitude + // except that: + // - the field is 9-bit long (including sign bit) + // - LSB weight is 90/(2^7). + struct { signed int dir:9; } s; + int r = s.dir = (int)w; + la_debug_print(D_INFO, "r=%d\n", r); + double result = (180.0-90.0/pow(2, 7)); + result *= (double)r; + result /= (double)0xff; + if(result < 0.0) + result += 360.0; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +static double la_adsc_temperature_parse(uint32_t t) { + struct { signed int temp:12; } s; + int r = s.temp = (int)t; + la_debug_print(D_INFO, "r=%d\n", r); + double result = (512.0-256.0/pow(2, 10)); + result *= (double)r; + result /= (double)0x7ff; + la_debug_print(D_INFO, "result: %f\n", result); + return result; +} + +#define LA_ADSC_CHECK_LEN(t, l, m) if((l) < (m)) { \ + la_debug_print(D_ERROR, "Truncated tag %u: len: %u < %u\n", (t), (l), (m)); \ + return -1; \ +} +#define LA_ADSC_PARSER_FUN(x) static int x(void *dest, uint8_t const *buf, uint32_t len) +#define LA_ADSC_FORMATTER_FUN(x) static void x(la_adsc_formatter_ctx_t *ctx, char const *label, void const *data) + +static int la_adsc_tag_parse(la_adsc_tag_t *t, la_dict const + *tag_descriptor_table, uint8_t const *buf, uint32_t len); + +/*************************************************** + * Prototypes of functions used in descriptor tables + ***************************************************/ + +LA_ADSC_PARSER_FUN(la_adsc_uint8_t_parse); +LA_ADSC_PARSER_FUN(la_adsc_contract_request_parse); +LA_ADSC_PARSER_FUN(la_adsc_reporting_interval_parse); +LA_ADSC_PARSER_FUN(la_adsc_lat_dev_change_parse); +LA_ADSC_PARSER_FUN(la_adsc_vspd_change_parse); +LA_ADSC_PARSER_FUN(la_adsc_alt_range_parse); +LA_ADSC_PARSER_FUN(la_adsc_acft_intent_group_parse); +LA_ADSC_PARSER_FUN(la_adsc_nack_parse); +LA_ADSC_PARSER_FUN(la_adsc_noncomp_notify_parse); +LA_ADSC_PARSER_FUN(la_adsc_basic_report_parse); +LA_ADSC_PARSER_FUN(la_adsc_flight_id_parse); +LA_ADSC_PARSER_FUN(la_adsc_predicted_route_parse); +LA_ADSC_PARSER_FUN(la_adsc_earth_air_ref_parse); +LA_ADSC_PARSER_FUN(la_adsc_intermediate_projection_parse); +LA_ADSC_PARSER_FUN(la_adsc_fixed_projection_parse); +LA_ADSC_PARSER_FUN(la_adsc_meteo_parse); +LA_ADSC_PARSER_FUN(la_adsc_airframe_id_parse); + +LA_ADSC_FORMATTER_FUN(la_adsc_empty_tag_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_tag_with_contract_number_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_contract_request_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_reporting_interval_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_lat_dev_change_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_vspd_change_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_alt_range_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_acft_intent_group_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_modulus_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_nack_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_dis_reason_code_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_noncomp_notify_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_basic_report_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_flight_id_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_predicted_route_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_earth_ref_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_air_ref_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_intermediate_projection_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_fixed_projection_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_meteo_format_text); +LA_ADSC_FORMATTER_FUN(la_adsc_airframe_id_format_text); + +LA_ADSC_FORMATTER_FUN(la_adsc_empty_tag_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_tag_with_contract_number_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_contract_request_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_reporting_interval_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_lat_dev_change_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_vspd_change_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_alt_range_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_acft_intent_group_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_modulus_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_nack_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_dis_reason_code_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_noncomp_notify_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_basic_report_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_flight_id_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_predicted_route_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_earth_ref_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_air_ref_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_intermediate_projection_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_fixed_projection_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_meteo_format_json); +LA_ADSC_FORMATTER_FUN(la_adsc_airframe_id_format_json); + +static void la_adsc_contract_request_destroy(void *data); +static void la_adsc_noncomp_notify_destroy(void *data); + +/***************** + * Downlink tags + *****************/ + +static la_dict const la_adsc_downlink_tag_descriptor_table[] = { + { + .id = 3, + .val = &(la_adsc_type_descriptor_t){ + .label = "Acknowledgement", + .json_key = "ack", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_tag_with_contract_number_format_text, + .format_json = la_adsc_tag_with_contract_number_format_json, + .destroy = NULL + } + }, + { + .id = 4, + .val = &(la_adsc_type_descriptor_t){ + .label = "Negative acknowledgement", + .json_key = "nack", + .parse = la_adsc_nack_parse, + .format_text = la_adsc_nack_format_text, + .format_json = la_adsc_nack_format_json, + .destroy = NULL + } + }, + { + .id = 5, + .val = &(la_adsc_type_descriptor_t){ + .label = "Noncompliance notification", + .json_key = "noncomp_notify", + .parse = la_adsc_noncomp_notify_parse, + .format_text = la_adsc_noncomp_notify_format_text, + .format_json = la_adsc_noncomp_notify_format_json, + .destroy = la_adsc_noncomp_notify_destroy + } + }, + { + .id = 6, + .val = &(la_adsc_type_descriptor_t){ + .label = "Cancel emergency mode", + .json_key = "cancel_emergency_mode", + .parse = NULL, + .format_text = la_adsc_empty_tag_format_text, + .format_json = la_adsc_empty_tag_format_json, + .destroy = NULL + } + }, + { + .id = 7, + .val = &(la_adsc_type_descriptor_t){ + .label = "Basic report", + .json_key = "basic_report", + .parse = la_adsc_basic_report_parse, + .format_text = la_adsc_basic_report_format_text, + .format_json = la_adsc_basic_report_format_json, + .destroy = NULL + } + }, + { + .id = 9, + .val = &(la_adsc_type_descriptor_t){ + .label = "Emergency basic report", + .json_key = "emerg_basic_report", + .parse = la_adsc_basic_report_parse, + .format_text = la_adsc_basic_report_format_text, + .format_json = la_adsc_basic_report_format_json, + .destroy = NULL + } + }, + { + .id = 10, + .val = &(la_adsc_type_descriptor_t){ + .label = "Lateral deviation change event", + .json_key = "lat_dev_change_event", + .parse = la_adsc_basic_report_parse, + .format_text = la_adsc_basic_report_format_text, + .format_json = la_adsc_basic_report_format_json, + .destroy = NULL + } + }, + { + .id = 12, + .val = &(la_adsc_type_descriptor_t){ + .label = "Flight ID data", + .json_key = "flight_id", + .parse = la_adsc_flight_id_parse, + .format_text = la_adsc_flight_id_format_text, + .format_json = la_adsc_flight_id_format_json, + .destroy = NULL + } + }, + { + .id = 13, + .val = &(la_adsc_type_descriptor_t){ + .label = "Predicted route", + .json_key = "predicted_route", + .parse = la_adsc_predicted_route_parse, + .format_text = la_adsc_predicted_route_format_text, + .format_json = la_adsc_predicted_route_format_json, + .destroy = NULL + } + }, + { + .id = 14, + .val = &(la_adsc_type_descriptor_t){ + .label = "Earth reference data", + .json_key = "earth_ref_data", + .parse = la_adsc_earth_air_ref_parse, + .format_text = la_adsc_earth_ref_format_text, + .format_json = la_adsc_earth_ref_format_json, + .destroy = NULL + } + }, + { + .id = 15, + .val = &(la_adsc_type_descriptor_t){ + .label = "Air reference data", + .json_key = "air_ref_data", + .parse = la_adsc_earth_air_ref_parse, + .format_text = la_adsc_air_ref_format_text, + .format_json = la_adsc_air_ref_format_json, + .destroy = NULL + } + }, + { + .id = 16, + .val = &(la_adsc_type_descriptor_t){ + .label = "Meteo data", + .json_key = "meteo_data", + .parse = la_adsc_meteo_parse, + .format_text = la_adsc_meteo_format_text, + .format_json = la_adsc_meteo_format_json, + .destroy = NULL + } + }, + { + .id = 17, + .val = &(la_adsc_type_descriptor_t){ + .label = "Airframe ID", + .json_key = "airframe_id", + .parse = la_adsc_airframe_id_parse, + .format_text = la_adsc_airframe_id_format_text, + .format_json = la_adsc_airframe_id_format_json, + .destroy = NULL + } + }, + { + .id = 18, + .val = &(la_adsc_type_descriptor_t){ + .label = "Vertical rate change event", + .json_key = "vspd_chg_event", + .parse = la_adsc_basic_report_parse, + .format_text = la_adsc_basic_report_format_text, + .format_json = la_adsc_basic_report_format_json, + .destroy = NULL + } + }, + { + .id = 19, + .val = &(la_adsc_type_descriptor_t){ + .label = "Altitude range event", + .json_key = "alt_range_event", + .parse = la_adsc_basic_report_parse, + .format_text = la_adsc_basic_report_format_text, + .format_json = la_adsc_basic_report_format_json, + .destroy = NULL + } + }, + { + .id = 20, + .val = &(la_adsc_type_descriptor_t){ + .label = "Waypoint change event", + .json_key = "wpt_change_event", + .parse = la_adsc_basic_report_parse, + .format_text = la_adsc_basic_report_format_text, + .format_json = la_adsc_basic_report_format_json, + .destroy = NULL + } + }, + { + .id = 22, + .val = &(la_adsc_type_descriptor_t){ + .label = "Intermediate projection", + .json_key = "intermediate_projection", + .parse = la_adsc_intermediate_projection_parse, + .format_text = la_adsc_intermediate_projection_format_text, + .format_json = la_adsc_intermediate_projection_format_json, + .destroy = NULL + } + }, + { + .id = 23, + .val = &(la_adsc_type_descriptor_t){ + .label = "Fixed projection", + .json_key = "fixed_projection", + .parse = la_adsc_fixed_projection_parse, + .format_text = la_adsc_fixed_projection_format_text, + .format_json = la_adsc_fixed_projection_format_json, + .destroy = NULL + } + }, + { + .id = 255, // Fake tag for reason code in DIS message + .val = &(la_adsc_type_descriptor_t){ + .label = "Reason", + .json_key = "reason", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_dis_reason_code_format_text, + .format_json = la_adsc_dis_reason_code_format_json, + .destroy = NULL + } + }, + { + .id = 0, + .val = NULL + } +}; + +/************************** + * Downlink tag destructors + **************************/ + +static void la_adsc_noncomp_notify_destroy(void *data) { + if(data == NULL) + return; + la_adsc_noncomp_notify_t *n = data; + LA_XFREE(n->groups); + LA_XFREE(data); + return; +} + +/********************** + * Downlink tag parsers + **********************/ + +#define LA_BS_READ_OR_RETURN(bs, dest, len, ret) \ + if(la_bitstream_read_word_msbfirst(bs, dest, len) < 0) { return ret; } + +LA_ADSC_PARSER_FUN(la_adsc_nack_parse) { + uint32_t tag_len = 2; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_nack_t, n); + + n->contract_req_num = buf[0]; + if(buf[1] > LA_ADSC_NACK_MAX_REASON_CODE) { + la_debug_print(D_ERROR, "Invalid reason code: %u\n", buf[1]); + goto fail; + } + n->reason = buf[1]; + la_debug_print(D_INFO, "reason: %u\n", n->reason); + + // these reason codes have extended data byte + if(buf[1] == 1 || buf[1] == 2 || buf[1] == 7) { + tag_len++; + if(len < tag_len) { + la_debug_print(D_ERROR, "Truncated tag %u: len: %u < %u\n", t->tag, len, tag_len); + goto fail; + } + n->ext_data = buf[2]; + la_debug_print(D_INFO, "ext_data: %u\n", n->ext_data); + } + t->data = n; + return tag_len; +fail: + LA_XFREE(n); + return -1; +} + +LA_ADSC_PARSER_FUN(la_adsc_noncomp_group_parse) { + uint32_t tag_len = 2; + la_adsc_noncomp_group_t *g = dest; + if(len < tag_len) { + la_debug_print(D_ERROR, "too short: %u < %u\n", len, tag_len); + return -1; + } + + g->noncomp_tag = buf[0]; + g->is_unrecognized = (buf[1] & 0x80) ? 1 : 0; + g->is_whole_group_unavail = (buf[1] & 0x40) ? 1 : 0; + la_debug_print(D_INFO, "tag: %u unrecognized: %u whole_group: %u\n", + g->noncomp_tag, g->is_unrecognized, g->is_whole_group_unavail); + + if(g->is_unrecognized || g->is_whole_group_unavail) { + return tag_len; + } + g->param_cnt = buf[1] & 0xf; + la_debug_print(D_INFO, "param_cnt: %u\n", g->param_cnt); + if(g->param_cnt == 0) { + return tag_len; + } + + // following octets contain 4-bit numbers of non-compliant parameters (up to 15) + tag_len += g->param_cnt / 2 + g->param_cnt % 2; + la_debug_print(D_INFO, "new tag_len: %u\n", tag_len); + if(len < tag_len) { + la_debug_print(D_ERROR, "too short: %u < %u\n", len, tag_len); + return -1; + } + buf += 2; len -= 2; + for(int i = 0; i < g->param_cnt; i++) { + // store nibbles separately + g->params[i] = (*buf >> (((i + 1) % 2) * 4)) & 0xf; + buf += i % 2; len -= i % 2; + } + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_noncomp_notify_parse) { + uint32_t tag_len = 2; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_noncomp_notify_t, n); + t->data = n; + + n->contract_req_num = buf[0]; + n->group_cnt = buf[1]; + if(n->group_cnt == 0) { + return tag_len; + } + la_debug_print(D_INFO, "group_cnt: %u\n", n->group_cnt); + n->groups = LA_XCALLOC(n->group_cnt, sizeof(la_adsc_noncomp_group_t)); + buf += 2; len -= 2; + int consumed_bytes = 0; + for(uint8_t i = 0; i < n->group_cnt; i++) { + la_debug_print(D_INFO, "Remaining length: %u\n", len); + if((consumed_bytes = la_adsc_noncomp_group_parse(n->groups + i, buf, len)) < 0) { + return -1; + } + buf += consumed_bytes; len -= consumed_bytes; + tag_len += consumed_bytes; + if(len == 0) { + if(i < n->group_cnt - 1) { + la_debug_print(D_ERROR, "truncated: read %u/%u groups\n", i + 1, n->group_cnt); + return -1; + } else { + break; // parsing completed + } + } + } + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_basic_report_parse) { + uint32_t tag_len = 10; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_basic_report_t, r); + t->data = r; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + + uint32_t tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + r->lat = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + r->lon = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 16, -1); + r->alt = la_adsc_altitude_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 15, -1); + r->timestamp = la_adsc_timestamp_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 7, -1); + r->redundancy = (uint8_t)(tmp & 1); + r->accuracy = (uint8_t)((tmp >> 1) & 0x7); + r->tcas_health = (uint8_t)((tmp >> 4) & 1); + la_debug_print(D_INFO, "redundancy: %u accuracy: %u TCAS: %u\n", + r->redundancy, r->accuracy, r->tcas_health); + + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_flight_id_parse) { + uint32_t tag_len = 6; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_flight_id_t, f); + t->data = f; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + uint32_t tmp = 0; + for(size_t i = 0; i < sizeof(f->id) - 1; i++) { + // ISO5 alphabet on 6 bits, valid characters: A-Z, 0-9, space + // (00) 10 0000 - space + // (01) 0x xxxx - A-Z + // (00) 11 xxxx - 0-9 + LA_BS_READ_OR_RETURN(bs, &tmp, 6, -1); + if((tmp & 0x20) == 0) + tmp += 0x40; + f->id[i] = (uint8_t)tmp; + } + f->id[sizeof(f->id) - 1] = '\0'; + la_debug_print(D_INFO, "%s\n", f->id); + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_predicted_route_parse) { + uint32_t tag_len = 17; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_predicted_route_t, r); + t->data = r; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + + uint32_t tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + r->lat_next = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + r->lon_next = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 16, -1); + r->alt_next = la_adsc_altitude_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 14, -1); + r->eta_next = tmp; + la_debug_print(D_INFO, "eta: %d\n", r->eta_next); + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + r->lat_next_next = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + r->lon_next_next = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 16, -1); + r->alt_next_next = la_adsc_altitude_parse(tmp); + + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_earth_air_ref_parse) { + uint32_t tag_len = 5; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_earth_air_ref_t, r); + t->data = r; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + + uint32_t tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 1, -1); + r->heading_invalid = tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 12, -1); + r->heading = la_adsc_heading_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 13, -1); + r->speed = la_adsc_speed_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 12, -1); + r->vert_speed = la_adsc_vert_speed_parse(tmp); + + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_intermediate_projection_parse) { + uint32_t tag_len = 8; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_intermediate_projection_t, p); + t->data = p; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + + uint32_t tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 16, -1); + p->distance = la_adsc_distance_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 1, -1); + p->track_invalid = tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 12, -1); + p->track = la_adsc_heading_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 16, -1); + p->alt = la_adsc_altitude_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 14, -1); + p->eta = tmp; + la_debug_print(D_INFO, "eta: %d\n", p->eta); + + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_fixed_projection_parse) { + uint32_t tag_len = 9; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_fixed_projection_t, p); + t->data = p; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + + uint32_t tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + p->lat = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 21, -1); + p->lon = la_adsc_coordinate_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 16, -1); + p->alt = la_adsc_altitude_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 14, -1); + p->eta = tmp; + la_debug_print(D_INFO, "eta: %d\n", p->eta); + + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_meteo_parse) { + uint32_t tag_len = 4; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_meteo_t, m); + t->data = m; + + la_bitstream_t *bs = la_bitstream_init(tag_len * 8); + if(la_bitstream_append_msbfirst(bs, buf, tag_len, 8) < 0) { + return -1; + } + + uint32_t tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 9, -1); + m->wind_speed = la_adsc_speed_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 1, -1); + m->wind_dir_invalid = tmp; + LA_BS_READ_OR_RETURN(bs, &tmp, 9, -1); + m->wind_dir = la_adsc_wind_dir_parse(tmp); + LA_BS_READ_OR_RETURN(bs, &tmp, 12, -1); + m->temp = la_adsc_temperature_parse(tmp); + + la_bitstream_destroy(bs); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_airframe_id_parse) { + uint32_t tag_len = 3; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_airframe_id_t, a); + t->data = a; + + memcpy(a->icao_hex, buf, tag_len); + return tag_len; +} + +/************************* + * Downlink tag formatters + *************************/ + +LA_ADSC_FORMATTER_FUN(la_adsc_nack_format_text) { + static char const *reason_code_table[LA_ADSC_NACK_MAX_REASON_CODE+1] = { + [0] = NULL, + [1] = "Duplicate group tag", + [2] = "Duplicate reporting interval tag", + [3] = "Event contract request with no data", + [4] = "Improper operational mode tag", + [5] = "Cancel request of a contract which does not exist", + [6] = "Requested contract already exists", + [7] = "Undefined contract request tag", + [8] = "Undefined error", + [9] = "Not enough data in request", + [10] = "Invalid altitude range: low limit >= high limit", + [11] = "Vertical speed threshold is 0", + [12] = "Aircraft intent projection time is 0", + [13] = "Lateral deviation threshold is 0" + }; + la_adsc_nack_t const *n = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Contract request number: %u\n", n->contract_req_num); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Reason: %u (%s)\n", n->reason, reason_code_table[n->reason]); + if(n->reason == 1 || n->reason == 2) { + LA_ISPRINTF(ctx->vstr, ctx->indent, "Erroneous octet number: %u\n", n->ext_data); + } else if(n->reason == 7) { + LA_ISPRINTF(ctx->vstr, ctx->indent, "Erroneous tag number: %u\n", n->ext_data); + } + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_nack_format_json) { + LA_UNUSED(label); + la_adsc_nack_t const *n = data; + la_json_append_int64(ctx->vstr, "contract_req_num", n->contract_req_num); + la_json_append_int64(ctx->vstr, "reason", n->reason); + if(n->reason == 1 || n->reason == 2) { + la_json_append_int64(ctx->vstr, "err_octet", n->ext_data); + } else if(n->reason == 7) { + la_json_append_int64(ctx->vstr, "err_tag", n->ext_data); + } +} + +LA_ADSC_FORMATTER_FUN(la_adsc_dis_reason_code_format_text) { + static la_dict const dis_reason_code_table[] = { + { 0, "reason not specified" }, + { 1, "congestion" }, + { 2, "application not available" }, + { 8, "normal disconnect" }, + { 0, NULL } + }; + uint8_t const *rc = data; + int reason = (int)(*rc >> 4); + char *descr = la_dict_search(dis_reason_code_table, reason); + if(descr) { + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s: %s\n", label, descr); + } else { + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s: unknown (%d)\n", label, reason); + } +} + +LA_ADSC_FORMATTER_FUN(la_adsc_dis_reason_code_format_json) { + LA_UNUSED(label); + uint8_t const *rc = data; + int reason = (int)(*rc >> 4); + la_json_append_int64(ctx->vstr, "reason_code", reason); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_noncomp_group_format_text) { + LA_UNUSED(label); + la_adsc_noncomp_group_t const *g = data; + + LA_ISPRINTF(ctx->vstr, ctx->indent, "Tag %u:\n", g->noncomp_tag); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s", + g->is_unrecognized ? "Unrecognized group" : + (g->is_whole_group_unavail ? "Unavailable group" : "Unavailable parameters: ") + ); + if(!g->is_unrecognized && !g->is_whole_group_unavail && g->param_cnt > 0) { + for(int i = 0; i < g->param_cnt; i++) { + la_vstring_append_sprintf(ctx->vstr, "%d ", g->params[i]); + } + } + la_vstring_append_sprintf(ctx->vstr, "\n"); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_noncomp_group_format_json) { + LA_UNUSED(label); + la_adsc_noncomp_group_t const *g = data; + + la_json_append_int64(ctx->vstr, "noncomp_tag", g->noncomp_tag); + la_json_append_string(ctx->vstr, "noncomp_cause", + g->is_unrecognized ? "group_unrecognized" : + (g->is_whole_group_unavail ? "group_unavailable" : "params_unavailable")); + if(!g->is_unrecognized && !g->is_whole_group_unavail) { + la_json_array_start(ctx->vstr, "params"); + if(g->param_cnt > 0) { + for(int i = 0; i < g->param_cnt; i++) { + la_json_append_int64(ctx->vstr, NULL, g->params[i]); + } + } + la_json_array_end(ctx->vstr); + } +} + +LA_ADSC_FORMATTER_FUN(la_adsc_noncomp_notify_format_text) { + la_adsc_noncomp_notify_t const *n = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Contract number: %u\n", n->contract_req_num); + if(n->group_cnt > 0) { + for(int i = 0; i < n->group_cnt; i++) { + la_adsc_noncomp_group_format_text(ctx, NULL, n->groups + i); + } + } + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_noncomp_notify_format_json) { + LA_UNUSED(label); + la_adsc_noncomp_notify_t const *n = data; + la_json_append_int64(ctx->vstr, "contract_req_num", n->contract_req_num); + la_json_array_start(ctx->vstr, "msg_groups"); + if(n->group_cnt > 0) { + for(int i = 0; i < n->group_cnt; i++) { + la_json_object_start(ctx->vstr, NULL); + la_adsc_noncomp_group_format_json(ctx, NULL, n->groups + i); + la_json_object_end(ctx->vstr); + } + } + la_json_array_end(ctx->vstr); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_basic_report_format_text) { + static char const *accuracy_table[] = { + [0] = "none (NAV capability lost)", + [1] = "<30 nm", + [2] = "<15 nm", + [3] = "<8 nm", + [4] = "<4 nm", + [5] = "<1 nm", + [6] = "<0.25 nm", + [7] = "<0.05 nm" + }; + static char const *redundancy_state_table[] = { + [0] = "lost", + [1] = "OK" + }; + static char const *tcas_state_table[] = { + [0] = "not available to ADS", + [1] = "OK" + }; + la_adsc_basic_report_t const *r = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lat: %.7f\n", r->lat); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lon: %.7f\n", r->lon); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Alt: %d ft\n", r->alt); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Time: %.3f sec past hour (:%02.0f:%06.3f)\n", + r->timestamp, + trunc(r->timestamp / 60.0), + r->timestamp - 60.0 * trunc(r->timestamp / 60.0) + ); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Position accuracy: %s\n", accuracy_table[r->accuracy]); + LA_ISPRINTF(ctx->vstr, ctx->indent, "NAV unit redundancy: %s\n", redundancy_state_table[r->redundancy]); + LA_ISPRINTF(ctx->vstr, ctx->indent, "TCAS: %s\n", tcas_state_table[r->tcas_health]); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_basic_report_format_json) { + LA_UNUSED(label); + static float const accuracy_table[] = { + [0] = -1.0f, // NAV capability lost + [1] = 30.0f, // less than 30 nm + [2] = 15.0f, // ... etc. + [3] = 8.0f, + [4] = 4.0f, + [5] = 1.0f, + [6] = 0.25f, + [7] = 0.05f + }; + static bool const redundancy_state_table[] = { + [0] = false, + [1] = true + }; + static char const tcas_state_table[] = { + [0] = false, + [1] = true + }; + la_adsc_basic_report_t const *r = data; + + la_json_append_double(ctx->vstr, "lat", r->lat); + la_json_append_double(ctx->vstr, "lon", r->lon); + la_json_append_int64(ctx->vstr, "alt", r->alt); + la_json_append_double(ctx->vstr, "ts_sec", r->timestamp); + la_json_append_double(ctx->vstr, "pos_accuracy_nm", accuracy_table[r->accuracy]); + la_json_append_bool(ctx->vstr, "nav_redundancy", redundancy_state_table[r->redundancy]); + la_json_append_bool(ctx->vstr, "tcas_avail", tcas_state_table[r->tcas_health]); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_flight_id_format_text) { + la_adsc_flight_id_t const *f = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Flight ID: %s\n", f->id); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_flight_id_format_json) { + LA_UNUSED(label); + la_adsc_flight_id_t const *f = data; + la_json_append_string(ctx->vstr, "flight_id", f->id); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_predicted_route_format_text) { + la_adsc_predicted_route_t const *r = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Next waypoint:\n"); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lat: %.7f\n", r->lat_next); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lon: %.7f\n", r->lon_next); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Alt: %d ft\n", r->alt_next); + LA_ISPRINTF(ctx->vstr, ctx->indent, "ETA: %d sec\n", r->eta_next); + ctx->indent--; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Next+1 waypoint:\n"); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lat: %.7f\n", r->lat_next_next); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lon: %.7f\n", r->lon_next_next); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Alt: %d ft\n", r->alt_next_next); + ctx->indent--; + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_predicted_route_format_json) { + LA_UNUSED(label); + la_adsc_predicted_route_t const *r = data; + la_json_object_start(ctx->vstr, "next_wpt"); + la_json_append_double(ctx->vstr, "lat", r->lat_next); + la_json_append_double(ctx->vstr, "lon", r->lon_next); + la_json_append_int64(ctx->vstr, "alt", r->alt_next); + la_json_append_int64(ctx->vstr, "eta_sec", r->eta_next); + la_json_object_end(ctx->vstr); + la_json_object_start(ctx->vstr, "next_next_wpt"); + la_json_append_double(ctx->vstr, "lat", r->lat_next_next); + la_json_append_double(ctx->vstr, "lon", r->lon_next_next); + la_json_append_int64(ctx->vstr, "alt", r->alt_next_next); + la_json_object_end(ctx->vstr); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_earth_ref_format_text) { + la_adsc_earth_air_ref_t const *r = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "True track: %.1f deg%s\n", r->heading, r->heading_invalid ? " (invalid)" : ""); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Ground speed: %.1f kt\n", r->speed); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Vertical speed: %d ft/min\n", r->vert_speed); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_earth_ref_format_json) { + LA_UNUSED(label); + la_adsc_earth_air_ref_t const *r = data; + la_json_append_double(ctx->vstr, "true_trk_deg", r->heading); + la_json_append_bool(ctx->vstr, "true_trk_valid", r->heading_invalid ? false : true); + la_json_append_double(ctx->vstr, "gnd_spd_kts", r->speed); + la_json_append_int64(ctx->vstr, "vspd_ftmin", r->vert_speed); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_air_ref_format_text) { + la_adsc_earth_air_ref_t const *r = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "True heading: %.1f deg%s\n", r->heading, r->heading_invalid ? " (invalid)" : ""); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Mach speed: %.4f\n", r->speed / 1000.0); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Vertical speed: %d ft/min\n", r->vert_speed); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_air_ref_format_json) { + LA_UNUSED(label); + la_adsc_earth_air_ref_t const *r = data; + la_json_append_double(ctx->vstr, "true_hdg_deg", r->heading); + la_json_append_bool(ctx->vstr, "true_hdg_valid", r->heading_invalid ? false : true); + la_json_append_double(ctx->vstr, "spd_mach", r->speed / 1000.0); + la_json_append_double(ctx->vstr, "vspd_ftmin", r->vert_speed); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_intermediate_projection_format_text) { + la_adsc_intermediate_projection_t const *p = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Distance: %.3f nm\n", p->distance); + LA_ISPRINTF(ctx->vstr, ctx->indent, "True track: %.1f deg%s\n", p->track, p->track_invalid ? " (invalid)" : ""); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Alt: %d ft\n", p->alt); + LA_ISPRINTF(ctx->vstr, ctx->indent, "ETA: %d sec\n", p->eta); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_intermediate_projection_format_json) { + LA_UNUSED(label); + la_adsc_intermediate_projection_t const *p = data; + la_json_append_double(ctx->vstr, "dist_nm", p->distance); + la_json_append_double(ctx->vstr, "true_trk_deg", p->track); + la_json_append_bool(ctx->vstr, "true_trk_valid", p->track_invalid ? false : true); + la_json_append_int64(ctx->vstr, "alt", p->alt); + la_json_append_int64(ctx->vstr, "eta_sec", p->eta); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_fixed_projection_format_text) { + la_adsc_fixed_projection_t const *p = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lat: %.7f\n", p->lat); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Lon: %.7f\n", p->lon); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Alt: %d ft\n", p->alt); + LA_ISPRINTF(ctx->vstr, ctx->indent, "ETA: %d sec\n", p->eta); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_fixed_projection_format_json) { + LA_UNUSED(label); + la_adsc_fixed_projection_t const *p = data; + la_json_append_double(ctx->vstr, "lat", p->lat); + la_json_append_double(ctx->vstr, "lon", p->lon); + la_json_append_int64(ctx->vstr, "alt", p->alt); + la_json_append_int64(ctx->vstr, "eta_sec", p->eta); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_meteo_format_text) { + la_adsc_meteo_t const *m = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Wind speed: %.1f kt\n", m->wind_speed); + LA_ISPRINTF(ctx->vstr, ctx->indent, "True wind direction: %.1f deg%s\n", m->wind_dir, m->wind_dir_invalid ? " (invalid)" : ""); + LA_ISPRINTF(ctx->vstr, ctx->indent, "Temperature: %.2f C\n", m->temp); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_meteo_format_json) { + LA_UNUSED(label); + la_adsc_meteo_t const *m = data; + la_json_append_double(ctx->vstr, "wind_spd_kts", m->wind_speed); + la_json_append_double(ctx->vstr, "wind_dir_true_deg", m->wind_dir); + la_json_append_bool(ctx->vstr, "wind_dir_valid", m->wind_dir_invalid ? false : true); + la_json_append_double(ctx->vstr, "temp_c", m->temp); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_airframe_id_format_text) { + la_adsc_airframe_id_t const *a = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "ICAO ID: %02X%02X%02X\n", a->icao_hex[0], a->icao_hex[1], a->icao_hex[2]); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_airframe_id_format_json) { + LA_UNUSED(label); + la_adsc_airframe_id_t const *a = data; + la_json_append_int64(ctx->vstr, "icao_id", + ((long)(a->icao_hex[0]) << 16) | + ((long)(a->icao_hex[1]) << 8) | + (long)(a->icao_hex[2]) + ); +} + +/**************** + * Uplink tags + ****************/ + +static la_dict const la_adsc_uplink_tag_descriptor_table[] = { + { + .id = 1, + .val = &(la_adsc_type_descriptor_t){ + .label = "Cancel all contracts and terminate connection", + .json_key = "cancel_all_contracts", + .parse = NULL, + .format_text = la_adsc_empty_tag_format_text, + .format_json = la_adsc_empty_tag_format_json, + .destroy = NULL + } + }, + { + .id = 2, + .val = &(la_adsc_type_descriptor_t){ + .label = "Cancel contract", + .json_key = "cancel_contract", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_tag_with_contract_number_format_text, + .format_json = la_adsc_tag_with_contract_number_format_json, + .destroy = NULL + } + }, + { + .id = 6, + .val = &(la_adsc_type_descriptor_t){ + .label = "Cancel emergency mode", + .json_key = "cancel_emergency_mode", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_tag_with_contract_number_format_text, + .format_json = la_adsc_tag_with_contract_number_format_json, + .destroy = NULL + } + }, + { + .id = 7, + .val = &(la_adsc_type_descriptor_t){ + .label = "Periodic contract request", + .json_key = "periodic_contract_req", + .parse = la_adsc_contract_request_parse, + .format_text = la_adsc_contract_request_format_text, + .format_json = la_adsc_contract_request_format_json, + .destroy = la_adsc_contract_request_destroy + } + }, + { + .id = 8, + .val = &(la_adsc_type_descriptor_t){ + .label = "Event contract request", + .json_key = "event_contract_req", + .parse = la_adsc_contract_request_parse, + .format_text = la_adsc_contract_request_format_text, + .format_json = la_adsc_contract_request_format_json, + .destroy = la_adsc_contract_request_destroy + } + }, + { + .id = 9, + .val = &(la_adsc_type_descriptor_t){ + .label = "Emergency periodic contract request", + .json_key = "emerg_periodic_contract_req", + .parse = la_adsc_contract_request_parse, + .format_text = la_adsc_contract_request_format_text, + .format_json = la_adsc_contract_request_format_json, + .destroy = la_adsc_contract_request_destroy + } + }, + { + .id = 0, + .val = NULL + } +}; + +static la_dict const la_adsc_request_tag_descriptor_table[] = { + { + .id = 10, + .val = &(la_adsc_type_descriptor_t){ + .label = "Report when lateral deviation exceeds", + .json_key = "report_when_lateral_dev_exceeds", + .parse = la_adsc_lat_dev_change_parse, + .format_text = la_adsc_lat_dev_change_format_text, + .format_json = la_adsc_lat_dev_change_format_json, + .destroy = NULL + } + }, + { + .id = 11, + .val = &(la_adsc_type_descriptor_t){ + .label = "Reporting interval", + .json_key = "report_interval", + .parse = la_adsc_reporting_interval_parse, + .format_text = la_adsc_reporting_interval_format_text, + .format_json = la_adsc_reporting_interval_format_json, + .destroy = NULL + } + }, + { + .id = 12, + .val = &(la_adsc_type_descriptor_t){ + .label = "Flight ID", + .json_key = "flight_id", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_modulus_format_text, + .format_json = la_adsc_modulus_format_json, + .destroy = NULL + } + }, + { + .id = 13, + .val = &(la_adsc_type_descriptor_t){ + .label = "Predicted route", + .json_key = "predicted_route", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_modulus_format_text, + .format_json = la_adsc_modulus_format_json, + .destroy = NULL + } + }, + { + .id = 14, + .val = &(la_adsc_type_descriptor_t){ + .label = "Earth reference data", + .json_key = "earth_ref_data", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_modulus_format_text, + .format_json = la_adsc_modulus_format_json, + .destroy = NULL + } + }, + { + .id = 15, + .val = &(la_adsc_type_descriptor_t){ + .label = "Air reference data", + .json_key = "air_ref_data", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_modulus_format_text, + .format_json = la_adsc_modulus_format_json, + .destroy = NULL + } + }, + { + .id = 16, + .val = &(la_adsc_type_descriptor_t){ + .label = "Meteo data", + .json_key = "meteo_data", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_modulus_format_text, + .format_json = la_adsc_modulus_format_json, + .destroy = NULL + } + }, + { + .id = 17, + .val = &(la_adsc_type_descriptor_t){ + .label = "Airframe ID", + .json_key = "airframe_id", + .parse = la_adsc_uint8_t_parse, + .format_text = la_adsc_modulus_format_text, + .format_json = la_adsc_modulus_format_json, + .destroy = NULL + } + }, + { + .id = 18, + .val = &(la_adsc_type_descriptor_t){ + .label = "Report when vertical speed is", + .json_key = "report_when_vspd_is", + .parse = la_adsc_vspd_change_parse, + .format_text = la_adsc_vspd_change_format_text, + .format_json = la_adsc_vspd_change_format_json, + .destroy = NULL + } + }, + { + .id = 19, + .val = &(la_adsc_type_descriptor_t){ + .label = "Report when altitude out of range", + .json_key = "report_when_alt_out_of_range", + .parse = la_adsc_alt_range_parse, + .format_text = la_adsc_alt_range_format_text, + .format_json = la_adsc_alt_range_format_json, + .destroy = NULL + } + }, + { + .id = 20, + .val = &(la_adsc_type_descriptor_t){ + .label = "Report waypoint changes", + .json_key = "report_wpt_changes", + .parse = NULL, + .format_text = la_adsc_empty_tag_format_text, + .format_json = la_adsc_empty_tag_format_json, + .destroy = NULL + } + }, + { + .id = 21, + .val = &(la_adsc_type_descriptor_t){ + .label = "Aircraft intent data", + .json_key = "acft_intent_data", + .parse = la_adsc_acft_intent_group_parse, + .format_text = la_adsc_acft_intent_group_format_text, + .format_json = la_adsc_acft_intent_group_format_json, + .destroy = NULL + } + }, + { + .id = 0, + .val = NULL + } +}; + +/***************** + * Tag destructors + *****************/ + +static void la_adsc_tag_destroy(void *tag) { + if(tag == NULL) + return; + la_adsc_tag_t *t = tag; + if(t->data == NULL || t->type == NULL) { + LA_XFREE(tag); + return; + } + if(t->type->destroy != NULL) + // simple types do not have any special destructors + // and can be freed directly + t->type->destroy(t->data); + else + LA_XFREE(t->data); + LA_XFREE(tag); +} + +static void la_adsc_contract_request_destroy(void *data) { + if(data == NULL) return; + la_adsc_req_t *r = data; + if(r->req_tag_list != NULL) { + la_list_free_full(r->req_tag_list, la_adsc_tag_destroy); + r->req_tag_list = NULL; + } + LA_XFREE(data); +} + +/**************** + * Tag formatters + ****************/ + +LA_ADSC_FORMATTER_FUN(la_adsc_empty_tag_format_text) { + LA_UNUSED(data); + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s\n", label); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_empty_tag_format_json) { + LA_UNUSED(label); + LA_UNUSED(data); + LA_UNUSED(ctx); + // NOOP +} + +LA_ADSC_FORMATTER_FUN(la_adsc_tag_with_contract_number_format_text) { + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Contract number: %u\n", *(uint8_t *)data); + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_tag_with_contract_number_format_json) { + LA_UNUSED(label); + la_json_append_int64(ctx->vstr, "contract_num", *(uint8_t *)data); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_modulus_format_text) { + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s: every %u reports\n", label, *(uint8_t *)data); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_modulus_format_json) { + LA_UNUSED(label); + la_json_append_int64(ctx->vstr, "modulus", *(uint8_t *)data); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_reporting_interval_format_text) { + la_adsc_report_interval_req_t const *t = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s: %d seconds\n", label, + (int)(t->scaling_factor) * ((int)(t->rate) + 1)); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_reporting_interval_format_json) { + LA_UNUSED(label); + la_adsc_report_interval_req_t const *t = data; + la_json_append_int64(ctx->vstr, "interval_secs", + (int)(t->scaling_factor) * ((int)(t->rate) + 1)); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_acft_intent_group_format_text) { + la_adsc_acft_intent_group_req_t const *t = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s: every %u reports, projection time: %u minutes\n", + label, t->modulus, t->acft_intent_projection_time); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_acft_intent_group_format_json) { + LA_UNUSED(label); + la_adsc_acft_intent_group_req_t const *t = data; + la_json_append_int64(ctx->vstr, "modulus", t->modulus); + la_json_append_int64(ctx->vstr, "proj_time_mins", t->acft_intent_projection_time); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_lat_dev_change_format_text) { + la_adsc_lat_dev_chg_event_t const *e = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, + "%s: %.3f nm\n", + label, + e->lat_dev_threshold + ); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_lat_dev_change_format_json) { + LA_UNUSED(label); + la_adsc_lat_dev_chg_event_t const *e = data; + la_json_append_double(ctx->vstr, "lat_dev_treshold_nm", e->lat_dev_threshold); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_vspd_change_format_text) { + la_adsc_vspd_chg_event_t const *e = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, + "%s: %c%d ft/min\n", + label, + e->vspd_threshold >= 0 ? '>' : '<', + abs(e->vspd_threshold) + ); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_vspd_change_format_json) { + LA_UNUSED(label); + la_adsc_vspd_chg_event_t const *e = data; + la_json_append_int64(ctx->vstr, "vspd_ftmin_threshold", abs(e->vspd_threshold)); + la_json_append_bool(ctx->vstr, "higher_than", e->vspd_threshold >= 0 ? true : false); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_alt_range_format_text) { + la_adsc_alt_range_event_t const *e = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, + "%s: %d-%d ft\n", + label, + e->floor_alt, + e->ceiling_alt + ); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_alt_range_format_json) { + LA_UNUSED(label); + la_adsc_alt_range_event_t const *e = data; + la_json_append_int64(ctx->vstr, "floor_alt", e->floor_alt); + la_json_append_int64(ctx->vstr, "ceiling_alt", e->ceiling_alt); +} + +LA_ADSC_FORMATTER_FUN(la_adsc_contract_request_format_text) { + la_adsc_req_t const *r = data; + LA_ISPRINTF(ctx->vstr, ctx->indent, "%s:\n", label); + ctx->indent++; + LA_ISPRINTF(ctx->vstr, ctx->indent, "Contract number: %u\n", r->contract_num); + + size_t len = la_list_length(r->req_tag_list); + if(len == 0) { + return; + } + for(la_list *ptr = r->req_tag_list; ptr != NULL; ptr = la_list_next(ptr)) { + la_adsc_tag_t *t = ptr->data; + if(!t->type) { + LA_ISPRINTF(ctx->vstr, ctx->indent, "-- Unparseable tag %u\n", t->tag); + break; + } + la_assert(t->type->format_text != NULL); + t->type->format_text(ctx, t->type->label, t->data); + } + ctx->indent--; +} + +LA_ADSC_FORMATTER_FUN(la_adsc_contract_request_format_json) { + LA_UNUSED(label); + la_adsc_req_t const *r = data; + la_json_append_int64(ctx->vstr, "contract_num", r->contract_num); + + size_t len = la_list_length(r->req_tag_list); + if(len == 0) { + return; + } + la_json_array_start(ctx->vstr, "groups"); + for(la_list *ptr = r->req_tag_list; ptr != NULL; ptr = la_list_next(ptr)) { + la_adsc_tag_t *t = ptr->data; + if(t->type == NULL || t->type->format_json == NULL || t->type->json_key == NULL) { + break; + } + la_json_object_start(ctx->vstr, NULL); + la_json_object_start(ctx->vstr, t->type->json_key); + t->type->format_json(ctx, NULL, t->data); + la_json_object_end(ctx->vstr); + la_json_object_end(ctx->vstr); + } + la_json_array_end(ctx->vstr); +} + +/************** + * Tag parsers + **************/ + +LA_ADSC_PARSER_FUN(la_adsc_uint8_t_parse) { + uint32_t tag_len = 1; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(uint8_t, ptr); + *ptr = buf[0]; + la_debug_print(D_INFO, "val=%u\n", *ptr); + t->data = ptr; + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_reporting_interval_parse) { + uint32_t tag_len = 1; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_report_interval_req_t, ri); + t->data = ri; + uint8_t sf = (buf[0] & 0xc0) >> 6; + // convert scaling factor to multiplier value + if(sf == 2) + sf = 8; + else if(sf == 3) + sf = 64; + ri->scaling_factor = sf; + ri->rate = buf[0] & 0x3f; + la_debug_print(D_INFO, "SF=%u rate=%u\n", ri->scaling_factor, ri->rate); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_lat_dev_change_parse) { + uint32_t tag_len = 1; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_lat_dev_chg_event_t, e); + t->data = e; + + e->lat_dev_threshold = (double)buf[0] / 8.0; + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_vspd_change_parse) { + uint32_t tag_len = 1; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_vspd_chg_event_t, e); + t->data = e; + + struct { signed int vt:8; } s; + e->vspd_threshold = s.vt = (int)buf[0]; + e->vspd_threshold *= 64; + la_debug_print(D_INFO, "result: %d\n", e->vspd_threshold); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_alt_range_parse) { + uint32_t tag_len = 4; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_alt_range_event_t, e); + t->data = e; + + uint32_t tmp = 0; + tmp = (buf[0] << 8) | buf[1]; + e->ceiling_alt = la_adsc_altitude_parse(tmp); + tmp = (buf[2] << 8) | buf[3]; + e->floor_alt = la_adsc_altitude_parse(tmp); + return tag_len; +} + +LA_ADSC_PARSER_FUN(la_adsc_acft_intent_group_parse) { + uint32_t tag_len = 2; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + LA_NEW(la_adsc_acft_intent_group_req_t, aig); + t->data = aig; + aig->modulus = buf[0]; + aig->acft_intent_projection_time = buf[1]; + la_debug_print(D_INFO, "modulus=%u projection_time=%u\n", aig->modulus, aig->acft_intent_projection_time); + return tag_len; +} + + +LA_ADSC_PARSER_FUN(la_adsc_contract_request_parse) { + uint32_t tag_len = 1; + la_adsc_tag_t *t = dest; + LA_ADSC_CHECK_LEN(t->tag, len, tag_len); + int consumed_bytes = 0; + LA_NEW(la_adsc_req_t, r); + t->data = r; + + r->contract_num = buf[0]; + buf++; len--; + + while(len > 0) { + la_debug_print(D_INFO, "Remaining length: %u\n", len); + // First lookup the tag value - if it's unknown, then it's probably a next request + // in a multi-request ADS message. We don't want la_adsc_tag_parse() to parse it, + // because we would get a nasty "-- Unparseable tag" error message in the output. + if(la_dict_search(la_adsc_request_tag_descriptor_table, (int)buf[0]) == NULL) { + la_debug_print(D_INFO, "Tag %d unknown - assuming end-of-request\n", (int)buf[0]); + break; + } + LA_NEW(la_adsc_tag_t, req_tag); + r->req_tag_list = la_list_append(r->req_tag_list, req_tag); + if((consumed_bytes = la_adsc_tag_parse(req_tag, la_adsc_request_tag_descriptor_table, buf, len)) < 0) { + return -1; + } + buf += consumed_bytes; len -= consumed_bytes; + tag_len += consumed_bytes; + } + return tag_len; +} + +static int la_adsc_tag_parse(la_adsc_tag_t *t, la_dict const + *tag_descriptor_table, uint8_t const *buf, uint32_t len) { + uint32_t tag_len = 1; + if(len < tag_len) { + la_debug_print(D_INFO, "Buffer len is 0\n"); + return -1; + } + + t->tag = buf[0]; + buf++; len--; + la_adsc_type_descriptor_t *type = la_dict_search(tag_descriptor_table, (int)t->tag); + if(type == NULL) { + la_debug_print(D_ERROR, "Unknown tag %u\n", t->tag); + return -1; + } + la_debug_print(D_INFO, "Found tag %u (%s)\n", t->tag, type->label); + int consumed_bytes = 0; + if(type->parse == NULL) { // tag is empty, no parsing required - return with success + goto end; + } + if((consumed_bytes = (*(type->parse))(t, buf, len)) < 0) { + return -1; + } +end: + tag_len += consumed_bytes; + t->type = type; + return tag_len; +} + +la_proto_node *la_adsc_parse(uint8_t const *buf, int len, la_msg_dir msg_dir, la_arinc_imi imi) { + if(buf == NULL) + return NULL; + + la_proto_node *node = la_proto_node_new(); + LA_NEW(la_adsc_msg_t, msg); + node->data = msg; + node->td = &la_DEF_adsc_message; + la_adsc_tag_t *tag = NULL; + int consumed_bytes; + + // Uplink and downlink tag values are the same, but their syntax is different. + // Figure out the dictionary to use based on the message direction. + static la_dict const *tag_table = NULL; + if(msg_dir == LA_MSG_DIR_GND2AIR) + tag_table = la_adsc_uplink_tag_descriptor_table; + else if(msg_dir == LA_MSG_DIR_AIR2GND) + tag_table = la_adsc_downlink_tag_descriptor_table; + la_assert(tag_table != NULL); + + msg->err = false; + switch(imi) { + case ARINC_MSG_ADS: + while(len > 0) { + la_debug_print(D_INFO, "Remaining length: %u\n", len); + tag = LA_XCALLOC(1, sizeof(la_adsc_tag_t)); + msg->tag_list = la_list_append(msg->tag_list, tag); + if((consumed_bytes = la_adsc_tag_parse(tag, tag_table, buf, len)) < 0) { + msg->err = true; + break; + } + buf += consumed_bytes; len -= consumed_bytes; + } + break; + case ARINC_MSG_DIS: + // DIS payload consists of an error code only, without any tag. + // Let's insert a fake tag value of 255. + if(len < 1) { + la_debug_print(D_ERROR, "DIS message too short\n"); + msg->err = true; + break; + } + tag = LA_XCALLOC(1, sizeof(la_adsc_tag_t)); + msg->tag_list = la_list_append(msg->tag_list, tag); + len = 2; + uint8_t *tmpbuf = LA_XCALLOC(len, sizeof(uint8_t)); + tmpbuf[0] = 255; + tmpbuf[1] = buf[0]; + if(la_adsc_tag_parse(tag, tag_table, tmpbuf, len) < 0) { + msg->err = true; + } + LA_XFREE(tmpbuf); + break; + default: + break; + } + return node; +} + +static void la_adsc_tag_output_text(void const *p, void *ctx) { + la_assert(p); + la_assert(ctx); + + la_adsc_tag_t const *t = p; + la_adsc_formatter_ctx_t *c = ctx; + if(!t->type) { + LA_ISPRINTF(c->vstr, c->indent, "-- Unparseable tag %u\n", t->tag); + return; + } + if(t->type->format_text != NULL) { + t->type->format_text(c, t->type->label, t->data); + } +} + +static void la_adsc_tag_output_json(void const *p, void *ctx) { + la_assert(p); + la_assert(ctx); + + la_adsc_tag_t const *t = p; + la_adsc_formatter_ctx_t *c = ctx; + if(!t->type) { + return; + } + if(t->type->format_json != NULL && t->type->json_key != NULL) { + // Every tags gets encapsulated in a separate anonymous object, + // so that correct JSON output is produced even if the message + // contains duplicate tags. + la_json_object_start(c->vstr, NULL); + la_json_object_start(c->vstr, t->type->json_key); + t->type->format_json(c, t->type->json_key, t->data); + la_json_object_end(c->vstr); + la_json_object_end(c->vstr); + } +} + +void la_adsc_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_adsc_msg_t const *msg = data; + la_adsc_formatter_ctx_t ctx = { + .vstr = vstr, + .indent = indent + }; + if(msg->tag_list == NULL) { + LA_ISPRINTF(ctx.vstr, ctx.indent, "-- Empty ADS-C message\n"); + return; + } + la_list_foreach(msg->tag_list, la_adsc_tag_output_text, &ctx); + if(msg->err == true) { + LA_ISPRINTF(ctx.vstr, ctx.indent, "-- Malformed ADS-C message\n"); + } +} + +void la_adsc_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_adsc_msg_t const *msg = data; + if(msg->tag_list == NULL) { + return; + } + la_adsc_formatter_ctx_t ctx = { + .vstr = vstr, + .indent = 0 // unused in JSON output + }; + la_json_array_start(vstr, "tags"); + la_list_foreach(msg->tag_list, la_adsc_tag_output_json, &ctx); + la_json_array_end(vstr); + la_json_append_bool(vstr, "err", msg->err); +} + +void la_adsc_destroy(void *data) { + if(data == NULL) { + return; + } + la_adsc_msg_t *msg = data; + la_list_free_full(msg->tag_list, la_adsc_tag_destroy); + msg->tag_list = NULL; + msg->err = false; + LA_XFREE(data); +} + +la_type_descriptor const la_DEF_adsc_message = { + .format_text = la_adsc_format_text, + .format_json = la_adsc_format_json, + .json_key = "adsc", + .destroy = la_adsc_destroy +}; + +la_proto_node *la_proto_tree_find_adsc(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_adsc_message); +} diff --git a/plugins/inmarsat_support/aero/libacars/adsc.h b/plugins/inmarsat_support/aero/libacars/adsc.h new file mode 100644 index 000000000..d25bd4a6b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/adsc.h @@ -0,0 +1,195 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_ADSC_H +#define LA_ADSC_H 1 + +#include +#include +#include // la_proto_node, la_type_descriptor +#include // la_arinc_imi +#include // la_list +#include // la_vstring + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + la_vstring *vstr; + int indent; +} la_adsc_formatter_ctx_t; + +typedef int(la_adsc_parser_fun)(void *dest, uint8_t const *buf, uint32_t len); +typedef void(la_adsc_formatter_fun)(la_adsc_formatter_ctx_t *ctx, char const *label, void const *data); +typedef void(la_adsc_destructor_fun)(void *data); + +typedef struct { + char const *label; + char const *json_key; + la_adsc_parser_fun *parse; + la_adsc_formatter_fun *format_text; + la_adsc_formatter_fun *format_json; + la_adsc_destructor_fun *destroy; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_adsc_type_descriptor_t; + +// ADS-C message +typedef struct { + bool err; + la_list *tag_list; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_adsc_msg_t; + +// generic tag structure +typedef struct { + uint8_t tag; + la_adsc_type_descriptor_t *type; + void *data; +} la_adsc_tag_t; + +// Downlink tag structures + +// negative acknowledgement (tag 4) +typedef struct { + uint8_t contract_req_num; + uint8_t reason; + uint8_t ext_data; +} la_adsc_nack_t; +#define LA_ADSC_NACK_MAX_REASON_CODE 13 + +// description of a single non-compliant message group contained in the above notification +typedef struct { + uint8_t noncomp_tag; /* non-compliant tag value */ + uint8_t is_unrecognized; /* 1 - group unrecognized, 0 - group unavailable */ + uint8_t is_whole_group_unavail; /* 1 - entire group is unavailable + 0 - one or more group params is unavailable */ + uint8_t param_cnt; /* number of unavailable params + (used when is_whole_group_noncompliant==0) */ + uint8_t params[15]; /* a table of non-compliant parameter numbers */ +} la_adsc_noncomp_group_t; + +// noncompliance notification (tag 5) +typedef struct { + uint8_t contract_req_num; // contract request number + uint8_t group_cnt; // number of non-compliant groups + la_adsc_noncomp_group_t *groups; // a table of non-compliant groups +} la_adsc_noncomp_notify_t; + +// basic ADS group (downlink tags: 7, 9, 10, 18, 19, 20) +typedef struct { + double lat, lon; + double timestamp; + int alt; + uint8_t redundancy, accuracy, tcas_health; +} la_adsc_basic_report_t; + +// flight ID group (tag 12) +typedef struct { + char id[9]; +} la_adsc_flight_id_t; + +// predicted route group (tag 13) +typedef struct { + double lat_next, lon_next; + double lat_next_next, lon_next_next; + int alt_next, alt_next_next; + int eta_next; +} la_adsc_predicted_route_t; + +// earth or air reference group (tags: 14, 15) +typedef struct { + double heading; + double speed; + int vert_speed; + uint8_t heading_invalid; +} la_adsc_earth_air_ref_t; + +// meteorological group (tag 16) +typedef struct { + double wind_speed; + double wind_dir; + double temp; + uint8_t wind_dir_invalid; +} la_adsc_meteo_t; + +// airframe ID group (tag 17) +typedef struct { + uint8_t icao_hex[3]; +} la_adsc_airframe_id_t; + +// intermediate projected intent group (tag 22) +typedef struct { + double distance; + double track; + int alt; + int eta; + uint8_t track_invalid; +} la_adsc_intermediate_projection_t; + +// fixed projected intent group (tag 23) +typedef struct { + double lat, lon; + int alt; + int eta; +} la_adsc_fixed_projection_t; + +// Uplink tag structures + +// periodic and event contract requests (tags: 7, 8, 9) +typedef struct { + uint8_t contract_num; // contract number + la_list *req_tag_list; // list of la_adsc_tag_t's describing requested report groups +} la_adsc_req_t; + +// lateral deviation change (uplink tag 10) +typedef struct { + double lat_dev_threshold; +} la_adsc_lat_dev_chg_event_t; + +// reporting interval (uplink tag 11) +typedef struct { + uint8_t scaling_factor; + uint8_t rate; +} la_adsc_report_interval_req_t; + +// vertical speed change threshold (uplink tag 18) +typedef struct { + int vspd_threshold; +} la_adsc_vspd_chg_event_t; + +// altitude range change event (uplink tag 19) +typedef struct { + int ceiling_alt, floor_alt; +} la_adsc_alt_range_event_t; + +// aircraft intent group (uplink tag 21) +typedef struct { + uint8_t modulus; + uint8_t acft_intent_projection_time; +} la_adsc_acft_intent_group_req_t; + +// adsc.c +extern la_type_descriptor const la_DEF_adsc_message; +la_proto_node *la_adsc_parse(uint8_t const *buf, int len, la_msg_dir msg_dir, la_arinc_imi imi); +void la_adsc_format_text(la_vstring *vstr, void const *data, int indent); +void la_adsc_format_json(la_vstring *vstr, void const *data); +void la_adsc_destroy(void *data); +la_proto_node *la_proto_tree_find_adsc(la_proto_node *root); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_ADSC_H diff --git a/plugins/inmarsat_support/aero/libacars/arinc.c b/plugins/inmarsat_support/aero/libacars/arinc.c new file mode 100644 index 000000000..18bce7afb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/arinc.c @@ -0,0 +1,256 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include // isupper(), isdigit() +#include // strstr() +#include // la_proto_node, la_proto_tree_find_protocol +#include // la_arinc_msg, LA_ARINC_IMI_CNT +#include // la_crc16_arinc() +#include // la_debug_print() +#include // la_vstring_append_sprintf() +#include // la_slurp_hexstring() +#include // la_json_append_*() +#include // la_adsc_parse() +#include // la_cpdlc_parse() + +#define LA_ARINC_IMI_LEN 3 +#define LA_ARINC_AIR_REG_LEN 7 +#define LA_ARINC_CRC_LEN 2 +#define LA_CRC_ARINC_GOOD 0x1D0Fu + +typedef enum { + ARINC_APP_TYPE_UNKNOWN = 0, + ARINC_APP_TYPE_CHARACTER, + ARINC_APP_TYPE_BINARY +} la_arinc_app_type; + +typedef struct { + char const *imi_string; + la_arinc_imi imi; +} la_arinc_imi_map; + +typedef struct { + la_arinc_app_type app_type; + char const *description; + char const *json_key; +} la_arinc_imi_props; + +static la_arinc_imi_map const imi_map[LA_ARINC_IMI_CNT] = { + { .imi_string = ".AT1", .imi = ARINC_MSG_AT1 }, + { .imi_string = ".CR1", .imi = ARINC_MSG_CR1 }, + { .imi_string = ".CC1", .imi = ARINC_MSG_CC1 }, + { .imi_string = ".DR1", .imi = ARINC_MSG_DR1 }, + { .imi_string = ".ADS", .imi = ARINC_MSG_ADS }, + { .imi_string = ".DIS", .imi = ARINC_MSG_DIS }, + { .imi_string = NULL, .imi = ARINC_MSG_UNKNOWN } +}; + +static la_arinc_imi_props const imi_props[LA_ARINC_IMI_CNT] = { + [ARINC_MSG_UNKNOWN] = { + .app_type = ARINC_APP_TYPE_UNKNOWN, + .description = "Unknown message type", + .json_key = "unknown" + }, + [ARINC_MSG_AT1] = { + .app_type = ARINC_APP_TYPE_BINARY, + .description = "FANS-1/A CPDLC Message", + .json_key = "fans1a_cpdlc_msg", + }, + [ARINC_MSG_CR1] = { + .app_type = ARINC_APP_TYPE_BINARY, + .description = "FANS-1/A CPDLC Connect Request", + .json_key = "fans1a_cpdlc_connect_request", + }, + [ARINC_MSG_CC1] = { + .app_type = ARINC_APP_TYPE_BINARY, + .description = "FANS-1/A CPDLC Connect Confirm", + .json_key = "fans1a_cpdlc_connect_confirm", + }, + [ARINC_MSG_DR1] = { + .app_type = ARINC_APP_TYPE_BINARY, + .description = "FANS-1/A CPDLC Disconnect Request", + .json_key = "fans1a_cpdlc_disconnect_request", + }, + [ARINC_MSG_ADS] = { + .app_type = ARINC_APP_TYPE_BINARY, + .description = "ADS-C message", + .json_key = "adsc_msg", + }, + [ARINC_MSG_DIS] = { + .app_type = ARINC_APP_TYPE_BINARY, + .description = "ADS-C disconnect request", + .json_key = "adsc_disconnect_request", + } +}; + +static bool is_numeric_or_uppercase(char const *str, size_t len) { + if(!str) return false; + for(size_t i = 0; i < len; i++) { + if((!isupper(str[i]) && !isdigit(str[i])) || str[i] == '\0') { + return false; + } + } + return true; +} + +static char *guess_arinc_msg_type(char const *txt, la_arinc_msg *msg) { + if(txt == NULL) { + return NULL; + } + la_assert(msg); + la_arinc_imi imi = ARINC_MSG_UNKNOWN; + + // H1 messages start with sublabel and MFI - these fields must be stripped + // before passing message text to this routine. This is done by + // la_acars_extract_sublabel_and_mfi(). In any case, message text + // must start with the ground address, optionally preceded by '/'. + if(txt[0] == '/') { + txt++; + } + + char *imi_ptr = NULL; + for(la_arinc_imi_map const *p = imi_map; ; p++) { + if(p->imi_string == NULL) break; + if((imi_ptr = strstr(txt, p->imi_string)) != NULL) { + imi = p->imi; + break; + } + } + if(imi == ARINC_MSG_UNKNOWN) { + la_debug_print(D_INFO, "No known IMI found\n"); + return NULL; + } + char *gs_addr = NULL; + size_t gs_addr_len = 0; + // Check for seven-character ground address ("AKLCDYA.AT1...") + if(imi_ptr - txt == 7) { + if(is_numeric_or_uppercase(imi_ptr - 7, 7)) { + gs_addr = imi_ptr - 7; + gs_addr_len = 7; + goto complete; + } + // Check for four-character ground address ("EDYY.AFN...") + } else if(imi_ptr - txt == 4) { + if(is_numeric_or_uppercase(imi_ptr - 4, 4)) { + gs_addr = imi_ptr - 4; + gs_addr_len = 4; + goto complete; + } + } + la_debug_print(D_ERROR, "IMI %d found but no GS address\n", imi); + return NULL; +complete: + msg->imi = imi; + memcpy(msg->gs_addr, gs_addr, gs_addr_len); + msg->gs_addr[gs_addr_len] = '\0'; + // Skip the dot before IMI and point to the start of the CRC-protected part + return imi_ptr + 1; +} + +static bool la_is_crc_ok(char const *text_part, uint8_t const *binary_part, size_t binary_part_len) { + // compute CRC over IMI+air_reg+binary_part_with_CRC + size_t buflen = LA_ARINC_IMI_LEN + LA_ARINC_AIR_REG_LEN + binary_part_len; + uint8_t *buf = LA_XCALLOC(buflen, sizeof(uint8_t)); + memcpy(buf, text_part, LA_ARINC_IMI_LEN + LA_ARINC_AIR_REG_LEN); + memcpy(buf + LA_ARINC_IMI_LEN + LA_ARINC_AIR_REG_LEN, binary_part, binary_part_len); + bool result = (la_crc16_arinc(buf, buflen, 0xFFFFu) == LA_CRC_ARINC_GOOD); + LA_XFREE(buf); + la_debug_print(D_INFO, "crc_ok? %d\n", result); + return result; +} + +la_proto_node *la_arinc_parse(char const *txt, la_msg_dir msg_dir) { + if(txt == NULL) { + return NULL; + } + LA_NEW(la_arinc_msg, msg); + la_proto_node *node = NULL; + la_proto_node *next_node = NULL; + + char *payload = guess_arinc_msg_type(txt, msg); + if(payload == NULL) { + goto cleanup; + } + + if(imi_props[msg->imi].app_type == ARINC_APP_TYPE_BINARY) { + size_t payload_len = strlen(payload); + if(payload_len < LA_ARINC_IMI_LEN + LA_ARINC_AIR_REG_LEN + LA_ARINC_CRC_LEN * 2) { + la_debug_print(D_ERROR, "payload too short: %zu\n", payload_len); + goto cleanup; + } + memcpy(msg->air_reg, payload + LA_ARINC_IMI_LEN, LA_ARINC_AIR_REG_LEN); + msg->air_reg[LA_ARINC_AIR_REG_LEN] = '\0'; + la_debug_print(D_INFO, "air_reg: %s\n", msg->air_reg); + uint8_t *buf = NULL; + size_t buflen = la_slurp_hexstring(payload + LA_ARINC_IMI_LEN + LA_ARINC_AIR_REG_LEN, &buf); + msg->crc_ok = la_is_crc_ok(payload, buf, buflen); + buflen -= LA_ARINC_CRC_LEN; // strip CRC + switch(msg->imi) { + case ARINC_MSG_CR1: + case ARINC_MSG_CC1: + case ARINC_MSG_DR1: + case ARINC_MSG_AT1: + next_node = la_cpdlc_parse(buf, buflen, msg_dir); + LA_XFREE(buf); + break; + case ARINC_MSG_ADS: + case ARINC_MSG_DIS: + next_node = la_adsc_parse(buf, buflen, msg_dir, msg->imi); + LA_XFREE(buf); + break; + default: + break; + } + } + + node = la_proto_node_new(); + node->data = msg; + node->td = &la_DEF_arinc_message; + node->next = next_node; + return node; +cleanup: + LA_XFREE(msg); + LA_XFREE(node); + return NULL; +} + +void la_arinc_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_arinc_msg const *msg = data; + LA_ISPRINTF(vstr, indent, "%s:\n", imi_props[msg->imi].description); + if(!msg->crc_ok) { + LA_ISPRINTF(vstr, indent + 1, "-- CRC check failed\n"); + } +} + +void la_arinc_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_arinc_msg const *msg = data; + la_json_append_string(vstr, "msg_type", imi_props[msg->imi].json_key); + if(msg->imi == ARINC_MSG_UNKNOWN) { + return; + } + la_json_append_bool(vstr, "crc_ok", msg->crc_ok); + la_json_append_string(vstr, "gs_addr", msg->gs_addr); + la_json_append_string(vstr, "air_addr", msg->air_reg); +} + +la_type_descriptor const la_DEF_arinc_message = { + .format_text = la_arinc_format_text, + .format_json = la_arinc_format_json, + .json_key = "arinc622", + .destroy = NULL +}; + +la_proto_node *la_proto_tree_find_arinc(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_arinc_message); +} diff --git a/plugins/inmarsat_support/aero/libacars/arinc.h b/plugins/inmarsat_support/aero/libacars/arinc.h new file mode 100644 index 000000000..59923e35e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/arinc.h @@ -0,0 +1,51 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_ARINC_H +#define LA_ARINC_H 1 + +#include +#include // la_type_descriptor, la_proto_node +#include // la_vstring + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + ARINC_MSG_UNKNOWN = 0, + ARINC_MSG_CR1, + ARINC_MSG_CC1, + ARINC_MSG_DR1, + ARINC_MSG_AT1, + ARINC_MSG_ADS, + ARINC_MSG_DIS +} la_arinc_imi; +#define LA_ARINC_IMI_CNT 7 + +typedef struct { + char gs_addr[8]; + char air_reg[8]; + la_arinc_imi imi; + bool crc_ok; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_arinc_msg; + +la_proto_node *la_arinc_parse(char const *txt, la_msg_dir msg_dir); +void la_arinc_format_text(la_vstring *vstr, void const *data, int indent); +void la_arinc_format_json(la_vstring *vstr, void const *data); +extern la_type_descriptor const la_DEF_arinc_message; +la_proto_node *la_proto_tree_find_arinc(la_proto_node *root); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_ARINC_H diff --git a/plugins/inmarsat_support/aero/libacars/asn1-format-common.c b/plugins/inmarsat_support/aero/libacars/asn1-format-common.c new file mode 100644 index 000000000..eb439a656 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-format-common.c @@ -0,0 +1,363 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include // asn_TYPE_descriptor_t, asn_sprintf +#include // OCTET_STRING_t +#include // asn_INTEGER_enum_map_t, asn_INTEGER2long() +#include // BIT_STRING_t +#include // BOOLEAN_t +#include // _fetch_present_idx() +#include // _A_CSET_FROM_VOID() +#include // LA_ASN1_FORMATTER_FUNC +#include // la_debug_print +#include // la_dict_search +#include // la_reverse +#include // la_vstring, la_vstring_append_sprintf(), LA_ISPRINTF +#include // la_json_*() + +char const *la_asn1_value2enum(asn_TYPE_descriptor_t *td, long value) { + if(td == NULL) return NULL; + asn_INTEGER_enum_map_t const *enum_map = INTEGER_map_value2enum(td->specifics, value); + if(enum_map == NULL) return NULL; + return enum_map->enum_name; +} + +void la_format_INTEGER_with_unit_as_text(la_asn1_formatter_params p, + char const *unit, double multiplier, int decimal_places) { + long const *val = p.sptr; + LA_ISPRINTF(p.vstr, p.indent, "%s: %.*f%s\n", p.label, decimal_places, (double)(*val) * multiplier, unit); +} + +void la_format_INTEGER_with_unit_as_json(la_asn1_formatter_params p, + char const *unit, double multiplier) { + long const *val = p.sptr; + la_json_object_start(p.vstr, p.label); + la_json_append_double(p.vstr, "val", (double)(*val) * multiplier); + la_json_append_string(p.vstr, "unit", unit); + la_json_object_end(p.vstr); +} + +void la_format_INTEGER_as_ENUM_as_text(la_asn1_formatter_params p, la_dict const *value_labels) { + long const *val = p.sptr; + char const *val_label = la_dict_search(value_labels, (int)(*val)); + if(val_label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s: %s\n", p.label, val_label); + } else { + LA_ISPRINTF(p.vstr, p.indent, "%s: %ld (unknown)\n", p.label, *val); + } +} + +void la_format_INTEGER_as_ENUM_as_json(la_asn1_formatter_params p, la_dict const *value_labels) { + long const *val = p.sptr; + la_json_object_start(p.vstr, p.label); + la_json_append_int64(p.vstr, "value", (int)(*val)); + char const *val_label = la_dict_search(value_labels, (int)(*val)); + if(val_label != NULL) { + la_json_append_string(p.vstr, "value_descr", val_label); + } + la_json_object_end(p.vstr); +} + +void la_format_CHOICE_as_text(la_asn1_formatter_params p, la_dict const *choice_labels, + la_asn1_formatter_func cb) { + asn_CHOICE_specifics_t *specs = p.td->specifics; + int present = _fetch_present_idx(p.sptr, specs->pres_offset, specs->pres_size); + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s:\n", p.label); + p.indent++; + } + if(choice_labels != NULL) { + char const *descr = la_dict_search(choice_labels, present); + if(descr != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s\n", descr); + } else { + LA_ISPRINTF(p.vstr, p.indent, "\n", present); + } + p.indent++; + } + if(present > 0 && present <= p.td->elements_count) { + asn_TYPE_member_t *elm = &p.td->elements[present-1]; + void const *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void const * const *)((char const *)p.sptr + elm->memb_offset); + if(!memb_ptr) { + LA_ISPRINTF(p.vstr, p.indent, "%s: \n", elm->name); + return; + } + } else { + memb_ptr = (void const *)((char const *)p.sptr + elm->memb_offset); + } + + p.td = elm->type; + p.sptr = memb_ptr; + cb(p); + } else { + LA_ISPRINTF(p.vstr, p.indent, "-- %s: value %d out of range\n", p.td->name, present); + } +} + +void la_format_CHOICE_as_json(la_asn1_formatter_params p, la_dict const *choice_labels, + la_asn1_formatter_func cb) { + asn_CHOICE_specifics_t const *specs = p.td->specifics; + int present = _fetch_present_idx(p.sptr, specs->pres_offset, specs->pres_size); + la_json_object_start(p.vstr, p.label); + if(choice_labels != NULL) { + char const *descr = la_dict_search(choice_labels, present); + la_json_append_string(p.vstr, "choice_label", descr != NULL ? descr : ""); + } + if(present > 0 && present <= p.td->elements_count) { + asn_TYPE_member_t *elm = &p.td->elements[present-1]; + void const *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void const * const *)((char const *)p.sptr + elm->memb_offset); + if(!memb_ptr) { + goto end; + } + } else { + memb_ptr = (void const *)((char const *)p.sptr + elm->memb_offset); + } + la_json_append_string(p.vstr, "choice", elm->name); + la_json_object_start(p.vstr, "data"); + p.td = elm->type; + p.sptr = memb_ptr; + cb(p); + la_json_object_end(p.vstr); + } +end: + la_json_object_end(p.vstr); +} + +void la_format_SEQUENCE_as_text(la_asn1_formatter_params p, la_asn1_formatter_func cb) { + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s:\n", p.label); + p.indent++; + } + la_asn1_formatter_params cb_p = p; + for(int edx = 0; edx < p.td->elements_count; edx++) { + asn_TYPE_member_t *elm = &p.td->elements[edx]; + void const *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void const * const *)((char const *)p.sptr + elm->memb_offset); + if(!memb_ptr) { + continue; + } + } else { + memb_ptr = (void const *)((char const *)p.sptr + elm->memb_offset); + } + cb_p.td = elm->type; + cb_p.sptr = memb_ptr; + cb(cb_p); + } +} + +// Prints ASN.1 SEQUENCE as JSON object. +// All fields in the sequence must have unique types (and p.labels), otherwise +// JSON keys will clash. +void la_format_SEQUENCE_as_json(la_asn1_formatter_params p, la_asn1_formatter_func cb) { + la_asn1_formatter_params cb_p = p; + la_json_object_start(p.vstr, p.label); + for(int edx = 0; edx < p.td->elements_count; edx++) { + asn_TYPE_member_t *elm = &p.td->elements[edx]; + void const *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void const * const *)((char const *)p.sptr + elm->memb_offset); + if(!memb_ptr) { + continue; + } + } else { + memb_ptr = (void const *)((char const *)p.sptr + elm->memb_offset); + } + cb_p.td = elm->type; + cb_p.sptr = memb_ptr; + cb(cb_p); + } + la_json_object_end(p.vstr); +} + +void la_format_SEQUENCE_OF_as_text(la_asn1_formatter_params p, la_asn1_formatter_func cb) { + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s:\n", p.label); + p.indent++; + } + asn_TYPE_member_t *elm = p.td->elements; + asn_anonymous_set_ const *list = _A_CSET_FROM_VOID(p.sptr); + for(int i = 0; i < list->count; i++) { + void const *memb_ptr = list->array[i]; + if(memb_ptr == NULL) { + continue; + } + p.td = elm->type; + p.sptr = memb_ptr; + cb(p); + } +} + +void la_format_SEQUENCE_OF_as_json(la_asn1_formatter_params p, la_asn1_formatter_func cb) { + la_json_array_start(p.vstr, p.label); + asn_TYPE_member_t *elm = p.td->elements; + asn_anonymous_set_ const *list = _A_CSET_FROM_VOID(p.sptr); + for(int i = 0; i < list->count; i++) { + void const *memb_ptr = list->array[i]; + if(memb_ptr == NULL) { + continue; + } + la_json_object_start(p.vstr, NULL); + p.td = elm->type; + p.sptr = memb_ptr; + cb(p); + la_json_object_end(p.vstr); + } + la_json_array_end(p.vstr); +} + +// Handles bit string up to 32 bits long. +// la_dict indices are bit numbers from 0 to bit_stream_len-1 +// Bit 0 is the MSB of the first octet in the buffer. +void la_format_BIT_STRING_as_text(la_asn1_formatter_params p, la_dict const *bit_labels) { + BIT_STRING_t const *bs = p.sptr; + la_debug_print(D_INFO, "buf len: %d bits_unused: %d\n", bs->size, bs->bits_unused); + uint32_t val = 0; + int truncated = 0; + int len = bs->size; + int bits_unused = bs->bits_unused; + + if(len > (int)sizeof(val)) { + la_debug_print(D_ERROR, "bit stream too long (%d octets), truncating to %zu octets\n", + len, sizeof(val)); + truncated = len - sizeof(val); + len = sizeof(val); + bits_unused = 0; + } + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s: ", p.label); + } + for(int i = 0; i < len; val = (val << 8) | bs->buf[i++]) + ; + la_debug_print(D_INFO, "val: 0x%08x\n", val); + val &= (~0u << bits_unused); // zeroize unused bits + if(val == 0) { + la_vstring_append_sprintf(p.vstr, "none\n"); + goto end; + } + val = la_reverse(val, len * 8); + bool first = true; + for(la_dict const *ptr = bit_labels; ptr->val != NULL; ptr++) { + uint32_t shift = (uint32_t)ptr->id; + if((val >> shift) & 1) { + la_vstring_append_sprintf(p.vstr, "%s%s", + (first ? "" : ", "), (char *)ptr->val); + first = false; + } + } + LA_EOL(p.vstr); +end: + if(truncated > 0) { + LA_ISPRINTF(p.vstr, p.indent, + "-- Warning: bit string too long (%d bits), truncated to %d bits\n", + bs->size * 8 - bs->bits_unused, len * 8); + } +} + +void la_format_BIT_STRING_as_json(la_asn1_formatter_params p, la_dict const *bit_labels) { + BIT_STRING_t const *bs = p.sptr; + la_debug_print(D_INFO, "buf len: %d bits_unused: %d\n", bs->size, bs->bits_unused); + uint32_t val = 0; + int len = bs->size; + int bits_unused = bs->bits_unused; + + if(len > (int)sizeof(val)) { + la_debug_print(D_ERROR, "bit stream too long (%d octets), truncating to %zu octets\n", + len, sizeof(val)); + len = sizeof(val); + bits_unused = 0; + } + la_json_array_start(p.vstr, p.label); + for(int i = 0; i < len; val = (val << 8) | bs->buf[i++]) + ; + la_debug_print(D_INFO, "val: 0x%08x\n", val); + val &= (~0u << bits_unused); // zeroize unused bits + if(val == 0) { + goto end; + } + val = la_reverse(val, len * 8); + for(la_dict const *ptr = bit_labels; ptr->val != NULL; ptr++) { + uint32_t shift = (uint32_t)ptr->id; + if((val >> shift) & 1) { + la_json_append_string(p.vstr, NULL, (char *)ptr->val); + } + } +end: + la_json_array_end(p.vstr); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_any_as_text) { + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s: ", p.label); + } else { + LA_ISPRINTF(p.vstr, p.indent, "%s", ""); + } + asn_sprintf(p.vstr, p.td, p.sptr, 1); + LA_EOL(p.vstr); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_any_as_string_as_json) { + la_vstring *tmp = la_vstring_new(); + asn_sprintf(tmp, p.td, p.sptr, 0); + la_json_append_octet_string_as_string(p.vstr, p.label, (uint8_t const *)tmp->str, tmp->len); + la_vstring_destroy(tmp, true); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_label_only_as_text) { + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s\n", p.label); + } +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_label_only_as_json) { + if(p.label != NULL) { + la_json_object_start(p.vstr, p.label); + la_json_object_end(p.vstr); + } +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_ENUM_as_text) { + long const value = *(long const *)p.sptr; + char const *s = la_asn1_value2enum(p.td, value); + if(s != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s: %s\n", p.label, s); + } else { + LA_ISPRINTF(p.vstr, p.indent, "%s: %ld\n", p.label, value); + } +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_ENUM_as_json) { + long const value = *(long const *)p.sptr; + char const *s = la_asn1_value2enum(p.td, value); + if(s != NULL) { + la_json_append_string(p.vstr, p.label, s); + } else { + la_json_append_int64(p.vstr, p.label, value); + } +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_long_as_json) { + long const *valptr = p.sptr; + la_json_append_int64(p.vstr, p.label, *valptr); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_bool_as_json) { + BOOLEAN_t const *valptr = p.sptr; + la_json_append_bool(p.vstr, p.label, (*valptr) ? true : false); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_OCTET_STRING_as_json) { + OCTET_STRING_t const *valptr = p.sptr; + la_json_append_octet_string(p.vstr, p.label, valptr->buf, valptr->size); +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1-format-common.h b/plugins/inmarsat_support/aero/libacars/asn1-format-common.h new file mode 100644 index 000000000..6bb51f527 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-format-common.h @@ -0,0 +1,44 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_ASN1_FORMAT_COMMON_H +#define LA_ASN1_FORMAT_COMMON_H 1 +#include // asn_TYPE_descriptor_t +#include // LA_ASN1_FORMATTER_FUNC, la_asn1_formatter_params +#include // la_dict +#include // la_vstring + +char const *la_asn1_value2enum(asn_TYPE_descriptor_t *td, long value); +void la_format_INTEGER_with_unit_as_text(la_asn1_formatter_params p, + char const *unit, double multiplier, int decimal_places); +void la_format_CHOICE_as_text(la_asn1_formatter_params p, la_dict const *choice_labels, + la_asn1_formatter_func cb); +void la_format_INTEGER_as_ENUM_as_text(la_asn1_formatter_params p, la_dict const *value_labels); +void la_format_SEQUENCE_as_text(la_asn1_formatter_params p, la_asn1_formatter_func cb); +void la_format_SEQUENCE_OF_as_text(la_asn1_formatter_params p, la_asn1_formatter_func cb); +void la_format_BIT_STRING_as_text(la_asn1_formatter_params p, la_dict const *bit_labels); + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_any_as_text); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_ENUM_as_text); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_label_only_as_text); + +void la_format_INTEGER_with_unit_as_json(la_asn1_formatter_params p, + char const *unit, double multiplier); +void la_format_CHOICE_as_json(la_asn1_formatter_params p, la_dict const *choice_labels, + la_asn1_formatter_func cb); +void la_format_INTEGER_as_ENUM_as_json(la_asn1_formatter_params p, la_dict const *value_labels); +void la_format_SEQUENCE_as_json(la_asn1_formatter_params p, la_asn1_formatter_func cb); +void la_format_SEQUENCE_OF_as_json(la_asn1_formatter_params p, la_asn1_formatter_func cb); +void la_format_BIT_STRING_as_json(la_asn1_formatter_params p, la_dict const *bit_labels); + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_any_as_string_as_json); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_ENUM_as_json); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_label_only_as_json); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_long_as_json); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_bool_as_json); +LA_ASN1_FORMATTER_FUNC(la_asn1_format_OCTET_STRING_as_json); + +#endif // !LA_ASN1_FORMAT_COMMON_H diff --git a/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc-json.c b/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc-json.c new file mode 100644 index 000000000..983bfb8ad --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc-json.c @@ -0,0 +1,432 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include /* FANSATCDownlinkMessage_t and dependencies */ +#include /* FANSATCUplinkMessage_t and dependencies */ +#include /* la_asn_formatter, la_asn1_output() */ +#include /* common formatters and helper functions */ +#include /* la_asn1_output_cpdlc_as_json(), + FANSATCUplinkMsgElementId_labels, + FANSATCDownlinkMsgElementId_labels */ +#include /* LA_ISPRINTF */ +#include /* LA_XCALLOC, la_dict_search() */ +#include /* la_vstring */ +#include /* la_json_*() */ + +// Forward declarations +static la_asn1_formatter const la_asn1_cpdlc_json_formatter_table[209]; +static size_t la_asn1_cpdlc_json_formatter_table_len; + +/************************ + * ASN.1 type formatters + ************************/ + +LA_ASN1_FORMATTER_FUNC(la_asn1_output_cpdlc_as_json) { + la_asn1_output(p, la_asn1_cpdlc_json_formatter_table, la_asn1_cpdlc_json_formatter_table_len, false); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_CHOICE_cpdlc_as_json) { + la_format_CHOICE_as_json(p, NULL, la_asn1_output_cpdlc_as_json); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_SEQUENCE_cpdlc_as_json) { + la_format_SEQUENCE_as_json(p, la_asn1_output_cpdlc_as_json); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_SEQUENCE_OF_cpdlc_as_json) { + la_format_SEQUENCE_OF_as_json(p, la_asn1_output_cpdlc_as_json); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltimeterEnglish_as_json) { + la_format_INTEGER_with_unit_as_json(p, "inHg", 0.01); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltimeterMetric_as_json) { + la_format_INTEGER_with_unit_as_json(p, "hPa", 0.1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltitudeGNSSFeet_as_json) { + la_format_INTEGER_with_unit_as_json(p, "ft", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltitudeFlightLevelMetric_as_json) { + la_format_INTEGER_with_unit_as_json(p, "m", 10); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_Degrees_as_json) { + la_format_INTEGER_with_unit_as_json(p, "deg", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSDistanceOffsetNm_as_json) { + la_format_INTEGER_with_unit_as_json(p, "nm", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSDistanceMetric_as_json) { + la_format_INTEGER_with_unit_as_json(p, "km", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSFeetX10_as_json) { + la_format_INTEGER_with_unit_as_json(p, "ft", 10); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSFrequencyhf_as_json) { + la_format_INTEGER_with_unit_as_json(p, "kHz", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSFrequencykHzToMHz_as_json) { + la_format_INTEGER_with_unit_as_json(p, "MHz", 0.001); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSDistanceEnglish_as_json) { + la_format_INTEGER_with_unit_as_json(p, "nm", 0.1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLegTime_as_json) { + la_format_INTEGER_with_unit_as_json(p, "min", 0.1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLatitudeDegrees_as_json) { + la_format_INTEGER_with_unit_as_json(p, "deg", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLongitudeDegrees_as_json) { + la_format_INTEGER_with_unit_as_json(p, "deg", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSMeters_as_json) { + la_format_INTEGER_with_unit_as_json(p, "m", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTemperatureC_as_json) { + la_format_INTEGER_with_unit_as_json(p, "C", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTemperatureF_as_json) { + la_format_INTEGER_with_unit_as_json(p, "F", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSWindSpeedEnglish_as_json) { + la_format_INTEGER_with_unit_as_json(p, "kts", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSWindSpeedMetric_as_json) { + la_format_INTEGER_with_unit_as_json(p, "km/h", 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSRTATolerance_as_json) { + la_format_INTEGER_with_unit_as_json(p, "min", 0.1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSSpeedEnglishX10_as_json) { + la_format_INTEGER_with_unit_as_json(p, "kts", 10); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSSpeedMetricX10_as_json) { + la_format_INTEGER_with_unit_as_json(p, "km/h", 10); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSSpeedMach_as_json) { + la_format_INTEGER_with_unit_as_json(p, "", 0.01); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSVerticalRateEnglish_as_json) { + la_format_INTEGER_with_unit_as_json(p, "ft/min", 100); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSVerticalRateMetric_as_json) { + la_format_INTEGER_with_unit_as_json(p, "m/min", 10); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSBeaconCode_as_json) { + FANSBeaconCode_t const *code = p.sptr; + long **cptr = code->list.array; + char str[5] = { + (char)(*cptr[0]) + '0', + (char)(*cptr[1]) + '0', + (char)(*cptr[2]) + '0', + (char)(*cptr[3]) + '0', + '\0' + }; + la_json_append_string(p.vstr, p.label, str); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTime_as_json) { + FANSTime_t const *t = p.sptr; + la_json_object_start(p.vstr, p.label); + la_json_append_int64(p.vstr, "hour", t->hours); + la_json_append_int64(p.vstr, "min", t->minutes); + la_json_object_end(p.vstr); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTimestamp_as_json) { + FANSTimestamp_t const *t = p.sptr; + la_json_object_start(p.vstr, p.label); + la_json_append_int64(p.vstr, "hour", t->hours); + la_json_append_int64(p.vstr, "min", t->minutes); + la_json_append_int64(p.vstr, "sec", t->seconds); + la_json_object_end(p.vstr); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLatitude_as_json) { + FANSLatitude_t const *lat = p.sptr; + long const ldir = lat->latitudeDirection; + char const *ldir_name = la_asn1_value2enum(&asn_DEF_FANSLatitudeDirection, ldir); + la_json_object_start(p.vstr, p.label); + la_json_append_int64(p.vstr, "deg", lat->latitudeDegrees); + if(lat->minutesLatLon != NULL) { + la_json_append_double(p.vstr, "min", *(long const *)(lat->minutesLatLon) / 10.0); + } + la_json_append_string(p.vstr, "dir", ldir_name); + la_json_object_end(p.vstr); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLongitude_as_json) { + FANSLongitude_t const *lat = p.sptr; + long const ldir = lat->longitudeDirection; + char const *ldir_name = la_asn1_value2enum(&asn_DEF_FANSLongitudeDirection, ldir); + la_json_object_start(p.vstr, p.label); + la_json_append_int64(p.vstr, "deg", lat->longitudeDegrees); + if(lat->minutesLatLon != NULL) { + la_json_append_double(p.vstr, "min", *(long const *)(lat->minutesLatLon) / 10.0); + } + la_json_append_string(p.vstr, "dir", ldir_name); + la_json_object_end(p.vstr); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSATCDownlinkMsgElementId_as_json) { + la_format_CHOICE_as_json(p, FANSATCDownlinkMsgElementId_labels, la_asn1_output_cpdlc_as_json); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSATCUplinkMsgElementId_as_json) { + la_format_CHOICE_as_json(p, FANSATCUplinkMsgElementId_labels, la_asn1_output_cpdlc_as_json); +} + +static la_asn1_formatter const la_asn1_cpdlc_json_formatter_table[209] = { + { .type = &asn_DEF_FANSAircraftEquipmentCode, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "ac_equipment_code" }, + { .type = &asn_DEF_FANSAircraftFlightIdentification, .format = la_asn1_format_any_as_string_as_json, .label = "ac_flight_id" }, + { .type = &asn_DEF_FANSAircraftType, .format = la_asn1_format_any_as_string_as_json, .label = "ac_type" }, + { .type = &asn_DEF_FANSAirport, .format = la_asn1_format_any_as_string_as_json, .label = "airport" }, + { .type = &asn_DEF_FANSAirportDeparture, .format = la_asn1_format_any_as_string_as_json, .label = "airport_dep" }, + { .type = &asn_DEF_FANSAirportDestination, .format = la_asn1_format_any_as_string_as_json, .label = "airport_dst" }, + { .type = &asn_DEF_FANSAirwayIdentifier, .format = la_asn1_format_any_as_string_as_json, .label = "airway_id" }, + { .type = &asn_DEF_FANSAirwayIntercept, .format = la_asn1_format_any_as_string_as_json, .label = "airway_intercept" }, + { .type = &asn_DEF_FANSAltimeter, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "altimeter" }, + { .type = &asn_DEF_FANSAltimeterEnglish, .format = la_asn1_format_FANSAltimeterEnglish_as_json, .label = "altimeter_english" }, + { .type = &asn_DEF_FANSAltimeterMetric, .format = la_asn1_format_FANSAltimeterMetric_as_json, .label = "altimeter_metric" }, + { .type = &asn_DEF_FANSAltitude, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "alt" }, + { .type = &asn_DEF_FANSAltitudeAltitude, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "alt_alt" }, + { .type = &asn_DEF_FANSAltitudeFlightLevel, .format = la_asn1_format_long_as_json, .label = "flight_level" }, + { .type = &asn_DEF_FANSAltitudeFlightLevelMetric, .format = la_asn1_format_FANSAltitudeFlightLevelMetric_as_json, .label = "flight_level_metric" }, + { .type = &asn_DEF_FANSAltitudeGNSSFeet, .format = la_asn1_format_FANSAltitudeGNSSFeet_as_json, .label = "alt_gnss" }, + { .type = &asn_DEF_FANSAltitudeGNSSMeters, .format = la_asn1_format_FANSMeters_as_json, .label = "alt_gnss_meters" }, + { .type = &asn_DEF_FANSAltitudePosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "alt_pos" }, + { .type = &asn_DEF_FANSAltitudeQFE, .format = la_asn1_format_FANSFeetX10_as_json, .label = "alt_qfe" }, + { .type = &asn_DEF_FANSAltitudeQFEMeters, .format = la_asn1_format_FANSMeters_as_json, .label = "alt_qfe_meters" }, + { .type = &asn_DEF_FANSAltitudeQNH, .format = la_asn1_format_FANSFeetX10_as_json, .label = "alt_qnh" }, + { .type = &asn_DEF_FANSAltitudeQNHMeters, .format = la_asn1_format_FANSMeters_as_json, .label = "alt_qnh_meters" }, + { .type = &asn_DEF_FANSAltitudeRestriction, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "alt_restriction" }, + { .type = &asn_DEF_FANSAltitudeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "alt_speed" }, + { .type = &asn_DEF_FANSAltitudeSpeedSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "alt_speed_speed" }, + { .type = &asn_DEF_FANSAltitudeTime, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "alt_time" }, + { .type = &asn_DEF_FANSATCDownlinkMessage, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "atc_downlink_msg" }, + { .type = &asn_DEF_FANSATCDownlinkMsgElementId, .format = la_asn1_format_FANSATCDownlinkMsgElementId_as_json, .label = "atc_downlink_msg_element_id" }, + { .type = &asn_DEF_FANSATCDownlinkMsgElementIdSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "atc_downlink_msg_element_id_seq" }, + { .type = &asn_DEF_FANSATCMessageHeader, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "header" }, + { .type = &asn_DEF_FANSATCUplinkMessage, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "atc_uplink_msg" }, + { .type = &asn_DEF_FANSATCUplinkMsgElementId, .format = la_asn1_format_FANSATCUplinkMsgElementId_as_json, .label = "atc_uplink_msg_element_id" }, + { .type = &asn_DEF_FANSATCUplinkMsgElementIdSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "atc_uplink_msg_element_id_seq" }, + { .type = &asn_DEF_FANSATISCode, .format = la_asn1_format_any_as_string_as_json, .label = "atis_code" }, + { .type = &asn_DEF_FANSATWAlongTrackWaypoint, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "atw_along_track_wpt" }, + { .type = &asn_DEF_FANSATWAlongTrackWaypointSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "atw_along_trk_wpt_seq" }, + { .type = &asn_DEF_FANSATWAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "atw_alt" }, + { .type = &asn_DEF_FANSATWAltitudeSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "atw_alt_seq" }, + { .type = &asn_DEF_FANSATWAltitudeTolerance, .format = la_asn1_format_ENUM_as_json, .label = "atw_alt_tolerance" }, + { .type = &asn_DEF_FANSATWDistance, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "atw_distance" }, + { .type = &asn_DEF_FANSATWDistanceTolerance, .format = la_asn1_format_ENUM_as_json, .label = "atw_dist_tolerance" }, + { .type = &asn_DEF_FANSBeaconCode, .format = la_asn1_format_FANSBeaconCode_as_json, .label = "beacon_code" }, + { .type = &asn_DEF_FANSCOMNAVApproachEquipmentAvailable, .format = la_asn1_format_bool_as_json, .label = "comm_nav_appr_equipment_avail" }, + { .type = &asn_DEF_FANSCOMNAVEquipmentStatus, .format = la_asn1_format_ENUM_as_json, .label = "comm_nav_equipment_status" }, + { .type = &asn_DEF_FANSCOMNAVEquipmentStatusSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "comm_nav_equipment_status_seq" }, + { .type = &asn_DEF_FANSDegreeIncrement, .format = la_asn1_format_Degrees_as_json, .label = "deg_increment" }, + { .type = &asn_DEF_FANSDegrees, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "deg" }, + { .type = &asn_DEF_FANSDegreesMagnetic, .format = la_asn1_format_Degrees_as_json, .label = "deg_mag" }, + { .type = &asn_DEF_FANSDegreesTrue, .format = la_asn1_format_Degrees_as_json, .label = "deg_true" }, + { .type = &asn_DEF_FANSDirection, .format = la_asn1_format_ENUM_as_json, .label = "dir" }, + { .type = &asn_DEF_FANSDirectionDegrees, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "dir_deg" }, + { .type = &asn_DEF_FANSDistance, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "dist" }, + { .type = &asn_DEF_FANSDistanceKm, .format = la_asn1_format_FANSDistanceMetric_as_json, .label = "dist_km" }, + { .type = &asn_DEF_FANSDistanceNm, .format = la_asn1_format_FANSDistanceEnglish_as_json, .label = "dist_nm" }, + { .type = &asn_DEF_FANSDistanceOffset, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "dist_offset" }, + { .type = &asn_DEF_FANSDistanceOffsetDirection, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "dist_offset_dir" }, + { .type = &asn_DEF_FANSDistanceOffsetKm, .format = la_asn1_format_FANSDistanceMetric_as_json, .label = "dist_offset_km" }, + { .type = &asn_DEF_FANSDistanceOffsetNm, .format = la_asn1_format_FANSDistanceOffsetNm_as_json, .label = "dist_offset_nm" }, + { .type = &asn_DEF_FANSEFCtime, .format = la_asn1_format_FANSTime_as_json, .label = "expect_further_clearance_at_time" }, + { .type = &asn_DEF_FANSErrorInformation, .format = la_asn1_format_ENUM_as_json, .label = "err_info" }, + { .type = &asn_DEF_FANSFixName, .format = la_asn1_format_any_as_string_as_json, .label = "fix" }, + { .type = &asn_DEF_FANSFixNext, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "next_fix" }, + { .type = &asn_DEF_FANSFixNextPlusOne, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "next_next_fix" }, + { .type = &asn_DEF_FANSFreeText, .format = la_asn1_format_any_as_string_as_json, .label = "free_text" }, + { .type = &asn_DEF_FANSFrequency, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "freq" }, + { .type = &asn_DEF_FANSFrequencyDeparture, .format = la_asn1_format_FANSFrequencykHzToMHz_as_json, .label = "freq_dep" }, + { .type = &asn_DEF_FANSFrequencyhf, .format = la_asn1_format_FANSFrequencyhf_as_json, .label = "hf" }, + { .type = &asn_DEF_FANSFrequencysatchannel, .format = la_asn1_format_any_as_string_as_json, .label = "sat_channel" }, + { .type = &asn_DEF_FANSFrequencyuhf, .format = la_asn1_format_FANSFrequencykHzToMHz_as_json, .label = "uhf" }, + { .type = &asn_DEF_FANSFrequencyvhf, .format = la_asn1_format_FANSFrequencykHzToMHz_as_json, .label = "vhf" }, + { .type = &asn_DEF_FANSHoldatwaypoint, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "hold_at_wpt" }, + { .type = &asn_DEF_FANSHoldatwaypointSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "hold_at_wpt_seq" }, + { .type = &asn_DEF_FANSHoldatwaypointSpeedHigh, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "hold_at_wpt_speed_high" }, + { .type = &asn_DEF_FANSHoldatwaypointSpeedLow, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "hold_at_wpt_speed_low" }, + { .type = &asn_DEF_FANSHoldClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "hold_clearance" }, + { .type = &asn_DEF_FANSICAOfacilityDesignation, .format = la_asn1_format_any_as_string_as_json, .label = "icao_facility_designation" }, + { .type = &asn_DEF_FANSICAOFacilityDesignationTp4Table, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "icao_facility_designation_tp4_table" }, + { .type = &asn_DEF_FANSICAOFacilityFunction, .format = la_asn1_format_ENUM_as_json, .label = "icao_facility_function" }, + { .type = &asn_DEF_FANSICAOFacilityIdentification, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "icao_facility_id" }, + { .type = &asn_DEF_FANSICAOFacilityName, .format = la_asn1_format_any_as_string_as_json, .label = "icao_facility_name" }, + { .type = &asn_DEF_FANSICAOUnitName, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "icao_unit_name" }, + { .type = &asn_DEF_FANSICAOUnitNameFrequency, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "icao_unit_name_freq" }, + { .type = &asn_DEF_FANSIcing, .format = la_asn1_format_ENUM_as_json, .label = "icing" }, + { .type = &asn_DEF_FANSInterceptCourseFrom, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "intercept_course_from" }, + { .type = &asn_DEF_FANSInterceptCourseFromSelection, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "intercept_source_from_selection" }, + { .type = &asn_DEF_FANSInterceptCourseFromSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "intercept_source_from_sequence" }, + { .type = &asn_DEF_FANSLatitude, .format = la_asn1_format_FANSLatitude_as_json, .label = "lat" }, + { .type = &asn_DEF_FANSLatitudeDegrees, .format = la_asn1_format_FANSLatitudeDegrees_as_json, .label = "lat_deg" }, + { .type = &asn_DEF_FANSLatitudeDirection, .format = la_asn1_format_ENUM_as_json, .label = "lat_dir" }, + { .type = &asn_DEF_FANSLatitudeLongitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "lat_lon" }, + { .type = &asn_DEF_FANSLatitudeLongitudeSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "lat_lon_seq" }, + { .type = &asn_DEF_FANSLatitudeReportingPoints, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "reporting_points" }, + { .type = &asn_DEF_FANSLatLonReportingPoints, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "lat_lon_reporting_points" }, + { .type = &asn_DEF_FANSLegDistance, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "leg_dist" }, + { .type = &asn_DEF_FANSLegDistanceEnglish, .format = la_asn1_format_FANSDistanceEnglish_as_json, .label = "leg_dist_english" }, + { .type = &asn_DEF_FANSLegDistanceMetric, .format = la_asn1_format_FANSDistanceMetric_as_json, .label = "leg_dist_metric" }, + { .type = &asn_DEF_FANSLegTime, .format = la_asn1_format_FANSLegTime_as_json, .label = "leg_time" }, + { .type = &asn_DEF_FANSLegType, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "leg_type" }, + { .type = &asn_DEF_FANSLongitude, .format = la_asn1_format_FANSLongitude_as_json, .label = "lon" }, + { .type = &asn_DEF_FANSLongitudeDegrees, .format = la_asn1_format_FANSLongitudeDegrees_as_json, .label = "lon_deg" }, + { .type = &asn_DEF_FANSLongitudeDirection, .format = la_asn1_format_ENUM_as_json, .label = "lon_dir" }, + { .type = &asn_DEF_FANSLongitudeReportingPoints, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "lon_reporting_points" }, + { .type = &asn_DEF_FANSMsgIdentificationNumber, .format = la_asn1_format_long_as_json, .label = "msg_id" }, + { .type = &asn_DEF_FANSMsgReferenceNumber, .format = la_asn1_format_long_as_json, .label = "msg_ref" }, + { .type = &asn_DEF_FANSNavaid, .format = la_asn1_format_any_as_string_as_json, .label = "navaid" }, + { .type = &asn_DEF_FANSPDCrevision, .format = la_asn1_format_long_as_json, .label = "pdc_revision" }, + { .type = &asn_DEF_FANSPlaceBearing, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "place_bearing" }, + { .type = &asn_DEF_FANSPlaceBearingDistance, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "place_bearing_dist" }, + { .type = &asn_DEF_FANSPlaceBearingPlaceBearing, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "place_bearing_place_bearing" }, + { .type = &asn_DEF_FANSPosition, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "pos" }, + { .type = &asn_DEF_FANSPositionAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_alt" }, + { .type = &asn_DEF_FANSPositionAltitudeAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_alt_alt" }, + { .type = &asn_DEF_FANSPositionAltitudeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_alt_speed" }, + { .type = &asn_DEF_FANSPositionCurrent, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "pos_current" }, + { .type = &asn_DEF_FANSPositionDegrees, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_deg" }, + { .type = &asn_DEF_FANSPositionDistanceOffsetDirection, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_dist_offset_dir" }, + { .type = &asn_DEF_FANSPositionICAOUnitNameFrequency, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_icao_unit_name_freq" }, + { .type = &asn_DEF_FANSPositionPosition, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "pos_pos" }, + { .type = &asn_DEF_FANSPositionProcedureName, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_procedure_name" }, + { .type = &asn_DEF_FANSPositionReport, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_report" }, + { .type = &asn_DEF_FANSPositionRouteClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_rte_clearance" }, + { .type = &asn_DEF_FANSPositionSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_speed" }, + { .type = &asn_DEF_FANSPositionSpeedSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_speed_speed" }, + { .type = &asn_DEF_FANSPositionTime, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_time" }, + { .type = &asn_DEF_FANSPositionTimeAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_time_alt" }, + { .type = &asn_DEF_FANSPositionTimeTime, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "pos_time_time" }, + { .type = &asn_DEF_FANSPredepartureClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "predeparture_clearance" }, + { .type = &asn_DEF_FANSProcedure, .format = la_asn1_format_any_as_string_as_json, .label = "procedure" }, + { .type = &asn_DEF_FANSProcedureApproach, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "procedure_appr" }, + { .type = &asn_DEF_FANSProcedureArrival, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "procedure_arr" }, + { .type = &asn_DEF_FANSProcedureDeparture, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "procedure_dep" }, + { .type = &asn_DEF_FANSProcedureName, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "procedure_name" }, + { .type = &asn_DEF_FANSProcedureTransition, .format = la_asn1_format_any_as_string_as_json, .label = "procedure_transition" }, + { .type = &asn_DEF_FANSProcedureType, .format = la_asn1_format_ENUM_as_json, .label = "procedure_type" }, + { .type = &asn_DEF_FANSPublishedIdentifier, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "published_identifier" }, + { .type = &asn_DEF_FANSRemainingFuel, .format = la_asn1_format_FANSTime_as_json, .label = "rem_fuel_time" }, + { .type = &asn_DEF_FANSRemainingFuelRemainingSouls, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "rem_fuel_persons_onboard" }, + { .type = &asn_DEF_FANSRemainingSouls, .format = la_asn1_format_long_as_json, .label = "persons_onboard" }, + { .type = &asn_DEF_FANSReportedWaypointAltitude, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "reported_wpt_alt" }, + { .type = &asn_DEF_FANSReportedWaypointPosition, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "reported_wpt_pos" }, + { .type = &asn_DEF_FANSReportedWaypointTime, .format = la_asn1_format_FANSTime_as_json, .label = "reported_wpt_time" }, + { .type = &asn_DEF_FANSReportingPoints, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "reporting_points" }, + { .type = &asn_DEF_FANSRouteClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "rte_clearance" }, + { .type = &asn_DEF_FANSRouteInformation, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "rte_info" }, + { .type = &asn_DEF_FANSRouteInformationAdditional, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "rte_info_additional" }, + { .type = &asn_DEF_FANSRouteInformationSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "rte_info_seq" }, + { .type = &asn_DEF_FANSRTARequiredTimeArrival, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "rta_req_time_arrival" }, + { .type = &asn_DEF_FANSRTARequiredTimeArrivalSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "req_time_arrival_seq" }, + { .type = &asn_DEF_FANSRTATime, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "rta_time" }, + { .type = &asn_DEF_FANSRTATolerance, .format = la_asn1_format_FANSRTATolerance_as_json, .label = "rta_tolerance" }, + { .type = &asn_DEF_FANSRunway, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "runway" }, + { .type = &asn_DEF_FANSRunwayArrival, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "runway_arr" }, + { .type = &asn_DEF_FANSRunwayConfiguration, .format = la_asn1_format_ENUM_as_json, .label = "runway_config" }, + { .type = &asn_DEF_FANSRunwayDeparture, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "runway_dep" }, + { .type = &asn_DEF_FANSRunwayDirection, .format = la_asn1_format_long_as_json, .label = "runway_dir" }, + { .type = &asn_DEF_FANSSpeed, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "speed" }, + { .type = &asn_DEF_FANSSpeedGround, .format = la_asn1_format_FANSSpeedEnglishX10_as_json, .label = "speed_gnd" }, + { .type = &asn_DEF_FANSSpeedGroundMetric, .format = la_asn1_format_FANSSpeedMetricX10_as_json, .label = "speed_gnd_metric" }, + { .type = &asn_DEF_FANSSpeedIndicated, .format = la_asn1_format_FANSSpeedEnglishX10_as_json, .label = "speed_indicated" }, + { .type = &asn_DEF_FANSSpeedIndicatedMetric, .format = la_asn1_format_FANSSpeedMetricX10_as_json, .label = "speed_indicated_metric" }, + { .type = &asn_DEF_FANSSpeedMach, .format = la_asn1_format_FANSSpeedMach_as_json, .label = "speed_mach" }, + { .type = &asn_DEF_FANSSpeedMachLarge, .format = la_asn1_format_FANSSpeedMach_as_json, .label = "speed_mach_large" }, + { .type = &asn_DEF_FANSSpeedSpeed, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "speed_speed" }, + { .type = &asn_DEF_FANSSpeedTrue, .format = la_asn1_format_FANSSpeedEnglishX10_as_json, .label = "speed_true" }, + { .type = &asn_DEF_FANSSpeedTrueMetric, .format = la_asn1_format_FANSSpeedMetricX10_as_json, .label = "speed_true_metric" }, + { .type = &asn_DEF_FANSSSREquipmentAvailable, .format = la_asn1_format_ENUM_as_json, .label = "ssr_equipment_avail" }, + { .type = &asn_DEF_FANSSupplementaryInformation, .format = la_asn1_format_any_as_string_as_json, .label = "supplementary_info" }, + { .type = &asn_DEF_FANSTemperature, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "temp" }, + { .type = &asn_DEF_FANSTemperatureC, .format = la_asn1_format_FANSTemperatureC_as_json, .label = "temp_deg_c" }, + { .type = &asn_DEF_FANSTemperatureF, .format = la_asn1_format_FANSTemperatureF_as_json, .label = "temp_deg_f" }, + { .type = &asn_DEF_FANSTime, .format = la_asn1_format_FANSTime_as_json, .label = "time" }, + { .type = &asn_DEF_FANSTimeAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "time_alt" }, + { .type = &asn_DEF_FANSTimeAtPositionCurrent, .format = la_asn1_format_FANSTime_as_json, .label = "time_at_pos_current" }, + { .type = &asn_DEF_FANSTimeDepartureEdct, .format = la_asn1_format_FANSTime_as_json, .label = "est_dep_time" }, + { .type = &asn_DEF_FANSTimeDistanceOffsetDirection, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "dist_offset_dir" }, + { .type = &asn_DEF_FANSTimeDistanceToFromPosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "dist_to_from_pos" }, + { .type = &asn_DEF_FANSTimeEtaAtFixNext, .format = la_asn1_format_FANSTime_as_json, .label = "eta_at_fix_next" }, + { .type = &asn_DEF_FANSTimeEtaDestination, .format = la_asn1_format_FANSTime_as_json, .label = "eta_at_dest" }, + { .type = &asn_DEF_FANSTimeICAOunitnameFrequency, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "icao_unitname_freq" }, + { .type = &asn_DEF_FANSTimePosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "time_pos" }, + { .type = &asn_DEF_FANSTimePositionAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "time_pos_alt" }, + { .type = &asn_DEF_FANSTimePositionAltitudeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "time_pos_alt_speed" }, + { .type = &asn_DEF_FANSTimeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "time_speed" }, + { .type = &asn_DEF_FANSTimeSpeedSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "time_speed_speed" }, + { .type = &asn_DEF_FANSTimestamp, .format = la_asn1_format_FANSTimestamp_as_json, .label = "timestamp" }, + { .type = &asn_DEF_FANSTimeTime, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "time_time" }, + { .type = &asn_DEF_FANSTimeTolerance, .format = la_asn1_format_ENUM_as_json, .label = "time_tolerance" }, + { .type = &asn_DEF_FANSToFrom, .format = la_asn1_format_ENUM_as_json, .label = "to_from" }, + { .type = &asn_DEF_FANSToFromPosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "to_from_pos" }, + { .type = &asn_DEF_FANSTp4table, .format = la_asn1_format_ENUM_as_json, .label = "tp4table" }, + { .type = &asn_DEF_FANSTrackAngle, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "trk_angle" }, + { .type = &asn_DEF_FANSTrackDetail, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "trk_detail" }, + { .type = &asn_DEF_FANSTrackName, .format = la_asn1_format_any_as_string_as_json, .label = "trk_name" }, + { .type = &asn_DEF_FANSTrueheading, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "true_hdg" }, + { .type = &asn_DEF_FANSTurbulence, .format = la_asn1_format_ENUM_as_json, .label = "turbulence" }, + { .type = &asn_DEF_FANSVersionNumber, .format = la_asn1_format_long_as_json, .label = "ver_num" }, + { .type = &asn_DEF_FANSVerticalChange, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "vert_change" }, + { .type = &asn_DEF_FANSVerticalDirection, .format = la_asn1_format_ENUM_as_json, .label = "vert_dir" }, + { .type = &asn_DEF_FANSVerticalRate, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "vert_rate" }, + { .type = &asn_DEF_FANSVerticalRateEnglish, .format = la_asn1_format_FANSVerticalRateEnglish_as_json, .label = "vert_rate_english" }, + { .type = &asn_DEF_FANSVerticalRateMetric, .format = la_asn1_format_FANSVerticalRateMetric_as_json, .label = "vert_rate_metric" }, + { .type = &asn_DEF_FANSWaypointSpeedAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "wpt_speed_alt" }, + { .type = &asn_DEF_FANSWaypointSpeedAltitudesequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_json, .label = "wpt_speed_alt_seq" }, + { .type = &asn_DEF_FANSWindDirection, .format = la_asn1_format_Degrees_as_json, .label = "wind_dir" }, + { .type = &asn_DEF_FANSWinds, .format = la_asn1_format_SEQUENCE_cpdlc_as_json, .label = "winds" }, + { .type = &asn_DEF_FANSWindSpeed, .format = la_asn1_format_CHOICE_cpdlc_as_json, .label = "wind_speed" }, + { .type = &asn_DEF_FANSWindSpeedEnglish, .format = la_asn1_format_FANSWindSpeedEnglish_as_json, .label = "wind_speed_english" }, + { .type = &asn_DEF_FANSWindSpeedMetric, .format = la_asn1_format_FANSWindSpeedMetric_as_json, .label = "wind_speed_metric" }, + { .type = &asn_DEF_NULL, .format = NULL, .label = NULL } + // Formatters for the following simple types are not implemented - they are handled by formatters + // of complex types where these simple types are used. + // + // Handled by la_asn1_format_FANSTime_as_json + // { .type = &asn_DEF_FANSTimehours, .format = la_asn1_format_long_as_json, .label = "hour" }, + // { .type = &asn_DEF_FANSTimeminutes, .format = la_asn1_format_long_as_json, .label = "minute" }, + // Handled by &asn_DEF_FANSTimestamp + // { .type = &asn_DEF_FANSTimeSeconds, .format = la_asn1_format_long_as_json, .label = "second" }, + // Handled by la_asn1_format_FANSBeaconCode_as_json + // { .type = &asn_DEF_FANSBeaconCodeOctalDigit, .format = , .label = "beacon_code_octal_digit" }, + // Handled by la_asn1_format_FANSLatitude_as_json / la_asn1_format_FANSLongitude_as_json + // { .type = &asn_DEF_FANSMinutesLatLon, .format = , .label = "minutes_lat_lon" }, +}; + +static size_t la_asn1_cpdlc_json_formatter_table_len = +sizeof(la_asn1_cpdlc_json_formatter_table) / sizeof(la_asn1_formatter); diff --git a/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc-text.c b/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc-text.c new file mode 100644 index 000000000..1f35ab36d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc-text.c @@ -0,0 +1,784 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include // FANSATCDownlinkMessage_t and dependencies +#include // FANSATCUplinkMessage_t and dependencies +#include // la_asn_formatter, la_asn1_output() +#include // common formatters and helper functions +#include // la_asn1_output_cpdlc_as_text() +#include // LA_ISPRINTF +#include // LA_XCALLOC, la_dict_search() +#include // la_vstring + +// Forward declarations +static la_asn1_formatter const la_asn1_cpdlc_text_formatter_table[209]; +static size_t la_asn1_cpdlc_text_formatter_table_len; + +la_dict const FANSATCUplinkMsgElementId_labels[] = { + { FANSATCUplinkMsgElementId_PR_uM0NULL, "UNABLE" }, + { FANSATCUplinkMsgElementId_PR_uM1NULL, "STANDBY" }, + { FANSATCUplinkMsgElementId_PR_uM2NULL, "REQUEST DEFERRED" }, + { FANSATCUplinkMsgElementId_PR_uM3NULL, "ROGER" }, + { FANSATCUplinkMsgElementId_PR_uM4NULL, "AFFIRM" }, + { FANSATCUplinkMsgElementId_PR_uM5NULL, "NEGATIVE" }, + { FANSATCUplinkMsgElementId_PR_uM6Altitude, "EXPECT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM7Time, "EXPECT CLIMB AT [time]" }, + { FANSATCUplinkMsgElementId_PR_uM8Position, "EXPECT CLIMB AT [position]" }, + { FANSATCUplinkMsgElementId_PR_uM9Time, "EXPECT DESCENT AT [time]" }, + { FANSATCUplinkMsgElementId_PR_uM10Position, "EXPECT DESCENT AT [position]" }, + { FANSATCUplinkMsgElementId_PR_uM11Time, "EXPECT CRUISE CLIMB AT [time]" }, + { FANSATCUplinkMsgElementId_PR_uM12Position, "EXPECT CRUISE CLIMB AT [position]" }, + { FANSATCUplinkMsgElementId_PR_uM13TimeAltitude, "AT [time] EXPECT CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM14PositionAltitude, "AT [position] EXPECT CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM15TimeAltitude, "AT [time] EXPECT DESCENT TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM16PositionAltitude, "AT [position] EXPECT DESCENT TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM17TimeAltitude, "AT [time] EXPECT CRUISE CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM18PositionAltitude, "AT [position] EXPECT CRUISE CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM19Altitude, "MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM20Altitude, "CLIMB TO AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM21TimeAltitude, "AT [time] CLIMB TO AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM22PositionAltitude, "AT [position] CLIMB TO AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM23Altitude, "DESCEND TO AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM24TimeAltitude, "AT [time] DESCEND TO AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM25PositionAltitude, "AT [position] DESCEND TO AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM26AltitudeTime, "CLIMB TO REACH [altitude] BY [time]" }, + { FANSATCUplinkMsgElementId_PR_uM27AltitudePosition, "CLIMB TO REACH [altitude] BY [position]" }, + { FANSATCUplinkMsgElementId_PR_uM28AltitudeTime, "DESCEND TO REACH [altitude] BY [time]" }, + { FANSATCUplinkMsgElementId_PR_uM29AltitudePosition, "DESCEND TO REACH [altitude] BY [position]" }, + { FANSATCUplinkMsgElementId_PR_uM30AltitudeAltitude, "MAINTAIN BLOCK [altitude] TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM31AltitudeAltitude, "CLIMB TO AND MAINTAIN BLOCK [altitude] TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM32AltitudeAltitude, "DESCEND TO AND MAINTAIN BLOCK [altitude] TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM33Altitude, "CRUISE [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM34Altitude, "CRUISE CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM35Altitude, "CRUISE CLIMB ABOVE [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM36Altitude, "EXPEDITE CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM37Altitude, "EXPEDITE DESCENT TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM38Altitude, "IMMEDIATELY CLIMB TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM39Altitude, "IMMEDIATELY DESCEND TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM40Altitude, "IMMEDIATELY STOP CLIMB AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM41Altitude, "IMMEDIATELY STOP DESCENT AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM42PositionAltitude, "EXPECT TO CROSS [position] AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM43PositionAltitude, "EXPECT TO CROSS [position] AT OR ABOVE [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM44PositionAltitude, "EXPECT TO CROSS [position] AT OR BELOW [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM45PositionAltitude, "EXPECT TO CROSS [position] AT AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM46PositionAltitude, "CROSS [position] AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM47PositionAltitude, "CROSS [position] AT OR ABOVE [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM48PositionAltitude, "CROSS [position] AT OR BELOW [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM49PositionAltitude, "CROSS [position] AT AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM50PositionAltitudeAltitude, "CROSS [position] BETWEEN [altitude] AND [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM51PositionTime, "CROSS [position] AT [time]" }, + { FANSATCUplinkMsgElementId_PR_uM52PositionTime, "CROSS [position] AT OR BEFORE [time]" }, + { FANSATCUplinkMsgElementId_PR_uM53PositionTime, "CROSS [position] AT OR AFTER [time]" }, + { FANSATCUplinkMsgElementId_PR_uM54PositionTimeTime, "CROSS [position] BETWEEN [time] AND [time]" }, + { FANSATCUplinkMsgElementId_PR_uM55PositionSpeed, "CROSS [position] AT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM56PositionSpeed, "CROSS [position] AT OR LESS THAN [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM57PositionSpeed, "CROSS [position] AT OR GREATER THAN [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM58PositionTimeAltitude, "CROSS [position] AT [time] AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM59PositionTimeAltitude, "CROSS [position] AT OR BEFORE [time] AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM60PositionTimeAltitude, "CROSS [position] AT OR AFTER [time] AT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM61PositionAltitudeSpeed, "CROSS [position] AT AND MAINTAIN [altitude] AT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM62TimePositionAltitude, "AT [time] CROSS [position] AT AND MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM63TimePositionAltitudeSpeed, "AT [time] CROSS [position] AT AND MAINTAIN [altitude] AT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM64DistanceOffsetDirection, "OFFSET [distanceoffset] [direction] OF ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM65PositionDistanceOffsetDirection, "AT [position] OFFSET [distanceoffset] [direction] OF ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM66TimeDistanceOffsetDirection, "AT [time] OFFSET [distanceoffset] [direction] OF ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM67NULL, "PROCEED BACK ON ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM68Position, "REJOIN ROUTE BY [position]" }, + { FANSATCUplinkMsgElementId_PR_uM69Time, "REJOIN ROUTE BY [time]" }, + { FANSATCUplinkMsgElementId_PR_uM70Position, "EXPECT BACK ON ROUTE BY [position]" }, + { FANSATCUplinkMsgElementId_PR_uM71Time, "EXPECT BACK ON ROUTE BY [time]" }, + { FANSATCUplinkMsgElementId_PR_uM72NULL, "RESUME OWN NAVIGATION" }, + { FANSATCUplinkMsgElementId_PR_uM73Predepartureclearance, "[predepartureclearance]" }, + { FANSATCUplinkMsgElementId_PR_uM74Position, "PROCEED DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM75Position, "WHEN ABLE PROCEED DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM76TimePosition, "AT [time] PROCEED DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM77PositionPosition, "AT [position] PROCEED DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM78AltitudePosition, "AT [altitude] PROCEED DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM79PositionRouteClearance, "CLEARED TO [position] VIA [routeclearance]" }, + { FANSATCUplinkMsgElementId_PR_uM80RouteClearance, "CLEARED [routeclearance]" }, + { FANSATCUplinkMsgElementId_PR_uM81ProcedureName, "CLEARED [procedurename]" }, + { FANSATCUplinkMsgElementId_PR_uM82DistanceOffsetDirection, "CLEARED TO DEVIATE UP TO [distanceoffset] [direction] OF ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM83PositionRouteClearance, "AT [position] CLEARED [routeclearance]" }, + { FANSATCUplinkMsgElementId_PR_uM84PositionProcedureName, "AT [position] CLEARED [procedurename]" }, + { FANSATCUplinkMsgElementId_PR_uM85RouteClearance, "EXPECT [routeclearance]" }, + { FANSATCUplinkMsgElementId_PR_uM86PositionRouteClearance, "AT [position] EXPECT [routeclearance]" }, + { FANSATCUplinkMsgElementId_PR_uM87Position, "EXPECT DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM88PositionPosition, "AT [position] EXPECT DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM89TimePosition, "AT [time] EXPECT DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM90AltitudePosition, "AT [altitude] EXPECT DIRECT TO [position]" }, + { FANSATCUplinkMsgElementId_PR_uM91HoldClearance, "HOLD AT [position] MAINTAIN [altitude] INBOUND TRACK [degrees] [direction] TURNS [legtype]" }, + { FANSATCUplinkMsgElementId_PR_uM92PositionAltitude, "HOLD AT [position] AS PUBLISHED MAINTAIN [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM93Time, "EXPECT FURTHER CLEARANCE AT [time]" }, + { FANSATCUplinkMsgElementId_PR_uM94DirectionDegrees, "TURN [direction] HEADING [degrees]" }, + { FANSATCUplinkMsgElementId_PR_uM95DirectionDegrees, "TURN [direction] GROUND TRACK [degrees]" }, + { FANSATCUplinkMsgElementId_PR_uM96NULL, "FLY PRESENT HEADING" }, + { FANSATCUplinkMsgElementId_PR_uM97PositionDegrees, "AT [position] FLY HEADING [degrees]" }, + { FANSATCUplinkMsgElementId_PR_uM98DirectionDegrees, "IMMEDIATELY TURN [direction] HEADING [degrees]" }, + { FANSATCUplinkMsgElementId_PR_uM99ProcedureName, "EXPECT [procedurename]" }, + { FANSATCUplinkMsgElementId_PR_uM100TimeSpeed, "AT [time] EXPECT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM101PositionSpeed, "AT [position] EXPECT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM102AltitudeSpeed, "AT [altitude] EXPECT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM103TimeSpeedSpeed, "AT [time] EXPECT [speed] TO [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM104PositionSpeedSpeed, "AT [position] EXPECT [speed] TO [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM105AltitudeSpeedSpeed, "AT [altitude] EXPECT [speed] TO [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM106Speed, "MAINTAIN [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM107NULL, "MAINTAIN PRESENT SPEED" }, + { FANSATCUplinkMsgElementId_PR_uM108Speed, "MAINTAIN [speed] OR GREATER" }, + { FANSATCUplinkMsgElementId_PR_uM109Speed, "MAINTAIN [speed] OR LESS" }, + { FANSATCUplinkMsgElementId_PR_uM110SpeedSpeed, "MAINTAIN [speed] TO [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM111Speed, "INCREASE SPEED TO [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM112Speed, "INCREASE SPEED TO [speed] OR GREATER" }, + { FANSATCUplinkMsgElementId_PR_uM113Speed, "REDUCE SPEED TO [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM114Speed, "REDUCE SPEED TO [speed] OR LESS" }, + { FANSATCUplinkMsgElementId_PR_uM115Speed, "DO NOT EXCEED [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM116NULL, "RESUME NORMAL SPEED" }, + { FANSATCUplinkMsgElementId_PR_uM117ICAOunitnameFrequency, "CONTACT [icaounitname] [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM118PositionICAOunitnameFrequency, "AT [position] CONTACT [icaounitname] [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM119TimeICAOunitnameFrequency, "AT [time] CONTACT [icaounitname] [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM120ICAOunitnameFrequency, "MONITOR [icaounitname] [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM121PositionICAOunitnameFrequency, "AT [position] MONITOR [icaounitname] [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM122TimeICAOunitnameFrequency, "AT [time] MONITOR [icaounitname] [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM123BeaconCode, "SQUAWK [beaconcode]" }, + { FANSATCUplinkMsgElementId_PR_uM124NULL, "STOP SQUAWK" }, + { FANSATCUplinkMsgElementId_PR_uM125NULL, "SQUAWK ALTITUDE" }, + { FANSATCUplinkMsgElementId_PR_uM126NULL, "STOP ALTITUDE SQUAWK" }, + { FANSATCUplinkMsgElementId_PR_uM127NULL, "REPORT BACK ON ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM128Altitude, "REPORT LEAVING [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM129Altitude, "REPORT LEVEL [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM130Position, "REPORT PASSING [position]" }, + { FANSATCUplinkMsgElementId_PR_uM131NULL, "REPORT REMAINING FUEL AND SOULS ON BOARD" }, + { FANSATCUplinkMsgElementId_PR_uM132NULL, "CONFIRM POSITION" }, + { FANSATCUplinkMsgElementId_PR_uM133NULL, "CONFIRM ALTITUDE" }, + { FANSATCUplinkMsgElementId_PR_uM134NULL, "CONFIRM SPEED" }, + { FANSATCUplinkMsgElementId_PR_uM135NULL, "CONFIRM ASSIGNED ALTITUDE" }, + { FANSATCUplinkMsgElementId_PR_uM136NULL, "CONFIRM ASSIGNED SPEED" }, + { FANSATCUplinkMsgElementId_PR_uM137NULL, "CONFIRM ASSIGNED ROUTE" }, + { FANSATCUplinkMsgElementId_PR_uM138NULL, "CONFIRM TIME OVER REPORTED WAYPOINT" }, + { FANSATCUplinkMsgElementId_PR_uM139NULL, "CONFIRM REPORTED WAYPOINT" }, + { FANSATCUplinkMsgElementId_PR_uM140NULL, "CONFIRM NEXT WAYPOINT" }, + { FANSATCUplinkMsgElementId_PR_uM141NULL, "CONFIRM NEXT WAYPOINT ETA" }, + { FANSATCUplinkMsgElementId_PR_uM142NULL, "CONFIRM ENSUING WAYPOINT" }, + { FANSATCUplinkMsgElementId_PR_uM143NULL, "CONFIRM REQUEST" }, + { FANSATCUplinkMsgElementId_PR_uM144NULL, "CONFIRM SQUAWK" }, + { FANSATCUplinkMsgElementId_PR_uM145NULL, "CONFIRM HEADING" }, + { FANSATCUplinkMsgElementId_PR_uM146NULL, "CONFIRM GROUND TRACK" }, + { FANSATCUplinkMsgElementId_PR_uM147NULL, "REQUEST POSITION REPORT" }, + { FANSATCUplinkMsgElementId_PR_uM148Altitude, "WHEN CAN YOU ACCEPT [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM149AltitudePosition, "CAN YOU ACCEPT [altitude] AT [position]" }, + { FANSATCUplinkMsgElementId_PR_uM150AltitudeTime, "CAN YOU ACCEPT [altitude] AT [time]" }, + { FANSATCUplinkMsgElementId_PR_uM151Speed, "WHEN CAN YOU ACCEPT [speed]" }, + { FANSATCUplinkMsgElementId_PR_uM152DistanceOffsetDirection, "WHEN CAN YOU ACCEPT [distanceoffset] [direction] OFFSET" }, + { FANSATCUplinkMsgElementId_PR_uM153Altimeter, "ALTIMETER [altimeter]" }, + { FANSATCUplinkMsgElementId_PR_uM154NULL, "RADAR SERVICES TERMINATED" }, + { FANSATCUplinkMsgElementId_PR_uM155Position, "RADAR CONTACT [position]" }, + { FANSATCUplinkMsgElementId_PR_uM156NULL, "RADAR CONTACT LOST" }, + { FANSATCUplinkMsgElementId_PR_uM157Frequency, "CHECK STUCK MICROPHONE [frequency]" }, + { FANSATCUplinkMsgElementId_PR_uM158ATISCode, "ATIS [atiscode]" }, + { FANSATCUplinkMsgElementId_PR_uM159ErrorInformation, "ERROR [errorinformation]" }, + { FANSATCUplinkMsgElementId_PR_uM160ICAOfacilitydesignation, "NEXT DATA AUTHORITY [icaofacilitydesignation]" }, + { FANSATCUplinkMsgElementId_PR_uM161NULL, "END SERVICE" }, + { FANSATCUplinkMsgElementId_PR_uM162NULL, "SERVICE UNAVAILABLE" }, + { FANSATCUplinkMsgElementId_PR_uM163ICAOfacilitydesignationTp4table, "[icaofacilitydesignation] [tp4table]" }, + { FANSATCUplinkMsgElementId_PR_uM164NULL, "WHEN READY" }, + { FANSATCUplinkMsgElementId_PR_uM165NULL, "THEN" }, + { FANSATCUplinkMsgElementId_PR_uM166NULL, "DUE TO TRAFFIC" }, + { FANSATCUplinkMsgElementId_PR_uM167NULL, "DUE TO AIRSPACE RESTRICTION" }, + { FANSATCUplinkMsgElementId_PR_uM168NULL, "DISREGARD" }, + { FANSATCUplinkMsgElementId_PR_uM169FreeText, "[freetext]" }, + { FANSATCUplinkMsgElementId_PR_uM170FreeText, "[freetext]" }, + { FANSATCUplinkMsgElementId_PR_uM171VerticalRate, "CLIMB AT [verticalrate] MINIMUM" }, + { FANSATCUplinkMsgElementId_PR_uM172VerticalRate, "CLIMB AT [verticalrate] MAXIMUM" }, + { FANSATCUplinkMsgElementId_PR_uM173VerticalRate, "DESCEND AT [verticalrate] MINIMUM" }, + { FANSATCUplinkMsgElementId_PR_uM174VerticalRate, "DESCEND AT [verticalrate] MAXIMUM" }, + { FANSATCUplinkMsgElementId_PR_uM175Altitude, "REPORT REACHING [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM176NULL, "MAINTAIN OWN SEPARATION AND VMC" }, + { FANSATCUplinkMsgElementId_PR_uM177NULL, "AT PILOTS DISCRETION" }, + { FANSATCUplinkMsgElementId_PR_uM178NULL, "[trackdetailmsg-deleted]" }, + { FANSATCUplinkMsgElementId_PR_uM179NULL, "SQUAWK IDENT" }, + { FANSATCUplinkMsgElementId_PR_uM180AltitudeAltitude, "REPORT REACHING BLOCK [altitude] TO [altitude]" }, + { FANSATCUplinkMsgElementId_PR_uM181ToFromPosition, "REPORT DISTANCE [tofrom] [position]" }, + { FANSATCUplinkMsgElementId_PR_uM182NULL, "CONFIRM ATIS CODE" }, + { 0, NULL } +}; + +la_dict const FANSATCDownlinkMsgElementId_labels[] = { + { FANSATCDownlinkMsgElementId_PR_dM0NULL, "WILCO" }, + { FANSATCDownlinkMsgElementId_PR_dM1NULL, "UNABLE" }, + { FANSATCDownlinkMsgElementId_PR_dM2NULL, "STANDBY" }, + { FANSATCDownlinkMsgElementId_PR_dM3NULL, "ROGER" }, + { FANSATCDownlinkMsgElementId_PR_dM4NULL, "AFFIRM" }, + { FANSATCDownlinkMsgElementId_PR_dM5NULL, "NEGATIVE" }, + { FANSATCDownlinkMsgElementId_PR_dM6Altitude, "REQUEST [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM7AltitudeAltitude, "REQUEST BLOCK [altitude] TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM8Altitude, "REQUEST CRUISE CLIMB TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM9Altitude, "REQUEST CLIMB TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM10Altitude, "REQUEST DESCENT TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM11PositionAltitude, "AT [position] REQUEST CLIMB TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM12PositionAltitude, "AT [position] REQUEST DESCENT TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM13TimeAltitude, "AT [time] REQUEST CLIMB TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM14TimeAltitude, "AT [time] REQUEST DESCENT TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM15DistanceOffsetDirection, "REQUEST OFFSET [distanceoffset] [direction] OF ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM16PositionDistanceOffsetDirection, "AT [position] REQUEST OFFSET [distanceoffset] [direction] OF ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM17TimeDistanceOffsetDirection, "AT [time] REQUEST OFFSET [distanceoffset] [direction] OF ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM18Speed, "REQUEST [speed]" }, + { FANSATCDownlinkMsgElementId_PR_dM19SpeedSpeed, "REQUEST [speed] TO [speed]" }, + { FANSATCDownlinkMsgElementId_PR_dM20NULL, "REQUEST VOICE CONTACT" }, + { FANSATCDownlinkMsgElementId_PR_dM21Frequency, "REQUEST VOICE CONTACT [frequency]" }, + { FANSATCDownlinkMsgElementId_PR_dM22Position, "REQUEST DIRECT TO [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM23ProcedureName, "REQUEST [procedurename]" }, + { FANSATCDownlinkMsgElementId_PR_dM24RouteClearance, "REQUEST [routeclearance]" }, + { FANSATCDownlinkMsgElementId_PR_dM25NULL, "REQUEST CLEARANCE" }, + { FANSATCDownlinkMsgElementId_PR_dM26PositionRouteClearance, "REQUEST WEATHER DEVIATION TO [position] VIA [routeclearance]" }, + { FANSATCDownlinkMsgElementId_PR_dM27DistanceOffsetDirection, "REQUEST WEATHER DEVIATION UP TO [distanceoffset] [direction] OF ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM28Altitude, "LEAVING [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM29Altitude, "CLIMBING TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM30Altitude, "DESCENDING TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM31Position, "PASSING [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM32Altitude, "PRESENT ALTITUDE [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM33Position, "PRESENT POSITION [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM34Speed, "PRESENT SPEED [speed]" }, + { FANSATCDownlinkMsgElementId_PR_dM35Degrees, "PRESENT HEADING [degrees]" }, + { FANSATCDownlinkMsgElementId_PR_dM36Degrees, "PRESENT GROUND TRACK [degrees]" }, + { FANSATCDownlinkMsgElementId_PR_dM37Altitude, "LEVEL [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM38Altitude, "ASSIGNED ALTITUDE [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM39Speed, "ASSIGNED SPEED [speed]" }, + { FANSATCDownlinkMsgElementId_PR_dM40RouteClearance, "ASSIGNED ROUTE [routeclearance]" }, + { FANSATCDownlinkMsgElementId_PR_dM41NULL, "BACK ON ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM42Position, "NEXT WAYPOINT [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM43Time, "NEXT WAYPOINT ETA [time]" }, + { FANSATCDownlinkMsgElementId_PR_dM44Position, "ENSUING WAYPOINT [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM45Position, "REPORTED WAYPOINT [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM46Time, "REPORTED WAYPOINT [time]" }, + { FANSATCDownlinkMsgElementId_PR_dM47BeaconCode, "SQUAWKING [beaconcode]" }, + { FANSATCDownlinkMsgElementId_PR_dM48PositionReport, "POSITION REPORT [positionreport]" }, + { FANSATCDownlinkMsgElementId_PR_dM49Speed, "WHEN CAN WE EXPECT [speed]" }, + { FANSATCDownlinkMsgElementId_PR_dM50SpeedSpeed, "WHEN CAN WE EXPECT [speed] TO [speed]" }, + { FANSATCDownlinkMsgElementId_PR_dM51NULL, "WHEN CAN WE EXPECT BACK ON ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM52NULL, "WHEN CAN WE EXPECT LOWER ALTITUDE" }, + { FANSATCDownlinkMsgElementId_PR_dM53NULL, "WHEN CAN WE EXPECT HIGHER ALTITUDE" }, + { FANSATCDownlinkMsgElementId_PR_dM54Altitude, "WHEN CAN WE EXPECT CRUISE CLIMB TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM55NULL, "PAN PAN PAN" }, + { FANSATCDownlinkMsgElementId_PR_dM56NULL, "MAYDAY MAYDAY MAYDAY" }, + { FANSATCDownlinkMsgElementId_PR_dM57RemainingFuelRemainingSouls, "[remainingfuel] OF FUEL REMAINING AND [remainingsouls] SOULS ON BOARD" }, + { FANSATCDownlinkMsgElementId_PR_dM58NULL, "CANCEL EMERGENCY" }, + { FANSATCDownlinkMsgElementId_PR_dM59PositionRouteClearance, "DIVERTING TO [position] VIA [routeclearance]" }, + { FANSATCDownlinkMsgElementId_PR_dM60DistanceOffsetDirection, "OFFSETTING [distanceoffset] [direction] OF ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM61Altitude, "DESCENDING TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM62ErrorInformation, "ERROR [errorinformation]" }, + { FANSATCDownlinkMsgElementId_PR_dM63NULL, "NOT CURRENT DATA AUTHORITY" }, + { FANSATCDownlinkMsgElementId_PR_dM64ICAOfacilitydesignation, "[icaofacilitydesignation]" }, + { FANSATCDownlinkMsgElementId_PR_dM65NULL, "DUE TO WEATHER" }, + { FANSATCDownlinkMsgElementId_PR_dM66NULL, "DUE TO AIRCRAFT PERFORMANCE" }, + { FANSATCDownlinkMsgElementId_PR_dM67FreeText, "[freetext]" }, + { FANSATCDownlinkMsgElementId_PR_dM68FreeText, "[freetext]" }, + { FANSATCDownlinkMsgElementId_PR_dM69NULL, "REQUEST VMC DESCENT" }, + { FANSATCDownlinkMsgElementId_PR_dM70Degrees, "REQUEST HEADING [degrees]" }, + { FANSATCDownlinkMsgElementId_PR_dM71Degrees, "REQUEST GROUND TRACK [degrees]" }, + { FANSATCDownlinkMsgElementId_PR_dM72Altitude, "REACHING [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM73VersionNumber, "[versionnumber]" }, + { FANSATCDownlinkMsgElementId_PR_dM74NULL, "MAINTAIN OWN SEPARATION AND VMC" }, + { FANSATCDownlinkMsgElementId_PR_dM75NULL, "AT PILOTS DISCRETION" }, + { FANSATCDownlinkMsgElementId_PR_dM76AltitudeAltitude, "REACHING BLOCK [altitude] TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM77AltitudeAltitude, "ASSIGNED BLOCK [altitude] TO [altitude]" }, + { FANSATCDownlinkMsgElementId_PR_dM78TimeDistanceToFromPosition, "AT [time] [distance] [tofrom] [position]" }, + { FANSATCDownlinkMsgElementId_PR_dM79ATISCode, "ATIS [atiscode]" }, + { FANSATCDownlinkMsgElementId_PR_dM80DistanceOffsetDirection, "DEVIATING [distanceoffset][direction] OF ROUTE" }, + { FANSATCDownlinkMsgElementId_PR_dM81NULL, "(reserved: dM81NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM82NULL, "(reserved: dM82NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM83NULL, "(reserved: dM83NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM84NULL, "(reserved: dM84NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM85NULL, "(reserved: dM85NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM86NULL, "(reserved: dM86NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM87NULL, "(reserved: dM87NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM88NULL, "(reserved: dM88NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM89NULL, "(reserved: dM89NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM90NULL, "(reserved: dM90NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM91NULL, "(reserved: dM91NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM92NULL, "(reserved: dM92NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM93NULL, "(reserved: dM93NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM94NULL, "(reserved: dM94NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM95NULL, "(reserved: dM95NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM96NULL, "(reserved: dM96NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM97NULL, "(reserved: dM97NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM98NULL, "(reserved: dM98NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM99NULL, "(reserved: dM99NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM100NULL, "(reserved: dM100NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM101NULL, "(reserved: dM101NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM102NULL, "(reserved: dM102NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM103NULL, "(reserved: dM103NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM104NULL, "(reserved: dM104NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM105NULL, "(reserved: dM105NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM106NULL, "(reserved: dM106NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM107NULL, "(reserved: dM107NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM108NULL, "(reserved: dM108NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM109NULL, "(reserved: dM109NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM110NULL, "(reserved: dM110NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM111NULL, "(reserved: dM111NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM112NULL, "(reserved: dM112NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM113NULL, "(reserved: dM113NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM114NULL, "(reserved: dM114NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM115NULL, "(reserved: dM115NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM116NULL, "(reserved: dM116NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM117NULL, "(reserved: dM117NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM118NULL, "(reserved: dM118NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM119NULL, "(reserved: dM119NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM120NULL, "(reserved: dM120NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM121NULL, "(reserved: dM121NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM122NULL, "(reserved: dM122NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM123NULL, "(reserved: dM123NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM124NULL, "(reserved: dM124NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM125NULL, "(reserved: dM125NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM126NULL, "(reserved: dM126NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM127NULL, "(reserved: dM127NULL)" }, + { FANSATCDownlinkMsgElementId_PR_dM128NULL, "(reserved: dM128NULL)" }, + { 0, NULL } +}; + +/************************ + * ASN.1 type formatters + ************************/ + + +LA_ASN1_FORMATTER_FUNC(la_asn1_output_cpdlc_as_text) { + la_asn1_output(p, la_asn1_cpdlc_text_formatter_table, la_asn1_cpdlc_text_formatter_table_len, true); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_CHOICE_cpdlc_as_text) { + la_format_CHOICE_as_text(p, NULL, la_asn1_output_cpdlc_as_text); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_SEQUENCE_cpdlc_as_text) { + la_format_SEQUENCE_as_text(p, la_asn1_output_cpdlc_as_text); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_SEQUENCE_OF_cpdlc_as_text) { + la_format_SEQUENCE_OF_as_text(p, la_asn1_output_cpdlc_as_text); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltimeterEnglish_as_text) { + la_format_INTEGER_with_unit_as_text(p, " inHg", 0.01, 2); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltimeterMetric_as_text) { + la_format_INTEGER_with_unit_as_text(p, " hPa", 0.1, 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltitudeGNSSFeet_as_text) { + la_format_INTEGER_with_unit_as_text(p, " ft", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSAltitudeFlightLevelMetric_as_text) { + la_format_INTEGER_with_unit_as_text(p, " m", 10, 0); +} + +LA_ASN1_FORMATTER_FUNC(la_asn1_format_Degrees_as_text) { + la_format_INTEGER_with_unit_as_text(p, " deg", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSDistanceOffsetNm_as_text) { + la_format_INTEGER_with_unit_as_text(p, " nm", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSDistanceMetric_as_text) { + la_format_INTEGER_with_unit_as_text(p, " km", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSFeetX10_as_text) { + la_format_INTEGER_with_unit_as_text(p, " ft", 10, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSFrequencyhf_as_text) { + la_format_INTEGER_with_unit_as_text(p, " kHz", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSFrequencykHzToMHz_as_text) { + la_format_INTEGER_with_unit_as_text(p, " MHz", 0.001, 3); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSDistanceEnglish_as_text) { + la_format_INTEGER_with_unit_as_text(p, " nm", 0.1, 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLegTime_as_text) { + la_format_INTEGER_with_unit_as_text(p, " min", 0.1, 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSMeters_as_text) { + la_format_INTEGER_with_unit_as_text(p, " m", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTemperatureC_as_text) { + la_format_INTEGER_with_unit_as_text(p, " C", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTemperatureF_as_text) { + la_format_INTEGER_with_unit_as_text(p, " F", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSWindSpeedEnglish_as_text) { + la_format_INTEGER_with_unit_as_text(p, " kts", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSWindSpeedMetric_as_text) { + la_format_INTEGER_with_unit_as_text(p, " km/h", 1, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSRTATolerance_as_text) { + la_format_INTEGER_with_unit_as_text(p, " min", 0.1, 1); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSSpeedEnglishX10_as_text) { + la_format_INTEGER_with_unit_as_text(p, " kts", 10, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSSpeedMetricX10_as_text) { + la_format_INTEGER_with_unit_as_text(p, " km/h", 10, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSSpeedMach_as_text) { + la_format_INTEGER_with_unit_as_text(p, "", 0.01, 2); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSVerticalRateEnglish_as_text) { + la_format_INTEGER_with_unit_as_text(p, " ft/min", 100, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSVerticalRateMetric_as_text) { + la_format_INTEGER_with_unit_as_text(p, " m/min", 10, 0); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSBeaconCode_as_text) { + FANSBeaconCode_t const *code = p.sptr; + long **cptr = code->list.array; + LA_ISPRINTF(p.vstr, p.indent, "%s: %ld%ld%ld%ld\n", + p.label, + *cptr[0], + *cptr[1], + *cptr[2], + *cptr[3] + ); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTime_as_text) { + FANSTime_t const *t = p.sptr; + LA_ISPRINTF(p.vstr, p.indent, "%s: %02ld:%02ld\n", p.label, t->hours, t->minutes); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSTimestamp_as_text) { + FANSTimestamp_t const *t = p.sptr; + LA_ISPRINTF(p.vstr, p.indent, "%s: %02ld:%02ld:%02ld\n", p.label, t->hours, t->minutes, t->seconds); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLatitude_as_text) { + FANSLatitude_t const *lat = p.sptr; + long const ldir = lat->latitudeDirection; + char const *ldir_name = la_asn1_value2enum(&asn_DEF_FANSLatitudeDirection, ldir); + if(lat->minutesLatLon != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s: %02ld %04.1f' %s\n", + p.label, + lat->latitudeDegrees, + *(long const *)(lat->minutesLatLon) / 10.0, + ldir_name + ); + } else { + LA_ISPRINTF(p.vstr, p.indent, "%s: %02ld deg %s\n", + p.label, + lat->latitudeDegrees, + ldir_name + ); + } +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSLongitude_as_text) { + FANSLongitude_t const *lat = p.sptr; + long const ldir = lat->longitudeDirection; + char const *ldir_name = la_asn1_value2enum(&asn_DEF_FANSLongitudeDirection, ldir); + if(lat->minutesLatLon != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s: %03ld %04.1f' %s\n", + p.label, + lat->longitudeDegrees, + *(long const *)(lat->minutesLatLon) / 10.0, + ldir_name + ); + } else { + LA_ISPRINTF(p.vstr, p.indent, "%s: %03ld deg %s\n", + p.label, + lat->longitudeDegrees, + ldir_name + ); + } +} + +// Can't replace this with la_asn1_format_SEQUENCE_cpdlc_as_text, because the first msg element +// is not a part of a SEQ-OF, hence we don't have any data type which we could +// associate "Message data:" label with (nor we can't use FANSATCUplinkMsgElementId +// for that because the same type is used inside the SEQ-OF which would cause +// the label to be printed for each element in the sequence). The same applies +// to la_asn1_format_FANSATCDownlinkMessage_as_text. +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSATCUplinkMessage_as_text) { + FANSATCUplinkMessage_t const *msg = p.sptr; + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s:\n", p.label); + p.indent++; + } + p.td = &asn_DEF_FANSATCMessageHeader; + p.sptr = &msg->aTCMessageheader; + la_asn1_output_cpdlc_as_text(p); + LA_ISPRINTF(p.vstr, p.indent, "Message data:\n"); + p.indent++; + p.td = &asn_DEF_FANSATCUplinkMsgElementId; + p.sptr = &msg->aTCuplinkmsgelementId; + la_asn1_output_cpdlc_as_text(p); + if(msg->aTCuplinkmsgelementid_seqOf != NULL) { + p.td = &asn_DEF_FANSATCUplinkMsgElementIdSequence; + p.sptr = msg->aTCuplinkmsgelementid_seqOf; + la_asn1_output_cpdlc_as_text(p); + } +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSATCDownlinkMessage_as_text) { + FANSATCDownlinkMessage_t const *msg = p.sptr; + if(p.label != NULL) { + LA_ISPRINTF(p.vstr, p.indent, "%s:\n", p.label); + p.indent++; + } + p.td = &asn_DEF_FANSATCMessageHeader; + p.sptr = &msg->aTCMessageheader; + la_asn1_output_cpdlc_as_text(p); + LA_ISPRINTF(p.vstr, p.indent, "Message data:\n"); + p.indent++; + p.td = &asn_DEF_FANSATCDownlinkMsgElementId; + p.sptr = &msg->aTCDownlinkmsgelementid; + la_asn1_output_cpdlc_as_text(p); + if(msg->aTCdownlinkmsgelementid_seqOf != NULL) { + p.td = &asn_DEF_FANSATCDownlinkMsgElementIdSequence; + p.sptr = msg->aTCdownlinkmsgelementid_seqOf; + la_asn1_output_cpdlc_as_text(p); + } +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSATCDownlinkMsgElementId_as_text) { + la_format_CHOICE_as_text(p, FANSATCDownlinkMsgElementId_labels, la_asn1_output_cpdlc_as_text); +} + +static LA_ASN1_FORMATTER_FUNC(la_asn1_format_FANSATCUplinkMsgElementId_as_text) { + la_format_CHOICE_as_text(p, FANSATCUplinkMsgElementId_labels, la_asn1_output_cpdlc_as_text); +} + +static la_asn1_formatter const la_asn1_cpdlc_text_formatter_table[209] = { + { .type = &asn_DEF_FANSAircraftEquipmentCode, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAircraftFlightIdentification, .format = la_asn1_format_any_as_text, .label = "Flight ID" }, + { .type = &asn_DEF_FANSAircraftType, .format = la_asn1_format_any_as_text, .label = "Aircraft type" }, + { .type = &asn_DEF_FANSAirport, .format = la_asn1_format_any_as_text, .label = "Airport" }, + { .type = &asn_DEF_FANSAirportDeparture, .format = la_asn1_format_any_as_text, .label = "Departure airport" }, + { .type = &asn_DEF_FANSAirportDestination, .format = la_asn1_format_any_as_text, .label = "Destination airport" }, + { .type = &asn_DEF_FANSAirwayIdentifier, .format = la_asn1_format_any_as_text, .label = "Airway ID" }, + { .type = &asn_DEF_FANSAirwayIntercept, .format = la_asn1_format_any_as_text, .label = "Airway intercept" }, + { .type = &asn_DEF_FANSAltimeter, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAltimeterEnglish, .format = la_asn1_format_FANSAltimeterEnglish_as_text, .label = "Altimeter" }, + { .type = &asn_DEF_FANSAltimeterMetric, .format = la_asn1_format_FANSAltimeterMetric_as_text, .label = "Altimeter" }, + { .type = &asn_DEF_FANSAltitude, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAltitudeAltitude, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAltitudeFlightLevel, .format = la_asn1_format_any_as_text, .label = "Flight level" }, + { .type = &asn_DEF_FANSAltitudeFlightLevelMetric, .format = la_asn1_format_FANSAltitudeFlightLevelMetric_as_text, .label = "Flight level" }, + { .type = &asn_DEF_FANSAltitudeGNSSFeet, .format = la_asn1_format_FANSAltitudeGNSSFeet_as_text, .label = "Altitude (GNSS)" }, + { .type = &asn_DEF_FANSAltitudeGNSSMeters, .format = la_asn1_format_FANSMeters_as_text, .label = "Altitude (GNSS)" }, + { .type = &asn_DEF_FANSAltitudePosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAltitudeQFE, .format = la_asn1_format_FANSFeetX10_as_text, .label = "Altitude (QFE)" }, + { .type = &asn_DEF_FANSAltitudeQFEMeters, .format = la_asn1_format_FANSMeters_as_text, .label = "Altitude (QFE)" }, + { .type = &asn_DEF_FANSAltitudeQNH, .format = la_asn1_format_FANSFeetX10_as_text, .label = "Altitude (QNH)" }, + { .type = &asn_DEF_FANSAltitudeQNHMeters, .format = la_asn1_format_FANSMeters_as_text, .label = "Altitude (QNH)" }, + { .type = &asn_DEF_FANSAltitudeRestriction, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Altitude restriction" }, + { .type = &asn_DEF_FANSAltitudeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAltitudeSpeedSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSAltitudeTime, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATCDownlinkMessage, .format = la_asn1_format_FANSATCDownlinkMessage_as_text, .label = "CPDLC Downlink Message" }, + { .type = &asn_DEF_FANSATCDownlinkMsgElementId, .format = la_asn1_format_FANSATCDownlinkMsgElementId_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATCDownlinkMsgElementIdSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATCMessageHeader, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Header" }, + { .type = &asn_DEF_FANSATCUplinkMessage, .format = la_asn1_format_FANSATCUplinkMessage_as_text, .label = "CPDLC Uplink Message" }, + { .type = &asn_DEF_FANSATCUplinkMsgElementId, .format = la_asn1_format_FANSATCUplinkMsgElementId_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATCUplinkMsgElementIdSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATISCode, .format = la_asn1_format_any_as_text, .label = "ATIS code" }, + { .type = &asn_DEF_FANSATWAlongTrackWaypoint, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATWAlongTrackWaypointSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Along-track waypoints" }, + { .type = &asn_DEF_FANSATWAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATWAltitudeSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATWAltitudeTolerance, .format = la_asn1_format_ENUM_as_text, .label = "ATW altitude tolerance" }, + { .type = &asn_DEF_FANSATWDistance, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSATWDistanceTolerance, .format = la_asn1_format_ENUM_as_text, .label = "ATW distance tolerance" }, + { .type = &asn_DEF_FANSBeaconCode, .format = la_asn1_format_FANSBeaconCode_as_text, .label = "Code" }, + { .type = &asn_DEF_FANSCOMNAVApproachEquipmentAvailable, .format = la_asn1_format_any_as_text, .label = "COMM/NAV/Approach equipment available" }, + { .type = &asn_DEF_FANSCOMNAVEquipmentStatus, .format = la_asn1_format_ENUM_as_text, .label = "COMM/NAV equipment status" }, + { .type = &asn_DEF_FANSCOMNAVEquipmentStatusSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "COMM/NAV Equipment status list" }, + { .type = &asn_DEF_FANSDegreeIncrement, .format = la_asn1_format_Degrees_as_text, .label = "Degree increment" }, + { .type = &asn_DEF_FANSDegrees, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSDegreesMagnetic, .format = la_asn1_format_Degrees_as_text, .label = "Degrees (magnetic)" }, + { .type = &asn_DEF_FANSDegreesTrue, .format = la_asn1_format_Degrees_as_text, .label = "Degrees (true)" }, + { .type = &asn_DEF_FANSDirection, .format = la_asn1_format_ENUM_as_text, .label = "Direction" }, + { .type = &asn_DEF_FANSDirectionDegrees, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSDistance, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSDistanceKm, .format = la_asn1_format_FANSDistanceMetric_as_text, .label = "Distance" }, + { .type = &asn_DEF_FANSDistanceNm, .format = la_asn1_format_FANSDistanceEnglish_as_text, .label = "Distance" }, + { .type = &asn_DEF_FANSDistanceOffset, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSDistanceOffsetDirection, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSDistanceOffsetKm, .format = la_asn1_format_FANSDistanceMetric_as_text, .label = "Offset" }, + { .type = &asn_DEF_FANSDistanceOffsetNm, .format = la_asn1_format_FANSDistanceOffsetNm_as_text, .label = "Offset" }, + { .type = &asn_DEF_FANSEFCtime, .format = la_asn1_format_FANSTime_as_text, .label = "Expect further clearance at" }, + { .type = &asn_DEF_FANSErrorInformation, .format = la_asn1_format_ENUM_as_text, .label = "Error information" }, + { .type = &asn_DEF_FANSFixName, .format = la_asn1_format_any_as_text, .label = "Fix" }, + { .type = &asn_DEF_FANSFixNext, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Next fix" }, + { .type = &asn_DEF_FANSFixNextPlusOne, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Next+1 fix" }, + { .type = &asn_DEF_FANSFreeText, .format = la_asn1_format_any_as_text, .label = NULL }, + { .type = &asn_DEF_FANSFrequency, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSFrequencyDeparture, .format = la_asn1_format_FANSFrequencykHzToMHz_as_text, .label = "Departure frequency" }, + { .type = &asn_DEF_FANSFrequencyhf, .format = la_asn1_format_FANSFrequencyhf_as_text, .label = "HF" }, + { .type = &asn_DEF_FANSFrequencysatchannel, .format = la_asn1_format_any_as_text, .label = "Satcom channel" }, + { .type = &asn_DEF_FANSFrequencyuhf, .format = la_asn1_format_FANSFrequencykHzToMHz_as_text, .label = "UHF" }, + { .type = &asn_DEF_FANSFrequencyvhf, .format = la_asn1_format_FANSFrequencykHzToMHz_as_text, .label = "VHF" }, + { .type = &asn_DEF_FANSHoldatwaypoint, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSHoldatwaypointSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Holding points" }, + { .type = &asn_DEF_FANSHoldatwaypointSpeedHigh, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Holding speed (max)" }, + { .type = &asn_DEF_FANSHoldatwaypointSpeedLow, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Holding speed (min)" }, + { .type = &asn_DEF_FANSHoldClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSICAOfacilityDesignation, .format = la_asn1_format_any_as_text, .label = "Facility designation" }, + { .type = &asn_DEF_FANSICAOFacilityDesignationTp4Table, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSICAOFacilityFunction, .format = la_asn1_format_ENUM_as_text, .label = "Facility function" }, + { .type = &asn_DEF_FANSICAOFacilityIdentification, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSICAOFacilityName, .format = la_asn1_format_any_as_text, .label = "Facility Name" }, + { .type = &asn_DEF_FANSICAOUnitName, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSICAOUnitNameFrequency, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSIcing, .format = la_asn1_format_ENUM_as_text, .label = "Icing" }, + { .type = &asn_DEF_FANSInterceptCourseFrom, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSInterceptCourseFromSelection, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSInterceptCourseFromSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Intercept courses" }, + { .type = &asn_DEF_FANSLatitude, .format = la_asn1_format_FANSLatitude_as_text, .label = "Latitude" }, + { .type = &asn_DEF_FANSLatitudeDegrees, .format = la_asn1_format_Degrees_as_text, .label = "Latitude" }, + { .type = &asn_DEF_FANSLatitudeDirection, .format = la_asn1_format_ENUM_as_text, .label = "Direction" }, + { .type = &asn_DEF_FANSLatitudeLongitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSLatitudeLongitudeSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Coordinate list" }, + { .type = &asn_DEF_FANSLatitudeReportingPoints, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSLatLonReportingPoints, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSLegDistance, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSLegDistanceEnglish, .format = la_asn1_format_FANSDistanceEnglish_as_text, .label = "Leg distance" }, + { .type = &asn_DEF_FANSLegDistanceMetric, .format = la_asn1_format_FANSDistanceMetric_as_text, .label = "Leg distance" }, + { .type = &asn_DEF_FANSLegTime, .format = la_asn1_format_FANSLegTime_as_text, .label = "Leg time" }, + { .type = &asn_DEF_FANSLegType, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSLongitude, .format = la_asn1_format_FANSLongitude_as_text, .label = "Longitude" }, + { .type = &asn_DEF_FANSLongitudeDegrees, .format = la_asn1_format_Degrees_as_text, .label = "Longitude" }, + { .type = &asn_DEF_FANSLongitudeDirection, .format = la_asn1_format_ENUM_as_text, .label = "Direction" }, + { .type = &asn_DEF_FANSLongitudeReportingPoints, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSMsgIdentificationNumber, .format = la_asn1_format_any_as_text, .label = "Msg ID" }, + { .type = &asn_DEF_FANSMsgReferenceNumber, .format = la_asn1_format_any_as_text, .label = "Msg Ref" }, + { .type = &asn_DEF_FANSNavaid, .format = la_asn1_format_any_as_text, .label = "Navaid" }, + { .type = &asn_DEF_FANSPDCrevision, .format = la_asn1_format_any_as_text, .label = "Revision number" }, + { .type = &asn_DEF_FANSPlaceBearing, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPlaceBearingDistance, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPlaceBearingPlaceBearing, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPosition, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionAltitudeAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionAltitudeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionCurrent, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionDegrees, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionDistanceOffsetDirection, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionICAOUnitNameFrequency, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionPosition, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionProcedureName, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionReport, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionRouteClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionSpeedSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionTime, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionTimeAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPositionTimeTime, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSPredepartureClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSProcedure, .format = la_asn1_format_any_as_text, .label = "Procedure name" }, + { .type = &asn_DEF_FANSProcedureApproach, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Approach procedure" }, + { .type = &asn_DEF_FANSProcedureArrival, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Arrival procedure" }, + { .type = &asn_DEF_FANSProcedureDeparture, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Departure procedure" }, + { .type = &asn_DEF_FANSProcedureName, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSProcedureTransition, .format = la_asn1_format_any_as_text, .label = "Procedure transition" }, + { .type = &asn_DEF_FANSProcedureType, .format = la_asn1_format_ENUM_as_text, .label = "Procedure type" }, + { .type = &asn_DEF_FANSPublishedIdentifier, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Published identifier" }, + { .type = &asn_DEF_FANSRemainingFuel, .format = la_asn1_format_FANSTime_as_text, .label = "Remaining fuel" }, + { .type = &asn_DEF_FANSRemainingFuelRemainingSouls, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRemainingSouls, .format = la_asn1_format_any_as_text, .label = "Persons on board" }, + { .type = &asn_DEF_FANSReportedWaypointAltitude, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Reported waypoint altitude" }, + { .type = &asn_DEF_FANSReportedWaypointPosition, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Reported waypoint position" }, + { .type = &asn_DEF_FANSReportedWaypointTime, .format = la_asn1_format_FANSTime_as_text, .label = "Reported waypoint time" }, + { .type = &asn_DEF_FANSReportingPoints, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRouteClearance, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRouteInformation, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRouteInformationAdditional, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRouteInformationSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Route" }, + { .type = &asn_DEF_FANSRTARequiredTimeArrival, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRTARequiredTimeArrivalSequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Required arrival times" }, + { .type = &asn_DEF_FANSRTATime, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRTATolerance, .format = la_asn1_format_FANSRTATolerance_as_text, .label = "RTA tolerance" }, + { .type = &asn_DEF_FANSRunway, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSRunwayArrival, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Arrival runway" }, + { .type = &asn_DEF_FANSRunwayConfiguration, .format = la_asn1_format_ENUM_as_text, .label = "Runway configuration" }, + { .type = &asn_DEF_FANSRunwayDeparture, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = "Departure runway" }, + { .type = &asn_DEF_FANSRunwayDirection, .format = la_asn1_format_any_as_text, .label = "Runway direction" }, + { .type = &asn_DEF_FANSSpeed, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSSpeedGround, .format = la_asn1_format_FANSSpeedEnglishX10_as_text, .label = "Ground speed" }, + { .type = &asn_DEF_FANSSpeedGroundMetric, .format = la_asn1_format_FANSSpeedMetricX10_as_text, .label = "Ground speed" }, + { .type = &asn_DEF_FANSSpeedIndicated, .format = la_asn1_format_FANSSpeedEnglishX10_as_text, .label = "Indicated airspeed" }, + { .type = &asn_DEF_FANSSpeedIndicatedMetric, .format = la_asn1_format_FANSSpeedMetricX10_as_text, .label = "Indicated airspeed" }, + { .type = &asn_DEF_FANSSpeedMach, .format = la_asn1_format_FANSSpeedMach_as_text, .label = "Mach number" }, + { .type = &asn_DEF_FANSSpeedMachLarge, .format = la_asn1_format_FANSSpeedMach_as_text, .label = "Mach number" }, + { .type = &asn_DEF_FANSSpeedSpeed, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSSpeedTrue, .format = la_asn1_format_FANSSpeedEnglishX10_as_text, .label = "True airspeed" }, + { .type = &asn_DEF_FANSSpeedTrueMetric, .format = la_asn1_format_FANSSpeedMetricX10_as_text, .label = "True airspeed" }, + { .type = &asn_DEF_FANSSSREquipmentAvailable, .format = la_asn1_format_ENUM_as_text, .label = "SSR equipment available" }, + { .type = &asn_DEF_FANSSupplementaryInformation, .format = la_asn1_format_any_as_text, .label = "Supplementary information" }, + { .type = &asn_DEF_FANSTemperature, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTemperatureC, .format = la_asn1_format_FANSTemperatureC_as_text, .label = "Temperature" }, + { .type = &asn_DEF_FANSTemperatureF, .format = la_asn1_format_FANSTemperatureF_as_text, .label = "Temperature" }, + { .type = &asn_DEF_FANSTime, .format = la_asn1_format_FANSTime_as_text, .label = "Time" }, + { .type = &asn_DEF_FANSTimeAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimeAtPositionCurrent, .format = la_asn1_format_FANSTime_as_text, .label = "Time at current position" }, + { .type = &asn_DEF_FANSTimeDepartureEdct, .format = la_asn1_format_FANSTime_as_text, .label = "Estimated departure time" }, + { .type = &asn_DEF_FANSTimeDistanceOffsetDirection, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimeDistanceToFromPosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimeEtaAtFixNext, .format = la_asn1_format_FANSTime_as_text, .label = "ETA at next fix" }, + { .type = &asn_DEF_FANSTimeEtaDestination, .format = la_asn1_format_FANSTime_as_text, .label = "ETA at destination" }, + { .type = &asn_DEF_FANSTimeICAOunitnameFrequency, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimePosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimePositionAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimePositionAltitudeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimeSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimeSpeedSpeed, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimestamp, .format = la_asn1_format_FANSTimestamp_as_text, .label = "Timestamp" }, + { .type = &asn_DEF_FANSTimeTime, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTimeTolerance, .format = la_asn1_format_ENUM_as_text, .label = "Time tolerance" }, + { .type = &asn_DEF_FANSToFrom, .format = la_asn1_format_ENUM_as_text, .label = "To/From" }, + { .type = &asn_DEF_FANSToFromPosition, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTp4table, .format = la_asn1_format_ENUM_as_text, .label = "TP4 table" }, + { .type = &asn_DEF_FANSTrackAngle, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "Track angle" }, + { .type = &asn_DEF_FANSTrackDetail, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSTrackName, .format = la_asn1_format_any_as_text, .label = "Track name" }, + { .type = &asn_DEF_FANSTrueheading, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = "True heading" }, + { .type = &asn_DEF_FANSTurbulence, .format = la_asn1_format_ENUM_as_text, .label = "Turbulence" }, + { .type = &asn_DEF_FANSVersionNumber, .format = la_asn1_format_any_as_text, .label = "Version number" }, + { .type = &asn_DEF_FANSVerticalChange, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSVerticalDirection, .format = la_asn1_format_ENUM_as_text, .label = "Vertical direction" }, + { .type = &asn_DEF_FANSVerticalRate, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSVerticalRateEnglish, .format = la_asn1_format_FANSVerticalRateEnglish_as_text, .label = "Vertical rate" }, + { .type = &asn_DEF_FANSVerticalRateMetric, .format = la_asn1_format_FANSVerticalRateMetric_as_text, .label = "Vertical rate" }, + { .type = &asn_DEF_FANSWaypointSpeedAltitude, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSWaypointSpeedAltitudesequence, .format = la_asn1_format_SEQUENCE_OF_cpdlc_as_text, .label = "Waypoints, speeds and altitudes" }, + { .type = &asn_DEF_FANSWindDirection, .format = la_asn1_format_Degrees_as_text, .label = "Wind direction" }, + { .type = &asn_DEF_FANSWinds, .format = la_asn1_format_SEQUENCE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSWindSpeed, .format = la_asn1_format_CHOICE_cpdlc_as_text, .label = NULL }, + { .type = &asn_DEF_FANSWindSpeedEnglish, .format = la_asn1_format_FANSWindSpeedEnglish_as_text, .label = "Wind speed" }, + { .type = &asn_DEF_FANSWindSpeedMetric, .format = la_asn1_format_FANSWindSpeedMetric_as_text, .label = "Wind speed" }, + { .type = &asn_DEF_NULL, .format = NULL, .label = NULL } +}; + +static size_t la_asn1_cpdlc_text_formatter_table_len = +sizeof(la_asn1_cpdlc_text_formatter_table) / sizeof(la_asn1_formatter); diff --git a/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc.h b/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc.h new file mode 100644 index 000000000..32e19007a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-format-cpdlc.h @@ -0,0 +1,22 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_ASN1_FORMAT_CPDLC_H +#define LA_ASN1_FORMAT_CPDLC_H 1 +#include // asn_TYPE_descriptor_t +#include // la_vstring +#include // la_dict +#include // LA_ASN1_FORMATTER_FUNC + +// asn1-format-cpdlc-text.c +LA_ASN1_FORMATTER_FUNC(la_asn1_output_cpdlc_as_text); +extern la_dict const FANSATCUplinkMsgElementId_labels[]; +extern la_dict const FANSATCDownlinkMsgElementId_labels[]; + +// asn1-format-cpdlc-json.c +LA_ASN1_FORMATTER_FUNC(la_asn1_output_cpdlc_as_json); + +#endif // !LA_ASN1_FORMAT_CPDLC_H diff --git a/plugins/inmarsat_support/aero/libacars/asn1-util.c b/plugins/inmarsat_support/aero/libacars/asn1-util.c new file mode 100644 index 000000000..9653a487b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-util.c @@ -0,0 +1,62 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include // lfind() +#include // asn_TYPE_descriptor_t +#include // la_asn1_formatter +#include // LA_ISPRINTF, la_debug_print +#include // la_vstring +#include "config.h" // LFIND_NMEMB_SIZE_SIZE_T, LFIND_NMEMB_SIZE_UINT + +static int la_compare_fmtr(void const *k, void const *m) { + la_asn1_formatter const *memb = m; + return(k == memb->type ? 0 : 1); +} + +int la_asn1_decode_as(asn_TYPE_descriptor_t *td, void **struct_ptr, uint8_t const *buf, int size) { + asn_dec_rval_t rval; + rval = uper_decode_complete(0, td, struct_ptr, buf, size); + if(rval.code != RC_OK) { + la_debug_print(D_ERROR, "uper_decode_complete failed: %d\n", rval.code); + return -1; + } + if(rval.consumed < (size_t)size) { + la_debug_print(D_ERROR, "uper_decode_complete left %zd unparsed octets\n", (size_t)size - rval.consumed); + return (int)((size_t)size - rval.consumed); + } +#ifdef DEBUG + if(Debug >= D_VERBOSE) { + asn_fprint(stderr, td, *struct_ptr, 1); + } +#endif + return 0; +} + +void la_asn1_output(la_asn1_formatter_params p, la_asn1_formatter const *asn1_formatter_table, + size_t asn1_formatter_table_len, bool dump_unknown_types) { + if(p.td == NULL || p.sptr == NULL) return; +#if defined LFIND_NMEMB_SIZE_SIZE_T + size_t table_len = asn1_formatter_table_len; +#elif defined LFIND_NMEMB_SIZE_UINT + unsigned int table_len = (unsigned int)asn1_formatter_table_len; +#endif + la_asn1_formatter *formatter = lfind(p.td, asn1_formatter_table, &table_len, + sizeof(la_asn1_formatter), &la_compare_fmtr); + if(formatter != NULL) { + // NULL formatting routine is allowed - it means the type should be silently omitted + if(formatter->format != NULL) { + p.label = formatter->label; + (*formatter->format)(p); + } + } else if(dump_unknown_types) { + LA_ISPRINTF(p.vstr, p.indent, "-- Formatter for type %s not found, ASN.1 dump follows:\n", p.td->name); + LA_ISPRINTF(p.vstr, p.indent, "%s", ""); // asn_sprintf does not indent the first line + asn_sprintf(p.vstr, p.td, p.sptr, p.indent+1); + LA_EOL(p.vstr); + LA_ISPRINTF(p.vstr, p.indent, "%s", "-- ASN.1 dump end\n"); + } +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1-util.h b/plugins/inmarsat_support/aero/libacars/asn1-util.h new file mode 100644 index 000000000..90e710758 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1-util.h @@ -0,0 +1,39 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_ASN1_UTIL_H +#define LA_ASN1_UTIL_H 1 +#include // size_t +#include // uint8_t +#include // asn_TYPE_descriptor_t +#include // la_vstring + +// Parameters to the formatter function +typedef struct { + la_vstring *vstr; + char const *label; + asn_TYPE_descriptor_t *td; + void const *sptr; + int indent; +} la_asn1_formatter_params; + +// Formatter function prototype +typedef void (*la_asn1_formatter_func)(la_asn1_formatter_params); + +typedef struct { + asn_TYPE_descriptor_t *type; + la_asn1_formatter_func format; + char const *label; +} la_asn1_formatter; + +#define LA_ASN1_FORMATTER_FUNC(x) \ + void x(la_asn1_formatter_params p) + +// asn1-util.c +int la_asn1_decode_as(asn_TYPE_descriptor_t *td, void **struct_ptr, uint8_t const *buf, int size); +void la_asn1_output(la_asn1_formatter_params p, la_asn1_formatter const *asn1_formatter_table, + size_t asn1_formatter_table_len, bool dump_unknown_types); +#endif // !LA_ASN1_UTIL_H diff --git a/plugins/inmarsat_support/aero/libacars/asn1/BIT_STRING.c b/plugins/inmarsat_support/aero/libacars/asn1/BIT_STRING.c new file mode 100644 index 000000000..b7794e07f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/BIT_STRING.c @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "BIT_STRING.h" +#include "asn_internal.h" + +/* + * BIT STRING basic type description. + */ +static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = { + sizeof(BIT_STRING_t), + offsetof(BIT_STRING_t, _asn_ctx), + ASN_OSUBV_BIT +}; +asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { + "BIT STRING", + "BIT_STRING", + OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ + BIT_STRING_print, + BIT_STRING_constraint, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_xer_binary, + BIT_STRING_encode_xer, + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BIT_STRING_tags, + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + asn_DEF_BIT_STRING_tags, /* Same as above */ + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_DEF_BIT_STRING_specs +}; + +/* + * BIT STRING generic constraint. + */ +int +BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + + if(st && st->buf) { + if((st->size == 0 && st->bits_unused) + || st->bits_unused < 0 || st->bits_unused > 7) { + ASN__CTFAIL(app_key, td, sptr, + "%s: invalid padding byte (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} + +static char *_bit_pattern[16] = { + "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", + "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" +}; + +asn_enc_rval_t +BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + char scratch[128]; + char *p = scratch; + char *scend = scratch + (sizeof(scratch) - 10); + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + int xcan = (flags & XER_F_CANONICAL); + uint8_t *buf; + uint8_t *end; + + if(!st || !st->buf) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + buf = st->buf; + end = buf + st->size - 1; /* Last byte is special */ + + /* + * Binary dump + */ + for(; buf < end; buf++) { + int v = *buf; + int nline = xcan?0:(((buf - st->buf) % 8) == 0); + if(p >= scend || nline) { + er.encoded += p - scratch; + ASN__CALLBACK(scratch, p - scratch); + p = scratch; + if(nline) ASN__TEXT_INDENT(1, ilevel); + } + memcpy(p + 0, _bit_pattern[v >> 4], 4); + memcpy(p + 4, _bit_pattern[v & 0x0f], 4); + p += 8; + } + + if(!xcan && ((buf - st->buf) % 8) == 0) + ASN__TEXT_INDENT(1, ilevel); + er.encoded += p - scratch; + ASN__CALLBACK(scratch, p - scratch); + p = scratch; + + if(buf == end) { + int v = *buf; + int ubits = st->bits_unused; + int i; + for(i = 7; i >= ubits; i--) + *p++ = (v & (1 << i)) ? 0x31 : 0x30; + er.encoded += p - scratch; + ASN__CALLBACK(scratch, p - scratch); + } + + if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + + +/* + * BIT STRING specific contents printer. + */ +int +BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const char * const h2c = "0123456789ABCDEF"; + char scratch[64]; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + uint8_t *buf; + uint8_t *end; + char *p = scratch; + + (void)td; /* Unused argument */ + + if(!st || !st->buf) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + ilevel++; + buf = st->buf; + end = buf + st->size; + + /* + * Hexadecimal dump. + */ + for(; buf < end; buf++) { + if((buf - st->buf) % 16 == 0 && (st->size > 16) + && buf != st->buf) { + _i_INDENT(1); + /* Dump the string */ + if(cb(scratch, p - scratch, app_key) < 0) return -1; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Eat the tailing space */ + + if((st->size > 16)) { + _i_INDENT(1); + } + + /* Dump the incomplete 16-bytes row */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + return 0; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/BIT_STRING.h b/plugins/inmarsat_support/aero/libacars/asn1/BIT_STRING.h new file mode 100644 index 000000000..75435b89d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/BIT_STRING.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BIT_STRING_H_ +#define _BIT_STRING_H_ + +#include "OCTET_STRING.h" /* Some help from OCTET STRING */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct BIT_STRING_s { + uint8_t *buf; /* BIT STRING body */ + int size; /* Size of the above buffer */ + + int bits_unused;/* Unused trailing bits in the last octet (0..7) */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} BIT_STRING_t; + +extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING; + +asn_struct_print_f BIT_STRING_print; /* Human-readable output */ +asn_constr_check_f BIT_STRING_constraint; +xer_type_encoder_f BIT_STRING_encode_xer; + +#ifdef __cplusplus +} +#endif + +#endif /* _BIT_STRING_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/BOOLEAN.c b/plugins/inmarsat_support/aero/libacars/asn1/BOOLEAN.c new file mode 100644 index 000000000..1a9c38092 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/BOOLEAN.c @@ -0,0 +1,282 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "asn_codecs_prim.h" +#include "BOOLEAN.h" + +/* + * BOOLEAN basic type description. + */ +static const ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { + "BOOLEAN", + "BOOLEAN", + BOOLEAN_free, + BOOLEAN_print, + asn_generic_no_constraint, + BOOLEAN_decode_ber, + BOOLEAN_encode_der, + BOOLEAN_decode_xer, + BOOLEAN_encode_xer, + BOOLEAN_decode_uper, /* Unaligned PER decoder */ + BOOLEAN_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BOOLEAN_tags, + sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), + asn_DEF_BOOLEAN_tags, /* Same as above */ + sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode BOOLEAN type. + */ +asn_dec_rval_t +BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **bool_value, const void *buf_ptr, size_t size, + int tag_mode) { + BOOLEAN_t *st = (BOOLEAN_t *)*bool_value; + asn_dec_rval_t rval; + ber_tlv_len_t length; + ber_tlv_len_t lidx; + + if(st == NULL) { + st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); + if(st == NULL) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + } + + ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", + td->name, tag_mode); + + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, + tag_mode, 0, &length, 0); + if(rval.code != RC_OK) + return rval; + + ASN_DEBUG("Boolean length is %d bytes", (int)length); + + buf_ptr = ((const char *)buf_ptr) + rval.consumed; + size -= rval.consumed; + if(length > (ber_tlv_len_t)size) { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } + + /* + * Compute boolean value. + */ + for(*st = 0, lidx = 0; + (lidx < length) && *st == 0; lidx++) { + /* + * Very simple approach: read bytes until the end or + * value is already TRUE. + * BOOLEAN is not supposed to contain meaningful data anyway. + */ + *st |= ((const uint8_t *)buf_ptr)[lidx]; + } + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", + (long)rval.consumed, (long)length, + td->name, *st); + + return rval; +} + +asn_enc_rval_t +BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval; + BOOLEAN_t *st = (BOOLEAN_t *)sptr; + + erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + + if(cb) { + uint8_t bool_value; + + bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ + + if(cb(&bool_value, 1, app_key) < 0) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } + + erval.encoded += 1; + + ASN__ENCODED_OK(erval); +} + + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +static enum xer_pbd_rval +BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { + BOOLEAN_t *st = (BOOLEAN_t *)sptr; + const char *p = (const char *)chunk_buf; + + (void)td; + + if(chunk_size && p[0] == 0x3c /* '<' */) { + switch(xer_check_tag(chunk_buf, chunk_size, "false")) { + case XCT_BOTH: + /* "" */ + *st = 0; + break; + case XCT_UNKNOWN_BO: + if(xer_check_tag(chunk_buf, chunk_size, "true") + != XCT_BOTH) + return XPBD_BROKEN_ENCODING; + /* "" */ + *st = 1; /* Or 0xff as in DER?.. */ + break; + default: + return XPBD_BROKEN_ENCODING; + } + return XPBD_BODY_CONSUMED; + } else { + return XPBD_BROKEN_ENCODING; + } +} + + +asn_dec_rval_t +BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + + return xer_decode_primitive(opt_codec_ctx, td, + sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size, + BOOLEAN__xer_body_decode); +} + +asn_enc_rval_t +BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; + asn_enc_rval_t er; + + (void)ilevel; + (void)flags; + + if(!st) ASN__ENCODE_FAILED; + + if(*st) { + ASN__CALLBACK("", 7); + er.encoded = 7; + } else { + ASN__CALLBACK("", 8); + er.encoded = 8; + } + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +int +BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; + const char *buf; + size_t buflen; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(st) { + if(*st) { + buf = "TRUE"; + buflen = 4; + } else { + buf = "FALSE"; + buflen = 5; + } + } else { + buf = ""; + buflen = 8; + } + + return (cb(buf, buflen, app_key) < 0) ? -1 : 0; +} + +void +BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + if(td && ptr && !contents_only) { + FREEMEM(ptr); + } +} + +asn_dec_rval_t +BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + BOOLEAN_t *st = (BOOLEAN_t *)*sptr; + + (void)opt_codec_ctx; + (void)constraints; + + if(!st) { + st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); + if(!st) ASN__DECODE_FAILED; + } + + /* + * Extract a single bit + */ + switch(per_get_few_bits(pd, 1)) { + case 1: *st = 1; break; + case 0: *st = 0; break; + case -1: default: ASN__DECODE_STARVED; + } + + ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); + + rv.code = RC_OK; + rv.consumed = 1; + return rv; +} + + +asn_enc_rval_t +BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; + + (void)constraints; + + if(!st) ASN__ENCODE_FAILED; + + if(per_put_few_bits(po, *st ? 1 : 0, 1)) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/BOOLEAN.h b/plugins/inmarsat_support/aero/libacars/asn1/BOOLEAN.h new file mode 100644 index 000000000..ebe5f8b44 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/BOOLEAN.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BOOLEAN_H_ +#define _BOOLEAN_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The underlying integer may contain various values, but everything + * non-zero is capped to 0xff by the DER encoder. The BER decoder may + * yield non-zero values different from 1, beware. + */ +typedef int BOOLEAN_t; + +extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN; + +asn_struct_free_f BOOLEAN_free; +asn_struct_print_f BOOLEAN_print; +ber_type_decoder_f BOOLEAN_decode_ber; +der_type_encoder_f BOOLEAN_encode_der; +xer_type_decoder_f BOOLEAN_decode_xer; +xer_type_encoder_f BOOLEAN_encode_xer; +per_type_decoder_f BOOLEAN_decode_uper; +per_type_encoder_f BOOLEAN_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BOOLEAN_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/CMakeLists.inc b/plugins/inmarsat_support/aero/libacars/asn1/CMakeLists.inc new file mode 100644 index 000000000..0165a4d5c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/CMakeLists.inc @@ -0,0 +1,494 @@ +set(ASN_MODULE_HEADERS + FANSATCUplinkMessage.h + FANSATCUplinkMsgElementIdSequence.h + FANSATCMessageHeader.h + FANSMsgIdentificationNumber.h + FANSMsgReferenceNumber.h + FANSTimestamp.h + FANSTimehours.h + FANSTimeminutes.h + FANSTimeSeconds.h + FANSATCUplinkMsgElementId.h + FANSATCDownlinkMessage.h + FANSATCDownlinkMsgElementIdSequence.h + FANSATCDownlinkMsgElementId.h + FANSAirport.h + FANSAltimeter.h + FANSAltimeterEnglish.h + FANSAltimeterMetric.h + FANSAltitude.h + FANSAltitudeQNH.h + FANSAltitudeQNHMeters.h + FANSAltitudeQFE.h + FANSAltitudeQFEMeters.h + FANSAltitudeGNSSFeet.h + FANSAltitudeGNSSMeters.h + FANSAltitudeFlightLevel.h + FANSAltitudeFlightLevelMetric.h + FANSAltitudePosition.h + FANSAltitudeAltitude.h + FANSAltitudeSpeed.h + FANSAltitudeSpeedSpeed.h + FANSAltitudeTime.h + FANSATISCode.h + FANSATWAltitude.h + FANSATWAltitudeTolerance.h + FANSBeaconCode.h + FANSBeaconCodeOctalDigit.h + FANSDegrees.h + FANSDegreesMagnetic.h + FANSDegreesTrue.h + FANSDirection.h + FANSDirectionDegrees.h + FANSDistanceOffset.h + FANSDistanceOffsetNm.h + FANSDistanceOffsetKm.h + FANSDistanceOffsetDirection.h + FANSErrorInformation.h + FANSFixName.h + FANSFreeText.h + FANSFrequency.h + FANSFrequencyhf.h + FANSFrequencyvhf.h + FANSFrequencyuhf.h + FANSFrequencysatchannel.h + FANSHoldClearance.h + FANSICAOUnitName.h + FANSICAOFacilityIdentification.h + FANSICAOfacilityDesignation.h + FANSICAOFacilityName.h + FANSICAOFacilityFunction.h + FANSICAOUnitNameFrequency.h + FANSICAOFacilityDesignationTp4Table.h + FANSLatitudeLongitude.h + FANSLatitudeLongitudeSequence.h + FANSLatitude.h + FANSLatitudeDegrees.h + FANSMinutesLatLon.h + FANSLatitudeDirection.h + FANSLongitude.h + FANSLongitudeDegrees.h + FANSLongitudeDirection.h + FANSLegType.h + FANSLegDistance.h + FANSLegDistanceEnglish.h + FANSLegDistanceMetric.h + FANSLegTime.h + FANSPlaceBearingDistance.h + FANSDistance.h + FANSDistanceNm.h + FANSDistanceKm.h + FANSPosition.h + FANSNavaid.h + FANSPositionAltitude.h + FANSPositionAltitudeAltitude.h + FANSPositionAltitudeSpeed.h + FANSPositionDegrees.h + FANSPositionDistanceOffsetDirection.h + FANSPositionICAOUnitNameFrequency.h + FANSPositionPosition.h + FANSPositionProcedureName.h + FANSPositionReport.h + FANSPositionCurrent.h + FANSTimeAtPositionCurrent.h + FANSFixNext.h + FANSTimeEtaAtFixNext.h + FANSFixNextPlusOne.h + FANSTimeEtaDestination.h + FANSTemperature.h + FANSTemperatureC.h + FANSTemperatureF.h + FANSWinds.h + FANSWindDirection.h + FANSWindSpeed.h + FANSWindSpeedEnglish.h + FANSWindSpeedMetric.h + FANSTurbulence.h + FANSIcing.h + FANSVerticalChange.h + FANSVerticalDirection.h + FANSTrackAngle.h + FANSTrueheading.h + FANSSupplementaryInformation.h + FANSReportedWaypointPosition.h + FANSReportedWaypointTime.h + FANSReportedWaypointAltitude.h + FANSPositionRouteClearance.h + FANSPositionSpeed.h + FANSPositionSpeedSpeed.h + FANSPositionTime.h + FANSPositionTimeAltitude.h + FANSPositionTimeTime.h + FANSPredepartureClearance.h + FANSAircraftFlightIdentification.h + FANSAircraftType.h + FANSAircraftEquipmentCode.h + FANSCOMNAVApproachEquipmentAvailable.h + FANSCOMNAVEquipmentStatus.h + FANSCOMNAVEquipmentStatusSequence.h + FANSSSREquipmentAvailable.h + FANSTimeDepartureEdct.h + FANSAltitudeRestriction.h + FANSFrequencyDeparture.h + FANSPDCrevision.h + FANSProcedureName.h + FANSProcedureType.h + FANSProcedure.h + FANSProcedureTransition.h + FANSRemainingFuelRemainingSouls.h + FANSRemainingFuel.h + FANSRemainingSouls.h + FANSRouteClearance.h + FANSAirportDeparture.h + FANSAirportDestination.h + FANSRunwayDeparture.h + FANSRunway.h + FANSRunwayDirection.h + FANSRunwayConfiguration.h + FANSProcedureDeparture.h + FANSRunwayArrival.h + FANSProcedureApproach.h + FANSProcedureArrival.h + FANSAirwayIntercept.h + FANSRouteInformation.h + FANSRouteInformationSequence.h + FANSPublishedIdentifier.h + FANSPlaceBearing.h + FANSPlaceBearingPlaceBearing.h + FANSAirwayIdentifier.h + FANSTrackDetail.h + FANSTrackName.h + FANSATWAlongTrackWaypointSequence.h + FANSInterceptCourseFromSequence.h + FANSHoldatwaypointSequence.h + FANSWaypointSpeedAltitudesequence.h + FANSRTARequiredTimeArrivalSequence.h + FANSRouteInformationAdditional.h + FANSATWAltitudeSequence.h + FANSATWAlongTrackWaypoint.h + FANSATWDistance.h + FANSATWDistanceTolerance.h + FANSReportingPoints.h + FANSLatLonReportingPoints.h + FANSLatitudeReportingPoints.h + FANSLongitudeReportingPoints.h + FANSDegreeIncrement.h + FANSInterceptCourseFrom.h + FANSInterceptCourseFromSelection.h + FANSHoldatwaypointSpeedLow.h + FANSHoldatwaypointSpeedHigh.h + FANSEFCtime.h + FANSHoldatwaypoint.h + FANSWaypointSpeedAltitude.h + FANSRTARequiredTimeArrival.h + FANSRTATime.h + FANSTimeTolerance.h + FANSRTATolerance.h + FANSSpeed.h + FANSSpeedIndicated.h + FANSSpeedIndicatedMetric.h + FANSSpeedTrue.h + FANSSpeedTrueMetric.h + FANSSpeedGround.h + FANSSpeedGroundMetric.h + FANSSpeedMach.h + FANSSpeedMachLarge.h + FANSSpeedSpeed.h + FANSTime.h + FANSTimeAltitude.h + FANSTimeDistanceOffsetDirection.h + FANSTimeDistanceToFromPosition.h + FANSTimeTime.h + FANSToFrom.h + FANSTimeICAOunitnameFrequency.h + FANSTimePosition.h + FANSTimePositionAltitude.h + FANSTimePositionAltitudeSpeed.h + FANSTimeSpeed.h + FANSTimeSpeedSpeed.h + FANSToFromPosition.h + FANSTp4table.h + FANSVersionNumber.h + FANSVerticalRate.h + FANSVerticalRateEnglish.h + FANSVerticalRateMetric.h + BOOLEAN.h + INTEGER.h + NativeEnumerated.h + IA5String.h + NULL.h + NativeInteger.h + NumericString.h + asn_SEQUENCE_OF.h + asn_SET_OF.h + constr_CHOICE.h + constr_SEQUENCE.h + constr_SEQUENCE_OF.h + constr_SET_OF.h + asn_application.h + asn_system.h + asn_codecs.h + asn_internal.h + OCTET_STRING.h + BIT_STRING.h + asn_codecs_prim.h + ber_tlv_length.h + ber_tlv_tag.h + ber_decoder.h + der_encoder.h + constr_TYPE.h + constraints.h + xer_support.h + xer_decoder.h + xer_encoder.h + per_support.h + per_decoder.h + per_encoder.h + per_opentype.h +) + +set(ASN_MODULE_SOURCES + FANSATCUplinkMessage.c + FANSATCUplinkMsgElementIdSequence.c + FANSATCMessageHeader.c + FANSMsgIdentificationNumber.c + FANSMsgReferenceNumber.c + FANSTimestamp.c + FANSTimehours.c + FANSTimeminutes.c + FANSTimeSeconds.c + FANSATCUplinkMsgElementId.c + FANSATCDownlinkMessage.c + FANSATCDownlinkMsgElementIdSequence.c + FANSATCDownlinkMsgElementId.c + FANSAirport.c + FANSAltimeter.c + FANSAltimeterEnglish.c + FANSAltimeterMetric.c + FANSAltitude.c + FANSAltitudeQNH.c + FANSAltitudeQNHMeters.c + FANSAltitudeQFE.c + FANSAltitudeQFEMeters.c + FANSAltitudeGNSSFeet.c + FANSAltitudeGNSSMeters.c + FANSAltitudeFlightLevel.c + FANSAltitudeFlightLevelMetric.c + FANSAltitudePosition.c + FANSAltitudeAltitude.c + FANSAltitudeSpeed.c + FANSAltitudeSpeedSpeed.c + FANSAltitudeTime.c + FANSATISCode.c + FANSATWAltitude.c + FANSATWAltitudeTolerance.c + FANSBeaconCode.c + FANSBeaconCodeOctalDigit.c + FANSDegrees.c + FANSDegreesMagnetic.c + FANSDegreesTrue.c + FANSDirection.c + FANSDirectionDegrees.c + FANSDistanceOffset.c + FANSDistanceOffsetNm.c + FANSDistanceOffsetKm.c + FANSDistanceOffsetDirection.c + FANSErrorInformation.c + FANSFixName.c + FANSFreeText.c + FANSFrequency.c + FANSFrequencyhf.c + FANSFrequencyvhf.c + FANSFrequencyuhf.c + FANSFrequencysatchannel.c + FANSHoldClearance.c + FANSICAOUnitName.c + FANSICAOFacilityIdentification.c + FANSICAOfacilityDesignation.c + FANSICAOFacilityName.c + FANSICAOFacilityFunction.c + FANSICAOUnitNameFrequency.c + FANSICAOFacilityDesignationTp4Table.c + FANSLatitudeLongitude.c + FANSLatitudeLongitudeSequence.c + FANSLatitude.c + FANSLatitudeDegrees.c + FANSMinutesLatLon.c + FANSLatitudeDirection.c + FANSLongitude.c + FANSLongitudeDegrees.c + FANSLongitudeDirection.c + FANSLegType.c + FANSLegDistance.c + FANSLegDistanceEnglish.c + FANSLegDistanceMetric.c + FANSLegTime.c + FANSPlaceBearingDistance.c + FANSDistance.c + FANSDistanceNm.c + FANSDistanceKm.c + FANSPosition.c + FANSNavaid.c + FANSPositionAltitude.c + FANSPositionAltitudeAltitude.c + FANSPositionAltitudeSpeed.c + FANSPositionDegrees.c + FANSPositionDistanceOffsetDirection.c + FANSPositionICAOUnitNameFrequency.c + FANSPositionPosition.c + FANSPositionProcedureName.c + FANSPositionReport.c + FANSPositionCurrent.c + FANSTimeAtPositionCurrent.c + FANSFixNext.c + FANSTimeEtaAtFixNext.c + FANSFixNextPlusOne.c + FANSTimeEtaDestination.c + FANSTemperature.c + FANSTemperatureC.c + FANSTemperatureF.c + FANSWinds.c + FANSWindDirection.c + FANSWindSpeed.c + FANSWindSpeedEnglish.c + FANSWindSpeedMetric.c + FANSTurbulence.c + FANSIcing.c + FANSVerticalChange.c + FANSVerticalDirection.c + FANSTrackAngle.c + FANSTrueheading.c + FANSSupplementaryInformation.c + FANSReportedWaypointPosition.c + FANSReportedWaypointTime.c + FANSReportedWaypointAltitude.c + FANSPositionRouteClearance.c + FANSPositionSpeed.c + FANSPositionSpeedSpeed.c + FANSPositionTime.c + FANSPositionTimeAltitude.c + FANSPositionTimeTime.c + FANSPredepartureClearance.c + FANSAircraftFlightIdentification.c + FANSAircraftType.c + FANSAircraftEquipmentCode.c + FANSCOMNAVApproachEquipmentAvailable.c + FANSCOMNAVEquipmentStatus.c + FANSCOMNAVEquipmentStatusSequence.c + FANSSSREquipmentAvailable.c + FANSTimeDepartureEdct.c + FANSAltitudeRestriction.c + FANSFrequencyDeparture.c + FANSPDCrevision.c + FANSProcedureName.c + FANSProcedureType.c + FANSProcedure.c + FANSProcedureTransition.c + FANSRemainingFuelRemainingSouls.c + FANSRemainingFuel.c + FANSRemainingSouls.c + FANSRouteClearance.c + FANSAirportDeparture.c + FANSAirportDestination.c + FANSRunwayDeparture.c + FANSRunway.c + FANSRunwayDirection.c + FANSRunwayConfiguration.c + FANSProcedureDeparture.c + FANSRunwayArrival.c + FANSProcedureApproach.c + FANSProcedureArrival.c + FANSAirwayIntercept.c + FANSRouteInformation.c + FANSRouteInformationSequence.c + FANSPublishedIdentifier.c + FANSPlaceBearing.c + FANSPlaceBearingPlaceBearing.c + FANSAirwayIdentifier.c + FANSTrackDetail.c + FANSTrackName.c + FANSATWAlongTrackWaypointSequence.c + FANSInterceptCourseFromSequence.c + FANSHoldatwaypointSequence.c + FANSWaypointSpeedAltitudesequence.c + FANSRTARequiredTimeArrivalSequence.c + FANSRouteInformationAdditional.c + FANSATWAltitudeSequence.c + FANSATWAlongTrackWaypoint.c + FANSATWDistance.c + FANSATWDistanceTolerance.c + FANSReportingPoints.c + FANSLatLonReportingPoints.c + FANSLatitudeReportingPoints.c + FANSLongitudeReportingPoints.c + FANSDegreeIncrement.c + FANSInterceptCourseFrom.c + FANSInterceptCourseFromSelection.c + FANSHoldatwaypointSpeedLow.c + FANSHoldatwaypointSpeedHigh.c + FANSEFCtime.c + FANSHoldatwaypoint.c + FANSWaypointSpeedAltitude.c + FANSRTARequiredTimeArrival.c + FANSRTATime.c + FANSTimeTolerance.c + FANSRTATolerance.c + FANSSpeed.c + FANSSpeedIndicated.c + FANSSpeedIndicatedMetric.c + FANSSpeedTrue.c + FANSSpeedTrueMetric.c + FANSSpeedGround.c + FANSSpeedGroundMetric.c + FANSSpeedMach.c + FANSSpeedMachLarge.c + FANSSpeedSpeed.c + FANSTime.c + FANSTimeAltitude.c + FANSTimeDistanceOffsetDirection.c + FANSTimeDistanceToFromPosition.c + FANSTimeTime.c + FANSToFrom.c + FANSTimeICAOunitnameFrequency.c + FANSTimePosition.c + FANSTimePositionAltitude.c + FANSTimePositionAltitudeSpeed.c + FANSTimeSpeed.c + FANSTimeSpeedSpeed.c + FANSToFromPosition.c + FANSTp4table.c + FANSVersionNumber.c + FANSVerticalRate.c + FANSVerticalRateEnglish.c + FANSVerticalRateMetric.c + BOOLEAN.c + IA5String.c + INTEGER.c + NULL.c + NativeEnumerated.c + NativeInteger.c + NumericString.c + asn_SEQUENCE_OF.c + asn_SET_OF.c + constr_CHOICE.c + constr_SEQUENCE.c + constr_SEQUENCE_OF.c + constr_SET_OF.c + OCTET_STRING.c + BIT_STRING.c + asn_codecs_prim.c + ber_tlv_length.c + ber_tlv_tag.c + ber_decoder.c + der_encoder.c + constr_TYPE.c + constraints.c + xer_support.c + xer_decoder.c + xer_encoder.c + per_support.c + per_decoder.c + per_encoder.c + per_opentype.c +) + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/CMakeLists.txt b/plugins/inmarsat_support/aero/libacars/asn1/CMakeLists.txt new file mode 100644 index 000000000..2802ddaf1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/CMakeLists.txt @@ -0,0 +1,13 @@ +include (CMakeLists.inc) +if (EMIT_ASN_DEBUG) + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DEMIT_ASN_DEBUG=1") +endif() + +# force inclusion of alloca.h from stdlib.h on macos +remove_definitions(-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L) + +add_library (asn1 OBJECT ${ASN_MODULE_SOURCES}) +set_property(TARGET asn1 PROPERTY POSITION_INDEPENDENT_CODE ON) + +install (FILES ${ASN_MODULE_HEADERS} DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/${LA_SUBDIR}/${PROJECT_NAME}/asn1) diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMessage.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMessage.c new file mode 100644 index 000000000..60b069fd4 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMessage.c @@ -0,0 +1,210 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCDownlinkMessage.h" + +static asn_TYPE_member_t asn_MBR_FANSATCDownlinkMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMessage, aTCMessageheader), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSATCMessageHeader, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTCMessageheader" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMessage, aTCDownlinkmsgelementid), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSATCDownlinkMsgElementId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTCDownlinkmsgelementid" + }, + { ATF_POINTER, 1, offsetof(struct FANSATCDownlinkMessage, aTCdownlinkmsgelementid_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSATCDownlinkMsgElementIdSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTCdownlinkmsgelementid-seqOf" + }, +}; +static const int asn_MAP_FANSATCDownlinkMessage_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_FANSATCDownlinkMessage_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATCDownlinkMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* aTCMessageheader */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 0 }, /* aTCdownlinkmsgelementid-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* dM0NULL */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dM1NULL */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* dM2NULL */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* dM3NULL */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 }, /* dM4NULL */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* dM5NULL */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* dM6Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 }, /* dM7AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 1, 0, 0 }, /* dM8Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 1, 0, 0 }, /* dM9Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 1, 0, 0 }, /* dM10Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 1, 0, 0 }, /* dM11PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 1, 0, 0 }, /* dM12PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 1, 0, 0 }, /* dM13TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 1, 0, 0 }, /* dM14TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 1, 0, 0 }, /* dM15DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 1, 0, 0 }, /* dM16PositionDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 1, 0, 0 }, /* dM17TimeDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 1, 0, 0 }, /* dM18Speed */ + { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 1, 0, 0 }, /* dM19SpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 1, 0, 0 }, /* dM20NULL */ + { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 1, 0, 0 }, /* dM21Frequency */ + { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 1, 0, 0 }, /* dM22Position */ + { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 1, 0, 0 }, /* dM23ProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 1, 0, 0 }, /* dM24RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 1, 0, 0 }, /* dM25NULL */ + { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 1, 0, 0 }, /* dM26PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 1, 0, 0 }, /* dM27DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 1, 0, 0 }, /* dM28Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (29 << 2)), 1, 0, 0 }, /* dM29Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (30 << 2)), 1, 0, 0 }, /* dM30Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (31 << 2)), 1, 0, 0 }, /* dM31Position */ + { (ASN_TAG_CLASS_CONTEXT | (32 << 2)), 1, 0, 0 }, /* dM32Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (33 << 2)), 1, 0, 0 }, /* dM33Position */ + { (ASN_TAG_CLASS_CONTEXT | (34 << 2)), 1, 0, 0 }, /* dM34Speed */ + { (ASN_TAG_CLASS_CONTEXT | (35 << 2)), 1, 0, 0 }, /* dM35Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (36 << 2)), 1, 0, 0 }, /* dM36Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (37 << 2)), 1, 0, 0 }, /* dM37Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (38 << 2)), 1, 0, 0 }, /* dM38Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (39 << 2)), 1, 0, 0 }, /* dM39Speed */ + { (ASN_TAG_CLASS_CONTEXT | (40 << 2)), 1, 0, 0 }, /* dM40RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (41 << 2)), 1, 0, 0 }, /* dM41NULL */ + { (ASN_TAG_CLASS_CONTEXT | (42 << 2)), 1, 0, 0 }, /* dM42Position */ + { (ASN_TAG_CLASS_CONTEXT | (43 << 2)), 1, 0, 0 }, /* dM43Time */ + { (ASN_TAG_CLASS_CONTEXT | (44 << 2)), 1, 0, 0 }, /* dM44Position */ + { (ASN_TAG_CLASS_CONTEXT | (45 << 2)), 1, 0, 0 }, /* dM45Position */ + { (ASN_TAG_CLASS_CONTEXT | (46 << 2)), 1, 0, 0 }, /* dM46Time */ + { (ASN_TAG_CLASS_CONTEXT | (47 << 2)), 1, 0, 0 }, /* dM47BeaconCode */ + { (ASN_TAG_CLASS_CONTEXT | (48 << 2)), 1, 0, 0 }, /* dM48PositionReport */ + { (ASN_TAG_CLASS_CONTEXT | (49 << 2)), 1, 0, 0 }, /* dM49Speed */ + { (ASN_TAG_CLASS_CONTEXT | (50 << 2)), 1, 0, 0 }, /* dM50SpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (51 << 2)), 1, 0, 0 }, /* dM51NULL */ + { (ASN_TAG_CLASS_CONTEXT | (52 << 2)), 1, 0, 0 }, /* dM52NULL */ + { (ASN_TAG_CLASS_CONTEXT | (53 << 2)), 1, 0, 0 }, /* dM53NULL */ + { (ASN_TAG_CLASS_CONTEXT | (54 << 2)), 1, 0, 0 }, /* dM54Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (55 << 2)), 1, 0, 0 }, /* dM55NULL */ + { (ASN_TAG_CLASS_CONTEXT | (56 << 2)), 1, 0, 0 }, /* dM56NULL */ + { (ASN_TAG_CLASS_CONTEXT | (57 << 2)), 1, 0, 0 }, /* dM57RemainingFuelRemainingSouls */ + { (ASN_TAG_CLASS_CONTEXT | (58 << 2)), 1, 0, 0 }, /* dM58NULL */ + { (ASN_TAG_CLASS_CONTEXT | (59 << 2)), 1, 0, 0 }, /* dM59PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (60 << 2)), 1, 0, 0 }, /* dM60DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (61 << 2)), 1, 0, 0 }, /* dM61Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (62 << 2)), 1, 0, 0 }, /* dM62ErrorInformation */ + { (ASN_TAG_CLASS_CONTEXT | (63 << 2)), 1, 0, 0 }, /* dM63NULL */ + { (ASN_TAG_CLASS_CONTEXT | (64 << 2)), 1, 0, 0 }, /* dM64ICAOfacilitydesignation */ + { (ASN_TAG_CLASS_CONTEXT | (65 << 2)), 1, 0, 0 }, /* dM65NULL */ + { (ASN_TAG_CLASS_CONTEXT | (66 << 2)), 1, 0, 0 }, /* dM66NULL */ + { (ASN_TAG_CLASS_CONTEXT | (67 << 2)), 1, 0, 0 }, /* dM67FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (68 << 2)), 1, 0, 0 }, /* dM68FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (69 << 2)), 1, 0, 0 }, /* dM69NULL */ + { (ASN_TAG_CLASS_CONTEXT | (70 << 2)), 1, 0, 0 }, /* dM70Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (71 << 2)), 1, 0, 0 }, /* dM71Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (72 << 2)), 1, 0, 0 }, /* dM72Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (73 << 2)), 1, 0, 0 }, /* dM73VersionNumber */ + { (ASN_TAG_CLASS_CONTEXT | (74 << 2)), 1, 0, 0 }, /* dM74NULL */ + { (ASN_TAG_CLASS_CONTEXT | (75 << 2)), 1, 0, 0 }, /* dM75NULL */ + { (ASN_TAG_CLASS_CONTEXT | (76 << 2)), 1, 0, 0 }, /* dM76AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (77 << 2)), 1, 0, 0 }, /* dM77AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (78 << 2)), 1, 0, 0 }, /* dM78TimeDistanceToFromPosition */ + { (ASN_TAG_CLASS_CONTEXT | (79 << 2)), 1, 0, 0 }, /* dM79ATISCode */ + { (ASN_TAG_CLASS_CONTEXT | (80 << 2)), 1, 0, 0 }, /* dM80DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (81 << 2)), 1, 0, 0 }, /* dM81NULL */ + { (ASN_TAG_CLASS_CONTEXT | (82 << 2)), 1, 0, 0 }, /* dM82NULL */ + { (ASN_TAG_CLASS_CONTEXT | (83 << 2)), 1, 0, 0 }, /* dM83NULL */ + { (ASN_TAG_CLASS_CONTEXT | (84 << 2)), 1, 0, 0 }, /* dM84NULL */ + { (ASN_TAG_CLASS_CONTEXT | (85 << 2)), 1, 0, 0 }, /* dM85NULL */ + { (ASN_TAG_CLASS_CONTEXT | (86 << 2)), 1, 0, 0 }, /* dM86NULL */ + { (ASN_TAG_CLASS_CONTEXT | (87 << 2)), 1, 0, 0 }, /* dM87NULL */ + { (ASN_TAG_CLASS_CONTEXT | (88 << 2)), 1, 0, 0 }, /* dM88NULL */ + { (ASN_TAG_CLASS_CONTEXT | (89 << 2)), 1, 0, 0 }, /* dM89NULL */ + { (ASN_TAG_CLASS_CONTEXT | (90 << 2)), 1, 0, 0 }, /* dM90NULL */ + { (ASN_TAG_CLASS_CONTEXT | (91 << 2)), 1, 0, 0 }, /* dM91NULL */ + { (ASN_TAG_CLASS_CONTEXT | (92 << 2)), 1, 0, 0 }, /* dM92NULL */ + { (ASN_TAG_CLASS_CONTEXT | (93 << 2)), 1, 0, 0 }, /* dM93NULL */ + { (ASN_TAG_CLASS_CONTEXT | (94 << 2)), 1, 0, 0 }, /* dM94NULL */ + { (ASN_TAG_CLASS_CONTEXT | (95 << 2)), 1, 0, 0 }, /* dM95NULL */ + { (ASN_TAG_CLASS_CONTEXT | (96 << 2)), 1, 0, 0 }, /* dM96NULL */ + { (ASN_TAG_CLASS_CONTEXT | (97 << 2)), 1, 0, 0 }, /* dM97NULL */ + { (ASN_TAG_CLASS_CONTEXT | (98 << 2)), 1, 0, 0 }, /* dM98NULL */ + { (ASN_TAG_CLASS_CONTEXT | (99 << 2)), 1, 0, 0 }, /* dM99NULL */ + { (ASN_TAG_CLASS_CONTEXT | (100 << 2)), 1, 0, 0 }, /* dM100NULL */ + { (ASN_TAG_CLASS_CONTEXT | (101 << 2)), 1, 0, 0 }, /* dM101NULL */ + { (ASN_TAG_CLASS_CONTEXT | (102 << 2)), 1, 0, 0 }, /* dM102NULL */ + { (ASN_TAG_CLASS_CONTEXT | (103 << 2)), 1, 0, 0 }, /* dM103NULL */ + { (ASN_TAG_CLASS_CONTEXT | (104 << 2)), 1, 0, 0 }, /* dM104NULL */ + { (ASN_TAG_CLASS_CONTEXT | (105 << 2)), 1, 0, 0 }, /* dM105NULL */ + { (ASN_TAG_CLASS_CONTEXT | (106 << 2)), 1, 0, 0 }, /* dM106NULL */ + { (ASN_TAG_CLASS_CONTEXT | (107 << 2)), 1, 0, 0 }, /* dM107NULL */ + { (ASN_TAG_CLASS_CONTEXT | (108 << 2)), 1, 0, 0 }, /* dM108NULL */ + { (ASN_TAG_CLASS_CONTEXT | (109 << 2)), 1, 0, 0 }, /* dM109NULL */ + { (ASN_TAG_CLASS_CONTEXT | (110 << 2)), 1, 0, 0 }, /* dM110NULL */ + { (ASN_TAG_CLASS_CONTEXT | (111 << 2)), 1, 0, 0 }, /* dM111NULL */ + { (ASN_TAG_CLASS_CONTEXT | (112 << 2)), 1, 0, 0 }, /* dM112NULL */ + { (ASN_TAG_CLASS_CONTEXT | (113 << 2)), 1, 0, 0 }, /* dM113NULL */ + { (ASN_TAG_CLASS_CONTEXT | (114 << 2)), 1, 0, 0 }, /* dM114NULL */ + { (ASN_TAG_CLASS_CONTEXT | (115 << 2)), 1, 0, 0 }, /* dM115NULL */ + { (ASN_TAG_CLASS_CONTEXT | (116 << 2)), 1, 0, 0 }, /* dM116NULL */ + { (ASN_TAG_CLASS_CONTEXT | (117 << 2)), 1, 0, 0 }, /* dM117NULL */ + { (ASN_TAG_CLASS_CONTEXT | (118 << 2)), 1, 0, 0 }, /* dM118NULL */ + { (ASN_TAG_CLASS_CONTEXT | (119 << 2)), 1, 0, 0 }, /* dM119NULL */ + { (ASN_TAG_CLASS_CONTEXT | (120 << 2)), 1, 0, 0 }, /* dM120NULL */ + { (ASN_TAG_CLASS_CONTEXT | (121 << 2)), 1, 0, 0 }, /* dM121NULL */ + { (ASN_TAG_CLASS_CONTEXT | (122 << 2)), 1, 0, 0 }, /* dM122NULL */ + { (ASN_TAG_CLASS_CONTEXT | (123 << 2)), 1, 0, 0 }, /* dM123NULL */ + { (ASN_TAG_CLASS_CONTEXT | (124 << 2)), 1, 0, 0 }, /* dM124NULL */ + { (ASN_TAG_CLASS_CONTEXT | (125 << 2)), 1, 0, 0 }, /* dM125NULL */ + { (ASN_TAG_CLASS_CONTEXT | (126 << 2)), 1, 0, 0 }, /* dM126NULL */ + { (ASN_TAG_CLASS_CONTEXT | (127 << 2)), 1, 0, 0 }, /* dM127NULL */ + { (ASN_TAG_CLASS_CONTEXT | (128 << 2)), 1, 0, 0 } /* dM128NULL */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSATCDownlinkMessage_specs_1 = { + sizeof(struct FANSATCDownlinkMessage), + offsetof(struct FANSATCDownlinkMessage, _asn_ctx), + asn_MAP_FANSATCDownlinkMessage_tag2el_1, + 131, /* Count of tags in the map */ + asn_MAP_FANSATCDownlinkMessage_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCDownlinkMessage = { + "FANSATCDownlinkMessage", + "FANSATCDownlinkMessage", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATCDownlinkMessage_tags_1, + sizeof(asn_DEF_FANSATCDownlinkMessage_tags_1) + /sizeof(asn_DEF_FANSATCDownlinkMessage_tags_1[0]), /* 1 */ + asn_DEF_FANSATCDownlinkMessage_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATCDownlinkMessage_tags_1) + /sizeof(asn_DEF_FANSATCDownlinkMessage_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSATCDownlinkMessage_1, + 3, /* Elements count */ + &asn_SPC_FANSATCDownlinkMessage_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMessage.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMessage.h new file mode 100644 index 000000000..ce8205828 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMessage.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCDownlinkMessage_H_ +#define _FANSATCDownlinkMessage_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSATCMessageHeader.h" +#include "FANSATCDownlinkMsgElementId.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATCDownlinkMsgElementIdSequence; + +/* FANSATCDownlinkMessage */ +typedef struct FANSATCDownlinkMessage { + FANSATCMessageHeader_t aTCMessageheader; + FANSATCDownlinkMsgElementId_t aTCDownlinkmsgelementid; + struct FANSATCDownlinkMsgElementIdSequence *aTCdownlinkmsgelementid_seqOf /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCDownlinkMessage_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCDownlinkMessage; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATCDownlinkMsgElementIdSequence.h" + +#endif /* _FANSATCDownlinkMessage_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementId.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementId.c new file mode 100644 index 000000000..dc2d91d9d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementId.c @@ -0,0 +1,1341 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCDownlinkMsgElementId.h" + +static asn_per_constraints_t asn_PER_type_FANSATCDownlinkMsgElementId_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 128 } /* (0..128) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSATCDownlinkMsgElementId_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM0NULL), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM0NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM1NULL), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM1NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM2NULL), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM2NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM3NULL), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM3NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM4NULL), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM4NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM5NULL), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM5NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM6Altitude), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM6Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM7AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM7AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM8Altitude), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM8Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM9Altitude), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM9Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM10Altitude), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM10Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM11PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM11PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM12PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM12PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM13TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM13TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM14TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM14TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM15DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM15DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM16PositionDistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (16 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM16PositionDistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM17TimeDistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM17TimeDistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM18Speed), + (ASN_TAG_CLASS_CONTEXT | (18 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM18Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM19SpeedSpeed), + (ASN_TAG_CLASS_CONTEXT | (19 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM19SpeedSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM20NULL), + (ASN_TAG_CLASS_CONTEXT | (20 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM20NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM21Frequency), + (ASN_TAG_CLASS_CONTEXT | (21 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM21Frequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM22Position), + (ASN_TAG_CLASS_CONTEXT | (22 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM22Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM23ProcedureName), + (ASN_TAG_CLASS_CONTEXT | (23 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSProcedureName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM23ProcedureName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM24RouteClearance), + (ASN_TAG_CLASS_CONTEXT | (24 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM24RouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM25NULL), + (ASN_TAG_CLASS_CONTEXT | (25 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM25NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM26PositionRouteClearance), + (ASN_TAG_CLASS_CONTEXT | (26 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM26PositionRouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM27DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (27 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM27DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM28Altitude), + (ASN_TAG_CLASS_CONTEXT | (28 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM28Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM29Altitude), + (ASN_TAG_CLASS_CONTEXT | (29 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM29Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM30Altitude), + (ASN_TAG_CLASS_CONTEXT | (30 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM30Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM31Position), + (ASN_TAG_CLASS_CONTEXT | (31 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM31Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM32Altitude), + (ASN_TAG_CLASS_CONTEXT | (32 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM32Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM33Position), + (ASN_TAG_CLASS_CONTEXT | (33 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM33Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM34Speed), + (ASN_TAG_CLASS_CONTEXT | (34 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM34Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM35Degrees), + (ASN_TAG_CLASS_CONTEXT | (35 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM35Degrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM36Degrees), + (ASN_TAG_CLASS_CONTEXT | (36 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM36Degrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM37Altitude), + (ASN_TAG_CLASS_CONTEXT | (37 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM37Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM38Altitude), + (ASN_TAG_CLASS_CONTEXT | (38 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM38Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM39Speed), + (ASN_TAG_CLASS_CONTEXT | (39 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM39Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM40RouteClearance), + (ASN_TAG_CLASS_CONTEXT | (40 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM40RouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM41NULL), + (ASN_TAG_CLASS_CONTEXT | (41 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM41NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM42Position), + (ASN_TAG_CLASS_CONTEXT | (42 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM42Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM43Time), + (ASN_TAG_CLASS_CONTEXT | (43 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM43Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM44Position), + (ASN_TAG_CLASS_CONTEXT | (44 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM44Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM45Position), + (ASN_TAG_CLASS_CONTEXT | (45 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM45Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM46Time), + (ASN_TAG_CLASS_CONTEXT | (46 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM46Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM47BeaconCode), + (ASN_TAG_CLASS_CONTEXT | (47 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSBeaconCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM47BeaconCode" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM48PositionReport), + (ASN_TAG_CLASS_CONTEXT | (48 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionReport, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM48PositionReport" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM49Speed), + (ASN_TAG_CLASS_CONTEXT | (49 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM49Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM50SpeedSpeed), + (ASN_TAG_CLASS_CONTEXT | (50 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM50SpeedSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM51NULL), + (ASN_TAG_CLASS_CONTEXT | (51 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM51NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM52NULL), + (ASN_TAG_CLASS_CONTEXT | (52 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM52NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM53NULL), + (ASN_TAG_CLASS_CONTEXT | (53 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM53NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM54Altitude), + (ASN_TAG_CLASS_CONTEXT | (54 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM54Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM55NULL), + (ASN_TAG_CLASS_CONTEXT | (55 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM55NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM56NULL), + (ASN_TAG_CLASS_CONTEXT | (56 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM56NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM57RemainingFuelRemainingSouls), + (ASN_TAG_CLASS_CONTEXT | (57 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRemainingFuelRemainingSouls, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM57RemainingFuelRemainingSouls" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM58NULL), + (ASN_TAG_CLASS_CONTEXT | (58 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM58NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM59PositionRouteClearance), + (ASN_TAG_CLASS_CONTEXT | (59 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM59PositionRouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM60DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (60 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM60DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM61Altitude), + (ASN_TAG_CLASS_CONTEXT | (61 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM61Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM62ErrorInformation), + (ASN_TAG_CLASS_CONTEXT | (62 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSErrorInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM62ErrorInformation" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM63NULL), + (ASN_TAG_CLASS_CONTEXT | (63 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM63NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM64ICAOfacilitydesignation), + (ASN_TAG_CLASS_CONTEXT | (64 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOfacilityDesignation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM64ICAOfacilitydesignation" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM65NULL), + (ASN_TAG_CLASS_CONTEXT | (65 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM65NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM66NULL), + (ASN_TAG_CLASS_CONTEXT | (66 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM66NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM67FreeText), + (ASN_TAG_CLASS_CONTEXT | (67 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFreeText, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM67FreeText" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM68FreeText), + (ASN_TAG_CLASS_CONTEXT | (68 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFreeText, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM68FreeText" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM69NULL), + (ASN_TAG_CLASS_CONTEXT | (69 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM69NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM70Degrees), + (ASN_TAG_CLASS_CONTEXT | (70 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM70Degrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM71Degrees), + (ASN_TAG_CLASS_CONTEXT | (71 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM71Degrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM72Altitude), + (ASN_TAG_CLASS_CONTEXT | (72 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM72Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM73VersionNumber), + (ASN_TAG_CLASS_CONTEXT | (73 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSVersionNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM73VersionNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM74NULL), + (ASN_TAG_CLASS_CONTEXT | (74 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM74NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM75NULL), + (ASN_TAG_CLASS_CONTEXT | (75 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM75NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM76AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (76 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM76AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM77AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (77 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM77AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM78TimeDistanceToFromPosition), + (ASN_TAG_CLASS_CONTEXT | (78 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeDistanceToFromPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM78TimeDistanceToFromPosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM79ATISCode), + (ASN_TAG_CLASS_CONTEXT | (79 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATISCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM79ATISCode" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM80DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (80 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM80DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM81NULL), + (ASN_TAG_CLASS_CONTEXT | (81 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM81NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM82NULL), + (ASN_TAG_CLASS_CONTEXT | (82 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM82NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM83NULL), + (ASN_TAG_CLASS_CONTEXT | (83 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM83NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM84NULL), + (ASN_TAG_CLASS_CONTEXT | (84 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM84NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM85NULL), + (ASN_TAG_CLASS_CONTEXT | (85 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM85NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM86NULL), + (ASN_TAG_CLASS_CONTEXT | (86 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM86NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM87NULL), + (ASN_TAG_CLASS_CONTEXT | (87 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM87NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM88NULL), + (ASN_TAG_CLASS_CONTEXT | (88 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM88NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM89NULL), + (ASN_TAG_CLASS_CONTEXT | (89 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM89NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM90NULL), + (ASN_TAG_CLASS_CONTEXT | (90 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM90NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM91NULL), + (ASN_TAG_CLASS_CONTEXT | (91 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM91NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM92NULL), + (ASN_TAG_CLASS_CONTEXT | (92 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM92NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM93NULL), + (ASN_TAG_CLASS_CONTEXT | (93 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM93NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM94NULL), + (ASN_TAG_CLASS_CONTEXT | (94 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM94NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM95NULL), + (ASN_TAG_CLASS_CONTEXT | (95 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM95NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM96NULL), + (ASN_TAG_CLASS_CONTEXT | (96 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM96NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM97NULL), + (ASN_TAG_CLASS_CONTEXT | (97 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM97NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM98NULL), + (ASN_TAG_CLASS_CONTEXT | (98 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM98NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM99NULL), + (ASN_TAG_CLASS_CONTEXT | (99 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM99NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM100NULL), + (ASN_TAG_CLASS_CONTEXT | (100 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM100NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM101NULL), + (ASN_TAG_CLASS_CONTEXT | (101 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM101NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM102NULL), + (ASN_TAG_CLASS_CONTEXT | (102 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM102NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM103NULL), + (ASN_TAG_CLASS_CONTEXT | (103 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM103NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM104NULL), + (ASN_TAG_CLASS_CONTEXT | (104 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM104NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM105NULL), + (ASN_TAG_CLASS_CONTEXT | (105 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM105NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM106NULL), + (ASN_TAG_CLASS_CONTEXT | (106 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM106NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM107NULL), + (ASN_TAG_CLASS_CONTEXT | (107 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM107NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM108NULL), + (ASN_TAG_CLASS_CONTEXT | (108 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM108NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM109NULL), + (ASN_TAG_CLASS_CONTEXT | (109 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM109NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM110NULL), + (ASN_TAG_CLASS_CONTEXT | (110 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM110NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM111NULL), + (ASN_TAG_CLASS_CONTEXT | (111 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM111NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM112NULL), + (ASN_TAG_CLASS_CONTEXT | (112 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM112NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM113NULL), + (ASN_TAG_CLASS_CONTEXT | (113 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM113NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM114NULL), + (ASN_TAG_CLASS_CONTEXT | (114 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM114NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM115NULL), + (ASN_TAG_CLASS_CONTEXT | (115 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM115NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM116NULL), + (ASN_TAG_CLASS_CONTEXT | (116 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM116NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM117NULL), + (ASN_TAG_CLASS_CONTEXT | (117 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM117NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM118NULL), + (ASN_TAG_CLASS_CONTEXT | (118 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM118NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM119NULL), + (ASN_TAG_CLASS_CONTEXT | (119 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM119NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM120NULL), + (ASN_TAG_CLASS_CONTEXT | (120 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM120NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM121NULL), + (ASN_TAG_CLASS_CONTEXT | (121 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM121NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM122NULL), + (ASN_TAG_CLASS_CONTEXT | (122 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM122NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM123NULL), + (ASN_TAG_CLASS_CONTEXT | (123 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM123NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM124NULL), + (ASN_TAG_CLASS_CONTEXT | (124 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM124NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM125NULL), + (ASN_TAG_CLASS_CONTEXT | (125 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM125NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM126NULL), + (ASN_TAG_CLASS_CONTEXT | (126 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM126NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM127NULL), + (ASN_TAG_CLASS_CONTEXT | (127 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM127NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCDownlinkMsgElementId, choice.dM128NULL), + (ASN_TAG_CLASS_CONTEXT | (128 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dM128NULL" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATCDownlinkMsgElementId_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dM0NULL */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dM1NULL */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* dM2NULL */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* dM3NULL */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* dM4NULL */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* dM5NULL */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* dM6Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* dM7AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* dM8Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* dM9Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* dM10Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* dM11PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* dM12PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* dM13TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* dM14TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 }, /* dM15DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* dM16PositionDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* dM17TimeDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* dM18Speed */ + { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* dM19SpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* dM20NULL */ + { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 }, /* dM21Frequency */ + { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0 }, /* dM22Position */ + { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0 }, /* dM23ProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0 }, /* dM24RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0 }, /* dM25NULL */ + { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0 }, /* dM26PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0 }, /* dM27DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0 }, /* dM28Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (29 << 2)), 29, 0, 0 }, /* dM29Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (30 << 2)), 30, 0, 0 }, /* dM30Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (31 << 2)), 31, 0, 0 }, /* dM31Position */ + { (ASN_TAG_CLASS_CONTEXT | (32 << 2)), 32, 0, 0 }, /* dM32Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (33 << 2)), 33, 0, 0 }, /* dM33Position */ + { (ASN_TAG_CLASS_CONTEXT | (34 << 2)), 34, 0, 0 }, /* dM34Speed */ + { (ASN_TAG_CLASS_CONTEXT | (35 << 2)), 35, 0, 0 }, /* dM35Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (36 << 2)), 36, 0, 0 }, /* dM36Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (37 << 2)), 37, 0, 0 }, /* dM37Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (38 << 2)), 38, 0, 0 }, /* dM38Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (39 << 2)), 39, 0, 0 }, /* dM39Speed */ + { (ASN_TAG_CLASS_CONTEXT | (40 << 2)), 40, 0, 0 }, /* dM40RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (41 << 2)), 41, 0, 0 }, /* dM41NULL */ + { (ASN_TAG_CLASS_CONTEXT | (42 << 2)), 42, 0, 0 }, /* dM42Position */ + { (ASN_TAG_CLASS_CONTEXT | (43 << 2)), 43, 0, 0 }, /* dM43Time */ + { (ASN_TAG_CLASS_CONTEXT | (44 << 2)), 44, 0, 0 }, /* dM44Position */ + { (ASN_TAG_CLASS_CONTEXT | (45 << 2)), 45, 0, 0 }, /* dM45Position */ + { (ASN_TAG_CLASS_CONTEXT | (46 << 2)), 46, 0, 0 }, /* dM46Time */ + { (ASN_TAG_CLASS_CONTEXT | (47 << 2)), 47, 0, 0 }, /* dM47BeaconCode */ + { (ASN_TAG_CLASS_CONTEXT | (48 << 2)), 48, 0, 0 }, /* dM48PositionReport */ + { (ASN_TAG_CLASS_CONTEXT | (49 << 2)), 49, 0, 0 }, /* dM49Speed */ + { (ASN_TAG_CLASS_CONTEXT | (50 << 2)), 50, 0, 0 }, /* dM50SpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (51 << 2)), 51, 0, 0 }, /* dM51NULL */ + { (ASN_TAG_CLASS_CONTEXT | (52 << 2)), 52, 0, 0 }, /* dM52NULL */ + { (ASN_TAG_CLASS_CONTEXT | (53 << 2)), 53, 0, 0 }, /* dM53NULL */ + { (ASN_TAG_CLASS_CONTEXT | (54 << 2)), 54, 0, 0 }, /* dM54Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (55 << 2)), 55, 0, 0 }, /* dM55NULL */ + { (ASN_TAG_CLASS_CONTEXT | (56 << 2)), 56, 0, 0 }, /* dM56NULL */ + { (ASN_TAG_CLASS_CONTEXT | (57 << 2)), 57, 0, 0 }, /* dM57RemainingFuelRemainingSouls */ + { (ASN_TAG_CLASS_CONTEXT | (58 << 2)), 58, 0, 0 }, /* dM58NULL */ + { (ASN_TAG_CLASS_CONTEXT | (59 << 2)), 59, 0, 0 }, /* dM59PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (60 << 2)), 60, 0, 0 }, /* dM60DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (61 << 2)), 61, 0, 0 }, /* dM61Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (62 << 2)), 62, 0, 0 }, /* dM62ErrorInformation */ + { (ASN_TAG_CLASS_CONTEXT | (63 << 2)), 63, 0, 0 }, /* dM63NULL */ + { (ASN_TAG_CLASS_CONTEXT | (64 << 2)), 64, 0, 0 }, /* dM64ICAOfacilitydesignation */ + { (ASN_TAG_CLASS_CONTEXT | (65 << 2)), 65, 0, 0 }, /* dM65NULL */ + { (ASN_TAG_CLASS_CONTEXT | (66 << 2)), 66, 0, 0 }, /* dM66NULL */ + { (ASN_TAG_CLASS_CONTEXT | (67 << 2)), 67, 0, 0 }, /* dM67FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (68 << 2)), 68, 0, 0 }, /* dM68FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (69 << 2)), 69, 0, 0 }, /* dM69NULL */ + { (ASN_TAG_CLASS_CONTEXT | (70 << 2)), 70, 0, 0 }, /* dM70Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (71 << 2)), 71, 0, 0 }, /* dM71Degrees */ + { (ASN_TAG_CLASS_CONTEXT | (72 << 2)), 72, 0, 0 }, /* dM72Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (73 << 2)), 73, 0, 0 }, /* dM73VersionNumber */ + { (ASN_TAG_CLASS_CONTEXT | (74 << 2)), 74, 0, 0 }, /* dM74NULL */ + { (ASN_TAG_CLASS_CONTEXT | (75 << 2)), 75, 0, 0 }, /* dM75NULL */ + { (ASN_TAG_CLASS_CONTEXT | (76 << 2)), 76, 0, 0 }, /* dM76AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (77 << 2)), 77, 0, 0 }, /* dM77AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (78 << 2)), 78, 0, 0 }, /* dM78TimeDistanceToFromPosition */ + { (ASN_TAG_CLASS_CONTEXT | (79 << 2)), 79, 0, 0 }, /* dM79ATISCode */ + { (ASN_TAG_CLASS_CONTEXT | (80 << 2)), 80, 0, 0 }, /* dM80DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (81 << 2)), 81, 0, 0 }, /* dM81NULL */ + { (ASN_TAG_CLASS_CONTEXT | (82 << 2)), 82, 0, 0 }, /* dM82NULL */ + { (ASN_TAG_CLASS_CONTEXT | (83 << 2)), 83, 0, 0 }, /* dM83NULL */ + { (ASN_TAG_CLASS_CONTEXT | (84 << 2)), 84, 0, 0 }, /* dM84NULL */ + { (ASN_TAG_CLASS_CONTEXT | (85 << 2)), 85, 0, 0 }, /* dM85NULL */ + { (ASN_TAG_CLASS_CONTEXT | (86 << 2)), 86, 0, 0 }, /* dM86NULL */ + { (ASN_TAG_CLASS_CONTEXT | (87 << 2)), 87, 0, 0 }, /* dM87NULL */ + { (ASN_TAG_CLASS_CONTEXT | (88 << 2)), 88, 0, 0 }, /* dM88NULL */ + { (ASN_TAG_CLASS_CONTEXT | (89 << 2)), 89, 0, 0 }, /* dM89NULL */ + { (ASN_TAG_CLASS_CONTEXT | (90 << 2)), 90, 0, 0 }, /* dM90NULL */ + { (ASN_TAG_CLASS_CONTEXT | (91 << 2)), 91, 0, 0 }, /* dM91NULL */ + { (ASN_TAG_CLASS_CONTEXT | (92 << 2)), 92, 0, 0 }, /* dM92NULL */ + { (ASN_TAG_CLASS_CONTEXT | (93 << 2)), 93, 0, 0 }, /* dM93NULL */ + { (ASN_TAG_CLASS_CONTEXT | (94 << 2)), 94, 0, 0 }, /* dM94NULL */ + { (ASN_TAG_CLASS_CONTEXT | (95 << 2)), 95, 0, 0 }, /* dM95NULL */ + { (ASN_TAG_CLASS_CONTEXT | (96 << 2)), 96, 0, 0 }, /* dM96NULL */ + { (ASN_TAG_CLASS_CONTEXT | (97 << 2)), 97, 0, 0 }, /* dM97NULL */ + { (ASN_TAG_CLASS_CONTEXT | (98 << 2)), 98, 0, 0 }, /* dM98NULL */ + { (ASN_TAG_CLASS_CONTEXT | (99 << 2)), 99, 0, 0 }, /* dM99NULL */ + { (ASN_TAG_CLASS_CONTEXT | (100 << 2)), 100, 0, 0 }, /* dM100NULL */ + { (ASN_TAG_CLASS_CONTEXT | (101 << 2)), 101, 0, 0 }, /* dM101NULL */ + { (ASN_TAG_CLASS_CONTEXT | (102 << 2)), 102, 0, 0 }, /* dM102NULL */ + { (ASN_TAG_CLASS_CONTEXT | (103 << 2)), 103, 0, 0 }, /* dM103NULL */ + { (ASN_TAG_CLASS_CONTEXT | (104 << 2)), 104, 0, 0 }, /* dM104NULL */ + { (ASN_TAG_CLASS_CONTEXT | (105 << 2)), 105, 0, 0 }, /* dM105NULL */ + { (ASN_TAG_CLASS_CONTEXT | (106 << 2)), 106, 0, 0 }, /* dM106NULL */ + { (ASN_TAG_CLASS_CONTEXT | (107 << 2)), 107, 0, 0 }, /* dM107NULL */ + { (ASN_TAG_CLASS_CONTEXT | (108 << 2)), 108, 0, 0 }, /* dM108NULL */ + { (ASN_TAG_CLASS_CONTEXT | (109 << 2)), 109, 0, 0 }, /* dM109NULL */ + { (ASN_TAG_CLASS_CONTEXT | (110 << 2)), 110, 0, 0 }, /* dM110NULL */ + { (ASN_TAG_CLASS_CONTEXT | (111 << 2)), 111, 0, 0 }, /* dM111NULL */ + { (ASN_TAG_CLASS_CONTEXT | (112 << 2)), 112, 0, 0 }, /* dM112NULL */ + { (ASN_TAG_CLASS_CONTEXT | (113 << 2)), 113, 0, 0 }, /* dM113NULL */ + { (ASN_TAG_CLASS_CONTEXT | (114 << 2)), 114, 0, 0 }, /* dM114NULL */ + { (ASN_TAG_CLASS_CONTEXT | (115 << 2)), 115, 0, 0 }, /* dM115NULL */ + { (ASN_TAG_CLASS_CONTEXT | (116 << 2)), 116, 0, 0 }, /* dM116NULL */ + { (ASN_TAG_CLASS_CONTEXT | (117 << 2)), 117, 0, 0 }, /* dM117NULL */ + { (ASN_TAG_CLASS_CONTEXT | (118 << 2)), 118, 0, 0 }, /* dM118NULL */ + { (ASN_TAG_CLASS_CONTEXT | (119 << 2)), 119, 0, 0 }, /* dM119NULL */ + { (ASN_TAG_CLASS_CONTEXT | (120 << 2)), 120, 0, 0 }, /* dM120NULL */ + { (ASN_TAG_CLASS_CONTEXT | (121 << 2)), 121, 0, 0 }, /* dM121NULL */ + { (ASN_TAG_CLASS_CONTEXT | (122 << 2)), 122, 0, 0 }, /* dM122NULL */ + { (ASN_TAG_CLASS_CONTEXT | (123 << 2)), 123, 0, 0 }, /* dM123NULL */ + { (ASN_TAG_CLASS_CONTEXT | (124 << 2)), 124, 0, 0 }, /* dM124NULL */ + { (ASN_TAG_CLASS_CONTEXT | (125 << 2)), 125, 0, 0 }, /* dM125NULL */ + { (ASN_TAG_CLASS_CONTEXT | (126 << 2)), 126, 0, 0 }, /* dM126NULL */ + { (ASN_TAG_CLASS_CONTEXT | (127 << 2)), 127, 0, 0 }, /* dM127NULL */ + { (ASN_TAG_CLASS_CONTEXT | (128 << 2)), 128, 0, 0 } /* dM128NULL */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSATCDownlinkMsgElementId_specs_1 = { + sizeof(struct FANSATCDownlinkMsgElementId), + offsetof(struct FANSATCDownlinkMsgElementId, _asn_ctx), + offsetof(struct FANSATCDownlinkMsgElementId, present), + sizeof(((struct FANSATCDownlinkMsgElementId *)0)->present), + asn_MAP_FANSATCDownlinkMsgElementId_tag2el_1, + 129, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCDownlinkMsgElementId = { + "FANSATCDownlinkMsgElementId", + "FANSATCDownlinkMsgElementId", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSATCDownlinkMsgElementId_constr_1, + asn_MBR_FANSATCDownlinkMsgElementId_1, + 129, /* Elements count */ + &asn_SPC_FANSATCDownlinkMsgElementId_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementId.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementId.h new file mode 100644 index 000000000..05011a07e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementId.h @@ -0,0 +1,328 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCDownlinkMsgElementId_H_ +#define _FANSATCDownlinkMsgElementId_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NULL.h" +#include "FANSAltitude.h" +#include "FANSAltitudeAltitude.h" +#include "FANSPositionAltitude.h" +#include "FANSTimeAltitude.h" +#include "FANSDistanceOffsetDirection.h" +#include "FANSPositionDistanceOffsetDirection.h" +#include "FANSTimeDistanceOffsetDirection.h" +#include "FANSSpeed.h" +#include "FANSSpeedSpeed.h" +#include "FANSFrequency.h" +#include "FANSPosition.h" +#include "FANSProcedureName.h" +#include "FANSRouteClearance.h" +#include "FANSPositionRouteClearance.h" +#include "FANSDegrees.h" +#include "FANSTime.h" +#include "FANSBeaconCode.h" +#include "FANSPositionReport.h" +#include "FANSRemainingFuelRemainingSouls.h" +#include "FANSErrorInformation.h" +#include "FANSICAOfacilityDesignation.h" +#include "FANSFreeText.h" +#include "FANSVersionNumber.h" +#include "FANSTimeDistanceToFromPosition.h" +#include "FANSATISCode.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSATCDownlinkMsgElementId_PR { + FANSATCDownlinkMsgElementId_PR_NOTHING, /* No components present */ + FANSATCDownlinkMsgElementId_PR_dM0NULL, + FANSATCDownlinkMsgElementId_PR_dM1NULL, + FANSATCDownlinkMsgElementId_PR_dM2NULL, + FANSATCDownlinkMsgElementId_PR_dM3NULL, + FANSATCDownlinkMsgElementId_PR_dM4NULL, + FANSATCDownlinkMsgElementId_PR_dM5NULL, + FANSATCDownlinkMsgElementId_PR_dM6Altitude, + FANSATCDownlinkMsgElementId_PR_dM7AltitudeAltitude, + FANSATCDownlinkMsgElementId_PR_dM8Altitude, + FANSATCDownlinkMsgElementId_PR_dM9Altitude, + FANSATCDownlinkMsgElementId_PR_dM10Altitude, + FANSATCDownlinkMsgElementId_PR_dM11PositionAltitude, + FANSATCDownlinkMsgElementId_PR_dM12PositionAltitude, + FANSATCDownlinkMsgElementId_PR_dM13TimeAltitude, + FANSATCDownlinkMsgElementId_PR_dM14TimeAltitude, + FANSATCDownlinkMsgElementId_PR_dM15DistanceOffsetDirection, + FANSATCDownlinkMsgElementId_PR_dM16PositionDistanceOffsetDirection, + FANSATCDownlinkMsgElementId_PR_dM17TimeDistanceOffsetDirection, + FANSATCDownlinkMsgElementId_PR_dM18Speed, + FANSATCDownlinkMsgElementId_PR_dM19SpeedSpeed, + FANSATCDownlinkMsgElementId_PR_dM20NULL, + FANSATCDownlinkMsgElementId_PR_dM21Frequency, + FANSATCDownlinkMsgElementId_PR_dM22Position, + FANSATCDownlinkMsgElementId_PR_dM23ProcedureName, + FANSATCDownlinkMsgElementId_PR_dM24RouteClearance, + FANSATCDownlinkMsgElementId_PR_dM25NULL, + FANSATCDownlinkMsgElementId_PR_dM26PositionRouteClearance, + FANSATCDownlinkMsgElementId_PR_dM27DistanceOffsetDirection, + FANSATCDownlinkMsgElementId_PR_dM28Altitude, + FANSATCDownlinkMsgElementId_PR_dM29Altitude, + FANSATCDownlinkMsgElementId_PR_dM30Altitude, + FANSATCDownlinkMsgElementId_PR_dM31Position, + FANSATCDownlinkMsgElementId_PR_dM32Altitude, + FANSATCDownlinkMsgElementId_PR_dM33Position, + FANSATCDownlinkMsgElementId_PR_dM34Speed, + FANSATCDownlinkMsgElementId_PR_dM35Degrees, + FANSATCDownlinkMsgElementId_PR_dM36Degrees, + FANSATCDownlinkMsgElementId_PR_dM37Altitude, + FANSATCDownlinkMsgElementId_PR_dM38Altitude, + FANSATCDownlinkMsgElementId_PR_dM39Speed, + FANSATCDownlinkMsgElementId_PR_dM40RouteClearance, + FANSATCDownlinkMsgElementId_PR_dM41NULL, + FANSATCDownlinkMsgElementId_PR_dM42Position, + FANSATCDownlinkMsgElementId_PR_dM43Time, + FANSATCDownlinkMsgElementId_PR_dM44Position, + FANSATCDownlinkMsgElementId_PR_dM45Position, + FANSATCDownlinkMsgElementId_PR_dM46Time, + FANSATCDownlinkMsgElementId_PR_dM47BeaconCode, + FANSATCDownlinkMsgElementId_PR_dM48PositionReport, + FANSATCDownlinkMsgElementId_PR_dM49Speed, + FANSATCDownlinkMsgElementId_PR_dM50SpeedSpeed, + FANSATCDownlinkMsgElementId_PR_dM51NULL, + FANSATCDownlinkMsgElementId_PR_dM52NULL, + FANSATCDownlinkMsgElementId_PR_dM53NULL, + FANSATCDownlinkMsgElementId_PR_dM54Altitude, + FANSATCDownlinkMsgElementId_PR_dM55NULL, + FANSATCDownlinkMsgElementId_PR_dM56NULL, + FANSATCDownlinkMsgElementId_PR_dM57RemainingFuelRemainingSouls, + FANSATCDownlinkMsgElementId_PR_dM58NULL, + FANSATCDownlinkMsgElementId_PR_dM59PositionRouteClearance, + FANSATCDownlinkMsgElementId_PR_dM60DistanceOffsetDirection, + FANSATCDownlinkMsgElementId_PR_dM61Altitude, + FANSATCDownlinkMsgElementId_PR_dM62ErrorInformation, + FANSATCDownlinkMsgElementId_PR_dM63NULL, + FANSATCDownlinkMsgElementId_PR_dM64ICAOfacilitydesignation, + FANSATCDownlinkMsgElementId_PR_dM65NULL, + FANSATCDownlinkMsgElementId_PR_dM66NULL, + FANSATCDownlinkMsgElementId_PR_dM67FreeText, + FANSATCDownlinkMsgElementId_PR_dM68FreeText, + FANSATCDownlinkMsgElementId_PR_dM69NULL, + FANSATCDownlinkMsgElementId_PR_dM70Degrees, + FANSATCDownlinkMsgElementId_PR_dM71Degrees, + FANSATCDownlinkMsgElementId_PR_dM72Altitude, + FANSATCDownlinkMsgElementId_PR_dM73VersionNumber, + FANSATCDownlinkMsgElementId_PR_dM74NULL, + FANSATCDownlinkMsgElementId_PR_dM75NULL, + FANSATCDownlinkMsgElementId_PR_dM76AltitudeAltitude, + FANSATCDownlinkMsgElementId_PR_dM77AltitudeAltitude, + FANSATCDownlinkMsgElementId_PR_dM78TimeDistanceToFromPosition, + FANSATCDownlinkMsgElementId_PR_dM79ATISCode, + FANSATCDownlinkMsgElementId_PR_dM80DistanceOffsetDirection, + FANSATCDownlinkMsgElementId_PR_dM81NULL, + FANSATCDownlinkMsgElementId_PR_dM82NULL, + FANSATCDownlinkMsgElementId_PR_dM83NULL, + FANSATCDownlinkMsgElementId_PR_dM84NULL, + FANSATCDownlinkMsgElementId_PR_dM85NULL, + FANSATCDownlinkMsgElementId_PR_dM86NULL, + FANSATCDownlinkMsgElementId_PR_dM87NULL, + FANSATCDownlinkMsgElementId_PR_dM88NULL, + FANSATCDownlinkMsgElementId_PR_dM89NULL, + FANSATCDownlinkMsgElementId_PR_dM90NULL, + FANSATCDownlinkMsgElementId_PR_dM91NULL, + FANSATCDownlinkMsgElementId_PR_dM92NULL, + FANSATCDownlinkMsgElementId_PR_dM93NULL, + FANSATCDownlinkMsgElementId_PR_dM94NULL, + FANSATCDownlinkMsgElementId_PR_dM95NULL, + FANSATCDownlinkMsgElementId_PR_dM96NULL, + FANSATCDownlinkMsgElementId_PR_dM97NULL, + FANSATCDownlinkMsgElementId_PR_dM98NULL, + FANSATCDownlinkMsgElementId_PR_dM99NULL, + FANSATCDownlinkMsgElementId_PR_dM100NULL, + FANSATCDownlinkMsgElementId_PR_dM101NULL, + FANSATCDownlinkMsgElementId_PR_dM102NULL, + FANSATCDownlinkMsgElementId_PR_dM103NULL, + FANSATCDownlinkMsgElementId_PR_dM104NULL, + FANSATCDownlinkMsgElementId_PR_dM105NULL, + FANSATCDownlinkMsgElementId_PR_dM106NULL, + FANSATCDownlinkMsgElementId_PR_dM107NULL, + FANSATCDownlinkMsgElementId_PR_dM108NULL, + FANSATCDownlinkMsgElementId_PR_dM109NULL, + FANSATCDownlinkMsgElementId_PR_dM110NULL, + FANSATCDownlinkMsgElementId_PR_dM111NULL, + FANSATCDownlinkMsgElementId_PR_dM112NULL, + FANSATCDownlinkMsgElementId_PR_dM113NULL, + FANSATCDownlinkMsgElementId_PR_dM114NULL, + FANSATCDownlinkMsgElementId_PR_dM115NULL, + FANSATCDownlinkMsgElementId_PR_dM116NULL, + FANSATCDownlinkMsgElementId_PR_dM117NULL, + FANSATCDownlinkMsgElementId_PR_dM118NULL, + FANSATCDownlinkMsgElementId_PR_dM119NULL, + FANSATCDownlinkMsgElementId_PR_dM120NULL, + FANSATCDownlinkMsgElementId_PR_dM121NULL, + FANSATCDownlinkMsgElementId_PR_dM122NULL, + FANSATCDownlinkMsgElementId_PR_dM123NULL, + FANSATCDownlinkMsgElementId_PR_dM124NULL, + FANSATCDownlinkMsgElementId_PR_dM125NULL, + FANSATCDownlinkMsgElementId_PR_dM126NULL, + FANSATCDownlinkMsgElementId_PR_dM127NULL, + FANSATCDownlinkMsgElementId_PR_dM128NULL +} FANSATCDownlinkMsgElementId_PR; + +/* FANSATCDownlinkMsgElementId */ +typedef struct FANSATCDownlinkMsgElementId { + FANSATCDownlinkMsgElementId_PR present; + union FANSATCDownlinkMsgElementId_u { + NULL_t dM0NULL; + NULL_t dM1NULL; + NULL_t dM2NULL; + NULL_t dM3NULL; + NULL_t dM4NULL; + NULL_t dM5NULL; + FANSAltitude_t dM6Altitude; + FANSAltitudeAltitude_t dM7AltitudeAltitude; + FANSAltitude_t dM8Altitude; + FANSAltitude_t dM9Altitude; + FANSAltitude_t dM10Altitude; + FANSPositionAltitude_t dM11PositionAltitude; + FANSPositionAltitude_t dM12PositionAltitude; + FANSTimeAltitude_t dM13TimeAltitude; + FANSTimeAltitude_t dM14TimeAltitude; + FANSDistanceOffsetDirection_t dM15DistanceOffsetDirection; + FANSPositionDistanceOffsetDirection_t dM16PositionDistanceOffsetDirection; + FANSTimeDistanceOffsetDirection_t dM17TimeDistanceOffsetDirection; + FANSSpeed_t dM18Speed; + FANSSpeedSpeed_t dM19SpeedSpeed; + NULL_t dM20NULL; + FANSFrequency_t dM21Frequency; + FANSPosition_t dM22Position; + FANSProcedureName_t dM23ProcedureName; + FANSRouteClearance_t dM24RouteClearance; + NULL_t dM25NULL; + FANSPositionRouteClearance_t dM26PositionRouteClearance; + FANSDistanceOffsetDirection_t dM27DistanceOffsetDirection; + FANSAltitude_t dM28Altitude; + FANSAltitude_t dM29Altitude; + FANSAltitude_t dM30Altitude; + FANSPosition_t dM31Position; + FANSAltitude_t dM32Altitude; + FANSPosition_t dM33Position; + FANSSpeed_t dM34Speed; + FANSDegrees_t dM35Degrees; + FANSDegrees_t dM36Degrees; + FANSAltitude_t dM37Altitude; + FANSAltitude_t dM38Altitude; + FANSSpeed_t dM39Speed; + FANSRouteClearance_t dM40RouteClearance; + NULL_t dM41NULL; + FANSPosition_t dM42Position; + FANSTime_t dM43Time; + FANSPosition_t dM44Position; + FANSPosition_t dM45Position; + FANSTime_t dM46Time; + FANSBeaconCode_t dM47BeaconCode; + FANSPositionReport_t dM48PositionReport; + FANSSpeed_t dM49Speed; + FANSSpeedSpeed_t dM50SpeedSpeed; + NULL_t dM51NULL; + NULL_t dM52NULL; + NULL_t dM53NULL; + FANSAltitude_t dM54Altitude; + NULL_t dM55NULL; + NULL_t dM56NULL; + FANSRemainingFuelRemainingSouls_t dM57RemainingFuelRemainingSouls; + NULL_t dM58NULL; + FANSPositionRouteClearance_t dM59PositionRouteClearance; + FANSDistanceOffsetDirection_t dM60DistanceOffsetDirection; + FANSAltitude_t dM61Altitude; + FANSErrorInformation_t dM62ErrorInformation; + NULL_t dM63NULL; + FANSICAOfacilityDesignation_t dM64ICAOfacilitydesignation; + NULL_t dM65NULL; + NULL_t dM66NULL; + FANSFreeText_t dM67FreeText; + FANSFreeText_t dM68FreeText; + NULL_t dM69NULL; + FANSDegrees_t dM70Degrees; + FANSDegrees_t dM71Degrees; + FANSAltitude_t dM72Altitude; + FANSVersionNumber_t dM73VersionNumber; + NULL_t dM74NULL; + NULL_t dM75NULL; + FANSAltitudeAltitude_t dM76AltitudeAltitude; + FANSAltitudeAltitude_t dM77AltitudeAltitude; + FANSTimeDistanceToFromPosition_t dM78TimeDistanceToFromPosition; + FANSATISCode_t dM79ATISCode; + FANSDistanceOffsetDirection_t dM80DistanceOffsetDirection; + NULL_t dM81NULL; + NULL_t dM82NULL; + NULL_t dM83NULL; + NULL_t dM84NULL; + NULL_t dM85NULL; + NULL_t dM86NULL; + NULL_t dM87NULL; + NULL_t dM88NULL; + NULL_t dM89NULL; + NULL_t dM90NULL; + NULL_t dM91NULL; + NULL_t dM92NULL; + NULL_t dM93NULL; + NULL_t dM94NULL; + NULL_t dM95NULL; + NULL_t dM96NULL; + NULL_t dM97NULL; + NULL_t dM98NULL; + NULL_t dM99NULL; + NULL_t dM100NULL; + NULL_t dM101NULL; + NULL_t dM102NULL; + NULL_t dM103NULL; + NULL_t dM104NULL; + NULL_t dM105NULL; + NULL_t dM106NULL; + NULL_t dM107NULL; + NULL_t dM108NULL; + NULL_t dM109NULL; + NULL_t dM110NULL; + NULL_t dM111NULL; + NULL_t dM112NULL; + NULL_t dM113NULL; + NULL_t dM114NULL; + NULL_t dM115NULL; + NULL_t dM116NULL; + NULL_t dM117NULL; + NULL_t dM118NULL; + NULL_t dM119NULL; + NULL_t dM120NULL; + NULL_t dM121NULL; + NULL_t dM122NULL; + NULL_t dM123NULL; + NULL_t dM124NULL; + NULL_t dM125NULL; + NULL_t dM126NULL; + NULL_t dM127NULL; + NULL_t dM128NULL; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCDownlinkMsgElementId_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCDownlinkMsgElementId; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATCDownlinkMsgElementId_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementIdSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementIdSequence.c new file mode 100644 index 000000000..8ed9808e0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementIdSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCDownlinkMsgElementIdSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSATCDownlinkMsgElementIdSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSATCDownlinkMsgElementIdSequence_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSATCDownlinkMsgElementId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSATCDownlinkMsgElementIdSequence_specs_1 = { + sizeof(struct FANSATCDownlinkMsgElementIdSequence), + offsetof(struct FANSATCDownlinkMsgElementIdSequence, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCDownlinkMsgElementIdSequence = { + "FANSATCDownlinkMsgElementIdSequence", + "FANSATCDownlinkMsgElementIdSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1, + sizeof(asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1) + /sizeof(asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1) + /sizeof(asn_DEF_FANSATCDownlinkMsgElementIdSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATCDownlinkMsgElementIdSequence_constr_1, + asn_MBR_FANSATCDownlinkMsgElementIdSequence_1, + 1, /* Single element */ + &asn_SPC_FANSATCDownlinkMsgElementIdSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementIdSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementIdSequence.h new file mode 100644 index 000000000..63076f78e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCDownlinkMsgElementIdSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCDownlinkMsgElementIdSequence_H_ +#define _FANSATCDownlinkMsgElementIdSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATCDownlinkMsgElementId; + +/* FANSATCDownlinkMsgElementIdSequence */ +typedef struct FANSATCDownlinkMsgElementIdSequence { + A_SEQUENCE_OF(struct FANSATCDownlinkMsgElementId) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCDownlinkMsgElementIdSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCDownlinkMsgElementIdSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATCDownlinkMsgElementId.h" + +#endif /* _FANSATCDownlinkMsgElementIdSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCMessageHeader.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCMessageHeader.c new file mode 100644 index 000000000..12732ed04 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCMessageHeader.c @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCMessageHeader.h" + +static asn_TYPE_member_t asn_MBR_FANSATCMessageHeader_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATCMessageHeader, msgIdentificationNumber), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSMsgIdentificationNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msgIdentificationNumber" + }, + { ATF_POINTER, 2, offsetof(struct FANSATCMessageHeader, msgReferenceNumber), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSMsgReferenceNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msgReferenceNumber" + }, + { ATF_POINTER, 1, offsetof(struct FANSATCMessageHeader, timestamp), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTimestamp, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timestamp" + }, +}; +static const int asn_MAP_FANSATCMessageHeader_oms_1[] = { 1, 2 }; +static const ber_tlv_tag_t asn_DEF_FANSATCMessageHeader_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATCMessageHeader_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* msgIdentificationNumber */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* msgReferenceNumber */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 0 } /* timestamp */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSATCMessageHeader_specs_1 = { + sizeof(struct FANSATCMessageHeader), + offsetof(struct FANSATCMessageHeader, _asn_ctx), + asn_MAP_FANSATCMessageHeader_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSATCMessageHeader_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCMessageHeader = { + "FANSATCMessageHeader", + "FANSATCMessageHeader", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATCMessageHeader_tags_1, + sizeof(asn_DEF_FANSATCMessageHeader_tags_1) + /sizeof(asn_DEF_FANSATCMessageHeader_tags_1[0]), /* 1 */ + asn_DEF_FANSATCMessageHeader_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATCMessageHeader_tags_1) + /sizeof(asn_DEF_FANSATCMessageHeader_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSATCMessageHeader_1, + 3, /* Elements count */ + &asn_SPC_FANSATCMessageHeader_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCMessageHeader.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCMessageHeader.h new file mode 100644 index 000000000..bdd29fa41 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCMessageHeader.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCMessageHeader_H_ +#define _FANSATCMessageHeader_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSMsgIdentificationNumber.h" +#include "FANSMsgReferenceNumber.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSTimestamp; + +/* FANSATCMessageHeader */ +typedef struct FANSATCMessageHeader { + FANSMsgIdentificationNumber_t msgIdentificationNumber; + FANSMsgReferenceNumber_t *msgReferenceNumber /* OPTIONAL */; + struct FANSTimestamp *timestamp /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCMessageHeader_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCMessageHeader; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSTimestamp.h" + +#endif /* _FANSATCMessageHeader_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMessage.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMessage.c new file mode 100644 index 000000000..af23d26d9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMessage.c @@ -0,0 +1,264 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCUplinkMessage.h" + +static asn_TYPE_member_t asn_MBR_FANSATCUplinkMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMessage, aTCMessageheader), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSATCMessageHeader, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTCMessageheader" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMessage, aTCuplinkmsgelementId), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSATCUplinkMsgElementId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTCuplinkmsgelementId" + }, + { ATF_POINTER, 1, offsetof(struct FANSATCUplinkMessage, aTCuplinkmsgelementid_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSATCUplinkMsgElementIdSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTCuplinkmsgelementid-seqOf" + }, +}; +static const int asn_MAP_FANSATCUplinkMessage_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_FANSATCUplinkMessage_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATCUplinkMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* aTCMessageheader */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 0 }, /* aTCuplinkmsgelementid-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* uM0NULL */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uM1NULL */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* uM2NULL */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* uM3NULL */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 }, /* uM4NULL */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* uM5NULL */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* uM6Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 }, /* uM7Time */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 1, 0, 0 }, /* uM8Position */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 1, 0, 0 }, /* uM9Time */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 1, 0, 0 }, /* uM10Position */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 1, 0, 0 }, /* uM11Time */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 1, 0, 0 }, /* uM12Position */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 1, 0, 0 }, /* uM13TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 1, 0, 0 }, /* uM14PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 1, 0, 0 }, /* uM15TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 1, 0, 0 }, /* uM16PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 1, 0, 0 }, /* uM17TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 1, 0, 0 }, /* uM18PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 1, 0, 0 }, /* uM19Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 1, 0, 0 }, /* uM20Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 1, 0, 0 }, /* uM21TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 1, 0, 0 }, /* uM22PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 1, 0, 0 }, /* uM23Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 1, 0, 0 }, /* uM24TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 1, 0, 0 }, /* uM25PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 1, 0, 0 }, /* uM26AltitudeTime */ + { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 1, 0, 0 }, /* uM27AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 1, 0, 0 }, /* uM28AltitudeTime */ + { (ASN_TAG_CLASS_CONTEXT | (29 << 2)), 1, 0, 0 }, /* uM29AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (30 << 2)), 1, 0, 0 }, /* uM30AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (31 << 2)), 1, 0, 0 }, /* uM31AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (32 << 2)), 1, 0, 0 }, /* uM32AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (33 << 2)), 1, 0, 0 }, /* uM33Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (34 << 2)), 1, 0, 0 }, /* uM34Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (35 << 2)), 1, 0, 0 }, /* uM35Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (36 << 2)), 1, 0, 0 }, /* uM36Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (37 << 2)), 1, 0, 0 }, /* uM37Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (38 << 2)), 1, 0, 0 }, /* uM38Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (39 << 2)), 1, 0, 0 }, /* uM39Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (40 << 2)), 1, 0, 0 }, /* uM40Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (41 << 2)), 1, 0, 0 }, /* uM41Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (42 << 2)), 1, 0, 0 }, /* uM42PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (43 << 2)), 1, 0, 0 }, /* uM43PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (44 << 2)), 1, 0, 0 }, /* uM44PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (45 << 2)), 1, 0, 0 }, /* uM45PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (46 << 2)), 1, 0, 0 }, /* uM46PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (47 << 2)), 1, 0, 0 }, /* uM47PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (48 << 2)), 1, 0, 0 }, /* uM48PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (49 << 2)), 1, 0, 0 }, /* uM49PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (50 << 2)), 1, 0, 0 }, /* uM50PositionAltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (51 << 2)), 1, 0, 0 }, /* uM51PositionTime */ + { (ASN_TAG_CLASS_CONTEXT | (52 << 2)), 1, 0, 0 }, /* uM52PositionTime */ + { (ASN_TAG_CLASS_CONTEXT | (53 << 2)), 1, 0, 0 }, /* uM53PositionTime */ + { (ASN_TAG_CLASS_CONTEXT | (54 << 2)), 1, 0, 0 }, /* uM54PositionTimeTime */ + { (ASN_TAG_CLASS_CONTEXT | (55 << 2)), 1, 0, 0 }, /* uM55PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (56 << 2)), 1, 0, 0 }, /* uM56PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (57 << 2)), 1, 0, 0 }, /* uM57PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (58 << 2)), 1, 0, 0 }, /* uM58PositionTimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (59 << 2)), 1, 0, 0 }, /* uM59PositionTimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (60 << 2)), 1, 0, 0 }, /* uM60PositionTimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (61 << 2)), 1, 0, 0 }, /* uM61PositionAltitudeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (62 << 2)), 1, 0, 0 }, /* uM62TimePositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (63 << 2)), 1, 0, 0 }, /* uM63TimePositionAltitudeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (64 << 2)), 1, 0, 0 }, /* uM64DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (65 << 2)), 1, 0, 0 }, /* uM65PositionDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (66 << 2)), 1, 0, 0 }, /* uM66TimeDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (67 << 2)), 1, 0, 0 }, /* uM67NULL */ + { (ASN_TAG_CLASS_CONTEXT | (68 << 2)), 1, 0, 0 }, /* uM68Position */ + { (ASN_TAG_CLASS_CONTEXT | (69 << 2)), 1, 0, 0 }, /* uM69Time */ + { (ASN_TAG_CLASS_CONTEXT | (70 << 2)), 1, 0, 0 }, /* uM70Position */ + { (ASN_TAG_CLASS_CONTEXT | (71 << 2)), 1, 0, 0 }, /* uM71Time */ + { (ASN_TAG_CLASS_CONTEXT | (72 << 2)), 1, 0, 0 }, /* uM72NULL */ + { (ASN_TAG_CLASS_CONTEXT | (73 << 2)), 1, 0, 0 }, /* uM73Predepartureclearance */ + { (ASN_TAG_CLASS_CONTEXT | (74 << 2)), 1, 0, 0 }, /* uM74Position */ + { (ASN_TAG_CLASS_CONTEXT | (75 << 2)), 1, 0, 0 }, /* uM75Position */ + { (ASN_TAG_CLASS_CONTEXT | (76 << 2)), 1, 0, 0 }, /* uM76TimePosition */ + { (ASN_TAG_CLASS_CONTEXT | (77 << 2)), 1, 0, 0 }, /* uM77PositionPosition */ + { (ASN_TAG_CLASS_CONTEXT | (78 << 2)), 1, 0, 0 }, /* uM78AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (79 << 2)), 1, 0, 0 }, /* uM79PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (80 << 2)), 1, 0, 0 }, /* uM80RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (81 << 2)), 1, 0, 0 }, /* uM81ProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (82 << 2)), 1, 0, 0 }, /* uM82DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (83 << 2)), 1, 0, 0 }, /* uM83PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (84 << 2)), 1, 0, 0 }, /* uM84PositionProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (85 << 2)), 1, 0, 0 }, /* uM85RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (86 << 2)), 1, 0, 0 }, /* uM86PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (87 << 2)), 1, 0, 0 }, /* uM87Position */ + { (ASN_TAG_CLASS_CONTEXT | (88 << 2)), 1, 0, 0 }, /* uM88PositionPosition */ + { (ASN_TAG_CLASS_CONTEXT | (89 << 2)), 1, 0, 0 }, /* uM89TimePosition */ + { (ASN_TAG_CLASS_CONTEXT | (90 << 2)), 1, 0, 0 }, /* uM90AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (91 << 2)), 1, 0, 0 }, /* uM91HoldClearance */ + { (ASN_TAG_CLASS_CONTEXT | (92 << 2)), 1, 0, 0 }, /* uM92PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (93 << 2)), 1, 0, 0 }, /* uM93Time */ + { (ASN_TAG_CLASS_CONTEXT | (94 << 2)), 1, 0, 0 }, /* uM94DirectionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (95 << 2)), 1, 0, 0 }, /* uM95DirectionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (96 << 2)), 1, 0, 0 }, /* uM96NULL */ + { (ASN_TAG_CLASS_CONTEXT | (97 << 2)), 1, 0, 0 }, /* uM97PositionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (98 << 2)), 1, 0, 0 }, /* uM98DirectionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (99 << 2)), 1, 0, 0 }, /* uM99ProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (100 << 2)), 1, 0, 0 }, /* uM100TimeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (101 << 2)), 1, 0, 0 }, /* uM101PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (102 << 2)), 1, 0, 0 }, /* uM102AltitudeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (103 << 2)), 1, 0, 0 }, /* uM103TimeSpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (104 << 2)), 1, 0, 0 }, /* uM104PositionSpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (105 << 2)), 1, 0, 0 }, /* uM105AltitudeSpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (106 << 2)), 1, 0, 0 }, /* uM106Speed */ + { (ASN_TAG_CLASS_CONTEXT | (107 << 2)), 1, 0, 0 }, /* uM107NULL */ + { (ASN_TAG_CLASS_CONTEXT | (108 << 2)), 1, 0, 0 }, /* uM108Speed */ + { (ASN_TAG_CLASS_CONTEXT | (109 << 2)), 1, 0, 0 }, /* uM109Speed */ + { (ASN_TAG_CLASS_CONTEXT | (110 << 2)), 1, 0, 0 }, /* uM110SpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (111 << 2)), 1, 0, 0 }, /* uM111Speed */ + { (ASN_TAG_CLASS_CONTEXT | (112 << 2)), 1, 0, 0 }, /* uM112Speed */ + { (ASN_TAG_CLASS_CONTEXT | (113 << 2)), 1, 0, 0 }, /* uM113Speed */ + { (ASN_TAG_CLASS_CONTEXT | (114 << 2)), 1, 0, 0 }, /* uM114Speed */ + { (ASN_TAG_CLASS_CONTEXT | (115 << 2)), 1, 0, 0 }, /* uM115Speed */ + { (ASN_TAG_CLASS_CONTEXT | (116 << 2)), 1, 0, 0 }, /* uM116NULL */ + { (ASN_TAG_CLASS_CONTEXT | (117 << 2)), 1, 0, 0 }, /* uM117ICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (118 << 2)), 1, 0, 0 }, /* uM118PositionICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (119 << 2)), 1, 0, 0 }, /* uM119TimeICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (120 << 2)), 1, 0, 0 }, /* uM120ICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (121 << 2)), 1, 0, 0 }, /* uM121PositionICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (122 << 2)), 1, 0, 0 }, /* uM122TimeICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (123 << 2)), 1, 0, 0 }, /* uM123BeaconCode */ + { (ASN_TAG_CLASS_CONTEXT | (124 << 2)), 1, 0, 0 }, /* uM124NULL */ + { (ASN_TAG_CLASS_CONTEXT | (125 << 2)), 1, 0, 0 }, /* uM125NULL */ + { (ASN_TAG_CLASS_CONTEXT | (126 << 2)), 1, 0, 0 }, /* uM126NULL */ + { (ASN_TAG_CLASS_CONTEXT | (127 << 2)), 1, 0, 0 }, /* uM127NULL */ + { (ASN_TAG_CLASS_CONTEXT | (128 << 2)), 1, 0, 0 }, /* uM128Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (129 << 2)), 1, 0, 0 }, /* uM129Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (130 << 2)), 1, 0, 0 }, /* uM130Position */ + { (ASN_TAG_CLASS_CONTEXT | (131 << 2)), 1, 0, 0 }, /* uM131NULL */ + { (ASN_TAG_CLASS_CONTEXT | (132 << 2)), 1, 0, 0 }, /* uM132NULL */ + { (ASN_TAG_CLASS_CONTEXT | (133 << 2)), 1, 0, 0 }, /* uM133NULL */ + { (ASN_TAG_CLASS_CONTEXT | (134 << 2)), 1, 0, 0 }, /* uM134NULL */ + { (ASN_TAG_CLASS_CONTEXT | (135 << 2)), 1, 0, 0 }, /* uM135NULL */ + { (ASN_TAG_CLASS_CONTEXT | (136 << 2)), 1, 0, 0 }, /* uM136NULL */ + { (ASN_TAG_CLASS_CONTEXT | (137 << 2)), 1, 0, 0 }, /* uM137NULL */ + { (ASN_TAG_CLASS_CONTEXT | (138 << 2)), 1, 0, 0 }, /* uM138NULL */ + { (ASN_TAG_CLASS_CONTEXT | (139 << 2)), 1, 0, 0 }, /* uM139NULL */ + { (ASN_TAG_CLASS_CONTEXT | (140 << 2)), 1, 0, 0 }, /* uM140NULL */ + { (ASN_TAG_CLASS_CONTEXT | (141 << 2)), 1, 0, 0 }, /* uM141NULL */ + { (ASN_TAG_CLASS_CONTEXT | (142 << 2)), 1, 0, 0 }, /* uM142NULL */ + { (ASN_TAG_CLASS_CONTEXT | (143 << 2)), 1, 0, 0 }, /* uM143NULL */ + { (ASN_TAG_CLASS_CONTEXT | (144 << 2)), 1, 0, 0 }, /* uM144NULL */ + { (ASN_TAG_CLASS_CONTEXT | (145 << 2)), 1, 0, 0 }, /* uM145NULL */ + { (ASN_TAG_CLASS_CONTEXT | (146 << 2)), 1, 0, 0 }, /* uM146NULL */ + { (ASN_TAG_CLASS_CONTEXT | (147 << 2)), 1, 0, 0 }, /* uM147NULL */ + { (ASN_TAG_CLASS_CONTEXT | (148 << 2)), 1, 0, 0 }, /* uM148Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (149 << 2)), 1, 0, 0 }, /* uM149AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (150 << 2)), 1, 0, 0 }, /* uM150AltitudeTime */ + { (ASN_TAG_CLASS_CONTEXT | (151 << 2)), 1, 0, 0 }, /* uM151Speed */ + { (ASN_TAG_CLASS_CONTEXT | (152 << 2)), 1, 0, 0 }, /* uM152DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (153 << 2)), 1, 0, 0 }, /* uM153Altimeter */ + { (ASN_TAG_CLASS_CONTEXT | (154 << 2)), 1, 0, 0 }, /* uM154NULL */ + { (ASN_TAG_CLASS_CONTEXT | (155 << 2)), 1, 0, 0 }, /* uM155Position */ + { (ASN_TAG_CLASS_CONTEXT | (156 << 2)), 1, 0, 0 }, /* uM156NULL */ + { (ASN_TAG_CLASS_CONTEXT | (157 << 2)), 1, 0, 0 }, /* uM157Frequency */ + { (ASN_TAG_CLASS_CONTEXT | (158 << 2)), 1, 0, 0 }, /* uM158ATISCode */ + { (ASN_TAG_CLASS_CONTEXT | (159 << 2)), 1, 0, 0 }, /* uM159ErrorInformation */ + { (ASN_TAG_CLASS_CONTEXT | (160 << 2)), 1, 0, 0 }, /* uM160ICAOfacilitydesignation */ + { (ASN_TAG_CLASS_CONTEXT | (161 << 2)), 1, 0, 0 }, /* uM161NULL */ + { (ASN_TAG_CLASS_CONTEXT | (162 << 2)), 1, 0, 0 }, /* uM162NULL */ + { (ASN_TAG_CLASS_CONTEXT | (163 << 2)), 1, 0, 0 }, /* uM163ICAOfacilitydesignationTp4table */ + { (ASN_TAG_CLASS_CONTEXT | (164 << 2)), 1, 0, 0 }, /* uM164NULL */ + { (ASN_TAG_CLASS_CONTEXT | (165 << 2)), 1, 0, 0 }, /* uM165NULL */ + { (ASN_TAG_CLASS_CONTEXT | (166 << 2)), 1, 0, 0 }, /* uM166NULL */ + { (ASN_TAG_CLASS_CONTEXT | (167 << 2)), 1, 0, 0 }, /* uM167NULL */ + { (ASN_TAG_CLASS_CONTEXT | (168 << 2)), 1, 0, 0 }, /* uM168NULL */ + { (ASN_TAG_CLASS_CONTEXT | (169 << 2)), 1, 0, 0 }, /* uM169FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (170 << 2)), 1, 0, 0 }, /* uM170FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (171 << 2)), 1, 0, 0 }, /* uM171VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (172 << 2)), 1, 0, 0 }, /* uM172VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (173 << 2)), 1, 0, 0 }, /* uM173VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (174 << 2)), 1, 0, 0 }, /* uM174VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (175 << 2)), 1, 0, 0 }, /* uM175Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (176 << 2)), 1, 0, 0 }, /* uM176NULL */ + { (ASN_TAG_CLASS_CONTEXT | (177 << 2)), 1, 0, 0 }, /* uM177NULL */ + { (ASN_TAG_CLASS_CONTEXT | (178 << 2)), 1, 0, 0 }, /* uM178NULL */ + { (ASN_TAG_CLASS_CONTEXT | (179 << 2)), 1, 0, 0 }, /* uM179NULL */ + { (ASN_TAG_CLASS_CONTEXT | (180 << 2)), 1, 0, 0 }, /* uM180AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (181 << 2)), 1, 0, 0 }, /* uM181ToFromPosition */ + { (ASN_TAG_CLASS_CONTEXT | (182 << 2)), 1, 0, 0 } /* uM182NULL */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSATCUplinkMessage_specs_1 = { + sizeof(struct FANSATCUplinkMessage), + offsetof(struct FANSATCUplinkMessage, _asn_ctx), + asn_MAP_FANSATCUplinkMessage_tag2el_1, + 185, /* Count of tags in the map */ + asn_MAP_FANSATCUplinkMessage_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCUplinkMessage = { + "FANSATCUplinkMessage", + "FANSATCUplinkMessage", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATCUplinkMessage_tags_1, + sizeof(asn_DEF_FANSATCUplinkMessage_tags_1) + /sizeof(asn_DEF_FANSATCUplinkMessage_tags_1[0]), /* 1 */ + asn_DEF_FANSATCUplinkMessage_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATCUplinkMessage_tags_1) + /sizeof(asn_DEF_FANSATCUplinkMessage_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSATCUplinkMessage_1, + 3, /* Elements count */ + &asn_SPC_FANSATCUplinkMessage_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMessage.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMessage.h new file mode 100644 index 000000000..995d98e15 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMessage.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCUplinkMessage_H_ +#define _FANSATCUplinkMessage_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSATCMessageHeader.h" +#include "FANSATCUplinkMsgElementId.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATCUplinkMsgElementIdSequence; + +/* FANSATCUplinkMessage */ +typedef struct FANSATCUplinkMessage { + FANSATCMessageHeader_t aTCMessageheader; + FANSATCUplinkMsgElementId_t aTCuplinkmsgelementId; + struct FANSATCUplinkMsgElementIdSequence *aTCuplinkmsgelementid_seqOf /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCUplinkMessage_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCUplinkMessage; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATCUplinkMsgElementIdSequence.h" + +#endif /* _FANSATCUplinkMessage_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementId.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementId.c new file mode 100644 index 000000000..32e4dfdfe --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementId.c @@ -0,0 +1,1881 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCUplinkMsgElementId.h" + +static asn_per_constraints_t asn_PER_type_FANSATCUplinkMsgElementId_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 182 } /* (0..182) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSATCUplinkMsgElementId_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM0NULL), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM0NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM1NULL), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM1NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM2NULL), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM2NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM3NULL), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM3NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM4NULL), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM4NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM5NULL), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM5NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM6Altitude), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM6Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM7Time), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM7Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM8Position), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM8Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM9Time), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM9Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM10Position), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM10Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM11Time), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM11Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM12Position), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM12Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM13TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM13TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM14PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM14PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM15TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM15TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM16PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (16 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM16PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM17TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM17TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM18PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (18 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM18PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM19Altitude), + (ASN_TAG_CLASS_CONTEXT | (19 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM19Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM20Altitude), + (ASN_TAG_CLASS_CONTEXT | (20 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM20Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM21TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (21 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM21TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM22PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (22 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM22PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM23Altitude), + (ASN_TAG_CLASS_CONTEXT | (23 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM23Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM24TimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (24 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM24TimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM25PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (25 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM25PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM26AltitudeTime), + (ASN_TAG_CLASS_CONTEXT | (26 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM26AltitudeTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM27AltitudePosition), + (ASN_TAG_CLASS_CONTEXT | (27 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM27AltitudePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM28AltitudeTime), + (ASN_TAG_CLASS_CONTEXT | (28 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM28AltitudeTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM29AltitudePosition), + (ASN_TAG_CLASS_CONTEXT | (29 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM29AltitudePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM30AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (30 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM30AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM31AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (31 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM31AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM32AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (32 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM32AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM33Altitude), + (ASN_TAG_CLASS_CONTEXT | (33 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM33Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM34Altitude), + (ASN_TAG_CLASS_CONTEXT | (34 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM34Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM35Altitude), + (ASN_TAG_CLASS_CONTEXT | (35 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM35Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM36Altitude), + (ASN_TAG_CLASS_CONTEXT | (36 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM36Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM37Altitude), + (ASN_TAG_CLASS_CONTEXT | (37 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM37Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM38Altitude), + (ASN_TAG_CLASS_CONTEXT | (38 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM38Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM39Altitude), + (ASN_TAG_CLASS_CONTEXT | (39 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM39Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM40Altitude), + (ASN_TAG_CLASS_CONTEXT | (40 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM40Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM41Altitude), + (ASN_TAG_CLASS_CONTEXT | (41 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM41Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM42PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (42 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM42PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM43PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (43 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM43PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM44PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (44 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM44PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM45PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (45 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM45PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM46PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (46 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM46PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM47PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (47 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM47PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM48PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (48 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM48PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM49PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (49 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM49PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM50PositionAltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (50 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM50PositionAltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM51PositionTime), + (ASN_TAG_CLASS_CONTEXT | (51 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM51PositionTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM52PositionTime), + (ASN_TAG_CLASS_CONTEXT | (52 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM52PositionTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM53PositionTime), + (ASN_TAG_CLASS_CONTEXT | (53 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM53PositionTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM54PositionTimeTime), + (ASN_TAG_CLASS_CONTEXT | (54 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTimeTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM54PositionTimeTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM55PositionSpeed), + (ASN_TAG_CLASS_CONTEXT | (55 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM55PositionSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM56PositionSpeed), + (ASN_TAG_CLASS_CONTEXT | (56 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM56PositionSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM57PositionSpeed), + (ASN_TAG_CLASS_CONTEXT | (57 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM57PositionSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM58PositionTimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (58 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM58PositionTimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM59PositionTimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (59 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM59PositionTimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM60PositionTimeAltitude), + (ASN_TAG_CLASS_CONTEXT | (60 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionTimeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM60PositionTimeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM61PositionAltitudeSpeed), + (ASN_TAG_CLASS_CONTEXT | (61 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitudeSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM61PositionAltitudeSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM62TimePositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (62 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimePositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM62TimePositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM63TimePositionAltitudeSpeed), + (ASN_TAG_CLASS_CONTEXT | (63 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimePositionAltitudeSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM63TimePositionAltitudeSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM64DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (64 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM64DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM65PositionDistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (65 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM65PositionDistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM66TimeDistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (66 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM66TimeDistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM67NULL), + (ASN_TAG_CLASS_CONTEXT | (67 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM67NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM68Position), + (ASN_TAG_CLASS_CONTEXT | (68 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM68Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM69Time), + (ASN_TAG_CLASS_CONTEXT | (69 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM69Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM70Position), + (ASN_TAG_CLASS_CONTEXT | (70 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM70Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM71Time), + (ASN_TAG_CLASS_CONTEXT | (71 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM71Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM72NULL), + (ASN_TAG_CLASS_CONTEXT | (72 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM72NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM73Predepartureclearance), + (ASN_TAG_CLASS_CONTEXT | (73 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPredepartureClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM73Predepartureclearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM74Position), + (ASN_TAG_CLASS_CONTEXT | (74 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM74Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM75Position), + (ASN_TAG_CLASS_CONTEXT | (75 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM75Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM76TimePosition), + (ASN_TAG_CLASS_CONTEXT | (76 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM76TimePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM77PositionPosition), + (ASN_TAG_CLASS_CONTEXT | (77 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM77PositionPosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM78AltitudePosition), + (ASN_TAG_CLASS_CONTEXT | (78 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM78AltitudePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM79PositionRouteClearance), + (ASN_TAG_CLASS_CONTEXT | (79 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM79PositionRouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM80RouteClearance), + (ASN_TAG_CLASS_CONTEXT | (80 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM80RouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM81ProcedureName), + (ASN_TAG_CLASS_CONTEXT | (81 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSProcedureName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM81ProcedureName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM82DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (82 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM82DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM83PositionRouteClearance), + (ASN_TAG_CLASS_CONTEXT | (83 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM83PositionRouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM84PositionProcedureName), + (ASN_TAG_CLASS_CONTEXT | (84 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionProcedureName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM84PositionProcedureName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM85RouteClearance), + (ASN_TAG_CLASS_CONTEXT | (85 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM85RouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM86PositionRouteClearance), + (ASN_TAG_CLASS_CONTEXT | (86 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM86PositionRouteClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM87Position), + (ASN_TAG_CLASS_CONTEXT | (87 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM87Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM88PositionPosition), + (ASN_TAG_CLASS_CONTEXT | (88 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM88PositionPosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM89TimePosition), + (ASN_TAG_CLASS_CONTEXT | (89 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM89TimePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM90AltitudePosition), + (ASN_TAG_CLASS_CONTEXT | (90 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM90AltitudePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM91HoldClearance), + (ASN_TAG_CLASS_CONTEXT | (91 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSHoldClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM91HoldClearance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM92PositionAltitude), + (ASN_TAG_CLASS_CONTEXT | (92 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM92PositionAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM93Time), + (ASN_TAG_CLASS_CONTEXT | (93 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM93Time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM94DirectionDegrees), + (ASN_TAG_CLASS_CONTEXT | (94 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDirectionDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM94DirectionDegrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM95DirectionDegrees), + (ASN_TAG_CLASS_CONTEXT | (95 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDirectionDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM95DirectionDegrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM96NULL), + (ASN_TAG_CLASS_CONTEXT | (96 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM96NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM97PositionDegrees), + (ASN_TAG_CLASS_CONTEXT | (97 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM97PositionDegrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM98DirectionDegrees), + (ASN_TAG_CLASS_CONTEXT | (98 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDirectionDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM98DirectionDegrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM99ProcedureName), + (ASN_TAG_CLASS_CONTEXT | (99 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSProcedureName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM99ProcedureName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM100TimeSpeed), + (ASN_TAG_CLASS_CONTEXT | (100 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM100TimeSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM101PositionSpeed), + (ASN_TAG_CLASS_CONTEXT | (101 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM101PositionSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM102AltitudeSpeed), + (ASN_TAG_CLASS_CONTEXT | (102 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM102AltitudeSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM103TimeSpeedSpeed), + (ASN_TAG_CLASS_CONTEXT | (103 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM103TimeSpeedSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM104PositionSpeedSpeed), + (ASN_TAG_CLASS_CONTEXT | (104 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM104PositionSpeedSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM105AltitudeSpeedSpeed), + (ASN_TAG_CLASS_CONTEXT | (105 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM105AltitudeSpeedSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM106Speed), + (ASN_TAG_CLASS_CONTEXT | (106 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM106Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM107NULL), + (ASN_TAG_CLASS_CONTEXT | (107 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM107NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM108Speed), + (ASN_TAG_CLASS_CONTEXT | (108 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM108Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM109Speed), + (ASN_TAG_CLASS_CONTEXT | (109 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM109Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM110SpeedSpeed), + (ASN_TAG_CLASS_CONTEXT | (110 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM110SpeedSpeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM111Speed), + (ASN_TAG_CLASS_CONTEXT | (111 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM111Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM112Speed), + (ASN_TAG_CLASS_CONTEXT | (112 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM112Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM113Speed), + (ASN_TAG_CLASS_CONTEXT | (113 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM113Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM114Speed), + (ASN_TAG_CLASS_CONTEXT | (114 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM114Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM115Speed), + (ASN_TAG_CLASS_CONTEXT | (115 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM115Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM116NULL), + (ASN_TAG_CLASS_CONTEXT | (116 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM116NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM117ICAOunitnameFrequency), + (ASN_TAG_CLASS_CONTEXT | (117 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOUnitNameFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM117ICAOunitnameFrequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM118PositionICAOunitnameFrequency), + (ASN_TAG_CLASS_CONTEXT | (118 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionICAOUnitNameFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM118PositionICAOunitnameFrequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM119TimeICAOunitnameFrequency), + (ASN_TAG_CLASS_CONTEXT | (119 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeICAOunitnameFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM119TimeICAOunitnameFrequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM120ICAOunitnameFrequency), + (ASN_TAG_CLASS_CONTEXT | (120 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOUnitNameFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM120ICAOunitnameFrequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM121PositionICAOunitnameFrequency), + (ASN_TAG_CLASS_CONTEXT | (121 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPositionICAOUnitNameFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM121PositionICAOunitnameFrequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM122TimeICAOunitnameFrequency), + (ASN_TAG_CLASS_CONTEXT | (122 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeICAOunitnameFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM122TimeICAOunitnameFrequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM123BeaconCode), + (ASN_TAG_CLASS_CONTEXT | (123 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSBeaconCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM123BeaconCode" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM124NULL), + (ASN_TAG_CLASS_CONTEXT | (124 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM124NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM125NULL), + (ASN_TAG_CLASS_CONTEXT | (125 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM125NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM126NULL), + (ASN_TAG_CLASS_CONTEXT | (126 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM126NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM127NULL), + (ASN_TAG_CLASS_CONTEXT | (127 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM127NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM128Altitude), + (ASN_TAG_CLASS_CONTEXT | (128 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM128Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM129Altitude), + (ASN_TAG_CLASS_CONTEXT | (129 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM129Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM130Position), + (ASN_TAG_CLASS_CONTEXT | (130 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM130Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM131NULL), + (ASN_TAG_CLASS_CONTEXT | (131 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM131NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM132NULL), + (ASN_TAG_CLASS_CONTEXT | (132 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM132NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM133NULL), + (ASN_TAG_CLASS_CONTEXT | (133 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM133NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM134NULL), + (ASN_TAG_CLASS_CONTEXT | (134 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM134NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM135NULL), + (ASN_TAG_CLASS_CONTEXT | (135 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM135NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM136NULL), + (ASN_TAG_CLASS_CONTEXT | (136 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM136NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM137NULL), + (ASN_TAG_CLASS_CONTEXT | (137 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM137NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM138NULL), + (ASN_TAG_CLASS_CONTEXT | (138 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM138NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM139NULL), + (ASN_TAG_CLASS_CONTEXT | (139 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM139NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM140NULL), + (ASN_TAG_CLASS_CONTEXT | (140 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM140NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM141NULL), + (ASN_TAG_CLASS_CONTEXT | (141 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM141NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM142NULL), + (ASN_TAG_CLASS_CONTEXT | (142 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM142NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM143NULL), + (ASN_TAG_CLASS_CONTEXT | (143 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM143NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM144NULL), + (ASN_TAG_CLASS_CONTEXT | (144 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM144NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM145NULL), + (ASN_TAG_CLASS_CONTEXT | (145 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM145NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM146NULL), + (ASN_TAG_CLASS_CONTEXT | (146 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM146NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM147NULL), + (ASN_TAG_CLASS_CONTEXT | (147 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM147NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM148Altitude), + (ASN_TAG_CLASS_CONTEXT | (148 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM148Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM149AltitudePosition), + (ASN_TAG_CLASS_CONTEXT | (149 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudePosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM149AltitudePosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM150AltitudeTime), + (ASN_TAG_CLASS_CONTEXT | (150 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM150AltitudeTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM151Speed), + (ASN_TAG_CLASS_CONTEXT | (151 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM151Speed" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM152DistanceOffsetDirection), + (ASN_TAG_CLASS_CONTEXT | (152 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM152DistanceOffsetDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM153Altimeter), + (ASN_TAG_CLASS_CONTEXT | (153 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltimeter, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM153Altimeter" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM154NULL), + (ASN_TAG_CLASS_CONTEXT | (154 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM154NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM155Position), + (ASN_TAG_CLASS_CONTEXT | (155 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM155Position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM156NULL), + (ASN_TAG_CLASS_CONTEXT | (156 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM156NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM157Frequency), + (ASN_TAG_CLASS_CONTEXT | (157 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM157Frequency" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM158ATISCode), + (ASN_TAG_CLASS_CONTEXT | (158 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATISCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM158ATISCode" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM159ErrorInformation), + (ASN_TAG_CLASS_CONTEXT | (159 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSErrorInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM159ErrorInformation" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM160ICAOfacilitydesignation), + (ASN_TAG_CLASS_CONTEXT | (160 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOfacilityDesignation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM160ICAOfacilitydesignation" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM161NULL), + (ASN_TAG_CLASS_CONTEXT | (161 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM161NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM162NULL), + (ASN_TAG_CLASS_CONTEXT | (162 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM162NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM163ICAOfacilitydesignationTp4table), + (ASN_TAG_CLASS_CONTEXT | (163 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOFacilityDesignationTp4Table, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM163ICAOfacilitydesignationTp4table" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM164NULL), + (ASN_TAG_CLASS_CONTEXT | (164 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM164NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM165NULL), + (ASN_TAG_CLASS_CONTEXT | (165 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM165NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM166NULL), + (ASN_TAG_CLASS_CONTEXT | (166 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM166NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM167NULL), + (ASN_TAG_CLASS_CONTEXT | (167 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM167NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM168NULL), + (ASN_TAG_CLASS_CONTEXT | (168 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM168NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM169FreeText), + (ASN_TAG_CLASS_CONTEXT | (169 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFreeText, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM169FreeText" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM170FreeText), + (ASN_TAG_CLASS_CONTEXT | (170 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFreeText, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM170FreeText" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM171VerticalRate), + (ASN_TAG_CLASS_CONTEXT | (171 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSVerticalRate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM171VerticalRate" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM172VerticalRate), + (ASN_TAG_CLASS_CONTEXT | (172 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSVerticalRate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM172VerticalRate" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM173VerticalRate), + (ASN_TAG_CLASS_CONTEXT | (173 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSVerticalRate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM173VerticalRate" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM174VerticalRate), + (ASN_TAG_CLASS_CONTEXT | (174 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSVerticalRate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM174VerticalRate" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM175Altitude), + (ASN_TAG_CLASS_CONTEXT | (175 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM175Altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM176NULL), + (ASN_TAG_CLASS_CONTEXT | (176 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM176NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM177NULL), + (ASN_TAG_CLASS_CONTEXT | (177 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM177NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM178NULL), + (ASN_TAG_CLASS_CONTEXT | (178 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM178NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM179NULL), + (ASN_TAG_CLASS_CONTEXT | (179 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM179NULL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM180AltitudeAltitude), + (ASN_TAG_CLASS_CONTEXT | (180 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM180AltitudeAltitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM181ToFromPosition), + (ASN_TAG_CLASS_CONTEXT | (181 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSToFromPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM181ToFromPosition" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATCUplinkMsgElementId, choice.uM182NULL), + (ASN_TAG_CLASS_CONTEXT | (182 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uM182NULL" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATCUplinkMsgElementId_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uM0NULL */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uM1NULL */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* uM2NULL */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* uM3NULL */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* uM4NULL */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* uM5NULL */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* uM6Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* uM7Time */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* uM8Position */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* uM9Time */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* uM10Position */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* uM11Time */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* uM12Position */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* uM13TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* uM14PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 }, /* uM15TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* uM16PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* uM17TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* uM18PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* uM19Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* uM20Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 }, /* uM21TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0 }, /* uM22PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0 }, /* uM23Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0 }, /* uM24TimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0 }, /* uM25PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0 }, /* uM26AltitudeTime */ + { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0 }, /* uM27AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0 }, /* uM28AltitudeTime */ + { (ASN_TAG_CLASS_CONTEXT | (29 << 2)), 29, 0, 0 }, /* uM29AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (30 << 2)), 30, 0, 0 }, /* uM30AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (31 << 2)), 31, 0, 0 }, /* uM31AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (32 << 2)), 32, 0, 0 }, /* uM32AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (33 << 2)), 33, 0, 0 }, /* uM33Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (34 << 2)), 34, 0, 0 }, /* uM34Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (35 << 2)), 35, 0, 0 }, /* uM35Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (36 << 2)), 36, 0, 0 }, /* uM36Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (37 << 2)), 37, 0, 0 }, /* uM37Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (38 << 2)), 38, 0, 0 }, /* uM38Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (39 << 2)), 39, 0, 0 }, /* uM39Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (40 << 2)), 40, 0, 0 }, /* uM40Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (41 << 2)), 41, 0, 0 }, /* uM41Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (42 << 2)), 42, 0, 0 }, /* uM42PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (43 << 2)), 43, 0, 0 }, /* uM43PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (44 << 2)), 44, 0, 0 }, /* uM44PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (45 << 2)), 45, 0, 0 }, /* uM45PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (46 << 2)), 46, 0, 0 }, /* uM46PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (47 << 2)), 47, 0, 0 }, /* uM47PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (48 << 2)), 48, 0, 0 }, /* uM48PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (49 << 2)), 49, 0, 0 }, /* uM49PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (50 << 2)), 50, 0, 0 }, /* uM50PositionAltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (51 << 2)), 51, 0, 0 }, /* uM51PositionTime */ + { (ASN_TAG_CLASS_CONTEXT | (52 << 2)), 52, 0, 0 }, /* uM52PositionTime */ + { (ASN_TAG_CLASS_CONTEXT | (53 << 2)), 53, 0, 0 }, /* uM53PositionTime */ + { (ASN_TAG_CLASS_CONTEXT | (54 << 2)), 54, 0, 0 }, /* uM54PositionTimeTime */ + { (ASN_TAG_CLASS_CONTEXT | (55 << 2)), 55, 0, 0 }, /* uM55PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (56 << 2)), 56, 0, 0 }, /* uM56PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (57 << 2)), 57, 0, 0 }, /* uM57PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (58 << 2)), 58, 0, 0 }, /* uM58PositionTimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (59 << 2)), 59, 0, 0 }, /* uM59PositionTimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (60 << 2)), 60, 0, 0 }, /* uM60PositionTimeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (61 << 2)), 61, 0, 0 }, /* uM61PositionAltitudeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (62 << 2)), 62, 0, 0 }, /* uM62TimePositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (63 << 2)), 63, 0, 0 }, /* uM63TimePositionAltitudeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (64 << 2)), 64, 0, 0 }, /* uM64DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (65 << 2)), 65, 0, 0 }, /* uM65PositionDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (66 << 2)), 66, 0, 0 }, /* uM66TimeDistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (67 << 2)), 67, 0, 0 }, /* uM67NULL */ + { (ASN_TAG_CLASS_CONTEXT | (68 << 2)), 68, 0, 0 }, /* uM68Position */ + { (ASN_TAG_CLASS_CONTEXT | (69 << 2)), 69, 0, 0 }, /* uM69Time */ + { (ASN_TAG_CLASS_CONTEXT | (70 << 2)), 70, 0, 0 }, /* uM70Position */ + { (ASN_TAG_CLASS_CONTEXT | (71 << 2)), 71, 0, 0 }, /* uM71Time */ + { (ASN_TAG_CLASS_CONTEXT | (72 << 2)), 72, 0, 0 }, /* uM72NULL */ + { (ASN_TAG_CLASS_CONTEXT | (73 << 2)), 73, 0, 0 }, /* uM73Predepartureclearance */ + { (ASN_TAG_CLASS_CONTEXT | (74 << 2)), 74, 0, 0 }, /* uM74Position */ + { (ASN_TAG_CLASS_CONTEXT | (75 << 2)), 75, 0, 0 }, /* uM75Position */ + { (ASN_TAG_CLASS_CONTEXT | (76 << 2)), 76, 0, 0 }, /* uM76TimePosition */ + { (ASN_TAG_CLASS_CONTEXT | (77 << 2)), 77, 0, 0 }, /* uM77PositionPosition */ + { (ASN_TAG_CLASS_CONTEXT | (78 << 2)), 78, 0, 0 }, /* uM78AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (79 << 2)), 79, 0, 0 }, /* uM79PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (80 << 2)), 80, 0, 0 }, /* uM80RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (81 << 2)), 81, 0, 0 }, /* uM81ProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (82 << 2)), 82, 0, 0 }, /* uM82DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (83 << 2)), 83, 0, 0 }, /* uM83PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (84 << 2)), 84, 0, 0 }, /* uM84PositionProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (85 << 2)), 85, 0, 0 }, /* uM85RouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (86 << 2)), 86, 0, 0 }, /* uM86PositionRouteClearance */ + { (ASN_TAG_CLASS_CONTEXT | (87 << 2)), 87, 0, 0 }, /* uM87Position */ + { (ASN_TAG_CLASS_CONTEXT | (88 << 2)), 88, 0, 0 }, /* uM88PositionPosition */ + { (ASN_TAG_CLASS_CONTEXT | (89 << 2)), 89, 0, 0 }, /* uM89TimePosition */ + { (ASN_TAG_CLASS_CONTEXT | (90 << 2)), 90, 0, 0 }, /* uM90AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (91 << 2)), 91, 0, 0 }, /* uM91HoldClearance */ + { (ASN_TAG_CLASS_CONTEXT | (92 << 2)), 92, 0, 0 }, /* uM92PositionAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (93 << 2)), 93, 0, 0 }, /* uM93Time */ + { (ASN_TAG_CLASS_CONTEXT | (94 << 2)), 94, 0, 0 }, /* uM94DirectionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (95 << 2)), 95, 0, 0 }, /* uM95DirectionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (96 << 2)), 96, 0, 0 }, /* uM96NULL */ + { (ASN_TAG_CLASS_CONTEXT | (97 << 2)), 97, 0, 0 }, /* uM97PositionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (98 << 2)), 98, 0, 0 }, /* uM98DirectionDegrees */ + { (ASN_TAG_CLASS_CONTEXT | (99 << 2)), 99, 0, 0 }, /* uM99ProcedureName */ + { (ASN_TAG_CLASS_CONTEXT | (100 << 2)), 100, 0, 0 }, /* uM100TimeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (101 << 2)), 101, 0, 0 }, /* uM101PositionSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (102 << 2)), 102, 0, 0 }, /* uM102AltitudeSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (103 << 2)), 103, 0, 0 }, /* uM103TimeSpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (104 << 2)), 104, 0, 0 }, /* uM104PositionSpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (105 << 2)), 105, 0, 0 }, /* uM105AltitudeSpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (106 << 2)), 106, 0, 0 }, /* uM106Speed */ + { (ASN_TAG_CLASS_CONTEXT | (107 << 2)), 107, 0, 0 }, /* uM107NULL */ + { (ASN_TAG_CLASS_CONTEXT | (108 << 2)), 108, 0, 0 }, /* uM108Speed */ + { (ASN_TAG_CLASS_CONTEXT | (109 << 2)), 109, 0, 0 }, /* uM109Speed */ + { (ASN_TAG_CLASS_CONTEXT | (110 << 2)), 110, 0, 0 }, /* uM110SpeedSpeed */ + { (ASN_TAG_CLASS_CONTEXT | (111 << 2)), 111, 0, 0 }, /* uM111Speed */ + { (ASN_TAG_CLASS_CONTEXT | (112 << 2)), 112, 0, 0 }, /* uM112Speed */ + { (ASN_TAG_CLASS_CONTEXT | (113 << 2)), 113, 0, 0 }, /* uM113Speed */ + { (ASN_TAG_CLASS_CONTEXT | (114 << 2)), 114, 0, 0 }, /* uM114Speed */ + { (ASN_TAG_CLASS_CONTEXT | (115 << 2)), 115, 0, 0 }, /* uM115Speed */ + { (ASN_TAG_CLASS_CONTEXT | (116 << 2)), 116, 0, 0 }, /* uM116NULL */ + { (ASN_TAG_CLASS_CONTEXT | (117 << 2)), 117, 0, 0 }, /* uM117ICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (118 << 2)), 118, 0, 0 }, /* uM118PositionICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (119 << 2)), 119, 0, 0 }, /* uM119TimeICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (120 << 2)), 120, 0, 0 }, /* uM120ICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (121 << 2)), 121, 0, 0 }, /* uM121PositionICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (122 << 2)), 122, 0, 0 }, /* uM122TimeICAOunitnameFrequency */ + { (ASN_TAG_CLASS_CONTEXT | (123 << 2)), 123, 0, 0 }, /* uM123BeaconCode */ + { (ASN_TAG_CLASS_CONTEXT | (124 << 2)), 124, 0, 0 }, /* uM124NULL */ + { (ASN_TAG_CLASS_CONTEXT | (125 << 2)), 125, 0, 0 }, /* uM125NULL */ + { (ASN_TAG_CLASS_CONTEXT | (126 << 2)), 126, 0, 0 }, /* uM126NULL */ + { (ASN_TAG_CLASS_CONTEXT | (127 << 2)), 127, 0, 0 }, /* uM127NULL */ + { (ASN_TAG_CLASS_CONTEXT | (128 << 2)), 128, 0, 0 }, /* uM128Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (129 << 2)), 129, 0, 0 }, /* uM129Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (130 << 2)), 130, 0, 0 }, /* uM130Position */ + { (ASN_TAG_CLASS_CONTEXT | (131 << 2)), 131, 0, 0 }, /* uM131NULL */ + { (ASN_TAG_CLASS_CONTEXT | (132 << 2)), 132, 0, 0 }, /* uM132NULL */ + { (ASN_TAG_CLASS_CONTEXT | (133 << 2)), 133, 0, 0 }, /* uM133NULL */ + { (ASN_TAG_CLASS_CONTEXT | (134 << 2)), 134, 0, 0 }, /* uM134NULL */ + { (ASN_TAG_CLASS_CONTEXT | (135 << 2)), 135, 0, 0 }, /* uM135NULL */ + { (ASN_TAG_CLASS_CONTEXT | (136 << 2)), 136, 0, 0 }, /* uM136NULL */ + { (ASN_TAG_CLASS_CONTEXT | (137 << 2)), 137, 0, 0 }, /* uM137NULL */ + { (ASN_TAG_CLASS_CONTEXT | (138 << 2)), 138, 0, 0 }, /* uM138NULL */ + { (ASN_TAG_CLASS_CONTEXT | (139 << 2)), 139, 0, 0 }, /* uM139NULL */ + { (ASN_TAG_CLASS_CONTEXT | (140 << 2)), 140, 0, 0 }, /* uM140NULL */ + { (ASN_TAG_CLASS_CONTEXT | (141 << 2)), 141, 0, 0 }, /* uM141NULL */ + { (ASN_TAG_CLASS_CONTEXT | (142 << 2)), 142, 0, 0 }, /* uM142NULL */ + { (ASN_TAG_CLASS_CONTEXT | (143 << 2)), 143, 0, 0 }, /* uM143NULL */ + { (ASN_TAG_CLASS_CONTEXT | (144 << 2)), 144, 0, 0 }, /* uM144NULL */ + { (ASN_TAG_CLASS_CONTEXT | (145 << 2)), 145, 0, 0 }, /* uM145NULL */ + { (ASN_TAG_CLASS_CONTEXT | (146 << 2)), 146, 0, 0 }, /* uM146NULL */ + { (ASN_TAG_CLASS_CONTEXT | (147 << 2)), 147, 0, 0 }, /* uM147NULL */ + { (ASN_TAG_CLASS_CONTEXT | (148 << 2)), 148, 0, 0 }, /* uM148Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (149 << 2)), 149, 0, 0 }, /* uM149AltitudePosition */ + { (ASN_TAG_CLASS_CONTEXT | (150 << 2)), 150, 0, 0 }, /* uM150AltitudeTime */ + { (ASN_TAG_CLASS_CONTEXT | (151 << 2)), 151, 0, 0 }, /* uM151Speed */ + { (ASN_TAG_CLASS_CONTEXT | (152 << 2)), 152, 0, 0 }, /* uM152DistanceOffsetDirection */ + { (ASN_TAG_CLASS_CONTEXT | (153 << 2)), 153, 0, 0 }, /* uM153Altimeter */ + { (ASN_TAG_CLASS_CONTEXT | (154 << 2)), 154, 0, 0 }, /* uM154NULL */ + { (ASN_TAG_CLASS_CONTEXT | (155 << 2)), 155, 0, 0 }, /* uM155Position */ + { (ASN_TAG_CLASS_CONTEXT | (156 << 2)), 156, 0, 0 }, /* uM156NULL */ + { (ASN_TAG_CLASS_CONTEXT | (157 << 2)), 157, 0, 0 }, /* uM157Frequency */ + { (ASN_TAG_CLASS_CONTEXT | (158 << 2)), 158, 0, 0 }, /* uM158ATISCode */ + { (ASN_TAG_CLASS_CONTEXT | (159 << 2)), 159, 0, 0 }, /* uM159ErrorInformation */ + { (ASN_TAG_CLASS_CONTEXT | (160 << 2)), 160, 0, 0 }, /* uM160ICAOfacilitydesignation */ + { (ASN_TAG_CLASS_CONTEXT | (161 << 2)), 161, 0, 0 }, /* uM161NULL */ + { (ASN_TAG_CLASS_CONTEXT | (162 << 2)), 162, 0, 0 }, /* uM162NULL */ + { (ASN_TAG_CLASS_CONTEXT | (163 << 2)), 163, 0, 0 }, /* uM163ICAOfacilitydesignationTp4table */ + { (ASN_TAG_CLASS_CONTEXT | (164 << 2)), 164, 0, 0 }, /* uM164NULL */ + { (ASN_TAG_CLASS_CONTEXT | (165 << 2)), 165, 0, 0 }, /* uM165NULL */ + { (ASN_TAG_CLASS_CONTEXT | (166 << 2)), 166, 0, 0 }, /* uM166NULL */ + { (ASN_TAG_CLASS_CONTEXT | (167 << 2)), 167, 0, 0 }, /* uM167NULL */ + { (ASN_TAG_CLASS_CONTEXT | (168 << 2)), 168, 0, 0 }, /* uM168NULL */ + { (ASN_TAG_CLASS_CONTEXT | (169 << 2)), 169, 0, 0 }, /* uM169FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (170 << 2)), 170, 0, 0 }, /* uM170FreeText */ + { (ASN_TAG_CLASS_CONTEXT | (171 << 2)), 171, 0, 0 }, /* uM171VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (172 << 2)), 172, 0, 0 }, /* uM172VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (173 << 2)), 173, 0, 0 }, /* uM173VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (174 << 2)), 174, 0, 0 }, /* uM174VerticalRate */ + { (ASN_TAG_CLASS_CONTEXT | (175 << 2)), 175, 0, 0 }, /* uM175Altitude */ + { (ASN_TAG_CLASS_CONTEXT | (176 << 2)), 176, 0, 0 }, /* uM176NULL */ + { (ASN_TAG_CLASS_CONTEXT | (177 << 2)), 177, 0, 0 }, /* uM177NULL */ + { (ASN_TAG_CLASS_CONTEXT | (178 << 2)), 178, 0, 0 }, /* uM178NULL */ + { (ASN_TAG_CLASS_CONTEXT | (179 << 2)), 179, 0, 0 }, /* uM179NULL */ + { (ASN_TAG_CLASS_CONTEXT | (180 << 2)), 180, 0, 0 }, /* uM180AltitudeAltitude */ + { (ASN_TAG_CLASS_CONTEXT | (181 << 2)), 181, 0, 0 }, /* uM181ToFromPosition */ + { (ASN_TAG_CLASS_CONTEXT | (182 << 2)), 182, 0, 0 } /* uM182NULL */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSATCUplinkMsgElementId_specs_1 = { + sizeof(struct FANSATCUplinkMsgElementId), + offsetof(struct FANSATCUplinkMsgElementId, _asn_ctx), + offsetof(struct FANSATCUplinkMsgElementId, present), + sizeof(((struct FANSATCUplinkMsgElementId *)0)->present), + asn_MAP_FANSATCUplinkMsgElementId_tag2el_1, + 183, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCUplinkMsgElementId = { + "FANSATCUplinkMsgElementId", + "FANSATCUplinkMsgElementId", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSATCUplinkMsgElementId_constr_1, + asn_MBR_FANSATCUplinkMsgElementId_1, + 183, /* Elements count */ + &asn_SPC_FANSATCUplinkMsgElementId_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementId.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementId.h new file mode 100644 index 000000000..d5ee86076 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementId.h @@ -0,0 +1,460 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCUplinkMsgElementId_H_ +#define _FANSATCUplinkMsgElementId_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NULL.h" +#include "FANSAltitude.h" +#include "FANSTime.h" +#include "FANSPosition.h" +#include "FANSTimeAltitude.h" +#include "FANSPositionAltitude.h" +#include "FANSAltitudeTime.h" +#include "FANSAltitudePosition.h" +#include "FANSAltitudeAltitude.h" +#include "FANSPositionAltitudeAltitude.h" +#include "FANSPositionTime.h" +#include "FANSPositionTimeTime.h" +#include "FANSPositionSpeed.h" +#include "FANSPositionTimeAltitude.h" +#include "FANSPositionAltitudeSpeed.h" +#include "FANSTimePositionAltitude.h" +#include "FANSTimePositionAltitudeSpeed.h" +#include "FANSDistanceOffsetDirection.h" +#include "FANSPositionDistanceOffsetDirection.h" +#include "FANSTimeDistanceOffsetDirection.h" +#include "FANSPredepartureClearance.h" +#include "FANSTimePosition.h" +#include "FANSPositionPosition.h" +#include "FANSPositionRouteClearance.h" +#include "FANSRouteClearance.h" +#include "FANSProcedureName.h" +#include "FANSPositionProcedureName.h" +#include "FANSHoldClearance.h" +#include "FANSDirectionDegrees.h" +#include "FANSPositionDegrees.h" +#include "FANSTimeSpeed.h" +#include "FANSAltitudeSpeed.h" +#include "FANSTimeSpeedSpeed.h" +#include "FANSPositionSpeedSpeed.h" +#include "FANSAltitudeSpeedSpeed.h" +#include "FANSSpeed.h" +#include "FANSSpeedSpeed.h" +#include "FANSICAOUnitNameFrequency.h" +#include "FANSPositionICAOUnitNameFrequency.h" +#include "FANSTimeICAOunitnameFrequency.h" +#include "FANSBeaconCode.h" +#include "FANSAltimeter.h" +#include "FANSFrequency.h" +#include "FANSATISCode.h" +#include "FANSErrorInformation.h" +#include "FANSICAOfacilityDesignation.h" +#include "FANSICAOFacilityDesignationTp4Table.h" +#include "FANSFreeText.h" +#include "FANSVerticalRate.h" +#include "FANSToFromPosition.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSATCUplinkMsgElementId_PR { + FANSATCUplinkMsgElementId_PR_NOTHING, /* No components present */ + FANSATCUplinkMsgElementId_PR_uM0NULL, + FANSATCUplinkMsgElementId_PR_uM1NULL, + FANSATCUplinkMsgElementId_PR_uM2NULL, + FANSATCUplinkMsgElementId_PR_uM3NULL, + FANSATCUplinkMsgElementId_PR_uM4NULL, + FANSATCUplinkMsgElementId_PR_uM5NULL, + FANSATCUplinkMsgElementId_PR_uM6Altitude, + FANSATCUplinkMsgElementId_PR_uM7Time, + FANSATCUplinkMsgElementId_PR_uM8Position, + FANSATCUplinkMsgElementId_PR_uM9Time, + FANSATCUplinkMsgElementId_PR_uM10Position, + FANSATCUplinkMsgElementId_PR_uM11Time, + FANSATCUplinkMsgElementId_PR_uM12Position, + FANSATCUplinkMsgElementId_PR_uM13TimeAltitude, + FANSATCUplinkMsgElementId_PR_uM14PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM15TimeAltitude, + FANSATCUplinkMsgElementId_PR_uM16PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM17TimeAltitude, + FANSATCUplinkMsgElementId_PR_uM18PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM19Altitude, + FANSATCUplinkMsgElementId_PR_uM20Altitude, + FANSATCUplinkMsgElementId_PR_uM21TimeAltitude, + FANSATCUplinkMsgElementId_PR_uM22PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM23Altitude, + FANSATCUplinkMsgElementId_PR_uM24TimeAltitude, + FANSATCUplinkMsgElementId_PR_uM25PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM26AltitudeTime, + FANSATCUplinkMsgElementId_PR_uM27AltitudePosition, + FANSATCUplinkMsgElementId_PR_uM28AltitudeTime, + FANSATCUplinkMsgElementId_PR_uM29AltitudePosition, + FANSATCUplinkMsgElementId_PR_uM30AltitudeAltitude, + FANSATCUplinkMsgElementId_PR_uM31AltitudeAltitude, + FANSATCUplinkMsgElementId_PR_uM32AltitudeAltitude, + FANSATCUplinkMsgElementId_PR_uM33Altitude, + FANSATCUplinkMsgElementId_PR_uM34Altitude, + FANSATCUplinkMsgElementId_PR_uM35Altitude, + FANSATCUplinkMsgElementId_PR_uM36Altitude, + FANSATCUplinkMsgElementId_PR_uM37Altitude, + FANSATCUplinkMsgElementId_PR_uM38Altitude, + FANSATCUplinkMsgElementId_PR_uM39Altitude, + FANSATCUplinkMsgElementId_PR_uM40Altitude, + FANSATCUplinkMsgElementId_PR_uM41Altitude, + FANSATCUplinkMsgElementId_PR_uM42PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM43PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM44PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM45PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM46PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM47PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM48PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM49PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM50PositionAltitudeAltitude, + FANSATCUplinkMsgElementId_PR_uM51PositionTime, + FANSATCUplinkMsgElementId_PR_uM52PositionTime, + FANSATCUplinkMsgElementId_PR_uM53PositionTime, + FANSATCUplinkMsgElementId_PR_uM54PositionTimeTime, + FANSATCUplinkMsgElementId_PR_uM55PositionSpeed, + FANSATCUplinkMsgElementId_PR_uM56PositionSpeed, + FANSATCUplinkMsgElementId_PR_uM57PositionSpeed, + FANSATCUplinkMsgElementId_PR_uM58PositionTimeAltitude, + FANSATCUplinkMsgElementId_PR_uM59PositionTimeAltitude, + FANSATCUplinkMsgElementId_PR_uM60PositionTimeAltitude, + FANSATCUplinkMsgElementId_PR_uM61PositionAltitudeSpeed, + FANSATCUplinkMsgElementId_PR_uM62TimePositionAltitude, + FANSATCUplinkMsgElementId_PR_uM63TimePositionAltitudeSpeed, + FANSATCUplinkMsgElementId_PR_uM64DistanceOffsetDirection, + FANSATCUplinkMsgElementId_PR_uM65PositionDistanceOffsetDirection, + FANSATCUplinkMsgElementId_PR_uM66TimeDistanceOffsetDirection, + FANSATCUplinkMsgElementId_PR_uM67NULL, + FANSATCUplinkMsgElementId_PR_uM68Position, + FANSATCUplinkMsgElementId_PR_uM69Time, + FANSATCUplinkMsgElementId_PR_uM70Position, + FANSATCUplinkMsgElementId_PR_uM71Time, + FANSATCUplinkMsgElementId_PR_uM72NULL, + FANSATCUplinkMsgElementId_PR_uM73Predepartureclearance, + FANSATCUplinkMsgElementId_PR_uM74Position, + FANSATCUplinkMsgElementId_PR_uM75Position, + FANSATCUplinkMsgElementId_PR_uM76TimePosition, + FANSATCUplinkMsgElementId_PR_uM77PositionPosition, + FANSATCUplinkMsgElementId_PR_uM78AltitudePosition, + FANSATCUplinkMsgElementId_PR_uM79PositionRouteClearance, + FANSATCUplinkMsgElementId_PR_uM80RouteClearance, + FANSATCUplinkMsgElementId_PR_uM81ProcedureName, + FANSATCUplinkMsgElementId_PR_uM82DistanceOffsetDirection, + FANSATCUplinkMsgElementId_PR_uM83PositionRouteClearance, + FANSATCUplinkMsgElementId_PR_uM84PositionProcedureName, + FANSATCUplinkMsgElementId_PR_uM85RouteClearance, + FANSATCUplinkMsgElementId_PR_uM86PositionRouteClearance, + FANSATCUplinkMsgElementId_PR_uM87Position, + FANSATCUplinkMsgElementId_PR_uM88PositionPosition, + FANSATCUplinkMsgElementId_PR_uM89TimePosition, + FANSATCUplinkMsgElementId_PR_uM90AltitudePosition, + FANSATCUplinkMsgElementId_PR_uM91HoldClearance, + FANSATCUplinkMsgElementId_PR_uM92PositionAltitude, + FANSATCUplinkMsgElementId_PR_uM93Time, + FANSATCUplinkMsgElementId_PR_uM94DirectionDegrees, + FANSATCUplinkMsgElementId_PR_uM95DirectionDegrees, + FANSATCUplinkMsgElementId_PR_uM96NULL, + FANSATCUplinkMsgElementId_PR_uM97PositionDegrees, + FANSATCUplinkMsgElementId_PR_uM98DirectionDegrees, + FANSATCUplinkMsgElementId_PR_uM99ProcedureName, + FANSATCUplinkMsgElementId_PR_uM100TimeSpeed, + FANSATCUplinkMsgElementId_PR_uM101PositionSpeed, + FANSATCUplinkMsgElementId_PR_uM102AltitudeSpeed, + FANSATCUplinkMsgElementId_PR_uM103TimeSpeedSpeed, + FANSATCUplinkMsgElementId_PR_uM104PositionSpeedSpeed, + FANSATCUplinkMsgElementId_PR_uM105AltitudeSpeedSpeed, + FANSATCUplinkMsgElementId_PR_uM106Speed, + FANSATCUplinkMsgElementId_PR_uM107NULL, + FANSATCUplinkMsgElementId_PR_uM108Speed, + FANSATCUplinkMsgElementId_PR_uM109Speed, + FANSATCUplinkMsgElementId_PR_uM110SpeedSpeed, + FANSATCUplinkMsgElementId_PR_uM111Speed, + FANSATCUplinkMsgElementId_PR_uM112Speed, + FANSATCUplinkMsgElementId_PR_uM113Speed, + FANSATCUplinkMsgElementId_PR_uM114Speed, + FANSATCUplinkMsgElementId_PR_uM115Speed, + FANSATCUplinkMsgElementId_PR_uM116NULL, + FANSATCUplinkMsgElementId_PR_uM117ICAOunitnameFrequency, + FANSATCUplinkMsgElementId_PR_uM118PositionICAOunitnameFrequency, + FANSATCUplinkMsgElementId_PR_uM119TimeICAOunitnameFrequency, + FANSATCUplinkMsgElementId_PR_uM120ICAOunitnameFrequency, + FANSATCUplinkMsgElementId_PR_uM121PositionICAOunitnameFrequency, + FANSATCUplinkMsgElementId_PR_uM122TimeICAOunitnameFrequency, + FANSATCUplinkMsgElementId_PR_uM123BeaconCode, + FANSATCUplinkMsgElementId_PR_uM124NULL, + FANSATCUplinkMsgElementId_PR_uM125NULL, + FANSATCUplinkMsgElementId_PR_uM126NULL, + FANSATCUplinkMsgElementId_PR_uM127NULL, + FANSATCUplinkMsgElementId_PR_uM128Altitude, + FANSATCUplinkMsgElementId_PR_uM129Altitude, + FANSATCUplinkMsgElementId_PR_uM130Position, + FANSATCUplinkMsgElementId_PR_uM131NULL, + FANSATCUplinkMsgElementId_PR_uM132NULL, + FANSATCUplinkMsgElementId_PR_uM133NULL, + FANSATCUplinkMsgElementId_PR_uM134NULL, + FANSATCUplinkMsgElementId_PR_uM135NULL, + FANSATCUplinkMsgElementId_PR_uM136NULL, + FANSATCUplinkMsgElementId_PR_uM137NULL, + FANSATCUplinkMsgElementId_PR_uM138NULL, + FANSATCUplinkMsgElementId_PR_uM139NULL, + FANSATCUplinkMsgElementId_PR_uM140NULL, + FANSATCUplinkMsgElementId_PR_uM141NULL, + FANSATCUplinkMsgElementId_PR_uM142NULL, + FANSATCUplinkMsgElementId_PR_uM143NULL, + FANSATCUplinkMsgElementId_PR_uM144NULL, + FANSATCUplinkMsgElementId_PR_uM145NULL, + FANSATCUplinkMsgElementId_PR_uM146NULL, + FANSATCUplinkMsgElementId_PR_uM147NULL, + FANSATCUplinkMsgElementId_PR_uM148Altitude, + FANSATCUplinkMsgElementId_PR_uM149AltitudePosition, + FANSATCUplinkMsgElementId_PR_uM150AltitudeTime, + FANSATCUplinkMsgElementId_PR_uM151Speed, + FANSATCUplinkMsgElementId_PR_uM152DistanceOffsetDirection, + FANSATCUplinkMsgElementId_PR_uM153Altimeter, + FANSATCUplinkMsgElementId_PR_uM154NULL, + FANSATCUplinkMsgElementId_PR_uM155Position, + FANSATCUplinkMsgElementId_PR_uM156NULL, + FANSATCUplinkMsgElementId_PR_uM157Frequency, + FANSATCUplinkMsgElementId_PR_uM158ATISCode, + FANSATCUplinkMsgElementId_PR_uM159ErrorInformation, + FANSATCUplinkMsgElementId_PR_uM160ICAOfacilitydesignation, + FANSATCUplinkMsgElementId_PR_uM161NULL, + FANSATCUplinkMsgElementId_PR_uM162NULL, + FANSATCUplinkMsgElementId_PR_uM163ICAOfacilitydesignationTp4table, + FANSATCUplinkMsgElementId_PR_uM164NULL, + FANSATCUplinkMsgElementId_PR_uM165NULL, + FANSATCUplinkMsgElementId_PR_uM166NULL, + FANSATCUplinkMsgElementId_PR_uM167NULL, + FANSATCUplinkMsgElementId_PR_uM168NULL, + FANSATCUplinkMsgElementId_PR_uM169FreeText, + FANSATCUplinkMsgElementId_PR_uM170FreeText, + FANSATCUplinkMsgElementId_PR_uM171VerticalRate, + FANSATCUplinkMsgElementId_PR_uM172VerticalRate, + FANSATCUplinkMsgElementId_PR_uM173VerticalRate, + FANSATCUplinkMsgElementId_PR_uM174VerticalRate, + FANSATCUplinkMsgElementId_PR_uM175Altitude, + FANSATCUplinkMsgElementId_PR_uM176NULL, + FANSATCUplinkMsgElementId_PR_uM177NULL, + FANSATCUplinkMsgElementId_PR_uM178NULL, + FANSATCUplinkMsgElementId_PR_uM179NULL, + FANSATCUplinkMsgElementId_PR_uM180AltitudeAltitude, + FANSATCUplinkMsgElementId_PR_uM181ToFromPosition, + FANSATCUplinkMsgElementId_PR_uM182NULL +} FANSATCUplinkMsgElementId_PR; + +/* FANSATCUplinkMsgElementId */ +typedef struct FANSATCUplinkMsgElementId { + FANSATCUplinkMsgElementId_PR present; + union FANSATCUplinkMsgElementId_u { + NULL_t uM0NULL; + NULL_t uM1NULL; + NULL_t uM2NULL; + NULL_t uM3NULL; + NULL_t uM4NULL; + NULL_t uM5NULL; + FANSAltitude_t uM6Altitude; + FANSTime_t uM7Time; + FANSPosition_t uM8Position; + FANSTime_t uM9Time; + FANSPosition_t uM10Position; + FANSTime_t uM11Time; + FANSPosition_t uM12Position; + FANSTimeAltitude_t uM13TimeAltitude; + FANSPositionAltitude_t uM14PositionAltitude; + FANSTimeAltitude_t uM15TimeAltitude; + FANSPositionAltitude_t uM16PositionAltitude; + FANSTimeAltitude_t uM17TimeAltitude; + FANSPositionAltitude_t uM18PositionAltitude; + FANSAltitude_t uM19Altitude; + FANSAltitude_t uM20Altitude; + FANSTimeAltitude_t uM21TimeAltitude; + FANSPositionAltitude_t uM22PositionAltitude; + FANSAltitude_t uM23Altitude; + FANSTimeAltitude_t uM24TimeAltitude; + FANSPositionAltitude_t uM25PositionAltitude; + FANSAltitudeTime_t uM26AltitudeTime; + FANSAltitudePosition_t uM27AltitudePosition; + FANSAltitudeTime_t uM28AltitudeTime; + FANSAltitudePosition_t uM29AltitudePosition; + FANSAltitudeAltitude_t uM30AltitudeAltitude; + FANSAltitudeAltitude_t uM31AltitudeAltitude; + FANSAltitudeAltitude_t uM32AltitudeAltitude; + FANSAltitude_t uM33Altitude; + FANSAltitude_t uM34Altitude; + FANSAltitude_t uM35Altitude; + FANSAltitude_t uM36Altitude; + FANSAltitude_t uM37Altitude; + FANSAltitude_t uM38Altitude; + FANSAltitude_t uM39Altitude; + FANSAltitude_t uM40Altitude; + FANSAltitude_t uM41Altitude; + FANSPositionAltitude_t uM42PositionAltitude; + FANSPositionAltitude_t uM43PositionAltitude; + FANSPositionAltitude_t uM44PositionAltitude; + FANSPositionAltitude_t uM45PositionAltitude; + FANSPositionAltitude_t uM46PositionAltitude; + FANSPositionAltitude_t uM47PositionAltitude; + FANSPositionAltitude_t uM48PositionAltitude; + FANSPositionAltitude_t uM49PositionAltitude; + FANSPositionAltitudeAltitude_t uM50PositionAltitudeAltitude; + FANSPositionTime_t uM51PositionTime; + FANSPositionTime_t uM52PositionTime; + FANSPositionTime_t uM53PositionTime; + FANSPositionTimeTime_t uM54PositionTimeTime; + FANSPositionSpeed_t uM55PositionSpeed; + FANSPositionSpeed_t uM56PositionSpeed; + FANSPositionSpeed_t uM57PositionSpeed; + FANSPositionTimeAltitude_t uM58PositionTimeAltitude; + FANSPositionTimeAltitude_t uM59PositionTimeAltitude; + FANSPositionTimeAltitude_t uM60PositionTimeAltitude; + FANSPositionAltitudeSpeed_t uM61PositionAltitudeSpeed; + FANSTimePositionAltitude_t uM62TimePositionAltitude; + FANSTimePositionAltitudeSpeed_t uM63TimePositionAltitudeSpeed; + FANSDistanceOffsetDirection_t uM64DistanceOffsetDirection; + FANSPositionDistanceOffsetDirection_t uM65PositionDistanceOffsetDirection; + FANSTimeDistanceOffsetDirection_t uM66TimeDistanceOffsetDirection; + NULL_t uM67NULL; + FANSPosition_t uM68Position; + FANSTime_t uM69Time; + FANSPosition_t uM70Position; + FANSTime_t uM71Time; + NULL_t uM72NULL; + FANSPredepartureClearance_t uM73Predepartureclearance; + FANSPosition_t uM74Position; + FANSPosition_t uM75Position; + FANSTimePosition_t uM76TimePosition; + FANSPositionPosition_t uM77PositionPosition; + FANSAltitudePosition_t uM78AltitudePosition; + FANSPositionRouteClearance_t uM79PositionRouteClearance; + FANSRouteClearance_t uM80RouteClearance; + FANSProcedureName_t uM81ProcedureName; + FANSDistanceOffsetDirection_t uM82DistanceOffsetDirection; + FANSPositionRouteClearance_t uM83PositionRouteClearance; + FANSPositionProcedureName_t uM84PositionProcedureName; + FANSRouteClearance_t uM85RouteClearance; + FANSPositionRouteClearance_t uM86PositionRouteClearance; + FANSPosition_t uM87Position; + FANSPositionPosition_t uM88PositionPosition; + FANSTimePosition_t uM89TimePosition; + FANSAltitudePosition_t uM90AltitudePosition; + FANSHoldClearance_t uM91HoldClearance; + FANSPositionAltitude_t uM92PositionAltitude; + FANSTime_t uM93Time; + FANSDirectionDegrees_t uM94DirectionDegrees; + FANSDirectionDegrees_t uM95DirectionDegrees; + NULL_t uM96NULL; + FANSPositionDegrees_t uM97PositionDegrees; + FANSDirectionDegrees_t uM98DirectionDegrees; + FANSProcedureName_t uM99ProcedureName; + FANSTimeSpeed_t uM100TimeSpeed; + FANSPositionSpeed_t uM101PositionSpeed; + FANSAltitudeSpeed_t uM102AltitudeSpeed; + FANSTimeSpeedSpeed_t uM103TimeSpeedSpeed; + FANSPositionSpeedSpeed_t uM104PositionSpeedSpeed; + FANSAltitudeSpeedSpeed_t uM105AltitudeSpeedSpeed; + FANSSpeed_t uM106Speed; + NULL_t uM107NULL; + FANSSpeed_t uM108Speed; + FANSSpeed_t uM109Speed; + FANSSpeedSpeed_t uM110SpeedSpeed; + FANSSpeed_t uM111Speed; + FANSSpeed_t uM112Speed; + FANSSpeed_t uM113Speed; + FANSSpeed_t uM114Speed; + FANSSpeed_t uM115Speed; + NULL_t uM116NULL; + FANSICAOUnitNameFrequency_t uM117ICAOunitnameFrequency; + FANSPositionICAOUnitNameFrequency_t uM118PositionICAOunitnameFrequency; + FANSTimeICAOunitnameFrequency_t uM119TimeICAOunitnameFrequency; + FANSICAOUnitNameFrequency_t uM120ICAOunitnameFrequency; + FANSPositionICAOUnitNameFrequency_t uM121PositionICAOunitnameFrequency; + FANSTimeICAOunitnameFrequency_t uM122TimeICAOunitnameFrequency; + FANSBeaconCode_t uM123BeaconCode; + NULL_t uM124NULL; + NULL_t uM125NULL; + NULL_t uM126NULL; + NULL_t uM127NULL; + FANSAltitude_t uM128Altitude; + FANSAltitude_t uM129Altitude; + FANSPosition_t uM130Position; + NULL_t uM131NULL; + NULL_t uM132NULL; + NULL_t uM133NULL; + NULL_t uM134NULL; + NULL_t uM135NULL; + NULL_t uM136NULL; + NULL_t uM137NULL; + NULL_t uM138NULL; + NULL_t uM139NULL; + NULL_t uM140NULL; + NULL_t uM141NULL; + NULL_t uM142NULL; + NULL_t uM143NULL; + NULL_t uM144NULL; + NULL_t uM145NULL; + NULL_t uM146NULL; + NULL_t uM147NULL; + FANSAltitude_t uM148Altitude; + FANSAltitudePosition_t uM149AltitudePosition; + FANSAltitudeTime_t uM150AltitudeTime; + FANSSpeed_t uM151Speed; + FANSDistanceOffsetDirection_t uM152DistanceOffsetDirection; + FANSAltimeter_t uM153Altimeter; + NULL_t uM154NULL; + FANSPosition_t uM155Position; + NULL_t uM156NULL; + FANSFrequency_t uM157Frequency; + FANSATISCode_t uM158ATISCode; + FANSErrorInformation_t uM159ErrorInformation; + FANSICAOfacilityDesignation_t uM160ICAOfacilitydesignation; + NULL_t uM161NULL; + NULL_t uM162NULL; + FANSICAOFacilityDesignationTp4Table_t uM163ICAOfacilitydesignationTp4table; + NULL_t uM164NULL; + NULL_t uM165NULL; + NULL_t uM166NULL; + NULL_t uM167NULL; + NULL_t uM168NULL; + FANSFreeText_t uM169FreeText; + FANSFreeText_t uM170FreeText; + FANSVerticalRate_t uM171VerticalRate; + FANSVerticalRate_t uM172VerticalRate; + FANSVerticalRate_t uM173VerticalRate; + FANSVerticalRate_t uM174VerticalRate; + FANSAltitude_t uM175Altitude; + NULL_t uM176NULL; + NULL_t uM177NULL; + NULL_t uM178NULL; + NULL_t uM179NULL; + FANSAltitudeAltitude_t uM180AltitudeAltitude; + FANSToFromPosition_t uM181ToFromPosition; + NULL_t uM182NULL; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCUplinkMsgElementId_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCUplinkMsgElementId; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATCUplinkMsgElementId_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementIdSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementIdSequence.c new file mode 100644 index 000000000..d950cce6e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementIdSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATCUplinkMsgElementIdSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSATCUplinkMsgElementIdSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSATCUplinkMsgElementIdSequence_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSATCUplinkMsgElementId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSATCUplinkMsgElementIdSequence_specs_1 = { + sizeof(struct FANSATCUplinkMsgElementIdSequence), + offsetof(struct FANSATCUplinkMsgElementIdSequence, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATCUplinkMsgElementIdSequence = { + "FANSATCUplinkMsgElementIdSequence", + "FANSATCUplinkMsgElementIdSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1, + sizeof(asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1) + /sizeof(asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1) + /sizeof(asn_DEF_FANSATCUplinkMsgElementIdSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATCUplinkMsgElementIdSequence_constr_1, + asn_MBR_FANSATCUplinkMsgElementIdSequence_1, + 1, /* Single element */ + &asn_SPC_FANSATCUplinkMsgElementIdSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementIdSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementIdSequence.h new file mode 100644 index 000000000..1ccb22181 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATCUplinkMsgElementIdSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATCUplinkMsgElementIdSequence_H_ +#define _FANSATCUplinkMsgElementIdSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATCUplinkMsgElementId; + +/* FANSATCUplinkMsgElementIdSequence */ +typedef struct FANSATCUplinkMsgElementIdSequence { + A_SEQUENCE_OF(struct FANSATCUplinkMsgElementId) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATCUplinkMsgElementIdSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATCUplinkMsgElementIdSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATCUplinkMsgElementId.h" + +#endif /* _FANSATCUplinkMsgElementIdSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATISCode.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATISCode.c new file mode 100644 index 000000000..159889102 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATISCode.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATISCode.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSATISCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 1) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSATISCode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSATISCode_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSATISCode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSATISCode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSATISCode_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSATISCode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSATISCode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSATISCode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSATISCode_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSATISCode_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSATISCode_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSATISCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSATISCode = { + "FANSATISCode", + "FANSATISCode", + FANSATISCode_free, + FANSATISCode_print, + FANSATISCode_constraint, + FANSATISCode_decode_ber, + FANSATISCode_encode_der, + FANSATISCode_decode_xer, + FANSATISCode_encode_xer, + FANSATISCode_decode_uper, + FANSATISCode_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATISCode_tags_1, + sizeof(asn_DEF_FANSATISCode_tags_1) + /sizeof(asn_DEF_FANSATISCode_tags_1[0]), /* 1 */ + asn_DEF_FANSATISCode_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATISCode_tags_1) + /sizeof(asn_DEF_FANSATISCode_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATISCode_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATISCode.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATISCode.h new file mode 100644 index 000000000..977bfb71f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATISCode.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATISCode_H_ +#define _FANSATISCode_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSATISCode */ +typedef IA5String_t FANSATISCode_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATISCode; +asn_struct_free_f FANSATISCode_free; +asn_struct_print_f FANSATISCode_print; +asn_constr_check_f FANSATISCode_constraint; +ber_type_decoder_f FANSATISCode_decode_ber; +der_type_encoder_f FANSATISCode_encode_der; +xer_type_decoder_f FANSATISCode_decode_xer; +xer_type_encoder_f FANSATISCode_encode_xer; +per_type_decoder_f FANSATISCode_decode_uper; +per_type_encoder_f FANSATISCode_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATISCode_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypoint.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypoint.c new file mode 100644 index 000000000..670486f12 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypoint.c @@ -0,0 +1,92 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWAlongTrackWaypoint.h" + +static asn_TYPE_member_t asn_MBR_FANSATWAlongTrackWaypoint_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATWAlongTrackWaypoint, position), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATWAlongTrackWaypoint, aTWdistance), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATWDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTWdistance" + }, + { ATF_POINTER, 2, offsetof(struct FANSATWAlongTrackWaypoint, speed), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, + { ATF_POINTER, 1, offsetof(struct FANSATWAlongTrackWaypoint, aTWaltitudesequence), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATWAltitudeSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTWaltitudesequence" + }, +}; +static const int asn_MAP_FANSATWAlongTrackWaypoint_oms_1[] = { 2, 3 }; +static const ber_tlv_tag_t asn_DEF_FANSATWAlongTrackWaypoint_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATWAlongTrackWaypoint_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* position */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* aTWdistance */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* speed */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* aTWaltitudesequence */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSATWAlongTrackWaypoint_specs_1 = { + sizeof(struct FANSATWAlongTrackWaypoint), + offsetof(struct FANSATWAlongTrackWaypoint, _asn_ctx), + asn_MAP_FANSATWAlongTrackWaypoint_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_FANSATWAlongTrackWaypoint_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWAlongTrackWaypoint = { + "FANSATWAlongTrackWaypoint", + "FANSATWAlongTrackWaypoint", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWAlongTrackWaypoint_tags_1, + sizeof(asn_DEF_FANSATWAlongTrackWaypoint_tags_1) + /sizeof(asn_DEF_FANSATWAlongTrackWaypoint_tags_1[0]), /* 1 */ + asn_DEF_FANSATWAlongTrackWaypoint_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWAlongTrackWaypoint_tags_1) + /sizeof(asn_DEF_FANSATWAlongTrackWaypoint_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSATWAlongTrackWaypoint_1, + 4, /* Elements count */ + &asn_SPC_FANSATWAlongTrackWaypoint_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypoint.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypoint.h new file mode 100644 index 000000000..3c7857ecb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypoint.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWAlongTrackWaypoint_H_ +#define _FANSATWAlongTrackWaypoint_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSATWDistance.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSSpeed; +struct FANSATWAltitudeSequence; + +/* FANSATWAlongTrackWaypoint */ +typedef struct FANSATWAlongTrackWaypoint { + FANSPosition_t position; + FANSATWDistance_t aTWdistance; + struct FANSSpeed *speed /* OPTIONAL */; + struct FANSATWAltitudeSequence *aTWaltitudesequence /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATWAlongTrackWaypoint_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWAlongTrackWaypoint; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSSpeed.h" +#include "FANSATWAltitudeSequence.h" + +#endif /* _FANSATWAlongTrackWaypoint_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypointSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypointSequence.c new file mode 100644 index 000000000..ca7c0591e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypointSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWAlongTrackWaypointSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSATWAlongTrackWaypointSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSATWAlongTrackWaypointSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSATWAlongTrackWaypoint, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSATWAlongTrackWaypointSequence_specs_1 = { + sizeof(struct FANSATWAlongTrackWaypointSequence), + offsetof(struct FANSATWAlongTrackWaypointSequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWAlongTrackWaypointSequence = { + "FANSATWAlongTrackWaypointSequence", + "FANSATWAlongTrackWaypointSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1, + sizeof(asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1) + /sizeof(asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1) + /sizeof(asn_DEF_FANSATWAlongTrackWaypointSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATWAlongTrackWaypointSequence_constr_1, + asn_MBR_FANSATWAlongTrackWaypointSequence_1, + 1, /* Single element */ + &asn_SPC_FANSATWAlongTrackWaypointSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypointSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypointSequence.h new file mode 100644 index 000000000..ee3f20b77 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAlongTrackWaypointSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWAlongTrackWaypointSequence_H_ +#define _FANSATWAlongTrackWaypointSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATWAlongTrackWaypoint; + +/* FANSATWAlongTrackWaypointSequence */ +typedef struct FANSATWAlongTrackWaypointSequence { + A_SEQUENCE_OF(struct FANSATWAlongTrackWaypoint) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATWAlongTrackWaypointSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWAlongTrackWaypointSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATWAlongTrackWaypoint.h" + +#endif /* _FANSATWAlongTrackWaypointSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitude.c new file mode 100644 index 000000000..dd38e797a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitude.c @@ -0,0 +1,77 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSATWAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATWAltitude, aTWAltitudeTolerance), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSATWAltitudeTolerance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTWAltitudeTolerance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATWAltitude, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSATWAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATWAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* aTWAltitudeTolerance */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSATWAltitude_specs_1 = { + sizeof(struct FANSATWAltitude), + offsetof(struct FANSATWAltitude, _asn_ctx), + asn_MAP_FANSATWAltitude_tag2el_1, + 9, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWAltitude = { + "FANSATWAltitude", + "FANSATWAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWAltitude_tags_1, + sizeof(asn_DEF_FANSATWAltitude_tags_1) + /sizeof(asn_DEF_FANSATWAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSATWAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWAltitude_tags_1) + /sizeof(asn_DEF_FANSATWAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSATWAltitude_1, + 2, /* Elements count */ + &asn_SPC_FANSATWAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitude.h new file mode 100644 index 000000000..719a00fcd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitude.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWAltitude_H_ +#define _FANSATWAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSATWAltitudeTolerance.h" +#include "FANSAltitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSATWAltitude */ +typedef struct FANSATWAltitude { + FANSATWAltitudeTolerance_t aTWAltitudeTolerance; + FANSAltitude_t altitude; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATWAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATWAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeSequence.c new file mode 100644 index 000000000..ad39efe9a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWAltitudeSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSATWAltitudeSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSATWAltitudeSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSATWAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSATWAltitudeSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSATWAltitudeSequence_specs_1 = { + sizeof(struct FANSATWAltitudeSequence), + offsetof(struct FANSATWAltitudeSequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWAltitudeSequence = { + "FANSATWAltitudeSequence", + "FANSATWAltitudeSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWAltitudeSequence_tags_1, + sizeof(asn_DEF_FANSATWAltitudeSequence_tags_1) + /sizeof(asn_DEF_FANSATWAltitudeSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSATWAltitudeSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWAltitudeSequence_tags_1) + /sizeof(asn_DEF_FANSATWAltitudeSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATWAltitudeSequence_constr_1, + asn_MBR_FANSATWAltitudeSequence_1, + 1, /* Single element */ + &asn_SPC_FANSATWAltitudeSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeSequence.h new file mode 100644 index 000000000..5954ed49e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWAltitudeSequence_H_ +#define _FANSATWAltitudeSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATWAltitude; + +/* FANSATWAltitudeSequence */ +typedef struct FANSATWAltitudeSequence { + A_SEQUENCE_OF(struct FANSATWAltitude) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATWAltitudeSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWAltitudeSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATWAltitude.h" + +#endif /* _FANSATWAltitudeSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeTolerance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeTolerance.c new file mode 100644 index 000000000..446f1e238 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeTolerance.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWAltitudeTolerance.h" + +int +FANSATWAltitudeTolerance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSATWAltitudeTolerance_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSATWAltitudeTolerance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSATWAltitudeTolerance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSATWAltitudeTolerance_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSATWAltitudeTolerance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSATWAltitudeTolerance_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSATWAltitudeTolerance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSATWAltitudeTolerance_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSATWAltitudeTolerance_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSATWAltitudeTolerance_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSATWAltitudeTolerance_value2enum_1[] = { + { 0, 2, "at" }, + { 1, 9, "atorabove" }, + { 2, 9, "atorbelow" } +}; +static const unsigned int asn_MAP_FANSATWAltitudeTolerance_enum2value_1[] = { + 0, /* at(0) */ + 1, /* atorabove(1) */ + 2 /* atorbelow(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSATWAltitudeTolerance_specs_1 = { + asn_MAP_FANSATWAltitudeTolerance_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSATWAltitudeTolerance_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSATWAltitudeTolerance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWAltitudeTolerance = { + "FANSATWAltitudeTolerance", + "FANSATWAltitudeTolerance", + FANSATWAltitudeTolerance_free, + FANSATWAltitudeTolerance_print, + FANSATWAltitudeTolerance_constraint, + FANSATWAltitudeTolerance_decode_ber, + FANSATWAltitudeTolerance_encode_der, + FANSATWAltitudeTolerance_decode_xer, + FANSATWAltitudeTolerance_encode_xer, + FANSATWAltitudeTolerance_decode_uper, + FANSATWAltitudeTolerance_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWAltitudeTolerance_tags_1, + sizeof(asn_DEF_FANSATWAltitudeTolerance_tags_1) + /sizeof(asn_DEF_FANSATWAltitudeTolerance_tags_1[0]), /* 1 */ + asn_DEF_FANSATWAltitudeTolerance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWAltitudeTolerance_tags_1) + /sizeof(asn_DEF_FANSATWAltitudeTolerance_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATWAltitudeTolerance_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSATWAltitudeTolerance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeTolerance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeTolerance.h new file mode 100644 index 000000000..34e950b11 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWAltitudeTolerance.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWAltitudeTolerance_H_ +#define _FANSATWAltitudeTolerance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSATWAltitudeTolerance { + FANSATWAltitudeTolerance_at = 0, + FANSATWAltitudeTolerance_atorabove = 1, + FANSATWAltitudeTolerance_atorbelow = 2 +} e_FANSATWAltitudeTolerance; + +/* FANSATWAltitudeTolerance */ +typedef long FANSATWAltitudeTolerance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWAltitudeTolerance; +asn_struct_free_f FANSATWAltitudeTolerance_free; +asn_struct_print_f FANSATWAltitudeTolerance_print; +asn_constr_check_f FANSATWAltitudeTolerance_constraint; +ber_type_decoder_f FANSATWAltitudeTolerance_decode_ber; +der_type_encoder_f FANSATWAltitudeTolerance_encode_der; +xer_type_decoder_f FANSATWAltitudeTolerance_decode_xer; +xer_type_encoder_f FANSATWAltitudeTolerance_encode_xer; +per_type_decoder_f FANSATWAltitudeTolerance_decode_uper; +per_type_encoder_f FANSATWAltitudeTolerance_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATWAltitudeTolerance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistance.c new file mode 100644 index 000000000..c98d1cf95 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistance.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWDistance.h" + +static asn_TYPE_member_t asn_MBR_FANSATWDistance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSATWDistance, atwDistanceTolerance), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSATWDistanceTolerance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "atwDistanceTolerance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSATWDistance, distance), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distance" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSATWDistance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSATWDistance_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* atwDistanceTolerance */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* distanceNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* distanceKm */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSATWDistance_specs_1 = { + sizeof(struct FANSATWDistance), + offsetof(struct FANSATWDistance, _asn_ctx), + asn_MAP_FANSATWDistance_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWDistance = { + "FANSATWDistance", + "FANSATWDistance", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWDistance_tags_1, + sizeof(asn_DEF_FANSATWDistance_tags_1) + /sizeof(asn_DEF_FANSATWDistance_tags_1[0]), /* 1 */ + asn_DEF_FANSATWDistance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWDistance_tags_1) + /sizeof(asn_DEF_FANSATWDistance_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSATWDistance_1, + 2, /* Elements count */ + &asn_SPC_FANSATWDistance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistance.h new file mode 100644 index 000000000..34b93053a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistance.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWDistance_H_ +#define _FANSATWDistance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSATWDistanceTolerance.h" +#include "FANSDistance.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSATWDistance */ +typedef struct FANSATWDistance { + FANSATWDistanceTolerance_t atwDistanceTolerance; + FANSDistance_t distance; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSATWDistance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWDistance; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATWDistance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistanceTolerance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistanceTolerance.c new file mode 100644 index 000000000..5640c5e38 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistanceTolerance.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSATWDistanceTolerance.h" + +int +FANSATWDistanceTolerance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSATWDistanceTolerance_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSATWDistanceTolerance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSATWDistanceTolerance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSATWDistanceTolerance_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSATWDistanceTolerance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSATWDistanceTolerance_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSATWDistanceTolerance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSATWDistanceTolerance_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSATWDistanceTolerance_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSATWDistanceTolerance_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSATWDistanceTolerance_value2enum_1[] = { + { 0, 4, "plus" }, + { 1, 5, "minus" } +}; +static const unsigned int asn_MAP_FANSATWDistanceTolerance_enum2value_1[] = { + 1, /* minus(1) */ + 0 /* plus(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSATWDistanceTolerance_specs_1 = { + asn_MAP_FANSATWDistanceTolerance_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSATWDistanceTolerance_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSATWDistanceTolerance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSATWDistanceTolerance = { + "FANSATWDistanceTolerance", + "FANSATWDistanceTolerance", + FANSATWDistanceTolerance_free, + FANSATWDistanceTolerance_print, + FANSATWDistanceTolerance_constraint, + FANSATWDistanceTolerance_decode_ber, + FANSATWDistanceTolerance_encode_der, + FANSATWDistanceTolerance_decode_xer, + FANSATWDistanceTolerance_encode_xer, + FANSATWDistanceTolerance_decode_uper, + FANSATWDistanceTolerance_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSATWDistanceTolerance_tags_1, + sizeof(asn_DEF_FANSATWDistanceTolerance_tags_1) + /sizeof(asn_DEF_FANSATWDistanceTolerance_tags_1[0]), /* 1 */ + asn_DEF_FANSATWDistanceTolerance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSATWDistanceTolerance_tags_1) + /sizeof(asn_DEF_FANSATWDistanceTolerance_tags_1[0]), /* 1 */ + &asn_PER_type_FANSATWDistanceTolerance_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSATWDistanceTolerance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistanceTolerance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistanceTolerance.h new file mode 100644 index 000000000..2b472bde7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSATWDistanceTolerance.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSATWDistanceTolerance_H_ +#define _FANSATWDistanceTolerance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSATWDistanceTolerance { + FANSATWDistanceTolerance_plus = 0, + FANSATWDistanceTolerance_minus = 1 +} e_FANSATWDistanceTolerance; + +/* FANSATWDistanceTolerance */ +typedef long FANSATWDistanceTolerance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSATWDistanceTolerance; +asn_struct_free_f FANSATWDistanceTolerance_free; +asn_struct_print_f FANSATWDistanceTolerance_print; +asn_constr_check_f FANSATWDistanceTolerance_constraint; +ber_type_decoder_f FANSATWDistanceTolerance_decode_ber; +der_type_encoder_f FANSATWDistanceTolerance_encode_der; +xer_type_decoder_f FANSATWDistanceTolerance_decode_xer; +xer_type_encoder_f FANSATWDistanceTolerance_encode_xer; +per_type_decoder_f FANSATWDistanceTolerance_decode_uper; +per_type_encoder_f FANSATWDistanceTolerance_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSATWDistanceTolerance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftEquipmentCode.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftEquipmentCode.c new file mode 100644 index 000000000..0b71d03c2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftEquipmentCode.c @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAircraftEquipmentCode.h" + +static asn_TYPE_member_t asn_MBR_FANSAircraftEquipmentCode_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAircraftEquipmentCode, cOMNAVApproachEquipmentAvailable), + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), + 0, + &asn_DEF_FANSCOMNAVApproachEquipmentAvailable, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cOMNAVApproachEquipmentAvailable" + }, + { ATF_POINTER, 1, offsetof(struct FANSAircraftEquipmentCode, comnavequipmentstatus_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSCOMNAVEquipmentStatusSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "comnavequipmentstatus-seqOf" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAircraftEquipmentCode, sSREquipmentAvailable), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSSSREquipmentAvailable, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sSREquipmentAvailable" + }, +}; +static const int asn_MAP_FANSAircraftEquipmentCode_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSAircraftEquipmentCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAircraftEquipmentCode_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 0, 0, 0 }, /* cOMNAVApproachEquipmentAvailable */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 }, /* sSREquipmentAvailable */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 } /* comnavequipmentstatus-seqOf */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSAircraftEquipmentCode_specs_1 = { + sizeof(struct FANSAircraftEquipmentCode), + offsetof(struct FANSAircraftEquipmentCode, _asn_ctx), + asn_MAP_FANSAircraftEquipmentCode_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSAircraftEquipmentCode_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAircraftEquipmentCode = { + "FANSAircraftEquipmentCode", + "FANSAircraftEquipmentCode", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAircraftEquipmentCode_tags_1, + sizeof(asn_DEF_FANSAircraftEquipmentCode_tags_1) + /sizeof(asn_DEF_FANSAircraftEquipmentCode_tags_1[0]), /* 1 */ + asn_DEF_FANSAircraftEquipmentCode_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAircraftEquipmentCode_tags_1) + /sizeof(asn_DEF_FANSAircraftEquipmentCode_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSAircraftEquipmentCode_1, + 3, /* Elements count */ + &asn_SPC_FANSAircraftEquipmentCode_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftEquipmentCode.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftEquipmentCode.h new file mode 100644 index 000000000..aba30e506 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftEquipmentCode.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAircraftEquipmentCode_H_ +#define _FANSAircraftEquipmentCode_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSCOMNAVApproachEquipmentAvailable.h" +#include "FANSSSREquipmentAvailable.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSCOMNAVEquipmentStatusSequence; + +/* FANSAircraftEquipmentCode */ +typedef struct FANSAircraftEquipmentCode { + FANSCOMNAVApproachEquipmentAvailable_t cOMNAVApproachEquipmentAvailable; + struct FANSCOMNAVEquipmentStatusSequence *comnavequipmentstatus_seqOf /* OPTIONAL */; + FANSSSREquipmentAvailable_t sSREquipmentAvailable; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAircraftEquipmentCode_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAircraftEquipmentCode; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSCOMNAVEquipmentStatusSequence.h" + +#endif /* _FANSAircraftEquipmentCode_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftFlightIdentification.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftFlightIdentification.c new file mode 100644 index 000000000..5683179f8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftFlightIdentification.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAircraftFlightIdentification.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAircraftFlightIdentification_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 2 && size <= 7) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSAircraftFlightIdentification_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAircraftFlightIdentification_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAircraftFlightIdentification_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAircraftFlightIdentification_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAircraftFlightIdentification_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAircraftFlightIdentification_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAircraftFlightIdentification_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAircraftFlightIdentification_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAircraftFlightIdentification_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAircraftFlightIdentification_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 3, 3, 2, 7 } /* (SIZE(2..7)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAircraftFlightIdentification_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAircraftFlightIdentification = { + "FANSAircraftFlightIdentification", + "FANSAircraftFlightIdentification", + FANSAircraftFlightIdentification_free, + FANSAircraftFlightIdentification_print, + FANSAircraftFlightIdentification_constraint, + FANSAircraftFlightIdentification_decode_ber, + FANSAircraftFlightIdentification_encode_der, + FANSAircraftFlightIdentification_decode_xer, + FANSAircraftFlightIdentification_encode_xer, + FANSAircraftFlightIdentification_decode_uper, + FANSAircraftFlightIdentification_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAircraftFlightIdentification_tags_1, + sizeof(asn_DEF_FANSAircraftFlightIdentification_tags_1) + /sizeof(asn_DEF_FANSAircraftFlightIdentification_tags_1[0]), /* 1 */ + asn_DEF_FANSAircraftFlightIdentification_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAircraftFlightIdentification_tags_1) + /sizeof(asn_DEF_FANSAircraftFlightIdentification_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAircraftFlightIdentification_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftFlightIdentification.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftFlightIdentification.h new file mode 100644 index 000000000..0a6114ed9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftFlightIdentification.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAircraftFlightIdentification_H_ +#define _FANSAircraftFlightIdentification_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAircraftFlightIdentification */ +typedef IA5String_t FANSAircraftFlightIdentification_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAircraftFlightIdentification; +asn_struct_free_f FANSAircraftFlightIdentification_free; +asn_struct_print_f FANSAircraftFlightIdentification_print; +asn_constr_check_f FANSAircraftFlightIdentification_constraint; +ber_type_decoder_f FANSAircraftFlightIdentification_decode_ber; +der_type_encoder_f FANSAircraftFlightIdentification_encode_der; +xer_type_decoder_f FANSAircraftFlightIdentification_decode_xer; +xer_type_encoder_f FANSAircraftFlightIdentification_encode_xer; +per_type_decoder_f FANSAircraftFlightIdentification_decode_uper; +per_type_encoder_f FANSAircraftFlightIdentification_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAircraftFlightIdentification_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftType.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftType.c new file mode 100644 index 000000000..ff7567931 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftType.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAircraftType.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAircraftType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 2 && size <= 5) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSAircraftType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSAircraftType_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAircraftType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAircraftType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAircraftType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAircraftType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAircraftType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAircraftType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAircraftType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAircraftType_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAircraftType_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 2, 2, 2, 5 } /* (SIZE(2..5)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAircraftType_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAircraftType = { + "FANSAircraftType", + "FANSAircraftType", + FANSAircraftType_free, + FANSAircraftType_print, + FANSAircraftType_constraint, + FANSAircraftType_decode_ber, + FANSAircraftType_encode_der, + FANSAircraftType_decode_xer, + FANSAircraftType_encode_xer, + FANSAircraftType_decode_uper, + FANSAircraftType_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAircraftType_tags_1, + sizeof(asn_DEF_FANSAircraftType_tags_1) + /sizeof(asn_DEF_FANSAircraftType_tags_1[0]), /* 1 */ + asn_DEF_FANSAircraftType_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAircraftType_tags_1) + /sizeof(asn_DEF_FANSAircraftType_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAircraftType_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftType.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftType.h new file mode 100644 index 000000000..68b80808d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAircraftType.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAircraftType_H_ +#define _FANSAircraftType_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAircraftType */ +typedef IA5String_t FANSAircraftType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAircraftType; +asn_struct_free_f FANSAircraftType_free; +asn_struct_print_f FANSAircraftType_print; +asn_constr_check_f FANSAircraftType_constraint; +ber_type_decoder_f FANSAircraftType_decode_ber; +der_type_encoder_f FANSAircraftType_encode_der; +xer_type_decoder_f FANSAircraftType_decode_xer; +xer_type_encoder_f FANSAircraftType_encode_xer; +per_type_decoder_f FANSAircraftType_decode_uper; +per_type_encoder_f FANSAircraftType_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAircraftType_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirport.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirport.c new file mode 100644 index 000000000..06c27b23b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirport.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAirport.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAirport_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 4) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSAirport_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSAirport_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAirport_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAirport_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAirport_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAirport_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAirport_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAirport_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAirport_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAirport_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAirport_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAirport_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAirport_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAirport = { + "FANSAirport", + "FANSAirport", + FANSAirport_free, + FANSAirport_print, + FANSAirport_constraint, + FANSAirport_decode_ber, + FANSAirport_encode_der, + FANSAirport_decode_xer, + FANSAirport_encode_xer, + FANSAirport_decode_uper, + FANSAirport_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAirport_tags_1, + sizeof(asn_DEF_FANSAirport_tags_1) + /sizeof(asn_DEF_FANSAirport_tags_1[0]), /* 1 */ + asn_DEF_FANSAirport_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAirport_tags_1) + /sizeof(asn_DEF_FANSAirport_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAirport_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirport.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirport.h new file mode 100644 index 000000000..30780a1a1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirport.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAirport_H_ +#define _FANSAirport_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAirport */ +typedef IA5String_t FANSAirport_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAirport; +asn_struct_free_f FANSAirport_free; +asn_struct_print_f FANSAirport_print; +asn_constr_check_f FANSAirport_constraint; +ber_type_decoder_f FANSAirport_decode_ber; +der_type_encoder_f FANSAirport_encode_der; +xer_type_decoder_f FANSAirport_decode_xer; +xer_type_encoder_f FANSAirport_encode_xer; +per_type_decoder_f FANSAirport_decode_uper; +per_type_encoder_f FANSAirport_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAirport_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDeparture.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDeparture.c new file mode 100644 index 000000000..a1405ede5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDeparture.c @@ -0,0 +1,157 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAirportDeparture.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAirportDeparture_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const FANSAirport_t *st = (const FANSAirport_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 4) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using FANSAirport, + * so here we adjust the DEF accordingly. + */ +static void +FANSAirportDeparture_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSAirport.free_struct; + td->print_struct = asn_DEF_FANSAirport.print_struct; + td->check_constraints = asn_DEF_FANSAirport.check_constraints; + td->ber_decoder = asn_DEF_FANSAirport.ber_decoder; + td->der_encoder = asn_DEF_FANSAirport.der_encoder; + td->xer_decoder = asn_DEF_FANSAirport.xer_decoder; + td->xer_encoder = asn_DEF_FANSAirport.xer_encoder; + td->uper_decoder = asn_DEF_FANSAirport.uper_decoder; + td->uper_encoder = asn_DEF_FANSAirport.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSAirport.per_constraints; + td->elements = asn_DEF_FANSAirport.elements; + td->elements_count = asn_DEF_FANSAirport.elements_count; + td->specifics = asn_DEF_FANSAirport.specifics; +} + +void +FANSAirportDeparture_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAirportDeparture_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAirportDeparture_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAirportDeparture_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAirportDeparture_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAirportDeparture_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAirportDeparture_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAirportDeparture_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAirportDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSAirportDeparture_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAirportDeparture = { + "FANSAirportDeparture", + "FANSAirportDeparture", + FANSAirportDeparture_free, + FANSAirportDeparture_print, + FANSAirportDeparture_constraint, + FANSAirportDeparture_decode_ber, + FANSAirportDeparture_encode_der, + FANSAirportDeparture_decode_xer, + FANSAirportDeparture_encode_xer, + FANSAirportDeparture_decode_uper, + FANSAirportDeparture_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAirportDeparture_tags_1, + sizeof(asn_DEF_FANSAirportDeparture_tags_1) + /sizeof(asn_DEF_FANSAirportDeparture_tags_1[0]), /* 1 */ + asn_DEF_FANSAirportDeparture_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAirportDeparture_tags_1) + /sizeof(asn_DEF_FANSAirportDeparture_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDeparture.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDeparture.h new file mode 100644 index 000000000..84979851c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDeparture.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAirportDeparture_H_ +#define _FANSAirportDeparture_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAirport.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAirportDeparture */ +typedef FANSAirport_t FANSAirportDeparture_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAirportDeparture; +asn_struct_free_f FANSAirportDeparture_free; +asn_struct_print_f FANSAirportDeparture_print; +asn_constr_check_f FANSAirportDeparture_constraint; +ber_type_decoder_f FANSAirportDeparture_decode_ber; +der_type_encoder_f FANSAirportDeparture_encode_der; +xer_type_decoder_f FANSAirportDeparture_decode_xer; +xer_type_encoder_f FANSAirportDeparture_encode_xer; +per_type_decoder_f FANSAirportDeparture_decode_uper; +per_type_encoder_f FANSAirportDeparture_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAirportDeparture_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDestination.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDestination.c new file mode 100644 index 000000000..0c6f2b5c0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDestination.c @@ -0,0 +1,157 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAirportDestination.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAirportDestination_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const FANSAirport_t *st = (const FANSAirport_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 4) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using FANSAirport, + * so here we adjust the DEF accordingly. + */ +static void +FANSAirportDestination_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSAirport.free_struct; + td->print_struct = asn_DEF_FANSAirport.print_struct; + td->check_constraints = asn_DEF_FANSAirport.check_constraints; + td->ber_decoder = asn_DEF_FANSAirport.ber_decoder; + td->der_encoder = asn_DEF_FANSAirport.der_encoder; + td->xer_decoder = asn_DEF_FANSAirport.xer_decoder; + td->xer_encoder = asn_DEF_FANSAirport.xer_encoder; + td->uper_decoder = asn_DEF_FANSAirport.uper_decoder; + td->uper_encoder = asn_DEF_FANSAirport.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSAirport.per_constraints; + td->elements = asn_DEF_FANSAirport.elements; + td->elements_count = asn_DEF_FANSAirport.elements_count; + td->specifics = asn_DEF_FANSAirport.specifics; +} + +void +FANSAirportDestination_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAirportDestination_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAirportDestination_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAirportDestination_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAirportDestination_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAirportDestination_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAirportDestination_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAirportDestination_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAirportDestination_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSAirportDestination_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAirportDestination = { + "FANSAirportDestination", + "FANSAirportDestination", + FANSAirportDestination_free, + FANSAirportDestination_print, + FANSAirportDestination_constraint, + FANSAirportDestination_decode_ber, + FANSAirportDestination_encode_der, + FANSAirportDestination_decode_xer, + FANSAirportDestination_encode_xer, + FANSAirportDestination_decode_uper, + FANSAirportDestination_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAirportDestination_tags_1, + sizeof(asn_DEF_FANSAirportDestination_tags_1) + /sizeof(asn_DEF_FANSAirportDestination_tags_1[0]), /* 1 */ + asn_DEF_FANSAirportDestination_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAirportDestination_tags_1) + /sizeof(asn_DEF_FANSAirportDestination_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDestination.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDestination.h new file mode 100644 index 000000000..e0ac6610e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirportDestination.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAirportDestination_H_ +#define _FANSAirportDestination_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAirport.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAirportDestination */ +typedef FANSAirport_t FANSAirportDestination_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAirportDestination; +asn_struct_free_f FANSAirportDestination_free; +asn_struct_print_f FANSAirportDestination_print; +asn_constr_check_f FANSAirportDestination_constraint; +ber_type_decoder_f FANSAirportDestination_decode_ber; +der_type_encoder_f FANSAirportDestination_encode_der; +xer_type_decoder_f FANSAirportDestination_decode_xer; +xer_type_encoder_f FANSAirportDestination_encode_xer; +per_type_decoder_f FANSAirportDestination_decode_uper; +per_type_encoder_f FANSAirportDestination_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAirportDestination_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIdentifier.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIdentifier.c new file mode 100644 index 000000000..8b70f3063 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIdentifier.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAirwayIdentifier.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAirwayIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 5) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSAirwayIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSAirwayIdentifier_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAirwayIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAirwayIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAirwayIdentifier_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAirwayIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAirwayIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAirwayIdentifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAirwayIdentifier_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAirwayIdentifier_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAirwayIdentifier_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAirwayIdentifier_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAirwayIdentifier = { + "FANSAirwayIdentifier", + "FANSAirwayIdentifier", + FANSAirwayIdentifier_free, + FANSAirwayIdentifier_print, + FANSAirwayIdentifier_constraint, + FANSAirwayIdentifier_decode_ber, + FANSAirwayIdentifier_encode_der, + FANSAirwayIdentifier_decode_xer, + FANSAirwayIdentifier_encode_xer, + FANSAirwayIdentifier_decode_uper, + FANSAirwayIdentifier_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAirwayIdentifier_tags_1, + sizeof(asn_DEF_FANSAirwayIdentifier_tags_1) + /sizeof(asn_DEF_FANSAirwayIdentifier_tags_1[0]), /* 1 */ + asn_DEF_FANSAirwayIdentifier_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAirwayIdentifier_tags_1) + /sizeof(asn_DEF_FANSAirwayIdentifier_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAirwayIdentifier_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIdentifier.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIdentifier.h new file mode 100644 index 000000000..b133b22b1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIdentifier.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAirwayIdentifier_H_ +#define _FANSAirwayIdentifier_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAirwayIdentifier */ +typedef IA5String_t FANSAirwayIdentifier_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAirwayIdentifier; +asn_struct_free_f FANSAirwayIdentifier_free; +asn_struct_print_f FANSAirwayIdentifier_print; +asn_constr_check_f FANSAirwayIdentifier_constraint; +ber_type_decoder_f FANSAirwayIdentifier_decode_ber; +der_type_encoder_f FANSAirwayIdentifier_encode_der; +xer_type_decoder_f FANSAirwayIdentifier_decode_xer; +xer_type_encoder_f FANSAirwayIdentifier_encode_xer; +per_type_decoder_f FANSAirwayIdentifier_decode_uper; +per_type_encoder_f FANSAirwayIdentifier_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAirwayIdentifier_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIntercept.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIntercept.c new file mode 100644 index 000000000..1a5e69f50 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIntercept.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAirwayIntercept.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSAirwayIntercept_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 5) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSAirwayIntercept_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSAirwayIntercept_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAirwayIntercept_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAirwayIntercept_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAirwayIntercept_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAirwayIntercept_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAirwayIntercept_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAirwayIntercept_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAirwayIntercept_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAirwayIntercept_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAirwayIntercept_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAirwayIntercept_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAirwayIntercept = { + "FANSAirwayIntercept", + "FANSAirwayIntercept", + FANSAirwayIntercept_free, + FANSAirwayIntercept_print, + FANSAirwayIntercept_constraint, + FANSAirwayIntercept_decode_ber, + FANSAirwayIntercept_encode_der, + FANSAirwayIntercept_decode_xer, + FANSAirwayIntercept_encode_xer, + FANSAirwayIntercept_decode_uper, + FANSAirwayIntercept_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAirwayIntercept_tags_1, + sizeof(asn_DEF_FANSAirwayIntercept_tags_1) + /sizeof(asn_DEF_FANSAirwayIntercept_tags_1[0]), /* 1 */ + asn_DEF_FANSAirwayIntercept_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAirwayIntercept_tags_1) + /sizeof(asn_DEF_FANSAirwayIntercept_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAirwayIntercept_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIntercept.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIntercept.h new file mode 100644 index 000000000..6b7a03f9e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAirwayIntercept.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAirwayIntercept_H_ +#define _FANSAirwayIntercept_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAirwayIntercept */ +typedef IA5String_t FANSAirwayIntercept_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAirwayIntercept; +asn_struct_free_f FANSAirwayIntercept_free; +asn_struct_print_f FANSAirwayIntercept_print; +asn_constr_check_f FANSAirwayIntercept_constraint; +ber_type_decoder_f FANSAirwayIntercept_decode_ber; +der_type_encoder_f FANSAirwayIntercept_encode_der; +xer_type_decoder_f FANSAirwayIntercept_decode_xer; +xer_type_encoder_f FANSAirwayIntercept_encode_xer; +per_type_decoder_f FANSAirwayIntercept_decode_uper; +per_type_encoder_f FANSAirwayIntercept_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAirwayIntercept_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeter.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeter.c new file mode 100644 index 000000000..38fe4c552 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeter.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltimeter.h" + +static asn_per_constraints_t asn_PER_type_FANSAltimeter_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSAltimeter_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAltimeter, choice.altimeterEnglish), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltimeterEnglish, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altimeterEnglish" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltimeter, choice.altimeterMetric), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltimeterMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altimeterMetric" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAltimeter_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* altimeterEnglish */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* altimeterMetric */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSAltimeter_specs_1 = { + sizeof(struct FANSAltimeter), + offsetof(struct FANSAltimeter, _asn_ctx), + offsetof(struct FANSAltimeter, present), + sizeof(((struct FANSAltimeter *)0)->present), + asn_MAP_FANSAltimeter_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltimeter = { + "FANSAltimeter", + "FANSAltimeter", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSAltimeter_constr_1, + asn_MBR_FANSAltimeter_1, + 2, /* Elements count */ + &asn_SPC_FANSAltimeter_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeter.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeter.h new file mode 100644 index 000000000..dc27aca19 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeter.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltimeter_H_ +#define _FANSAltimeter_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltimeterEnglish.h" +#include "FANSAltimeterMetric.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSAltimeter_PR { + FANSAltimeter_PR_NOTHING, /* No components present */ + FANSAltimeter_PR_altimeterEnglish, + FANSAltimeter_PR_altimeterMetric +} FANSAltimeter_PR; + +/* FANSAltimeter */ +typedef struct FANSAltimeter { + FANSAltimeter_PR present; + union FANSAltimeter_u { + FANSAltimeterEnglish_t altimeterEnglish; + FANSAltimeterMetric_t altimeterMetric; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltimeter_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltimeter; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltimeter_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterEnglish.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterEnglish.c new file mode 100644 index 000000000..97dd84ad0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterEnglish.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltimeterEnglish.h" + +int +FANSAltimeterEnglish_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 2200 && value <= 3200)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltimeterEnglish_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltimeterEnglish_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltimeterEnglish_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltimeterEnglish_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltimeterEnglish_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltimeterEnglish_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltimeterEnglish_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltimeterEnglish_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltimeterEnglish_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltimeterEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltimeterEnglish_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 2200, 3200 } /* (2200..3200) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltimeterEnglish_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltimeterEnglish = { + "FANSAltimeterEnglish", + "FANSAltimeterEnglish", + FANSAltimeterEnglish_free, + FANSAltimeterEnglish_print, + FANSAltimeterEnglish_constraint, + FANSAltimeterEnglish_decode_ber, + FANSAltimeterEnglish_encode_der, + FANSAltimeterEnglish_decode_xer, + FANSAltimeterEnglish_encode_xer, + FANSAltimeterEnglish_decode_uper, + FANSAltimeterEnglish_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltimeterEnglish_tags_1, + sizeof(asn_DEF_FANSAltimeterEnglish_tags_1) + /sizeof(asn_DEF_FANSAltimeterEnglish_tags_1[0]), /* 1 */ + asn_DEF_FANSAltimeterEnglish_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltimeterEnglish_tags_1) + /sizeof(asn_DEF_FANSAltimeterEnglish_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltimeterEnglish_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterEnglish.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterEnglish.h new file mode 100644 index 000000000..fb8e52a70 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterEnglish.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltimeterEnglish_H_ +#define _FANSAltimeterEnglish_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltimeterEnglish */ +typedef long FANSAltimeterEnglish_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltimeterEnglish; +asn_struct_free_f FANSAltimeterEnglish_free; +asn_struct_print_f FANSAltimeterEnglish_print; +asn_constr_check_f FANSAltimeterEnglish_constraint; +ber_type_decoder_f FANSAltimeterEnglish_decode_ber; +der_type_encoder_f FANSAltimeterEnglish_encode_der; +xer_type_decoder_f FANSAltimeterEnglish_decode_xer; +xer_type_encoder_f FANSAltimeterEnglish_encode_xer; +per_type_decoder_f FANSAltimeterEnglish_decode_uper; +per_type_encoder_f FANSAltimeterEnglish_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltimeterEnglish_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterMetric.c new file mode 100644 index 000000000..a9da4942c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltimeterMetric.h" + +int +FANSAltimeterMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 7500 && value <= 12500)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltimeterMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltimeterMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltimeterMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltimeterMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltimeterMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltimeterMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltimeterMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltimeterMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltimeterMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltimeterMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltimeterMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 13, 13, 7500, 12500 } /* (7500..12500) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltimeterMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltimeterMetric = { + "FANSAltimeterMetric", + "FANSAltimeterMetric", + FANSAltimeterMetric_free, + FANSAltimeterMetric_print, + FANSAltimeterMetric_constraint, + FANSAltimeterMetric_decode_ber, + FANSAltimeterMetric_encode_der, + FANSAltimeterMetric_decode_xer, + FANSAltimeterMetric_encode_xer, + FANSAltimeterMetric_decode_uper, + FANSAltimeterMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltimeterMetric_tags_1, + sizeof(asn_DEF_FANSAltimeterMetric_tags_1) + /sizeof(asn_DEF_FANSAltimeterMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSAltimeterMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltimeterMetric_tags_1) + /sizeof(asn_DEF_FANSAltimeterMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltimeterMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterMetric.h new file mode 100644 index 000000000..71933f42f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltimeterMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltimeterMetric_H_ +#define _FANSAltimeterMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltimeterMetric */ +typedef long FANSAltimeterMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltimeterMetric; +asn_struct_free_f FANSAltimeterMetric_free; +asn_struct_print_f FANSAltimeterMetric_print; +asn_constr_check_f FANSAltimeterMetric_constraint; +ber_type_decoder_f FANSAltimeterMetric_decode_ber; +der_type_encoder_f FANSAltimeterMetric_encode_der; +xer_type_decoder_f FANSAltimeterMetric_decode_xer; +xer_type_encoder_f FANSAltimeterMetric_encode_xer; +per_type_decoder_f FANSAltimeterMetric_decode_uper; +per_type_encoder_f FANSAltimeterMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltimeterMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitude.c new file mode 100644 index 000000000..7800f9aa4 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitude.c @@ -0,0 +1,131 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitude.h" + +static asn_per_constraints_t asn_PER_type_FANSAltitude_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeQNH), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeQNH, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeQNH" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeQNHMeters), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeQNHMeters, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeQNHMeters" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeQFE), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeQFE, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeQFE" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeQFEMeters), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeQFEMeters, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeQFEMeters" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeGNSSFeet), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeGNSSFeet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeGNSSFeet" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeGNSSMeters), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeGNSSMeters, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeGNSSMeters" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeFlightLevel), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeFlightLevel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeFlightLevel" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitude, choice.altitudeFlightLevelMetric), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAltitudeFlightLevelMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeFlightLevelMetric" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSAltitude_specs_1 = { + sizeof(struct FANSAltitude), + offsetof(struct FANSAltitude, _asn_ctx), + offsetof(struct FANSAltitude, present), + sizeof(((struct FANSAltitude *)0)->present), + asn_MAP_FANSAltitude_tag2el_1, + 8, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitude = { + "FANSAltitude", + "FANSAltitude", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSAltitude_constr_1, + asn_MBR_FANSAltitude_1, + 8, /* Elements count */ + &asn_SPC_FANSAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitude.h new file mode 100644 index 000000000..1e81f9793 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitude.h @@ -0,0 +1,68 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitude_H_ +#define _FANSAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitudeQNH.h" +#include "FANSAltitudeQNHMeters.h" +#include "FANSAltitudeQFE.h" +#include "FANSAltitudeQFEMeters.h" +#include "FANSAltitudeGNSSFeet.h" +#include "FANSAltitudeGNSSMeters.h" +#include "FANSAltitudeFlightLevel.h" +#include "FANSAltitudeFlightLevelMetric.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSAltitude_PR { + FANSAltitude_PR_NOTHING, /* No components present */ + FANSAltitude_PR_altitudeQNH, + FANSAltitude_PR_altitudeQNHMeters, + FANSAltitude_PR_altitudeQFE, + FANSAltitude_PR_altitudeQFEMeters, + FANSAltitude_PR_altitudeGNSSFeet, + FANSAltitude_PR_altitudeGNSSMeters, + FANSAltitude_PR_altitudeFlightLevel, + FANSAltitude_PR_altitudeFlightLevelMetric +} FANSAltitude_PR; + +/* FANSAltitude */ +typedef struct FANSAltitude { + FANSAltitude_PR present; + union FANSAltitude_u { + FANSAltitudeQNH_t altitudeQNH; + FANSAltitudeQNHMeters_t altitudeQNHMeters; + FANSAltitudeQFE_t altitudeQFE; + FANSAltitudeQFEMeters_t altitudeQFEMeters; + FANSAltitudeGNSSFeet_t altitudeGNSSFeet; + FANSAltitudeGNSSMeters_t altitudeGNSSMeters; + FANSAltitudeFlightLevel_t altitudeFlightLevel; + FANSAltitudeFlightLevelMetric_t altitudeFlightLevelMetric; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeAltitude.c new file mode 100644 index 000000000..086a2064b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeAltitude.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeAltitude.h" + +static asn_per_constraints_t asn_PER_type_FANSAltitudeAltitude_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 2, 2 } /* (SIZE(2..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSAltitudeAltitude_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSAltitudeAltitude_specs_1 = { + sizeof(struct FANSAltitudeAltitude), + offsetof(struct FANSAltitudeAltitude, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeAltitude = { + "FANSAltitudeAltitude", + "FANSAltitudeAltitude", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeAltitude_tags_1, + sizeof(asn_DEF_FANSAltitudeAltitude_tags_1) + /sizeof(asn_DEF_FANSAltitudeAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeAltitude_tags_1) + /sizeof(asn_DEF_FANSAltitudeAltitude_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeAltitude_constr_1, + asn_MBR_FANSAltitudeAltitude_1, + 1, /* Single element */ + &asn_SPC_FANSAltitudeAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeAltitude.h new file mode 100644 index 000000000..46a17220e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeAltitude.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeAltitude_H_ +#define _FANSAltitudeAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSAltitude; + +/* FANSAltitudeAltitude */ +typedef struct FANSAltitudeAltitude { + A_SEQUENCE_OF(struct FANSAltitude) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltitudeAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeAltitude; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSAltitude.h" + +#endif /* _FANSAltitudeAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevel.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevel.c new file mode 100644 index 000000000..42c1e6ccb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevel.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeFlightLevel.h" + +int +FANSAltitudeFlightLevel_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 30 && value <= 600)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeFlightLevel_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeFlightLevel_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeFlightLevel_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeFlightLevel_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeFlightLevel_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeFlightLevel_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeFlightLevel_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeFlightLevel_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeFlightLevel_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeFlightLevel_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 30, 600 } /* (30..600) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeFlightLevel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeFlightLevel = { + "FANSAltitudeFlightLevel", + "FANSAltitudeFlightLevel", + FANSAltitudeFlightLevel_free, + FANSAltitudeFlightLevel_print, + FANSAltitudeFlightLevel_constraint, + FANSAltitudeFlightLevel_decode_ber, + FANSAltitudeFlightLevel_encode_der, + FANSAltitudeFlightLevel_decode_xer, + FANSAltitudeFlightLevel_encode_xer, + FANSAltitudeFlightLevel_decode_uper, + FANSAltitudeFlightLevel_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeFlightLevel_tags_1, + sizeof(asn_DEF_FANSAltitudeFlightLevel_tags_1) + /sizeof(asn_DEF_FANSAltitudeFlightLevel_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeFlightLevel_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeFlightLevel_tags_1) + /sizeof(asn_DEF_FANSAltitudeFlightLevel_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeFlightLevel_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevel.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevel.h new file mode 100644 index 000000000..83fd48759 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevel.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeFlightLevel_H_ +#define _FANSAltitudeFlightLevel_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeFlightLevel */ +typedef long FANSAltitudeFlightLevel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeFlightLevel; +asn_struct_free_f FANSAltitudeFlightLevel_free; +asn_struct_print_f FANSAltitudeFlightLevel_print; +asn_constr_check_f FANSAltitudeFlightLevel_constraint; +ber_type_decoder_f FANSAltitudeFlightLevel_decode_ber; +der_type_encoder_f FANSAltitudeFlightLevel_encode_der; +xer_type_decoder_f FANSAltitudeFlightLevel_decode_xer; +xer_type_encoder_f FANSAltitudeFlightLevel_encode_xer; +per_type_decoder_f FANSAltitudeFlightLevel_decode_uper; +per_type_encoder_f FANSAltitudeFlightLevel_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeFlightLevel_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevelMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevelMetric.c new file mode 100644 index 000000000..8223c6ac1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevelMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeFlightLevelMetric.h" + +int +FANSAltitudeFlightLevelMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 100 && value <= 2000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeFlightLevelMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeFlightLevelMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeFlightLevelMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeFlightLevelMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeFlightLevelMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeFlightLevelMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeFlightLevelMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeFlightLevelMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeFlightLevelMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeFlightLevelMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 11, 11, 100, 2000 } /* (100..2000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeFlightLevelMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeFlightLevelMetric = { + "FANSAltitudeFlightLevelMetric", + "FANSAltitudeFlightLevelMetric", + FANSAltitudeFlightLevelMetric_free, + FANSAltitudeFlightLevelMetric_print, + FANSAltitudeFlightLevelMetric_constraint, + FANSAltitudeFlightLevelMetric_decode_ber, + FANSAltitudeFlightLevelMetric_encode_der, + FANSAltitudeFlightLevelMetric_decode_xer, + FANSAltitudeFlightLevelMetric_encode_xer, + FANSAltitudeFlightLevelMetric_decode_uper, + FANSAltitudeFlightLevelMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeFlightLevelMetric_tags_1, + sizeof(asn_DEF_FANSAltitudeFlightLevelMetric_tags_1) + /sizeof(asn_DEF_FANSAltitudeFlightLevelMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeFlightLevelMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeFlightLevelMetric_tags_1) + /sizeof(asn_DEF_FANSAltitudeFlightLevelMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeFlightLevelMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevelMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevelMetric.h new file mode 100644 index 000000000..b46688099 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeFlightLevelMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeFlightLevelMetric_H_ +#define _FANSAltitudeFlightLevelMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeFlightLevelMetric */ +typedef long FANSAltitudeFlightLevelMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeFlightLevelMetric; +asn_struct_free_f FANSAltitudeFlightLevelMetric_free; +asn_struct_print_f FANSAltitudeFlightLevelMetric_print; +asn_constr_check_f FANSAltitudeFlightLevelMetric_constraint; +ber_type_decoder_f FANSAltitudeFlightLevelMetric_decode_ber; +der_type_encoder_f FANSAltitudeFlightLevelMetric_encode_der; +xer_type_decoder_f FANSAltitudeFlightLevelMetric_decode_xer; +xer_type_encoder_f FANSAltitudeFlightLevelMetric_encode_xer; +per_type_decoder_f FANSAltitudeFlightLevelMetric_decode_uper; +per_type_encoder_f FANSAltitudeFlightLevelMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeFlightLevelMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSFeet.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSFeet.c new file mode 100644 index 000000000..2344f2df3 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSFeet.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeGNSSFeet.h" + +int +FANSAltitudeGNSSFeet_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 150000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeGNSSFeet_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeGNSSFeet_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeGNSSFeet_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeGNSSFeet_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeGNSSFeet_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeGNSSFeet_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeGNSSFeet_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeGNSSFeet_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeGNSSFeet_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeGNSSFeet_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 18, -1, 0, 150000 } /* (0..150000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeGNSSFeet_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeGNSSFeet = { + "FANSAltitudeGNSSFeet", + "FANSAltitudeGNSSFeet", + FANSAltitudeGNSSFeet_free, + FANSAltitudeGNSSFeet_print, + FANSAltitudeGNSSFeet_constraint, + FANSAltitudeGNSSFeet_decode_ber, + FANSAltitudeGNSSFeet_encode_der, + FANSAltitudeGNSSFeet_decode_xer, + FANSAltitudeGNSSFeet_encode_xer, + FANSAltitudeGNSSFeet_decode_uper, + FANSAltitudeGNSSFeet_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeGNSSFeet_tags_1, + sizeof(asn_DEF_FANSAltitudeGNSSFeet_tags_1) + /sizeof(asn_DEF_FANSAltitudeGNSSFeet_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeGNSSFeet_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeGNSSFeet_tags_1) + /sizeof(asn_DEF_FANSAltitudeGNSSFeet_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeGNSSFeet_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSFeet.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSFeet.h new file mode 100644 index 000000000..1bd38a691 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSFeet.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeGNSSFeet_H_ +#define _FANSAltitudeGNSSFeet_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeGNSSFeet */ +typedef long FANSAltitudeGNSSFeet_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeGNSSFeet; +asn_struct_free_f FANSAltitudeGNSSFeet_free; +asn_struct_print_f FANSAltitudeGNSSFeet_print; +asn_constr_check_f FANSAltitudeGNSSFeet_constraint; +ber_type_decoder_f FANSAltitudeGNSSFeet_decode_ber; +der_type_encoder_f FANSAltitudeGNSSFeet_encode_der; +xer_type_decoder_f FANSAltitudeGNSSFeet_decode_xer; +xer_type_encoder_f FANSAltitudeGNSSFeet_encode_xer; +per_type_decoder_f FANSAltitudeGNSSFeet_decode_uper; +per_type_encoder_f FANSAltitudeGNSSFeet_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeGNSSFeet_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSMeters.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSMeters.c new file mode 100644 index 000000000..e44d3349e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSMeters.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeGNSSMeters.h" + +int +FANSAltitudeGNSSMeters_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 50000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeGNSSMeters_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeGNSSMeters_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeGNSSMeters_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeGNSSMeters_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeGNSSMeters_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeGNSSMeters_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeGNSSMeters_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeGNSSMeters_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeGNSSMeters_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeGNSSMeters_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 16, 16, 0, 50000 } /* (0..50000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeGNSSMeters_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeGNSSMeters = { + "FANSAltitudeGNSSMeters", + "FANSAltitudeGNSSMeters", + FANSAltitudeGNSSMeters_free, + FANSAltitudeGNSSMeters_print, + FANSAltitudeGNSSMeters_constraint, + FANSAltitudeGNSSMeters_decode_ber, + FANSAltitudeGNSSMeters_encode_der, + FANSAltitudeGNSSMeters_decode_xer, + FANSAltitudeGNSSMeters_encode_xer, + FANSAltitudeGNSSMeters_decode_uper, + FANSAltitudeGNSSMeters_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeGNSSMeters_tags_1, + sizeof(asn_DEF_FANSAltitudeGNSSMeters_tags_1) + /sizeof(asn_DEF_FANSAltitudeGNSSMeters_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeGNSSMeters_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeGNSSMeters_tags_1) + /sizeof(asn_DEF_FANSAltitudeGNSSMeters_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeGNSSMeters_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSMeters.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSMeters.h new file mode 100644 index 000000000..753315a36 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeGNSSMeters.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeGNSSMeters_H_ +#define _FANSAltitudeGNSSMeters_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeGNSSMeters */ +typedef long FANSAltitudeGNSSMeters_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeGNSSMeters; +asn_struct_free_f FANSAltitudeGNSSMeters_free; +asn_struct_print_f FANSAltitudeGNSSMeters_print; +asn_constr_check_f FANSAltitudeGNSSMeters_constraint; +ber_type_decoder_f FANSAltitudeGNSSMeters_decode_ber; +der_type_encoder_f FANSAltitudeGNSSMeters_encode_der; +xer_type_decoder_f FANSAltitudeGNSSMeters_decode_xer; +xer_type_encoder_f FANSAltitudeGNSSMeters_encode_xer; +per_type_decoder_f FANSAltitudeGNSSMeters_decode_uper; +per_type_encoder_f FANSAltitudeGNSSMeters_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeGNSSMeters_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudePosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudePosition.c new file mode 100644 index 000000000..187a3dc8b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudePosition.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudePosition.h" + +static asn_TYPE_member_t asn_MBR_FANSAltitudePosition_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudePosition, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudePosition, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudePosition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAltitudePosition_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, -1, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, -1, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 1 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, -1, 0 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 0, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 0, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSAltitudePosition_specs_1 = { + sizeof(struct FANSAltitudePosition), + offsetof(struct FANSAltitudePosition, _asn_ctx), + asn_MAP_FANSAltitudePosition_tag2el_1, + 13, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudePosition = { + "FANSAltitudePosition", + "FANSAltitudePosition", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudePosition_tags_1, + sizeof(asn_DEF_FANSAltitudePosition_tags_1) + /sizeof(asn_DEF_FANSAltitudePosition_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudePosition_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudePosition_tags_1) + /sizeof(asn_DEF_FANSAltitudePosition_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSAltitudePosition_1, + 2, /* Elements count */ + &asn_SPC_FANSAltitudePosition_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudePosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudePosition.h new file mode 100644 index 000000000..c5562167e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudePosition.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudePosition_H_ +#define _FANSAltitudePosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitude.h" +#include "FANSPosition.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudePosition */ +typedef struct FANSAltitudePosition { + FANSAltitude_t altitude; + FANSPosition_t position; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltitudePosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudePosition; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudePosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFE.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFE.c new file mode 100644 index 000000000..ef7938fdb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFE.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeQFE.h" + +int +FANSAltitudeQFE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2100)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeQFE_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeQFE_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeQFE_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQFE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeQFE_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQFE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeQFE_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQFE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeQFE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeQFE_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeQFE_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2100 } /* (0..2100) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeQFE_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQFE = { + "FANSAltitudeQFE", + "FANSAltitudeQFE", + FANSAltitudeQFE_free, + FANSAltitudeQFE_print, + FANSAltitudeQFE_constraint, + FANSAltitudeQFE_decode_ber, + FANSAltitudeQFE_encode_der, + FANSAltitudeQFE_decode_xer, + FANSAltitudeQFE_encode_xer, + FANSAltitudeQFE_decode_uper, + FANSAltitudeQFE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeQFE_tags_1, + sizeof(asn_DEF_FANSAltitudeQFE_tags_1) + /sizeof(asn_DEF_FANSAltitudeQFE_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeQFE_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeQFE_tags_1) + /sizeof(asn_DEF_FANSAltitudeQFE_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeQFE_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFE.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFE.h new file mode 100644 index 000000000..174e23db6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFE.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeQFE_H_ +#define _FANSAltitudeQFE_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeQFE */ +typedef long FANSAltitudeQFE_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQFE; +asn_struct_free_f FANSAltitudeQFE_free; +asn_struct_print_f FANSAltitudeQFE_print; +asn_constr_check_f FANSAltitudeQFE_constraint; +ber_type_decoder_f FANSAltitudeQFE_decode_ber; +der_type_encoder_f FANSAltitudeQFE_encode_der; +xer_type_decoder_f FANSAltitudeQFE_decode_xer; +xer_type_encoder_f FANSAltitudeQFE_encode_xer; +per_type_decoder_f FANSAltitudeQFE_decode_uper; +per_type_encoder_f FANSAltitudeQFE_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeQFE_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFEMeters.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFEMeters.c new file mode 100644 index 000000000..1a2120f84 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFEMeters.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeQFEMeters.h" + +int +FANSAltitudeQFEMeters_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeQFEMeters_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeQFEMeters_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQFEMeters_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeQFEMeters_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQFEMeters_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeQFEMeters_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQFEMeters_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeQFEMeters_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeQFEMeters_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeQFEMeters_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 13, 13, 0, 7000 } /* (0..7000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeQFEMeters_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQFEMeters = { + "FANSAltitudeQFEMeters", + "FANSAltitudeQFEMeters", + FANSAltitudeQFEMeters_free, + FANSAltitudeQFEMeters_print, + FANSAltitudeQFEMeters_constraint, + FANSAltitudeQFEMeters_decode_ber, + FANSAltitudeQFEMeters_encode_der, + FANSAltitudeQFEMeters_decode_xer, + FANSAltitudeQFEMeters_encode_xer, + FANSAltitudeQFEMeters_decode_uper, + FANSAltitudeQFEMeters_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeQFEMeters_tags_1, + sizeof(asn_DEF_FANSAltitudeQFEMeters_tags_1) + /sizeof(asn_DEF_FANSAltitudeQFEMeters_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeQFEMeters_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeQFEMeters_tags_1) + /sizeof(asn_DEF_FANSAltitudeQFEMeters_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeQFEMeters_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFEMeters.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFEMeters.h new file mode 100644 index 000000000..e74c6914d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQFEMeters.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeQFEMeters_H_ +#define _FANSAltitudeQFEMeters_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeQFEMeters */ +typedef long FANSAltitudeQFEMeters_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQFEMeters; +asn_struct_free_f FANSAltitudeQFEMeters_free; +asn_struct_print_f FANSAltitudeQFEMeters_print; +asn_constr_check_f FANSAltitudeQFEMeters_constraint; +ber_type_decoder_f FANSAltitudeQFEMeters_decode_ber; +der_type_encoder_f FANSAltitudeQFEMeters_encode_der; +xer_type_decoder_f FANSAltitudeQFEMeters_decode_xer; +xer_type_encoder_f FANSAltitudeQFEMeters_encode_xer; +per_type_decoder_f FANSAltitudeQFEMeters_decode_uper; +per_type_encoder_f FANSAltitudeQFEMeters_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeQFEMeters_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNH.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNH.c new file mode 100644 index 000000000..447cb1596 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNH.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeQNH.h" + +int +FANSAltitudeQNH_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2500)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeQNH_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeQNH_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeQNH_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQNH_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeQNH_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQNH_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeQNH_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQNH_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeQNH_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeQNH_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeQNH_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 12, 12, 0, 2500 } /* (0..2500) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeQNH_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQNH = { + "FANSAltitudeQNH", + "FANSAltitudeQNH", + FANSAltitudeQNH_free, + FANSAltitudeQNH_print, + FANSAltitudeQNH_constraint, + FANSAltitudeQNH_decode_ber, + FANSAltitudeQNH_encode_der, + FANSAltitudeQNH_decode_xer, + FANSAltitudeQNH_encode_xer, + FANSAltitudeQNH_decode_uper, + FANSAltitudeQNH_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeQNH_tags_1, + sizeof(asn_DEF_FANSAltitudeQNH_tags_1) + /sizeof(asn_DEF_FANSAltitudeQNH_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeQNH_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeQNH_tags_1) + /sizeof(asn_DEF_FANSAltitudeQNH_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeQNH_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNH.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNH.h new file mode 100644 index 000000000..3a2e26e41 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNH.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeQNH_H_ +#define _FANSAltitudeQNH_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeQNH */ +typedef long FANSAltitudeQNH_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQNH; +asn_struct_free_f FANSAltitudeQNH_free; +asn_struct_print_f FANSAltitudeQNH_print; +asn_constr_check_f FANSAltitudeQNH_constraint; +ber_type_decoder_f FANSAltitudeQNH_decode_ber; +der_type_encoder_f FANSAltitudeQNH_encode_der; +xer_type_decoder_f FANSAltitudeQNH_decode_xer; +xer_type_encoder_f FANSAltitudeQNH_encode_xer; +per_type_decoder_f FANSAltitudeQNH_decode_uper; +per_type_encoder_f FANSAltitudeQNH_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeQNH_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNHMeters.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNHMeters.c new file mode 100644 index 000000000..d448bc93c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNHMeters.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeQNHMeters.h" + +int +FANSAltitudeQNHMeters_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSAltitudeQNHMeters_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeQNHMeters_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQNHMeters_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeQNHMeters_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQNHMeters_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeQNHMeters_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeQNHMeters_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeQNHMeters_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeQNHMeters_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeQNHMeters_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 14, 14, 0, 16000 } /* (0..16000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeQNHMeters_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQNHMeters = { + "FANSAltitudeQNHMeters", + "FANSAltitudeQNHMeters", + FANSAltitudeQNHMeters_free, + FANSAltitudeQNHMeters_print, + FANSAltitudeQNHMeters_constraint, + FANSAltitudeQNHMeters_decode_ber, + FANSAltitudeQNHMeters_encode_der, + FANSAltitudeQNHMeters_decode_xer, + FANSAltitudeQNHMeters_encode_xer, + FANSAltitudeQNHMeters_decode_uper, + FANSAltitudeQNHMeters_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeQNHMeters_tags_1, + sizeof(asn_DEF_FANSAltitudeQNHMeters_tags_1) + /sizeof(asn_DEF_FANSAltitudeQNHMeters_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeQNHMeters_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeQNHMeters_tags_1) + /sizeof(asn_DEF_FANSAltitudeQNHMeters_tags_1[0]), /* 1 */ + &asn_PER_type_FANSAltitudeQNHMeters_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNHMeters.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNHMeters.h new file mode 100644 index 000000000..77b715deb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeQNHMeters.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeQNHMeters_H_ +#define _FANSAltitudeQNHMeters_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeQNHMeters */ +typedef long FANSAltitudeQNHMeters_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeQNHMeters; +asn_struct_free_f FANSAltitudeQNHMeters_free; +asn_struct_print_f FANSAltitudeQNHMeters_print; +asn_constr_check_f FANSAltitudeQNHMeters_constraint; +ber_type_decoder_f FANSAltitudeQNHMeters_decode_ber; +der_type_encoder_f FANSAltitudeQNHMeters_encode_der; +xer_type_decoder_f FANSAltitudeQNHMeters_decode_xer; +xer_type_encoder_f FANSAltitudeQNHMeters_encode_xer; +per_type_decoder_f FANSAltitudeQNHMeters_decode_uper; +per_type_encoder_f FANSAltitudeQNHMeters_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeQNHMeters_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeRestriction.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeRestriction.c new file mode 100644 index 000000000..1171bb8c2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeRestriction.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeRestriction.h" + +int +FANSAltitudeRestriction_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSAltitude.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSAltitude, + * so here we adjust the DEF accordingly. + */ +static void +FANSAltitudeRestriction_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSAltitude.free_struct; + td->print_struct = asn_DEF_FANSAltitude.print_struct; + td->check_constraints = asn_DEF_FANSAltitude.check_constraints; + td->ber_decoder = asn_DEF_FANSAltitude.ber_decoder; + td->der_encoder = asn_DEF_FANSAltitude.der_encoder; + td->xer_decoder = asn_DEF_FANSAltitude.xer_decoder; + td->xer_encoder = asn_DEF_FANSAltitude.xer_encoder; + td->uper_decoder = asn_DEF_FANSAltitude.uper_decoder; + td->uper_encoder = asn_DEF_FANSAltitude.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSAltitude.per_constraints; + td->elements = asn_DEF_FANSAltitude.elements; + td->elements_count = asn_DEF_FANSAltitude.elements_count; + td->specifics = asn_DEF_FANSAltitude.specifics; +} + +void +FANSAltitudeRestriction_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSAltitudeRestriction_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeRestriction_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSAltitudeRestriction_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeRestriction_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSAltitudeRestriction_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSAltitudeRestriction_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSAltitudeRestriction_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSAltitudeRestriction_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSAltitudeRestriction_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeRestriction = { + "FANSAltitudeRestriction", + "FANSAltitudeRestriction", + FANSAltitudeRestriction_free, + FANSAltitudeRestriction_print, + FANSAltitudeRestriction_constraint, + FANSAltitudeRestriction_decode_ber, + FANSAltitudeRestriction_encode_der, + FANSAltitudeRestriction_decode_xer, + FANSAltitudeRestriction_encode_xer, + FANSAltitudeRestriction_decode_uper, + FANSAltitudeRestriction_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeRestriction.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeRestriction.h new file mode 100644 index 000000000..3848ec46a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeRestriction.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeRestriction_H_ +#define _FANSAltitudeRestriction_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitude.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeRestriction */ +typedef FANSAltitude_t FANSAltitudeRestriction_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeRestriction; +asn_struct_free_f FANSAltitudeRestriction_free; +asn_struct_print_f FANSAltitudeRestriction_print; +asn_constr_check_f FANSAltitudeRestriction_constraint; +ber_type_decoder_f FANSAltitudeRestriction_decode_ber; +der_type_encoder_f FANSAltitudeRestriction_encode_der; +xer_type_decoder_f FANSAltitudeRestriction_decode_xer; +xer_type_encoder_f FANSAltitudeRestriction_encode_xer; +per_type_decoder_f FANSAltitudeRestriction_decode_uper; +per_type_encoder_f FANSAltitudeRestriction_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeRestriction_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeed.c new file mode 100644 index 000000000..68d30195c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeed.c @@ -0,0 +1,84 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSAltitudeSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudeSpeed, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudeSpeed, speed), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAltitudeSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* speedIndicated */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* speedIndicatedMetric */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, -1, 0 }, /* speedTrue */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, -1, 0 }, /* speedTrueMetric */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 1 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, -1, 0 }, /* speedGround */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 1 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, -1, 0 }, /* speedGroundMetric */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 0, 0, 1 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, -1, 0 }, /* speedMach */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 0, 0, 1 }, /* altitudeFlightLevelMetric */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, -1, 0 } /* speedMachLarge */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSAltitudeSpeed_specs_1 = { + sizeof(struct FANSAltitudeSpeed), + offsetof(struct FANSAltitudeSpeed, _asn_ctx), + asn_MAP_FANSAltitudeSpeed_tag2el_1, + 16, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeSpeed = { + "FANSAltitudeSpeed", + "FANSAltitudeSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeSpeed_tags_1, + sizeof(asn_DEF_FANSAltitudeSpeed_tags_1) + /sizeof(asn_DEF_FANSAltitudeSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeSpeed_tags_1) + /sizeof(asn_DEF_FANSAltitudeSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSAltitudeSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSAltitudeSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeed.h new file mode 100644 index 000000000..da654df47 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeed.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeSpeed_H_ +#define _FANSAltitudeSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitude.h" +#include "FANSSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeSpeed */ +typedef struct FANSAltitudeSpeed { + FANSAltitude_t altitude; + FANSSpeed_t speed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltitudeSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeedSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeedSpeed.c new file mode 100644 index 000000000..0492f6b53 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeedSpeed.c @@ -0,0 +1,77 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeSpeedSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSAltitudeSpeedSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudeSpeedSpeed, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudeSpeedSpeed, speed_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed-seqOf" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeSpeedSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAltitudeSpeedSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* speed-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 0, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 0, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSAltitudeSpeedSpeed_specs_1 = { + sizeof(struct FANSAltitudeSpeedSpeed), + offsetof(struct FANSAltitudeSpeedSpeed, _asn_ctx), + asn_MAP_FANSAltitudeSpeedSpeed_tag2el_1, + 9, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeSpeedSpeed = { + "FANSAltitudeSpeedSpeed", + "FANSAltitudeSpeedSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeSpeedSpeed_tags_1, + sizeof(asn_DEF_FANSAltitudeSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSAltitudeSpeedSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeSpeedSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSAltitudeSpeedSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSAltitudeSpeedSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSAltitudeSpeedSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeedSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeedSpeed.h new file mode 100644 index 000000000..920dc062a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeSpeedSpeed.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeSpeedSpeed_H_ +#define _FANSAltitudeSpeedSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitude.h" +#include "FANSSpeedSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeSpeedSpeed */ +typedef struct FANSAltitudeSpeedSpeed { + FANSAltitude_t altitude; + FANSSpeedSpeed_t speed_seqOf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltitudeSpeedSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeSpeedSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeSpeedSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeTime.c new file mode 100644 index 000000000..0519e5e4b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeTime.c @@ -0,0 +1,77 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSAltitudeTime.h" + +static asn_TYPE_member_t asn_MBR_FANSAltitudeTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudeTime, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSAltitudeTime, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSAltitudeTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSAltitudeTime_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 0, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 0, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSAltitudeTime_specs_1 = { + sizeof(struct FANSAltitudeTime), + offsetof(struct FANSAltitudeTime, _asn_ctx), + asn_MAP_FANSAltitudeTime_tag2el_1, + 9, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSAltitudeTime = { + "FANSAltitudeTime", + "FANSAltitudeTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSAltitudeTime_tags_1, + sizeof(asn_DEF_FANSAltitudeTime_tags_1) + /sizeof(asn_DEF_FANSAltitudeTime_tags_1[0]), /* 1 */ + asn_DEF_FANSAltitudeTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSAltitudeTime_tags_1) + /sizeof(asn_DEF_FANSAltitudeTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSAltitudeTime_1, + 2, /* Elements count */ + &asn_SPC_FANSAltitudeTime_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeTime.h new file mode 100644 index 000000000..12b2d8935 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSAltitudeTime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSAltitudeTime_H_ +#define _FANSAltitudeTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitude.h" +#include "FANSTime.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSAltitudeTime */ +typedef struct FANSAltitudeTime { + FANSAltitude_t altitude; + FANSTime_t time; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSAltitudeTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSAltitudeTime; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSAltitudeTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCode.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCode.c new file mode 100644 index 000000000..5ebecc1fb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCode.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSBeaconCode.h" + +static asn_per_constraints_t asn_PER_type_FANSBeaconCode_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSBeaconCode_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSBeaconCodeOctalDigit, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSBeaconCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSBeaconCode_specs_1 = { + sizeof(struct FANSBeaconCode), + offsetof(struct FANSBeaconCode, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSBeaconCode = { + "FANSBeaconCode", + "FANSBeaconCode", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSBeaconCode_tags_1, + sizeof(asn_DEF_FANSBeaconCode_tags_1) + /sizeof(asn_DEF_FANSBeaconCode_tags_1[0]), /* 1 */ + asn_DEF_FANSBeaconCode_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSBeaconCode_tags_1) + /sizeof(asn_DEF_FANSBeaconCode_tags_1[0]), /* 1 */ + &asn_PER_type_FANSBeaconCode_constr_1, + asn_MBR_FANSBeaconCode_1, + 1, /* Single element */ + &asn_SPC_FANSBeaconCode_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCode.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCode.h new file mode 100644 index 000000000..ac0f76d9b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCode.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSBeaconCode_H_ +#define _FANSBeaconCode_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSBeaconCodeOctalDigit.h" +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSBeaconCode */ +typedef struct FANSBeaconCode { + A_SEQUENCE_OF(FANSBeaconCodeOctalDigit_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSBeaconCode_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSBeaconCode; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSBeaconCode_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCodeOctalDigit.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCodeOctalDigit.c new file mode 100644 index 000000000..b7cdff94a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCodeOctalDigit.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSBeaconCodeOctalDigit.h" + +int +FANSBeaconCodeOctalDigit_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSBeaconCodeOctalDigit_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSBeaconCodeOctalDigit_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSBeaconCodeOctalDigit_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSBeaconCodeOctalDigit_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSBeaconCodeOctalDigit_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSBeaconCodeOctalDigit_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSBeaconCodeOctalDigit_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSBeaconCodeOctalDigit_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSBeaconCodeOctalDigit_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSBeaconCodeOctalDigit_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSBeaconCodeOctalDigit_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSBeaconCodeOctalDigit = { + "FANSBeaconCodeOctalDigit", + "FANSBeaconCodeOctalDigit", + FANSBeaconCodeOctalDigit_free, + FANSBeaconCodeOctalDigit_print, + FANSBeaconCodeOctalDigit_constraint, + FANSBeaconCodeOctalDigit_decode_ber, + FANSBeaconCodeOctalDigit_encode_der, + FANSBeaconCodeOctalDigit_decode_xer, + FANSBeaconCodeOctalDigit_encode_xer, + FANSBeaconCodeOctalDigit_decode_uper, + FANSBeaconCodeOctalDigit_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSBeaconCodeOctalDigit_tags_1, + sizeof(asn_DEF_FANSBeaconCodeOctalDigit_tags_1) + /sizeof(asn_DEF_FANSBeaconCodeOctalDigit_tags_1[0]), /* 1 */ + asn_DEF_FANSBeaconCodeOctalDigit_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSBeaconCodeOctalDigit_tags_1) + /sizeof(asn_DEF_FANSBeaconCodeOctalDigit_tags_1[0]), /* 1 */ + &asn_PER_type_FANSBeaconCodeOctalDigit_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCodeOctalDigit.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCodeOctalDigit.h new file mode 100644 index 000000000..2e2a94996 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSBeaconCodeOctalDigit.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSBeaconCodeOctalDigit_H_ +#define _FANSBeaconCodeOctalDigit_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSBeaconCodeOctalDigit */ +typedef long FANSBeaconCodeOctalDigit_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSBeaconCodeOctalDigit; +asn_struct_free_f FANSBeaconCodeOctalDigit_free; +asn_struct_print_f FANSBeaconCodeOctalDigit_print; +asn_constr_check_f FANSBeaconCodeOctalDigit_constraint; +ber_type_decoder_f FANSBeaconCodeOctalDigit_decode_ber; +der_type_encoder_f FANSBeaconCodeOctalDigit_encode_der; +xer_type_decoder_f FANSBeaconCodeOctalDigit_decode_xer; +xer_type_encoder_f FANSBeaconCodeOctalDigit_encode_xer; +per_type_decoder_f FANSBeaconCodeOctalDigit_decode_uper; +per_type_encoder_f FANSBeaconCodeOctalDigit_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSBeaconCodeOctalDigit_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVApproachEquipmentAvailable.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVApproachEquipmentAvailable.c new file mode 100644 index 000000000..25c4a6f10 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVApproachEquipmentAvailable.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSCOMNAVApproachEquipmentAvailable.h" + +int +FANSCOMNAVApproachEquipmentAvailable_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_BOOLEAN.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using BOOLEAN, + * so here we adjust the DEF accordingly. + */ +static void +FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BOOLEAN.free_struct; + td->print_struct = asn_DEF_BOOLEAN.print_struct; + td->check_constraints = asn_DEF_BOOLEAN.check_constraints; + td->ber_decoder = asn_DEF_BOOLEAN.ber_decoder; + td->der_encoder = asn_DEF_BOOLEAN.der_encoder; + td->xer_decoder = asn_DEF_BOOLEAN.xer_decoder; + td->xer_encoder = asn_DEF_BOOLEAN.xer_encoder; + td->uper_decoder = asn_DEF_BOOLEAN.uper_decoder; + td->uper_encoder = asn_DEF_BOOLEAN.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BOOLEAN.per_constraints; + td->elements = asn_DEF_BOOLEAN.elements; + td->elements_count = asn_DEF_BOOLEAN.elements_count; + td->specifics = asn_DEF_BOOLEAN.specifics; +} + +void +FANSCOMNAVApproachEquipmentAvailable_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSCOMNAVApproachEquipmentAvailable_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSCOMNAVApproachEquipmentAvailable_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSCOMNAVApproachEquipmentAvailable_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSCOMNAVApproachEquipmentAvailable_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSCOMNAVApproachEquipmentAvailable_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSCOMNAVApproachEquipmentAvailable_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSCOMNAVApproachEquipmentAvailable_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSCOMNAVApproachEquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSCOMNAVApproachEquipmentAvailable = { + "FANSCOMNAVApproachEquipmentAvailable", + "FANSCOMNAVApproachEquipmentAvailable", + FANSCOMNAVApproachEquipmentAvailable_free, + FANSCOMNAVApproachEquipmentAvailable_print, + FANSCOMNAVApproachEquipmentAvailable_constraint, + FANSCOMNAVApproachEquipmentAvailable_decode_ber, + FANSCOMNAVApproachEquipmentAvailable_encode_der, + FANSCOMNAVApproachEquipmentAvailable_decode_xer, + FANSCOMNAVApproachEquipmentAvailable_encode_xer, + FANSCOMNAVApproachEquipmentAvailable_decode_uper, + FANSCOMNAVApproachEquipmentAvailable_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1, + sizeof(asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1) + /sizeof(asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1[0]), /* 1 */ + asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1) + /sizeof(asn_DEF_FANSCOMNAVApproachEquipmentAvailable_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVApproachEquipmentAvailable.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVApproachEquipmentAvailable.h new file mode 100644 index 000000000..2d178f135 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVApproachEquipmentAvailable.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSCOMNAVApproachEquipmentAvailable_H_ +#define _FANSCOMNAVApproachEquipmentAvailable_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "BOOLEAN.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSCOMNAVApproachEquipmentAvailable */ +typedef BOOLEAN_t FANSCOMNAVApproachEquipmentAvailable_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSCOMNAVApproachEquipmentAvailable; +asn_struct_free_f FANSCOMNAVApproachEquipmentAvailable_free; +asn_struct_print_f FANSCOMNAVApproachEquipmentAvailable_print; +asn_constr_check_f FANSCOMNAVApproachEquipmentAvailable_constraint; +ber_type_decoder_f FANSCOMNAVApproachEquipmentAvailable_decode_ber; +der_type_encoder_f FANSCOMNAVApproachEquipmentAvailable_encode_der; +xer_type_decoder_f FANSCOMNAVApproachEquipmentAvailable_decode_xer; +xer_type_encoder_f FANSCOMNAVApproachEquipmentAvailable_encode_xer; +per_type_decoder_f FANSCOMNAVApproachEquipmentAvailable_decode_uper; +per_type_encoder_f FANSCOMNAVApproachEquipmentAvailable_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSCOMNAVApproachEquipmentAvailable_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatus.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatus.c new file mode 100644 index 000000000..7cf1f791b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatus.c @@ -0,0 +1,175 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSCOMNAVEquipmentStatus.h" + +int +FANSCOMNAVEquipmentStatus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSCOMNAVEquipmentStatus_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSCOMNAVEquipmentStatus_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSCOMNAVEquipmentStatus_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSCOMNAVEquipmentStatus_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSCOMNAVEquipmentStatus_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSCOMNAVEquipmentStatus_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSCOMNAVEquipmentStatus_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSCOMNAVEquipmentStatus_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSCOMNAVEquipmentStatus_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSCOMNAVEquipmentStatus_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSCOMNAVEquipmentStatus_value2enum_1[] = { + { 0, 7, "aloranA" }, + { 1, 7, "cloranC" }, + { 2, 4, "ddme" }, + { 3, 6, "edecca" }, + { 4, 4, "fadf" }, + { 5, 5, "ggnss" }, + { 6, 6, "hhfRTF" }, + { 7, 19, "iinertialNavigation" }, + { 8, 4, "lils" }, + { 9, 6, "momega" }, + { 10, 4, "ovor" }, + { 11, 8, "pdoppler" }, + { 12, 19, "rrnavRouteEquipment" }, + { 13, 6, "ttacan" }, + { 14, 7, "uuhfRTF" }, + { 15, 7, "vvhfRTF" } +}; +static const unsigned int asn_MAP_FANSCOMNAVEquipmentStatus_enum2value_1[] = { + 0, /* aloranA(0) */ + 1, /* cloranC(1) */ + 2, /* ddme(2) */ + 3, /* edecca(3) */ + 4, /* fadf(4) */ + 5, /* ggnss(5) */ + 6, /* hhfRTF(6) */ + 7, /* iinertialNavigation(7) */ + 8, /* lils(8) */ + 9, /* momega(9) */ + 10, /* ovor(10) */ + 11, /* pdoppler(11) */ + 12, /* rrnavRouteEquipment(12) */ + 13, /* ttacan(13) */ + 14, /* uuhfRTF(14) */ + 15 /* vvhfRTF(15) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSCOMNAVEquipmentStatus_specs_1 = { + asn_MAP_FANSCOMNAVEquipmentStatus_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSCOMNAVEquipmentStatus_enum2value_1, /* N => "tag"; sorted by N */ + 16, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSCOMNAVEquipmentStatus_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSCOMNAVEquipmentStatus = { + "FANSCOMNAVEquipmentStatus", + "FANSCOMNAVEquipmentStatus", + FANSCOMNAVEquipmentStatus_free, + FANSCOMNAVEquipmentStatus_print, + FANSCOMNAVEquipmentStatus_constraint, + FANSCOMNAVEquipmentStatus_decode_ber, + FANSCOMNAVEquipmentStatus_encode_der, + FANSCOMNAVEquipmentStatus_decode_xer, + FANSCOMNAVEquipmentStatus_encode_xer, + FANSCOMNAVEquipmentStatus_decode_uper, + FANSCOMNAVEquipmentStatus_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSCOMNAVEquipmentStatus_tags_1, + sizeof(asn_DEF_FANSCOMNAVEquipmentStatus_tags_1) + /sizeof(asn_DEF_FANSCOMNAVEquipmentStatus_tags_1[0]), /* 1 */ + asn_DEF_FANSCOMNAVEquipmentStatus_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSCOMNAVEquipmentStatus_tags_1) + /sizeof(asn_DEF_FANSCOMNAVEquipmentStatus_tags_1[0]), /* 1 */ + &asn_PER_type_FANSCOMNAVEquipmentStatus_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSCOMNAVEquipmentStatus_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatus.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatus.h new file mode 100644 index 000000000..1ce469bff --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatus.h @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSCOMNAVEquipmentStatus_H_ +#define _FANSCOMNAVEquipmentStatus_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSCOMNAVEquipmentStatus { + FANSCOMNAVEquipmentStatus_aloranA = 0, + FANSCOMNAVEquipmentStatus_cloranC = 1, + FANSCOMNAVEquipmentStatus_ddme = 2, + FANSCOMNAVEquipmentStatus_edecca = 3, + FANSCOMNAVEquipmentStatus_fadf = 4, + FANSCOMNAVEquipmentStatus_ggnss = 5, + FANSCOMNAVEquipmentStatus_hhfRTF = 6, + FANSCOMNAVEquipmentStatus_iinertialNavigation = 7, + FANSCOMNAVEquipmentStatus_lils = 8, + FANSCOMNAVEquipmentStatus_momega = 9, + FANSCOMNAVEquipmentStatus_ovor = 10, + FANSCOMNAVEquipmentStatus_pdoppler = 11, + FANSCOMNAVEquipmentStatus_rrnavRouteEquipment = 12, + FANSCOMNAVEquipmentStatus_ttacan = 13, + FANSCOMNAVEquipmentStatus_uuhfRTF = 14, + FANSCOMNAVEquipmentStatus_vvhfRTF = 15 +} e_FANSCOMNAVEquipmentStatus; + +/* FANSCOMNAVEquipmentStatus */ +typedef long FANSCOMNAVEquipmentStatus_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSCOMNAVEquipmentStatus; +asn_struct_free_f FANSCOMNAVEquipmentStatus_free; +asn_struct_print_f FANSCOMNAVEquipmentStatus_print; +asn_constr_check_f FANSCOMNAVEquipmentStatus_constraint; +ber_type_decoder_f FANSCOMNAVEquipmentStatus_decode_ber; +der_type_encoder_f FANSCOMNAVEquipmentStatus_encode_der; +xer_type_decoder_f FANSCOMNAVEquipmentStatus_decode_xer; +xer_type_encoder_f FANSCOMNAVEquipmentStatus_encode_xer; +per_type_decoder_f FANSCOMNAVEquipmentStatus_decode_uper; +per_type_encoder_f FANSCOMNAVEquipmentStatus_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSCOMNAVEquipmentStatus_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatusSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatusSequence.c new file mode 100644 index 000000000..b7cdbe7a9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatusSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSCOMNAVEquipmentStatusSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSCOMNAVEquipmentStatusSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSCOMNAVEquipmentStatusSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSCOMNAVEquipmentStatus, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSCOMNAVEquipmentStatusSequence_specs_1 = { + sizeof(struct FANSCOMNAVEquipmentStatusSequence), + offsetof(struct FANSCOMNAVEquipmentStatusSequence, _asn_ctx), + 1, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSCOMNAVEquipmentStatusSequence = { + "FANSCOMNAVEquipmentStatusSequence", + "FANSCOMNAVEquipmentStatusSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1, + sizeof(asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1) + /sizeof(asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1) + /sizeof(asn_DEF_FANSCOMNAVEquipmentStatusSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSCOMNAVEquipmentStatusSequence_constr_1, + asn_MBR_FANSCOMNAVEquipmentStatusSequence_1, + 1, /* Single element */ + &asn_SPC_FANSCOMNAVEquipmentStatusSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatusSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatusSequence.h new file mode 100644 index 000000000..19b05ec50 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSCOMNAVEquipmentStatusSequence.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSCOMNAVEquipmentStatusSequence_H_ +#define _FANSCOMNAVEquipmentStatusSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSCOMNAVEquipmentStatus.h" +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSCOMNAVEquipmentStatusSequence */ +typedef struct FANSCOMNAVEquipmentStatusSequence { + A_SEQUENCE_OF(FANSCOMNAVEquipmentStatus_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSCOMNAVEquipmentStatusSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSCOMNAVEquipmentStatusSequence; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSCOMNAVEquipmentStatusSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreeIncrement.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreeIncrement.c new file mode 100644 index 000000000..d7c6fe4c7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreeIncrement.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDegreeIncrement.h" + +int +FANSDegreeIncrement_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 20)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDegreeIncrement_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDegreeIncrement_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDegreeIncrement_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDegreeIncrement_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDegreeIncrement_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDegreeIncrement_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDegreeIncrement_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDegreeIncrement_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDegreeIncrement_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDegreeIncrement_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDegreeIncrement_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 1, 20 } /* (1..20) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDegreeIncrement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDegreeIncrement = { + "FANSDegreeIncrement", + "FANSDegreeIncrement", + FANSDegreeIncrement_free, + FANSDegreeIncrement_print, + FANSDegreeIncrement_constraint, + FANSDegreeIncrement_decode_ber, + FANSDegreeIncrement_encode_der, + FANSDegreeIncrement_decode_xer, + FANSDegreeIncrement_encode_xer, + FANSDegreeIncrement_decode_uper, + FANSDegreeIncrement_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDegreeIncrement_tags_1, + sizeof(asn_DEF_FANSDegreeIncrement_tags_1) + /sizeof(asn_DEF_FANSDegreeIncrement_tags_1[0]), /* 1 */ + asn_DEF_FANSDegreeIncrement_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDegreeIncrement_tags_1) + /sizeof(asn_DEF_FANSDegreeIncrement_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDegreeIncrement_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreeIncrement.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreeIncrement.h new file mode 100644 index 000000000..40225527c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreeIncrement.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDegreeIncrement_H_ +#define _FANSDegreeIncrement_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDegreeIncrement */ +typedef long FANSDegreeIncrement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDegreeIncrement; +asn_struct_free_f FANSDegreeIncrement_free; +asn_struct_print_f FANSDegreeIncrement_print; +asn_constr_check_f FANSDegreeIncrement_constraint; +ber_type_decoder_f FANSDegreeIncrement_decode_ber; +der_type_encoder_f FANSDegreeIncrement_encode_der; +xer_type_decoder_f FANSDegreeIncrement_decode_xer; +xer_type_encoder_f FANSDegreeIncrement_encode_xer; +per_type_decoder_f FANSDegreeIncrement_decode_uper; +per_type_encoder_f FANSDegreeIncrement_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDegreeIncrement_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegrees.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegrees.c new file mode 100644 index 000000000..7bab20937 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegrees.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDegrees.h" + +static asn_per_constraints_t asn_PER_type_FANSDegrees_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSDegrees_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSDegrees, choice.degreesMagnetic), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDegreesMagnetic, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degreesMagnetic" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSDegrees, choice.degreesTrue), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDegreesTrue, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degreesTrue" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSDegrees_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* degreesTrue */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSDegrees_specs_1 = { + sizeof(struct FANSDegrees), + offsetof(struct FANSDegrees, _asn_ctx), + offsetof(struct FANSDegrees, present), + sizeof(((struct FANSDegrees *)0)->present), + asn_MAP_FANSDegrees_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSDegrees = { + "FANSDegrees", + "FANSDegrees", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSDegrees_constr_1, + asn_MBR_FANSDegrees_1, + 2, /* Elements count */ + &asn_SPC_FANSDegrees_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegrees.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegrees.h new file mode 100644 index 000000000..07a8df2ce --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegrees.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDegrees_H_ +#define _FANSDegrees_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDegreesMagnetic.h" +#include "FANSDegreesTrue.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSDegrees_PR { + FANSDegrees_PR_NOTHING, /* No components present */ + FANSDegrees_PR_degreesMagnetic, + FANSDegrees_PR_degreesTrue +} FANSDegrees_PR; + +/* FANSDegrees */ +typedef struct FANSDegrees { + FANSDegrees_PR present; + union FANSDegrees_u { + FANSDegreesMagnetic_t degreesMagnetic; + FANSDegreesTrue_t degreesTrue; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSDegrees_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDegrees; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDegrees_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesMagnetic.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesMagnetic.c new file mode 100644 index 000000000..609a25d0f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesMagnetic.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDegreesMagnetic.h" + +int +FANSDegreesMagnetic_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 360)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDegreesMagnetic_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDegreesMagnetic_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDegreesMagnetic_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDegreesMagnetic_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDegreesMagnetic_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDegreesMagnetic_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDegreesMagnetic_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDegreesMagnetic_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDegreesMagnetic_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDegreesMagnetic_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDegreesMagnetic_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 1, 360 } /* (1..360) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDegreesMagnetic_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDegreesMagnetic = { + "FANSDegreesMagnetic", + "FANSDegreesMagnetic", + FANSDegreesMagnetic_free, + FANSDegreesMagnetic_print, + FANSDegreesMagnetic_constraint, + FANSDegreesMagnetic_decode_ber, + FANSDegreesMagnetic_encode_der, + FANSDegreesMagnetic_decode_xer, + FANSDegreesMagnetic_encode_xer, + FANSDegreesMagnetic_decode_uper, + FANSDegreesMagnetic_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDegreesMagnetic_tags_1, + sizeof(asn_DEF_FANSDegreesMagnetic_tags_1) + /sizeof(asn_DEF_FANSDegreesMagnetic_tags_1[0]), /* 1 */ + asn_DEF_FANSDegreesMagnetic_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDegreesMagnetic_tags_1) + /sizeof(asn_DEF_FANSDegreesMagnetic_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDegreesMagnetic_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesMagnetic.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesMagnetic.h new file mode 100644 index 000000000..6963a9329 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesMagnetic.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDegreesMagnetic_H_ +#define _FANSDegreesMagnetic_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDegreesMagnetic */ +typedef long FANSDegreesMagnetic_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDegreesMagnetic; +asn_struct_free_f FANSDegreesMagnetic_free; +asn_struct_print_f FANSDegreesMagnetic_print; +asn_constr_check_f FANSDegreesMagnetic_constraint; +ber_type_decoder_f FANSDegreesMagnetic_decode_ber; +der_type_encoder_f FANSDegreesMagnetic_encode_der; +xer_type_decoder_f FANSDegreesMagnetic_decode_xer; +xer_type_encoder_f FANSDegreesMagnetic_encode_xer; +per_type_decoder_f FANSDegreesMagnetic_decode_uper; +per_type_encoder_f FANSDegreesMagnetic_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDegreesMagnetic_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesTrue.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesTrue.c new file mode 100644 index 000000000..22c6eb503 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesTrue.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDegreesTrue.h" + +int +FANSDegreesTrue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 360)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDegreesTrue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDegreesTrue_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDegreesTrue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDegreesTrue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDegreesTrue_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDegreesTrue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDegreesTrue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDegreesTrue_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDegreesTrue_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDegreesTrue_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDegreesTrue_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 1, 360 } /* (1..360) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDegreesTrue_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDegreesTrue = { + "FANSDegreesTrue", + "FANSDegreesTrue", + FANSDegreesTrue_free, + FANSDegreesTrue_print, + FANSDegreesTrue_constraint, + FANSDegreesTrue_decode_ber, + FANSDegreesTrue_encode_der, + FANSDegreesTrue_decode_xer, + FANSDegreesTrue_encode_xer, + FANSDegreesTrue_decode_uper, + FANSDegreesTrue_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDegreesTrue_tags_1, + sizeof(asn_DEF_FANSDegreesTrue_tags_1) + /sizeof(asn_DEF_FANSDegreesTrue_tags_1[0]), /* 1 */ + asn_DEF_FANSDegreesTrue_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDegreesTrue_tags_1) + /sizeof(asn_DEF_FANSDegreesTrue_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDegreesTrue_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesTrue.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesTrue.h new file mode 100644 index 000000000..5458bf240 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDegreesTrue.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDegreesTrue_H_ +#define _FANSDegreesTrue_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDegreesTrue */ +typedef long FANSDegreesTrue_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDegreesTrue; +asn_struct_free_f FANSDegreesTrue_free; +asn_struct_print_f FANSDegreesTrue_print; +asn_constr_check_f FANSDegreesTrue_constraint; +ber_type_decoder_f FANSDegreesTrue_decode_ber; +der_type_encoder_f FANSDegreesTrue_encode_der; +xer_type_decoder_f FANSDegreesTrue_decode_xer; +xer_type_encoder_f FANSDegreesTrue_encode_xer; +per_type_decoder_f FANSDegreesTrue_decode_uper; +per_type_encoder_f FANSDegreesTrue_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDegreesTrue_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirection.c new file mode 100644 index 000000000..b3ac8e217 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirection.c @@ -0,0 +1,165 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDirection.h" + +int +FANSDirection_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSDirection_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSDirection_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDirection_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDirection_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDirection_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDirection_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDirection_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDirection_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDirection_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDirection_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDirection_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDirection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSDirection_value2enum_1[] = { + { 0, 4, "left" }, + { 1, 5, "right" }, + { 2, 10, "eitherSide" }, + { 3, 5, "north" }, + { 4, 5, "south" }, + { 5, 4, "east" }, + { 6, 4, "west" }, + { 7, 9, "northEast" }, + { 8, 9, "northWest" }, + { 9, 9, "southEast" }, + { 10, 9, "southWest" } +}; +static const unsigned int asn_MAP_FANSDirection_enum2value_1[] = { + 5, /* east(5) */ + 2, /* eitherSide(2) */ + 0, /* left(0) */ + 3, /* north(3) */ + 7, /* northEast(7) */ + 8, /* northWest(8) */ + 1, /* right(1) */ + 4, /* south(4) */ + 9, /* southEast(9) */ + 10, /* southWest(10) */ + 6 /* west(6) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSDirection_specs_1 = { + asn_MAP_FANSDirection_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSDirection_enum2value_1, /* N => "tag"; sorted by N */ + 11, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDirection = { + "FANSDirection", + "FANSDirection", + FANSDirection_free, + FANSDirection_print, + FANSDirection_constraint, + FANSDirection_decode_ber, + FANSDirection_encode_der, + FANSDirection_decode_xer, + FANSDirection_encode_xer, + FANSDirection_decode_uper, + FANSDirection_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDirection_tags_1, + sizeof(asn_DEF_FANSDirection_tags_1) + /sizeof(asn_DEF_FANSDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDirection_tags_1) + /sizeof(asn_DEF_FANSDirection_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDirection_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirection.h new file mode 100644 index 000000000..35f33dffc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirection.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDirection_H_ +#define _FANSDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSDirection { + FANSDirection_left = 0, + FANSDirection_right = 1, + FANSDirection_eitherSide = 2, + FANSDirection_north = 3, + FANSDirection_south = 4, + FANSDirection_east = 5, + FANSDirection_west = 6, + FANSDirection_northEast = 7, + FANSDirection_northWest = 8, + FANSDirection_southEast = 9, + FANSDirection_southWest = 10 +} e_FANSDirection; + +/* FANSDirection */ +typedef long FANSDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDirection; +asn_struct_free_f FANSDirection_free; +asn_struct_print_f FANSDirection_print; +asn_constr_check_f FANSDirection_constraint; +ber_type_decoder_f FANSDirection_decode_ber; +der_type_encoder_f FANSDirection_encode_der; +xer_type_decoder_f FANSDirection_decode_xer; +xer_type_encoder_f FANSDirection_encode_xer; +per_type_decoder_f FANSDirection_decode_uper; +per_type_encoder_f FANSDirection_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDirectionDegrees.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirectionDegrees.c new file mode 100644 index 000000000..79d180be5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirectionDegrees.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDirectionDegrees.h" + +static asn_TYPE_member_t asn_MBR_FANSDirectionDegrees_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSDirectionDegrees, direction), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "direction" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSDirectionDegrees, degrees), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSDirectionDegrees_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSDirectionDegrees_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* direction */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* degreesTrue */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSDirectionDegrees_specs_1 = { + sizeof(struct FANSDirectionDegrees), + offsetof(struct FANSDirectionDegrees, _asn_ctx), + asn_MAP_FANSDirectionDegrees_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSDirectionDegrees = { + "FANSDirectionDegrees", + "FANSDirectionDegrees", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDirectionDegrees_tags_1, + sizeof(asn_DEF_FANSDirectionDegrees_tags_1) + /sizeof(asn_DEF_FANSDirectionDegrees_tags_1[0]), /* 1 */ + asn_DEF_FANSDirectionDegrees_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDirectionDegrees_tags_1) + /sizeof(asn_DEF_FANSDirectionDegrees_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSDirectionDegrees_1, + 2, /* Elements count */ + &asn_SPC_FANSDirectionDegrees_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDirectionDegrees.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirectionDegrees.h new file mode 100644 index 000000000..5bd154ccb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDirectionDegrees.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDirectionDegrees_H_ +#define _FANSDirectionDegrees_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDirection.h" +#include "FANSDegrees.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDirectionDegrees */ +typedef struct FANSDirectionDegrees { + FANSDirection_t direction; + FANSDegrees_t degrees; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSDirectionDegrees_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDirectionDegrees; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDirectionDegrees_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistance.c new file mode 100644 index 000000000..2b8d039df --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistance.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistance.h" + +static asn_per_constraints_t asn_PER_type_FANSDistance_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSDistance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSDistance, choice.distanceNm), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceNm, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceNm" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSDistance, choice.distanceKm), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceKm, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceKm" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSDistance_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* distanceNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* distanceKm */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSDistance_specs_1 = { + sizeof(struct FANSDistance), + offsetof(struct FANSDistance, _asn_ctx), + offsetof(struct FANSDistance, present), + sizeof(((struct FANSDistance *)0)->present), + asn_MAP_FANSDistance_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistance = { + "FANSDistance", + "FANSDistance", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSDistance_constr_1, + asn_MBR_FANSDistance_1, + 2, /* Elements count */ + &asn_SPC_FANSDistance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistance.h new file mode 100644 index 000000000..648db784a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistance.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistance_H_ +#define _FANSDistance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDistanceNm.h" +#include "FANSDistanceKm.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSDistance_PR { + FANSDistance_PR_NOTHING, /* No components present */ + FANSDistance_PR_distanceNm, + FANSDistance_PR_distanceKm +} FANSDistance_PR; + +/* FANSDistance */ +typedef struct FANSDistance { + FANSDistance_PR present; + union FANSDistance_u { + FANSDistanceNm_t distanceNm; + FANSDistanceKm_t distanceKm; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSDistance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistance; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceKm.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceKm.c new file mode 100644 index 000000000..6b0453c06 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceKm.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistanceKm.h" + +int +FANSDistanceKm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 1024)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDistanceKm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDistanceKm_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDistanceKm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceKm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDistanceKm_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceKm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDistanceKm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceKm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDistanceKm_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDistanceKm_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDistanceKm_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 1, 1024 } /* (1..1024) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDistanceKm_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistanceKm = { + "FANSDistanceKm", + "FANSDistanceKm", + FANSDistanceKm_free, + FANSDistanceKm_print, + FANSDistanceKm_constraint, + FANSDistanceKm_decode_ber, + FANSDistanceKm_encode_der, + FANSDistanceKm_decode_xer, + FANSDistanceKm_encode_xer, + FANSDistanceKm_decode_uper, + FANSDistanceKm_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDistanceKm_tags_1, + sizeof(asn_DEF_FANSDistanceKm_tags_1) + /sizeof(asn_DEF_FANSDistanceKm_tags_1[0]), /* 1 */ + asn_DEF_FANSDistanceKm_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDistanceKm_tags_1) + /sizeof(asn_DEF_FANSDistanceKm_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDistanceKm_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceKm.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceKm.h new file mode 100644 index 000000000..cc8d5a729 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceKm.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistanceKm_H_ +#define _FANSDistanceKm_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDistanceKm */ +typedef long FANSDistanceKm_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistanceKm; +asn_struct_free_f FANSDistanceKm_free; +asn_struct_print_f FANSDistanceKm_print; +asn_constr_check_f FANSDistanceKm_constraint; +ber_type_decoder_f FANSDistanceKm_decode_ber; +der_type_encoder_f FANSDistanceKm_encode_der; +xer_type_decoder_f FANSDistanceKm_decode_xer; +xer_type_encoder_f FANSDistanceKm_encode_xer; +per_type_decoder_f FANSDistanceKm_decode_uper; +per_type_encoder_f FANSDistanceKm_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistanceKm_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceNm.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceNm.c new file mode 100644 index 000000000..c6d6e30db --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceNm.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistanceNm.h" + +int +FANSDistanceNm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 9999)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDistanceNm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDistanceNm_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDistanceNm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceNm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDistanceNm_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceNm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDistanceNm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceNm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDistanceNm_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDistanceNm_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDistanceNm_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 14, 14, 0, 9999 } /* (0..9999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDistanceNm_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistanceNm = { + "FANSDistanceNm", + "FANSDistanceNm", + FANSDistanceNm_free, + FANSDistanceNm_print, + FANSDistanceNm_constraint, + FANSDistanceNm_decode_ber, + FANSDistanceNm_encode_der, + FANSDistanceNm_decode_xer, + FANSDistanceNm_encode_xer, + FANSDistanceNm_decode_uper, + FANSDistanceNm_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDistanceNm_tags_1, + sizeof(asn_DEF_FANSDistanceNm_tags_1) + /sizeof(asn_DEF_FANSDistanceNm_tags_1[0]), /* 1 */ + asn_DEF_FANSDistanceNm_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDistanceNm_tags_1) + /sizeof(asn_DEF_FANSDistanceNm_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDistanceNm_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceNm.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceNm.h new file mode 100644 index 000000000..84c9de36c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceNm.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistanceNm_H_ +#define _FANSDistanceNm_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDistanceNm */ +typedef long FANSDistanceNm_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistanceNm; +asn_struct_free_f FANSDistanceNm_free; +asn_struct_print_f FANSDistanceNm_print; +asn_constr_check_f FANSDistanceNm_constraint; +ber_type_decoder_f FANSDistanceNm_decode_ber; +der_type_encoder_f FANSDistanceNm_encode_der; +xer_type_decoder_f FANSDistanceNm_decode_xer; +xer_type_encoder_f FANSDistanceNm_encode_xer; +per_type_decoder_f FANSDistanceNm_decode_uper; +per_type_encoder_f FANSDistanceNm_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistanceNm_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffset.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffset.c new file mode 100644 index 000000000..c2243e566 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffset.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistanceOffset.h" + +static asn_per_constraints_t asn_PER_type_FANSDistanceOffset_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSDistanceOffset_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSDistanceOffset, choice.distanceOffsetNm), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetNm, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceOffsetNm" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSDistanceOffset, choice.distanceOffsetKm), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDistanceOffsetKm, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceOffsetKm" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSDistanceOffset_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* distanceOffsetNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* distanceOffsetKm */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSDistanceOffset_specs_1 = { + sizeof(struct FANSDistanceOffset), + offsetof(struct FANSDistanceOffset, _asn_ctx), + offsetof(struct FANSDistanceOffset, present), + sizeof(((struct FANSDistanceOffset *)0)->present), + asn_MAP_FANSDistanceOffset_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffset = { + "FANSDistanceOffset", + "FANSDistanceOffset", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSDistanceOffset_constr_1, + asn_MBR_FANSDistanceOffset_1, + 2, /* Elements count */ + &asn_SPC_FANSDistanceOffset_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffset.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffset.h new file mode 100644 index 000000000..05728994d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffset.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistanceOffset_H_ +#define _FANSDistanceOffset_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDistanceOffsetNm.h" +#include "FANSDistanceOffsetKm.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSDistanceOffset_PR { + FANSDistanceOffset_PR_NOTHING, /* No components present */ + FANSDistanceOffset_PR_distanceOffsetNm, + FANSDistanceOffset_PR_distanceOffsetKm +} FANSDistanceOffset_PR; + +/* FANSDistanceOffset */ +typedef struct FANSDistanceOffset { + FANSDistanceOffset_PR present; + union FANSDistanceOffset_u { + FANSDistanceOffsetNm_t distanceOffsetNm; + FANSDistanceOffsetKm_t distanceOffsetKm; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSDistanceOffset_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffset; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistanceOffset_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetDirection.c new file mode 100644 index 000000000..7542d989a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetDirection.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistanceOffsetDirection.h" + +static asn_TYPE_member_t asn_MBR_FANSDistanceOffsetDirection_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSDistanceOffsetDirection, distanceOffset), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDistanceOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSDistanceOffsetDirection, direction), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "direction" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSDistanceOffsetDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSDistanceOffsetDirection_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 }, /* direction */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* distanceOffsetNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 } /* distanceOffsetKm */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSDistanceOffsetDirection_specs_1 = { + sizeof(struct FANSDistanceOffsetDirection), + offsetof(struct FANSDistanceOffsetDirection, _asn_ctx), + asn_MAP_FANSDistanceOffsetDirection_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffsetDirection = { + "FANSDistanceOffsetDirection", + "FANSDistanceOffsetDirection", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDistanceOffsetDirection_tags_1, + sizeof(asn_DEF_FANSDistanceOffsetDirection_tags_1) + /sizeof(asn_DEF_FANSDistanceOffsetDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSDistanceOffsetDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDistanceOffsetDirection_tags_1) + /sizeof(asn_DEF_FANSDistanceOffsetDirection_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSDistanceOffsetDirection_1, + 2, /* Elements count */ + &asn_SPC_FANSDistanceOffsetDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetDirection.h new file mode 100644 index 000000000..c248b6535 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetDirection.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistanceOffsetDirection_H_ +#define _FANSDistanceOffsetDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDistanceOffset.h" +#include "FANSDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDistanceOffsetDirection */ +typedef struct FANSDistanceOffsetDirection { + FANSDistanceOffset_t distanceOffset; + FANSDirection_t direction; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSDistanceOffsetDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffsetDirection; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistanceOffsetDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetKm.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetKm.c new file mode 100644 index 000000000..d3fb013b3 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetKm.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistanceOffsetKm.h" + +int +FANSDistanceOffsetKm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 256)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDistanceOffsetKm_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDistanceOffsetKm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceOffsetKm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDistanceOffsetKm_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceOffsetKm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDistanceOffsetKm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceOffsetKm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDistanceOffsetKm_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDistanceOffsetKm_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDistanceOffsetKm_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 1, 256 } /* (1..256) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDistanceOffsetKm_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffsetKm = { + "FANSDistanceOffsetKm", + "FANSDistanceOffsetKm", + FANSDistanceOffsetKm_free, + FANSDistanceOffsetKm_print, + FANSDistanceOffsetKm_constraint, + FANSDistanceOffsetKm_decode_ber, + FANSDistanceOffsetKm_encode_der, + FANSDistanceOffsetKm_decode_xer, + FANSDistanceOffsetKm_encode_xer, + FANSDistanceOffsetKm_decode_uper, + FANSDistanceOffsetKm_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDistanceOffsetKm_tags_1, + sizeof(asn_DEF_FANSDistanceOffsetKm_tags_1) + /sizeof(asn_DEF_FANSDistanceOffsetKm_tags_1[0]), /* 1 */ + asn_DEF_FANSDistanceOffsetKm_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDistanceOffsetKm_tags_1) + /sizeof(asn_DEF_FANSDistanceOffsetKm_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDistanceOffsetKm_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetKm.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetKm.h new file mode 100644 index 000000000..a87da627c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetKm.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistanceOffsetKm_H_ +#define _FANSDistanceOffsetKm_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDistanceOffsetKm */ +typedef long FANSDistanceOffsetKm_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffsetKm; +asn_struct_free_f FANSDistanceOffsetKm_free; +asn_struct_print_f FANSDistanceOffsetKm_print; +asn_constr_check_f FANSDistanceOffsetKm_constraint; +ber_type_decoder_f FANSDistanceOffsetKm_decode_ber; +der_type_encoder_f FANSDistanceOffsetKm_encode_der; +xer_type_decoder_f FANSDistanceOffsetKm_decode_xer; +xer_type_encoder_f FANSDistanceOffsetKm_encode_xer; +per_type_decoder_f FANSDistanceOffsetKm_decode_uper; +per_type_encoder_f FANSDistanceOffsetKm_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistanceOffsetKm_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetNm.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetNm.c new file mode 100644 index 000000000..f4deeb961 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetNm.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSDistanceOffsetNm.h" + +int +FANSDistanceOffsetNm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 128)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSDistanceOffsetNm_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSDistanceOffsetNm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceOffsetNm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSDistanceOffsetNm_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceOffsetNm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSDistanceOffsetNm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSDistanceOffsetNm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSDistanceOffsetNm_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSDistanceOffsetNm_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSDistanceOffsetNm_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 1, 128 } /* (1..128) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSDistanceOffsetNm_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffsetNm = { + "FANSDistanceOffsetNm", + "FANSDistanceOffsetNm", + FANSDistanceOffsetNm_free, + FANSDistanceOffsetNm_print, + FANSDistanceOffsetNm_constraint, + FANSDistanceOffsetNm_decode_ber, + FANSDistanceOffsetNm_encode_der, + FANSDistanceOffsetNm_decode_xer, + FANSDistanceOffsetNm_encode_xer, + FANSDistanceOffsetNm_decode_uper, + FANSDistanceOffsetNm_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSDistanceOffsetNm_tags_1, + sizeof(asn_DEF_FANSDistanceOffsetNm_tags_1) + /sizeof(asn_DEF_FANSDistanceOffsetNm_tags_1[0]), /* 1 */ + asn_DEF_FANSDistanceOffsetNm_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSDistanceOffsetNm_tags_1) + /sizeof(asn_DEF_FANSDistanceOffsetNm_tags_1[0]), /* 1 */ + &asn_PER_type_FANSDistanceOffsetNm_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetNm.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetNm.h new file mode 100644 index 000000000..d588f7d48 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSDistanceOffsetNm.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSDistanceOffsetNm_H_ +#define _FANSDistanceOffsetNm_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSDistanceOffsetNm */ +typedef long FANSDistanceOffsetNm_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSDistanceOffsetNm; +asn_struct_free_f FANSDistanceOffsetNm_free; +asn_struct_print_f FANSDistanceOffsetNm_print; +asn_constr_check_f FANSDistanceOffsetNm_constraint; +ber_type_decoder_f FANSDistanceOffsetNm_decode_ber; +der_type_encoder_f FANSDistanceOffsetNm_encode_der; +xer_type_decoder_f FANSDistanceOffsetNm_decode_xer; +xer_type_encoder_f FANSDistanceOffsetNm_encode_xer; +per_type_decoder_f FANSDistanceOffsetNm_decode_uper; +per_type_encoder_f FANSDistanceOffsetNm_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSDistanceOffsetNm_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSEFCtime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSEFCtime.c new file mode 100644 index 000000000..0fb4a61e5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSEFCtime.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSEFCtime.h" + +int +FANSEFCtime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSTime.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSTime, + * so here we adjust the DEF accordingly. + */ +static void +FANSEFCtime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSTime.free_struct; + td->print_struct = asn_DEF_FANSTime.print_struct; + td->check_constraints = asn_DEF_FANSTime.check_constraints; + td->ber_decoder = asn_DEF_FANSTime.ber_decoder; + td->der_encoder = asn_DEF_FANSTime.der_encoder; + td->xer_decoder = asn_DEF_FANSTime.xer_decoder; + td->xer_encoder = asn_DEF_FANSTime.xer_encoder; + td->uper_decoder = asn_DEF_FANSTime.uper_decoder; + td->uper_encoder = asn_DEF_FANSTime.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSTime.per_constraints; + td->elements = asn_DEF_FANSTime.elements; + td->elements_count = asn_DEF_FANSTime.elements_count; + td->specifics = asn_DEF_FANSTime.specifics; +} + +void +FANSEFCtime_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSEFCtime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSEFCtime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSEFCtime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSEFCtime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSEFCtime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSEFCtime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSEFCtime_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSEFCtime_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSEFCtime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSEFCtime = { + "FANSEFCtime", + "FANSEFCtime", + FANSEFCtime_free, + FANSEFCtime_print, + FANSEFCtime_constraint, + FANSEFCtime_decode_ber, + FANSEFCtime_encode_der, + FANSEFCtime_decode_xer, + FANSEFCtime_encode_xer, + FANSEFCtime_decode_uper, + FANSEFCtime_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSEFCtime_tags_1, + sizeof(asn_DEF_FANSEFCtime_tags_1) + /sizeof(asn_DEF_FANSEFCtime_tags_1[0]), /* 1 */ + asn_DEF_FANSEFCtime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSEFCtime_tags_1) + /sizeof(asn_DEF_FANSEFCtime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSEFCtime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSEFCtime.h new file mode 100644 index 000000000..035a4e29a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSEFCtime.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSEFCtime_H_ +#define _FANSEFCtime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSEFCtime */ +typedef FANSTime_t FANSEFCtime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSEFCtime; +asn_struct_free_f FANSEFCtime_free; +asn_struct_print_f FANSEFCtime_print; +asn_constr_check_f FANSEFCtime_constraint; +ber_type_decoder_f FANSEFCtime_decode_ber; +der_type_encoder_f FANSEFCtime_encode_der; +xer_type_decoder_f FANSEFCtime_decode_xer; +xer_type_encoder_f FANSEFCtime_encode_xer; +per_type_decoder_f FANSEFCtime_decode_uper; +per_type_encoder_f FANSEFCtime_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSEFCtime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSErrorInformation.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSErrorInformation.c new file mode 100644 index 000000000..f3cd9853f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSErrorInformation.c @@ -0,0 +1,177 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSErrorInformation.h" + +int +FANSErrorInformation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSErrorInformation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSErrorInformation_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSErrorInformation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSErrorInformation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSErrorInformation_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSErrorInformation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSErrorInformation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSErrorInformation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSErrorInformation_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSErrorInformation_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSErrorInformation_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 0, 16 } /* (0..16) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSErrorInformation_value2enum_1[] = { + { 0, 16, "applicationError" }, + { 1, 32, "duplicateMsgIdentificationNumber" }, + { 2, 30, "unrecognizedMsgReferenceNumber" }, + { 3, 25, "endServiceWithPendingMsgs" }, + { 4, 29, "endServiceWithNoValidResponse" }, + { 5, 30, "insufficientMsgStorageCapacity" }, + { 6, 34, "noAvailableMsgIdentificationNumber" }, + { 7, 20, "commandedTermination" }, + { 8, 16, "insufficientData" }, + { 9, 14, "unexpectedData" }, + { 10, 11, "invalidData" }, + { 11, 17, "reservedErrorMsg1" }, + { 12, 17, "reservedErrorMsg2" }, + { 13, 17, "reservedErrorMsg3" }, + { 14, 17, "reservedErrorMsg4" }, + { 15, 17, "reservedErrorMsg5" }, + { 16, 17, "reservedErrorMsg6" } +}; +static const unsigned int asn_MAP_FANSErrorInformation_enum2value_1[] = { + 0, /* applicationError(0) */ + 7, /* commandedTermination(7) */ + 1, /* duplicateMsgIdentificationNumber(1) */ + 4, /* endServiceWithNoValidResponse(4) */ + 3, /* endServiceWithPendingMsgs(3) */ + 8, /* insufficientData(8) */ + 5, /* insufficientMsgStorageCapacity(5) */ + 10, /* invalidData(10) */ + 6, /* noAvailableMsgIdentificationNumber(6) */ + 11, /* reservedErrorMsg1(11) */ + 12, /* reservedErrorMsg2(12) */ + 13, /* reservedErrorMsg3(13) */ + 14, /* reservedErrorMsg4(14) */ + 15, /* reservedErrorMsg5(15) */ + 16, /* reservedErrorMsg6(16) */ + 9, /* unexpectedData(9) */ + 2 /* unrecognizedMsgReferenceNumber(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSErrorInformation_specs_1 = { + asn_MAP_FANSErrorInformation_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSErrorInformation_enum2value_1, /* N => "tag"; sorted by N */ + 17, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSErrorInformation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSErrorInformation = { + "FANSErrorInformation", + "FANSErrorInformation", + FANSErrorInformation_free, + FANSErrorInformation_print, + FANSErrorInformation_constraint, + FANSErrorInformation_decode_ber, + FANSErrorInformation_encode_der, + FANSErrorInformation_decode_xer, + FANSErrorInformation_encode_xer, + FANSErrorInformation_decode_uper, + FANSErrorInformation_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSErrorInformation_tags_1, + sizeof(asn_DEF_FANSErrorInformation_tags_1) + /sizeof(asn_DEF_FANSErrorInformation_tags_1[0]), /* 1 */ + asn_DEF_FANSErrorInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSErrorInformation_tags_1) + /sizeof(asn_DEF_FANSErrorInformation_tags_1[0]), /* 1 */ + &asn_PER_type_FANSErrorInformation_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSErrorInformation_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSErrorInformation.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSErrorInformation.h new file mode 100644 index 000000000..168f14575 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSErrorInformation.h @@ -0,0 +1,62 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSErrorInformation_H_ +#define _FANSErrorInformation_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSErrorInformation { + FANSErrorInformation_applicationError = 0, + FANSErrorInformation_duplicateMsgIdentificationNumber = 1, + FANSErrorInformation_unrecognizedMsgReferenceNumber = 2, + FANSErrorInformation_endServiceWithPendingMsgs = 3, + FANSErrorInformation_endServiceWithNoValidResponse = 4, + FANSErrorInformation_insufficientMsgStorageCapacity = 5, + FANSErrorInformation_noAvailableMsgIdentificationNumber = 6, + FANSErrorInformation_commandedTermination = 7, + FANSErrorInformation_insufficientData = 8, + FANSErrorInformation_unexpectedData = 9, + FANSErrorInformation_invalidData = 10, + FANSErrorInformation_reservedErrorMsg1 = 11, + FANSErrorInformation_reservedErrorMsg2 = 12, + FANSErrorInformation_reservedErrorMsg3 = 13, + FANSErrorInformation_reservedErrorMsg4 = 14, + FANSErrorInformation_reservedErrorMsg5 = 15, + FANSErrorInformation_reservedErrorMsg6 = 16 +} e_FANSErrorInformation; + +/* FANSErrorInformation */ +typedef long FANSErrorInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSErrorInformation; +asn_struct_free_f FANSErrorInformation_free; +asn_struct_print_f FANSErrorInformation_print; +asn_constr_check_f FANSErrorInformation_constraint; +ber_type_decoder_f FANSErrorInformation_decode_ber; +der_type_encoder_f FANSErrorInformation_encode_der; +xer_type_decoder_f FANSErrorInformation_decode_xer; +xer_type_encoder_f FANSErrorInformation_encode_xer; +per_type_decoder_f FANSErrorInformation_decode_uper; +per_type_encoder_f FANSErrorInformation_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSErrorInformation_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFixName.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixName.c new file mode 100644 index 000000000..ae0cbb8c3 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixName.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFixName.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSFixName_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 5) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSFixName_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSFixName_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFixName_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFixName_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFixName_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFixName_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFixName_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFixName_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFixName_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFixName_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFixName_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFixName_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSFixName_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFixName = { + "FANSFixName", + "FANSFixName", + FANSFixName_free, + FANSFixName_print, + FANSFixName_constraint, + FANSFixName_decode_ber, + FANSFixName_encode_der, + FANSFixName_decode_xer, + FANSFixName_encode_xer, + FANSFixName_decode_uper, + FANSFixName_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFixName_tags_1, + sizeof(asn_DEF_FANSFixName_tags_1) + /sizeof(asn_DEF_FANSFixName_tags_1[0]), /* 1 */ + asn_DEF_FANSFixName_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFixName_tags_1) + /sizeof(asn_DEF_FANSFixName_tags_1[0]), /* 1 */ + &asn_PER_type_FANSFixName_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFixName.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixName.h new file mode 100644 index 000000000..5c9a7f81a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixName.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFixName_H_ +#define _FANSFixName_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFixName */ +typedef IA5String_t FANSFixName_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFixName; +asn_struct_free_f FANSFixName_free; +asn_struct_print_f FANSFixName_print; +asn_constr_check_f FANSFixName_constraint; +ber_type_decoder_f FANSFixName_decode_ber; +der_type_encoder_f FANSFixName_encode_der; +xer_type_decoder_f FANSFixName_decode_xer; +xer_type_encoder_f FANSFixName_encode_xer; +per_type_decoder_f FANSFixName_decode_uper; +per_type_encoder_f FANSFixName_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFixName_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNext.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNext.c new file mode 100644 index 000000000..cf3753ff8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNext.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFixNext.h" + +int +FANSFixNext_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSPosition, + * so here we adjust the DEF accordingly. + */ +static void +FANSFixNext_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSPosition.free_struct; + td->print_struct = asn_DEF_FANSPosition.print_struct; + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + td->ber_decoder = asn_DEF_FANSPosition.ber_decoder; + td->der_encoder = asn_DEF_FANSPosition.der_encoder; + td->xer_decoder = asn_DEF_FANSPosition.xer_decoder; + td->xer_encoder = asn_DEF_FANSPosition.xer_encoder; + td->uper_decoder = asn_DEF_FANSPosition.uper_decoder; + td->uper_encoder = asn_DEF_FANSPosition.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSPosition.per_constraints; + td->elements = asn_DEF_FANSPosition.elements; + td->elements_count = asn_DEF_FANSPosition.elements_count; + td->specifics = asn_DEF_FANSPosition.specifics; +} + +void +FANSFixNext_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFixNext_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFixNext_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFixNext_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFixNext_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFixNext_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFixNext_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFixNext_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFixNext_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFixNext_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSFixNext = { + "FANSFixNext", + "FANSFixNext", + FANSFixNext_free, + FANSFixNext_print, + FANSFixNext_constraint, + FANSFixNext_decode_ber, + FANSFixNext_encode_der, + FANSFixNext_decode_xer, + FANSFixNext_encode_xer, + FANSFixNext_decode_uper, + FANSFixNext_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNext.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNext.h new file mode 100644 index 000000000..9af0c93e1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNext.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFixNext_H_ +#define _FANSFixNext_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFixNext */ +typedef FANSPosition_t FANSFixNext_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFixNext; +asn_struct_free_f FANSFixNext_free; +asn_struct_print_f FANSFixNext_print; +asn_constr_check_f FANSFixNext_constraint; +ber_type_decoder_f FANSFixNext_decode_ber; +der_type_encoder_f FANSFixNext_encode_der; +xer_type_decoder_f FANSFixNext_decode_xer; +xer_type_encoder_f FANSFixNext_encode_xer; +per_type_decoder_f FANSFixNext_decode_uper; +per_type_encoder_f FANSFixNext_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFixNext_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNextPlusOne.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNextPlusOne.c new file mode 100644 index 000000000..dd4b31a3d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNextPlusOne.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFixNextPlusOne.h" + +int +FANSFixNextPlusOne_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSPosition, + * so here we adjust the DEF accordingly. + */ +static void +FANSFixNextPlusOne_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSPosition.free_struct; + td->print_struct = asn_DEF_FANSPosition.print_struct; + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + td->ber_decoder = asn_DEF_FANSPosition.ber_decoder; + td->der_encoder = asn_DEF_FANSPosition.der_encoder; + td->xer_decoder = asn_DEF_FANSPosition.xer_decoder; + td->xer_encoder = asn_DEF_FANSPosition.xer_encoder; + td->uper_decoder = asn_DEF_FANSPosition.uper_decoder; + td->uper_encoder = asn_DEF_FANSPosition.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSPosition.per_constraints; + td->elements = asn_DEF_FANSPosition.elements; + td->elements_count = asn_DEF_FANSPosition.elements_count; + td->specifics = asn_DEF_FANSPosition.specifics; +} + +void +FANSFixNextPlusOne_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFixNextPlusOne_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFixNextPlusOne_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFixNextPlusOne_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFixNextPlusOne_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFixNextPlusOne_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFixNextPlusOne_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFixNextPlusOne_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFixNextPlusOne_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFixNextPlusOne_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSFixNextPlusOne = { + "FANSFixNextPlusOne", + "FANSFixNextPlusOne", + FANSFixNextPlusOne_free, + FANSFixNextPlusOne_print, + FANSFixNextPlusOne_constraint, + FANSFixNextPlusOne_decode_ber, + FANSFixNextPlusOne_encode_der, + FANSFixNextPlusOne_decode_xer, + FANSFixNextPlusOne_encode_xer, + FANSFixNextPlusOne_decode_uper, + FANSFixNextPlusOne_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNextPlusOne.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNextPlusOne.h new file mode 100644 index 000000000..d23f68e98 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFixNextPlusOne.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFixNextPlusOne_H_ +#define _FANSFixNextPlusOne_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFixNextPlusOne */ +typedef FANSPosition_t FANSFixNextPlusOne_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFixNextPlusOne; +asn_struct_free_f FANSFixNextPlusOne_free; +asn_struct_print_f FANSFixNextPlusOne_print; +asn_constr_check_f FANSFixNextPlusOne_constraint; +ber_type_decoder_f FANSFixNextPlusOne_decode_ber; +der_type_encoder_f FANSFixNextPlusOne_encode_der; +xer_type_decoder_f FANSFixNextPlusOne_decode_xer; +xer_type_encoder_f FANSFixNextPlusOne_encode_xer; +per_type_decoder_f FANSFixNextPlusOne_decode_uper; +per_type_encoder_f FANSFixNextPlusOne_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFixNextPlusOne_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFreeText.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFreeText.c new file mode 100644 index 000000000..1156b4e9e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFreeText.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFreeText.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSFreeText_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 256) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSFreeText_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSFreeText_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFreeText_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFreeText_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFreeText_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFreeText_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFreeText_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFreeText_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFreeText_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFreeText_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFreeText_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSFreeText_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFreeText = { + "FANSFreeText", + "FANSFreeText", + FANSFreeText_free, + FANSFreeText_print, + FANSFreeText_constraint, + FANSFreeText_decode_ber, + FANSFreeText_encode_der, + FANSFreeText_decode_xer, + FANSFreeText_encode_xer, + FANSFreeText_decode_uper, + FANSFreeText_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFreeText_tags_1, + sizeof(asn_DEF_FANSFreeText_tags_1) + /sizeof(asn_DEF_FANSFreeText_tags_1[0]), /* 1 */ + asn_DEF_FANSFreeText_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFreeText_tags_1) + /sizeof(asn_DEF_FANSFreeText_tags_1[0]), /* 1 */ + &asn_PER_type_FANSFreeText_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFreeText.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFreeText.h new file mode 100644 index 000000000..e2c8ff002 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFreeText.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFreeText_H_ +#define _FANSFreeText_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFreeText */ +typedef IA5String_t FANSFreeText_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFreeText; +asn_struct_free_f FANSFreeText_free; +asn_struct_print_f FANSFreeText_print; +asn_constr_check_f FANSFreeText_constraint; +ber_type_decoder_f FANSFreeText_decode_ber; +der_type_encoder_f FANSFreeText_encode_der; +xer_type_decoder_f FANSFreeText_decode_xer; +xer_type_encoder_f FANSFreeText_encode_xer; +per_type_decoder_f FANSFreeText_decode_uper; +per_type_encoder_f FANSFreeText_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFreeText_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequency.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequency.c new file mode 100644 index 000000000..d9f4689d7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequency.c @@ -0,0 +1,91 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFrequency.h" + +static asn_per_constraints_t asn_PER_type_FANSFrequency_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSFrequency_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSFrequency, choice.frequencyhf), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFrequencyhf, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencyhf" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSFrequency, choice.frequencyvhf), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFrequencyvhf, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencyvhf" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSFrequency, choice.frequencyuhf), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFrequencyuhf, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencyuhf" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSFrequency, choice.frequencysatchannel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFrequencysatchannel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencysatchannel" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSFrequency_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyhf */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* frequencyvhf */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* frequencyuhf */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* frequencysatchannel */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSFrequency_specs_1 = { + sizeof(struct FANSFrequency), + offsetof(struct FANSFrequency, _asn_ctx), + offsetof(struct FANSFrequency, present), + sizeof(((struct FANSFrequency *)0)->present), + asn_MAP_FANSFrequency_tag2el_1, + 4, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSFrequency = { + "FANSFrequency", + "FANSFrequency", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSFrequency_constr_1, + asn_MBR_FANSFrequency_1, + 4, /* Elements count */ + &asn_SPC_FANSFrequency_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequency.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequency.h new file mode 100644 index 000000000..00a6d6a47 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequency.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFrequency_H_ +#define _FANSFrequency_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFrequencyhf.h" +#include "FANSFrequencyvhf.h" +#include "FANSFrequencyuhf.h" +#include "FANSFrequencysatchannel.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSFrequency_PR { + FANSFrequency_PR_NOTHING, /* No components present */ + FANSFrequency_PR_frequencyhf, + FANSFrequency_PR_frequencyvhf, + FANSFrequency_PR_frequencyuhf, + FANSFrequency_PR_frequencysatchannel +} FANSFrequency_PR; + +/* FANSFrequency */ +typedef struct FANSFrequency { + FANSFrequency_PR present; + union FANSFrequency_u { + FANSFrequencyhf_t frequencyhf; + FANSFrequencyvhf_t frequencyvhf; + FANSFrequencyuhf_t frequencyuhf; + FANSFrequencysatchannel_t frequencysatchannel; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSFrequency_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFrequency; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFrequency_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyDeparture.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyDeparture.c new file mode 100644 index 000000000..45ef4ec91 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyDeparture.c @@ -0,0 +1,142 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFrequencyDeparture.h" + +int +FANSFrequencyDeparture_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 117000 && value <= 138000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using FANSFrequencyvhf, + * so here we adjust the DEF accordingly. + */ +static void +FANSFrequencyDeparture_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSFrequencyvhf.free_struct; + td->print_struct = asn_DEF_FANSFrequencyvhf.print_struct; + td->check_constraints = asn_DEF_FANSFrequencyvhf.check_constraints; + td->ber_decoder = asn_DEF_FANSFrequencyvhf.ber_decoder; + td->der_encoder = asn_DEF_FANSFrequencyvhf.der_encoder; + td->xer_decoder = asn_DEF_FANSFrequencyvhf.xer_decoder; + td->xer_encoder = asn_DEF_FANSFrequencyvhf.xer_encoder; + td->uper_decoder = asn_DEF_FANSFrequencyvhf.uper_decoder; + td->uper_encoder = asn_DEF_FANSFrequencyvhf.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSFrequencyvhf.per_constraints; + td->elements = asn_DEF_FANSFrequencyvhf.elements; + td->elements_count = asn_DEF_FANSFrequencyvhf.elements_count; + td->specifics = asn_DEF_FANSFrequencyvhf.specifics; +} + +void +FANSFrequencyDeparture_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFrequencyDeparture_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyDeparture_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFrequencyDeparture_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyDeparture_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFrequencyDeparture_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyDeparture_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFrequencyDeparture_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFrequencyDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSFrequencyDeparture_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFrequencyDeparture = { + "FANSFrequencyDeparture", + "FANSFrequencyDeparture", + FANSFrequencyDeparture_free, + FANSFrequencyDeparture_print, + FANSFrequencyDeparture_constraint, + FANSFrequencyDeparture_decode_ber, + FANSFrequencyDeparture_encode_der, + FANSFrequencyDeparture_decode_xer, + FANSFrequencyDeparture_encode_xer, + FANSFrequencyDeparture_decode_uper, + FANSFrequencyDeparture_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFrequencyDeparture_tags_1, + sizeof(asn_DEF_FANSFrequencyDeparture_tags_1) + /sizeof(asn_DEF_FANSFrequencyDeparture_tags_1[0]), /* 1 */ + asn_DEF_FANSFrequencyDeparture_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFrequencyDeparture_tags_1) + /sizeof(asn_DEF_FANSFrequencyDeparture_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyDeparture.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyDeparture.h new file mode 100644 index 000000000..a1beab805 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyDeparture.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFrequencyDeparture_H_ +#define _FANSFrequencyDeparture_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFrequencyvhf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFrequencyDeparture */ +typedef FANSFrequencyvhf_t FANSFrequencyDeparture_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFrequencyDeparture; +asn_struct_free_f FANSFrequencyDeparture_free; +asn_struct_print_f FANSFrequencyDeparture_print; +asn_constr_check_f FANSFrequencyDeparture_constraint; +ber_type_decoder_f FANSFrequencyDeparture_decode_ber; +der_type_encoder_f FANSFrequencyDeparture_encode_der; +xer_type_decoder_f FANSFrequencyDeparture_decode_xer; +xer_type_encoder_f FANSFrequencyDeparture_encode_xer; +per_type_decoder_f FANSFrequencyDeparture_decode_uper; +per_type_encoder_f FANSFrequencyDeparture_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFrequencyDeparture_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyhf.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyhf.c new file mode 100644 index 000000000..f3f905af5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyhf.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFrequencyhf.h" + +int +FANSFrequencyhf_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 2850 && value <= 28000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSFrequencyhf_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSFrequencyhf_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFrequencyhf_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyhf_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFrequencyhf_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyhf_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFrequencyhf_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyhf_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFrequencyhf_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFrequencyhf_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFrequencyhf_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 15, 15, 2850, 28000 } /* (2850..28000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSFrequencyhf_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFrequencyhf = { + "FANSFrequencyhf", + "FANSFrequencyhf", + FANSFrequencyhf_free, + FANSFrequencyhf_print, + FANSFrequencyhf_constraint, + FANSFrequencyhf_decode_ber, + FANSFrequencyhf_encode_der, + FANSFrequencyhf_decode_xer, + FANSFrequencyhf_encode_xer, + FANSFrequencyhf_decode_uper, + FANSFrequencyhf_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFrequencyhf_tags_1, + sizeof(asn_DEF_FANSFrequencyhf_tags_1) + /sizeof(asn_DEF_FANSFrequencyhf_tags_1[0]), /* 1 */ + asn_DEF_FANSFrequencyhf_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFrequencyhf_tags_1) + /sizeof(asn_DEF_FANSFrequencyhf_tags_1[0]), /* 1 */ + &asn_PER_type_FANSFrequencyhf_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyhf.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyhf.h new file mode 100644 index 000000000..28e1e8ad7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyhf.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFrequencyhf_H_ +#define _FANSFrequencyhf_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFrequencyhf */ +typedef long FANSFrequencyhf_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFrequencyhf; +asn_struct_free_f FANSFrequencyhf_free; +asn_struct_print_f FANSFrequencyhf_print; +asn_constr_check_f FANSFrequencyhf_constraint; +ber_type_decoder_f FANSFrequencyhf_decode_ber; +der_type_encoder_f FANSFrequencyhf_encode_der; +xer_type_decoder_f FANSFrequencyhf_decode_xer; +xer_type_encoder_f FANSFrequencyhf_encode_xer; +per_type_decoder_f FANSFrequencyhf_decode_uper; +per_type_encoder_f FANSFrequencyhf_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFrequencyhf_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencysatchannel.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencysatchannel.c new file mode 100644 index 000000000..dfade6b17 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencysatchannel.c @@ -0,0 +1,184 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFrequencysatchannel.h" + +static const int permitted_alphabet_table_1[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* . */ + 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ +}; +static const int permitted_alphabet_code2value_1[11] = { +32,48,49,50,51,52,53,54,55,56,57,}; + + +static int check_permitted_alphabet_1(const void *sptr) { + const int *table = permitted_alphabet_table_1; + /* The underlying type is NumericString */ + const NumericString_t *st = (const NumericString_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!table[cv]) return -1; + } + return 0; +} + +int +FANSFrequencysatchannel_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const NumericString_t *st = (const NumericString_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 12) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int asn_PER_MAP_FANSFrequencysatchannel_1_v2c(unsigned int value) { + if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) + return -1; + return permitted_alphabet_table_1[value] - 1; +} +static int asn_PER_MAP_FANSFrequencysatchannel_1_c2v(unsigned int code) { + if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) + return -1; + return permitted_alphabet_code2value_1[code]; +} +/* + * This type is implemented using NumericString, + * so here we adjust the DEF accordingly. + */ +static void +FANSFrequencysatchannel_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NumericString.free_struct; + td->print_struct = asn_DEF_NumericString.print_struct; + td->check_constraints = asn_DEF_NumericString.check_constraints; + td->ber_decoder = asn_DEF_NumericString.ber_decoder; + td->der_encoder = asn_DEF_NumericString.der_encoder; + td->xer_decoder = asn_DEF_NumericString.xer_decoder; + td->xer_encoder = asn_DEF_NumericString.xer_encoder; + td->uper_decoder = asn_DEF_NumericString.uper_decoder; + td->uper_encoder = asn_DEF_NumericString.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NumericString.per_constraints; + td->elements = asn_DEF_NumericString.elements; + td->elements_count = asn_DEF_NumericString.elements_count; + td->specifics = asn_DEF_NumericString.specifics; +} + +void +FANSFrequencysatchannel_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFrequencysatchannel_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencysatchannel_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFrequencysatchannel_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencysatchannel_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFrequencysatchannel_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencysatchannel_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFrequencysatchannel_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFrequencysatchannel_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFrequencysatchannel_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 32, 57 } /* (32..57) */, + { APC_CONSTRAINED, 0, 0, 12, 12 } /* (SIZE(12..12)) */, + asn_PER_MAP_FANSFrequencysatchannel_1_v2c, /* Value to PER code map */ + asn_PER_MAP_FANSFrequencysatchannel_1_c2v /* PER code to value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSFrequencysatchannel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (18 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFrequencysatchannel = { + "FANSFrequencysatchannel", + "FANSFrequencysatchannel", + FANSFrequencysatchannel_free, + FANSFrequencysatchannel_print, + FANSFrequencysatchannel_constraint, + FANSFrequencysatchannel_decode_ber, + FANSFrequencysatchannel_encode_der, + FANSFrequencysatchannel_decode_xer, + FANSFrequencysatchannel_encode_xer, + FANSFrequencysatchannel_decode_uper, + FANSFrequencysatchannel_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFrequencysatchannel_tags_1, + sizeof(asn_DEF_FANSFrequencysatchannel_tags_1) + /sizeof(asn_DEF_FANSFrequencysatchannel_tags_1[0]), /* 1 */ + asn_DEF_FANSFrequencysatchannel_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFrequencysatchannel_tags_1) + /sizeof(asn_DEF_FANSFrequencysatchannel_tags_1[0]), /* 1 */ + &asn_PER_type_FANSFrequencysatchannel_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencysatchannel.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencysatchannel.h new file mode 100644 index 000000000..cabaa30ef --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencysatchannel.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFrequencysatchannel_H_ +#define _FANSFrequencysatchannel_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NumericString.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFrequencysatchannel */ +typedef NumericString_t FANSFrequencysatchannel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFrequencysatchannel; +asn_struct_free_f FANSFrequencysatchannel_free; +asn_struct_print_f FANSFrequencysatchannel_print; +asn_constr_check_f FANSFrequencysatchannel_constraint; +ber_type_decoder_f FANSFrequencysatchannel_decode_ber; +der_type_encoder_f FANSFrequencysatchannel_encode_der; +xer_type_decoder_f FANSFrequencysatchannel_decode_xer; +xer_type_encoder_f FANSFrequencysatchannel_encode_xer; +per_type_decoder_f FANSFrequencysatchannel_decode_uper; +per_type_encoder_f FANSFrequencysatchannel_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFrequencysatchannel_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyuhf.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyuhf.c new file mode 100644 index 000000000..40ab1aa24 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyuhf.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFrequencyuhf.h" + +int +FANSFrequencyuhf_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 225000 && value <= 399975)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSFrequencyuhf_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSFrequencyuhf_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFrequencyuhf_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyuhf_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFrequencyuhf_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyuhf_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFrequencyuhf_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyuhf_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFrequencyuhf_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFrequencyuhf_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFrequencyuhf_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 18, -1, 225000, 399975 } /* (225000..399975) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSFrequencyuhf_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFrequencyuhf = { + "FANSFrequencyuhf", + "FANSFrequencyuhf", + FANSFrequencyuhf_free, + FANSFrequencyuhf_print, + FANSFrequencyuhf_constraint, + FANSFrequencyuhf_decode_ber, + FANSFrequencyuhf_encode_der, + FANSFrequencyuhf_decode_xer, + FANSFrequencyuhf_encode_xer, + FANSFrequencyuhf_decode_uper, + FANSFrequencyuhf_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFrequencyuhf_tags_1, + sizeof(asn_DEF_FANSFrequencyuhf_tags_1) + /sizeof(asn_DEF_FANSFrequencyuhf_tags_1[0]), /* 1 */ + asn_DEF_FANSFrequencyuhf_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFrequencyuhf_tags_1) + /sizeof(asn_DEF_FANSFrequencyuhf_tags_1[0]), /* 1 */ + &asn_PER_type_FANSFrequencyuhf_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyuhf.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyuhf.h new file mode 100644 index 000000000..1df6c2f4d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyuhf.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFrequencyuhf_H_ +#define _FANSFrequencyuhf_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFrequencyuhf */ +typedef long FANSFrequencyuhf_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFrequencyuhf; +asn_struct_free_f FANSFrequencyuhf_free; +asn_struct_print_f FANSFrequencyuhf_print; +asn_constr_check_f FANSFrequencyuhf_constraint; +ber_type_decoder_f FANSFrequencyuhf_decode_ber; +der_type_encoder_f FANSFrequencyuhf_encode_der; +xer_type_decoder_f FANSFrequencyuhf_decode_xer; +xer_type_encoder_f FANSFrequencyuhf_encode_xer; +per_type_decoder_f FANSFrequencyuhf_decode_uper; +per_type_encoder_f FANSFrequencyuhf_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFrequencyuhf_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyvhf.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyvhf.c new file mode 100644 index 000000000..37ddc77c6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyvhf.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSFrequencyvhf.h" + +int +FANSFrequencyvhf_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 117000 && value <= 138000)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSFrequencyvhf_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSFrequencyvhf_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSFrequencyvhf_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyvhf_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSFrequencyvhf_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyvhf_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSFrequencyvhf_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSFrequencyvhf_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSFrequencyvhf_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSFrequencyvhf_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSFrequencyvhf_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 15, -1, 117000, 138000 } /* (117000..138000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSFrequencyvhf_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSFrequencyvhf = { + "FANSFrequencyvhf", + "FANSFrequencyvhf", + FANSFrequencyvhf_free, + FANSFrequencyvhf_print, + FANSFrequencyvhf_constraint, + FANSFrequencyvhf_decode_ber, + FANSFrequencyvhf_encode_der, + FANSFrequencyvhf_decode_xer, + FANSFrequencyvhf_encode_xer, + FANSFrequencyvhf_decode_uper, + FANSFrequencyvhf_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSFrequencyvhf_tags_1, + sizeof(asn_DEF_FANSFrequencyvhf_tags_1) + /sizeof(asn_DEF_FANSFrequencyvhf_tags_1[0]), /* 1 */ + asn_DEF_FANSFrequencyvhf_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSFrequencyvhf_tags_1) + /sizeof(asn_DEF_FANSFrequencyvhf_tags_1[0]), /* 1 */ + &asn_PER_type_FANSFrequencyvhf_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyvhf.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyvhf.h new file mode 100644 index 000000000..879f5b4d7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSFrequencyvhf.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSFrequencyvhf_H_ +#define _FANSFrequencyvhf_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSFrequencyvhf */ +typedef long FANSFrequencyvhf_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSFrequencyvhf; +asn_struct_free_f FANSFrequencyvhf_free; +asn_struct_print_f FANSFrequencyvhf_print; +asn_constr_check_f FANSFrequencyvhf_constraint; +ber_type_decoder_f FANSFrequencyvhf_decode_ber; +der_type_encoder_f FANSFrequencyvhf_encode_der; +xer_type_decoder_f FANSFrequencyvhf_decode_xer; +xer_type_encoder_f FANSFrequencyvhf_encode_xer; +per_type_decoder_f FANSFrequencyvhf_decode_uper; +per_type_encoder_f FANSFrequencyvhf_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSFrequencyvhf_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldClearance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldClearance.c new file mode 100644 index 000000000..ee0446609 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldClearance.c @@ -0,0 +1,115 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSHoldClearance.h" + +static asn_TYPE_member_t asn_MBR_FANSHoldClearance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSHoldClearance, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSHoldClearance, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSHoldClearance, degrees), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSHoldClearance, direction), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "direction" + }, + { ATF_POINTER, 1, offsetof(struct FANSHoldClearance, legType), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSLegType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "legType" + }, +}; +static const int asn_MAP_FANSHoldClearance_oms_1[] = { 4 }; +static const ber_tlv_tag_t asn_DEF_FANSHoldClearance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSHoldClearance_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 3, 0, 0 }, /* direction */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 3 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 2 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, -2, 1 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 4, -3, 0 }, /* legDistance */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 3 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 2 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, -2, 1 }, /* degreesTrue */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 4, -3, 0 }, /* legTime */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, -1, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, -1, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 1 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, -1, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSHoldClearance_specs_1 = { + sizeof(struct FANSHoldClearance), + offsetof(struct FANSHoldClearance, _asn_ctx), + asn_MAP_FANSHoldClearance_tag2el_1, + 18, /* Count of tags in the map */ + asn_MAP_FANSHoldClearance_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSHoldClearance = { + "FANSHoldClearance", + "FANSHoldClearance", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSHoldClearance_tags_1, + sizeof(asn_DEF_FANSHoldClearance_tags_1) + /sizeof(asn_DEF_FANSHoldClearance_tags_1[0]), /* 1 */ + asn_DEF_FANSHoldClearance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSHoldClearance_tags_1) + /sizeof(asn_DEF_FANSHoldClearance_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSHoldClearance_1, + 5, /* Elements count */ + &asn_SPC_FANSHoldClearance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldClearance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldClearance.h new file mode 100644 index 000000000..037596a8f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldClearance.h @@ -0,0 +1,51 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSHoldClearance_H_ +#define _FANSHoldClearance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSAltitude.h" +#include "FANSDegrees.h" +#include "FANSDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSLegType; + +/* FANSHoldClearance */ +typedef struct FANSHoldClearance { + FANSPosition_t position; + FANSAltitude_t altitude; + FANSDegrees_t degrees; + FANSDirection_t direction; + struct FANSLegType *legType /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSHoldClearance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSHoldClearance; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSLegType.h" + +#endif /* _FANSHoldClearance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypoint.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypoint.c new file mode 100644 index 000000000..0e8508974 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypoint.c @@ -0,0 +1,132 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSHoldatwaypoint.h" + +static asn_TYPE_member_t asn_MBR_FANSHoldatwaypoint_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSHoldatwaypoint, position), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_POINTER, 7, offsetof(struct FANSHoldatwaypoint, holdatwaypointspeedlow), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSHoldatwaypointSpeedLow, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "holdatwaypointspeedlow" + }, + { ATF_POINTER, 6, offsetof(struct FANSHoldatwaypoint, aTWaltitude), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATWAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTWaltitude" + }, + { ATF_POINTER, 5, offsetof(struct FANSHoldatwaypoint, holdatwaypointspeedhigh), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSHoldatwaypointSpeedHigh, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "holdatwaypointspeedhigh" + }, + { ATF_POINTER, 4, offsetof(struct FANSHoldatwaypoint, direction), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "direction" + }, + { ATF_POINTER, 3, offsetof(struct FANSHoldatwaypoint, degrees), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, + { ATF_POINTER, 2, offsetof(struct FANSHoldatwaypoint, eFCtime), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSEFCtime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "eFCtime" + }, + { ATF_POINTER, 1, offsetof(struct FANSHoldatwaypoint, legType), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSLegType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "legType" + }, +}; +static const int asn_MAP_FANSHoldatwaypoint_oms_1[] = { 1, 2, 3, 4, 5, 6, 7 }; +static const ber_tlv_tag_t asn_DEF_FANSHoldatwaypoint_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSHoldatwaypoint_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* position */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* holdatwaypointspeedlow */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* aTWaltitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* holdatwaypointspeedhigh */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* direction */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* degrees */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* eFCtime */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* legType */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSHoldatwaypoint_specs_1 = { + sizeof(struct FANSHoldatwaypoint), + offsetof(struct FANSHoldatwaypoint, _asn_ctx), + asn_MAP_FANSHoldatwaypoint_tag2el_1, + 8, /* Count of tags in the map */ + asn_MAP_FANSHoldatwaypoint_oms_1, /* Optional members */ + 7, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypoint = { + "FANSHoldatwaypoint", + "FANSHoldatwaypoint", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSHoldatwaypoint_tags_1, + sizeof(asn_DEF_FANSHoldatwaypoint_tags_1) + /sizeof(asn_DEF_FANSHoldatwaypoint_tags_1[0]), /* 1 */ + asn_DEF_FANSHoldatwaypoint_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSHoldatwaypoint_tags_1) + /sizeof(asn_DEF_FANSHoldatwaypoint_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSHoldatwaypoint_1, + 8, /* Elements count */ + &asn_SPC_FANSHoldatwaypoint_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypoint.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypoint.h new file mode 100644 index 000000000..f2a536abd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypoint.h @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSHoldatwaypoint_H_ +#define _FANSHoldatwaypoint_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSSpeed; +struct FANSATWAltitude; +struct FANSDegrees; +struct FANSTime; +struct FANSLegType; + +/* FANSHoldatwaypoint */ +typedef struct FANSHoldatwaypoint { + FANSPosition_t position; + struct FANSSpeed *holdatwaypointspeedlow /* OPTIONAL */; + struct FANSATWAltitude *aTWaltitude /* OPTIONAL */; + struct FANSSpeed *holdatwaypointspeedhigh /* OPTIONAL */; + FANSDirection_t *direction /* OPTIONAL */; + struct FANSDegrees *degrees /* OPTIONAL */; + struct FANSTime *eFCtime /* OPTIONAL */; + struct FANSLegType *legType /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSHoldatwaypoint_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypoint; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSHoldatwaypointSpeedLow.h" +#include "FANSATWAltitude.h" +#include "FANSHoldatwaypointSpeedHigh.h" +#include "FANSDegrees.h" +#include "FANSEFCtime.h" +#include "FANSLegType.h" + +#endif /* _FANSHoldatwaypoint_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSequence.c new file mode 100644 index 000000000..8c4090a7e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSHoldatwaypointSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSHoldatwaypointSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSHoldatwaypointSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSHoldatwaypoint, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSHoldatwaypointSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSHoldatwaypointSequence_specs_1 = { + sizeof(struct FANSHoldatwaypointSequence), + offsetof(struct FANSHoldatwaypointSequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypointSequence = { + "FANSHoldatwaypointSequence", + "FANSHoldatwaypointSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSHoldatwaypointSequence_tags_1, + sizeof(asn_DEF_FANSHoldatwaypointSequence_tags_1) + /sizeof(asn_DEF_FANSHoldatwaypointSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSHoldatwaypointSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSHoldatwaypointSequence_tags_1) + /sizeof(asn_DEF_FANSHoldatwaypointSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSHoldatwaypointSequence_constr_1, + asn_MBR_FANSHoldatwaypointSequence_1, + 1, /* Single element */ + &asn_SPC_FANSHoldatwaypointSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSequence.h new file mode 100644 index 000000000..56109879a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSHoldatwaypointSequence_H_ +#define _FANSHoldatwaypointSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSHoldatwaypoint; + +/* FANSHoldatwaypointSequence */ +typedef struct FANSHoldatwaypointSequence { + A_SEQUENCE_OF(struct FANSHoldatwaypoint) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSHoldatwaypointSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypointSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSHoldatwaypoint.h" + +#endif /* _FANSHoldatwaypointSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedHigh.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedHigh.c new file mode 100644 index 000000000..4d7b47a0c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedHigh.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSHoldatwaypointSpeedHigh.h" + +int +FANSHoldatwaypointSpeedHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSSpeed.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSSpeed, + * so here we adjust the DEF accordingly. + */ +static void +FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSSpeed.free_struct; + td->print_struct = asn_DEF_FANSSpeed.print_struct; + td->check_constraints = asn_DEF_FANSSpeed.check_constraints; + td->ber_decoder = asn_DEF_FANSSpeed.ber_decoder; + td->der_encoder = asn_DEF_FANSSpeed.der_encoder; + td->xer_decoder = asn_DEF_FANSSpeed.xer_decoder; + td->xer_encoder = asn_DEF_FANSSpeed.xer_encoder; + td->uper_decoder = asn_DEF_FANSSpeed.uper_decoder; + td->uper_encoder = asn_DEF_FANSSpeed.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSSpeed.per_constraints; + td->elements = asn_DEF_FANSSpeed.elements; + td->elements_count = asn_DEF_FANSSpeed.elements_count; + td->specifics = asn_DEF_FANSSpeed.specifics; +} + +void +FANSHoldatwaypointSpeedHigh_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSHoldatwaypointSpeedHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSHoldatwaypointSpeedHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSHoldatwaypointSpeedHigh_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSHoldatwaypointSpeedHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSHoldatwaypointSpeedHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSHoldatwaypointSpeedHigh_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSHoldatwaypointSpeedHigh_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSHoldatwaypointSpeedHigh_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSHoldatwaypointSpeedHigh_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypointSpeedHigh = { + "FANSHoldatwaypointSpeedHigh", + "FANSHoldatwaypointSpeedHigh", + FANSHoldatwaypointSpeedHigh_free, + FANSHoldatwaypointSpeedHigh_print, + FANSHoldatwaypointSpeedHigh_constraint, + FANSHoldatwaypointSpeedHigh_decode_ber, + FANSHoldatwaypointSpeedHigh_encode_der, + FANSHoldatwaypointSpeedHigh_decode_xer, + FANSHoldatwaypointSpeedHigh_encode_xer, + FANSHoldatwaypointSpeedHigh_decode_uper, + FANSHoldatwaypointSpeedHigh_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedHigh.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedHigh.h new file mode 100644 index 000000000..9826c9e21 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedHigh.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSHoldatwaypointSpeedHigh_H_ +#define _FANSHoldatwaypointSpeedHigh_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSSpeed.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSHoldatwaypointSpeedHigh */ +typedef FANSSpeed_t FANSHoldatwaypointSpeedHigh_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypointSpeedHigh; +asn_struct_free_f FANSHoldatwaypointSpeedHigh_free; +asn_struct_print_f FANSHoldatwaypointSpeedHigh_print; +asn_constr_check_f FANSHoldatwaypointSpeedHigh_constraint; +ber_type_decoder_f FANSHoldatwaypointSpeedHigh_decode_ber; +der_type_encoder_f FANSHoldatwaypointSpeedHigh_encode_der; +xer_type_decoder_f FANSHoldatwaypointSpeedHigh_decode_xer; +xer_type_encoder_f FANSHoldatwaypointSpeedHigh_encode_xer; +per_type_decoder_f FANSHoldatwaypointSpeedHigh_decode_uper; +per_type_encoder_f FANSHoldatwaypointSpeedHigh_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSHoldatwaypointSpeedHigh_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedLow.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedLow.c new file mode 100644 index 000000000..d48942734 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedLow.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSHoldatwaypointSpeedLow.h" + +int +FANSHoldatwaypointSpeedLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSSpeed.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSSpeed, + * so here we adjust the DEF accordingly. + */ +static void +FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSSpeed.free_struct; + td->print_struct = asn_DEF_FANSSpeed.print_struct; + td->check_constraints = asn_DEF_FANSSpeed.check_constraints; + td->ber_decoder = asn_DEF_FANSSpeed.ber_decoder; + td->der_encoder = asn_DEF_FANSSpeed.der_encoder; + td->xer_decoder = asn_DEF_FANSSpeed.xer_decoder; + td->xer_encoder = asn_DEF_FANSSpeed.xer_encoder; + td->uper_decoder = asn_DEF_FANSSpeed.uper_decoder; + td->uper_encoder = asn_DEF_FANSSpeed.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSSpeed.per_constraints; + td->elements = asn_DEF_FANSSpeed.elements; + td->elements_count = asn_DEF_FANSSpeed.elements_count; + td->specifics = asn_DEF_FANSSpeed.specifics; +} + +void +FANSHoldatwaypointSpeedLow_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSHoldatwaypointSpeedLow_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSHoldatwaypointSpeedLow_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSHoldatwaypointSpeedLow_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSHoldatwaypointSpeedLow_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSHoldatwaypointSpeedLow_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSHoldatwaypointSpeedLow_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSHoldatwaypointSpeedLow_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSHoldatwaypointSpeedLow_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSHoldatwaypointSpeedLow_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypointSpeedLow = { + "FANSHoldatwaypointSpeedLow", + "FANSHoldatwaypointSpeedLow", + FANSHoldatwaypointSpeedLow_free, + FANSHoldatwaypointSpeedLow_print, + FANSHoldatwaypointSpeedLow_constraint, + FANSHoldatwaypointSpeedLow_decode_ber, + FANSHoldatwaypointSpeedLow_encode_der, + FANSHoldatwaypointSpeedLow_decode_xer, + FANSHoldatwaypointSpeedLow_encode_xer, + FANSHoldatwaypointSpeedLow_decode_uper, + FANSHoldatwaypointSpeedLow_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedLow.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedLow.h new file mode 100644 index 000000000..011e989d7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSHoldatwaypointSpeedLow.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSHoldatwaypointSpeedLow_H_ +#define _FANSHoldatwaypointSpeedLow_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSSpeed.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSHoldatwaypointSpeedLow */ +typedef FANSSpeed_t FANSHoldatwaypointSpeedLow_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSHoldatwaypointSpeedLow; +asn_struct_free_f FANSHoldatwaypointSpeedLow_free; +asn_struct_print_f FANSHoldatwaypointSpeedLow_print; +asn_constr_check_f FANSHoldatwaypointSpeedLow_constraint; +ber_type_decoder_f FANSHoldatwaypointSpeedLow_decode_ber; +der_type_encoder_f FANSHoldatwaypointSpeedLow_encode_der; +xer_type_decoder_f FANSHoldatwaypointSpeedLow_decode_xer; +xer_type_encoder_f FANSHoldatwaypointSpeedLow_encode_xer; +per_type_decoder_f FANSHoldatwaypointSpeedLow_decode_uper; +per_type_encoder_f FANSHoldatwaypointSpeedLow_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSHoldatwaypointSpeedLow_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityDesignationTp4Table.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityDesignationTp4Table.c new file mode 100644 index 000000000..dba43e1dc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityDesignationTp4Table.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOFacilityDesignationTp4Table.h" + +static asn_TYPE_member_t asn_MBR_FANSICAOFacilityDesignationTp4Table_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOFacilityDesignationTp4Table, iCAOFacilityDesignation), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSICAOfacilityDesignation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOFacilityDesignation" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOFacilityDesignationTp4Table, tp4table), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSTp4table, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tp4table" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSICAOFacilityDesignationTp4Table_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 }, /* tp4table */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 } /* iCAOFacilityDesignation */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSICAOFacilityDesignationTp4Table_specs_1 = { + sizeof(struct FANSICAOFacilityDesignationTp4Table), + offsetof(struct FANSICAOFacilityDesignationTp4Table, _asn_ctx), + asn_MAP_FANSICAOFacilityDesignationTp4Table_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityDesignationTp4Table = { + "FANSICAOFacilityDesignationTp4Table", + "FANSICAOFacilityDesignationTp4Table", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1, + sizeof(asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1) + /sizeof(asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1[0]), /* 1 */ + asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1) + /sizeof(asn_DEF_FANSICAOFacilityDesignationTp4Table_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSICAOFacilityDesignationTp4Table_1, + 2, /* Elements count */ + &asn_SPC_FANSICAOFacilityDesignationTp4Table_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityDesignationTp4Table.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityDesignationTp4Table.h new file mode 100644 index 000000000..82fe12d73 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityDesignationTp4Table.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOFacilityDesignationTp4Table_H_ +#define _FANSICAOFacilityDesignationTp4Table_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSICAOfacilityDesignation.h" +#include "FANSTp4table.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSICAOFacilityDesignationTp4Table */ +typedef struct FANSICAOFacilityDesignationTp4Table { + FANSICAOfacilityDesignation_t iCAOFacilityDesignation; + FANSTp4table_t tp4table; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSICAOFacilityDesignationTp4Table_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityDesignationTp4Table; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOFacilityDesignationTp4Table_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityFunction.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityFunction.c new file mode 100644 index 000000000..2f5ef814b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityFunction.c @@ -0,0 +1,159 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOFacilityFunction.h" + +int +FANSICAOFacilityFunction_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSICAOFacilityFunction_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSICAOFacilityFunction_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSICAOFacilityFunction_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSICAOFacilityFunction_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSICAOFacilityFunction_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSICAOFacilityFunction_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSICAOFacilityFunction_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSICAOFacilityFunction_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSICAOFacilityFunction_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSICAOFacilityFunction_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSICAOFacilityFunction_value2enum_1[] = { + { 0, 6, "center" }, + { 1, 8, "approach" }, + { 2, 5, "tower" }, + { 3, 5, "final" }, + { 4, 13, "groundControl" }, + { 5, 17, "clearanceDelivery" }, + { 6, 9, "departure" }, + { 7, 7, "control" } +}; +static const unsigned int asn_MAP_FANSICAOFacilityFunction_enum2value_1[] = { + 1, /* approach(1) */ + 0, /* center(0) */ + 5, /* clearanceDelivery(5) */ + 7, /* control(7) */ + 6, /* departure(6) */ + 3, /* final(3) */ + 4, /* groundControl(4) */ + 2 /* tower(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSICAOFacilityFunction_specs_1 = { + asn_MAP_FANSICAOFacilityFunction_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSICAOFacilityFunction_enum2value_1, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSICAOFacilityFunction_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityFunction = { + "FANSICAOFacilityFunction", + "FANSICAOFacilityFunction", + FANSICAOFacilityFunction_free, + FANSICAOFacilityFunction_print, + FANSICAOFacilityFunction_constraint, + FANSICAOFacilityFunction_decode_ber, + FANSICAOFacilityFunction_encode_der, + FANSICAOFacilityFunction_decode_xer, + FANSICAOFacilityFunction_encode_xer, + FANSICAOFacilityFunction_decode_uper, + FANSICAOFacilityFunction_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSICAOFacilityFunction_tags_1, + sizeof(asn_DEF_FANSICAOFacilityFunction_tags_1) + /sizeof(asn_DEF_FANSICAOFacilityFunction_tags_1[0]), /* 1 */ + asn_DEF_FANSICAOFacilityFunction_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSICAOFacilityFunction_tags_1) + /sizeof(asn_DEF_FANSICAOFacilityFunction_tags_1[0]), /* 1 */ + &asn_PER_type_FANSICAOFacilityFunction_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSICAOFacilityFunction_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityFunction.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityFunction.h new file mode 100644 index 000000000..724b6dd00 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityFunction.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOFacilityFunction_H_ +#define _FANSICAOFacilityFunction_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSICAOFacilityFunction { + FANSICAOFacilityFunction_center = 0, + FANSICAOFacilityFunction_approach = 1, + FANSICAOFacilityFunction_tower = 2, + FANSICAOFacilityFunction_final = 3, + FANSICAOFacilityFunction_groundControl = 4, + FANSICAOFacilityFunction_clearanceDelivery = 5, + FANSICAOFacilityFunction_departure = 6, + FANSICAOFacilityFunction_control = 7 +} e_FANSICAOFacilityFunction; + +/* FANSICAOFacilityFunction */ +typedef long FANSICAOFacilityFunction_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityFunction; +asn_struct_free_f FANSICAOFacilityFunction_free; +asn_struct_print_f FANSICAOFacilityFunction_print; +asn_constr_check_f FANSICAOFacilityFunction_constraint; +ber_type_decoder_f FANSICAOFacilityFunction_decode_ber; +der_type_encoder_f FANSICAOFacilityFunction_encode_der; +xer_type_decoder_f FANSICAOFacilityFunction_decode_xer; +xer_type_encoder_f FANSICAOFacilityFunction_encode_xer; +per_type_decoder_f FANSICAOFacilityFunction_decode_uper; +per_type_encoder_f FANSICAOFacilityFunction_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOFacilityFunction_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityIdentification.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityIdentification.c new file mode 100644 index 000000000..7e15853e7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityIdentification.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOFacilityIdentification.h" + +static asn_per_constraints_t asn_PER_type_FANSICAOFacilityIdentification_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSICAOFacilityIdentification_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOFacilityIdentification, choice.iCAOfacilitydesignation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOfacilityDesignation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOfacilitydesignation" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOFacilityIdentification, choice.iCAOfacilityname), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSICAOFacilityName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOfacilityname" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSICAOFacilityIdentification_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* iCAOfacilitydesignation */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iCAOfacilityname */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSICAOFacilityIdentification_specs_1 = { + sizeof(struct FANSICAOFacilityIdentification), + offsetof(struct FANSICAOFacilityIdentification, _asn_ctx), + offsetof(struct FANSICAOFacilityIdentification, present), + sizeof(((struct FANSICAOFacilityIdentification *)0)->present), + asn_MAP_FANSICAOFacilityIdentification_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityIdentification = { + "FANSICAOFacilityIdentification", + "FANSICAOFacilityIdentification", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSICAOFacilityIdentification_constr_1, + asn_MBR_FANSICAOFacilityIdentification_1, + 2, /* Elements count */ + &asn_SPC_FANSICAOFacilityIdentification_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityIdentification.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityIdentification.h new file mode 100644 index 000000000..601927056 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityIdentification.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOFacilityIdentification_H_ +#define _FANSICAOFacilityIdentification_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSICAOfacilityDesignation.h" +#include "FANSICAOFacilityName.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSICAOFacilityIdentification_PR { + FANSICAOFacilityIdentification_PR_NOTHING, /* No components present */ + FANSICAOFacilityIdentification_PR_iCAOfacilitydesignation, + FANSICAOFacilityIdentification_PR_iCAOfacilityname +} FANSICAOFacilityIdentification_PR; + +/* FANSICAOFacilityIdentification */ +typedef struct FANSICAOFacilityIdentification { + FANSICAOFacilityIdentification_PR present; + union FANSICAOFacilityIdentification_u { + FANSICAOfacilityDesignation_t iCAOfacilitydesignation; + FANSICAOFacilityName_t iCAOfacilityname; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSICAOFacilityIdentification_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityIdentification; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOFacilityIdentification_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityName.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityName.c new file mode 100644 index 000000000..47a1ff86a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityName.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOFacilityName.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSICAOFacilityName_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 3 && size <= 18) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSICAOFacilityName_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSICAOFacilityName_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSICAOFacilityName_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSICAOFacilityName_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSICAOFacilityName_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSICAOFacilityName_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSICAOFacilityName_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSICAOFacilityName_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSICAOFacilityName_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSICAOFacilityName_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSICAOFacilityName_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 4, 4, 3, 18 } /* (SIZE(3..18)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSICAOFacilityName_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityName = { + "FANSICAOFacilityName", + "FANSICAOFacilityName", + FANSICAOFacilityName_free, + FANSICAOFacilityName_print, + FANSICAOFacilityName_constraint, + FANSICAOFacilityName_decode_ber, + FANSICAOFacilityName_encode_der, + FANSICAOFacilityName_decode_xer, + FANSICAOFacilityName_encode_xer, + FANSICAOFacilityName_decode_uper, + FANSICAOFacilityName_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSICAOFacilityName_tags_1, + sizeof(asn_DEF_FANSICAOFacilityName_tags_1) + /sizeof(asn_DEF_FANSICAOFacilityName_tags_1[0]), /* 1 */ + asn_DEF_FANSICAOFacilityName_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSICAOFacilityName_tags_1) + /sizeof(asn_DEF_FANSICAOFacilityName_tags_1[0]), /* 1 */ + &asn_PER_type_FANSICAOFacilityName_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityName.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityName.h new file mode 100644 index 000000000..136382756 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOFacilityName.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOFacilityName_H_ +#define _FANSICAOFacilityName_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSICAOFacilityName */ +typedef IA5String_t FANSICAOFacilityName_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOFacilityName; +asn_struct_free_f FANSICAOFacilityName_free; +asn_struct_print_f FANSICAOFacilityName_print; +asn_constr_check_f FANSICAOFacilityName_constraint; +ber_type_decoder_f FANSICAOFacilityName_decode_ber; +der_type_encoder_f FANSICAOFacilityName_encode_der; +xer_type_decoder_f FANSICAOFacilityName_decode_xer; +xer_type_encoder_f FANSICAOFacilityName_encode_xer; +per_type_decoder_f FANSICAOFacilityName_decode_uper; +per_type_encoder_f FANSICAOFacilityName_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOFacilityName_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitName.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitName.c new file mode 100644 index 000000000..cc5e8936f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitName.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOUnitName.h" + +static asn_TYPE_member_t asn_MBR_FANSICAOUnitName_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOUnitName, iCAOFacilityIdentification), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSICAOFacilityIdentification, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOFacilityIdentification" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOUnitName, iCAOFacilityFunction), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSICAOFacilityFunction, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOFacilityFunction" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSICAOUnitName_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSICAOUnitName_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 }, /* iCAOFacilityFunction */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* iCAOfacilitydesignation */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 } /* iCAOfacilityname */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSICAOUnitName_specs_1 = { + sizeof(struct FANSICAOUnitName), + offsetof(struct FANSICAOUnitName, _asn_ctx), + asn_MAP_FANSICAOUnitName_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOUnitName = { + "FANSICAOUnitName", + "FANSICAOUnitName", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSICAOUnitName_tags_1, + sizeof(asn_DEF_FANSICAOUnitName_tags_1) + /sizeof(asn_DEF_FANSICAOUnitName_tags_1[0]), /* 1 */ + asn_DEF_FANSICAOUnitName_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSICAOUnitName_tags_1) + /sizeof(asn_DEF_FANSICAOUnitName_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSICAOUnitName_1, + 2, /* Elements count */ + &asn_SPC_FANSICAOUnitName_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitName.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitName.h new file mode 100644 index 000000000..da3a7d59d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitName.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOUnitName_H_ +#define _FANSICAOUnitName_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSICAOFacilityIdentification.h" +#include "FANSICAOFacilityFunction.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSICAOUnitName */ +typedef struct FANSICAOUnitName { + FANSICAOFacilityIdentification_t iCAOFacilityIdentification; + FANSICAOFacilityFunction_t iCAOFacilityFunction; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSICAOUnitName_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOUnitName; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOUnitName_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitNameFrequency.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitNameFrequency.c new file mode 100644 index 000000000..174dad458 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitNameFrequency.c @@ -0,0 +1,73 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOUnitNameFrequency.h" + +static asn_TYPE_member_t asn_MBR_FANSICAOUnitNameFrequency_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOUnitNameFrequency, iCAOUnitName), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSICAOUnitName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOUnitName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSICAOUnitNameFrequency, frequency), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequency" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSICAOUnitNameFrequency_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSICAOUnitNameFrequency_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* iCAOUnitName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* frequencyhf */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* frequencyvhf */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* frequencyuhf */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 } /* frequencysatchannel */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSICAOUnitNameFrequency_specs_1 = { + sizeof(struct FANSICAOUnitNameFrequency), + offsetof(struct FANSICAOUnitNameFrequency, _asn_ctx), + asn_MAP_FANSICAOUnitNameFrequency_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOUnitNameFrequency = { + "FANSICAOUnitNameFrequency", + "FANSICAOUnitNameFrequency", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSICAOUnitNameFrequency_tags_1, + sizeof(asn_DEF_FANSICAOUnitNameFrequency_tags_1) + /sizeof(asn_DEF_FANSICAOUnitNameFrequency_tags_1[0]), /* 1 */ + asn_DEF_FANSICAOUnitNameFrequency_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSICAOUnitNameFrequency_tags_1) + /sizeof(asn_DEF_FANSICAOUnitNameFrequency_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSICAOUnitNameFrequency_1, + 2, /* Elements count */ + &asn_SPC_FANSICAOUnitNameFrequency_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitNameFrequency.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitNameFrequency.h new file mode 100644 index 000000000..ec947d050 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOUnitNameFrequency.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOUnitNameFrequency_H_ +#define _FANSICAOUnitNameFrequency_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSICAOUnitName.h" +#include "FANSFrequency.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSICAOUnitNameFrequency */ +typedef struct FANSICAOUnitNameFrequency { + FANSICAOUnitName_t iCAOUnitName; + FANSFrequency_t frequency; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSICAOUnitNameFrequency_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOUnitNameFrequency; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOUnitNameFrequency_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOfacilityDesignation.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOfacilityDesignation.c new file mode 100644 index 000000000..e1e87d7b2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOfacilityDesignation.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSICAOfacilityDesignation.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSICAOfacilityDesignation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 4) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSICAOfacilityDesignation_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSICAOfacilityDesignation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSICAOfacilityDesignation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSICAOfacilityDesignation_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSICAOfacilityDesignation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSICAOfacilityDesignation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSICAOfacilityDesignation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSICAOfacilityDesignation_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSICAOfacilityDesignation_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSICAOfacilityDesignation_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSICAOfacilityDesignation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSICAOfacilityDesignation = { + "FANSICAOfacilityDesignation", + "FANSICAOfacilityDesignation", + FANSICAOfacilityDesignation_free, + FANSICAOfacilityDesignation_print, + FANSICAOfacilityDesignation_constraint, + FANSICAOfacilityDesignation_decode_ber, + FANSICAOfacilityDesignation_encode_der, + FANSICAOfacilityDesignation_decode_xer, + FANSICAOfacilityDesignation_encode_xer, + FANSICAOfacilityDesignation_decode_uper, + FANSICAOfacilityDesignation_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSICAOfacilityDesignation_tags_1, + sizeof(asn_DEF_FANSICAOfacilityDesignation_tags_1) + /sizeof(asn_DEF_FANSICAOfacilityDesignation_tags_1[0]), /* 1 */ + asn_DEF_FANSICAOfacilityDesignation_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSICAOfacilityDesignation_tags_1) + /sizeof(asn_DEF_FANSICAOfacilityDesignation_tags_1[0]), /* 1 */ + &asn_PER_type_FANSICAOfacilityDesignation_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOfacilityDesignation.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOfacilityDesignation.h new file mode 100644 index 000000000..46a12c137 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSICAOfacilityDesignation.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSICAOfacilityDesignation_H_ +#define _FANSICAOfacilityDesignation_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSICAOfacilityDesignation */ +typedef IA5String_t FANSICAOfacilityDesignation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSICAOfacilityDesignation; +asn_struct_free_f FANSICAOfacilityDesignation_free; +asn_struct_print_f FANSICAOfacilityDesignation_print; +asn_constr_check_f FANSICAOfacilityDesignation_constraint; +ber_type_decoder_f FANSICAOfacilityDesignation_decode_ber; +der_type_encoder_f FANSICAOfacilityDesignation_encode_der; +xer_type_decoder_f FANSICAOfacilityDesignation_decode_xer; +xer_type_encoder_f FANSICAOfacilityDesignation_encode_xer; +per_type_decoder_f FANSICAOfacilityDesignation_decode_uper; +per_type_encoder_f FANSICAOfacilityDesignation_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSICAOfacilityDesignation_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSIcing.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSIcing.c new file mode 100644 index 000000000..7ca282c42 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSIcing.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSIcing.h" + +int +FANSIcing_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSIcing_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSIcing_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSIcing_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSIcing_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSIcing_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSIcing_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSIcing_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSIcing_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSIcing_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSIcing_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSIcing_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSIcing_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSIcing_value2enum_1[] = { + { 0, 5, "trace" }, + { 1, 5, "light" }, + { 2, 8, "moderate" }, + { 3, 6, "severe" } +}; +static const unsigned int asn_MAP_FANSIcing_enum2value_1[] = { + 1, /* light(1) */ + 2, /* moderate(2) */ + 3, /* severe(3) */ + 0 /* trace(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSIcing_specs_1 = { + asn_MAP_FANSIcing_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSIcing_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSIcing_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSIcing = { + "FANSIcing", + "FANSIcing", + FANSIcing_free, + FANSIcing_print, + FANSIcing_constraint, + FANSIcing_decode_ber, + FANSIcing_encode_der, + FANSIcing_decode_xer, + FANSIcing_encode_xer, + FANSIcing_decode_uper, + FANSIcing_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSIcing_tags_1, + sizeof(asn_DEF_FANSIcing_tags_1) + /sizeof(asn_DEF_FANSIcing_tags_1[0]), /* 1 */ + asn_DEF_FANSIcing_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSIcing_tags_1) + /sizeof(asn_DEF_FANSIcing_tags_1[0]), /* 1 */ + &asn_PER_type_FANSIcing_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSIcing_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSIcing.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSIcing.h new file mode 100644 index 000000000..dec15d9c0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSIcing.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSIcing_H_ +#define _FANSIcing_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSIcing { + FANSIcing_trace = 0, + FANSIcing_light = 1, + FANSIcing_moderate = 2, + FANSIcing_severe = 3 +} e_FANSIcing; + +/* FANSIcing */ +typedef long FANSIcing_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSIcing; +asn_struct_free_f FANSIcing_free; +asn_struct_print_f FANSIcing_print; +asn_constr_check_f FANSIcing_constraint; +ber_type_decoder_f FANSIcing_decode_ber; +der_type_encoder_f FANSIcing_encode_der; +xer_type_decoder_f FANSIcing_decode_xer; +xer_type_encoder_f FANSIcing_encode_xer; +per_type_decoder_f FANSIcing_decode_uper; +per_type_encoder_f FANSIcing_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSIcing_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFrom.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFrom.c new file mode 100644 index 000000000..b9da1f4c5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFrom.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSInterceptCourseFrom.h" + +static asn_TYPE_member_t asn_MBR_FANSInterceptCourseFrom_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSInterceptCourseFrom, interceptCourceFromSelection), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSInterceptCourseFromSelection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "interceptCourceFromSelection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSInterceptCourseFrom, degrees), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSInterceptCourseFrom_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSInterceptCourseFrom_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* publishedIdentifier */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* degreesTrue */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* placeBearingPlaceBearing */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSInterceptCourseFrom_specs_1 = { + sizeof(struct FANSInterceptCourseFrom), + offsetof(struct FANSInterceptCourseFrom, _asn_ctx), + asn_MAP_FANSInterceptCourseFrom_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSInterceptCourseFrom = { + "FANSInterceptCourseFrom", + "FANSInterceptCourseFrom", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSInterceptCourseFrom_tags_1, + sizeof(asn_DEF_FANSInterceptCourseFrom_tags_1) + /sizeof(asn_DEF_FANSInterceptCourseFrom_tags_1[0]), /* 1 */ + asn_DEF_FANSInterceptCourseFrom_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSInterceptCourseFrom_tags_1) + /sizeof(asn_DEF_FANSInterceptCourseFrom_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSInterceptCourseFrom_1, + 2, /* Elements count */ + &asn_SPC_FANSInterceptCourseFrom_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFrom.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFrom.h new file mode 100644 index 000000000..48162e836 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFrom.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSInterceptCourseFrom_H_ +#define _FANSInterceptCourseFrom_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSInterceptCourseFromSelection.h" +#include "FANSDegrees.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSInterceptCourseFrom */ +typedef struct FANSInterceptCourseFrom { + FANSInterceptCourseFromSelection_t interceptCourceFromSelection; + FANSDegrees_t degrees; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSInterceptCourseFrom_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSInterceptCourseFrom; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSInterceptCourseFrom_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSelection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSelection.c new file mode 100644 index 000000000..2f966deaf --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSelection.c @@ -0,0 +1,91 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSInterceptCourseFromSelection.h" + +static asn_per_constraints_t asn_PER_type_FANSInterceptCourseFromSelection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSInterceptCourseFromSelection_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSInterceptCourseFromSelection, choice.publishedIdentifier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPublishedIdentifier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "publishedIdentifier" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSInterceptCourseFromSelection, choice.latitudeLongitude), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSInterceptCourseFromSelection, choice.placeBearingPlaceBearing), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPlaceBearingPlaceBearing, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "placeBearingPlaceBearing" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSInterceptCourseFromSelection, choice.placeBearingDistance), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPlaceBearingDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "placeBearingDistance" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSInterceptCourseFromSelection_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* publishedIdentifier */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* placeBearingPlaceBearing */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* placeBearingDistance */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSInterceptCourseFromSelection_specs_1 = { + sizeof(struct FANSInterceptCourseFromSelection), + offsetof(struct FANSInterceptCourseFromSelection, _asn_ctx), + offsetof(struct FANSInterceptCourseFromSelection, present), + sizeof(((struct FANSInterceptCourseFromSelection *)0)->present), + asn_MAP_FANSInterceptCourseFromSelection_tag2el_1, + 4, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSInterceptCourseFromSelection = { + "FANSInterceptCourseFromSelection", + "FANSInterceptCourseFromSelection", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSInterceptCourseFromSelection_constr_1, + asn_MBR_FANSInterceptCourseFromSelection_1, + 4, /* Elements count */ + &asn_SPC_FANSInterceptCourseFromSelection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSelection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSelection.h new file mode 100644 index 000000000..7fdeae3ed --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSelection.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSInterceptCourseFromSelection_H_ +#define _FANSInterceptCourseFromSelection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPublishedIdentifier.h" +#include "FANSLatitudeLongitude.h" +#include "FANSPlaceBearingPlaceBearing.h" +#include "FANSPlaceBearingDistance.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSInterceptCourseFromSelection_PR { + FANSInterceptCourseFromSelection_PR_NOTHING, /* No components present */ + FANSInterceptCourseFromSelection_PR_publishedIdentifier, + FANSInterceptCourseFromSelection_PR_latitudeLongitude, + FANSInterceptCourseFromSelection_PR_placeBearingPlaceBearing, + FANSInterceptCourseFromSelection_PR_placeBearingDistance +} FANSInterceptCourseFromSelection_PR; + +/* FANSInterceptCourseFromSelection */ +typedef struct FANSInterceptCourseFromSelection { + FANSInterceptCourseFromSelection_PR present; + union FANSInterceptCourseFromSelection_u { + FANSPublishedIdentifier_t publishedIdentifier; + FANSLatitudeLongitude_t latitudeLongitude; + FANSPlaceBearingPlaceBearing_t placeBearingPlaceBearing; + FANSPlaceBearingDistance_t placeBearingDistance; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSInterceptCourseFromSelection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSInterceptCourseFromSelection; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSInterceptCourseFromSelection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSequence.c new file mode 100644 index 000000000..d77c39e8d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSInterceptCourseFromSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSInterceptCourseFromSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSInterceptCourseFromSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSInterceptCourseFrom, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSInterceptCourseFromSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSInterceptCourseFromSequence_specs_1 = { + sizeof(struct FANSInterceptCourseFromSequence), + offsetof(struct FANSInterceptCourseFromSequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSInterceptCourseFromSequence = { + "FANSInterceptCourseFromSequence", + "FANSInterceptCourseFromSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSInterceptCourseFromSequence_tags_1, + sizeof(asn_DEF_FANSInterceptCourseFromSequence_tags_1) + /sizeof(asn_DEF_FANSInterceptCourseFromSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSInterceptCourseFromSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSInterceptCourseFromSequence_tags_1) + /sizeof(asn_DEF_FANSInterceptCourseFromSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSInterceptCourseFromSequence_constr_1, + asn_MBR_FANSInterceptCourseFromSequence_1, + 1, /* Single element */ + &asn_SPC_FANSInterceptCourseFromSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSequence.h new file mode 100644 index 000000000..9510a3a6b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSInterceptCourseFromSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSInterceptCourseFromSequence_H_ +#define _FANSInterceptCourseFromSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSInterceptCourseFrom; + +/* FANSInterceptCourseFromSequence */ +typedef struct FANSInterceptCourseFromSequence { + A_SEQUENCE_OF(struct FANSInterceptCourseFrom) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSInterceptCourseFromSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSInterceptCourseFromSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSInterceptCourseFrom.h" + +#endif /* _FANSInterceptCourseFromSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatLonReportingPoints.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatLonReportingPoints.c new file mode 100644 index 000000000..9a0a740e6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatLonReportingPoints.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatLonReportingPoints.h" + +static asn_per_constraints_t asn_PER_type_FANSLatLonReportingPoints_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSLatLonReportingPoints_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLatLonReportingPoints, choice.latitudeReportingPoints), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLatitudeReportingPoints, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeReportingPoints" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLatLonReportingPoints, choice.longitudeReportingPoints), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLongitudeReportingPoints, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "longitudeReportingPoints" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLatLonReportingPoints_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* latitudeReportingPoints */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* longitudeReportingPoints */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSLatLonReportingPoints_specs_1 = { + sizeof(struct FANSLatLonReportingPoints), + offsetof(struct FANSLatLonReportingPoints, _asn_ctx), + offsetof(struct FANSLatLonReportingPoints, present), + sizeof(((struct FANSLatLonReportingPoints *)0)->present), + asn_MAP_FANSLatLonReportingPoints_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatLonReportingPoints = { + "FANSLatLonReportingPoints", + "FANSLatLonReportingPoints", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSLatLonReportingPoints_constr_1, + asn_MBR_FANSLatLonReportingPoints_1, + 2, /* Elements count */ + &asn_SPC_FANSLatLonReportingPoints_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatLonReportingPoints.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatLonReportingPoints.h new file mode 100644 index 000000000..b8d083c3c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatLonReportingPoints.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatLonReportingPoints_H_ +#define _FANSLatLonReportingPoints_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLatitudeReportingPoints.h" +#include "FANSLongitudeReportingPoints.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSLatLonReportingPoints_PR { + FANSLatLonReportingPoints_PR_NOTHING, /* No components present */ + FANSLatLonReportingPoints_PR_latitudeReportingPoints, + FANSLatLonReportingPoints_PR_longitudeReportingPoints +} FANSLatLonReportingPoints_PR; + +/* FANSLatLonReportingPoints */ +typedef struct FANSLatLonReportingPoints { + FANSLatLonReportingPoints_PR present; + union FANSLatLonReportingPoints_u { + FANSLatitudeReportingPoints_t latitudeReportingPoints; + FANSLongitudeReportingPoints_t longitudeReportingPoints; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLatLonReportingPoints_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatLonReportingPoints; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLatLonReportingPoints_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitude.c new file mode 100644 index 000000000..97053c27e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitude.c @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatitude.h" + +static asn_TYPE_member_t asn_MBR_FANSLatitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLatitude, latitudeDegrees), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSLatitudeDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeDegrees" + }, + { ATF_POINTER, 1, offsetof(struct FANSLatitude, minutesLatLon), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSMinutesLatLon, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "minutesLatLon" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLatitude, latitudeDirection), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSLatitudeDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeDirection" + }, +}; +static const int asn_MAP_FANSLatitude_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSLatitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLatitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* latitudeDegrees */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* minutesLatLon */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 } /* latitudeDirection */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSLatitude_specs_1 = { + sizeof(struct FANSLatitude), + offsetof(struct FANSLatitude, _asn_ctx), + asn_MAP_FANSLatitude_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSLatitude_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatitude = { + "FANSLatitude", + "FANSLatitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLatitude_tags_1, + sizeof(asn_DEF_FANSLatitude_tags_1) + /sizeof(asn_DEF_FANSLatitude_tags_1[0]), /* 1 */ + asn_DEF_FANSLatitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLatitude_tags_1) + /sizeof(asn_DEF_FANSLatitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSLatitude_1, + 3, /* Elements count */ + &asn_SPC_FANSLatitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitude.h new file mode 100644 index 000000000..fb05fb946 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitude.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatitude_H_ +#define _FANSLatitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLatitudeDegrees.h" +#include "FANSMinutesLatLon.h" +#include "FANSLatitudeDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLatitude */ +typedef struct FANSLatitude { + FANSLatitudeDegrees_t latitudeDegrees; + FANSMinutesLatLon_t *minutesLatLon /* OPTIONAL */; + FANSLatitudeDirection_t latitudeDirection; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLatitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLatitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDegrees.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDegrees.c new file mode 100644 index 000000000..d7ac07535 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDegrees.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatitudeDegrees.h" + +int +FANSLatitudeDegrees_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 90)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSLatitudeDegrees_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSLatitudeDegrees_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLatitudeDegrees_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLatitudeDegrees_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLatitudeDegrees_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLatitudeDegrees_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLatitudeDegrees_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLatitudeDegrees_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLatitudeDegrees_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLatitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLatitudeDegrees_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 90 } /* (0..90) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSLatitudeDegrees_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatitudeDegrees = { + "FANSLatitudeDegrees", + "FANSLatitudeDegrees", + FANSLatitudeDegrees_free, + FANSLatitudeDegrees_print, + FANSLatitudeDegrees_constraint, + FANSLatitudeDegrees_decode_ber, + FANSLatitudeDegrees_encode_der, + FANSLatitudeDegrees_decode_xer, + FANSLatitudeDegrees_encode_xer, + FANSLatitudeDegrees_decode_uper, + FANSLatitudeDegrees_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLatitudeDegrees_tags_1, + sizeof(asn_DEF_FANSLatitudeDegrees_tags_1) + /sizeof(asn_DEF_FANSLatitudeDegrees_tags_1[0]), /* 1 */ + asn_DEF_FANSLatitudeDegrees_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLatitudeDegrees_tags_1) + /sizeof(asn_DEF_FANSLatitudeDegrees_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLatitudeDegrees_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDegrees.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDegrees.h new file mode 100644 index 000000000..68aeb3f15 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDegrees.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatitudeDegrees_H_ +#define _FANSLatitudeDegrees_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLatitudeDegrees */ +typedef long FANSLatitudeDegrees_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatitudeDegrees; +asn_struct_free_f FANSLatitudeDegrees_free; +asn_struct_print_f FANSLatitudeDegrees_print; +asn_constr_check_f FANSLatitudeDegrees_constraint; +ber_type_decoder_f FANSLatitudeDegrees_decode_ber; +der_type_encoder_f FANSLatitudeDegrees_encode_der; +xer_type_decoder_f FANSLatitudeDegrees_decode_xer; +xer_type_encoder_f FANSLatitudeDegrees_encode_xer; +per_type_decoder_f FANSLatitudeDegrees_decode_uper; +per_type_encoder_f FANSLatitudeDegrees_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLatitudeDegrees_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDirection.c new file mode 100644 index 000000000..bef084d22 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDirection.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatitudeDirection.h" + +int +FANSLatitudeDirection_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSLatitudeDirection_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSLatitudeDirection_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLatitudeDirection_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLatitudeDirection_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLatitudeDirection_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLatitudeDirection_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLatitudeDirection_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLatitudeDirection_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLatitudeDirection_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLatitudeDirection_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLatitudeDirection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSLatitudeDirection_value2enum_1[] = { + { 0, 5, "north" }, + { 1, 5, "south" } +}; +static const unsigned int asn_MAP_FANSLatitudeDirection_enum2value_1[] = { + 0, /* north(0) */ + 1 /* south(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSLatitudeDirection_specs_1 = { + asn_MAP_FANSLatitudeDirection_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSLatitudeDirection_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSLatitudeDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatitudeDirection = { + "FANSLatitudeDirection", + "FANSLatitudeDirection", + FANSLatitudeDirection_free, + FANSLatitudeDirection_print, + FANSLatitudeDirection_constraint, + FANSLatitudeDirection_decode_ber, + FANSLatitudeDirection_encode_der, + FANSLatitudeDirection_decode_xer, + FANSLatitudeDirection_encode_xer, + FANSLatitudeDirection_decode_uper, + FANSLatitudeDirection_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLatitudeDirection_tags_1, + sizeof(asn_DEF_FANSLatitudeDirection_tags_1) + /sizeof(asn_DEF_FANSLatitudeDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSLatitudeDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLatitudeDirection_tags_1) + /sizeof(asn_DEF_FANSLatitudeDirection_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLatitudeDirection_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSLatitudeDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDirection.h new file mode 100644 index 000000000..43ed1f962 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeDirection.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatitudeDirection_H_ +#define _FANSLatitudeDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSLatitudeDirection { + FANSLatitudeDirection_north = 0, + FANSLatitudeDirection_south = 1 +} e_FANSLatitudeDirection; + +/* FANSLatitudeDirection */ +typedef long FANSLatitudeDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatitudeDirection; +asn_struct_free_f FANSLatitudeDirection_free; +asn_struct_print_f FANSLatitudeDirection_print; +asn_constr_check_f FANSLatitudeDirection_constraint; +ber_type_decoder_f FANSLatitudeDirection_decode_ber; +der_type_encoder_f FANSLatitudeDirection_encode_der; +xer_type_decoder_f FANSLatitudeDirection_decode_xer; +xer_type_encoder_f FANSLatitudeDirection_encode_xer; +per_type_decoder_f FANSLatitudeDirection_decode_uper; +per_type_encoder_f FANSLatitudeDirection_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLatitudeDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitude.c new file mode 100644 index 000000000..a03671c47 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitude.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatitudeLongitude.h" + +static asn_TYPE_member_t asn_MBR_FANSLatitudeLongitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLatitudeLongitude, latitude), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLatitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLatitudeLongitude, longitude), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "longitude" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSLatitudeLongitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLatitudeLongitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* latitude */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* longitude */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSLatitudeLongitude_specs_1 = { + sizeof(struct FANSLatitudeLongitude), + offsetof(struct FANSLatitudeLongitude, _asn_ctx), + asn_MAP_FANSLatitudeLongitude_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatitudeLongitude = { + "FANSLatitudeLongitude", + "FANSLatitudeLongitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLatitudeLongitude_tags_1, + sizeof(asn_DEF_FANSLatitudeLongitude_tags_1) + /sizeof(asn_DEF_FANSLatitudeLongitude_tags_1[0]), /* 1 */ + asn_DEF_FANSLatitudeLongitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLatitudeLongitude_tags_1) + /sizeof(asn_DEF_FANSLatitudeLongitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSLatitudeLongitude_1, + 2, /* Elements count */ + &asn_SPC_FANSLatitudeLongitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitude.h new file mode 100644 index 000000000..2494675fb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitude.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatitudeLongitude_H_ +#define _FANSLatitudeLongitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLatitude.h" +#include "FANSLongitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLatitudeLongitude */ +typedef struct FANSLatitudeLongitude { + FANSLatitude_t latitude; + FANSLongitude_t longitude; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLatitudeLongitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatitudeLongitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLatitudeLongitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitudeSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitudeSequence.c new file mode 100644 index 000000000..15bc0dda4 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitudeSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatitudeLongitudeSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSLatitudeLongitudeSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 7, 7, 1, 128 } /* (SIZE(1..128)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSLatitudeLongitudeSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSLatitudeLongitudeSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSLatitudeLongitudeSequence_specs_1 = { + sizeof(struct FANSLatitudeLongitudeSequence), + offsetof(struct FANSLatitudeLongitudeSequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatitudeLongitudeSequence = { + "FANSLatitudeLongitudeSequence", + "FANSLatitudeLongitudeSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLatitudeLongitudeSequence_tags_1, + sizeof(asn_DEF_FANSLatitudeLongitudeSequence_tags_1) + /sizeof(asn_DEF_FANSLatitudeLongitudeSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSLatitudeLongitudeSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLatitudeLongitudeSequence_tags_1) + /sizeof(asn_DEF_FANSLatitudeLongitudeSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLatitudeLongitudeSequence_constr_1, + asn_MBR_FANSLatitudeLongitudeSequence_1, + 1, /* Single element */ + &asn_SPC_FANSLatitudeLongitudeSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitudeSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitudeSequence.h new file mode 100644 index 000000000..ea000b6f2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeLongitudeSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatitudeLongitudeSequence_H_ +#define _FANSLatitudeLongitudeSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSLatitudeLongitude; + +/* FANSLatitudeLongitudeSequence */ +typedef struct FANSLatitudeLongitudeSequence { + A_SEQUENCE_OF(struct FANSLatitudeLongitude) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLatitudeLongitudeSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatitudeLongitudeSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSLatitudeLongitude.h" + +#endif /* _FANSLatitudeLongitudeSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeReportingPoints.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeReportingPoints.c new file mode 100644 index 000000000..a68fc2cad --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeReportingPoints.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLatitudeReportingPoints.h" + +static asn_TYPE_member_t asn_MBR_FANSLatitudeReportingPoints_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLatitudeReportingPoints, latitudeDirection), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSLatitudeDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLatitudeReportingPoints, latitudeDegrees), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSLatitudeDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeDegrees" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSLatitudeReportingPoints_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLatitudeReportingPoints_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* latitudeDegrees */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* latitudeDirection */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSLatitudeReportingPoints_specs_1 = { + sizeof(struct FANSLatitudeReportingPoints), + offsetof(struct FANSLatitudeReportingPoints, _asn_ctx), + asn_MAP_FANSLatitudeReportingPoints_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLatitudeReportingPoints = { + "FANSLatitudeReportingPoints", + "FANSLatitudeReportingPoints", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLatitudeReportingPoints_tags_1, + sizeof(asn_DEF_FANSLatitudeReportingPoints_tags_1) + /sizeof(asn_DEF_FANSLatitudeReportingPoints_tags_1[0]), /* 1 */ + asn_DEF_FANSLatitudeReportingPoints_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLatitudeReportingPoints_tags_1) + /sizeof(asn_DEF_FANSLatitudeReportingPoints_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSLatitudeReportingPoints_1, + 2, /* Elements count */ + &asn_SPC_FANSLatitudeReportingPoints_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeReportingPoints.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeReportingPoints.h new file mode 100644 index 000000000..093f65ef4 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLatitudeReportingPoints.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLatitudeReportingPoints_H_ +#define _FANSLatitudeReportingPoints_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLatitudeDirection.h" +#include "FANSLatitudeDegrees.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLatitudeReportingPoints */ +typedef struct FANSLatitudeReportingPoints { + FANSLatitudeDirection_t latitudeDirection; + FANSLatitudeDegrees_t latitudeDegrees; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLatitudeReportingPoints_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLatitudeReportingPoints; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLatitudeReportingPoints_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistance.c new file mode 100644 index 000000000..d381e0a6a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistance.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLegDistance.h" + +static asn_per_constraints_t asn_PER_type_FANSLegDistance_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSLegDistance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLegDistance, choice.legDistanceEnglish), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLegDistanceEnglish, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "legDistanceEnglish" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLegDistance, choice.legDistanceMetric), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLegDistanceMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "legDistanceMetric" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLegDistance_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* legDistanceEnglish */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* legDistanceMetric */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSLegDistance_specs_1 = { + sizeof(struct FANSLegDistance), + offsetof(struct FANSLegDistance, _asn_ctx), + offsetof(struct FANSLegDistance, present), + sizeof(((struct FANSLegDistance *)0)->present), + asn_MAP_FANSLegDistance_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLegDistance = { + "FANSLegDistance", + "FANSLegDistance", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSLegDistance_constr_1, + asn_MBR_FANSLegDistance_1, + 2, /* Elements count */ + &asn_SPC_FANSLegDistance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistance.h new file mode 100644 index 000000000..5712b78e1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistance.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLegDistance_H_ +#define _FANSLegDistance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLegDistanceEnglish.h" +#include "FANSLegDistanceMetric.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSLegDistance_PR { + FANSLegDistance_PR_NOTHING, /* No components present */ + FANSLegDistance_PR_legDistanceEnglish, + FANSLegDistance_PR_legDistanceMetric +} FANSLegDistance_PR; + +/* FANSLegDistance */ +typedef struct FANSLegDistance { + FANSLegDistance_PR present; + union FANSLegDistance_u { + FANSLegDistanceEnglish_t legDistanceEnglish; + FANSLegDistanceMetric_t legDistanceMetric; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLegDistance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLegDistance; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLegDistance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceEnglish.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceEnglish.c new file mode 100644 index 000000000..633c66786 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceEnglish.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLegDistanceEnglish.h" + +int +FANSLegDistanceEnglish_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 999)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSLegDistanceEnglish_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLegDistanceEnglish_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLegDistanceEnglish_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLegDistanceEnglish_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLegDistanceEnglish_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLegDistanceEnglish_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLegDistanceEnglish_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLegDistanceEnglish_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLegDistanceEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLegDistanceEnglish_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 1, 999 } /* (1..999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSLegDistanceEnglish_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLegDistanceEnglish = { + "FANSLegDistanceEnglish", + "FANSLegDistanceEnglish", + FANSLegDistanceEnglish_free, + FANSLegDistanceEnglish_print, + FANSLegDistanceEnglish_constraint, + FANSLegDistanceEnglish_decode_ber, + FANSLegDistanceEnglish_encode_der, + FANSLegDistanceEnglish_decode_xer, + FANSLegDistanceEnglish_encode_xer, + FANSLegDistanceEnglish_decode_uper, + FANSLegDistanceEnglish_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLegDistanceEnglish_tags_1, + sizeof(asn_DEF_FANSLegDistanceEnglish_tags_1) + /sizeof(asn_DEF_FANSLegDistanceEnglish_tags_1[0]), /* 1 */ + asn_DEF_FANSLegDistanceEnglish_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLegDistanceEnglish_tags_1) + /sizeof(asn_DEF_FANSLegDistanceEnglish_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLegDistanceEnglish_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceEnglish.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceEnglish.h new file mode 100644 index 000000000..94d569515 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceEnglish.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLegDistanceEnglish_H_ +#define _FANSLegDistanceEnglish_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLegDistanceEnglish */ +typedef long FANSLegDistanceEnglish_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLegDistanceEnglish; +asn_struct_free_f FANSLegDistanceEnglish_free; +asn_struct_print_f FANSLegDistanceEnglish_print; +asn_constr_check_f FANSLegDistanceEnglish_constraint; +ber_type_decoder_f FANSLegDistanceEnglish_decode_ber; +der_type_encoder_f FANSLegDistanceEnglish_encode_der; +xer_type_decoder_f FANSLegDistanceEnglish_decode_xer; +xer_type_encoder_f FANSLegDistanceEnglish_encode_xer; +per_type_decoder_f FANSLegDistanceEnglish_decode_uper; +per_type_encoder_f FANSLegDistanceEnglish_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLegDistanceEnglish_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceMetric.c new file mode 100644 index 000000000..c322a13b2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLegDistanceMetric.h" + +int +FANSLegDistanceMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 128)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSLegDistanceMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSLegDistanceMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLegDistanceMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLegDistanceMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLegDistanceMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLegDistanceMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLegDistanceMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLegDistanceMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLegDistanceMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLegDistanceMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLegDistanceMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 1, 128 } /* (1..128) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSLegDistanceMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLegDistanceMetric = { + "FANSLegDistanceMetric", + "FANSLegDistanceMetric", + FANSLegDistanceMetric_free, + FANSLegDistanceMetric_print, + FANSLegDistanceMetric_constraint, + FANSLegDistanceMetric_decode_ber, + FANSLegDistanceMetric_encode_der, + FANSLegDistanceMetric_decode_xer, + FANSLegDistanceMetric_encode_xer, + FANSLegDistanceMetric_decode_uper, + FANSLegDistanceMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLegDistanceMetric_tags_1, + sizeof(asn_DEF_FANSLegDistanceMetric_tags_1) + /sizeof(asn_DEF_FANSLegDistanceMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSLegDistanceMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLegDistanceMetric_tags_1) + /sizeof(asn_DEF_FANSLegDistanceMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLegDistanceMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceMetric.h new file mode 100644 index 000000000..feef5a564 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegDistanceMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLegDistanceMetric_H_ +#define _FANSLegDistanceMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLegDistanceMetric */ +typedef long FANSLegDistanceMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLegDistanceMetric; +asn_struct_free_f FANSLegDistanceMetric_free; +asn_struct_print_f FANSLegDistanceMetric_print; +asn_constr_check_f FANSLegDistanceMetric_constraint; +ber_type_decoder_f FANSLegDistanceMetric_decode_ber; +der_type_encoder_f FANSLegDistanceMetric_encode_der; +xer_type_decoder_f FANSLegDistanceMetric_decode_xer; +xer_type_encoder_f FANSLegDistanceMetric_encode_xer; +per_type_decoder_f FANSLegDistanceMetric_decode_uper; +per_type_encoder_f FANSLegDistanceMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLegDistanceMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegTime.c new file mode 100644 index 000000000..800172590 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegTime.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLegTime.h" + +int +FANSLegTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 99)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSLegTime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSLegTime_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLegTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLegTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLegTime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLegTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLegTime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLegTime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLegTime_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLegTime_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLegTime_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 1, 99 } /* (1..99) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSLegTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLegTime = { + "FANSLegTime", + "FANSLegTime", + FANSLegTime_free, + FANSLegTime_print, + FANSLegTime_constraint, + FANSLegTime_decode_ber, + FANSLegTime_encode_der, + FANSLegTime_decode_xer, + FANSLegTime_encode_xer, + FANSLegTime_decode_uper, + FANSLegTime_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLegTime_tags_1, + sizeof(asn_DEF_FANSLegTime_tags_1) + /sizeof(asn_DEF_FANSLegTime_tags_1[0]), /* 1 */ + asn_DEF_FANSLegTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLegTime_tags_1) + /sizeof(asn_DEF_FANSLegTime_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLegTime_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegTime.h new file mode 100644 index 000000000..e4db8dbea --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegTime.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLegTime_H_ +#define _FANSLegTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLegTime */ +typedef long FANSLegTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLegTime; +asn_struct_free_f FANSLegTime_free; +asn_struct_print_f FANSLegTime_print; +asn_constr_check_f FANSLegTime_constraint; +ber_type_decoder_f FANSLegTime_decode_ber; +der_type_encoder_f FANSLegTime_encode_der; +xer_type_decoder_f FANSLegTime_decode_xer; +xer_type_encoder_f FANSLegTime_encode_xer; +per_type_decoder_f FANSLegTime_decode_uper; +per_type_encoder_f FANSLegTime_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLegTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegType.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegType.c new file mode 100644 index 000000000..cfcaec7d6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegType.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLegType.h" + +static asn_per_constraints_t asn_PER_type_FANSLegType_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSLegType_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLegType, choice.legDistance), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSLegDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "legDistance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLegType, choice.legTime), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLegTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "legTime" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLegType_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* legDistance */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* legTime */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSLegType_specs_1 = { + sizeof(struct FANSLegType), + offsetof(struct FANSLegType, _asn_ctx), + offsetof(struct FANSLegType, present), + sizeof(((struct FANSLegType *)0)->present), + asn_MAP_FANSLegType_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLegType = { + "FANSLegType", + "FANSLegType", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSLegType_constr_1, + asn_MBR_FANSLegType_1, + 2, /* Elements count */ + &asn_SPC_FANSLegType_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLegType.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegType.h new file mode 100644 index 000000000..2980ee144 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLegType.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLegType_H_ +#define _FANSLegType_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLegDistance.h" +#include "FANSLegTime.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSLegType_PR { + FANSLegType_PR_NOTHING, /* No components present */ + FANSLegType_PR_legDistance, + FANSLegType_PR_legTime +} FANSLegType_PR; + +/* FANSLegType */ +typedef struct FANSLegType { + FANSLegType_PR present; + union FANSLegType_u { + FANSLegDistance_t legDistance; + FANSLegTime_t legTime; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLegType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLegType; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLegType_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitude.c new file mode 100644 index 000000000..c3fba94ac --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitude.c @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLongitude.h" + +static asn_TYPE_member_t asn_MBR_FANSLongitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLongitude, longitudeDegrees), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSLongitudeDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "longitudeDegrees" + }, + { ATF_POINTER, 1, offsetof(struct FANSLongitude, minutesLatLon), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSMinutesLatLon, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "minutesLatLon" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLongitude, longitudeDirection), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSLongitudeDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "longitudeDirection" + }, +}; +static const int asn_MAP_FANSLongitude_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSLongitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLongitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* longitudeDegrees */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* minutesLatLon */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 } /* longitudeDirection */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSLongitude_specs_1 = { + sizeof(struct FANSLongitude), + offsetof(struct FANSLongitude, _asn_ctx), + asn_MAP_FANSLongitude_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSLongitude_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLongitude = { + "FANSLongitude", + "FANSLongitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLongitude_tags_1, + sizeof(asn_DEF_FANSLongitude_tags_1) + /sizeof(asn_DEF_FANSLongitude_tags_1[0]), /* 1 */ + asn_DEF_FANSLongitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLongitude_tags_1) + /sizeof(asn_DEF_FANSLongitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSLongitude_1, + 3, /* Elements count */ + &asn_SPC_FANSLongitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitude.h new file mode 100644 index 000000000..064d58103 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitude.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLongitude_H_ +#define _FANSLongitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLongitudeDegrees.h" +#include "FANSMinutesLatLon.h" +#include "FANSLongitudeDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLongitude */ +typedef struct FANSLongitude { + FANSLongitudeDegrees_t longitudeDegrees; + FANSMinutesLatLon_t *minutesLatLon /* OPTIONAL */; + FANSLongitudeDirection_t longitudeDirection; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLongitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLongitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLongitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDegrees.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDegrees.c new file mode 100644 index 000000000..b22dcffa1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDegrees.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLongitudeDegrees.h" + +int +FANSLongitudeDegrees_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 180)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSLongitudeDegrees_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSLongitudeDegrees_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLongitudeDegrees_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLongitudeDegrees_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLongitudeDegrees_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLongitudeDegrees_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLongitudeDegrees_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLongitudeDegrees_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLongitudeDegrees_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLongitudeDegrees_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLongitudeDegrees_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 180 } /* (0..180) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSLongitudeDegrees_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLongitudeDegrees = { + "FANSLongitudeDegrees", + "FANSLongitudeDegrees", + FANSLongitudeDegrees_free, + FANSLongitudeDegrees_print, + FANSLongitudeDegrees_constraint, + FANSLongitudeDegrees_decode_ber, + FANSLongitudeDegrees_encode_der, + FANSLongitudeDegrees_decode_xer, + FANSLongitudeDegrees_encode_xer, + FANSLongitudeDegrees_decode_uper, + FANSLongitudeDegrees_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLongitudeDegrees_tags_1, + sizeof(asn_DEF_FANSLongitudeDegrees_tags_1) + /sizeof(asn_DEF_FANSLongitudeDegrees_tags_1[0]), /* 1 */ + asn_DEF_FANSLongitudeDegrees_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLongitudeDegrees_tags_1) + /sizeof(asn_DEF_FANSLongitudeDegrees_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLongitudeDegrees_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDegrees.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDegrees.h new file mode 100644 index 000000000..bfdc38bdc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDegrees.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLongitudeDegrees_H_ +#define _FANSLongitudeDegrees_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLongitudeDegrees */ +typedef long FANSLongitudeDegrees_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLongitudeDegrees; +asn_struct_free_f FANSLongitudeDegrees_free; +asn_struct_print_f FANSLongitudeDegrees_print; +asn_constr_check_f FANSLongitudeDegrees_constraint; +ber_type_decoder_f FANSLongitudeDegrees_decode_ber; +der_type_encoder_f FANSLongitudeDegrees_encode_der; +xer_type_decoder_f FANSLongitudeDegrees_decode_xer; +xer_type_encoder_f FANSLongitudeDegrees_encode_xer; +per_type_decoder_f FANSLongitudeDegrees_decode_uper; +per_type_encoder_f FANSLongitudeDegrees_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLongitudeDegrees_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDirection.c new file mode 100644 index 000000000..f86579b86 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDirection.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLongitudeDirection.h" + +int +FANSLongitudeDirection_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSLongitudeDirection_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSLongitudeDirection_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSLongitudeDirection_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSLongitudeDirection_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSLongitudeDirection_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSLongitudeDirection_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSLongitudeDirection_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSLongitudeDirection_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSLongitudeDirection_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSLongitudeDirection_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSLongitudeDirection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSLongitudeDirection_value2enum_1[] = { + { 0, 4, "east" }, + { 1, 4, "west" } +}; +static const unsigned int asn_MAP_FANSLongitudeDirection_enum2value_1[] = { + 0, /* east(0) */ + 1 /* west(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSLongitudeDirection_specs_1 = { + asn_MAP_FANSLongitudeDirection_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSLongitudeDirection_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSLongitudeDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSLongitudeDirection = { + "FANSLongitudeDirection", + "FANSLongitudeDirection", + FANSLongitudeDirection_free, + FANSLongitudeDirection_print, + FANSLongitudeDirection_constraint, + FANSLongitudeDirection_decode_ber, + FANSLongitudeDirection_encode_der, + FANSLongitudeDirection_decode_xer, + FANSLongitudeDirection_encode_xer, + FANSLongitudeDirection_decode_uper, + FANSLongitudeDirection_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLongitudeDirection_tags_1, + sizeof(asn_DEF_FANSLongitudeDirection_tags_1) + /sizeof(asn_DEF_FANSLongitudeDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSLongitudeDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLongitudeDirection_tags_1) + /sizeof(asn_DEF_FANSLongitudeDirection_tags_1[0]), /* 1 */ + &asn_PER_type_FANSLongitudeDirection_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSLongitudeDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDirection.h new file mode 100644 index 000000000..6b063f2ae --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeDirection.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLongitudeDirection_H_ +#define _FANSLongitudeDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSLongitudeDirection { + FANSLongitudeDirection_east = 0, + FANSLongitudeDirection_west = 1 +} e_FANSLongitudeDirection; + +/* FANSLongitudeDirection */ +typedef long FANSLongitudeDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLongitudeDirection; +asn_struct_free_f FANSLongitudeDirection_free; +asn_struct_print_f FANSLongitudeDirection_print; +asn_constr_check_f FANSLongitudeDirection_constraint; +ber_type_decoder_f FANSLongitudeDirection_decode_ber; +der_type_encoder_f FANSLongitudeDirection_encode_der; +xer_type_decoder_f FANSLongitudeDirection_decode_xer; +xer_type_encoder_f FANSLongitudeDirection_encode_xer; +per_type_decoder_f FANSLongitudeDirection_decode_uper; +per_type_encoder_f FANSLongitudeDirection_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLongitudeDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeReportingPoints.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeReportingPoints.c new file mode 100644 index 000000000..8e8a9954b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeReportingPoints.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSLongitudeReportingPoints.h" + +static asn_TYPE_member_t asn_MBR_FANSLongitudeReportingPoints_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSLongitudeReportingPoints, longitudeDirection), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSLongitudeDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "longitudeDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSLongitudeReportingPoints, longitudeDegrees), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSLongitudeDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "longitudeDegrees" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSLongitudeReportingPoints_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSLongitudeReportingPoints_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* longitudeDegrees */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* longitudeDirection */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSLongitudeReportingPoints_specs_1 = { + sizeof(struct FANSLongitudeReportingPoints), + offsetof(struct FANSLongitudeReportingPoints, _asn_ctx), + asn_MAP_FANSLongitudeReportingPoints_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSLongitudeReportingPoints = { + "FANSLongitudeReportingPoints", + "FANSLongitudeReportingPoints", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSLongitudeReportingPoints_tags_1, + sizeof(asn_DEF_FANSLongitudeReportingPoints_tags_1) + /sizeof(asn_DEF_FANSLongitudeReportingPoints_tags_1[0]), /* 1 */ + asn_DEF_FANSLongitudeReportingPoints_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSLongitudeReportingPoints_tags_1) + /sizeof(asn_DEF_FANSLongitudeReportingPoints_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSLongitudeReportingPoints_1, + 2, /* Elements count */ + &asn_SPC_FANSLongitudeReportingPoints_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeReportingPoints.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeReportingPoints.h new file mode 100644 index 000000000..ca21fe23d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSLongitudeReportingPoints.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSLongitudeReportingPoints_H_ +#define _FANSLongitudeReportingPoints_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLongitudeDirection.h" +#include "FANSLongitudeDegrees.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSLongitudeReportingPoints */ +typedef struct FANSLongitudeReportingPoints { + FANSLongitudeDirection_t longitudeDirection; + FANSLongitudeDegrees_t longitudeDegrees; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSLongitudeReportingPoints_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSLongitudeReportingPoints; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSLongitudeReportingPoints_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSMinutesLatLon.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSMinutesLatLon.c new file mode 100644 index 000000000..6ef837d3f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSMinutesLatLon.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSMinutesLatLon.h" + +int +FANSMinutesLatLon_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 599)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSMinutesLatLon_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSMinutesLatLon_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSMinutesLatLon_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSMinutesLatLon_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSMinutesLatLon_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSMinutesLatLon_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSMinutesLatLon_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSMinutesLatLon_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSMinutesLatLon_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSMinutesLatLon_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSMinutesLatLon_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 0, 599 } /* (0..599) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSMinutesLatLon_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSMinutesLatLon = { + "FANSMinutesLatLon", + "FANSMinutesLatLon", + FANSMinutesLatLon_free, + FANSMinutesLatLon_print, + FANSMinutesLatLon_constraint, + FANSMinutesLatLon_decode_ber, + FANSMinutesLatLon_encode_der, + FANSMinutesLatLon_decode_xer, + FANSMinutesLatLon_encode_xer, + FANSMinutesLatLon_decode_uper, + FANSMinutesLatLon_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSMinutesLatLon_tags_1, + sizeof(asn_DEF_FANSMinutesLatLon_tags_1) + /sizeof(asn_DEF_FANSMinutesLatLon_tags_1[0]), /* 1 */ + asn_DEF_FANSMinutesLatLon_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSMinutesLatLon_tags_1) + /sizeof(asn_DEF_FANSMinutesLatLon_tags_1[0]), /* 1 */ + &asn_PER_type_FANSMinutesLatLon_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSMinutesLatLon.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSMinutesLatLon.h new file mode 100644 index 000000000..f6681266f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSMinutesLatLon.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSMinutesLatLon_H_ +#define _FANSMinutesLatLon_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSMinutesLatLon */ +typedef long FANSMinutesLatLon_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSMinutesLatLon; +asn_struct_free_f FANSMinutesLatLon_free; +asn_struct_print_f FANSMinutesLatLon_print; +asn_constr_check_f FANSMinutesLatLon_constraint; +ber_type_decoder_f FANSMinutesLatLon_decode_ber; +der_type_encoder_f FANSMinutesLatLon_encode_der; +xer_type_decoder_f FANSMinutesLatLon_decode_xer; +xer_type_encoder_f FANSMinutesLatLon_encode_xer; +per_type_decoder_f FANSMinutesLatLon_decode_uper; +per_type_encoder_f FANSMinutesLatLon_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSMinutesLatLon_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgIdentificationNumber.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgIdentificationNumber.c new file mode 100644 index 000000000..c624777cd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgIdentificationNumber.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSMsgIdentificationNumber.h" + +int +FANSMsgIdentificationNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSMsgIdentificationNumber_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSMsgIdentificationNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSMsgIdentificationNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSMsgIdentificationNumber_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSMsgIdentificationNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSMsgIdentificationNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSMsgIdentificationNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSMsgIdentificationNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSMsgIdentificationNumber_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSMsgIdentificationNumber_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSMsgIdentificationNumber_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSMsgIdentificationNumber = { + "FANSMsgIdentificationNumber", + "FANSMsgIdentificationNumber", + FANSMsgIdentificationNumber_free, + FANSMsgIdentificationNumber_print, + FANSMsgIdentificationNumber_constraint, + FANSMsgIdentificationNumber_decode_ber, + FANSMsgIdentificationNumber_encode_der, + FANSMsgIdentificationNumber_decode_xer, + FANSMsgIdentificationNumber_encode_xer, + FANSMsgIdentificationNumber_decode_uper, + FANSMsgIdentificationNumber_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSMsgIdentificationNumber_tags_1, + sizeof(asn_DEF_FANSMsgIdentificationNumber_tags_1) + /sizeof(asn_DEF_FANSMsgIdentificationNumber_tags_1[0]), /* 1 */ + asn_DEF_FANSMsgIdentificationNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSMsgIdentificationNumber_tags_1) + /sizeof(asn_DEF_FANSMsgIdentificationNumber_tags_1[0]), /* 1 */ + &asn_PER_type_FANSMsgIdentificationNumber_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgIdentificationNumber.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgIdentificationNumber.h new file mode 100644 index 000000000..04eeca8bd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgIdentificationNumber.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSMsgIdentificationNumber_H_ +#define _FANSMsgIdentificationNumber_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSMsgIdentificationNumber */ +typedef long FANSMsgIdentificationNumber_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSMsgIdentificationNumber; +asn_struct_free_f FANSMsgIdentificationNumber_free; +asn_struct_print_f FANSMsgIdentificationNumber_print; +asn_constr_check_f FANSMsgIdentificationNumber_constraint; +ber_type_decoder_f FANSMsgIdentificationNumber_decode_ber; +der_type_encoder_f FANSMsgIdentificationNumber_encode_der; +xer_type_decoder_f FANSMsgIdentificationNumber_decode_xer; +xer_type_encoder_f FANSMsgIdentificationNumber_encode_xer; +per_type_decoder_f FANSMsgIdentificationNumber_decode_uper; +per_type_encoder_f FANSMsgIdentificationNumber_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSMsgIdentificationNumber_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgReferenceNumber.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgReferenceNumber.c new file mode 100644 index 000000000..8726d74be --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgReferenceNumber.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSMsgReferenceNumber.h" + +int +FANSMsgReferenceNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSMsgReferenceNumber_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSMsgReferenceNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSMsgReferenceNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSMsgReferenceNumber_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSMsgReferenceNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSMsgReferenceNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSMsgReferenceNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSMsgReferenceNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSMsgReferenceNumber_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSMsgReferenceNumber_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSMsgReferenceNumber_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSMsgReferenceNumber = { + "FANSMsgReferenceNumber", + "FANSMsgReferenceNumber", + FANSMsgReferenceNumber_free, + FANSMsgReferenceNumber_print, + FANSMsgReferenceNumber_constraint, + FANSMsgReferenceNumber_decode_ber, + FANSMsgReferenceNumber_encode_der, + FANSMsgReferenceNumber_decode_xer, + FANSMsgReferenceNumber_encode_xer, + FANSMsgReferenceNumber_decode_uper, + FANSMsgReferenceNumber_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSMsgReferenceNumber_tags_1, + sizeof(asn_DEF_FANSMsgReferenceNumber_tags_1) + /sizeof(asn_DEF_FANSMsgReferenceNumber_tags_1[0]), /* 1 */ + asn_DEF_FANSMsgReferenceNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSMsgReferenceNumber_tags_1) + /sizeof(asn_DEF_FANSMsgReferenceNumber_tags_1[0]), /* 1 */ + &asn_PER_type_FANSMsgReferenceNumber_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgReferenceNumber.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgReferenceNumber.h new file mode 100644 index 000000000..c04a3661a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSMsgReferenceNumber.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSMsgReferenceNumber_H_ +#define _FANSMsgReferenceNumber_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSMsgReferenceNumber */ +typedef long FANSMsgReferenceNumber_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSMsgReferenceNumber; +asn_struct_free_f FANSMsgReferenceNumber_free; +asn_struct_print_f FANSMsgReferenceNumber_print; +asn_constr_check_f FANSMsgReferenceNumber_constraint; +ber_type_decoder_f FANSMsgReferenceNumber_decode_ber; +der_type_encoder_f FANSMsgReferenceNumber_encode_der; +xer_type_decoder_f FANSMsgReferenceNumber_decode_xer; +xer_type_encoder_f FANSMsgReferenceNumber_encode_xer; +per_type_decoder_f FANSMsgReferenceNumber_decode_uper; +per_type_encoder_f FANSMsgReferenceNumber_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSMsgReferenceNumber_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSNavaid.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSNavaid.c new file mode 100644 index 000000000..592d84c1f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSNavaid.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSNavaid.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSNavaid_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 4) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSNavaid_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSNavaid_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSNavaid_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSNavaid_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSNavaid_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSNavaid_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSNavaid_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSNavaid_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSNavaid_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSNavaid_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSNavaid_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSNavaid_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSNavaid = { + "FANSNavaid", + "FANSNavaid", + FANSNavaid_free, + FANSNavaid_print, + FANSNavaid_constraint, + FANSNavaid_decode_ber, + FANSNavaid_encode_der, + FANSNavaid_decode_xer, + FANSNavaid_encode_xer, + FANSNavaid_decode_uper, + FANSNavaid_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSNavaid_tags_1, + sizeof(asn_DEF_FANSNavaid_tags_1) + /sizeof(asn_DEF_FANSNavaid_tags_1[0]), /* 1 */ + asn_DEF_FANSNavaid_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSNavaid_tags_1) + /sizeof(asn_DEF_FANSNavaid_tags_1[0]), /* 1 */ + &asn_PER_type_FANSNavaid_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSNavaid.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSNavaid.h new file mode 100644 index 000000000..fcd44f64d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSNavaid.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSNavaid_H_ +#define _FANSNavaid_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSNavaid */ +typedef IA5String_t FANSNavaid_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSNavaid; +asn_struct_free_f FANSNavaid_free; +asn_struct_print_f FANSNavaid_print; +asn_constr_check_f FANSNavaid_constraint; +ber_type_decoder_f FANSNavaid_decode_ber; +der_type_encoder_f FANSNavaid_encode_der; +xer_type_decoder_f FANSNavaid_decode_xer; +xer_type_encoder_f FANSNavaid_encode_xer; +per_type_decoder_f FANSNavaid_decode_uper; +per_type_encoder_f FANSNavaid_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSNavaid_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPDCrevision.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPDCrevision.c new file mode 100644 index 000000000..2df0716b7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPDCrevision.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPDCrevision.h" + +int +FANSPDCrevision_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 16)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSPDCrevision_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSPDCrevision_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSPDCrevision_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSPDCrevision_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSPDCrevision_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSPDCrevision_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSPDCrevision_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSPDCrevision_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSPDCrevision_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSPDCrevision_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSPDCrevision_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (1..16) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSPDCrevision_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSPDCrevision = { + "FANSPDCrevision", + "FANSPDCrevision", + FANSPDCrevision_free, + FANSPDCrevision_print, + FANSPDCrevision_constraint, + FANSPDCrevision_decode_ber, + FANSPDCrevision_encode_der, + FANSPDCrevision_decode_xer, + FANSPDCrevision_encode_xer, + FANSPDCrevision_decode_uper, + FANSPDCrevision_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPDCrevision_tags_1, + sizeof(asn_DEF_FANSPDCrevision_tags_1) + /sizeof(asn_DEF_FANSPDCrevision_tags_1[0]), /* 1 */ + asn_DEF_FANSPDCrevision_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPDCrevision_tags_1) + /sizeof(asn_DEF_FANSPDCrevision_tags_1[0]), /* 1 */ + &asn_PER_type_FANSPDCrevision_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPDCrevision.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPDCrevision.h new file mode 100644 index 000000000..d9deda38e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPDCrevision.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPDCrevision_H_ +#define _FANSPDCrevision_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPDCrevision */ +typedef long FANSPDCrevision_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPDCrevision; +asn_struct_free_f FANSPDCrevision_free; +asn_struct_print_f FANSPDCrevision_print; +asn_constr_check_f FANSPDCrevision_constraint; +ber_type_decoder_f FANSPDCrevision_decode_ber; +der_type_encoder_f FANSPDCrevision_encode_der; +xer_type_decoder_f FANSPDCrevision_decode_xer; +xer_type_encoder_f FANSPDCrevision_encode_xer; +per_type_decoder_f FANSPDCrevision_decode_uper; +per_type_encoder_f FANSPDCrevision_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPDCrevision_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearing.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearing.c new file mode 100644 index 000000000..d6cc46a95 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearing.c @@ -0,0 +1,83 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPlaceBearing.h" + +static asn_TYPE_member_t asn_MBR_FANSPlaceBearing_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPlaceBearing, fixName), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSFixName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixName" + }, + { ATF_POINTER, 1, offsetof(struct FANSPlaceBearing, latitudeLongitude), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPlaceBearing, degrees), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, +}; +static const int asn_MAP_FANSPlaceBearing_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSPlaceBearing_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPlaceBearing_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 } /* degreesTrue */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPlaceBearing_specs_1 = { + sizeof(struct FANSPlaceBearing), + offsetof(struct FANSPlaceBearing, _asn_ctx), + asn_MAP_FANSPlaceBearing_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_FANSPlaceBearing_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPlaceBearing = { + "FANSPlaceBearing", + "FANSPlaceBearing", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPlaceBearing_tags_1, + sizeof(asn_DEF_FANSPlaceBearing_tags_1) + /sizeof(asn_DEF_FANSPlaceBearing_tags_1[0]), /* 1 */ + asn_DEF_FANSPlaceBearing_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPlaceBearing_tags_1) + /sizeof(asn_DEF_FANSPlaceBearing_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPlaceBearing_1, + 3, /* Elements count */ + &asn_SPC_FANSPlaceBearing_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearing.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearing.h new file mode 100644 index 000000000..ee2694109 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearing.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPlaceBearing_H_ +#define _FANSPlaceBearing_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFixName.h" +#include "FANSDegrees.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSLatitudeLongitude; + +/* FANSPlaceBearing */ +typedef struct FANSPlaceBearing { + FANSFixName_t fixName; + struct FANSLatitudeLongitude *latitudeLongitude /* OPTIONAL */; + FANSDegrees_t degrees; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPlaceBearing_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPlaceBearing; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSLatitudeLongitude.h" + +#endif /* _FANSPlaceBearing_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingDistance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingDistance.c new file mode 100644 index 000000000..7a667a4e8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingDistance.c @@ -0,0 +1,94 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPlaceBearingDistance.h" + +static asn_TYPE_member_t asn_MBR_FANSPlaceBearingDistance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPlaceBearingDistance, fixName), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSFixName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixName" + }, + { ATF_POINTER, 1, offsetof(struct FANSPlaceBearingDistance, latitudeLongitude), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPlaceBearingDistance, degrees), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPlaceBearingDistance, distance), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distance" + }, +}; +static const int asn_MAP_FANSPlaceBearingDistance_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSPlaceBearingDistance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPlaceBearingDistance_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 1 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, -1, 0 }, /* distanceNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 1 }, /* degreesTrue */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, -1, 0 } /* distanceKm */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPlaceBearingDistance_specs_1 = { + sizeof(struct FANSPlaceBearingDistance), + offsetof(struct FANSPlaceBearingDistance, _asn_ctx), + asn_MAP_FANSPlaceBearingDistance_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_FANSPlaceBearingDistance_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPlaceBearingDistance = { + "FANSPlaceBearingDistance", + "FANSPlaceBearingDistance", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPlaceBearingDistance_tags_1, + sizeof(asn_DEF_FANSPlaceBearingDistance_tags_1) + /sizeof(asn_DEF_FANSPlaceBearingDistance_tags_1[0]), /* 1 */ + asn_DEF_FANSPlaceBearingDistance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPlaceBearingDistance_tags_1) + /sizeof(asn_DEF_FANSPlaceBearingDistance_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPlaceBearingDistance_1, + 4, /* Elements count */ + &asn_SPC_FANSPlaceBearingDistance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingDistance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingDistance.h new file mode 100644 index 000000000..a0db3b196 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingDistance.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPlaceBearingDistance_H_ +#define _FANSPlaceBearingDistance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFixName.h" +#include "FANSDegrees.h" +#include "FANSDistance.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSLatitudeLongitude; + +/* FANSPlaceBearingDistance */ +typedef struct FANSPlaceBearingDistance { + FANSFixName_t fixName; + struct FANSLatitudeLongitude *latitudeLongitude /* OPTIONAL */; + FANSDegrees_t degrees; + FANSDistance_t distance; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPlaceBearingDistance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPlaceBearingDistance; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSLatitudeLongitude.h" + +#endif /* _FANSPlaceBearingDistance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingPlaceBearing.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingPlaceBearing.c new file mode 100644 index 000000000..86aab9c0e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingPlaceBearing.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPlaceBearingPlaceBearing.h" + +static asn_per_constraints_t asn_PER_type_FANSPlaceBearingPlaceBearing_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 2, 2 } /* (SIZE(2..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSPlaceBearingPlaceBearing_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSPlaceBearing, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPlaceBearingPlaceBearing_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSPlaceBearingPlaceBearing_specs_1 = { + sizeof(struct FANSPlaceBearingPlaceBearing), + offsetof(struct FANSPlaceBearingPlaceBearing, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPlaceBearingPlaceBearing = { + "FANSPlaceBearingPlaceBearing", + "FANSPlaceBearingPlaceBearing", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPlaceBearingPlaceBearing_tags_1, + sizeof(asn_DEF_FANSPlaceBearingPlaceBearing_tags_1) + /sizeof(asn_DEF_FANSPlaceBearingPlaceBearing_tags_1[0]), /* 1 */ + asn_DEF_FANSPlaceBearingPlaceBearing_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPlaceBearingPlaceBearing_tags_1) + /sizeof(asn_DEF_FANSPlaceBearingPlaceBearing_tags_1[0]), /* 1 */ + &asn_PER_type_FANSPlaceBearingPlaceBearing_constr_1, + asn_MBR_FANSPlaceBearingPlaceBearing_1, + 1, /* Single element */ + &asn_SPC_FANSPlaceBearingPlaceBearing_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingPlaceBearing.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingPlaceBearing.h new file mode 100644 index 000000000..16c01ed7d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPlaceBearingPlaceBearing.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPlaceBearingPlaceBearing_H_ +#define _FANSPlaceBearingPlaceBearing_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSPlaceBearing; + +/* FANSPlaceBearingPlaceBearing */ +typedef struct FANSPlaceBearingPlaceBearing { + A_SEQUENCE_OF(struct FANSPlaceBearing) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPlaceBearingPlaceBearing_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPlaceBearingPlaceBearing; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSPlaceBearing.h" + +#endif /* _FANSPlaceBearingPlaceBearing_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPosition.c new file mode 100644 index 000000000..e563eea2c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPosition.c @@ -0,0 +1,101 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPosition.h" + +static asn_per_constraints_t asn_PER_type_FANSPosition_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSPosition_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPosition, choice.fixName), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFixName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPosition, choice.navaid), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSNavaid, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "navaid" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPosition, choice.airport), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAirport, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "airport" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPosition, choice.latitudeLongitude), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPosition, choice.placeBearingDistance), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPlaceBearingDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "placeBearingDistance" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPosition_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* placeBearingDistance */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSPosition_specs_1 = { + sizeof(struct FANSPosition), + offsetof(struct FANSPosition, _asn_ctx), + offsetof(struct FANSPosition, present), + sizeof(((struct FANSPosition *)0)->present), + asn_MAP_FANSPosition_tag2el_1, + 5, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPosition = { + "FANSPosition", + "FANSPosition", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSPosition_constr_1, + asn_MBR_FANSPosition_1, + 5, /* Elements count */ + &asn_SPC_FANSPosition_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPosition.h new file mode 100644 index 000000000..4c418f3bb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPosition.h @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPosition_H_ +#define _FANSPosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFixName.h" +#include "FANSNavaid.h" +#include "FANSAirport.h" +#include "FANSLatitudeLongitude.h" +#include "FANSPlaceBearingDistance.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSPosition_PR { + FANSPosition_PR_NOTHING, /* No components present */ + FANSPosition_PR_fixName, + FANSPosition_PR_navaid, + FANSPosition_PR_airport, + FANSPosition_PR_latitudeLongitude, + FANSPosition_PR_placeBearingDistance +} FANSPosition_PR; + +/* FANSPosition */ +typedef struct FANSPosition { + FANSPosition_PR present; + union FANSPosition_u { + FANSFixName_t fixName; + FANSNavaid_t navaid; + FANSAirport_t airport; + FANSLatitudeLongitude_t latitudeLongitude; + FANSPlaceBearingDistance_t placeBearingDistance; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPosition; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitude.c new file mode 100644 index 000000000..740ff5c62 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitude.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitude, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitude, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, -1, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, -1, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 1 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, -1, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionAltitude_specs_1 = { + sizeof(struct FANSPositionAltitude), + offsetof(struct FANSPositionAltitude, _asn_ctx), + asn_MAP_FANSPositionAltitude_tag2el_1, + 13, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionAltitude = { + "FANSPositionAltitude", + "FANSPositionAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionAltitude_tags_1, + sizeof(asn_DEF_FANSPositionAltitude_tags_1) + /sizeof(asn_DEF_FANSPositionAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionAltitude_tags_1) + /sizeof(asn_DEF_FANSPositionAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionAltitude_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitude.h new file mode 100644 index 000000000..e1cbdc98e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitude.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionAltitude_H_ +#define _FANSPositionAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSAltitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionAltitude */ +typedef struct FANSPositionAltitude { + FANSPosition_t position; + FANSAltitude_t altitude; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeAltitude.c new file mode 100644 index 000000000..ac2412a7d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeAltitude.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionAltitudeAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionAltitudeAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitudeAltitude, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitudeAltitude, altitude_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSAltitudeAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude-seqOf" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionAltitudeAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionAltitudeAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* altitude-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionAltitudeAltitude_specs_1 = { + sizeof(struct FANSPositionAltitudeAltitude), + offsetof(struct FANSPositionAltitudeAltitude, _asn_ctx), + asn_MAP_FANSPositionAltitudeAltitude_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionAltitudeAltitude = { + "FANSPositionAltitudeAltitude", + "FANSPositionAltitudeAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionAltitudeAltitude_tags_1, + sizeof(asn_DEF_FANSPositionAltitudeAltitude_tags_1) + /sizeof(asn_DEF_FANSPositionAltitudeAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionAltitudeAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionAltitudeAltitude_tags_1) + /sizeof(asn_DEF_FANSPositionAltitudeAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionAltitudeAltitude_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionAltitudeAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeAltitude.h new file mode 100644 index 000000000..97355ce6b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeAltitude.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionAltitudeAltitude_H_ +#define _FANSPositionAltitudeAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSAltitudeAltitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionAltitudeAltitude */ +typedef struct FANSPositionAltitudeAltitude { + FANSPosition_t position; + FANSAltitudeAltitude_t altitude_seqOf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionAltitudeAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionAltitudeAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionAltitudeAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeSpeed.c new file mode 100644 index 000000000..6c3c554ad --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeSpeed.c @@ -0,0 +1,98 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionAltitudeSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionAltitudeSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitudeSpeed, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitudeSpeed, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionAltitudeSpeed, speed), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionAltitudeSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionAltitudeSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 2 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 1 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, -2, 0 }, /* speedIndicated */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 2 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 1 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, -2, 0 }, /* speedIndicatedMetric */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 2 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, -1, 1 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, -2, 0 }, /* speedTrue */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 2 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, -1, 1 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, -2, 0 }, /* speedTrueMetric */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 2 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, -1, 1 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 2, -2, 0 }, /* speedGround */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 1 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 2, -1, 0 }, /* speedGroundMetric */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 1 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 2, -1, 0 }, /* speedMach */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 1 }, /* altitudeFlightLevelMetric */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 2, -1, 0 } /* speedMachLarge */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionAltitudeSpeed_specs_1 = { + sizeof(struct FANSPositionAltitudeSpeed), + offsetof(struct FANSPositionAltitudeSpeed, _asn_ctx), + asn_MAP_FANSPositionAltitudeSpeed_tag2el_1, + 21, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionAltitudeSpeed = { + "FANSPositionAltitudeSpeed", + "FANSPositionAltitudeSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionAltitudeSpeed_tags_1, + sizeof(asn_DEF_FANSPositionAltitudeSpeed_tags_1) + /sizeof(asn_DEF_FANSPositionAltitudeSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionAltitudeSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionAltitudeSpeed_tags_1) + /sizeof(asn_DEF_FANSPositionAltitudeSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionAltitudeSpeed_1, + 3, /* Elements count */ + &asn_SPC_FANSPositionAltitudeSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeSpeed.h new file mode 100644 index 000000000..9c6e056ed --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionAltitudeSpeed.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionAltitudeSpeed_H_ +#define _FANSPositionAltitudeSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSAltitude.h" +#include "FANSSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionAltitudeSpeed */ +typedef struct FANSPositionAltitudeSpeed { + FANSPosition_t position; + FANSAltitude_t altitude; + FANSSpeed_t speed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionAltitudeSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionAltitudeSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionAltitudeSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionCurrent.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionCurrent.c new file mode 100644 index 000000000..86e47b42a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionCurrent.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionCurrent.h" + +int +FANSPositionCurrent_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSPosition, + * so here we adjust the DEF accordingly. + */ +static void +FANSPositionCurrent_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSPosition.free_struct; + td->print_struct = asn_DEF_FANSPosition.print_struct; + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + td->ber_decoder = asn_DEF_FANSPosition.ber_decoder; + td->der_encoder = asn_DEF_FANSPosition.der_encoder; + td->xer_decoder = asn_DEF_FANSPosition.xer_decoder; + td->xer_encoder = asn_DEF_FANSPosition.xer_encoder; + td->uper_decoder = asn_DEF_FANSPosition.uper_decoder; + td->uper_encoder = asn_DEF_FANSPosition.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSPosition.per_constraints; + td->elements = asn_DEF_FANSPosition.elements; + td->elements_count = asn_DEF_FANSPosition.elements_count; + td->specifics = asn_DEF_FANSPosition.specifics; +} + +void +FANSPositionCurrent_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSPositionCurrent_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSPositionCurrent_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSPositionCurrent_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSPositionCurrent_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSPositionCurrent_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSPositionCurrent_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSPositionCurrent_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSPositionCurrent_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionCurrent = { + "FANSPositionCurrent", + "FANSPositionCurrent", + FANSPositionCurrent_free, + FANSPositionCurrent_print, + FANSPositionCurrent_constraint, + FANSPositionCurrent_decode_ber, + FANSPositionCurrent_encode_der, + FANSPositionCurrent_decode_xer, + FANSPositionCurrent_encode_xer, + FANSPositionCurrent_decode_uper, + FANSPositionCurrent_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionCurrent.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionCurrent.h new file mode 100644 index 000000000..137ece418 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionCurrent.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionCurrent_H_ +#define _FANSPositionCurrent_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionCurrent */ +typedef FANSPosition_t FANSPositionCurrent_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionCurrent; +asn_struct_free_f FANSPositionCurrent_free; +asn_struct_print_f FANSPositionCurrent_print; +asn_constr_check_f FANSPositionCurrent_constraint; +ber_type_decoder_f FANSPositionCurrent_decode_ber; +der_type_encoder_f FANSPositionCurrent_encode_der; +xer_type_decoder_f FANSPositionCurrent_decode_xer; +xer_type_encoder_f FANSPositionCurrent_encode_xer; +per_type_decoder_f FANSPositionCurrent_decode_uper; +per_type_encoder_f FANSPositionCurrent_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionCurrent_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDegrees.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDegrees.c new file mode 100644 index 000000000..5965465ab --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDegrees.c @@ -0,0 +1,75 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionDegrees.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionDegrees_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionDegrees, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionDegrees, degrees), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDegrees, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degrees" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionDegrees_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionDegrees_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* degreesMagnetic */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* degreesTrue */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionDegrees_specs_1 = { + sizeof(struct FANSPositionDegrees), + offsetof(struct FANSPositionDegrees, _asn_ctx), + asn_MAP_FANSPositionDegrees_tag2el_1, + 7, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionDegrees = { + "FANSPositionDegrees", + "FANSPositionDegrees", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionDegrees_tags_1, + sizeof(asn_DEF_FANSPositionDegrees_tags_1) + /sizeof(asn_DEF_FANSPositionDegrees_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionDegrees_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionDegrees_tags_1) + /sizeof(asn_DEF_FANSPositionDegrees_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionDegrees_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionDegrees_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDegrees.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDegrees.h new file mode 100644 index 000000000..2b9ce1bd1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDegrees.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionDegrees_H_ +#define _FANSPositionDegrees_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSDegrees.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionDegrees */ +typedef struct FANSPositionDegrees { + FANSPosition_t position; + FANSDegrees_t degrees; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionDegrees_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionDegrees; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionDegrees_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDistanceOffsetDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDistanceOffsetDirection.c new file mode 100644 index 000000000..d48cdcd8b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDistanceOffsetDirection.c @@ -0,0 +1,85 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionDistanceOffsetDirection.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionDistanceOffsetDirection_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionDistanceOffsetDirection, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionDistanceOffsetDirection, distanceOffset), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDistanceOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionDistanceOffsetDirection, direction), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "direction" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionDistanceOffsetDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionDistanceOffsetDirection_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 }, /* direction */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* distanceOffsetNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* distanceOffsetKm */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionDistanceOffsetDirection_specs_1 = { + sizeof(struct FANSPositionDistanceOffsetDirection), + offsetof(struct FANSPositionDistanceOffsetDirection, _asn_ctx), + asn_MAP_FANSPositionDistanceOffsetDirection_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionDistanceOffsetDirection = { + "FANSPositionDistanceOffsetDirection", + "FANSPositionDistanceOffsetDirection", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionDistanceOffsetDirection_tags_1, + sizeof(asn_DEF_FANSPositionDistanceOffsetDirection_tags_1) + /sizeof(asn_DEF_FANSPositionDistanceOffsetDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionDistanceOffsetDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionDistanceOffsetDirection_tags_1) + /sizeof(asn_DEF_FANSPositionDistanceOffsetDirection_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionDistanceOffsetDirection_1, + 3, /* Elements count */ + &asn_SPC_FANSPositionDistanceOffsetDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDistanceOffsetDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDistanceOffsetDirection.h new file mode 100644 index 000000000..c030814d2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionDistanceOffsetDirection.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionDistanceOffsetDirection_H_ +#define _FANSPositionDistanceOffsetDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSDistanceOffset.h" +#include "FANSDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionDistanceOffsetDirection */ +typedef struct FANSPositionDistanceOffsetDirection { + FANSPosition_t position; + FANSDistanceOffset_t distanceOffset; + FANSDirection_t direction; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionDistanceOffsetDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionDistanceOffsetDirection; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionDistanceOffsetDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionICAOUnitNameFrequency.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionICAOUnitNameFrequency.c new file mode 100644 index 000000000..6216159ba --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionICAOUnitNameFrequency.c @@ -0,0 +1,87 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionICAOUnitNameFrequency.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionICAOUnitNameFrequency_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionICAOUnitNameFrequency, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionICAOUnitNameFrequency, iCAOUnitName), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSICAOUnitName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOUnitName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionICAOUnitNameFrequency, frequency), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequency" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionICAOUnitNameFrequency_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* iCAOUnitName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, -1, 0 }, /* frequencyhf */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, -1, 0 }, /* frequencyvhf */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, -1, 0 }, /* frequencyuhf */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, -1, 0 }, /* frequencysatchannel */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionICAOUnitNameFrequency_specs_1 = { + sizeof(struct FANSPositionICAOUnitNameFrequency), + offsetof(struct FANSPositionICAOUnitNameFrequency, _asn_ctx), + asn_MAP_FANSPositionICAOUnitNameFrequency_tag2el_1, + 10, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionICAOUnitNameFrequency = { + "FANSPositionICAOUnitNameFrequency", + "FANSPositionICAOUnitNameFrequency", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1, + sizeof(asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1) + /sizeof(asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1) + /sizeof(asn_DEF_FANSPositionICAOUnitNameFrequency_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionICAOUnitNameFrequency_1, + 3, /* Elements count */ + &asn_SPC_FANSPositionICAOUnitNameFrequency_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionICAOUnitNameFrequency.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionICAOUnitNameFrequency.h new file mode 100644 index 000000000..c9ccb26ce --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionICAOUnitNameFrequency.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionICAOUnitNameFrequency_H_ +#define _FANSPositionICAOUnitNameFrequency_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSICAOUnitName.h" +#include "FANSFrequency.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionICAOUnitNameFrequency */ +typedef struct FANSPositionICAOUnitNameFrequency { + FANSPosition_t position; + FANSICAOUnitName_t iCAOUnitName; + FANSFrequency_t frequency; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionICAOUnitNameFrequency_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionICAOUnitNameFrequency; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionICAOUnitNameFrequency_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionPosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionPosition.c new file mode 100644 index 000000000..7a922552c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionPosition.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionPosition.h" + +static asn_per_constraints_t asn_PER_type_FANSPositionPosition_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 2, 2 } /* (SIZE(2..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSPositionPosition_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionPosition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSPositionPosition_specs_1 = { + sizeof(struct FANSPositionPosition), + offsetof(struct FANSPositionPosition, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionPosition = { + "FANSPositionPosition", + "FANSPositionPosition", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionPosition_tags_1, + sizeof(asn_DEF_FANSPositionPosition_tags_1) + /sizeof(asn_DEF_FANSPositionPosition_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionPosition_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionPosition_tags_1) + /sizeof(asn_DEF_FANSPositionPosition_tags_1[0]), /* 1 */ + &asn_PER_type_FANSPositionPosition_constr_1, + asn_MBR_FANSPositionPosition_1, + 1, /* Single element */ + &asn_SPC_FANSPositionPosition_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionPosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionPosition.h new file mode 100644 index 000000000..d9c0d7fdc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionPosition.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionPosition_H_ +#define _FANSPositionPosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSPosition; + +/* FANSPositionPosition */ +typedef struct FANSPositionPosition { + A_SEQUENCE_OF(struct FANSPosition) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionPosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionPosition; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSPosition.h" + +#endif /* _FANSPositionPosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionProcedureName.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionProcedureName.c new file mode 100644 index 000000000..fd54f7418 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionProcedureName.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionProcedureName.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionProcedureName_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionProcedureName, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionProcedureName, procedureName), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSProcedureName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedureName" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionProcedureName_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionProcedureName_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* procedureName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionProcedureName_specs_1 = { + sizeof(struct FANSPositionProcedureName), + offsetof(struct FANSPositionProcedureName, _asn_ctx), + asn_MAP_FANSPositionProcedureName_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionProcedureName = { + "FANSPositionProcedureName", + "FANSPositionProcedureName", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionProcedureName_tags_1, + sizeof(asn_DEF_FANSPositionProcedureName_tags_1) + /sizeof(asn_DEF_FANSPositionProcedureName_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionProcedureName_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionProcedureName_tags_1) + /sizeof(asn_DEF_FANSPositionProcedureName_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionProcedureName_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionProcedureName_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionProcedureName.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionProcedureName.h new file mode 100644 index 000000000..3a5ee22cb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionProcedureName.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionProcedureName_H_ +#define _FANSPositionProcedureName_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSProcedureName.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionProcedureName */ +typedef struct FANSPositionProcedureName { + FANSPosition_t position; + FANSProcedureName_t procedureName; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionProcedureName_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionProcedureName; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionProcedureName_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionReport.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionReport.c new file mode 100644 index 000000000..bdbf00c79 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionReport.c @@ -0,0 +1,272 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionReport.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionReport_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionReport, positioncurrent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPositionCurrent, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "positioncurrent" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionReport, timeatpositioncurrent), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeAtPositionCurrent, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeatpositioncurrent" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionReport, altitude), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_POINTER, 19, offsetof(struct FANSPositionReport, fixnext), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSFixNext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixnext" + }, + { ATF_POINTER, 18, offsetof(struct FANSPositionReport, timeetaatfixnext), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeEtaAtFixNext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeetaatfixnext" + }, + { ATF_POINTER, 17, offsetof(struct FANSPositionReport, fixnextplusone), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSFixNextPlusOne, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixnextplusone" + }, + { ATF_POINTER, 16, offsetof(struct FANSPositionReport, timeetadestination), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeEtaDestination, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeetadestination" + }, + { ATF_POINTER, 15, offsetof(struct FANSPositionReport, remainingFuel), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRemainingFuel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "remainingFuel" + }, + { ATF_POINTER, 14, offsetof(struct FANSPositionReport, temperature), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSTemperature, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "temperature" + }, + { ATF_POINTER, 13, offsetof(struct FANSPositionReport, winds), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSWinds, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "winds" + }, + { ATF_POINTER, 12, offsetof(struct FANSPositionReport, turbulence), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTurbulence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "turbulence" + }, + { ATF_POINTER, 11, offsetof(struct FANSPositionReport, icing), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSIcing, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "icing" + }, + { ATF_POINTER, 10, offsetof(struct FANSPositionReport, speed), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, + { ATF_POINTER, 9, offsetof(struct FANSPositionReport, speedground), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedGround, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedground" + }, + { ATF_POINTER, 8, offsetof(struct FANSPositionReport, verticalChange), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSVerticalChange, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "verticalChange" + }, + { ATF_POINTER, 7, offsetof(struct FANSPositionReport, trackAngle), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSTrackAngle, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "trackAngle" + }, + { ATF_POINTER, 6, offsetof(struct FANSPositionReport, trueHeading), + (ASN_TAG_CLASS_CONTEXT | (16 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSTrueheading, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "trueHeading" + }, + { ATF_POINTER, 5, offsetof(struct FANSPositionReport, distance), + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distance" + }, + { ATF_POINTER, 4, offsetof(struct FANSPositionReport, supplementaryInformation), + (ASN_TAG_CLASS_CONTEXT | (18 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSupplementaryInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "supplementaryInformation" + }, + { ATF_POINTER, 3, offsetof(struct FANSPositionReport, reportedWaypointPosition), + (ASN_TAG_CLASS_CONTEXT | (19 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSReportedWaypointPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "reportedWaypointPosition" + }, + { ATF_POINTER, 2, offsetof(struct FANSPositionReport, reportedWaypointTime), + (ASN_TAG_CLASS_CONTEXT | (20 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSReportedWaypointTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "reportedWaypointTime" + }, + { ATF_POINTER, 1, offsetof(struct FANSPositionReport, reportedWaypointAltitude), + (ASN_TAG_CLASS_CONTEXT | (21 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSReportedWaypointAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "reportedWaypointAltitude" + }, +}; +static const int asn_MAP_FANSPositionReport_oms_1[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }; +static const ber_tlv_tag_t asn_DEF_FANSPositionReport_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionReport_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* positioncurrent */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* timeatpositioncurrent */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* altitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* fixnext */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* timeetaatfixnext */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* fixnextplusone */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* timeetadestination */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* remainingFuel */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* temperature */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* winds */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* turbulence */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* icing */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* speed */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* speedground */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* verticalChange */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 }, /* trackAngle */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* trueHeading */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* distance */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* supplementaryInformation */ + { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* reportedWaypointPosition */ + { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* reportedWaypointTime */ + { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 } /* reportedWaypointAltitude */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionReport_specs_1 = { + sizeof(struct FANSPositionReport), + offsetof(struct FANSPositionReport, _asn_ctx), + asn_MAP_FANSPositionReport_tag2el_1, + 22, /* Count of tags in the map */ + asn_MAP_FANSPositionReport_oms_1, /* Optional members */ + 19, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionReport = { + "FANSPositionReport", + "FANSPositionReport", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionReport_tags_1, + sizeof(asn_DEF_FANSPositionReport_tags_1) + /sizeof(asn_DEF_FANSPositionReport_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionReport_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionReport_tags_1) + /sizeof(asn_DEF_FANSPositionReport_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionReport_1, + 22, /* Elements count */ + &asn_SPC_FANSPositionReport_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionReport.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionReport.h new file mode 100644 index 000000000..6326b7e1b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionReport.h @@ -0,0 +1,94 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionReport_H_ +#define _FANSPositionReport_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPositionCurrent.h" +#include "FANSTimeAtPositionCurrent.h" +#include "FANSAltitude.h" +#include "FANSTurbulence.h" +#include "FANSIcing.h" +#include "FANSSpeedGround.h" +#include "FANSSupplementaryInformation.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSPosition; +struct FANSTime; +struct FANSRemainingFuel; +struct FANSTemperature; +struct FANSWinds; +struct FANSSpeed; +struct FANSVerticalChange; +struct FANSDegrees; +struct FANSDistance; +struct FANSAltitude; + +/* FANSPositionReport */ +typedef struct FANSPositionReport { + FANSPositionCurrent_t positioncurrent; + FANSTimeAtPositionCurrent_t timeatpositioncurrent; + FANSAltitude_t altitude; + struct FANSPosition *fixnext /* OPTIONAL */; + struct FANSTime *timeetaatfixnext /* OPTIONAL */; + struct FANSPosition *fixnextplusone /* OPTIONAL */; + struct FANSTime *timeetadestination /* OPTIONAL */; + struct FANSRemainingFuel *remainingFuel /* OPTIONAL */; + struct FANSTemperature *temperature /* OPTIONAL */; + struct FANSWinds *winds /* OPTIONAL */; + FANSTurbulence_t *turbulence /* OPTIONAL */; + FANSIcing_t *icing /* OPTIONAL */; + struct FANSSpeed *speed /* OPTIONAL */; + FANSSpeedGround_t *speedground /* OPTIONAL */; + struct FANSVerticalChange *verticalChange /* OPTIONAL */; + struct FANSDegrees *trackAngle /* OPTIONAL */; + struct FANSDegrees *trueHeading /* OPTIONAL */; + struct FANSDistance *distance /* OPTIONAL */; + FANSSupplementaryInformation_t *supplementaryInformation /* OPTIONAL */; + struct FANSPosition *reportedWaypointPosition /* OPTIONAL */; + struct FANSTime *reportedWaypointTime /* OPTIONAL */; + struct FANSAltitude *reportedWaypointAltitude /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionReport_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionReport; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSFixNext.h" +#include "FANSTimeEtaAtFixNext.h" +#include "FANSFixNextPlusOne.h" +#include "FANSTimeEtaDestination.h" +#include "FANSRemainingFuel.h" +#include "FANSTemperature.h" +#include "FANSWinds.h" +#include "FANSSpeed.h" +#include "FANSVerticalChange.h" +#include "FANSTrackAngle.h" +#include "FANSTrueheading.h" +#include "FANSDistance.h" +#include "FANSReportedWaypointPosition.h" +#include "FANSReportedWaypointTime.h" +#include "FANSReportedWaypointAltitude.h" + +#endif /* _FANSPositionReport_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionRouteClearance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionRouteClearance.c new file mode 100644 index 000000000..12ab36f6e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionRouteClearance.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionRouteClearance.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionRouteClearance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionRouteClearance, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionRouteClearance, routeClearance), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "routeClearance" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionRouteClearance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionRouteClearance_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* routeClearance */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionRouteClearance_specs_1 = { + sizeof(struct FANSPositionRouteClearance), + offsetof(struct FANSPositionRouteClearance, _asn_ctx), + asn_MAP_FANSPositionRouteClearance_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionRouteClearance = { + "FANSPositionRouteClearance", + "FANSPositionRouteClearance", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionRouteClearance_tags_1, + sizeof(asn_DEF_FANSPositionRouteClearance_tags_1) + /sizeof(asn_DEF_FANSPositionRouteClearance_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionRouteClearance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionRouteClearance_tags_1) + /sizeof(asn_DEF_FANSPositionRouteClearance_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionRouteClearance_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionRouteClearance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionRouteClearance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionRouteClearance.h new file mode 100644 index 000000000..125f2bd39 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionRouteClearance.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionRouteClearance_H_ +#define _FANSPositionRouteClearance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSRouteClearance.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionRouteClearance */ +typedef struct FANSPositionRouteClearance { + FANSPosition_t position; + FANSRouteClearance_t routeClearance; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionRouteClearance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionRouteClearance; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionRouteClearance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeed.c new file mode 100644 index 000000000..4f2326138 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeed.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionSpeed, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionSpeed, speed), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, -1, 0 }, /* speedIndicated */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, -1, 0 }, /* speedIndicatedMetric */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, -1, 0 }, /* speedTrue */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, -1, 0 }, /* speedTrueMetric */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 1 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, -1, 0 }, /* speedGround */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* speedGroundMetric */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* speedMach */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 } /* speedMachLarge */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionSpeed_specs_1 = { + sizeof(struct FANSPositionSpeed), + offsetof(struct FANSPositionSpeed, _asn_ctx), + asn_MAP_FANSPositionSpeed_tag2el_1, + 13, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionSpeed = { + "FANSPositionSpeed", + "FANSPositionSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionSpeed_tags_1, + sizeof(asn_DEF_FANSPositionSpeed_tags_1) + /sizeof(asn_DEF_FANSPositionSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionSpeed_tags_1) + /sizeof(asn_DEF_FANSPositionSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeed.h new file mode 100644 index 000000000..77dbfa9bc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeed.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionSpeed_H_ +#define _FANSPositionSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionSpeed */ +typedef struct FANSPositionSpeed { + FANSPosition_t position; + FANSSpeed_t speed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeedSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeedSpeed.c new file mode 100644 index 000000000..ede497462 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeedSpeed.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionSpeedSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionSpeedSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionSpeedSpeed, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionSpeedSpeed, speed_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed-seqOf" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionSpeedSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionSpeedSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* speed-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionSpeedSpeed_specs_1 = { + sizeof(struct FANSPositionSpeedSpeed), + offsetof(struct FANSPositionSpeedSpeed, _asn_ctx), + asn_MAP_FANSPositionSpeedSpeed_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionSpeedSpeed = { + "FANSPositionSpeedSpeed", + "FANSPositionSpeedSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionSpeedSpeed_tags_1, + sizeof(asn_DEF_FANSPositionSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSPositionSpeedSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionSpeedSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSPositionSpeedSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionSpeedSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionSpeedSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeedSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeedSpeed.h new file mode 100644 index 000000000..51901371d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionSpeedSpeed.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionSpeedSpeed_H_ +#define _FANSPositionSpeedSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSSpeedSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionSpeedSpeed */ +typedef struct FANSPositionSpeedSpeed { + FANSPosition_t position; + FANSSpeedSpeed_t speed_seqOf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionSpeedSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionSpeedSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionSpeedSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTime.c new file mode 100644 index 000000000..ff8243733 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTime.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionTime.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTime, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTime, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionTime_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionTime_specs_1 = { + sizeof(struct FANSPositionTime), + offsetof(struct FANSPositionTime, _asn_ctx), + asn_MAP_FANSPositionTime_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionTime = { + "FANSPositionTime", + "FANSPositionTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionTime_tags_1, + sizeof(asn_DEF_FANSPositionTime_tags_1) + /sizeof(asn_DEF_FANSPositionTime_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionTime_tags_1) + /sizeof(asn_DEF_FANSPositionTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionTime_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionTime_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTime.h new file mode 100644 index 000000000..52429bd06 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionTime_H_ +#define _FANSPositionTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSTime.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionTime */ +typedef struct FANSPositionTime { + FANSPosition_t position; + FANSTime_t time; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionTime; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeAltitude.c new file mode 100644 index 000000000..fd7b0103c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeAltitude.c @@ -0,0 +1,91 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionTimeAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionTimeAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTimeAltitude, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTimeAltitude, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTimeAltitude, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionTimeAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionTimeAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, -1, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, -1, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 1 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, -1, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, -1, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 1 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 2, -1, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 2, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 2, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 2, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionTimeAltitude_specs_1 = { + sizeof(struct FANSPositionTimeAltitude), + offsetof(struct FANSPositionTimeAltitude, _asn_ctx), + asn_MAP_FANSPositionTimeAltitude_tag2el_1, + 14, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionTimeAltitude = { + "FANSPositionTimeAltitude", + "FANSPositionTimeAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionTimeAltitude_tags_1, + sizeof(asn_DEF_FANSPositionTimeAltitude_tags_1) + /sizeof(asn_DEF_FANSPositionTimeAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionTimeAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionTimeAltitude_tags_1) + /sizeof(asn_DEF_FANSPositionTimeAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionTimeAltitude_1, + 3, /* Elements count */ + &asn_SPC_FANSPositionTimeAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeAltitude.h new file mode 100644 index 000000000..fc1f41936 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeAltitude.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionTimeAltitude_H_ +#define _FANSPositionTimeAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSTime.h" +#include "FANSAltitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionTimeAltitude */ +typedef struct FANSPositionTimeAltitude { + FANSPosition_t position; + FANSTime_t time; + FANSAltitude_t altitude; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionTimeAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionTimeAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionTimeAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeTime.c new file mode 100644 index 000000000..aa9011bc3 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeTime.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPositionTimeTime.h" + +static asn_TYPE_member_t asn_MBR_FANSPositionTimeTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTimeTime, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPositionTimeTime, time_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTimeTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time-seqOf" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSPositionTimeTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPositionTimeTime_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* time-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPositionTimeTime_specs_1 = { + sizeof(struct FANSPositionTimeTime), + offsetof(struct FANSPositionTimeTime, _asn_ctx), + asn_MAP_FANSPositionTimeTime_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPositionTimeTime = { + "FANSPositionTimeTime", + "FANSPositionTimeTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPositionTimeTime_tags_1, + sizeof(asn_DEF_FANSPositionTimeTime_tags_1) + /sizeof(asn_DEF_FANSPositionTimeTime_tags_1[0]), /* 1 */ + asn_DEF_FANSPositionTimeTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPositionTimeTime_tags_1) + /sizeof(asn_DEF_FANSPositionTimeTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPositionTimeTime_1, + 2, /* Elements count */ + &asn_SPC_FANSPositionTimeTime_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeTime.h new file mode 100644 index 000000000..a9b178b83 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPositionTimeTime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPositionTimeTime_H_ +#define _FANSPositionTimeTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSTimeTime.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSPositionTimeTime */ +typedef struct FANSPositionTimeTime { + FANSPosition_t position; + FANSTimeTime_t time_seqOf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPositionTimeTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPositionTimeTime; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSPositionTimeTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPredepartureClearance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPredepartureClearance.c new file mode 100644 index 000000000..fca9b94c8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPredepartureClearance.c @@ -0,0 +1,142 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPredepartureClearance.h" + +static asn_TYPE_member_t asn_MBR_FANSPredepartureClearance_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPredepartureClearance, aircraftFlightIdentification), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAircraftFlightIdentification, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aircraftFlightIdentification" + }, + { ATF_POINTER, 2, offsetof(struct FANSPredepartureClearance, aircraftType), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAircraftType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aircraftType" + }, + { ATF_POINTER, 1, offsetof(struct FANSPredepartureClearance, aircraftEquipmentCode), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAircraftEquipmentCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aircraftEquipmentCode" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPredepartureClearance, timeDepartureEdct), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTimeDepartureEdct, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeDepartureEdct" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPredepartureClearance, routeClearance), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteClearance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "routeClearance" + }, + { ATF_POINTER, 1, offsetof(struct FANSPredepartureClearance, altitudeRestriction), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSAltitudeRestriction, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeRestriction" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPredepartureClearance, frequencyDeparture), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSFrequencyDeparture, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencyDeparture" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPredepartureClearance, beaconCode), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSBeaconCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "beaconCode" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSPredepartureClearance, pDCrevision), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPDCrevision, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "pDCrevision" + }, +}; +static const int asn_MAP_FANSPredepartureClearance_oms_1[] = { 1, 2, 5 }; +static const ber_tlv_tag_t asn_DEF_FANSPredepartureClearance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPredepartureClearance_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* aircraftFlightIdentification */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* aircraftType */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* aircraftEquipmentCode */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeDepartureEdct */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* routeClearance */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* altitudeRestriction */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* frequencyDeparture */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* beaconCode */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* pDCrevision */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPredepartureClearance_specs_1 = { + sizeof(struct FANSPredepartureClearance), + offsetof(struct FANSPredepartureClearance, _asn_ctx), + asn_MAP_FANSPredepartureClearance_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_FANSPredepartureClearance_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPredepartureClearance = { + "FANSPredepartureClearance", + "FANSPredepartureClearance", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPredepartureClearance_tags_1, + sizeof(asn_DEF_FANSPredepartureClearance_tags_1) + /sizeof(asn_DEF_FANSPredepartureClearance_tags_1[0]), /* 1 */ + asn_DEF_FANSPredepartureClearance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPredepartureClearance_tags_1) + /sizeof(asn_DEF_FANSPredepartureClearance_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPredepartureClearance_1, + 9, /* Elements count */ + &asn_SPC_FANSPredepartureClearance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPredepartureClearance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPredepartureClearance.h new file mode 100644 index 000000000..fa9c0c98d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPredepartureClearance.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPredepartureClearance_H_ +#define _FANSPredepartureClearance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAircraftFlightIdentification.h" +#include "FANSAircraftType.h" +#include "FANSTimeDepartureEdct.h" +#include "FANSRouteClearance.h" +#include "FANSFrequencyDeparture.h" +#include "FANSBeaconCode.h" +#include "FANSPDCrevision.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSAircraftEquipmentCode; +struct FANSAltitude; + +/* FANSPredepartureClearance */ +typedef struct FANSPredepartureClearance { + FANSAircraftFlightIdentification_t aircraftFlightIdentification; + FANSAircraftType_t *aircraftType /* OPTIONAL */; + struct FANSAircraftEquipmentCode *aircraftEquipmentCode /* OPTIONAL */; + FANSTimeDepartureEdct_t timeDepartureEdct; + FANSRouteClearance_t routeClearance; + struct FANSAltitude *altitudeRestriction /* OPTIONAL */; + FANSFrequencyDeparture_t frequencyDeparture; + FANSBeaconCode_t beaconCode; + FANSPDCrevision_t pDCrevision; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPredepartureClearance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPredepartureClearance; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSAircraftEquipmentCode.h" +#include "FANSAltitudeRestriction.h" + +#endif /* _FANSPredepartureClearance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedure.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedure.c new file mode 100644 index 000000000..e43f32c25 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedure.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedure.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSProcedure_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 6) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSProcedure_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSProcedure_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSProcedure_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSProcedure_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSProcedure_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSProcedure_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSProcedure_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSProcedure_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSProcedure_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSProcedure_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSProcedure_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 3, 3, 1, 6 } /* (SIZE(1..6)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSProcedure_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedure = { + "FANSProcedure", + "FANSProcedure", + FANSProcedure_free, + FANSProcedure_print, + FANSProcedure_constraint, + FANSProcedure_decode_ber, + FANSProcedure_encode_der, + FANSProcedure_decode_xer, + FANSProcedure_encode_xer, + FANSProcedure_decode_uper, + FANSProcedure_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedure_tags_1, + sizeof(asn_DEF_FANSProcedure_tags_1) + /sizeof(asn_DEF_FANSProcedure_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedure_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedure_tags_1) + /sizeof(asn_DEF_FANSProcedure_tags_1[0]), /* 1 */ + &asn_PER_type_FANSProcedure_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedure.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedure.h new file mode 100644 index 000000000..96b795bac --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedure.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedure_H_ +#define _FANSProcedure_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSProcedure */ +typedef IA5String_t FANSProcedure_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedure; +asn_struct_free_f FANSProcedure_free; +asn_struct_print_f FANSProcedure_print; +asn_constr_check_f FANSProcedure_constraint; +ber_type_decoder_f FANSProcedure_decode_ber; +der_type_encoder_f FANSProcedure_encode_der; +xer_type_decoder_f FANSProcedure_decode_xer; +xer_type_encoder_f FANSProcedure_encode_xer; +per_type_decoder_f FANSProcedure_decode_uper; +per_type_encoder_f FANSProcedure_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedure_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureApproach.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureApproach.c new file mode 100644 index 000000000..600dbbb47 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureApproach.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedureApproach.h" + +int +FANSProcedureApproach_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSProcedureName.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSProcedureName, + * so here we adjust the DEF accordingly. + */ +static void +FANSProcedureApproach_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSProcedureName.free_struct; + td->print_struct = asn_DEF_FANSProcedureName.print_struct; + td->check_constraints = asn_DEF_FANSProcedureName.check_constraints; + td->ber_decoder = asn_DEF_FANSProcedureName.ber_decoder; + td->der_encoder = asn_DEF_FANSProcedureName.der_encoder; + td->xer_decoder = asn_DEF_FANSProcedureName.xer_decoder; + td->xer_encoder = asn_DEF_FANSProcedureName.xer_encoder; + td->uper_decoder = asn_DEF_FANSProcedureName.uper_decoder; + td->uper_encoder = asn_DEF_FANSProcedureName.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSProcedureName.per_constraints; + td->elements = asn_DEF_FANSProcedureName.elements; + td->elements_count = asn_DEF_FANSProcedureName.elements_count; + td->specifics = asn_DEF_FANSProcedureName.specifics; +} + +void +FANSProcedureApproach_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSProcedureApproach_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureApproach_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSProcedureApproach_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureApproach_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSProcedureApproach_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureApproach_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSProcedureApproach_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSProcedureApproach_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSProcedureApproach_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedureApproach = { + "FANSProcedureApproach", + "FANSProcedureApproach", + FANSProcedureApproach_free, + FANSProcedureApproach_print, + FANSProcedureApproach_constraint, + FANSProcedureApproach_decode_ber, + FANSProcedureApproach_encode_der, + FANSProcedureApproach_decode_xer, + FANSProcedureApproach_encode_xer, + FANSProcedureApproach_decode_uper, + FANSProcedureApproach_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedureApproach_tags_1, + sizeof(asn_DEF_FANSProcedureApproach_tags_1) + /sizeof(asn_DEF_FANSProcedureApproach_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedureApproach_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedureApproach_tags_1) + /sizeof(asn_DEF_FANSProcedureApproach_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureApproach.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureApproach.h new file mode 100644 index 000000000..1063c5b22 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureApproach.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedureApproach_H_ +#define _FANSProcedureApproach_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSProcedureName.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSProcedureApproach */ +typedef FANSProcedureName_t FANSProcedureApproach_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedureApproach; +asn_struct_free_f FANSProcedureApproach_free; +asn_struct_print_f FANSProcedureApproach_print; +asn_constr_check_f FANSProcedureApproach_constraint; +ber_type_decoder_f FANSProcedureApproach_decode_ber; +der_type_encoder_f FANSProcedureApproach_encode_der; +xer_type_decoder_f FANSProcedureApproach_decode_xer; +xer_type_encoder_f FANSProcedureApproach_encode_xer; +per_type_decoder_f FANSProcedureApproach_decode_uper; +per_type_encoder_f FANSProcedureApproach_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedureApproach_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureArrival.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureArrival.c new file mode 100644 index 000000000..fdcb326c2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureArrival.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedureArrival.h" + +int +FANSProcedureArrival_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSProcedureName.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSProcedureName, + * so here we adjust the DEF accordingly. + */ +static void +FANSProcedureArrival_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSProcedureName.free_struct; + td->print_struct = asn_DEF_FANSProcedureName.print_struct; + td->check_constraints = asn_DEF_FANSProcedureName.check_constraints; + td->ber_decoder = asn_DEF_FANSProcedureName.ber_decoder; + td->der_encoder = asn_DEF_FANSProcedureName.der_encoder; + td->xer_decoder = asn_DEF_FANSProcedureName.xer_decoder; + td->xer_encoder = asn_DEF_FANSProcedureName.xer_encoder; + td->uper_decoder = asn_DEF_FANSProcedureName.uper_decoder; + td->uper_encoder = asn_DEF_FANSProcedureName.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSProcedureName.per_constraints; + td->elements = asn_DEF_FANSProcedureName.elements; + td->elements_count = asn_DEF_FANSProcedureName.elements_count; + td->specifics = asn_DEF_FANSProcedureName.specifics; +} + +void +FANSProcedureArrival_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSProcedureArrival_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureArrival_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSProcedureArrival_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureArrival_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSProcedureArrival_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureArrival_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSProcedureArrival_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSProcedureArrival_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSProcedureArrival_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedureArrival = { + "FANSProcedureArrival", + "FANSProcedureArrival", + FANSProcedureArrival_free, + FANSProcedureArrival_print, + FANSProcedureArrival_constraint, + FANSProcedureArrival_decode_ber, + FANSProcedureArrival_encode_der, + FANSProcedureArrival_decode_xer, + FANSProcedureArrival_encode_xer, + FANSProcedureArrival_decode_uper, + FANSProcedureArrival_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedureArrival_tags_1, + sizeof(asn_DEF_FANSProcedureArrival_tags_1) + /sizeof(asn_DEF_FANSProcedureArrival_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedureArrival_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedureArrival_tags_1) + /sizeof(asn_DEF_FANSProcedureArrival_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureArrival.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureArrival.h new file mode 100644 index 000000000..6157c123d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureArrival.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedureArrival_H_ +#define _FANSProcedureArrival_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSProcedureName.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSProcedureArrival */ +typedef FANSProcedureName_t FANSProcedureArrival_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedureArrival; +asn_struct_free_f FANSProcedureArrival_free; +asn_struct_print_f FANSProcedureArrival_print; +asn_constr_check_f FANSProcedureArrival_constraint; +ber_type_decoder_f FANSProcedureArrival_decode_ber; +der_type_encoder_f FANSProcedureArrival_encode_der; +xer_type_decoder_f FANSProcedureArrival_decode_xer; +xer_type_encoder_f FANSProcedureArrival_encode_xer; +per_type_decoder_f FANSProcedureArrival_decode_uper; +per_type_encoder_f FANSProcedureArrival_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedureArrival_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureDeparture.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureDeparture.c new file mode 100644 index 000000000..09de889fe --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureDeparture.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedureDeparture.h" + +int +FANSProcedureDeparture_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSProcedureName.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSProcedureName, + * so here we adjust the DEF accordingly. + */ +static void +FANSProcedureDeparture_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSProcedureName.free_struct; + td->print_struct = asn_DEF_FANSProcedureName.print_struct; + td->check_constraints = asn_DEF_FANSProcedureName.check_constraints; + td->ber_decoder = asn_DEF_FANSProcedureName.ber_decoder; + td->der_encoder = asn_DEF_FANSProcedureName.der_encoder; + td->xer_decoder = asn_DEF_FANSProcedureName.xer_decoder; + td->xer_encoder = asn_DEF_FANSProcedureName.xer_encoder; + td->uper_decoder = asn_DEF_FANSProcedureName.uper_decoder; + td->uper_encoder = asn_DEF_FANSProcedureName.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSProcedureName.per_constraints; + td->elements = asn_DEF_FANSProcedureName.elements; + td->elements_count = asn_DEF_FANSProcedureName.elements_count; + td->specifics = asn_DEF_FANSProcedureName.specifics; +} + +void +FANSProcedureDeparture_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSProcedureDeparture_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureDeparture_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSProcedureDeparture_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureDeparture_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSProcedureDeparture_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureDeparture_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSProcedureDeparture_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSProcedureDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSProcedureDeparture_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedureDeparture = { + "FANSProcedureDeparture", + "FANSProcedureDeparture", + FANSProcedureDeparture_free, + FANSProcedureDeparture_print, + FANSProcedureDeparture_constraint, + FANSProcedureDeparture_decode_ber, + FANSProcedureDeparture_encode_der, + FANSProcedureDeparture_decode_xer, + FANSProcedureDeparture_encode_xer, + FANSProcedureDeparture_decode_uper, + FANSProcedureDeparture_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedureDeparture_tags_1, + sizeof(asn_DEF_FANSProcedureDeparture_tags_1) + /sizeof(asn_DEF_FANSProcedureDeparture_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedureDeparture_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedureDeparture_tags_1) + /sizeof(asn_DEF_FANSProcedureDeparture_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureDeparture.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureDeparture.h new file mode 100644 index 000000000..110affad9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureDeparture.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedureDeparture_H_ +#define _FANSProcedureDeparture_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSProcedureName.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSProcedureDeparture */ +typedef FANSProcedureName_t FANSProcedureDeparture_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedureDeparture; +asn_struct_free_f FANSProcedureDeparture_free; +asn_struct_print_f FANSProcedureDeparture_print; +asn_constr_check_f FANSProcedureDeparture_constraint; +ber_type_decoder_f FANSProcedureDeparture_decode_ber; +der_type_encoder_f FANSProcedureDeparture_encode_der; +xer_type_decoder_f FANSProcedureDeparture_decode_xer; +xer_type_encoder_f FANSProcedureDeparture_encode_xer; +per_type_decoder_f FANSProcedureDeparture_decode_uper; +per_type_encoder_f FANSProcedureDeparture_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedureDeparture_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureName.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureName.c new file mode 100644 index 000000000..f21eaf1d9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureName.c @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedureName.h" + +static asn_TYPE_member_t asn_MBR_FANSProcedureName_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSProcedureName, procedureType), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSProcedureType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedureType" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSProcedureName, procedure), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSProcedure, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedure" + }, + { ATF_POINTER, 1, offsetof(struct FANSProcedureName, procedureTransition), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSProcedureTransition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedureTransition" + }, +}; +static const int asn_MAP_FANSProcedureName_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_FANSProcedureName_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSProcedureName_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* procedureType */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 1, 0, 1 }, /* procedure */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 2, -1, 0 } /* procedureTransition */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSProcedureName_specs_1 = { + sizeof(struct FANSProcedureName), + offsetof(struct FANSProcedureName, _asn_ctx), + asn_MAP_FANSProcedureName_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSProcedureName_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedureName = { + "FANSProcedureName", + "FANSProcedureName", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedureName_tags_1, + sizeof(asn_DEF_FANSProcedureName_tags_1) + /sizeof(asn_DEF_FANSProcedureName_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedureName_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedureName_tags_1) + /sizeof(asn_DEF_FANSProcedureName_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSProcedureName_1, + 3, /* Elements count */ + &asn_SPC_FANSProcedureName_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureName.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureName.h new file mode 100644 index 000000000..e396f6338 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureName.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedureName_H_ +#define _FANSProcedureName_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSProcedureType.h" +#include "FANSProcedure.h" +#include "FANSProcedureTransition.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSProcedureName */ +typedef struct FANSProcedureName { + FANSProcedureType_t procedureType; + FANSProcedure_t procedure; + FANSProcedureTransition_t *procedureTransition /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSProcedureName_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedureName; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedureName_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureTransition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureTransition.c new file mode 100644 index 000000000..ec10a5f6c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureTransition.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedureTransition.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSProcedureTransition_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 5) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSProcedureTransition_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSProcedureTransition_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSProcedureTransition_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureTransition_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSProcedureTransition_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureTransition_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSProcedureTransition_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureTransition_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSProcedureTransition_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSProcedureTransition_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSProcedureTransition_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSProcedureTransition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedureTransition = { + "FANSProcedureTransition", + "FANSProcedureTransition", + FANSProcedureTransition_free, + FANSProcedureTransition_print, + FANSProcedureTransition_constraint, + FANSProcedureTransition_decode_ber, + FANSProcedureTransition_encode_der, + FANSProcedureTransition_decode_xer, + FANSProcedureTransition_encode_xer, + FANSProcedureTransition_decode_uper, + FANSProcedureTransition_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedureTransition_tags_1, + sizeof(asn_DEF_FANSProcedureTransition_tags_1) + /sizeof(asn_DEF_FANSProcedureTransition_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedureTransition_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedureTransition_tags_1) + /sizeof(asn_DEF_FANSProcedureTransition_tags_1[0]), /* 1 */ + &asn_PER_type_FANSProcedureTransition_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureTransition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureTransition.h new file mode 100644 index 000000000..13d4d2ffa --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureTransition.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedureTransition_H_ +#define _FANSProcedureTransition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSProcedureTransition */ +typedef IA5String_t FANSProcedureTransition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedureTransition; +asn_struct_free_f FANSProcedureTransition_free; +asn_struct_print_f FANSProcedureTransition_print; +asn_constr_check_f FANSProcedureTransition_constraint; +ber_type_decoder_f FANSProcedureTransition_decode_ber; +der_type_encoder_f FANSProcedureTransition_encode_der; +xer_type_decoder_f FANSProcedureTransition_decode_xer; +xer_type_encoder_f FANSProcedureTransition_encode_xer; +per_type_decoder_f FANSProcedureTransition_decode_uper; +per_type_encoder_f FANSProcedureTransition_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedureTransition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureType.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureType.c new file mode 100644 index 000000000..e166d0aa5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureType.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSProcedureType.h" + +int +FANSProcedureType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSProcedureType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSProcedureType_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSProcedureType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSProcedureType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSProcedureType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSProcedureType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSProcedureType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSProcedureType_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSProcedureType_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSProcedureType_value2enum_1[] = { + { 0, 7, "arrival" }, + { 1, 8, "approach" }, + { 2, 9, "departure" } +}; +static const unsigned int asn_MAP_FANSProcedureType_enum2value_1[] = { + 1, /* approach(1) */ + 0, /* arrival(0) */ + 2 /* departure(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSProcedureType_specs_1 = { + asn_MAP_FANSProcedureType_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSProcedureType_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSProcedureType_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSProcedureType = { + "FANSProcedureType", + "FANSProcedureType", + FANSProcedureType_free, + FANSProcedureType_print, + FANSProcedureType_constraint, + FANSProcedureType_decode_ber, + FANSProcedureType_encode_der, + FANSProcedureType_decode_xer, + FANSProcedureType_encode_xer, + FANSProcedureType_decode_uper, + FANSProcedureType_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSProcedureType_tags_1, + sizeof(asn_DEF_FANSProcedureType_tags_1) + /sizeof(asn_DEF_FANSProcedureType_tags_1[0]), /* 1 */ + asn_DEF_FANSProcedureType_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSProcedureType_tags_1) + /sizeof(asn_DEF_FANSProcedureType_tags_1[0]), /* 1 */ + &asn_PER_type_FANSProcedureType_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSProcedureType_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureType.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureType.h new file mode 100644 index 000000000..5919914ee --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSProcedureType.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSProcedureType_H_ +#define _FANSProcedureType_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSProcedureType { + FANSProcedureType_arrival = 0, + FANSProcedureType_approach = 1, + FANSProcedureType_departure = 2 +} e_FANSProcedureType; + +/* FANSProcedureType */ +typedef long FANSProcedureType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSProcedureType; +asn_struct_free_f FANSProcedureType_free; +asn_struct_print_f FANSProcedureType_print; +asn_constr_check_f FANSProcedureType_constraint; +ber_type_decoder_f FANSProcedureType_decode_ber; +der_type_encoder_f FANSProcedureType_encode_der; +xer_type_decoder_f FANSProcedureType_decode_xer; +xer_type_encoder_f FANSProcedureType_encode_xer; +per_type_decoder_f FANSProcedureType_decode_uper; +per_type_encoder_f FANSProcedureType_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSProcedureType_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPublishedIdentifier.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSPublishedIdentifier.c new file mode 100644 index 000000000..b243fa96f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPublishedIdentifier.c @@ -0,0 +1,72 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSPublishedIdentifier.h" + +static asn_TYPE_member_t asn_MBR_FANSPublishedIdentifier_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSPublishedIdentifier, fixName), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSFixName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixName" + }, + { ATF_POINTER, 1, offsetof(struct FANSPublishedIdentifier, latitudeLongitude), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude" + }, +}; +static const int asn_MAP_FANSPublishedIdentifier_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSPublishedIdentifier_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSPublishedIdentifier_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 } /* fixName */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSPublishedIdentifier_specs_1 = { + sizeof(struct FANSPublishedIdentifier), + offsetof(struct FANSPublishedIdentifier, _asn_ctx), + asn_MAP_FANSPublishedIdentifier_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_FANSPublishedIdentifier_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSPublishedIdentifier = { + "FANSPublishedIdentifier", + "FANSPublishedIdentifier", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSPublishedIdentifier_tags_1, + sizeof(asn_DEF_FANSPublishedIdentifier_tags_1) + /sizeof(asn_DEF_FANSPublishedIdentifier_tags_1[0]), /* 1 */ + asn_DEF_FANSPublishedIdentifier_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSPublishedIdentifier_tags_1) + /sizeof(asn_DEF_FANSPublishedIdentifier_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSPublishedIdentifier_1, + 2, /* Elements count */ + &asn_SPC_FANSPublishedIdentifier_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSPublishedIdentifier.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSPublishedIdentifier.h new file mode 100644 index 000000000..259cbfb94 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSPublishedIdentifier.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSPublishedIdentifier_H_ +#define _FANSPublishedIdentifier_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFixName.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSLatitudeLongitude; + +/* FANSPublishedIdentifier */ +typedef struct FANSPublishedIdentifier { + FANSFixName_t fixName; + struct FANSLatitudeLongitude *latitudeLongitude /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSPublishedIdentifier_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSPublishedIdentifier; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSLatitudeLongitude.h" + +#endif /* _FANSPublishedIdentifier_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrival.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrival.c new file mode 100644 index 000000000..8762b744e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrival.c @@ -0,0 +1,86 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRTARequiredTimeArrival.h" + +static asn_TYPE_member_t asn_MBR_FANSRTARequiredTimeArrival_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSRTARequiredTimeArrival, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRTARequiredTimeArrival, rTATime), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSRTATime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rTATime" + }, + { ATF_POINTER, 1, offsetof(struct FANSRTARequiredTimeArrival, rTATolerance), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSRTATolerance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rTATolerance" + }, +}; +static const int asn_MAP_FANSRTARequiredTimeArrival_oms_1[] = { 2 }; +static const ber_tlv_tag_t asn_DEF_FANSRTARequiredTimeArrival_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRTARequiredTimeArrival_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, 0, 0 }, /* rTATolerance */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* rTATime */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 0, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRTARequiredTimeArrival_specs_1 = { + sizeof(struct FANSRTARequiredTimeArrival), + offsetof(struct FANSRTARequiredTimeArrival, _asn_ctx), + asn_MAP_FANSRTARequiredTimeArrival_tag2el_1, + 7, /* Count of tags in the map */ + asn_MAP_FANSRTARequiredTimeArrival_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRTARequiredTimeArrival = { + "FANSRTARequiredTimeArrival", + "FANSRTARequiredTimeArrival", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRTARequiredTimeArrival_tags_1, + sizeof(asn_DEF_FANSRTARequiredTimeArrival_tags_1) + /sizeof(asn_DEF_FANSRTARequiredTimeArrival_tags_1[0]), /* 1 */ + asn_DEF_FANSRTARequiredTimeArrival_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRTARequiredTimeArrival_tags_1) + /sizeof(asn_DEF_FANSRTARequiredTimeArrival_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRTARequiredTimeArrival_1, + 3, /* Elements count */ + &asn_SPC_FANSRTARequiredTimeArrival_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrival.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrival.h new file mode 100644 index 000000000..ca20d529c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrival.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRTARequiredTimeArrival_H_ +#define _FANSRTARequiredTimeArrival_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "FANSRTATime.h" +#include "FANSRTATolerance.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRTARequiredTimeArrival */ +typedef struct FANSRTARequiredTimeArrival { + FANSPosition_t position; + FANSRTATime_t rTATime; + FANSRTATolerance_t *rTATolerance /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRTARequiredTimeArrival_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRTARequiredTimeArrival; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRTARequiredTimeArrival_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrivalSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrivalSequence.c new file mode 100644 index 000000000..0894f4e5b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrivalSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRTARequiredTimeArrivalSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSRTARequiredTimeArrivalSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSRTARequiredTimeArrivalSequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSRTARequiredTimeArrival, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSRTARequiredTimeArrivalSequence_specs_1 = { + sizeof(struct FANSRTARequiredTimeArrivalSequence), + offsetof(struct FANSRTARequiredTimeArrivalSequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRTARequiredTimeArrivalSequence = { + "FANSRTARequiredTimeArrivalSequence", + "FANSRTARequiredTimeArrivalSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1, + sizeof(asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1) + /sizeof(asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1) + /sizeof(asn_DEF_FANSRTARequiredTimeArrivalSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSRTARequiredTimeArrivalSequence_constr_1, + asn_MBR_FANSRTARequiredTimeArrivalSequence_1, + 1, /* Single element */ + &asn_SPC_FANSRTARequiredTimeArrivalSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrivalSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrivalSequence.h new file mode 100644 index 000000000..5d7a07559 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTARequiredTimeArrivalSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRTARequiredTimeArrivalSequence_H_ +#define _FANSRTARequiredTimeArrivalSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSRTARequiredTimeArrival; + +/* FANSRTARequiredTimeArrivalSequence */ +typedef struct FANSRTARequiredTimeArrivalSequence { + A_SEQUENCE_OF(struct FANSRTARequiredTimeArrival) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRTARequiredTimeArrivalSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRTARequiredTimeArrivalSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSRTARequiredTimeArrival.h" + +#endif /* _FANSRTARequiredTimeArrivalSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATime.c new file mode 100644 index 000000000..38a023cc8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATime.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRTATime.h" + +static asn_TYPE_member_t asn_MBR_FANSRTATime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSRTATime, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRTATime, timeTolerance), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSTimeTolerance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeTolerance" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSRTATime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRTATime_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 }, /* timeTolerance */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* time */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRTATime_specs_1 = { + sizeof(struct FANSRTATime), + offsetof(struct FANSRTATime, _asn_ctx), + asn_MAP_FANSRTATime_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRTATime = { + "FANSRTATime", + "FANSRTATime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRTATime_tags_1, + sizeof(asn_DEF_FANSRTATime_tags_1) + /sizeof(asn_DEF_FANSRTATime_tags_1[0]), /* 1 */ + asn_DEF_FANSRTATime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRTATime_tags_1) + /sizeof(asn_DEF_FANSRTATime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRTATime_1, + 2, /* Elements count */ + &asn_SPC_FANSRTATime_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATime.h new file mode 100644 index 000000000..7d90c2d90 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRTATime_H_ +#define _FANSRTATime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSTimeTolerance.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRTATime */ +typedef struct FANSRTATime { + FANSTime_t time; + FANSTimeTolerance_t timeTolerance; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRTATime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRTATime; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRTATime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATolerance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATolerance.c new file mode 100644 index 000000000..e95ee562f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATolerance.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRTATolerance.h" + +int +FANSRTATolerance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 150)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSRTATolerance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSRTATolerance_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSRTATolerance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSRTATolerance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSRTATolerance_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSRTATolerance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSRTATolerance_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSRTATolerance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSRTATolerance_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSRTATolerance_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSRTATolerance_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 1, 150 } /* (1..150) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSRTATolerance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSRTATolerance = { + "FANSRTATolerance", + "FANSRTATolerance", + FANSRTATolerance_free, + FANSRTATolerance_print, + FANSRTATolerance_constraint, + FANSRTATolerance_decode_ber, + FANSRTATolerance_encode_der, + FANSRTATolerance_decode_xer, + FANSRTATolerance_encode_xer, + FANSRTATolerance_decode_uper, + FANSRTATolerance_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRTATolerance_tags_1, + sizeof(asn_DEF_FANSRTATolerance_tags_1) + /sizeof(asn_DEF_FANSRTATolerance_tags_1[0]), /* 1 */ + asn_DEF_FANSRTATolerance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRTATolerance_tags_1) + /sizeof(asn_DEF_FANSRTATolerance_tags_1[0]), /* 1 */ + &asn_PER_type_FANSRTATolerance_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATolerance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATolerance.h new file mode 100644 index 000000000..4fdc83db5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRTATolerance.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRTATolerance_H_ +#define _FANSRTATolerance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRTATolerance */ +typedef long FANSRTATolerance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRTATolerance; +asn_struct_free_f FANSRTATolerance_free; +asn_struct_print_f FANSRTATolerance_print; +asn_constr_check_f FANSRTATolerance_constraint; +ber_type_decoder_f FANSRTATolerance_decode_ber; +der_type_encoder_f FANSRTATolerance_encode_der; +xer_type_decoder_f FANSRTATolerance_decode_xer; +xer_type_encoder_f FANSRTATolerance_encode_xer; +per_type_decoder_f FANSRTATolerance_decode_uper; +per_type_encoder_f FANSRTATolerance_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRTATolerance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuel.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuel.c new file mode 100644 index 000000000..653971c51 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuel.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRemainingFuel.h" + +static asn_TYPE_member_t asn_MBR_FANSRemainingFuel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSRemainingFuel, hours), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimehours, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "hours" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRemainingFuel, minutes), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimeminutes, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "minutes" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSRemainingFuel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRemainingFuel_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* hours */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* minutes */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRemainingFuel_specs_1 = { + sizeof(struct FANSRemainingFuel), + offsetof(struct FANSRemainingFuel, _asn_ctx), + asn_MAP_FANSRemainingFuel_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRemainingFuel = { + "FANSRemainingFuel", + "FANSRemainingFuel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRemainingFuel_tags_1, + sizeof(asn_DEF_FANSRemainingFuel_tags_1) + /sizeof(asn_DEF_FANSRemainingFuel_tags_1[0]), /* 1 */ + asn_DEF_FANSRemainingFuel_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRemainingFuel_tags_1) + /sizeof(asn_DEF_FANSRemainingFuel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRemainingFuel_1, + 2, /* Elements count */ + &asn_SPC_FANSRemainingFuel_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuel.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuel.h new file mode 100644 index 000000000..640174589 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuel.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRemainingFuel_H_ +#define _FANSRemainingFuel_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTimehours.h" +#include "FANSTimeminutes.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRemainingFuel */ +typedef struct FANSRemainingFuel { + FANSTimehours_t hours; + FANSTimeminutes_t minutes; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRemainingFuel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRemainingFuel; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRemainingFuel_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuelRemainingSouls.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuelRemainingSouls.c new file mode 100644 index 000000000..c5097bbd4 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuelRemainingSouls.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRemainingFuelRemainingSouls.h" + +static asn_TYPE_member_t asn_MBR_FANSRemainingFuelRemainingSouls_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSRemainingFuelRemainingSouls, remainingFuel), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSRemainingFuel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "remainingFuel" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRemainingFuelRemainingSouls, remainingSouls), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSRemainingSouls, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "remainingSouls" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSRemainingFuelRemainingSouls_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRemainingFuelRemainingSouls_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* remainingSouls */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* remainingFuel */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRemainingFuelRemainingSouls_specs_1 = { + sizeof(struct FANSRemainingFuelRemainingSouls), + offsetof(struct FANSRemainingFuelRemainingSouls, _asn_ctx), + asn_MAP_FANSRemainingFuelRemainingSouls_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRemainingFuelRemainingSouls = { + "FANSRemainingFuelRemainingSouls", + "FANSRemainingFuelRemainingSouls", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRemainingFuelRemainingSouls_tags_1, + sizeof(asn_DEF_FANSRemainingFuelRemainingSouls_tags_1) + /sizeof(asn_DEF_FANSRemainingFuelRemainingSouls_tags_1[0]), /* 1 */ + asn_DEF_FANSRemainingFuelRemainingSouls_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRemainingFuelRemainingSouls_tags_1) + /sizeof(asn_DEF_FANSRemainingFuelRemainingSouls_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRemainingFuelRemainingSouls_1, + 2, /* Elements count */ + &asn_SPC_FANSRemainingFuelRemainingSouls_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuelRemainingSouls.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuelRemainingSouls.h new file mode 100644 index 000000000..8beed2410 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingFuelRemainingSouls.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRemainingFuelRemainingSouls_H_ +#define _FANSRemainingFuelRemainingSouls_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSRemainingFuel.h" +#include "FANSRemainingSouls.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRemainingFuelRemainingSouls */ +typedef struct FANSRemainingFuelRemainingSouls { + FANSRemainingFuel_t remainingFuel; + FANSRemainingSouls_t remainingSouls; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRemainingFuelRemainingSouls_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRemainingFuelRemainingSouls; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRemainingFuelRemainingSouls_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingSouls.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingSouls.c new file mode 100644 index 000000000..fc0ee4a57 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingSouls.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRemainingSouls.h" + +int +FANSRemainingSouls_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 1024)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSRemainingSouls_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSRemainingSouls_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSRemainingSouls_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSRemainingSouls_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSRemainingSouls_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSRemainingSouls_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSRemainingSouls_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSRemainingSouls_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSRemainingSouls_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSRemainingSouls_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSRemainingSouls_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 10, 10, 1, 1024 } /* (1..1024) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSRemainingSouls_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSRemainingSouls = { + "FANSRemainingSouls", + "FANSRemainingSouls", + FANSRemainingSouls_free, + FANSRemainingSouls_print, + FANSRemainingSouls_constraint, + FANSRemainingSouls_decode_ber, + FANSRemainingSouls_encode_der, + FANSRemainingSouls_decode_xer, + FANSRemainingSouls_encode_xer, + FANSRemainingSouls_decode_uper, + FANSRemainingSouls_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRemainingSouls_tags_1, + sizeof(asn_DEF_FANSRemainingSouls_tags_1) + /sizeof(asn_DEF_FANSRemainingSouls_tags_1[0]), /* 1 */ + asn_DEF_FANSRemainingSouls_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRemainingSouls_tags_1) + /sizeof(asn_DEF_FANSRemainingSouls_tags_1[0]), /* 1 */ + &asn_PER_type_FANSRemainingSouls_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingSouls.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingSouls.h new file mode 100644 index 000000000..a37b556d9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRemainingSouls.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRemainingSouls_H_ +#define _FANSRemainingSouls_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRemainingSouls */ +typedef long FANSRemainingSouls_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRemainingSouls; +asn_struct_free_f FANSRemainingSouls_free; +asn_struct_print_f FANSRemainingSouls_print; +asn_constr_check_f FANSRemainingSouls_constraint; +ber_type_decoder_f FANSRemainingSouls_decode_ber; +der_type_encoder_f FANSRemainingSouls_encode_der; +xer_type_decoder_f FANSRemainingSouls_decode_xer; +xer_type_encoder_f FANSRemainingSouls_encode_xer; +per_type_decoder_f FANSRemainingSouls_decode_uper; +per_type_encoder_f FANSRemainingSouls_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRemainingSouls_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointAltitude.c new file mode 100644 index 000000000..a82158664 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointAltitude.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSReportedWaypointAltitude.h" + +int +FANSReportedWaypointAltitude_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSAltitude.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSAltitude, + * so here we adjust the DEF accordingly. + */ +static void +FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSAltitude.free_struct; + td->print_struct = asn_DEF_FANSAltitude.print_struct; + td->check_constraints = asn_DEF_FANSAltitude.check_constraints; + td->ber_decoder = asn_DEF_FANSAltitude.ber_decoder; + td->der_encoder = asn_DEF_FANSAltitude.der_encoder; + td->xer_decoder = asn_DEF_FANSAltitude.xer_decoder; + td->xer_encoder = asn_DEF_FANSAltitude.xer_encoder; + td->uper_decoder = asn_DEF_FANSAltitude.uper_decoder; + td->uper_encoder = asn_DEF_FANSAltitude.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSAltitude.per_constraints; + td->elements = asn_DEF_FANSAltitude.elements; + td->elements_count = asn_DEF_FANSAltitude.elements_count; + td->specifics = asn_DEF_FANSAltitude.specifics; +} + +void +FANSReportedWaypointAltitude_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSReportedWaypointAltitude_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointAltitude_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSReportedWaypointAltitude_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointAltitude_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSReportedWaypointAltitude_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointAltitude_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSReportedWaypointAltitude_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSReportedWaypointAltitude_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSReportedWaypointAltitude_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSReportedWaypointAltitude = { + "FANSReportedWaypointAltitude", + "FANSReportedWaypointAltitude", + FANSReportedWaypointAltitude_free, + FANSReportedWaypointAltitude_print, + FANSReportedWaypointAltitude_constraint, + FANSReportedWaypointAltitude_decode_ber, + FANSReportedWaypointAltitude_encode_der, + FANSReportedWaypointAltitude_decode_xer, + FANSReportedWaypointAltitude_encode_xer, + FANSReportedWaypointAltitude_decode_uper, + FANSReportedWaypointAltitude_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointAltitude.h new file mode 100644 index 000000000..607598d28 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointAltitude.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSReportedWaypointAltitude_H_ +#define _FANSReportedWaypointAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAltitude.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSReportedWaypointAltitude */ +typedef FANSAltitude_t FANSReportedWaypointAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSReportedWaypointAltitude; +asn_struct_free_f FANSReportedWaypointAltitude_free; +asn_struct_print_f FANSReportedWaypointAltitude_print; +asn_constr_check_f FANSReportedWaypointAltitude_constraint; +ber_type_decoder_f FANSReportedWaypointAltitude_decode_ber; +der_type_encoder_f FANSReportedWaypointAltitude_encode_der; +xer_type_decoder_f FANSReportedWaypointAltitude_decode_xer; +xer_type_encoder_f FANSReportedWaypointAltitude_encode_xer; +per_type_decoder_f FANSReportedWaypointAltitude_decode_uper; +per_type_encoder_f FANSReportedWaypointAltitude_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSReportedWaypointAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointPosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointPosition.c new file mode 100644 index 000000000..2b7805931 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointPosition.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSReportedWaypointPosition.h" + +int +FANSReportedWaypointPosition_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSPosition, + * so here we adjust the DEF accordingly. + */ +static void +FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSPosition.free_struct; + td->print_struct = asn_DEF_FANSPosition.print_struct; + td->check_constraints = asn_DEF_FANSPosition.check_constraints; + td->ber_decoder = asn_DEF_FANSPosition.ber_decoder; + td->der_encoder = asn_DEF_FANSPosition.der_encoder; + td->xer_decoder = asn_DEF_FANSPosition.xer_decoder; + td->xer_encoder = asn_DEF_FANSPosition.xer_encoder; + td->uper_decoder = asn_DEF_FANSPosition.uper_decoder; + td->uper_encoder = asn_DEF_FANSPosition.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSPosition.per_constraints; + td->elements = asn_DEF_FANSPosition.elements; + td->elements_count = asn_DEF_FANSPosition.elements_count; + td->specifics = asn_DEF_FANSPosition.specifics; +} + +void +FANSReportedWaypointPosition_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSReportedWaypointPosition_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointPosition_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSReportedWaypointPosition_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointPosition_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSReportedWaypointPosition_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointPosition_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSReportedWaypointPosition_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSReportedWaypointPosition_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSReportedWaypointPosition_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSReportedWaypointPosition = { + "FANSReportedWaypointPosition", + "FANSReportedWaypointPosition", + FANSReportedWaypointPosition_free, + FANSReportedWaypointPosition_print, + FANSReportedWaypointPosition_constraint, + FANSReportedWaypointPosition_decode_ber, + FANSReportedWaypointPosition_encode_der, + FANSReportedWaypointPosition_decode_xer, + FANSReportedWaypointPosition_encode_xer, + FANSReportedWaypointPosition_decode_uper, + FANSReportedWaypointPosition_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointPosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointPosition.h new file mode 100644 index 000000000..c560c9d5c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointPosition.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSReportedWaypointPosition_H_ +#define _FANSReportedWaypointPosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSReportedWaypointPosition */ +typedef FANSPosition_t FANSReportedWaypointPosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSReportedWaypointPosition; +asn_struct_free_f FANSReportedWaypointPosition_free; +asn_struct_print_f FANSReportedWaypointPosition_print; +asn_constr_check_f FANSReportedWaypointPosition_constraint; +ber_type_decoder_f FANSReportedWaypointPosition_decode_ber; +der_type_encoder_f FANSReportedWaypointPosition_encode_der; +xer_type_decoder_f FANSReportedWaypointPosition_decode_xer; +xer_type_encoder_f FANSReportedWaypointPosition_encode_xer; +per_type_decoder_f FANSReportedWaypointPosition_decode_uper; +per_type_encoder_f FANSReportedWaypointPosition_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSReportedWaypointPosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointTime.c new file mode 100644 index 000000000..be87c33dc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointTime.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSReportedWaypointTime.h" + +int +FANSReportedWaypointTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSTime.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSTime, + * so here we adjust the DEF accordingly. + */ +static void +FANSReportedWaypointTime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSTime.free_struct; + td->print_struct = asn_DEF_FANSTime.print_struct; + td->check_constraints = asn_DEF_FANSTime.check_constraints; + td->ber_decoder = asn_DEF_FANSTime.ber_decoder; + td->der_encoder = asn_DEF_FANSTime.der_encoder; + td->xer_decoder = asn_DEF_FANSTime.xer_decoder; + td->xer_encoder = asn_DEF_FANSTime.xer_encoder; + td->uper_decoder = asn_DEF_FANSTime.uper_decoder; + td->uper_encoder = asn_DEF_FANSTime.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSTime.per_constraints; + td->elements = asn_DEF_FANSTime.elements; + td->elements_count = asn_DEF_FANSTime.elements_count; + td->specifics = asn_DEF_FANSTime.specifics; +} + +void +FANSReportedWaypointTime_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSReportedWaypointTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSReportedWaypointTime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSReportedWaypointTime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSReportedWaypointTime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSReportedWaypointTime_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSReportedWaypointTime_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSReportedWaypointTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSReportedWaypointTime = { + "FANSReportedWaypointTime", + "FANSReportedWaypointTime", + FANSReportedWaypointTime_free, + FANSReportedWaypointTime_print, + FANSReportedWaypointTime_constraint, + FANSReportedWaypointTime_decode_ber, + FANSReportedWaypointTime_encode_der, + FANSReportedWaypointTime_decode_xer, + FANSReportedWaypointTime_encode_xer, + FANSReportedWaypointTime_decode_uper, + FANSReportedWaypointTime_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSReportedWaypointTime_tags_1, + sizeof(asn_DEF_FANSReportedWaypointTime_tags_1) + /sizeof(asn_DEF_FANSReportedWaypointTime_tags_1[0]), /* 1 */ + asn_DEF_FANSReportedWaypointTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSReportedWaypointTime_tags_1) + /sizeof(asn_DEF_FANSReportedWaypointTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointTime.h new file mode 100644 index 000000000..92271323c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportedWaypointTime.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSReportedWaypointTime_H_ +#define _FANSReportedWaypointTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSReportedWaypointTime */ +typedef FANSTime_t FANSReportedWaypointTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSReportedWaypointTime; +asn_struct_free_f FANSReportedWaypointTime_free; +asn_struct_print_f FANSReportedWaypointTime_print; +asn_constr_check_f FANSReportedWaypointTime_constraint; +ber_type_decoder_f FANSReportedWaypointTime_decode_ber; +der_type_encoder_f FANSReportedWaypointTime_encode_der; +xer_type_decoder_f FANSReportedWaypointTime_decode_xer; +xer_type_encoder_f FANSReportedWaypointTime_encode_xer; +per_type_decoder_f FANSReportedWaypointTime_decode_uper; +per_type_encoder_f FANSReportedWaypointTime_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSReportedWaypointTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportingPoints.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportingPoints.c new file mode 100644 index 000000000..9cadd9d3e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportingPoints.c @@ -0,0 +1,73 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSReportingPoints.h" + +static asn_TYPE_member_t asn_MBR_FANSReportingPoints_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSReportingPoints, latLonReportingPoints), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSLatLonReportingPoints, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latLonReportingPoints" + }, + { ATF_POINTER, 1, offsetof(struct FANSReportingPoints, degreeIncrement), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSDegreeIncrement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "degreeIncrement" + }, +}; +static const int asn_MAP_FANSReportingPoints_oms_1[] = { 1 }; +static const ber_tlv_tag_t asn_DEF_FANSReportingPoints_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSReportingPoints_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* degreeIncrement */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* latitudeReportingPoints */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 } /* longitudeReportingPoints */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSReportingPoints_specs_1 = { + sizeof(struct FANSReportingPoints), + offsetof(struct FANSReportingPoints, _asn_ctx), + asn_MAP_FANSReportingPoints_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSReportingPoints_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSReportingPoints = { + "FANSReportingPoints", + "FANSReportingPoints", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSReportingPoints_tags_1, + sizeof(asn_DEF_FANSReportingPoints_tags_1) + /sizeof(asn_DEF_FANSReportingPoints_tags_1[0]), /* 1 */ + asn_DEF_FANSReportingPoints_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSReportingPoints_tags_1) + /sizeof(asn_DEF_FANSReportingPoints_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSReportingPoints_1, + 2, /* Elements count */ + &asn_SPC_FANSReportingPoints_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSReportingPoints.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportingPoints.h new file mode 100644 index 000000000..9e7c7214e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSReportingPoints.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSReportingPoints_H_ +#define _FANSReportingPoints_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSLatLonReportingPoints.h" +#include "FANSDegreeIncrement.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSReportingPoints */ +typedef struct FANSReportingPoints { + FANSLatLonReportingPoints_t latLonReportingPoints; + FANSDegreeIncrement_t *degreeIncrement /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSReportingPoints_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSReportingPoints; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSReportingPoints_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteClearance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteClearance.c new file mode 100644 index 000000000..c5a868853 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteClearance.c @@ -0,0 +1,152 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRouteClearance.h" + +static asn_TYPE_member_t asn_MBR_FANSRouteClearance_1[] = { + { ATF_POINTER, 10, offsetof(struct FANSRouteClearance, airportDeparture), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAirportDeparture, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "airportDeparture" + }, + { ATF_POINTER, 9, offsetof(struct FANSRouteClearance, airportDestination), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAirportDestination, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "airportDestination" + }, + { ATF_POINTER, 8, offsetof(struct FANSRouteClearance, runwayDeparture), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRunwayDeparture, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "runwayDeparture" + }, + { ATF_POINTER, 7, offsetof(struct FANSRouteClearance, procedureDeparture), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSProcedureDeparture, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedureDeparture" + }, + { ATF_POINTER, 6, offsetof(struct FANSRouteClearance, runwayArrival), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRunwayArrival, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "runwayArrival" + }, + { ATF_POINTER, 5, offsetof(struct FANSRouteClearance, procedureApproach), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSProcedureApproach, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedureApproach" + }, + { ATF_POINTER, 4, offsetof(struct FANSRouteClearance, procedureArrival), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSProcedureArrival, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "procedureArrival" + }, + { ATF_POINTER, 3, offsetof(struct FANSRouteClearance, airwayIntercept), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAirwayIntercept, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "airwayIntercept" + }, + { ATF_POINTER, 2, offsetof(struct FANSRouteClearance, routeinformation_seqOf), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteInformationSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "routeinformation-seqOf" + }, + { ATF_POINTER, 1, offsetof(struct FANSRouteClearance, routeInformationAdditional), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRouteInformationAdditional, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "routeInformationAdditional" + }, +}; +static const int asn_MAP_FANSRouteClearance_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; +static const ber_tlv_tag_t asn_DEF_FANSRouteClearance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRouteClearance_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* airportDeparture */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* airportDestination */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* runwayDeparture */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* procedureDeparture */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* runwayArrival */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* procedureApproach */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* procedureArrival */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* airwayIntercept */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* routeinformation-seqOf */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* routeInformationAdditional */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRouteClearance_specs_1 = { + sizeof(struct FANSRouteClearance), + offsetof(struct FANSRouteClearance, _asn_ctx), + asn_MAP_FANSRouteClearance_tag2el_1, + 10, /* Count of tags in the map */ + asn_MAP_FANSRouteClearance_oms_1, /* Optional members */ + 10, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRouteClearance = { + "FANSRouteClearance", + "FANSRouteClearance", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRouteClearance_tags_1, + sizeof(asn_DEF_FANSRouteClearance_tags_1) + /sizeof(asn_DEF_FANSRouteClearance_tags_1[0]), /* 1 */ + asn_DEF_FANSRouteClearance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRouteClearance_tags_1) + /sizeof(asn_DEF_FANSRouteClearance_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRouteClearance_1, + 10, /* Elements count */ + &asn_SPC_FANSRouteClearance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteClearance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteClearance.h new file mode 100644 index 000000000..96e428455 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteClearance.h @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRouteClearance_H_ +#define _FANSRouteClearance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSAirportDeparture.h" +#include "FANSAirportDestination.h" +#include "FANSAirwayIntercept.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSRunway; +struct FANSProcedureName; +struct FANSRouteInformationSequence; +struct FANSRouteInformationAdditional; + +/* FANSRouteClearance */ +typedef struct FANSRouteClearance { + FANSAirportDeparture_t *airportDeparture /* OPTIONAL */; + FANSAirportDestination_t *airportDestination /* OPTIONAL */; + struct FANSRunway *runwayDeparture /* OPTIONAL */; + struct FANSProcedureName *procedureDeparture /* OPTIONAL */; + struct FANSRunway *runwayArrival /* OPTIONAL */; + struct FANSProcedureName *procedureApproach /* OPTIONAL */; + struct FANSProcedureName *procedureArrival /* OPTIONAL */; + FANSAirwayIntercept_t *airwayIntercept /* OPTIONAL */; + struct FANSRouteInformationSequence *routeinformation_seqOf /* OPTIONAL */; + struct FANSRouteInformationAdditional *routeInformationAdditional /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRouteClearance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRouteClearance; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSRunwayDeparture.h" +#include "FANSProcedureDeparture.h" +#include "FANSRunwayArrival.h" +#include "FANSProcedureApproach.h" +#include "FANSProcedureArrival.h" +#include "FANSRouteInformationSequence.h" +#include "FANSRouteInformationAdditional.h" + +#endif /* _FANSRouteClearance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformation.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformation.c new file mode 100644 index 000000000..84e7a7b3a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformation.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRouteInformation.h" + +static asn_per_constraints_t asn_PER_type_FANSRouteInformation_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 5 } /* (0..5) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSRouteInformation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSRouteInformation, choice.publishedIdentifier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPublishedIdentifier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "publishedIdentifier" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRouteInformation, choice.latitudeLongitude), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSLatitudeLongitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRouteInformation, choice.placeBearingPlaceBearing), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPlaceBearingPlaceBearing, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "placeBearingPlaceBearing" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRouteInformation, choice.placeBearingDistance), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSPlaceBearingDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "placeBearingDistance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRouteInformation, choice.airwayIdentifier), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSAirwayIdentifier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "airwayIdentifier" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRouteInformation, choice.trackDetail), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTrackDetail, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "trackDetail" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRouteInformation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* publishedIdentifier */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* placeBearingPlaceBearing */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* airwayIdentifier */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* trackDetail */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSRouteInformation_specs_1 = { + sizeof(struct FANSRouteInformation), + offsetof(struct FANSRouteInformation, _asn_ctx), + offsetof(struct FANSRouteInformation, present), + sizeof(((struct FANSRouteInformation *)0)->present), + asn_MAP_FANSRouteInformation_tag2el_1, + 6, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRouteInformation = { + "FANSRouteInformation", + "FANSRouteInformation", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSRouteInformation_constr_1, + asn_MBR_FANSRouteInformation_1, + 6, /* Elements count */ + &asn_SPC_FANSRouteInformation_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformation.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformation.h new file mode 100644 index 000000000..e626dd0c5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformation.h @@ -0,0 +1,62 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRouteInformation_H_ +#define _FANSRouteInformation_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPublishedIdentifier.h" +#include "FANSLatitudeLongitude.h" +#include "FANSPlaceBearingPlaceBearing.h" +#include "FANSPlaceBearingDistance.h" +#include "FANSAirwayIdentifier.h" +#include "FANSTrackDetail.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSRouteInformation_PR { + FANSRouteInformation_PR_NOTHING, /* No components present */ + FANSRouteInformation_PR_publishedIdentifier, + FANSRouteInformation_PR_latitudeLongitude, + FANSRouteInformation_PR_placeBearingPlaceBearing, + FANSRouteInformation_PR_placeBearingDistance, + FANSRouteInformation_PR_airwayIdentifier, + FANSRouteInformation_PR_trackDetail +} FANSRouteInformation_PR; + +/* FANSRouteInformation */ +typedef struct FANSRouteInformation { + FANSRouteInformation_PR present; + union FANSRouteInformation_u { + FANSPublishedIdentifier_t publishedIdentifier; + FANSLatitudeLongitude_t latitudeLongitude; + FANSPlaceBearingPlaceBearing_t placeBearingPlaceBearing; + FANSPlaceBearingDistance_t placeBearingDistance; + FANSAirwayIdentifier_t airwayIdentifier; + FANSTrackDetail_t trackDetail; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRouteInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRouteInformation; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRouteInformation_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationAdditional.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationAdditional.c new file mode 100644 index 000000000..f8709997c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationAdditional.c @@ -0,0 +1,112 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRouteInformationAdditional.h" + +static asn_TYPE_member_t asn_MBR_FANSRouteInformationAdditional_1[] = { + { ATF_POINTER, 6, offsetof(struct FANSRouteInformationAdditional, aTWalongtrackwaypointsequence), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATWAlongTrackWaypointSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTWalongtrackwaypointsequence" + }, + { ATF_POINTER, 5, offsetof(struct FANSRouteInformationAdditional, reportingPoints), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSReportingPoints, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "reportingPoints" + }, + { ATF_POINTER, 4, offsetof(struct FANSRouteInformationAdditional, interceptCourseFromSequence), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSInterceptCourseFromSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "interceptCourseFromSequence" + }, + { ATF_POINTER, 3, offsetof(struct FANSRouteInformationAdditional, holdAtWaypointSequence), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSHoldatwaypointSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "holdAtWaypointSequence" + }, + { ATF_POINTER, 2, offsetof(struct FANSRouteInformationAdditional, waypointSpeedAltitudeSequence), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSWaypointSpeedAltitudesequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "waypointSpeedAltitudeSequence" + }, + { ATF_POINTER, 1, offsetof(struct FANSRouteInformationAdditional, rTArequiredtimearrivalsequenc), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSRTARequiredTimeArrivalSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rTArequiredtimearrivalsequenc" + }, +}; +static const int asn_MAP_FANSRouteInformationAdditional_oms_1[] = { 0, 1, 2, 3, 4, 5 }; +static const ber_tlv_tag_t asn_DEF_FANSRouteInformationAdditional_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRouteInformationAdditional_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* aTWalongtrackwaypointsequence */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* reportingPoints */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* interceptCourseFromSequence */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* holdAtWaypointSequence */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* waypointSpeedAltitudeSequence */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* rTArequiredtimearrivalsequenc */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRouteInformationAdditional_specs_1 = { + sizeof(struct FANSRouteInformationAdditional), + offsetof(struct FANSRouteInformationAdditional, _asn_ctx), + asn_MAP_FANSRouteInformationAdditional_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_FANSRouteInformationAdditional_oms_1, /* Optional members */ + 6, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRouteInformationAdditional = { + "FANSRouteInformationAdditional", + "FANSRouteInformationAdditional", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRouteInformationAdditional_tags_1, + sizeof(asn_DEF_FANSRouteInformationAdditional_tags_1) + /sizeof(asn_DEF_FANSRouteInformationAdditional_tags_1[0]), /* 1 */ + asn_DEF_FANSRouteInformationAdditional_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRouteInformationAdditional_tags_1) + /sizeof(asn_DEF_FANSRouteInformationAdditional_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRouteInformationAdditional_1, + 6, /* Elements count */ + &asn_SPC_FANSRouteInformationAdditional_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationAdditional.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationAdditional.h new file mode 100644 index 000000000..fe848e26f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationAdditional.h @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRouteInformationAdditional_H_ +#define _FANSRouteInformationAdditional_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSATWAlongTrackWaypointSequence; +struct FANSReportingPoints; +struct FANSInterceptCourseFromSequence; +struct FANSHoldatwaypointSequence; +struct FANSWaypointSpeedAltitudesequence; +struct FANSRTARequiredTimeArrivalSequence; + +/* FANSRouteInformationAdditional */ +typedef struct FANSRouteInformationAdditional { + struct FANSATWAlongTrackWaypointSequence *aTWalongtrackwaypointsequence /* OPTIONAL */; + struct FANSReportingPoints *reportingPoints /* OPTIONAL */; + struct FANSInterceptCourseFromSequence *interceptCourseFromSequence /* OPTIONAL */; + struct FANSHoldatwaypointSequence *holdAtWaypointSequence /* OPTIONAL */; + struct FANSWaypointSpeedAltitudesequence *waypointSpeedAltitudeSequence /* OPTIONAL */; + struct FANSRTARequiredTimeArrivalSequence *rTArequiredtimearrivalsequenc /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRouteInformationAdditional_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRouteInformationAdditional; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSATWAlongTrackWaypointSequence.h" +#include "FANSReportingPoints.h" +#include "FANSInterceptCourseFromSequence.h" +#include "FANSHoldatwaypointSequence.h" +#include "FANSWaypointSpeedAltitudesequence.h" +#include "FANSRTARequiredTimeArrivalSequence.h" + +#endif /* _FANSRouteInformationAdditional_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationSequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationSequence.c new file mode 100644 index 000000000..6468c4e3c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationSequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRouteInformationSequence.h" + +static asn_per_constraints_t asn_PER_type_FANSRouteInformationSequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 7, 7, 1, 128 } /* (SIZE(1..128)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSRouteInformationSequence_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSRouteInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSRouteInformationSequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSRouteInformationSequence_specs_1 = { + sizeof(struct FANSRouteInformationSequence), + offsetof(struct FANSRouteInformationSequence, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRouteInformationSequence = { + "FANSRouteInformationSequence", + "FANSRouteInformationSequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRouteInformationSequence_tags_1, + sizeof(asn_DEF_FANSRouteInformationSequence_tags_1) + /sizeof(asn_DEF_FANSRouteInformationSequence_tags_1[0]), /* 1 */ + asn_DEF_FANSRouteInformationSequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRouteInformationSequence_tags_1) + /sizeof(asn_DEF_FANSRouteInformationSequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSRouteInformationSequence_constr_1, + asn_MBR_FANSRouteInformationSequence_1, + 1, /* Single element */ + &asn_SPC_FANSRouteInformationSequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationSequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationSequence.h new file mode 100644 index 000000000..42a4ed34c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRouteInformationSequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRouteInformationSequence_H_ +#define _FANSRouteInformationSequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSRouteInformation; + +/* FANSRouteInformationSequence */ +typedef struct FANSRouteInformationSequence { + A_SEQUENCE_OF(struct FANSRouteInformation) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRouteInformationSequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRouteInformationSequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSRouteInformation.h" + +#endif /* _FANSRouteInformationSequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunway.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunway.c new file mode 100644 index 000000000..4c5b4ec1a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunway.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRunway.h" + +static asn_TYPE_member_t asn_MBR_FANSRunway_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSRunway, runwayDirection), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSRunwayDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "runwayDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSRunway, runwayConfiguration), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSRunwayConfiguration, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "runwayConfiguration" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSRunway_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSRunway_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* runwayDirection */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 } /* runwayConfiguration */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSRunway_specs_1 = { + sizeof(struct FANSRunway), + offsetof(struct FANSRunway, _asn_ctx), + asn_MAP_FANSRunway_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSRunway = { + "FANSRunway", + "FANSRunway", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRunway_tags_1, + sizeof(asn_DEF_FANSRunway_tags_1) + /sizeof(asn_DEF_FANSRunway_tags_1[0]), /* 1 */ + asn_DEF_FANSRunway_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRunway_tags_1) + /sizeof(asn_DEF_FANSRunway_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSRunway_1, + 2, /* Elements count */ + &asn_SPC_FANSRunway_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunway.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunway.h new file mode 100644 index 000000000..e562baec9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunway.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRunway_H_ +#define _FANSRunway_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSRunwayDirection.h" +#include "FANSRunwayConfiguration.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRunway */ +typedef struct FANSRunway { + FANSRunwayDirection_t runwayDirection; + FANSRunwayConfiguration_t runwayConfiguration; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSRunway_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRunway; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRunway_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayArrival.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayArrival.c new file mode 100644 index 000000000..0b7eb5eb1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayArrival.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRunwayArrival.h" + +int +FANSRunwayArrival_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSRunway.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSRunway, + * so here we adjust the DEF accordingly. + */ +static void +FANSRunwayArrival_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSRunway.free_struct; + td->print_struct = asn_DEF_FANSRunway.print_struct; + td->check_constraints = asn_DEF_FANSRunway.check_constraints; + td->ber_decoder = asn_DEF_FANSRunway.ber_decoder; + td->der_encoder = asn_DEF_FANSRunway.der_encoder; + td->xer_decoder = asn_DEF_FANSRunway.xer_decoder; + td->xer_encoder = asn_DEF_FANSRunway.xer_encoder; + td->uper_decoder = asn_DEF_FANSRunway.uper_decoder; + td->uper_encoder = asn_DEF_FANSRunway.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSRunway.per_constraints; + td->elements = asn_DEF_FANSRunway.elements; + td->elements_count = asn_DEF_FANSRunway.elements_count; + td->specifics = asn_DEF_FANSRunway.specifics; +} + +void +FANSRunwayArrival_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSRunwayArrival_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayArrival_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSRunwayArrival_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayArrival_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSRunwayArrival_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayArrival_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSRunwayArrival_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSRunwayArrival_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSRunwayArrival_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSRunwayArrival = { + "FANSRunwayArrival", + "FANSRunwayArrival", + FANSRunwayArrival_free, + FANSRunwayArrival_print, + FANSRunwayArrival_constraint, + FANSRunwayArrival_decode_ber, + FANSRunwayArrival_encode_der, + FANSRunwayArrival_decode_xer, + FANSRunwayArrival_encode_xer, + FANSRunwayArrival_decode_uper, + FANSRunwayArrival_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRunwayArrival_tags_1, + sizeof(asn_DEF_FANSRunwayArrival_tags_1) + /sizeof(asn_DEF_FANSRunwayArrival_tags_1[0]), /* 1 */ + asn_DEF_FANSRunwayArrival_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRunwayArrival_tags_1) + /sizeof(asn_DEF_FANSRunwayArrival_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayArrival.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayArrival.h new file mode 100644 index 000000000..3b3885b48 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayArrival.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRunwayArrival_H_ +#define _FANSRunwayArrival_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSRunway.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRunwayArrival */ +typedef FANSRunway_t FANSRunwayArrival_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRunwayArrival; +asn_struct_free_f FANSRunwayArrival_free; +asn_struct_print_f FANSRunwayArrival_print; +asn_constr_check_f FANSRunwayArrival_constraint; +ber_type_decoder_f FANSRunwayArrival_decode_ber; +der_type_encoder_f FANSRunwayArrival_encode_der; +xer_type_decoder_f FANSRunwayArrival_decode_xer; +xer_type_encoder_f FANSRunwayArrival_encode_xer; +per_type_decoder_f FANSRunwayArrival_decode_uper; +per_type_encoder_f FANSRunwayArrival_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRunwayArrival_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayConfiguration.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayConfiguration.c new file mode 100644 index 000000000..3f01a1161 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayConfiguration.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRunwayConfiguration.h" + +int +FANSRunwayConfiguration_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSRunwayConfiguration_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSRunwayConfiguration_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSRunwayConfiguration_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayConfiguration_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSRunwayConfiguration_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayConfiguration_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSRunwayConfiguration_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayConfiguration_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSRunwayConfiguration_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSRunwayConfiguration_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSRunwayConfiguration_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSRunwayConfiguration_value2enum_1[] = { + { 0, 4, "left" }, + { 1, 5, "right" }, + { 2, 6, "center" }, + { 3, 4, "none" } +}; +static const unsigned int asn_MAP_FANSRunwayConfiguration_enum2value_1[] = { + 2, /* center(2) */ + 0, /* left(0) */ + 3, /* none(3) */ + 1 /* right(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSRunwayConfiguration_specs_1 = { + asn_MAP_FANSRunwayConfiguration_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSRunwayConfiguration_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSRunwayConfiguration_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSRunwayConfiguration = { + "FANSRunwayConfiguration", + "FANSRunwayConfiguration", + FANSRunwayConfiguration_free, + FANSRunwayConfiguration_print, + FANSRunwayConfiguration_constraint, + FANSRunwayConfiguration_decode_ber, + FANSRunwayConfiguration_encode_der, + FANSRunwayConfiguration_decode_xer, + FANSRunwayConfiguration_encode_xer, + FANSRunwayConfiguration_decode_uper, + FANSRunwayConfiguration_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRunwayConfiguration_tags_1, + sizeof(asn_DEF_FANSRunwayConfiguration_tags_1) + /sizeof(asn_DEF_FANSRunwayConfiguration_tags_1[0]), /* 1 */ + asn_DEF_FANSRunwayConfiguration_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRunwayConfiguration_tags_1) + /sizeof(asn_DEF_FANSRunwayConfiguration_tags_1[0]), /* 1 */ + &asn_PER_type_FANSRunwayConfiguration_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSRunwayConfiguration_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayConfiguration.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayConfiguration.h new file mode 100644 index 000000000..547416b54 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayConfiguration.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRunwayConfiguration_H_ +#define _FANSRunwayConfiguration_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSRunwayConfiguration { + FANSRunwayConfiguration_left = 0, + FANSRunwayConfiguration_right = 1, + FANSRunwayConfiguration_center = 2, + FANSRunwayConfiguration_none = 3 +} e_FANSRunwayConfiguration; + +/* FANSRunwayConfiguration */ +typedef long FANSRunwayConfiguration_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRunwayConfiguration; +asn_struct_free_f FANSRunwayConfiguration_free; +asn_struct_print_f FANSRunwayConfiguration_print; +asn_constr_check_f FANSRunwayConfiguration_constraint; +ber_type_decoder_f FANSRunwayConfiguration_decode_ber; +der_type_encoder_f FANSRunwayConfiguration_encode_der; +xer_type_decoder_f FANSRunwayConfiguration_decode_xer; +xer_type_encoder_f FANSRunwayConfiguration_encode_xer; +per_type_decoder_f FANSRunwayConfiguration_decode_uper; +per_type_encoder_f FANSRunwayConfiguration_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRunwayConfiguration_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDeparture.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDeparture.c new file mode 100644 index 000000000..f1e690d89 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDeparture.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRunwayDeparture.h" + +int +FANSRunwayDeparture_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSRunway.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSRunway, + * so here we adjust the DEF accordingly. + */ +static void +FANSRunwayDeparture_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSRunway.free_struct; + td->print_struct = asn_DEF_FANSRunway.print_struct; + td->check_constraints = asn_DEF_FANSRunway.check_constraints; + td->ber_decoder = asn_DEF_FANSRunway.ber_decoder; + td->der_encoder = asn_DEF_FANSRunway.der_encoder; + td->xer_decoder = asn_DEF_FANSRunway.xer_decoder; + td->xer_encoder = asn_DEF_FANSRunway.xer_encoder; + td->uper_decoder = asn_DEF_FANSRunway.uper_decoder; + td->uper_encoder = asn_DEF_FANSRunway.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSRunway.per_constraints; + td->elements = asn_DEF_FANSRunway.elements; + td->elements_count = asn_DEF_FANSRunway.elements_count; + td->specifics = asn_DEF_FANSRunway.specifics; +} + +void +FANSRunwayDeparture_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSRunwayDeparture_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayDeparture_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSRunwayDeparture_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayDeparture_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSRunwayDeparture_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayDeparture_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSRunwayDeparture_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSRunwayDeparture_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSRunwayDeparture_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSRunwayDeparture = { + "FANSRunwayDeparture", + "FANSRunwayDeparture", + FANSRunwayDeparture_free, + FANSRunwayDeparture_print, + FANSRunwayDeparture_constraint, + FANSRunwayDeparture_decode_ber, + FANSRunwayDeparture_encode_der, + FANSRunwayDeparture_decode_xer, + FANSRunwayDeparture_encode_xer, + FANSRunwayDeparture_decode_uper, + FANSRunwayDeparture_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRunwayDeparture_tags_1, + sizeof(asn_DEF_FANSRunwayDeparture_tags_1) + /sizeof(asn_DEF_FANSRunwayDeparture_tags_1[0]), /* 1 */ + asn_DEF_FANSRunwayDeparture_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRunwayDeparture_tags_1) + /sizeof(asn_DEF_FANSRunwayDeparture_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDeparture.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDeparture.h new file mode 100644 index 000000000..04e1272b5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDeparture.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRunwayDeparture_H_ +#define _FANSRunwayDeparture_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSRunway.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRunwayDeparture */ +typedef FANSRunway_t FANSRunwayDeparture_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRunwayDeparture; +asn_struct_free_f FANSRunwayDeparture_free; +asn_struct_print_f FANSRunwayDeparture_print; +asn_constr_check_f FANSRunwayDeparture_constraint; +ber_type_decoder_f FANSRunwayDeparture_decode_ber; +der_type_encoder_f FANSRunwayDeparture_encode_der; +xer_type_decoder_f FANSRunwayDeparture_decode_xer; +xer_type_encoder_f FANSRunwayDeparture_encode_xer; +per_type_decoder_f FANSRunwayDeparture_decode_uper; +per_type_encoder_f FANSRunwayDeparture_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRunwayDeparture_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDirection.c new file mode 100644 index 000000000..b3fb6ed93 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDirection.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSRunwayDirection.h" + +int +FANSRunwayDirection_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 36)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSRunwayDirection_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSRunwayDirection_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSRunwayDirection_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayDirection_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSRunwayDirection_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayDirection_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSRunwayDirection_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSRunwayDirection_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSRunwayDirection_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSRunwayDirection_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSRunwayDirection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 1, 36 } /* (1..36) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSRunwayDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSRunwayDirection = { + "FANSRunwayDirection", + "FANSRunwayDirection", + FANSRunwayDirection_free, + FANSRunwayDirection_print, + FANSRunwayDirection_constraint, + FANSRunwayDirection_decode_ber, + FANSRunwayDirection_encode_der, + FANSRunwayDirection_decode_xer, + FANSRunwayDirection_encode_xer, + FANSRunwayDirection_decode_uper, + FANSRunwayDirection_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSRunwayDirection_tags_1, + sizeof(asn_DEF_FANSRunwayDirection_tags_1) + /sizeof(asn_DEF_FANSRunwayDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSRunwayDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSRunwayDirection_tags_1) + /sizeof(asn_DEF_FANSRunwayDirection_tags_1[0]), /* 1 */ + &asn_PER_type_FANSRunwayDirection_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDirection.h new file mode 100644 index 000000000..36b351a4d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSRunwayDirection.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSRunwayDirection_H_ +#define _FANSRunwayDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSRunwayDirection */ +typedef long FANSRunwayDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSRunwayDirection; +asn_struct_free_f FANSRunwayDirection_free; +asn_struct_print_f FANSRunwayDirection_print; +asn_constr_check_f FANSRunwayDirection_constraint; +ber_type_decoder_f FANSRunwayDirection_decode_ber; +der_type_encoder_f FANSRunwayDirection_encode_der; +xer_type_decoder_f FANSRunwayDirection_decode_xer; +xer_type_encoder_f FANSRunwayDirection_encode_xer; +per_type_decoder_f FANSRunwayDirection_decode_uper; +per_type_encoder_f FANSRunwayDirection_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSRunwayDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSSREquipmentAvailable.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSSREquipmentAvailable.c new file mode 100644 index 000000000..1fc4daa63 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSSREquipmentAvailable.c @@ -0,0 +1,157 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSSREquipmentAvailable.h" + +int +FANSSSREquipmentAvailable_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSSSREquipmentAvailable_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSSREquipmentAvailable_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSSREquipmentAvailable_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSSREquipmentAvailable_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSSREquipmentAvailable_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSSREquipmentAvailable_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSSREquipmentAvailable_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSSREquipmentAvailable_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSSREquipmentAvailable_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSSREquipmentAvailable_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 6 } /* (0..6) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSSSREquipmentAvailable_value2enum_1[] = { + { 0, 4, "nnil" }, + { 1, 17, "atransponderModeA" }, + { 2, 21, "ctransponderModeAandC" }, + { 3, 17, "xtransponderModeS" }, + { 4, 19, "ptransponderModeSPA" }, + { 5, 19, "itransponderModeSID" }, + { 6, 21, "stransponderModeSPAID" } +}; +static const unsigned int asn_MAP_FANSSSREquipmentAvailable_enum2value_1[] = { + 1, /* atransponderModeA(1) */ + 2, /* ctransponderModeAandC(2) */ + 5, /* itransponderModeSID(5) */ + 0, /* nnil(0) */ + 4, /* ptransponderModeSPA(4) */ + 6, /* stransponderModeSPAID(6) */ + 3 /* xtransponderModeS(3) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSSSREquipmentAvailable_specs_1 = { + asn_MAP_FANSSSREquipmentAvailable_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSSSREquipmentAvailable_enum2value_1, /* N => "tag"; sorted by N */ + 7, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSSSREquipmentAvailable_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSSREquipmentAvailable = { + "FANSSSREquipmentAvailable", + "FANSSSREquipmentAvailable", + FANSSSREquipmentAvailable_free, + FANSSSREquipmentAvailable_print, + FANSSSREquipmentAvailable_constraint, + FANSSSREquipmentAvailable_decode_ber, + FANSSSREquipmentAvailable_encode_der, + FANSSSREquipmentAvailable_decode_xer, + FANSSSREquipmentAvailable_encode_xer, + FANSSSREquipmentAvailable_decode_uper, + FANSSSREquipmentAvailable_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSSREquipmentAvailable_tags_1, + sizeof(asn_DEF_FANSSSREquipmentAvailable_tags_1) + /sizeof(asn_DEF_FANSSSREquipmentAvailable_tags_1[0]), /* 1 */ + asn_DEF_FANSSSREquipmentAvailable_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSSREquipmentAvailable_tags_1) + /sizeof(asn_DEF_FANSSSREquipmentAvailable_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSSREquipmentAvailable_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSSSREquipmentAvailable_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSSREquipmentAvailable.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSSREquipmentAvailable.h new file mode 100644 index 000000000..2316880ed --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSSREquipmentAvailable.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSSREquipmentAvailable_H_ +#define _FANSSSREquipmentAvailable_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSSSREquipmentAvailable { + FANSSSREquipmentAvailable_nnil = 0, + FANSSSREquipmentAvailable_atransponderModeA = 1, + FANSSSREquipmentAvailable_ctransponderModeAandC = 2, + FANSSSREquipmentAvailable_xtransponderModeS = 3, + FANSSSREquipmentAvailable_ptransponderModeSPA = 4, + FANSSSREquipmentAvailable_itransponderModeSID = 5, + FANSSSREquipmentAvailable_stransponderModeSPAID = 6 +} e_FANSSSREquipmentAvailable; + +/* FANSSSREquipmentAvailable */ +typedef long FANSSSREquipmentAvailable_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSSREquipmentAvailable; +asn_struct_free_f FANSSSREquipmentAvailable_free; +asn_struct_print_f FANSSSREquipmentAvailable_print; +asn_constr_check_f FANSSSREquipmentAvailable_constraint; +ber_type_decoder_f FANSSSREquipmentAvailable_decode_ber; +der_type_encoder_f FANSSSREquipmentAvailable_encode_der; +xer_type_decoder_f FANSSSREquipmentAvailable_decode_xer; +xer_type_encoder_f FANSSSREquipmentAvailable_encode_xer; +per_type_decoder_f FANSSSREquipmentAvailable_decode_uper; +per_type_encoder_f FANSSSREquipmentAvailable_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSSREquipmentAvailable_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeed.c new file mode 100644 index 000000000..ced959c74 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeed.c @@ -0,0 +1,131 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeed.h" + +static asn_per_constraints_t asn_PER_type_FANSSpeed_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedIndicated), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedIndicated, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedIndicated" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedIndicatedMetric), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedIndicatedMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedIndicatedMetric" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedTrue), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedTrue, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedTrue" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedTrueMetric), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedTrueMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedTrueMetric" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedGround), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedGround, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedGround" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedGroundMetric), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedGroundMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedGroundMetric" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedMach), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedMach, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedMach" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSSpeed, choice.speedMachLarge), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSSpeedMachLarge, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speedMachLarge" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* speedIndicated */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* speedIndicatedMetric */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* speedTrue */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* speedTrueMetric */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* speedGround */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* speedGroundMetric */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* speedMach */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* speedMachLarge */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSSpeed_specs_1 = { + sizeof(struct FANSSpeed), + offsetof(struct FANSSpeed, _asn_ctx), + offsetof(struct FANSSpeed, present), + sizeof(((struct FANSSpeed *)0)->present), + asn_MAP_FANSSpeed_tag2el_1, + 8, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeed = { + "FANSSpeed", + "FANSSpeed", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSSpeed_constr_1, + asn_MBR_FANSSpeed_1, + 8, /* Elements count */ + &asn_SPC_FANSSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeed.h new file mode 100644 index 000000000..06872e058 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeed.h @@ -0,0 +1,68 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeed_H_ +#define _FANSSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSSpeedIndicated.h" +#include "FANSSpeedIndicatedMetric.h" +#include "FANSSpeedTrue.h" +#include "FANSSpeedTrueMetric.h" +#include "FANSSpeedGround.h" +#include "FANSSpeedGroundMetric.h" +#include "FANSSpeedMach.h" +#include "FANSSpeedMachLarge.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSSpeed_PR { + FANSSpeed_PR_NOTHING, /* No components present */ + FANSSpeed_PR_speedIndicated, + FANSSpeed_PR_speedIndicatedMetric, + FANSSpeed_PR_speedTrue, + FANSSpeed_PR_speedTrueMetric, + FANSSpeed_PR_speedGround, + FANSSpeed_PR_speedGroundMetric, + FANSSpeed_PR_speedMach, + FANSSpeed_PR_speedMachLarge +} FANSSpeed_PR; + +/* FANSSpeed */ +typedef struct FANSSpeed { + FANSSpeed_PR present; + union FANSSpeed_u { + FANSSpeedIndicated_t speedIndicated; + FANSSpeedIndicatedMetric_t speedIndicatedMetric; + FANSSpeedTrue_t speedTrue; + FANSSpeedTrueMetric_t speedTrueMetric; + FANSSpeedGround_t speedGround; + FANSSpeedGroundMetric_t speedGroundMetric; + FANSSpeedMach_t speedMach; + FANSSpeedMachLarge_t speedMachLarge; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGround.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGround.c new file mode 100644 index 000000000..9304e43c2 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGround.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedGround.h" + +int +FANSSpeedGround_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 7 && value <= 70)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedGround_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedGround_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedGround_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedGround_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedGround_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedGround_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedGround_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedGround_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedGround_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedGround_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedGround_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 7, 70 } /* (7..70) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedGround_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedGround = { + "FANSSpeedGround", + "FANSSpeedGround", + FANSSpeedGround_free, + FANSSpeedGround_print, + FANSSpeedGround_constraint, + FANSSpeedGround_decode_ber, + FANSSpeedGround_encode_der, + FANSSpeedGround_decode_xer, + FANSSpeedGround_encode_xer, + FANSSpeedGround_decode_uper, + FANSSpeedGround_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedGround_tags_1, + sizeof(asn_DEF_FANSSpeedGround_tags_1) + /sizeof(asn_DEF_FANSSpeedGround_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedGround_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedGround_tags_1) + /sizeof(asn_DEF_FANSSpeedGround_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedGround_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGround.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGround.h new file mode 100644 index 000000000..813acd918 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGround.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedGround_H_ +#define _FANSSpeedGround_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedGround */ +typedef long FANSSpeedGround_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedGround; +asn_struct_free_f FANSSpeedGround_free; +asn_struct_print_f FANSSpeedGround_print; +asn_constr_check_f FANSSpeedGround_constraint; +ber_type_decoder_f FANSSpeedGround_decode_ber; +der_type_encoder_f FANSSpeedGround_encode_der; +xer_type_decoder_f FANSSpeedGround_decode_xer; +xer_type_encoder_f FANSSpeedGround_encode_xer; +per_type_decoder_f FANSSpeedGround_decode_uper; +per_type_encoder_f FANSSpeedGround_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedGround_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGroundMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGroundMetric.c new file mode 100644 index 000000000..a2f857672 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGroundMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedGroundMetric.h" + +int +FANSSpeedGroundMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 10 && value <= 265)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedGroundMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedGroundMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedGroundMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedGroundMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedGroundMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedGroundMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedGroundMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedGroundMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedGroundMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedGroundMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 10, 265 } /* (10..265) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedGroundMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedGroundMetric = { + "FANSSpeedGroundMetric", + "FANSSpeedGroundMetric", + FANSSpeedGroundMetric_free, + FANSSpeedGroundMetric_print, + FANSSpeedGroundMetric_constraint, + FANSSpeedGroundMetric_decode_ber, + FANSSpeedGroundMetric_encode_der, + FANSSpeedGroundMetric_decode_xer, + FANSSpeedGroundMetric_encode_xer, + FANSSpeedGroundMetric_decode_uper, + FANSSpeedGroundMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedGroundMetric_tags_1, + sizeof(asn_DEF_FANSSpeedGroundMetric_tags_1) + /sizeof(asn_DEF_FANSSpeedGroundMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedGroundMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedGroundMetric_tags_1) + /sizeof(asn_DEF_FANSSpeedGroundMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedGroundMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGroundMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGroundMetric.h new file mode 100644 index 000000000..c22469707 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedGroundMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedGroundMetric_H_ +#define _FANSSpeedGroundMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedGroundMetric */ +typedef long FANSSpeedGroundMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedGroundMetric; +asn_struct_free_f FANSSpeedGroundMetric_free; +asn_struct_print_f FANSSpeedGroundMetric_print; +asn_constr_check_f FANSSpeedGroundMetric_constraint; +ber_type_decoder_f FANSSpeedGroundMetric_decode_ber; +der_type_encoder_f FANSSpeedGroundMetric_encode_der; +xer_type_decoder_f FANSSpeedGroundMetric_decode_xer; +xer_type_encoder_f FANSSpeedGroundMetric_encode_xer; +per_type_decoder_f FANSSpeedGroundMetric_decode_uper; +per_type_encoder_f FANSSpeedGroundMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedGroundMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicated.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicated.c new file mode 100644 index 000000000..33610829d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicated.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedIndicated.h" + +int +FANSSpeedIndicated_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 7 && value <= 38)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedIndicated_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedIndicated_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedIndicated_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedIndicated_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedIndicated_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedIndicated_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedIndicated_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedIndicated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedIndicated_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedIndicated_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedIndicated_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 7, 38 } /* (7..38) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedIndicated_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedIndicated = { + "FANSSpeedIndicated", + "FANSSpeedIndicated", + FANSSpeedIndicated_free, + FANSSpeedIndicated_print, + FANSSpeedIndicated_constraint, + FANSSpeedIndicated_decode_ber, + FANSSpeedIndicated_encode_der, + FANSSpeedIndicated_decode_xer, + FANSSpeedIndicated_encode_xer, + FANSSpeedIndicated_decode_uper, + FANSSpeedIndicated_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedIndicated_tags_1, + sizeof(asn_DEF_FANSSpeedIndicated_tags_1) + /sizeof(asn_DEF_FANSSpeedIndicated_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedIndicated_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedIndicated_tags_1) + /sizeof(asn_DEF_FANSSpeedIndicated_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedIndicated_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicated.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicated.h new file mode 100644 index 000000000..a6a7babc0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicated.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedIndicated_H_ +#define _FANSSpeedIndicated_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedIndicated */ +typedef long FANSSpeedIndicated_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedIndicated; +asn_struct_free_f FANSSpeedIndicated_free; +asn_struct_print_f FANSSpeedIndicated_print; +asn_constr_check_f FANSSpeedIndicated_constraint; +ber_type_decoder_f FANSSpeedIndicated_decode_ber; +der_type_encoder_f FANSSpeedIndicated_encode_der; +xer_type_decoder_f FANSSpeedIndicated_decode_xer; +xer_type_encoder_f FANSSpeedIndicated_encode_xer; +per_type_decoder_f FANSSpeedIndicated_decode_uper; +per_type_encoder_f FANSSpeedIndicated_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedIndicated_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicatedMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicatedMetric.c new file mode 100644 index 000000000..e2353921c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicatedMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedIndicatedMetric.h" + +int +FANSSpeedIndicatedMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 10 && value <= 137)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedIndicatedMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedIndicatedMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedIndicatedMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedIndicatedMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedIndicatedMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedIndicatedMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedIndicatedMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedIndicatedMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedIndicatedMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedIndicatedMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 10, 137 } /* (10..137) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedIndicatedMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedIndicatedMetric = { + "FANSSpeedIndicatedMetric", + "FANSSpeedIndicatedMetric", + FANSSpeedIndicatedMetric_free, + FANSSpeedIndicatedMetric_print, + FANSSpeedIndicatedMetric_constraint, + FANSSpeedIndicatedMetric_decode_ber, + FANSSpeedIndicatedMetric_encode_der, + FANSSpeedIndicatedMetric_decode_xer, + FANSSpeedIndicatedMetric_encode_xer, + FANSSpeedIndicatedMetric_decode_uper, + FANSSpeedIndicatedMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedIndicatedMetric_tags_1, + sizeof(asn_DEF_FANSSpeedIndicatedMetric_tags_1) + /sizeof(asn_DEF_FANSSpeedIndicatedMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedIndicatedMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedIndicatedMetric_tags_1) + /sizeof(asn_DEF_FANSSpeedIndicatedMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedIndicatedMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicatedMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicatedMetric.h new file mode 100644 index 000000000..ace3a0603 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedIndicatedMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedIndicatedMetric_H_ +#define _FANSSpeedIndicatedMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedIndicatedMetric */ +typedef long FANSSpeedIndicatedMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedIndicatedMetric; +asn_struct_free_f FANSSpeedIndicatedMetric_free; +asn_struct_print_f FANSSpeedIndicatedMetric_print; +asn_constr_check_f FANSSpeedIndicatedMetric_constraint; +ber_type_decoder_f FANSSpeedIndicatedMetric_decode_ber; +der_type_encoder_f FANSSpeedIndicatedMetric_encode_der; +xer_type_decoder_f FANSSpeedIndicatedMetric_decode_xer; +xer_type_encoder_f FANSSpeedIndicatedMetric_encode_xer; +per_type_decoder_f FANSSpeedIndicatedMetric_decode_uper; +per_type_encoder_f FANSSpeedIndicatedMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedIndicatedMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMach.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMach.c new file mode 100644 index 000000000..e978f4730 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMach.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedMach.h" + +int +FANSSpeedMach_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 61 && value <= 92)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedMach_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedMach_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedMach_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedMach_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedMach_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedMach_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedMach_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedMach_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedMach_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedMach_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedMach_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 61, 92 } /* (61..92) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedMach_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedMach = { + "FANSSpeedMach", + "FANSSpeedMach", + FANSSpeedMach_free, + FANSSpeedMach_print, + FANSSpeedMach_constraint, + FANSSpeedMach_decode_ber, + FANSSpeedMach_encode_der, + FANSSpeedMach_decode_xer, + FANSSpeedMach_encode_xer, + FANSSpeedMach_decode_uper, + FANSSpeedMach_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedMach_tags_1, + sizeof(asn_DEF_FANSSpeedMach_tags_1) + /sizeof(asn_DEF_FANSSpeedMach_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedMach_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedMach_tags_1) + /sizeof(asn_DEF_FANSSpeedMach_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedMach_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMach.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMach.h new file mode 100644 index 000000000..bbf2e26dd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMach.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedMach_H_ +#define _FANSSpeedMach_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedMach */ +typedef long FANSSpeedMach_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedMach; +asn_struct_free_f FANSSpeedMach_free; +asn_struct_print_f FANSSpeedMach_print; +asn_constr_check_f FANSSpeedMach_constraint; +ber_type_decoder_f FANSSpeedMach_decode_ber; +der_type_encoder_f FANSSpeedMach_encode_der; +xer_type_decoder_f FANSSpeedMach_decode_xer; +xer_type_encoder_f FANSSpeedMach_encode_xer; +per_type_decoder_f FANSSpeedMach_decode_uper; +per_type_encoder_f FANSSpeedMach_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedMach_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMachLarge.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMachLarge.c new file mode 100644 index 000000000..6a9d73aa7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMachLarge.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedMachLarge.h" + +int +FANSSpeedMachLarge_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 93 && value <= 604)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedMachLarge_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedMachLarge_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedMachLarge_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedMachLarge_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedMachLarge_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedMachLarge_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedMachLarge_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedMachLarge_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedMachLarge_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedMachLarge_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedMachLarge_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 93, 604 } /* (93..604) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedMachLarge_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedMachLarge = { + "FANSSpeedMachLarge", + "FANSSpeedMachLarge", + FANSSpeedMachLarge_free, + FANSSpeedMachLarge_print, + FANSSpeedMachLarge_constraint, + FANSSpeedMachLarge_decode_ber, + FANSSpeedMachLarge_encode_der, + FANSSpeedMachLarge_decode_xer, + FANSSpeedMachLarge_encode_xer, + FANSSpeedMachLarge_decode_uper, + FANSSpeedMachLarge_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedMachLarge_tags_1, + sizeof(asn_DEF_FANSSpeedMachLarge_tags_1) + /sizeof(asn_DEF_FANSSpeedMachLarge_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedMachLarge_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedMachLarge_tags_1) + /sizeof(asn_DEF_FANSSpeedMachLarge_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedMachLarge_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMachLarge.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMachLarge.h new file mode 100644 index 000000000..6fc51fe48 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedMachLarge.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedMachLarge_H_ +#define _FANSSpeedMachLarge_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedMachLarge */ +typedef long FANSSpeedMachLarge_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedMachLarge; +asn_struct_free_f FANSSpeedMachLarge_free; +asn_struct_print_f FANSSpeedMachLarge_print; +asn_constr_check_f FANSSpeedMachLarge_constraint; +ber_type_decoder_f FANSSpeedMachLarge_decode_ber; +der_type_encoder_f FANSSpeedMachLarge_encode_der; +xer_type_decoder_f FANSSpeedMachLarge_decode_xer; +xer_type_encoder_f FANSSpeedMachLarge_encode_xer; +per_type_decoder_f FANSSpeedMachLarge_decode_uper; +per_type_encoder_f FANSSpeedMachLarge_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedMachLarge_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedSpeed.c new file mode 100644 index 000000000..b7a1259b8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedSpeed.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedSpeed.h" + +static asn_per_constraints_t asn_PER_type_FANSSpeedSpeed_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 2, 2 } /* (SIZE(2..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSSpeedSpeed_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSSpeedSpeed_specs_1 = { + sizeof(struct FANSSpeedSpeed), + offsetof(struct FANSSpeedSpeed, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedSpeed = { + "FANSSpeedSpeed", + "FANSSpeedSpeed", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedSpeed_tags_1, + sizeof(asn_DEF_FANSSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSSpeedSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSSpeedSpeed_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedSpeed_constr_1, + asn_MBR_FANSSpeedSpeed_1, + 1, /* Single element */ + &asn_SPC_FANSSpeedSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedSpeed.h new file mode 100644 index 000000000..2af627c31 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedSpeed.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedSpeed_H_ +#define _FANSSpeedSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSSpeed; + +/* FANSSpeedSpeed */ +typedef struct FANSSpeedSpeed { + A_SEQUENCE_OF(struct FANSSpeed) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSSpeedSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedSpeed; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSSpeed.h" + +#endif /* _FANSSpeedSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrue.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrue.c new file mode 100644 index 000000000..215f845ec --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrue.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedTrue.h" + +int +FANSSpeedTrue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 7 && value <= 70)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedTrue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedTrue_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedTrue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedTrue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedTrue_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedTrue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedTrue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedTrue_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedTrue_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedTrue_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedTrue_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 7, 70 } /* (7..70) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedTrue_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedTrue = { + "FANSSpeedTrue", + "FANSSpeedTrue", + FANSSpeedTrue_free, + FANSSpeedTrue_print, + FANSSpeedTrue_constraint, + FANSSpeedTrue_decode_ber, + FANSSpeedTrue_encode_der, + FANSSpeedTrue_decode_xer, + FANSSpeedTrue_encode_xer, + FANSSpeedTrue_decode_uper, + FANSSpeedTrue_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedTrue_tags_1, + sizeof(asn_DEF_FANSSpeedTrue_tags_1) + /sizeof(asn_DEF_FANSSpeedTrue_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedTrue_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedTrue_tags_1) + /sizeof(asn_DEF_FANSSpeedTrue_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedTrue_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrue.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrue.h new file mode 100644 index 000000000..5a7cab9d9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrue.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedTrue_H_ +#define _FANSSpeedTrue_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedTrue */ +typedef long FANSSpeedTrue_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedTrue; +asn_struct_free_f FANSSpeedTrue_free; +asn_struct_print_f FANSSpeedTrue_print; +asn_constr_check_f FANSSpeedTrue_constraint; +ber_type_decoder_f FANSSpeedTrue_decode_ber; +der_type_encoder_f FANSSpeedTrue_encode_der; +xer_type_decoder_f FANSSpeedTrue_decode_xer; +xer_type_encoder_f FANSSpeedTrue_encode_xer; +per_type_decoder_f FANSSpeedTrue_decode_uper; +per_type_encoder_f FANSSpeedTrue_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedTrue_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrueMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrueMetric.c new file mode 100644 index 000000000..1627887fe --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrueMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSpeedTrueMetric.h" + +int +FANSSpeedTrueMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 10 && value <= 137)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSSpeedTrueMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSpeedTrueMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedTrueMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSpeedTrueMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedTrueMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSpeedTrueMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSpeedTrueMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSpeedTrueMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSpeedTrueMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSSpeedTrueMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 10, 137 } /* (10..137) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSSpeedTrueMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSpeedTrueMetric = { + "FANSSpeedTrueMetric", + "FANSSpeedTrueMetric", + FANSSpeedTrueMetric_free, + FANSSpeedTrueMetric_print, + FANSSpeedTrueMetric_constraint, + FANSSpeedTrueMetric_decode_ber, + FANSSpeedTrueMetric_encode_der, + FANSSpeedTrueMetric_decode_xer, + FANSSpeedTrueMetric_encode_xer, + FANSSpeedTrueMetric_decode_uper, + FANSSpeedTrueMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSpeedTrueMetric_tags_1, + sizeof(asn_DEF_FANSSpeedTrueMetric_tags_1) + /sizeof(asn_DEF_FANSSpeedTrueMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSSpeedTrueMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSpeedTrueMetric_tags_1) + /sizeof(asn_DEF_FANSSpeedTrueMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSSpeedTrueMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrueMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrueMetric.h new file mode 100644 index 000000000..47ab76db5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSpeedTrueMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSpeedTrueMetric_H_ +#define _FANSSpeedTrueMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSpeedTrueMetric */ +typedef long FANSSpeedTrueMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSpeedTrueMetric; +asn_struct_free_f FANSSpeedTrueMetric_free; +asn_struct_print_f FANSSpeedTrueMetric_print; +asn_constr_check_f FANSSpeedTrueMetric_constraint; +ber_type_decoder_f FANSSpeedTrueMetric_decode_ber; +der_type_encoder_f FANSSpeedTrueMetric_encode_der; +xer_type_decoder_f FANSSpeedTrueMetric_decode_xer; +xer_type_encoder_f FANSSpeedTrueMetric_encode_xer; +per_type_decoder_f FANSSpeedTrueMetric_decode_uper; +per_type_encoder_f FANSSpeedTrueMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSpeedTrueMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSupplementaryInformation.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSSupplementaryInformation.c new file mode 100644 index 000000000..2e06cc9bd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSupplementaryInformation.c @@ -0,0 +1,157 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSSupplementaryInformation.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSSupplementaryInformation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const FANSFreeText_t *st = (const FANSFreeText_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 256) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using FANSFreeText, + * so here we adjust the DEF accordingly. + */ +static void +FANSSupplementaryInformation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSFreeText.free_struct; + td->print_struct = asn_DEF_FANSFreeText.print_struct; + td->check_constraints = asn_DEF_FANSFreeText.check_constraints; + td->ber_decoder = asn_DEF_FANSFreeText.ber_decoder; + td->der_encoder = asn_DEF_FANSFreeText.der_encoder; + td->xer_decoder = asn_DEF_FANSFreeText.xer_decoder; + td->xer_encoder = asn_DEF_FANSFreeText.xer_encoder; + td->uper_decoder = asn_DEF_FANSFreeText.uper_decoder; + td->uper_encoder = asn_DEF_FANSFreeText.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSFreeText.per_constraints; + td->elements = asn_DEF_FANSFreeText.elements; + td->elements_count = asn_DEF_FANSFreeText.elements_count; + td->specifics = asn_DEF_FANSFreeText.specifics; +} + +void +FANSSupplementaryInformation_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSSupplementaryInformation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSSupplementaryInformation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSSupplementaryInformation_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSSupplementaryInformation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSSupplementaryInformation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSSupplementaryInformation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSSupplementaryInformation_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSSupplementaryInformation_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSSupplementaryInformation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSSupplementaryInformation = { + "FANSSupplementaryInformation", + "FANSSupplementaryInformation", + FANSSupplementaryInformation_free, + FANSSupplementaryInformation_print, + FANSSupplementaryInformation_constraint, + FANSSupplementaryInformation_decode_ber, + FANSSupplementaryInformation_encode_der, + FANSSupplementaryInformation_decode_xer, + FANSSupplementaryInformation_encode_xer, + FANSSupplementaryInformation_decode_uper, + FANSSupplementaryInformation_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSSupplementaryInformation_tags_1, + sizeof(asn_DEF_FANSSupplementaryInformation_tags_1) + /sizeof(asn_DEF_FANSSupplementaryInformation_tags_1[0]), /* 1 */ + asn_DEF_FANSSupplementaryInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSSupplementaryInformation_tags_1) + /sizeof(asn_DEF_FANSSupplementaryInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSSupplementaryInformation.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSSupplementaryInformation.h new file mode 100644 index 000000000..2bec5d2cc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSSupplementaryInformation.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSSupplementaryInformation_H_ +#define _FANSSupplementaryInformation_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSFreeText.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSSupplementaryInformation */ +typedef FANSFreeText_t FANSSupplementaryInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSSupplementaryInformation; +asn_struct_free_f FANSSupplementaryInformation_free; +asn_struct_print_f FANSSupplementaryInformation_print; +asn_constr_check_f FANSSupplementaryInformation_constraint; +ber_type_decoder_f FANSSupplementaryInformation_decode_ber; +der_type_encoder_f FANSSupplementaryInformation_encode_der; +xer_type_decoder_f FANSSupplementaryInformation_decode_xer; +xer_type_encoder_f FANSSupplementaryInformation_encode_xer; +per_type_decoder_f FANSSupplementaryInformation_decode_uper; +per_type_encoder_f FANSSupplementaryInformation_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSSupplementaryInformation_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperature.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperature.c new file mode 100644 index 000000000..5ef88be92 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperature.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTemperature.h" + +static asn_per_constraints_t asn_PER_type_FANSTemperature_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSTemperature_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTemperature, choice.temperatureC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTemperatureC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "temperatureC" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTemperature, choice.temperatureF), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTemperatureF, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "temperatureF" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTemperature_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* temperatureC */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* temperatureF */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSTemperature_specs_1 = { + sizeof(struct FANSTemperature), + offsetof(struct FANSTemperature, _asn_ctx), + offsetof(struct FANSTemperature, present), + sizeof(((struct FANSTemperature *)0)->present), + asn_MAP_FANSTemperature_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTemperature = { + "FANSTemperature", + "FANSTemperature", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSTemperature_constr_1, + asn_MBR_FANSTemperature_1, + 2, /* Elements count */ + &asn_SPC_FANSTemperature_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperature.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperature.h new file mode 100644 index 000000000..a3393f0d1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperature.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTemperature_H_ +#define _FANSTemperature_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTemperatureC.h" +#include "FANSTemperatureF.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSTemperature_PR { + FANSTemperature_PR_NOTHING, /* No components present */ + FANSTemperature_PR_temperatureC, + FANSTemperature_PR_temperatureF +} FANSTemperature_PR; + +/* FANSTemperature */ +typedef struct FANSTemperature { + FANSTemperature_PR present; + union FANSTemperature_u { + FANSTemperatureC_t temperatureC; + FANSTemperatureF_t temperatureF; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTemperature_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTemperature; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTemperature_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureC.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureC.c new file mode 100644 index 000000000..0acc09d6f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureC.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTemperatureC.h" + +int +FANSTemperatureC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -80 && value <= 47)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSTemperatureC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSTemperatureC_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTemperatureC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTemperatureC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTemperatureC_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTemperatureC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTemperatureC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTemperatureC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTemperatureC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTemperatureC_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTemperatureC_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, -80, 47 } /* (-80..47) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSTemperatureC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTemperatureC = { + "FANSTemperatureC", + "FANSTemperatureC", + FANSTemperatureC_free, + FANSTemperatureC_print, + FANSTemperatureC_constraint, + FANSTemperatureC_decode_ber, + FANSTemperatureC_encode_der, + FANSTemperatureC_decode_xer, + FANSTemperatureC_encode_xer, + FANSTemperatureC_decode_uper, + FANSTemperatureC_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTemperatureC_tags_1, + sizeof(asn_DEF_FANSTemperatureC_tags_1) + /sizeof(asn_DEF_FANSTemperatureC_tags_1[0]), /* 1 */ + asn_DEF_FANSTemperatureC_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTemperatureC_tags_1) + /sizeof(asn_DEF_FANSTemperatureC_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTemperatureC_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureC.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureC.h new file mode 100644 index 000000000..e8f57e798 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureC.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTemperatureC_H_ +#define _FANSTemperatureC_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTemperatureC */ +typedef long FANSTemperatureC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTemperatureC; +asn_struct_free_f FANSTemperatureC_free; +asn_struct_print_f FANSTemperatureC_print; +asn_constr_check_f FANSTemperatureC_constraint; +ber_type_decoder_f FANSTemperatureC_decode_ber; +der_type_encoder_f FANSTemperatureC_encode_der; +xer_type_decoder_f FANSTemperatureC_decode_xer; +xer_type_encoder_f FANSTemperatureC_encode_xer; +per_type_decoder_f FANSTemperatureC_decode_uper; +per_type_encoder_f FANSTemperatureC_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTemperatureC_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureF.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureF.c new file mode 100644 index 000000000..0ef0b2a2d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureF.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTemperatureF.h" + +int +FANSTemperatureF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -105 && value <= 150)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSTemperatureF_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSTemperatureF_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTemperatureF_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTemperatureF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTemperatureF_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTemperatureF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTemperatureF_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTemperatureF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTemperatureF_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTemperatureF_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTemperatureF_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, -105, 150 } /* (-105..150) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSTemperatureF_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTemperatureF = { + "FANSTemperatureF", + "FANSTemperatureF", + FANSTemperatureF_free, + FANSTemperatureF_print, + FANSTemperatureF_constraint, + FANSTemperatureF_decode_ber, + FANSTemperatureF_encode_der, + FANSTemperatureF_decode_xer, + FANSTemperatureF_encode_xer, + FANSTemperatureF_decode_uper, + FANSTemperatureF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTemperatureF_tags_1, + sizeof(asn_DEF_FANSTemperatureF_tags_1) + /sizeof(asn_DEF_FANSTemperatureF_tags_1[0]), /* 1 */ + asn_DEF_FANSTemperatureF_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTemperatureF_tags_1) + /sizeof(asn_DEF_FANSTemperatureF_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTemperatureF_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureF.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureF.h new file mode 100644 index 000000000..2731bce09 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTemperatureF.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTemperatureF_H_ +#define _FANSTemperatureF_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTemperatureF */ +typedef long FANSTemperatureF_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTemperatureF; +asn_struct_free_f FANSTemperatureF_free; +asn_struct_print_f FANSTemperatureF_print; +asn_constr_check_f FANSTemperatureF_constraint; +ber_type_decoder_f FANSTemperatureF_decode_ber; +der_type_encoder_f FANSTemperatureF_encode_der; +xer_type_decoder_f FANSTemperatureF_decode_xer; +xer_type_encoder_f FANSTemperatureF_encode_xer; +per_type_decoder_f FANSTemperatureF_decode_uper; +per_type_encoder_f FANSTemperatureF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTemperatureF_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTime.c new file mode 100644 index 000000000..a719decae --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTime.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTime.h" + +static asn_TYPE_member_t asn_MBR_FANSTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTime, hours), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimehours, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "hours" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTime, minutes), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimeminutes, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "minutes" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTime_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* hours */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* minutes */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTime_specs_1 = { + sizeof(struct FANSTime), + offsetof(struct FANSTime, _asn_ctx), + asn_MAP_FANSTime_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTime = { + "FANSTime", + "FANSTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTime_tags_1, + sizeof(asn_DEF_FANSTime_tags_1) + /sizeof(asn_DEF_FANSTime_tags_1[0]), /* 1 */ + asn_DEF_FANSTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTime_tags_1) + /sizeof(asn_DEF_FANSTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTime_1, + 2, /* Elements count */ + &asn_SPC_FANSTime_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTime.h new file mode 100644 index 000000000..18f59f2bd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTime_H_ +#define _FANSTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTimehours.h" +#include "FANSTimeminutes.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTime */ +typedef struct FANSTime { + FANSTimehours_t hours; + FANSTimeminutes_t minutes; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTime; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAltitude.c new file mode 100644 index 000000000..bf42d902a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAltitude.c @@ -0,0 +1,77 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSTimeAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeAltitude, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeAltitude, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimeAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimeAltitude_specs_1 = { + sizeof(struct FANSTimeAltitude), + offsetof(struct FANSTimeAltitude, _asn_ctx), + asn_MAP_FANSTimeAltitude_tag2el_1, + 9, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeAltitude = { + "FANSTimeAltitude", + "FANSTimeAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeAltitude_tags_1, + sizeof(asn_DEF_FANSTimeAltitude_tags_1) + /sizeof(asn_DEF_FANSTimeAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeAltitude_tags_1) + /sizeof(asn_DEF_FANSTimeAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimeAltitude_1, + 2, /* Elements count */ + &asn_SPC_FANSTimeAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAltitude.h new file mode 100644 index 000000000..6fc1adcda --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAltitude.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeAltitude_H_ +#define _FANSTimeAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSAltitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeAltitude */ +typedef struct FANSTimeAltitude { + FANSTime_t time; + FANSAltitude_t altitude; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAtPositionCurrent.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAtPositionCurrent.c new file mode 100644 index 000000000..44569b6a8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAtPositionCurrent.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeAtPositionCurrent.h" + +int +FANSTimeAtPositionCurrent_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSTime.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSTime, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSTime.free_struct; + td->print_struct = asn_DEF_FANSTime.print_struct; + td->check_constraints = asn_DEF_FANSTime.check_constraints; + td->ber_decoder = asn_DEF_FANSTime.ber_decoder; + td->der_encoder = asn_DEF_FANSTime.der_encoder; + td->xer_decoder = asn_DEF_FANSTime.xer_decoder; + td->xer_encoder = asn_DEF_FANSTime.xer_encoder; + td->uper_decoder = asn_DEF_FANSTime.uper_decoder; + td->uper_encoder = asn_DEF_FANSTime.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSTime.per_constraints; + td->elements = asn_DEF_FANSTime.elements; + td->elements_count = asn_DEF_FANSTime.elements_count; + td->specifics = asn_DEF_FANSTime.specifics; +} + +void +FANSTimeAtPositionCurrent_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeAtPositionCurrent_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeAtPositionCurrent_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeAtPositionCurrent_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeAtPositionCurrent_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeAtPositionCurrent_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeAtPositionCurrent_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeAtPositionCurrent_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeAtPositionCurrent_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSTimeAtPositionCurrent_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeAtPositionCurrent = { + "FANSTimeAtPositionCurrent", + "FANSTimeAtPositionCurrent", + FANSTimeAtPositionCurrent_free, + FANSTimeAtPositionCurrent_print, + FANSTimeAtPositionCurrent_constraint, + FANSTimeAtPositionCurrent_decode_ber, + FANSTimeAtPositionCurrent_encode_der, + FANSTimeAtPositionCurrent_decode_xer, + FANSTimeAtPositionCurrent_encode_xer, + FANSTimeAtPositionCurrent_decode_uper, + FANSTimeAtPositionCurrent_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeAtPositionCurrent_tags_1, + sizeof(asn_DEF_FANSTimeAtPositionCurrent_tags_1) + /sizeof(asn_DEF_FANSTimeAtPositionCurrent_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeAtPositionCurrent_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeAtPositionCurrent_tags_1) + /sizeof(asn_DEF_FANSTimeAtPositionCurrent_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAtPositionCurrent.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAtPositionCurrent.h new file mode 100644 index 000000000..1e24339ca --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeAtPositionCurrent.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeAtPositionCurrent_H_ +#define _FANSTimeAtPositionCurrent_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeAtPositionCurrent */ +typedef FANSTime_t FANSTimeAtPositionCurrent_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeAtPositionCurrent; +asn_struct_free_f FANSTimeAtPositionCurrent_free; +asn_struct_print_f FANSTimeAtPositionCurrent_print; +asn_constr_check_f FANSTimeAtPositionCurrent_constraint; +ber_type_decoder_f FANSTimeAtPositionCurrent_decode_ber; +der_type_encoder_f FANSTimeAtPositionCurrent_encode_der; +xer_type_decoder_f FANSTimeAtPositionCurrent_decode_xer; +xer_type_encoder_f FANSTimeAtPositionCurrent_encode_xer; +per_type_decoder_f FANSTimeAtPositionCurrent_decode_uper; +per_type_encoder_f FANSTimeAtPositionCurrent_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeAtPositionCurrent_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDepartureEdct.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDepartureEdct.c new file mode 100644 index 000000000..bd92775ae --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDepartureEdct.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeDepartureEdct.h" + +int +FANSTimeDepartureEdct_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSTime.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSTime, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSTime.free_struct; + td->print_struct = asn_DEF_FANSTime.print_struct; + td->check_constraints = asn_DEF_FANSTime.check_constraints; + td->ber_decoder = asn_DEF_FANSTime.ber_decoder; + td->der_encoder = asn_DEF_FANSTime.der_encoder; + td->xer_decoder = asn_DEF_FANSTime.xer_decoder; + td->xer_encoder = asn_DEF_FANSTime.xer_encoder; + td->uper_decoder = asn_DEF_FANSTime.uper_decoder; + td->uper_encoder = asn_DEF_FANSTime.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSTime.per_constraints; + td->elements = asn_DEF_FANSTime.elements; + td->elements_count = asn_DEF_FANSTime.elements_count; + td->specifics = asn_DEF_FANSTime.specifics; +} + +void +FANSTimeDepartureEdct_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeDepartureEdct_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeDepartureEdct_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeDepartureEdct_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeDepartureEdct_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeDepartureEdct_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeDepartureEdct_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeDepartureEdct_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeDepartureEdct_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSTimeDepartureEdct_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeDepartureEdct = { + "FANSTimeDepartureEdct", + "FANSTimeDepartureEdct", + FANSTimeDepartureEdct_free, + FANSTimeDepartureEdct_print, + FANSTimeDepartureEdct_constraint, + FANSTimeDepartureEdct_decode_ber, + FANSTimeDepartureEdct_encode_der, + FANSTimeDepartureEdct_decode_xer, + FANSTimeDepartureEdct_encode_xer, + FANSTimeDepartureEdct_decode_uper, + FANSTimeDepartureEdct_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeDepartureEdct_tags_1, + sizeof(asn_DEF_FANSTimeDepartureEdct_tags_1) + /sizeof(asn_DEF_FANSTimeDepartureEdct_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeDepartureEdct_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeDepartureEdct_tags_1) + /sizeof(asn_DEF_FANSTimeDepartureEdct_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDepartureEdct.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDepartureEdct.h new file mode 100644 index 000000000..865948f8e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDepartureEdct.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeDepartureEdct_H_ +#define _FANSTimeDepartureEdct_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeDepartureEdct */ +typedef FANSTime_t FANSTimeDepartureEdct_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeDepartureEdct; +asn_struct_free_f FANSTimeDepartureEdct_free; +asn_struct_print_f FANSTimeDepartureEdct_print; +asn_constr_check_f FANSTimeDepartureEdct_constraint; +ber_type_decoder_f FANSTimeDepartureEdct_decode_ber; +der_type_encoder_f FANSTimeDepartureEdct_encode_der; +xer_type_decoder_f FANSTimeDepartureEdct_decode_xer; +xer_type_encoder_f FANSTimeDepartureEdct_encode_xer; +per_type_decoder_f FANSTimeDepartureEdct_decode_uper; +per_type_encoder_f FANSTimeDepartureEdct_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeDepartureEdct_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceOffsetDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceOffsetDirection.c new file mode 100644 index 000000000..bd2e35e56 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceOffsetDirection.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeDistanceOffsetDirection.h" + +static asn_TYPE_member_t asn_MBR_FANSTimeDistanceOffsetDirection_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceOffsetDirection, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceOffsetDirection, distanceOffset), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSDistanceOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distanceOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceOffsetDirection, direction), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "direction" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeDistanceOffsetDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimeDistanceOffsetDirection_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 }, /* direction */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* distanceOffsetNm */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* distanceOffsetKm */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimeDistanceOffsetDirection_specs_1 = { + sizeof(struct FANSTimeDistanceOffsetDirection), + offsetof(struct FANSTimeDistanceOffsetDirection, _asn_ctx), + asn_MAP_FANSTimeDistanceOffsetDirection_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeDistanceOffsetDirection = { + "FANSTimeDistanceOffsetDirection", + "FANSTimeDistanceOffsetDirection", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeDistanceOffsetDirection_tags_1, + sizeof(asn_DEF_FANSTimeDistanceOffsetDirection_tags_1) + /sizeof(asn_DEF_FANSTimeDistanceOffsetDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeDistanceOffsetDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeDistanceOffsetDirection_tags_1) + /sizeof(asn_DEF_FANSTimeDistanceOffsetDirection_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimeDistanceOffsetDirection_1, + 3, /* Elements count */ + &asn_SPC_FANSTimeDistanceOffsetDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceOffsetDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceOffsetDirection.h new file mode 100644 index 000000000..d5374c58a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceOffsetDirection.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeDistanceOffsetDirection_H_ +#define _FANSTimeDistanceOffsetDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSDistanceOffset.h" +#include "FANSDirection.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeDistanceOffsetDirection */ +typedef struct FANSTimeDistanceOffsetDirection { + FANSTime_t time; + FANSDistanceOffset_t distanceOffset; + FANSDirection_t direction; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeDistanceOffsetDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeDistanceOffsetDirection; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeDistanceOffsetDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceToFromPosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceToFromPosition.c new file mode 100644 index 000000000..0d5d0549d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceToFromPosition.c @@ -0,0 +1,90 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeDistanceToFromPosition.h" + +static asn_TYPE_member_t asn_MBR_FANSTimeDistanceToFromPosition_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceToFromPosition, time), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceToFromPosition, distance), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "distance" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceToFromPosition, toFrom), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSToFrom, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "toFrom" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeDistanceToFromPosition, position), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeDistanceToFromPosition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimeDistanceToFromPosition_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* distance */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toFrom */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* position */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimeDistanceToFromPosition_specs_1 = { + sizeof(struct FANSTimeDistanceToFromPosition), + offsetof(struct FANSTimeDistanceToFromPosition, _asn_ctx), + asn_MAP_FANSTimeDistanceToFromPosition_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeDistanceToFromPosition = { + "FANSTimeDistanceToFromPosition", + "FANSTimeDistanceToFromPosition", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeDistanceToFromPosition_tags_1, + sizeof(asn_DEF_FANSTimeDistanceToFromPosition_tags_1) + /sizeof(asn_DEF_FANSTimeDistanceToFromPosition_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeDistanceToFromPosition_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeDistanceToFromPosition_tags_1) + /sizeof(asn_DEF_FANSTimeDistanceToFromPosition_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimeDistanceToFromPosition_1, + 4, /* Elements count */ + &asn_SPC_FANSTimeDistanceToFromPosition_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceToFromPosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceToFromPosition.h new file mode 100644 index 000000000..06b86da70 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeDistanceToFromPosition.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeDistanceToFromPosition_H_ +#define _FANSTimeDistanceToFromPosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSDistance.h" +#include "FANSToFrom.h" +#include "FANSPosition.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeDistanceToFromPosition */ +typedef struct FANSTimeDistanceToFromPosition { + FANSTime_t time; + FANSDistance_t distance; + FANSToFrom_t toFrom; + FANSPosition_t position; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeDistanceToFromPosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeDistanceToFromPosition; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeDistanceToFromPosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaAtFixNext.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaAtFixNext.c new file mode 100644 index 000000000..2a7ed180c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaAtFixNext.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeEtaAtFixNext.h" + +int +FANSTimeEtaAtFixNext_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSTime.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSTime, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSTime.free_struct; + td->print_struct = asn_DEF_FANSTime.print_struct; + td->check_constraints = asn_DEF_FANSTime.check_constraints; + td->ber_decoder = asn_DEF_FANSTime.ber_decoder; + td->der_encoder = asn_DEF_FANSTime.der_encoder; + td->xer_decoder = asn_DEF_FANSTime.xer_decoder; + td->xer_encoder = asn_DEF_FANSTime.xer_encoder; + td->uper_decoder = asn_DEF_FANSTime.uper_decoder; + td->uper_encoder = asn_DEF_FANSTime.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSTime.per_constraints; + td->elements = asn_DEF_FANSTime.elements; + td->elements_count = asn_DEF_FANSTime.elements_count; + td->specifics = asn_DEF_FANSTime.specifics; +} + +void +FANSTimeEtaAtFixNext_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeEtaAtFixNext_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeEtaAtFixNext_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeEtaAtFixNext_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeEtaAtFixNext_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeEtaAtFixNext_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeEtaAtFixNext_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeEtaAtFixNext_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeEtaAtFixNext_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSTimeEtaAtFixNext_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeEtaAtFixNext = { + "FANSTimeEtaAtFixNext", + "FANSTimeEtaAtFixNext", + FANSTimeEtaAtFixNext_free, + FANSTimeEtaAtFixNext_print, + FANSTimeEtaAtFixNext_constraint, + FANSTimeEtaAtFixNext_decode_ber, + FANSTimeEtaAtFixNext_encode_der, + FANSTimeEtaAtFixNext_decode_xer, + FANSTimeEtaAtFixNext_encode_xer, + FANSTimeEtaAtFixNext_decode_uper, + FANSTimeEtaAtFixNext_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeEtaAtFixNext_tags_1, + sizeof(asn_DEF_FANSTimeEtaAtFixNext_tags_1) + /sizeof(asn_DEF_FANSTimeEtaAtFixNext_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeEtaAtFixNext_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeEtaAtFixNext_tags_1) + /sizeof(asn_DEF_FANSTimeEtaAtFixNext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaAtFixNext.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaAtFixNext.h new file mode 100644 index 000000000..8ed51963e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaAtFixNext.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeEtaAtFixNext_H_ +#define _FANSTimeEtaAtFixNext_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeEtaAtFixNext */ +typedef FANSTime_t FANSTimeEtaAtFixNext_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeEtaAtFixNext; +asn_struct_free_f FANSTimeEtaAtFixNext_free; +asn_struct_print_f FANSTimeEtaAtFixNext_print; +asn_constr_check_f FANSTimeEtaAtFixNext_constraint; +ber_type_decoder_f FANSTimeEtaAtFixNext_decode_ber; +der_type_encoder_f FANSTimeEtaAtFixNext_encode_der; +xer_type_decoder_f FANSTimeEtaAtFixNext_decode_xer; +xer_type_encoder_f FANSTimeEtaAtFixNext_encode_xer; +per_type_decoder_f FANSTimeEtaAtFixNext_decode_uper; +per_type_encoder_f FANSTimeEtaAtFixNext_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeEtaAtFixNext_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaDestination.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaDestination.c new file mode 100644 index 000000000..271296765 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaDestination.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeEtaDestination.h" + +int +FANSTimeEtaDestination_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSTime.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSTime, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeEtaDestination_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSTime.free_struct; + td->print_struct = asn_DEF_FANSTime.print_struct; + td->check_constraints = asn_DEF_FANSTime.check_constraints; + td->ber_decoder = asn_DEF_FANSTime.ber_decoder; + td->der_encoder = asn_DEF_FANSTime.der_encoder; + td->xer_decoder = asn_DEF_FANSTime.xer_decoder; + td->xer_encoder = asn_DEF_FANSTime.xer_encoder; + td->uper_decoder = asn_DEF_FANSTime.uper_decoder; + td->uper_encoder = asn_DEF_FANSTime.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSTime.per_constraints; + td->elements = asn_DEF_FANSTime.elements; + td->elements_count = asn_DEF_FANSTime.elements_count; + td->specifics = asn_DEF_FANSTime.specifics; +} + +void +FANSTimeEtaDestination_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeEtaDestination_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeEtaDestination_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeEtaDestination_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeEtaDestination_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeEtaDestination_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeEtaDestination_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeEtaDestination_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeEtaDestination_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static const ber_tlv_tag_t asn_DEF_FANSTimeEtaDestination_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeEtaDestination = { + "FANSTimeEtaDestination", + "FANSTimeEtaDestination", + FANSTimeEtaDestination_free, + FANSTimeEtaDestination_print, + FANSTimeEtaDestination_constraint, + FANSTimeEtaDestination_decode_ber, + FANSTimeEtaDestination_encode_der, + FANSTimeEtaDestination_decode_xer, + FANSTimeEtaDestination_encode_xer, + FANSTimeEtaDestination_decode_uper, + FANSTimeEtaDestination_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeEtaDestination_tags_1, + sizeof(asn_DEF_FANSTimeEtaDestination_tags_1) + /sizeof(asn_DEF_FANSTimeEtaDestination_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeEtaDestination_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeEtaDestination_tags_1) + /sizeof(asn_DEF_FANSTimeEtaDestination_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaDestination.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaDestination.h new file mode 100644 index 000000000..c3c30a57c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeEtaDestination.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeEtaDestination_H_ +#define _FANSTimeEtaDestination_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeEtaDestination */ +typedef FANSTime_t FANSTimeEtaDestination_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeEtaDestination; +asn_struct_free_f FANSTimeEtaDestination_free; +asn_struct_print_f FANSTimeEtaDestination_print; +asn_constr_check_f FANSTimeEtaDestination_constraint; +ber_type_decoder_f FANSTimeEtaDestination_decode_ber; +der_type_encoder_f FANSTimeEtaDestination_encode_der; +xer_type_decoder_f FANSTimeEtaDestination_decode_xer; +xer_type_encoder_f FANSTimeEtaDestination_encode_xer; +per_type_decoder_f FANSTimeEtaDestination_decode_uper; +per_type_encoder_f FANSTimeEtaDestination_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeEtaDestination_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeICAOunitnameFrequency.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeICAOunitnameFrequency.c new file mode 100644 index 000000000..e3933c152 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeICAOunitnameFrequency.c @@ -0,0 +1,83 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeICAOunitnameFrequency.h" + +static asn_TYPE_member_t asn_MBR_FANSTimeICAOunitnameFrequency_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeICAOunitnameFrequency, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeICAOunitnameFrequency, iCAOUnitName), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSICAOUnitName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iCAOUnitName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeICAOunitnameFrequency, frequency), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSFrequency, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequency" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeICAOunitnameFrequency_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimeICAOunitnameFrequency_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* time */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 }, /* iCAOUnitName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* frequencyhf */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 }, /* frequencyvhf */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* frequencyuhf */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 } /* frequencysatchannel */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimeICAOunitnameFrequency_specs_1 = { + sizeof(struct FANSTimeICAOunitnameFrequency), + offsetof(struct FANSTimeICAOunitnameFrequency, _asn_ctx), + asn_MAP_FANSTimeICAOunitnameFrequency_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeICAOunitnameFrequency = { + "FANSTimeICAOunitnameFrequency", + "FANSTimeICAOunitnameFrequency", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeICAOunitnameFrequency_tags_1, + sizeof(asn_DEF_FANSTimeICAOunitnameFrequency_tags_1) + /sizeof(asn_DEF_FANSTimeICAOunitnameFrequency_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeICAOunitnameFrequency_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeICAOunitnameFrequency_tags_1) + /sizeof(asn_DEF_FANSTimeICAOunitnameFrequency_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimeICAOunitnameFrequency_1, + 3, /* Elements count */ + &asn_SPC_FANSTimeICAOunitnameFrequency_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeICAOunitnameFrequency.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeICAOunitnameFrequency.h new file mode 100644 index 000000000..09fb4a98a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeICAOunitnameFrequency.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeICAOunitnameFrequency_H_ +#define _FANSTimeICAOunitnameFrequency_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSICAOUnitName.h" +#include "FANSFrequency.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeICAOunitnameFrequency */ +typedef struct FANSTimeICAOunitnameFrequency { + FANSTime_t time; + FANSICAOUnitName_t iCAOUnitName; + FANSFrequency_t frequency; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeICAOunitnameFrequency_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeICAOunitnameFrequency; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeICAOunitnameFrequency_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePosition.c new file mode 100644 index 000000000..55b7064d5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePosition.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimePosition.h" + +static asn_TYPE_member_t asn_MBR_FANSTimePosition_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePosition, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePosition, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimePosition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimePosition_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimePosition_specs_1 = { + sizeof(struct FANSTimePosition), + offsetof(struct FANSTimePosition, _asn_ctx), + asn_MAP_FANSTimePosition_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimePosition = { + "FANSTimePosition", + "FANSTimePosition", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimePosition_tags_1, + sizeof(asn_DEF_FANSTimePosition_tags_1) + /sizeof(asn_DEF_FANSTimePosition_tags_1[0]), /* 1 */ + asn_DEF_FANSTimePosition_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimePosition_tags_1) + /sizeof(asn_DEF_FANSTimePosition_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimePosition_1, + 2, /* Elements count */ + &asn_SPC_FANSTimePosition_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePosition.h new file mode 100644 index 000000000..bccf5167b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePosition.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimePosition_H_ +#define _FANSTimePosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSPosition.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimePosition */ +typedef struct FANSTimePosition { + FANSTime_t time; + FANSPosition_t position; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimePosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimePosition; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimePosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitude.c new file mode 100644 index 000000000..03c2ebf5e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitude.c @@ -0,0 +1,91 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimePositionAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSTimePositionAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitude, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitude, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitude, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimePositionAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimePositionAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 1 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, -1, 0 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 1 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, -1, 0 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 1 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, -1, 0 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 1 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, -1, 0 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 1 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 2, -1, 0 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 2, 0, 0 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 2, 0, 0 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 2, 0, 0 } /* altitudeFlightLevelMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimePositionAltitude_specs_1 = { + sizeof(struct FANSTimePositionAltitude), + offsetof(struct FANSTimePositionAltitude, _asn_ctx), + asn_MAP_FANSTimePositionAltitude_tag2el_1, + 14, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimePositionAltitude = { + "FANSTimePositionAltitude", + "FANSTimePositionAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimePositionAltitude_tags_1, + sizeof(asn_DEF_FANSTimePositionAltitude_tags_1) + /sizeof(asn_DEF_FANSTimePositionAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSTimePositionAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimePositionAltitude_tags_1) + /sizeof(asn_DEF_FANSTimePositionAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimePositionAltitude_1, + 3, /* Elements count */ + &asn_SPC_FANSTimePositionAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitude.h new file mode 100644 index 000000000..25a9c3bee --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitude.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimePositionAltitude_H_ +#define _FANSTimePositionAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSPosition.h" +#include "FANSAltitude.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimePositionAltitude */ +typedef struct FANSTimePositionAltitude { + FANSTime_t time; + FANSPosition_t position; + FANSAltitude_t altitude; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimePositionAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimePositionAltitude; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimePositionAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitudeSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitudeSpeed.c new file mode 100644 index 000000000..e2bf995c6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitudeSpeed.c @@ -0,0 +1,108 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimePositionAltitudeSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSTimePositionAltitudeSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitudeSpeed, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitudeSpeed, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitudeSpeed, altitude), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimePositionAltitudeSpeed, speed), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimePositionAltitudeSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimePositionAltitudeSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 2 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, -1, 1 }, /* altitudeQNH */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, -2, 0 }, /* speedIndicated */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 2 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, -1, 1 }, /* altitudeQNHMeters */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, -2, 0 }, /* speedIndicatedMetric */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 2 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, -1, 1 }, /* altitudeQFE */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, -2, 0 }, /* speedTrue */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 2 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, -1, 1 }, /* altitudeQFEMeters */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, -2, 0 }, /* speedTrueMetric */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 2 }, /* placeBearingDistance */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 2, -1, 1 }, /* altitudeGNSSFeet */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 3, -2, 0 }, /* speedGround */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 2, 0, 1 }, /* altitudeGNSSMeters */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 3, -1, 0 }, /* speedGroundMetric */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 2, 0, 1 }, /* altitudeFlightLevel */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 3, -1, 0 }, /* speedMach */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 2, 0, 1 }, /* altitudeFlightLevelMetric */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 3, -1, 0 } /* speedMachLarge */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimePositionAltitudeSpeed_specs_1 = { + sizeof(struct FANSTimePositionAltitudeSpeed), + offsetof(struct FANSTimePositionAltitudeSpeed, _asn_ctx), + asn_MAP_FANSTimePositionAltitudeSpeed_tag2el_1, + 22, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimePositionAltitudeSpeed = { + "FANSTimePositionAltitudeSpeed", + "FANSTimePositionAltitudeSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimePositionAltitudeSpeed_tags_1, + sizeof(asn_DEF_FANSTimePositionAltitudeSpeed_tags_1) + /sizeof(asn_DEF_FANSTimePositionAltitudeSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSTimePositionAltitudeSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimePositionAltitudeSpeed_tags_1) + /sizeof(asn_DEF_FANSTimePositionAltitudeSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimePositionAltitudeSpeed_1, + 4, /* Elements count */ + &asn_SPC_FANSTimePositionAltitudeSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitudeSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitudeSpeed.h new file mode 100644 index 000000000..59dc4429e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimePositionAltitudeSpeed.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimePositionAltitudeSpeed_H_ +#define _FANSTimePositionAltitudeSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSPosition.h" +#include "FANSAltitude.h" +#include "FANSSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimePositionAltitudeSpeed */ +typedef struct FANSTimePositionAltitudeSpeed { + FANSTime_t time; + FANSPosition_t position; + FANSAltitude_t altitude; + FANSSpeed_t speed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimePositionAltitudeSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimePositionAltitudeSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimePositionAltitudeSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSeconds.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSeconds.c new file mode 100644 index 000000000..b2f5d003a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSeconds.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeSeconds.h" + +int +FANSTimeSeconds_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 59)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeSeconds_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSTimeSeconds_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeSeconds_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeSeconds_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeSeconds_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeSeconds_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeSeconds_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeSeconds_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeSeconds_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeSeconds_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTimeSeconds_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 59 } /* (0..59) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeSeconds_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeSeconds = { + "FANSTimeSeconds", + "FANSTimeSeconds", + FANSTimeSeconds_free, + FANSTimeSeconds_print, + FANSTimeSeconds_constraint, + FANSTimeSeconds_decode_ber, + FANSTimeSeconds_encode_der, + FANSTimeSeconds_decode_xer, + FANSTimeSeconds_encode_xer, + FANSTimeSeconds_decode_uper, + FANSTimeSeconds_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeSeconds_tags_1, + sizeof(asn_DEF_FANSTimeSeconds_tags_1) + /sizeof(asn_DEF_FANSTimeSeconds_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeSeconds_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeSeconds_tags_1) + /sizeof(asn_DEF_FANSTimeSeconds_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTimeSeconds_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSeconds.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSeconds.h new file mode 100644 index 000000000..4490d8fd4 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSeconds.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeSeconds_H_ +#define _FANSTimeSeconds_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeSeconds */ +typedef long FANSTimeSeconds_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeSeconds; +asn_struct_free_f FANSTimeSeconds_free; +asn_struct_print_f FANSTimeSeconds_print; +asn_constr_check_f FANSTimeSeconds_constraint; +ber_type_decoder_f FANSTimeSeconds_decode_ber; +der_type_encoder_f FANSTimeSeconds_encode_der; +xer_type_decoder_f FANSTimeSeconds_decode_xer; +xer_type_encoder_f FANSTimeSeconds_encode_xer; +per_type_decoder_f FANSTimeSeconds_decode_uper; +per_type_encoder_f FANSTimeSeconds_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeSeconds_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeed.c new file mode 100644 index 000000000..a2bbf51ff --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeed.c @@ -0,0 +1,77 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSTimeSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeSpeed, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeSpeed, speed), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimeSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* time */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* speedIndicated */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* speedIndicatedMetric */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* speedTrue */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* speedTrueMetric */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 }, /* speedGround */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* speedGroundMetric */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* speedMach */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 } /* speedMachLarge */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimeSpeed_specs_1 = { + sizeof(struct FANSTimeSpeed), + offsetof(struct FANSTimeSpeed, _asn_ctx), + asn_MAP_FANSTimeSpeed_tag2el_1, + 9, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeSpeed = { + "FANSTimeSpeed", + "FANSTimeSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeSpeed_tags_1, + sizeof(asn_DEF_FANSTimeSpeed_tags_1) + /sizeof(asn_DEF_FANSTimeSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeSpeed_tags_1) + /sizeof(asn_DEF_FANSTimeSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimeSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSTimeSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeed.h new file mode 100644 index 000000000..da5cb487f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeed.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeSpeed_H_ +#define _FANSTimeSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeSpeed */ +typedef struct FANSTimeSpeed { + FANSTime_t time; + FANSSpeed_t speed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeedSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeedSpeed.c new file mode 100644 index 000000000..dbb31379d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeedSpeed.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeSpeedSpeed.h" + +static asn_TYPE_member_t asn_MBR_FANSTimeSpeedSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeSpeedSpeed, time), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "time" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimeSpeedSpeed, speed_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSSpeedSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed-seqOf" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeSpeedSpeed_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimeSpeedSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* time */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* speed-seqOf */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimeSpeedSpeed_specs_1 = { + sizeof(struct FANSTimeSpeedSpeed), + offsetof(struct FANSTimeSpeedSpeed, _asn_ctx), + asn_MAP_FANSTimeSpeedSpeed_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeSpeedSpeed = { + "FANSTimeSpeedSpeed", + "FANSTimeSpeedSpeed", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeSpeedSpeed_tags_1, + sizeof(asn_DEF_FANSTimeSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSTimeSpeedSpeed_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeSpeedSpeed_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeSpeedSpeed_tags_1) + /sizeof(asn_DEF_FANSTimeSpeedSpeed_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimeSpeedSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSTimeSpeedSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeedSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeedSpeed.h new file mode 100644 index 000000000..c7c698618 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeSpeedSpeed.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeSpeedSpeed_H_ +#define _FANSTimeSpeedSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTime.h" +#include "FANSSpeedSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeSpeedSpeed */ +typedef struct FANSTimeSpeedSpeed { + FANSTime_t time; + FANSSpeedSpeed_t speed_seqOf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeSpeedSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeSpeedSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeSpeedSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTime.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTime.c new file mode 100644 index 000000000..6caf816b1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTime.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeTime.h" + +static asn_per_constraints_t asn_PER_type_FANSTimeTime_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 2, 2 } /* (SIZE(2..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSTimeTime_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSTimeTime_specs_1 = { + sizeof(struct FANSTimeTime), + offsetof(struct FANSTimeTime, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeTime = { + "FANSTimeTime", + "FANSTimeTime", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeTime_tags_1, + sizeof(asn_DEF_FANSTimeTime_tags_1) + /sizeof(asn_DEF_FANSTimeTime_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeTime_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeTime_tags_1) + /sizeof(asn_DEF_FANSTimeTime_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTimeTime_constr_1, + asn_MBR_FANSTimeTime_1, + 1, /* Single element */ + &asn_SPC_FANSTimeTime_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTime.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTime.h new file mode 100644 index 000000000..991c1f45f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTime.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeTime_H_ +#define _FANSTimeTime_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSTime; + +/* FANSTimeTime */ +typedef struct FANSTimeTime { + A_SEQUENCE_OF(struct FANSTime) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimeTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeTime; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSTime.h" + +#endif /* _FANSTimeTime_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTolerance.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTolerance.c new file mode 100644 index 000000000..7e5e862a3 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTolerance.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeTolerance.h" + +int +FANSTimeTolerance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeTolerance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSTimeTolerance_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeTolerance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeTolerance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeTolerance_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeTolerance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeTolerance_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeTolerance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeTolerance_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeTolerance_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTimeTolerance_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSTimeTolerance_value2enum_1[] = { + { 0, 2, "at" }, + { 1, 9, "atorafter" }, + { 2, 10, "atorbefore" } +}; +static const unsigned int asn_MAP_FANSTimeTolerance_enum2value_1[] = { + 0, /* at(0) */ + 1, /* atorafter(1) */ + 2 /* atorbefore(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSTimeTolerance_specs_1 = { + asn_MAP_FANSTimeTolerance_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSTimeTolerance_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeTolerance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeTolerance = { + "FANSTimeTolerance", + "FANSTimeTolerance", + FANSTimeTolerance_free, + FANSTimeTolerance_print, + FANSTimeTolerance_constraint, + FANSTimeTolerance_decode_ber, + FANSTimeTolerance_encode_der, + FANSTimeTolerance_decode_xer, + FANSTimeTolerance_encode_xer, + FANSTimeTolerance_decode_uper, + FANSTimeTolerance_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeTolerance_tags_1, + sizeof(asn_DEF_FANSTimeTolerance_tags_1) + /sizeof(asn_DEF_FANSTimeTolerance_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeTolerance_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeTolerance_tags_1) + /sizeof(asn_DEF_FANSTimeTolerance_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTimeTolerance_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSTimeTolerance_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTolerance.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTolerance.h new file mode 100644 index 000000000..80540856a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeTolerance.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeTolerance_H_ +#define _FANSTimeTolerance_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSTimeTolerance { + FANSTimeTolerance_at = 0, + FANSTimeTolerance_atorafter = 1, + FANSTimeTolerance_atorbefore = 2 +} e_FANSTimeTolerance; + +/* FANSTimeTolerance */ +typedef long FANSTimeTolerance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeTolerance; +asn_struct_free_f FANSTimeTolerance_free; +asn_struct_print_f FANSTimeTolerance_print; +asn_constr_check_f FANSTimeTolerance_constraint; +ber_type_decoder_f FANSTimeTolerance_decode_ber; +der_type_encoder_f FANSTimeTolerance_encode_der; +xer_type_decoder_f FANSTimeTolerance_decode_xer; +xer_type_encoder_f FANSTimeTolerance_encode_xer; +per_type_decoder_f FANSTimeTolerance_decode_uper; +per_type_encoder_f FANSTimeTolerance_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeTolerance_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimehours.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimehours.c new file mode 100644 index 000000000..e8c51f4aa --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimehours.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimehours.h" + +int +FANSTimehours_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 23)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimehours_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSTimehours_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimehours_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimehours_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimehours_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimehours_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimehours_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimehours_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimehours_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimehours_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTimehours_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 5, 5, 0, 23 } /* (0..23) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSTimehours_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimehours = { + "FANSTimehours", + "FANSTimehours", + FANSTimehours_free, + FANSTimehours_print, + FANSTimehours_constraint, + FANSTimehours_decode_ber, + FANSTimehours_encode_der, + FANSTimehours_decode_xer, + FANSTimehours_encode_xer, + FANSTimehours_decode_uper, + FANSTimehours_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimehours_tags_1, + sizeof(asn_DEF_FANSTimehours_tags_1) + /sizeof(asn_DEF_FANSTimehours_tags_1[0]), /* 1 */ + asn_DEF_FANSTimehours_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimehours_tags_1) + /sizeof(asn_DEF_FANSTimehours_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTimehours_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimehours.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimehours.h new file mode 100644 index 000000000..572289644 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimehours.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimehours_H_ +#define _FANSTimehours_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimehours */ +typedef long FANSTimehours_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimehours; +asn_struct_free_f FANSTimehours_free; +asn_struct_print_f FANSTimehours_print; +asn_constr_check_f FANSTimehours_constraint; +ber_type_decoder_f FANSTimehours_decode_ber; +der_type_encoder_f FANSTimehours_encode_der; +xer_type_decoder_f FANSTimehours_decode_xer; +xer_type_encoder_f FANSTimehours_encode_xer; +per_type_decoder_f FANSTimehours_decode_uper; +per_type_encoder_f FANSTimehours_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimehours_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeminutes.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeminutes.c new file mode 100644 index 000000000..72d8d00ac --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeminutes.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimeminutes.h" + +int +FANSTimeminutes_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 59)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSTimeminutes_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSTimeminutes_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTimeminutes_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTimeminutes_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTimeminutes_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTimeminutes_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTimeminutes_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTimeminutes_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTimeminutes_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTimeminutes_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTimeminutes_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 59 } /* (0..59) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSTimeminutes_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimeminutes = { + "FANSTimeminutes", + "FANSTimeminutes", + FANSTimeminutes_free, + FANSTimeminutes_print, + FANSTimeminutes_constraint, + FANSTimeminutes_decode_ber, + FANSTimeminutes_encode_der, + FANSTimeminutes_decode_xer, + FANSTimeminutes_encode_xer, + FANSTimeminutes_decode_uper, + FANSTimeminutes_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimeminutes_tags_1, + sizeof(asn_DEF_FANSTimeminutes_tags_1) + /sizeof(asn_DEF_FANSTimeminutes_tags_1[0]), /* 1 */ + asn_DEF_FANSTimeminutes_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimeminutes_tags_1) + /sizeof(asn_DEF_FANSTimeminutes_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTimeminutes_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeminutes.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeminutes.h new file mode 100644 index 000000000..65dc13cd9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimeminutes.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimeminutes_H_ +#define _FANSTimeminutes_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimeminutes */ +typedef long FANSTimeminutes_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimeminutes; +asn_struct_free_f FANSTimeminutes_free; +asn_struct_print_f FANSTimeminutes_print; +asn_constr_check_f FANSTimeminutes_constraint; +ber_type_decoder_f FANSTimeminutes_decode_ber; +der_type_encoder_f FANSTimeminutes_encode_der; +xer_type_decoder_f FANSTimeminutes_decode_xer; +xer_type_encoder_f FANSTimeminutes_encode_xer; +per_type_decoder_f FANSTimeminutes_decode_uper; +per_type_encoder_f FANSTimeminutes_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimeminutes_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimestamp.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimestamp.c new file mode 100644 index 000000000..b92a29f80 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimestamp.c @@ -0,0 +1,80 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTimestamp.h" + +static asn_TYPE_member_t asn_MBR_FANSTimestamp_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTimestamp, hours), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimehours, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "hours" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimestamp, minutes), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimeminutes, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "minutes" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTimestamp, seconds), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSTimeSeconds, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "seconds" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTimestamp_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTimestamp_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* hours */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* minutes */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* seconds */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTimestamp_specs_1 = { + sizeof(struct FANSTimestamp), + offsetof(struct FANSTimestamp, _asn_ctx), + asn_MAP_FANSTimestamp_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTimestamp = { + "FANSTimestamp", + "FANSTimestamp", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTimestamp_tags_1, + sizeof(asn_DEF_FANSTimestamp_tags_1) + /sizeof(asn_DEF_FANSTimestamp_tags_1[0]), /* 1 */ + asn_DEF_FANSTimestamp_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTimestamp_tags_1) + /sizeof(asn_DEF_FANSTimestamp_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTimestamp_1, + 3, /* Elements count */ + &asn_SPC_FANSTimestamp_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTimestamp.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimestamp.h new file mode 100644 index 000000000..02defdf8b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTimestamp.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTimestamp_H_ +#define _FANSTimestamp_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTimehours.h" +#include "FANSTimeminutes.h" +#include "FANSTimeSeconds.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTimestamp */ +typedef struct FANSTimestamp { + FANSTimehours_t hours; + FANSTimeminutes_t minutes; + FANSTimeSeconds_t seconds; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTimestamp_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTimestamp; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTimestamp_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSToFrom.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFrom.c new file mode 100644 index 000000000..cde568ef7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFrom.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSToFrom.h" + +int +FANSToFrom_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSToFrom_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSToFrom_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSToFrom_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSToFrom_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSToFrom_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSToFrom_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSToFrom_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSToFrom_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSToFrom_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSToFrom_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSToFrom_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSToFrom_value2enum_1[] = { + { 0, 2, "to" }, + { 1, 4, "from" } +}; +static const unsigned int asn_MAP_FANSToFrom_enum2value_1[] = { + 1, /* from(1) */ + 0 /* to(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSToFrom_specs_1 = { + asn_MAP_FANSToFrom_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSToFrom_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSToFrom_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSToFrom = { + "FANSToFrom", + "FANSToFrom", + FANSToFrom_free, + FANSToFrom_print, + FANSToFrom_constraint, + FANSToFrom_decode_ber, + FANSToFrom_encode_der, + FANSToFrom_decode_xer, + FANSToFrom_encode_xer, + FANSToFrom_decode_uper, + FANSToFrom_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSToFrom_tags_1, + sizeof(asn_DEF_FANSToFrom_tags_1) + /sizeof(asn_DEF_FANSToFrom_tags_1[0]), /* 1 */ + asn_DEF_FANSToFrom_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSToFrom_tags_1) + /sizeof(asn_DEF_FANSToFrom_tags_1[0]), /* 1 */ + &asn_PER_type_FANSToFrom_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSToFrom_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSToFrom.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFrom.h new file mode 100644 index 000000000..bdee10fbf --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFrom.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSToFrom_H_ +#define _FANSToFrom_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSToFrom { + FANSToFrom_to = 0, + FANSToFrom_from = 1 +} e_FANSToFrom; + +/* FANSToFrom */ +typedef long FANSToFrom_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSToFrom; +asn_struct_free_f FANSToFrom_free; +asn_struct_print_f FANSToFrom_print; +asn_constr_check_f FANSToFrom_constraint; +ber_type_decoder_f FANSToFrom_decode_ber; +der_type_encoder_f FANSToFrom_encode_der; +xer_type_decoder_f FANSToFrom_decode_xer; +xer_type_encoder_f FANSToFrom_encode_xer; +per_type_decoder_f FANSToFrom_decode_uper; +per_type_encoder_f FANSToFrom_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSToFrom_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSToFromPosition.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFromPosition.c new file mode 100644 index 000000000..c00b2109b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFromPosition.c @@ -0,0 +1,74 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSToFromPosition.h" + +static asn_TYPE_member_t asn_MBR_FANSToFromPosition_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSToFromPosition, toFrom), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSToFrom, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "toFrom" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSToFromPosition, position), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSToFromPosition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSToFromPosition_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* toFrom */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* fixName */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* navaid */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* airport */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* latitudeLongitude */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 } /* placeBearingDistance */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSToFromPosition_specs_1 = { + sizeof(struct FANSToFromPosition), + offsetof(struct FANSToFromPosition, _asn_ctx), + asn_MAP_FANSToFromPosition_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSToFromPosition = { + "FANSToFromPosition", + "FANSToFromPosition", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSToFromPosition_tags_1, + sizeof(asn_DEF_FANSToFromPosition_tags_1) + /sizeof(asn_DEF_FANSToFromPosition_tags_1[0]), /* 1 */ + asn_DEF_FANSToFromPosition_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSToFromPosition_tags_1) + /sizeof(asn_DEF_FANSToFromPosition_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSToFromPosition_1, + 2, /* Elements count */ + &asn_SPC_FANSToFromPosition_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSToFromPosition.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFromPosition.h new file mode 100644 index 000000000..f2cefadf1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSToFromPosition.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSToFromPosition_H_ +#define _FANSToFromPosition_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSToFrom.h" +#include "FANSPosition.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSToFromPosition */ +typedef struct FANSToFromPosition { + FANSToFrom_t toFrom; + FANSPosition_t position; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSToFromPosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSToFromPosition; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSToFromPosition_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTp4table.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTp4table.c new file mode 100644 index 000000000..5c492357d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTp4table.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTp4table.h" + +int +FANSTp4table_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSTp4table_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSTp4table_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTp4table_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTp4table_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTp4table_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTp4table_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTp4table_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTp4table_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTp4table_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTp4table_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTp4table_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSTp4table_value2enum_1[] = { + { 0, 6, "labelA" }, + { 1, 6, "labelB" } +}; +static const unsigned int asn_MAP_FANSTp4table_enum2value_1[] = { + 0, /* labelA(0) */ + 1 /* labelB(1) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSTp4table_specs_1 = { + asn_MAP_FANSTp4table_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSTp4table_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSTp4table_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTp4table = { + "FANSTp4table", + "FANSTp4table", + FANSTp4table_free, + FANSTp4table_print, + FANSTp4table_constraint, + FANSTp4table_decode_ber, + FANSTp4table_encode_der, + FANSTp4table_decode_xer, + FANSTp4table_encode_xer, + FANSTp4table_decode_uper, + FANSTp4table_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTp4table_tags_1, + sizeof(asn_DEF_FANSTp4table_tags_1) + /sizeof(asn_DEF_FANSTp4table_tags_1[0]), /* 1 */ + asn_DEF_FANSTp4table_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTp4table_tags_1) + /sizeof(asn_DEF_FANSTp4table_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTp4table_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSTp4table_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTp4table.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTp4table.h new file mode 100644 index 000000000..d180d3bdd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTp4table.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTp4table_H_ +#define _FANSTp4table_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSTp4table { + FANSTp4table_labelA = 0, + FANSTp4table_labelB = 1 +} e_FANSTp4table; + +/* FANSTp4table */ +typedef long FANSTp4table_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTp4table; +asn_struct_free_f FANSTp4table_free; +asn_struct_print_f FANSTp4table_print; +asn_constr_check_f FANSTp4table_constraint; +ber_type_decoder_f FANSTp4table_decode_ber; +der_type_encoder_f FANSTp4table_encode_der; +xer_type_decoder_f FANSTp4table_decode_xer; +xer_type_encoder_f FANSTp4table_encode_xer; +per_type_decoder_f FANSTp4table_decode_uper; +per_type_encoder_f FANSTp4table_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTp4table_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackAngle.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackAngle.c new file mode 100644 index 000000000..7e67db1dc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackAngle.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTrackAngle.h" + +int +FANSTrackAngle_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSDegrees.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSDegrees, + * so here we adjust the DEF accordingly. + */ +static void +FANSTrackAngle_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSDegrees.free_struct; + td->print_struct = asn_DEF_FANSDegrees.print_struct; + td->check_constraints = asn_DEF_FANSDegrees.check_constraints; + td->ber_decoder = asn_DEF_FANSDegrees.ber_decoder; + td->der_encoder = asn_DEF_FANSDegrees.der_encoder; + td->xer_decoder = asn_DEF_FANSDegrees.xer_decoder; + td->xer_encoder = asn_DEF_FANSDegrees.xer_encoder; + td->uper_decoder = asn_DEF_FANSDegrees.uper_decoder; + td->uper_encoder = asn_DEF_FANSDegrees.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSDegrees.per_constraints; + td->elements = asn_DEF_FANSDegrees.elements; + td->elements_count = asn_DEF_FANSDegrees.elements_count; + td->specifics = asn_DEF_FANSDegrees.specifics; +} + +void +FANSTrackAngle_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTrackAngle_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTrackAngle_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTrackAngle_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTrackAngle_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTrackAngle_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTrackAngle_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTrackAngle_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTrackAngle_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTrackAngle_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTrackAngle = { + "FANSTrackAngle", + "FANSTrackAngle", + FANSTrackAngle_free, + FANSTrackAngle_print, + FANSTrackAngle_constraint, + FANSTrackAngle_decode_ber, + FANSTrackAngle_encode_der, + FANSTrackAngle_decode_xer, + FANSTrackAngle_encode_xer, + FANSTrackAngle_decode_uper, + FANSTrackAngle_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackAngle.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackAngle.h new file mode 100644 index 000000000..cced6be3f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackAngle.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTrackAngle_H_ +#define _FANSTrackAngle_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDegrees.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTrackAngle */ +typedef FANSDegrees_t FANSTrackAngle_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTrackAngle; +asn_struct_free_f FANSTrackAngle_free; +asn_struct_print_f FANSTrackAngle_print; +asn_constr_check_f FANSTrackAngle_constraint; +ber_type_decoder_f FANSTrackAngle_decode_ber; +der_type_encoder_f FANSTrackAngle_encode_der; +xer_type_decoder_f FANSTrackAngle_decode_xer; +xer_type_encoder_f FANSTrackAngle_encode_xer; +per_type_decoder_f FANSTrackAngle_decode_uper; +per_type_encoder_f FANSTrackAngle_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTrackAngle_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackDetail.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackDetail.c new file mode 100644 index 000000000..fbdd3f176 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackDetail.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTrackDetail.h" + +static asn_TYPE_member_t asn_MBR_FANSTrackDetail_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSTrackDetail, trackName), + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + 0, + &asn_DEF_FANSTrackName, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "trackName" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSTrackDetail, latitudeLongitude_seqOf), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSLatitudeLongitudeSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeLongitude-seqOf" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSTrackDetail_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSTrackDetail_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* latitudeLongitude-seqOf */ + { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 } /* trackName */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSTrackDetail_specs_1 = { + sizeof(struct FANSTrackDetail), + offsetof(struct FANSTrackDetail, _asn_ctx), + asn_MAP_FANSTrackDetail_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTrackDetail = { + "FANSTrackDetail", + "FANSTrackDetail", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTrackDetail_tags_1, + sizeof(asn_DEF_FANSTrackDetail_tags_1) + /sizeof(asn_DEF_FANSTrackDetail_tags_1[0]), /* 1 */ + asn_DEF_FANSTrackDetail_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTrackDetail_tags_1) + /sizeof(asn_DEF_FANSTrackDetail_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSTrackDetail_1, + 2, /* Elements count */ + &asn_SPC_FANSTrackDetail_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackDetail.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackDetail.h new file mode 100644 index 000000000..6d1209f55 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackDetail.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTrackDetail_H_ +#define _FANSTrackDetail_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSTrackName.h" +#include "FANSLatitudeLongitudeSequence.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTrackDetail */ +typedef struct FANSTrackDetail { + FANSTrackName_t trackName; + FANSLatitudeLongitudeSequence_t latitudeLongitude_seqOf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSTrackDetail_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTrackDetail; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTrackDetail_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackName.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackName.c new file mode 100644 index 000000000..d877a8ff8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackName.c @@ -0,0 +1,162 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTrackName.h" + +static int check_permitted_alphabet_1(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +int +FANSTrackName_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 3 && size <= 6) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +FANSTrackName_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +FANSTrackName_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTrackName_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTrackName_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTrackName_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTrackName_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTrackName_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTrackName_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTrackName_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTrackName_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTrackName_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 2, 2, 3, 6 } /* (SIZE(3..6)) */, + 0, 0 /* No PER character map necessary */ +}; +static const ber_tlv_tag_t asn_DEF_FANSTrackName_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTrackName = { + "FANSTrackName", + "FANSTrackName", + FANSTrackName_free, + FANSTrackName_print, + FANSTrackName_constraint, + FANSTrackName_decode_ber, + FANSTrackName_encode_der, + FANSTrackName_decode_xer, + FANSTrackName_encode_xer, + FANSTrackName_decode_uper, + FANSTrackName_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTrackName_tags_1, + sizeof(asn_DEF_FANSTrackName_tags_1) + /sizeof(asn_DEF_FANSTrackName_tags_1[0]), /* 1 */ + asn_DEF_FANSTrackName_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTrackName_tags_1) + /sizeof(asn_DEF_FANSTrackName_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTrackName_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackName.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackName.h new file mode 100644 index 000000000..d7e771af1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrackName.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTrackName_H_ +#define _FANSTrackName_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "IA5String.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTrackName */ +typedef IA5String_t FANSTrackName_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTrackName; +asn_struct_free_f FANSTrackName_free; +asn_struct_print_f FANSTrackName_print; +asn_constr_check_f FANSTrackName_constraint; +ber_type_decoder_f FANSTrackName_decode_ber; +der_type_encoder_f FANSTrackName_encode_der; +xer_type_decoder_f FANSTrackName_decode_xer; +xer_type_encoder_f FANSTrackName_encode_xer; +per_type_decoder_f FANSTrackName_decode_uper; +per_type_encoder_f FANSTrackName_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTrackName_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrueheading.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrueheading.c new file mode 100644 index 000000000..7c0309a05 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrueheading.c @@ -0,0 +1,125 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTrueheading.h" + +int +FANSTrueheading_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_FANSDegrees.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using FANSDegrees, + * so here we adjust the DEF accordingly. + */ +static void +FANSTrueheading_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_FANSDegrees.free_struct; + td->print_struct = asn_DEF_FANSDegrees.print_struct; + td->check_constraints = asn_DEF_FANSDegrees.check_constraints; + td->ber_decoder = asn_DEF_FANSDegrees.ber_decoder; + td->der_encoder = asn_DEF_FANSDegrees.der_encoder; + td->xer_decoder = asn_DEF_FANSDegrees.xer_decoder; + td->xer_encoder = asn_DEF_FANSDegrees.xer_encoder; + td->uper_decoder = asn_DEF_FANSDegrees.uper_decoder; + td->uper_encoder = asn_DEF_FANSDegrees.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_FANSDegrees.per_constraints; + td->elements = asn_DEF_FANSDegrees.elements; + td->elements_count = asn_DEF_FANSDegrees.elements_count; + td->specifics = asn_DEF_FANSDegrees.specifics; +} + +void +FANSTrueheading_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTrueheading_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTrueheading_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTrueheading_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTrueheading_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTrueheading_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTrueheading_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTrueheading_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTrueheading_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTrueheading_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSTrueheading = { + "FANSTrueheading", + "FANSTrueheading", + FANSTrueheading_free, + FANSTrueheading_print, + FANSTrueheading_constraint, + FANSTrueheading_decode_ber, + FANSTrueheading_encode_der, + FANSTrueheading_decode_xer, + FANSTrueheading_encode_xer, + FANSTrueheading_decode_uper, + FANSTrueheading_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTrueheading.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrueheading.h new file mode 100644 index 000000000..8a0126b18 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTrueheading.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTrueheading_H_ +#define _FANSTrueheading_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSDegrees.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSTrueheading */ +typedef FANSDegrees_t FANSTrueheading_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTrueheading; +asn_struct_free_f FANSTrueheading_free; +asn_struct_print_f FANSTrueheading_print; +asn_constr_check_f FANSTrueheading_constraint; +ber_type_decoder_f FANSTrueheading_decode_ber; +der_type_encoder_f FANSTrueheading_encode_der; +xer_type_decoder_f FANSTrueheading_decode_xer; +xer_type_encoder_f FANSTrueheading_encode_xer; +per_type_decoder_f FANSTrueheading_decode_uper; +per_type_encoder_f FANSTrueheading_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTrueheading_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTurbulence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSTurbulence.c new file mode 100644 index 000000000..72b072ec0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTurbulence.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSTurbulence.h" + +int +FANSTurbulence_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSTurbulence_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSTurbulence_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSTurbulence_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSTurbulence_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSTurbulence_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSTurbulence_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSTurbulence_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSTurbulence_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSTurbulence_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSTurbulence_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSTurbulence_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSTurbulence_value2enum_1[] = { + { 0, 5, "light" }, + { 1, 8, "moderate" }, + { 2, 6, "severe" } +}; +static const unsigned int asn_MAP_FANSTurbulence_enum2value_1[] = { + 0, /* light(0) */ + 1, /* moderate(1) */ + 2 /* severe(2) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSTurbulence_specs_1 = { + asn_MAP_FANSTurbulence_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSTurbulence_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSTurbulence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSTurbulence = { + "FANSTurbulence", + "FANSTurbulence", + FANSTurbulence_free, + FANSTurbulence_print, + FANSTurbulence_constraint, + FANSTurbulence_decode_ber, + FANSTurbulence_encode_der, + FANSTurbulence_decode_xer, + FANSTurbulence_encode_xer, + FANSTurbulence_decode_uper, + FANSTurbulence_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSTurbulence_tags_1, + sizeof(asn_DEF_FANSTurbulence_tags_1) + /sizeof(asn_DEF_FANSTurbulence_tags_1[0]), /* 1 */ + asn_DEF_FANSTurbulence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSTurbulence_tags_1) + /sizeof(asn_DEF_FANSTurbulence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSTurbulence_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSTurbulence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSTurbulence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSTurbulence.h new file mode 100644 index 000000000..20bd06f9b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSTurbulence.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSTurbulence_H_ +#define _FANSTurbulence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSTurbulence { + FANSTurbulence_light = 0, + FANSTurbulence_moderate = 1, + FANSTurbulence_severe = 2 +} e_FANSTurbulence; + +/* FANSTurbulence */ +typedef long FANSTurbulence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSTurbulence; +asn_struct_free_f FANSTurbulence_free; +asn_struct_print_f FANSTurbulence_print; +asn_constr_check_f FANSTurbulence_constraint; +ber_type_decoder_f FANSTurbulence_decode_ber; +der_type_encoder_f FANSTurbulence_encode_der; +xer_type_decoder_f FANSTurbulence_decode_xer; +xer_type_encoder_f FANSTurbulence_encode_xer; +per_type_decoder_f FANSTurbulence_decode_uper; +per_type_encoder_f FANSTurbulence_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSTurbulence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVersionNumber.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSVersionNumber.c new file mode 100644 index 000000000..550d49b7f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVersionNumber.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSVersionNumber.h" + +int +FANSVersionNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSVersionNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSVersionNumber_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSVersionNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSVersionNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSVersionNumber_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSVersionNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSVersionNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSVersionNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSVersionNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSVersionNumber_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSVersionNumber_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSVersionNumber_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSVersionNumber = { + "FANSVersionNumber", + "FANSVersionNumber", + FANSVersionNumber_free, + FANSVersionNumber_print, + FANSVersionNumber_constraint, + FANSVersionNumber_decode_ber, + FANSVersionNumber_encode_der, + FANSVersionNumber_decode_xer, + FANSVersionNumber_encode_xer, + FANSVersionNumber_decode_uper, + FANSVersionNumber_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSVersionNumber_tags_1, + sizeof(asn_DEF_FANSVersionNumber_tags_1) + /sizeof(asn_DEF_FANSVersionNumber_tags_1[0]), /* 1 */ + asn_DEF_FANSVersionNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSVersionNumber_tags_1) + /sizeof(asn_DEF_FANSVersionNumber_tags_1[0]), /* 1 */ + &asn_PER_type_FANSVersionNumber_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVersionNumber.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSVersionNumber.h new file mode 100644 index 000000000..f3edc467f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVersionNumber.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSVersionNumber_H_ +#define _FANSVersionNumber_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSVersionNumber */ +typedef long FANSVersionNumber_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSVersionNumber; +asn_struct_free_f FANSVersionNumber_free; +asn_struct_print_f FANSVersionNumber_print; +asn_constr_check_f FANSVersionNumber_constraint; +ber_type_decoder_f FANSVersionNumber_decode_ber; +der_type_encoder_f FANSVersionNumber_encode_der; +xer_type_decoder_f FANSVersionNumber_decode_xer; +xer_type_encoder_f FANSVersionNumber_encode_xer; +per_type_decoder_f FANSVersionNumber_decode_uper; +per_type_encoder_f FANSVersionNumber_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSVersionNumber_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalChange.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalChange.c new file mode 100644 index 000000000..afa948d3f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalChange.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSVerticalChange.h" + +static asn_TYPE_member_t asn_MBR_FANSVerticalChange_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSVerticalChange, verticalDirection), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_FANSVerticalDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "verticalDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSVerticalChange, verticalRate), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSVerticalRate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "verticalRate" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSVerticalChange_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSVerticalChange_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* verticalDirection */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* verticalRateEnglish */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* verticalRateMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSVerticalChange_specs_1 = { + sizeof(struct FANSVerticalChange), + offsetof(struct FANSVerticalChange, _asn_ctx), + asn_MAP_FANSVerticalChange_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSVerticalChange = { + "FANSVerticalChange", + "FANSVerticalChange", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSVerticalChange_tags_1, + sizeof(asn_DEF_FANSVerticalChange_tags_1) + /sizeof(asn_DEF_FANSVerticalChange_tags_1[0]), /* 1 */ + asn_DEF_FANSVerticalChange_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSVerticalChange_tags_1) + /sizeof(asn_DEF_FANSVerticalChange_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSVerticalChange_1, + 2, /* Elements count */ + &asn_SPC_FANSVerticalChange_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalChange.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalChange.h new file mode 100644 index 000000000..e1e7656ab --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalChange.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSVerticalChange_H_ +#define _FANSVerticalChange_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSVerticalDirection.h" +#include "FANSVerticalRate.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSVerticalChange */ +typedef struct FANSVerticalChange { + FANSVerticalDirection_t verticalDirection; + FANSVerticalRate_t verticalRate; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSVerticalChange_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSVerticalChange; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSVerticalChange_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalDirection.c new file mode 100644 index 000000000..84792e652 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalDirection.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSVerticalDirection.h" + +int +FANSVerticalDirection_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +FANSVerticalDirection_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +FANSVerticalDirection_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSVerticalDirection_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalDirection_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSVerticalDirection_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalDirection_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSVerticalDirection_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalDirection_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSVerticalDirection_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSVerticalDirection_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSVerticalDirection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const asn_INTEGER_enum_map_t asn_MAP_FANSVerticalDirection_value2enum_1[] = { + { 0, 2, "up" }, + { 1, 4, "down" } +}; +static const unsigned int asn_MAP_FANSVerticalDirection_enum2value_1[] = { + 1, /* down(1) */ + 0 /* up(0) */ +}; +static const asn_INTEGER_specifics_t asn_SPC_FANSVerticalDirection_specs_1 = { + asn_MAP_FANSVerticalDirection_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FANSVerticalDirection_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static const ber_tlv_tag_t asn_DEF_FANSVerticalDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSVerticalDirection = { + "FANSVerticalDirection", + "FANSVerticalDirection", + FANSVerticalDirection_free, + FANSVerticalDirection_print, + FANSVerticalDirection_constraint, + FANSVerticalDirection_decode_ber, + FANSVerticalDirection_encode_der, + FANSVerticalDirection_decode_xer, + FANSVerticalDirection_encode_xer, + FANSVerticalDirection_decode_uper, + FANSVerticalDirection_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSVerticalDirection_tags_1, + sizeof(asn_DEF_FANSVerticalDirection_tags_1) + /sizeof(asn_DEF_FANSVerticalDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSVerticalDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSVerticalDirection_tags_1) + /sizeof(asn_DEF_FANSVerticalDirection_tags_1[0]), /* 1 */ + &asn_PER_type_FANSVerticalDirection_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FANSVerticalDirection_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalDirection.h new file mode 100644 index 000000000..c3ae62842 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalDirection.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSVerticalDirection_H_ +#define _FANSVerticalDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeEnumerated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSVerticalDirection { + FANSVerticalDirection_up = 0, + FANSVerticalDirection_down = 1 +} e_FANSVerticalDirection; + +/* FANSVerticalDirection */ +typedef long FANSVerticalDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSVerticalDirection; +asn_struct_free_f FANSVerticalDirection_free; +asn_struct_print_f FANSVerticalDirection_print; +asn_constr_check_f FANSVerticalDirection_constraint; +ber_type_decoder_f FANSVerticalDirection_decode_ber; +der_type_encoder_f FANSVerticalDirection_encode_der; +xer_type_decoder_f FANSVerticalDirection_decode_xer; +xer_type_encoder_f FANSVerticalDirection_encode_xer; +per_type_decoder_f FANSVerticalDirection_decode_uper; +per_type_encoder_f FANSVerticalDirection_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSVerticalDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRate.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRate.c new file mode 100644 index 000000000..242771612 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRate.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSVerticalRate.h" + +static asn_per_constraints_t asn_PER_type_FANSVerticalRate_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSVerticalRate_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSVerticalRate, choice.verticalRateEnglish), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSVerticalRateEnglish, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "verticalRateEnglish" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSVerticalRate, choice.verticalRateMetric), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSVerticalRateMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "verticalRateMetric" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSVerticalRate_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* verticalRateEnglish */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* verticalRateMetric */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSVerticalRate_specs_1 = { + sizeof(struct FANSVerticalRate), + offsetof(struct FANSVerticalRate, _asn_ctx), + offsetof(struct FANSVerticalRate, present), + sizeof(((struct FANSVerticalRate *)0)->present), + asn_MAP_FANSVerticalRate_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSVerticalRate = { + "FANSVerticalRate", + "FANSVerticalRate", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSVerticalRate_constr_1, + asn_MBR_FANSVerticalRate_1, + 2, /* Elements count */ + &asn_SPC_FANSVerticalRate_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRate.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRate.h new file mode 100644 index 000000000..7f2fe25b9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRate.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSVerticalRate_H_ +#define _FANSVerticalRate_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSVerticalRateEnglish.h" +#include "FANSVerticalRateMetric.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSVerticalRate_PR { + FANSVerticalRate_PR_NOTHING, /* No components present */ + FANSVerticalRate_PR_verticalRateEnglish, + FANSVerticalRate_PR_verticalRateMetric +} FANSVerticalRate_PR; + +/* FANSVerticalRate */ +typedef struct FANSVerticalRate { + FANSVerticalRate_PR present; + union FANSVerticalRate_u { + FANSVerticalRateEnglish_t verticalRateEnglish; + FANSVerticalRateMetric_t verticalRateMetric; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSVerticalRate_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSVerticalRate; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSVerticalRate_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateEnglish.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateEnglish.c new file mode 100644 index 000000000..8f8e786de --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateEnglish.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSVerticalRateEnglish.h" + +int +FANSVerticalRateEnglish_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 60)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSVerticalRateEnglish_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSVerticalRateEnglish_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalRateEnglish_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSVerticalRateEnglish_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalRateEnglish_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSVerticalRateEnglish_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalRateEnglish_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSVerticalRateEnglish_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSVerticalRateEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSVerticalRateEnglish_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 6, 6, 0, 60 } /* (0..60) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSVerticalRateEnglish_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSVerticalRateEnglish = { + "FANSVerticalRateEnglish", + "FANSVerticalRateEnglish", + FANSVerticalRateEnglish_free, + FANSVerticalRateEnglish_print, + FANSVerticalRateEnglish_constraint, + FANSVerticalRateEnglish_decode_ber, + FANSVerticalRateEnglish_encode_der, + FANSVerticalRateEnglish_decode_xer, + FANSVerticalRateEnglish_encode_xer, + FANSVerticalRateEnglish_decode_uper, + FANSVerticalRateEnglish_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSVerticalRateEnglish_tags_1, + sizeof(asn_DEF_FANSVerticalRateEnglish_tags_1) + /sizeof(asn_DEF_FANSVerticalRateEnglish_tags_1[0]), /* 1 */ + asn_DEF_FANSVerticalRateEnglish_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSVerticalRateEnglish_tags_1) + /sizeof(asn_DEF_FANSVerticalRateEnglish_tags_1[0]), /* 1 */ + &asn_PER_type_FANSVerticalRateEnglish_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateEnglish.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateEnglish.h new file mode 100644 index 000000000..1187c4902 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateEnglish.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSVerticalRateEnglish_H_ +#define _FANSVerticalRateEnglish_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSVerticalRateEnglish */ +typedef long FANSVerticalRateEnglish_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSVerticalRateEnglish; +asn_struct_free_f FANSVerticalRateEnglish_free; +asn_struct_print_f FANSVerticalRateEnglish_print; +asn_constr_check_f FANSVerticalRateEnglish_constraint; +ber_type_decoder_f FANSVerticalRateEnglish_decode_ber; +der_type_encoder_f FANSVerticalRateEnglish_encode_der; +xer_type_decoder_f FANSVerticalRateEnglish_decode_xer; +xer_type_encoder_f FANSVerticalRateEnglish_encode_xer; +per_type_decoder_f FANSVerticalRateEnglish_decode_uper; +per_type_encoder_f FANSVerticalRateEnglish_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSVerticalRateEnglish_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateMetric.c new file mode 100644 index 000000000..484becc68 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSVerticalRateMetric.h" + +int +FANSVerticalRateMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 200)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSVerticalRateMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSVerticalRateMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSVerticalRateMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalRateMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSVerticalRateMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalRateMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSVerticalRateMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSVerticalRateMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSVerticalRateMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSVerticalRateMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSVerticalRateMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 200 } /* (0..200) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSVerticalRateMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSVerticalRateMetric = { + "FANSVerticalRateMetric", + "FANSVerticalRateMetric", + FANSVerticalRateMetric_free, + FANSVerticalRateMetric_print, + FANSVerticalRateMetric_constraint, + FANSVerticalRateMetric_decode_ber, + FANSVerticalRateMetric_encode_der, + FANSVerticalRateMetric_decode_xer, + FANSVerticalRateMetric_encode_xer, + FANSVerticalRateMetric_decode_uper, + FANSVerticalRateMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSVerticalRateMetric_tags_1, + sizeof(asn_DEF_FANSVerticalRateMetric_tags_1) + /sizeof(asn_DEF_FANSVerticalRateMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSVerticalRateMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSVerticalRateMetric_tags_1) + /sizeof(asn_DEF_FANSVerticalRateMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSVerticalRateMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateMetric.h new file mode 100644 index 000000000..76d268517 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSVerticalRateMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSVerticalRateMetric_H_ +#define _FANSVerticalRateMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSVerticalRateMetric */ +typedef long FANSVerticalRateMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSVerticalRateMetric; +asn_struct_free_f FANSVerticalRateMetric_free; +asn_struct_print_f FANSVerticalRateMetric_print; +asn_constr_check_f FANSVerticalRateMetric_constraint; +ber_type_decoder_f FANSVerticalRateMetric_decode_ber; +der_type_encoder_f FANSVerticalRateMetric_encode_der; +xer_type_decoder_f FANSVerticalRateMetric_decode_xer; +xer_type_encoder_f FANSVerticalRateMetric_encode_xer; +per_type_decoder_f FANSVerticalRateMetric_decode_uper; +per_type_encoder_f FANSVerticalRateMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSVerticalRateMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitude.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitude.c new file mode 100644 index 000000000..1eef4e78d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitude.c @@ -0,0 +1,82 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWaypointSpeedAltitude.h" + +static asn_TYPE_member_t asn_MBR_FANSWaypointSpeedAltitude_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSWaypointSpeedAltitude, position), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_POINTER, 2, offsetof(struct FANSWaypointSpeedAltitude, speed), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_FANSSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "speed" + }, + { ATF_POINTER, 1, offsetof(struct FANSWaypointSpeedAltitude, aTWaltitudesequence), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSATWAltitudeSequence, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aTWaltitudesequence" + }, +}; +static const int asn_MAP_FANSWaypointSpeedAltitude_oms_1[] = { 1, 2 }; +static const ber_tlv_tag_t asn_DEF_FANSWaypointSpeedAltitude_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSWaypointSpeedAltitude_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* position */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* speed */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* aTWaltitudesequence */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSWaypointSpeedAltitude_specs_1 = { + sizeof(struct FANSWaypointSpeedAltitude), + offsetof(struct FANSWaypointSpeedAltitude, _asn_ctx), + asn_MAP_FANSWaypointSpeedAltitude_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_FANSWaypointSpeedAltitude_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSWaypointSpeedAltitude = { + "FANSWaypointSpeedAltitude", + "FANSWaypointSpeedAltitude", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSWaypointSpeedAltitude_tags_1, + sizeof(asn_DEF_FANSWaypointSpeedAltitude_tags_1) + /sizeof(asn_DEF_FANSWaypointSpeedAltitude_tags_1[0]), /* 1 */ + asn_DEF_FANSWaypointSpeedAltitude_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSWaypointSpeedAltitude_tags_1) + /sizeof(asn_DEF_FANSWaypointSpeedAltitude_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSWaypointSpeedAltitude_1, + 3, /* Elements count */ + &asn_SPC_FANSWaypointSpeedAltitude_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitude.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitude.h new file mode 100644 index 000000000..0113da4df --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitude.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWaypointSpeedAltitude_H_ +#define _FANSWaypointSpeedAltitude_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSPosition.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSSpeed; +struct FANSATWAltitudeSequence; + +/* FANSWaypointSpeedAltitude */ +typedef struct FANSWaypointSpeedAltitude { + FANSPosition_t position; + struct FANSSpeed *speed /* OPTIONAL */; + struct FANSATWAltitudeSequence *aTWaltitudesequence /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSWaypointSpeedAltitude_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWaypointSpeedAltitude; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSSpeed.h" +#include "FANSATWAltitudeSequence.h" + +#endif /* _FANSWaypointSpeedAltitude_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitudesequence.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitudesequence.c new file mode 100644 index 000000000..879f0544b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitudesequence.c @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWaypointSpeedAltitudesequence.h" + +static asn_per_constraints_t asn_PER_type_FANSWaypointSpeedAltitudesequence_constr_1 GCC_NOTUSED = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSWaypointSpeedAltitudesequence_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_FANSWaypointSpeedAltitude, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_FANSWaypointSpeedAltitudesequence_specs_1 = { + sizeof(struct FANSWaypointSpeedAltitudesequence), + offsetof(struct FANSWaypointSpeedAltitudesequence, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSWaypointSpeedAltitudesequence = { + "FANSWaypointSpeedAltitudesequence", + "FANSWaypointSpeedAltitudesequence", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1, + sizeof(asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1) + /sizeof(asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1[0]), /* 1 */ + asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1) + /sizeof(asn_DEF_FANSWaypointSpeedAltitudesequence_tags_1[0]), /* 1 */ + &asn_PER_type_FANSWaypointSpeedAltitudesequence_constr_1, + asn_MBR_FANSWaypointSpeedAltitudesequence_1, + 1, /* Single element */ + &asn_SPC_FANSWaypointSpeedAltitudesequence_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitudesequence.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitudesequence.h new file mode 100644 index 000000000..5bd489165 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWaypointSpeedAltitudesequence.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWaypointSpeedAltitudesequence_H_ +#define _FANSWaypointSpeedAltitudesequence_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "asn_SEQUENCE_OF.h" +#include "constr_SEQUENCE_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FANSWaypointSpeedAltitude; + +/* FANSWaypointSpeedAltitudesequence */ +typedef struct FANSWaypointSpeedAltitudesequence { + A_SEQUENCE_OF(struct FANSWaypointSpeedAltitude) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSWaypointSpeedAltitudesequence_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWaypointSpeedAltitudesequence; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FANSWaypointSpeedAltitude.h" + +#endif /* _FANSWaypointSpeedAltitudesequence_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindDirection.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindDirection.c new file mode 100644 index 000000000..11452e790 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindDirection.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWindDirection.h" + +int +FANSWindDirection_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 360)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSWindDirection_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSWindDirection_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSWindDirection_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSWindDirection_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSWindDirection_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSWindDirection_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSWindDirection_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSWindDirection_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSWindDirection_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSWindDirection_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSWindDirection_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 1, 360 } /* (1..360) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSWindDirection_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSWindDirection = { + "FANSWindDirection", + "FANSWindDirection", + FANSWindDirection_free, + FANSWindDirection_print, + FANSWindDirection_constraint, + FANSWindDirection_decode_ber, + FANSWindDirection_encode_der, + FANSWindDirection_decode_xer, + FANSWindDirection_encode_xer, + FANSWindDirection_decode_uper, + FANSWindDirection_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSWindDirection_tags_1, + sizeof(asn_DEF_FANSWindDirection_tags_1) + /sizeof(asn_DEF_FANSWindDirection_tags_1[0]), /* 1 */ + asn_DEF_FANSWindDirection_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSWindDirection_tags_1) + /sizeof(asn_DEF_FANSWindDirection_tags_1[0]), /* 1 */ + &asn_PER_type_FANSWindDirection_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindDirection.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindDirection.h new file mode 100644 index 000000000..1bba00072 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindDirection.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWindDirection_H_ +#define _FANSWindDirection_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSWindDirection */ +typedef long FANSWindDirection_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWindDirection; +asn_struct_free_f FANSWindDirection_free; +asn_struct_print_f FANSWindDirection_print; +asn_constr_check_f FANSWindDirection_constraint; +ber_type_decoder_f FANSWindDirection_decode_ber; +der_type_encoder_f FANSWindDirection_encode_der; +xer_type_decoder_f FANSWindDirection_decode_xer; +xer_type_encoder_f FANSWindDirection_encode_xer; +per_type_decoder_f FANSWindDirection_decode_uper; +per_type_encoder_f FANSWindDirection_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSWindDirection_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeed.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeed.c new file mode 100644 index 000000000..805b7e628 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeed.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWindSpeed.h" + +static asn_per_constraints_t asn_PER_type_FANSWindSpeed_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_FANSWindSpeed_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSWindSpeed, choice.windSpeedEnglish), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSWindSpeedEnglish, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "windSpeedEnglish" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSWindSpeed, choice.windSpeedMetric), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FANSWindSpeedMetric, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "windSpeedMetric" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSWindSpeed_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* windSpeedEnglish */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* windSpeedMetric */ +}; +static asn_CHOICE_specifics_t asn_SPC_FANSWindSpeed_specs_1 = { + sizeof(struct FANSWindSpeed), + offsetof(struct FANSWindSpeed, _asn_ctx), + offsetof(struct FANSWindSpeed, present), + sizeof(((struct FANSWindSpeed *)0)->present), + asn_MAP_FANSWindSpeed_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSWindSpeed = { + "FANSWindSpeed", + "FANSWindSpeed", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_FANSWindSpeed_constr_1, + asn_MBR_FANSWindSpeed_1, + 2, /* Elements count */ + &asn_SPC_FANSWindSpeed_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeed.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeed.h new file mode 100644 index 000000000..27443d930 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeed.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWindSpeed_H_ +#define _FANSWindSpeed_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSWindSpeedEnglish.h" +#include "FANSWindSpeedMetric.h" +#include "constr_CHOICE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FANSWindSpeed_PR { + FANSWindSpeed_PR_NOTHING, /* No components present */ + FANSWindSpeed_PR_windSpeedEnglish, + FANSWindSpeed_PR_windSpeedMetric +} FANSWindSpeed_PR; + +/* FANSWindSpeed */ +typedef struct FANSWindSpeed { + FANSWindSpeed_PR present; + union FANSWindSpeed_u { + FANSWindSpeedEnglish_t windSpeedEnglish; + FANSWindSpeedMetric_t windSpeedMetric; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSWindSpeed_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWindSpeed; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSWindSpeed_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedEnglish.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedEnglish.c new file mode 100644 index 000000000..ec6fd64d3 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedEnglish.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWindSpeedEnglish.h" + +int +FANSWindSpeedEnglish_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSWindSpeedEnglish_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSWindSpeedEnglish_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSWindSpeedEnglish_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSWindSpeedEnglish_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSWindSpeedEnglish_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSWindSpeedEnglish_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSWindSpeedEnglish_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSWindSpeedEnglish_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSWindSpeedEnglish_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSWindSpeedEnglish_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSWindSpeedEnglish_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSWindSpeedEnglish = { + "FANSWindSpeedEnglish", + "FANSWindSpeedEnglish", + FANSWindSpeedEnglish_free, + FANSWindSpeedEnglish_print, + FANSWindSpeedEnglish_constraint, + FANSWindSpeedEnglish_decode_ber, + FANSWindSpeedEnglish_encode_der, + FANSWindSpeedEnglish_decode_xer, + FANSWindSpeedEnglish_encode_xer, + FANSWindSpeedEnglish_decode_uper, + FANSWindSpeedEnglish_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSWindSpeedEnglish_tags_1, + sizeof(asn_DEF_FANSWindSpeedEnglish_tags_1) + /sizeof(asn_DEF_FANSWindSpeedEnglish_tags_1[0]), /* 1 */ + asn_DEF_FANSWindSpeedEnglish_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSWindSpeedEnglish_tags_1) + /sizeof(asn_DEF_FANSWindSpeedEnglish_tags_1[0]), /* 1 */ + &asn_PER_type_FANSWindSpeedEnglish_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedEnglish.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedEnglish.h new file mode 100644 index 000000000..514287c9a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedEnglish.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWindSpeedEnglish_H_ +#define _FANSWindSpeedEnglish_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSWindSpeedEnglish */ +typedef long FANSWindSpeedEnglish_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWindSpeedEnglish; +asn_struct_free_f FANSWindSpeedEnglish_free; +asn_struct_print_f FANSWindSpeedEnglish_print; +asn_constr_check_f FANSWindSpeedEnglish_constraint; +ber_type_decoder_f FANSWindSpeedEnglish_decode_ber; +der_type_encoder_f FANSWindSpeedEnglish_encode_der; +xer_type_decoder_f FANSWindSpeedEnglish_decode_xer; +xer_type_encoder_f FANSWindSpeedEnglish_encode_xer; +per_type_decoder_f FANSWindSpeedEnglish_decode_uper; +per_type_encoder_f FANSWindSpeedEnglish_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSWindSpeedEnglish_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedMetric.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedMetric.c new file mode 100644 index 000000000..61a818f10 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedMetric.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWindSpeedMetric.h" + +int +FANSWindSpeedMetric_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FANSWindSpeedMetric_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->check_constraints = asn_DEF_NativeInteger.check_constraints; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FANSWindSpeedMetric_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FANSWindSpeedMetric_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FANSWindSpeedMetric_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FANSWindSpeedMetric_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FANSWindSpeedMetric_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FANSWindSpeedMetric_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FANSWindSpeedMetric_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FANSWindSpeedMetric_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FANSWindSpeedMetric_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FANSWindSpeedMetric_constr_1 GCC_NOTUSED = { + { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static const ber_tlv_tag_t asn_DEF_FANSWindSpeedMetric_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FANSWindSpeedMetric = { + "FANSWindSpeedMetric", + "FANSWindSpeedMetric", + FANSWindSpeedMetric_free, + FANSWindSpeedMetric_print, + FANSWindSpeedMetric_constraint, + FANSWindSpeedMetric_decode_ber, + FANSWindSpeedMetric_encode_der, + FANSWindSpeedMetric_decode_xer, + FANSWindSpeedMetric_encode_xer, + FANSWindSpeedMetric_decode_uper, + FANSWindSpeedMetric_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSWindSpeedMetric_tags_1, + sizeof(asn_DEF_FANSWindSpeedMetric_tags_1) + /sizeof(asn_DEF_FANSWindSpeedMetric_tags_1[0]), /* 1 */ + asn_DEF_FANSWindSpeedMetric_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSWindSpeedMetric_tags_1) + /sizeof(asn_DEF_FANSWindSpeedMetric_tags_1[0]), /* 1 */ + &asn_PER_type_FANSWindSpeedMetric_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedMetric.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedMetric.h new file mode 100644 index 000000000..0a0df9eca --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWindSpeedMetric.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWindSpeedMetric_H_ +#define _FANSWindSpeedMetric_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSWindSpeedMetric */ +typedef long FANSWindSpeedMetric_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWindSpeedMetric; +asn_struct_free_f FANSWindSpeedMetric_free; +asn_struct_print_f FANSWindSpeedMetric_print; +asn_constr_check_f FANSWindSpeedMetric_constraint; +ber_type_decoder_f FANSWindSpeedMetric_decode_ber; +der_type_encoder_f FANSWindSpeedMetric_encode_der; +xer_type_decoder_f FANSWindSpeedMetric_decode_xer; +xer_type_encoder_f FANSWindSpeedMetric_encode_xer; +per_type_decoder_f FANSWindSpeedMetric_decode_uper; +per_type_encoder_f FANSWindSpeedMetric_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSWindSpeedMetric_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWinds.c b/plugins/inmarsat_support/aero/libacars/asn1/FANSWinds.c new file mode 100644 index 000000000..fa83f5f49 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWinds.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#include "FANSWinds.h" + +static asn_TYPE_member_t asn_MBR_FANSWinds_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FANSWinds, windDirection), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_FANSWindDirection, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "windDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct FANSWinds, windSpeed), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_FANSWindSpeed, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "windSpeed" + }, +}; +static const ber_tlv_tag_t asn_DEF_FANSWinds_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_FANSWinds_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* windDirection */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* windSpeedEnglish */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* windSpeedMetric */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FANSWinds_specs_1 = { + sizeof(struct FANSWinds), + offsetof(struct FANSWinds, _asn_ctx), + asn_MAP_FANSWinds_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FANSWinds = { + "FANSWinds", + "FANSWinds", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FANSWinds_tags_1, + sizeof(asn_DEF_FANSWinds_tags_1) + /sizeof(asn_DEF_FANSWinds_tags_1[0]), /* 1 */ + asn_DEF_FANSWinds_tags_1, /* Same as above */ + sizeof(asn_DEF_FANSWinds_tags_1) + /sizeof(asn_DEF_FANSWinds_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FANSWinds_1, + 2, /* Elements count */ + &asn_SPC_FANSWinds_specs_1 /* Additional specs */ +}; + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/FANSWinds.h b/plugins/inmarsat_support/aero/libacars/asn1/FANSWinds.h new file mode 100644 index 000000000..c848dffa0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/FANSWinds.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "FANSACTwoWayDataLinkCommunications" + * found in "../../../libacars.asn1/fans-cpdlc.asn1" + * `asn1c -fcompound-names -fincludes-quoted -gen-PER` + */ + +#ifndef _FANSWinds_H_ +#define _FANSWinds_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "FANSWindDirection.h" +#include "FANSWindSpeed.h" +#include "constr_SEQUENCE.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FANSWinds */ +typedef struct FANSWinds { + FANSWindDirection_t windDirection; + FANSWindSpeed_t windSpeed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FANSWinds_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FANSWinds; + +#ifdef __cplusplus +} +#endif + +#endif /* _FANSWinds_H_ */ +#include "asn_internal.h" diff --git a/plugins/inmarsat_support/aero/libacars/asn1/IA5String.c b/plugins/inmarsat_support/aero/libacars/asn1/IA5String.c new file mode 100644 index 000000000..504785321 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/IA5String.c @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "IA5String.h" + +/* + * IA5String basic type description. + */ +static const ber_tlv_tag_t asn_DEF_IA5String_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), /* [UNIVERSAL 22] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +static asn_per_constraints_t asn_DEF_IA5String_constraints = { + { APC_CONSTRAINED, 7, 7, 0, 0x7f }, /* Value */ + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_IA5String = { + "IA5String", + "IA5String", + OCTET_STRING_free, + OCTET_STRING_print_utf8, /* ASCII subset */ + IA5String_constraint, /* Constraint on the alphabet */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_utf8, + OCTET_STRING_encode_xer_utf8, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_IA5String_tags, + sizeof(asn_DEF_IA5String_tags) + / sizeof(asn_DEF_IA5String_tags[0]) - 1, + asn_DEF_IA5String_tags, + sizeof(asn_DEF_IA5String_tags) + / sizeof(asn_DEF_IA5String_tags[0]), + &asn_DEF_IA5String_constraints, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +int +IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + + if(st && st->buf) { + uint8_t *buf = st->buf; + uint8_t *end = buf + st->size; + /* + * IA5String is generally equivalent to 7bit ASCII. + * ISO/ITU-T T.50, 1963. + */ + for(; buf < end; buf++) { + if(*buf > 0x7F) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value byte %ld out of range: " + "%d > 127 (%s:%d)", + td->name, + (long)((buf - st->buf) + 1), + *buf, + __FILE__, __LINE__); + return -1; + } + } + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/IA5String.h b/plugins/inmarsat_support/aero/libacars/asn1/IA5String.h new file mode 100644 index 000000000..c5fd99e07 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/IA5String.h @@ -0,0 +1,27 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _IA5String_H_ +#define _IA5String_H_ + +#include "OCTET_STRING.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t IA5String_t; /* Implemented via OCTET STRING */ + +/* + * IA5String ASN.1 type definition. + */ +extern asn_TYPE_descriptor_t asn_DEF_IA5String; + +asn_constr_check_f IA5String_constraint; + +#ifdef __cplusplus +} +#endif + +#endif /* _IA5String_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/INTEGER.c b/plugins/inmarsat_support/aero/libacars/asn1/INTEGER.c new file mode 100644 index 000000000..b3433f895 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/INTEGER.c @@ -0,0 +1,1025 @@ +/*- + * Copyright (c) 2003-2014 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "INTEGER.h" +#include "asn_codecs_prim.h" /* Encoder and decoder of a primitive type */ +#include + +/* + * INTEGER basic type description. + */ +static const ber_tlv_tag_t asn_DEF_INTEGER_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_INTEGER = { + "INTEGER", + "INTEGER", + ASN__PRIMITIVE_TYPE_free, + INTEGER_print, + asn_generic_no_constraint, + ber_decode_primitive, + INTEGER_encode_der, + INTEGER_decode_xer, + INTEGER_encode_xer, +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, +#else + INTEGER_decode_uper, /* Unaligned PER decoder */ + INTEGER_encode_uper, /* Unaligned PER encoder */ +#endif /* ASN_DISABLE_PER_SUPPORT */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_INTEGER_tags, + sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), + asn_DEF_INTEGER_tags, /* Same as above */ + sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Encode INTEGER type using DER. + */ +asn_enc_rval_t +INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + INTEGER_t *st = (INTEGER_t *)sptr; + + ASN_DEBUG("%s %s as INTEGER (tm=%d)", + cb?"Encoding":"Estimating", td->name, tag_mode); + + /* + * Canonicalize integer in the buffer. + * (Remove too long sign extension, remove some first 0x00 bytes) + */ + if(st->buf) { + uint8_t *buf = st->buf; + uint8_t *end1 = buf + st->size - 1; + int shift; + + /* Compute the number of superfluous leading bytes */ + for(; buf < end1; buf++) { + /* + * If the contents octets of an integer value encoding + * consist of more than one octet, then the bits of the + * first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + switch(*buf) { + case 0x00: if((buf[1] & 0x80) == 0) + continue; + break; + case 0xff: if((buf[1] & 0x80)) + continue; + break; + } + break; + } + + /* Remove leading superfluous bytes from the integer */ + shift = buf - st->buf; + if(shift) { + uint8_t *nb = st->buf; + uint8_t *end; + + st->size -= shift; /* New size, minus bad bytes */ + end = nb + st->size; + + for(; nb < end; nb++, buf++) + *nb = *buf; + } + + } /* if(1) */ + + return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); +} + +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); + +/* + * INTEGER specific human-readable output. + */ +static ssize_t +INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit integer */ + uint8_t *buf = st->buf; + uint8_t *buf_end = st->buf + st->size; + signed long value; + ssize_t wrote = 0; + char *p; + int ret; + + if(specs && specs->field_unsigned) + ret = asn_INTEGER2ulong(st, (unsigned long *)&value); + else + ret = asn_INTEGER2long(st, &value); + + /* Simple case: the integer size is small */ + if(ret == 0) { + const asn_INTEGER_enum_map_t *el; + size_t scrsize; + char *scr; + + el = (value >= 0 || !specs || !specs->field_unsigned) + ? INTEGER_map_value2enum(specs, value) : 0; + if(el) { + scrsize = el->enum_len + 32; + scr = (char *)alloca(scrsize); + if(plainOrXER == 0) + ret = snprintf(scr, scrsize, + "%ld (%s)", value, el->enum_name); + else + ret = snprintf(scr, scrsize, + "<%s/>", el->enum_name); + } else if(plainOrXER && specs && specs->strict_enumeration) { + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } else { + scrsize = sizeof(scratch); + scr = scratch; + ret = snprintf(scr, scrsize, + (specs && specs->field_unsigned) + ?"%lu":"%ld", value); + } + assert(ret > 0 && (size_t)ret < scrsize); + return (cb(scr, ret, app_key) < 0) ? -1 : ret; + } else if(plainOrXER && specs && specs->strict_enumeration) { + /* + * Here and earlier, we cannot encode the ENUMERATED values + * if there is no corresponding identifier. + */ + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } + + /* Output in the long xx:yy:zz... format */ + /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */ + for(p = scratch; buf < buf_end; buf++) { + const char * const h2c = "0123456789ABCDEF"; + if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) { + /* Flush buffer */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + wrote += p - scratch; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x3a; /* ":" */ + } + if(p != scratch) + p--; /* Remove the last ":" */ + + wrote += p - scratch; + return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote; +} + +/* + * INTEGER specific human-readable output. + */ +int +INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + ssize_t ret; + + (void)td; + (void)ilevel; + + if(!st || !st->buf) + ret = cb("", 8, app_key); + else + ret = INTEGER__dump(td, st, cb, app_key, 0); + + return (ret < 0) ? -1 : 0; +} + +struct e2v_key { + const char *start; + const char *stop; + const asn_INTEGER_enum_map_t *vemap; + const unsigned int *evmap; +}; +static int +INTEGER__compar_enum2value(const void *kp, const void *am) { + const struct e2v_key *key = (const struct e2v_key *)kp; + const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; + const char *ptr, *end, *name; + + /* Remap the element (sort by different criterion) */ + el = key->vemap + key->evmap[el - key->vemap]; + + /* Compare strings */ + for(ptr = key->start, end = key->stop, name = el->enum_name; + ptr < end; ptr++, name++) { + if(*ptr != *name) + return *(const unsigned char *)ptr + - *(const unsigned char *)name; + } + return name[0] ? -1 : 0; +} + +static const asn_INTEGER_enum_map_t * +INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { + const asn_INTEGER_enum_map_t *el_found; + int count = specs ? specs->map_count : 0; + struct e2v_key key; + const char *lp; + + if(!count) return NULL; + + /* Guaranteed: assert(lstart < lstop); */ + /* Figure out the tag name */ + for(lstart++, lp = lstart; lp < lstop; lp++) { + switch(*lp) { + case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */ + case 0x2f: /* '/' */ case 0x3e: /* '>' */ + break; + default: + continue; + } + break; + } + if(lp == lstop) return NULL; /* No tag found */ + lstop = lp; + + key.start = lstart; + key.stop = lstop; + key.vemap = specs->value2enum; + key.evmap = specs->enum2value; + el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, + specs->value2enum, count, sizeof(specs->value2enum[0]), + INTEGER__compar_enum2value); + if(el_found) { + /* Remap enum2value into value2enum */ + el_found = key.vemap + key.evmap[el_found - key.vemap]; + } + return el_found; +} + +static int +INTEGER__compar_value2enum(const void *kp, const void *am) { + long a = *(const long *)kp; + const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; + long b = el->nat_value; + if(a < b) return -1; + else if(a == b) return 0; + else return 1; +} + +const asn_INTEGER_enum_map_t * +INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) { + int count = specs ? specs->map_count : 0; + if(!count) return 0; + return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, + count, sizeof(specs->value2enum[0]), + INTEGER__compar_value2enum); +} + +static int +INTEGER_st_prealloc(INTEGER_t *st, int min_size) { + void *p = MALLOC(min_size + 1); + if(p) { + void *b = st->buf; + st->size = 0; + st->buf = p; + FREEMEM(b); + return 0; + } else { + return -1; + } +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +static enum xer_pbd_rval +INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { + INTEGER_t *st = (INTEGER_t *)sptr; + long dec_value; + long hex_value = 0; + const char *lp; + const char *lstart = (const char *)chunk_buf; + const char *lstop = lstart + chunk_size; + enum { + ST_LEADSPACE, + ST_SKIPSPHEX, + ST_WAITDIGITS, + ST_DIGITS, + ST_DIGITS_TRAILSPACE, + ST_HEXDIGIT1, + ST_HEXDIGIT2, + ST_HEXDIGITS_TRAILSPACE, + ST_HEXCOLON, + ST_END_ENUM, + ST_UNEXPECTED + } state = ST_LEADSPACE; + const char *dec_value_start = 0; /* INVARIANT: always !0 in ST_DIGITS */ + const char *dec_value_end = 0; + + if(chunk_size) + ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", + (long)chunk_size, *lstart, lstop[-1]); + + if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) + return XPBD_SYSTEM_FAILURE; + + /* + * We may have received a tag here. It will be processed inline. + * Use strtoul()-like code and serialize the result. + */ + for(lp = lstart; lp < lstop; lp++) { + int lv = *lp; + switch(lv) { + case 0x09: case 0x0a: case 0x0d: case 0x20: + switch(state) { + case ST_LEADSPACE: + case ST_DIGITS_TRAILSPACE: + case ST_HEXDIGITS_TRAILSPACE: + case ST_SKIPSPHEX: + continue; + case ST_DIGITS: + dec_value_end = lp; + state = ST_DIGITS_TRAILSPACE; + continue; + case ST_HEXCOLON: + state = ST_HEXDIGITS_TRAILSPACE; + continue; + default: + break; + } + break; + case 0x2d: /* '-' */ + if(state == ST_LEADSPACE) { + dec_value = 0; + dec_value_start = lp; + state = ST_WAITDIGITS; + continue; + } + break; + case 0x2b: /* '+' */ + if(state == ST_LEADSPACE) { + dec_value = 0; + dec_value_start = lp; + state = ST_WAITDIGITS; + continue; + } + break; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + switch(state) { + case ST_DIGITS: continue; + case ST_SKIPSPHEX: /* Fall through */ + case ST_HEXDIGIT1: + hex_value = (lv - 0x30) << 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + hex_value += (lv - 0x30); + state = ST_HEXCOLON; + st->buf[st->size++] = (uint8_t)hex_value; + continue; + case ST_HEXCOLON: + return XPBD_BROKEN_ENCODING; + case ST_LEADSPACE: + dec_value = 0; + dec_value_start = lp; + /* FALL THROUGH */ + case ST_WAITDIGITS: + state = ST_DIGITS; + continue; + default: + break; + } + break; + case 0x3c: /* '<', start of XML encoded enumeration */ + if(state == ST_LEADSPACE) { + const asn_INTEGER_enum_map_t *el; + el = INTEGER_map_enum2value( + (asn_INTEGER_specifics_t *) + td->specifics, lstart, lstop); + if(el) { + ASN_DEBUG("Found \"%s\" => %ld", + el->enum_name, el->nat_value); + dec_value = el->nat_value; + state = ST_END_ENUM; + lp = lstop - 1; + continue; + } + ASN_DEBUG("Unknown identifier for INTEGER"); + } + return XPBD_BROKEN_ENCODING; + case 0x3a: /* ':' */ + if(state == ST_HEXCOLON) { + /* This colon is expected */ + state = ST_HEXDIGIT1; + continue; + } else if(state == ST_DIGITS) { + /* The colon here means that we have + * decoded the first two hexadecimal + * places as a decimal value. + * Switch decoding mode. */ + ASN_DEBUG("INTEGER re-evaluate as hex form"); + state = ST_SKIPSPHEX; + dec_value_start = 0; + lp = lstart - 1; + continue; + } else { + ASN_DEBUG("state %d at %ld", state, (long)(lp - lstart)); + break; + } + /* [A-Fa-f] */ + case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46: + case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66: + switch(state) { + case ST_SKIPSPHEX: + case ST_LEADSPACE: /* Fall through */ + case ST_HEXDIGIT1: + hex_value = lv - ((lv < 0x61) ? 0x41 : 0x61); + hex_value += 10; + hex_value <<= 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + hex_value += lv - ((lv < 0x61) ? 0x41 : 0x61); + hex_value += 10; + st->buf[st->size++] = (uint8_t)hex_value; + state = ST_HEXCOLON; + continue; + case ST_DIGITS: + ASN_DEBUG("INTEGER re-evaluate as hex form"); + state = ST_SKIPSPHEX; + dec_value_start = 0; + lp = lstart - 1; + continue; + default: + break; + } + break; + } + + /* Found extra non-numeric stuff */ + ASN_DEBUG("INTEGER :: Found non-numeric 0x%2x at %ld", + lv, (long)(lp - lstart)); + state = ST_UNEXPECTED; + break; + } + + switch(state) { + case ST_END_ENUM: + /* Got a complete and valid enumeration encoded as a tag. */ + break; + case ST_DIGITS: + dec_value_end = lstop; + /* FALL THROUGH */ + case ST_DIGITS_TRAILSPACE: + /* The last symbol encountered was a digit. */ + switch(asn_strtol_lim(dec_value_start, &dec_value_end, &dec_value)) { + case ASN_STRTOL_OK: + break; + case ASN_STRTOL_ERROR_RANGE: + return XPBD_DECODER_LIMIT; + case ASN_STRTOL_ERROR_INVAL: + case ASN_STRTOL_EXPECT_MORE: + case ASN_STRTOL_EXTRA_DATA: + return XPBD_BROKEN_ENCODING; + } + break; + case ST_HEXCOLON: + case ST_HEXDIGITS_TRAILSPACE: + st->buf[st->size] = 0; /* Just in case termination */ + return XPBD_BODY_CONSUMED; + case ST_HEXDIGIT1: + case ST_HEXDIGIT2: + case ST_SKIPSPHEX: + return XPBD_BROKEN_ENCODING; + case ST_LEADSPACE: + /* Content not found */ + return XPBD_NOT_BODY_IGNORE; + case ST_WAITDIGITS: + case ST_UNEXPECTED: + ASN_DEBUG("INTEGER: No useful digits (state %d)", state); + return XPBD_BROKEN_ENCODING; /* No digits */ + } + + /* + * Convert the result of parsing of enumeration or a straight + * decimal value into a BER representation. + */ + if(asn_long2INTEGER(st, dec_value)) + return XPBD_SYSTEM_FAILURE; + + return XPBD_BODY_CONSUMED; +} + +asn_dec_rval_t +INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + + return xer_decode_primitive(opt_codec_ctx, td, + sptr, sizeof(INTEGER_t), opt_mname, + buf_ptr, size, INTEGER__xer_body_decode); +} + +asn_enc_rval_t +INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + asn_enc_rval_t er; + + (void)ilevel; + (void)flags; + + if(!st || !st->buf) + ASN__ENCODE_FAILED; + + er.encoded = INTEGER__dump(td, st, cb, app_key, 1); + if(er.encoded < 0) ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} + +#ifndef ASN_DISABLE_PER_SUPPORT + +asn_dec_rval_t +INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + INTEGER_t *st = (INTEGER_t *)*sptr; + asn_per_constraint_t *ct; + int repeat; + + (void)opt_codec_ctx; + + if(!st) { + st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) ASN__DECODE_FAILED; + } + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) ASN__DECODE_STARVED; + if(inext) ct = 0; + } + + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + if(ct) { + if(ct->flags & APC_SEMI_CONSTRAINED) { + st->buf = (uint8_t *)CALLOC(1, 2); + if(!st->buf) ASN__DECODE_FAILED; + st->size = 1; + } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { + size_t size = (ct->range_bits + 7) >> 3; + st->buf = (uint8_t *)MALLOC(1 + size + 1); + if(!st->buf) ASN__DECODE_FAILED; + st->size = size; + } + } + + /* X.691-2008/11, #13.2.2, constrained whole number */ + if(ct && ct->flags != APC_UNCONSTRAINED) { + /* #11.5.6 */ + ASN_DEBUG("Integer with range %d bits", ct->range_bits); + if(ct->range_bits >= 0) { + if((size_t)ct->range_bits > 8 * sizeof(unsigned long)) + ASN__DECODE_FAILED; + + if(specs && specs->field_unsigned) { + unsigned long uvalue; + if(uper_get_constrained_whole_number(pd, + &uvalue, ct->range_bits)) + ASN__DECODE_STARVED; + ASN_DEBUG("Got value %lu + low %ld", + uvalue, ct->lower_bound); + uvalue += ct->lower_bound; + if(asn_ulong2INTEGER(st, uvalue)) + ASN__DECODE_FAILED; + } else { + unsigned long svalue; + if(uper_get_constrained_whole_number(pd, + &svalue, ct->range_bits)) + ASN__DECODE_STARVED; + ASN_DEBUG("Got value %ld + low %ld", + svalue, ct->lower_bound); + svalue += ct->lower_bound; + if(asn_long2INTEGER(st, svalue)) + ASN__DECODE_FAILED; + } + return rval; + } + } else { + ASN_DEBUG("Decoding unconstrained integer %s", td->name); + } + + /* X.691, #12.2.3, #12.2.4 */ + do { + ssize_t len; + void *p; + int ret; + + /* Get the PER length */ + len = uper_get_length(pd, -1, &repeat); + if(len < 0) ASN__DECODE_STARVED; + + p = REALLOC(st->buf, st->size + len + 1); + if(!p) ASN__DECODE_FAILED; + st->buf = (uint8_t *)p; + + ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); + if(ret < 0) ASN__DECODE_STARVED; + st->size += len; + } while(repeat); + st->buf[st->size] = 0; /* JIC */ + + /* #12.2.3 */ + if(ct && ct->lower_bound) { + /* + * TODO: replace by in-place arithmetics. + */ + long value; + if(asn_INTEGER2long(st, &value)) + ASN__DECODE_FAILED; + if(asn_long2INTEGER(st, value + ct->lower_bound)) + ASN__DECODE_FAILED; + } + + return rval; +} + +asn_enc_rval_t +INTEGER_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + INTEGER_t *st = (INTEGER_t *)sptr; + const uint8_t *buf; + const uint8_t *end; + asn_per_constraint_t *ct; + long value = 0; + unsigned long v = 0; + + if(!st || st->size == 0) ASN__ENCODE_FAILED; + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + er.encoded = 0; + + if(ct) { + int inext = 0; + if(specs && specs->field_unsigned) { + unsigned long uval; + if(asn_INTEGER2ulong(st, &uval)) + ASN__ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(uval < (unsigned long)ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(uval < (unsigned long)ct->lower_bound + || uval > (unsigned long)ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", + uval, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + value = uval; + } else { + if(asn_INTEGER2long(st, &value)) + ASN__ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(value < ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(value < ct->lower_bound + || value > ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", + value, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + ASN__ENCODE_FAILED; + } + } + + + /* X.691-11/2008, #13.2.2, test if constrained whole number */ + if(ct && ct->range_bits >= 0) { + /* #11.5.6 -> #11.3 */ + ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits", + value, value - ct->lower_bound, ct->range_bits); + v = value - ct->lower_bound; + if(uper_put_constrained_whole_number_u(po, v, ct->range_bits)) + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + if(ct && ct->lower_bound) { + ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); + /* TODO: adjust lower bound */ + ASN__ENCODE_FAILED; + } + + for(buf = st->buf, end = st->buf + st->size; buf < end;) { + ssize_t mayEncode = uper_put_length(po, end - buf); + if(mayEncode < 0) + ASN__ENCODE_FAILED; + if(per_put_many_bits(po, buf, 8 * mayEncode)) + ASN__ENCODE_FAILED; + buf += mayEncode; + } + + ASN__ENCODED_OK(er); +} + +#endif /* ASN_DISABLE_PER_SUPPORT */ + +int +asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { + uint8_t *b, *end; + size_t size; + long l; + + /* Sanity checking */ + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + /* Cache the begin/end of the buffer */ + b = iptr->buf; /* Start of the INTEGER buffer */ + size = iptr->size; + end = b + size; /* Where to stop */ + + if(size > sizeof(long)) { + uint8_t *end1 = end - 1; + /* + * Slightly more advanced processing, + * able to >sizeof(long) bytes, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip out the insignificant leading bytes */ + for(; b < end1; b++) { + switch(*b) { + case 0x00: if((b[1] & 0x80) == 0) continue; break; + case 0xff: if((b[1] & 0x80) != 0) continue; break; + } + break; + } + + size = end - b; + if(size > sizeof(long)) { + /* Still cannot fit the long */ + errno = ERANGE; + return -1; + } + } + + /* Shortcut processing of a corner case */ + if(end == b) { + *lptr = 0; + return 0; + } + + /* Perform the sign initialization */ + /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ + if((*b >> 7)) l = -1; else l = 0; + + /* Conversion engine */ + for(; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + +int +asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { + uint8_t *b, *end; + unsigned long l; + size_t size; + + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + b = iptr->buf; + size = iptr->size; + end = b + size; + + /* If all extra leading bytes are zeroes, ignore them */ + for(; size > sizeof(unsigned long); b++, size--) { + if(*b) { + /* Value won't fit unsigned long */ + errno = ERANGE; + return -1; + } + } + + /* Conversion engine */ + for(l = 0; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + +int +asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { + uint8_t *buf; + uint8_t *end; + uint8_t *b; + int shr; + + if(value <= LONG_MAX) + return asn_long2INTEGER(st, value); + + buf = (uint8_t *)MALLOC(1 + sizeof(value)); + if(!buf) return -1; + + end = buf + (sizeof(value) + 1); + buf[0] = 0; + for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++) + *b = (uint8_t)(value >> shr); + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = 1 + sizeof(value); + + return 0; +} + +int +asn_long2INTEGER(INTEGER_t *st, long value) { + uint8_t *buf, *bp; + uint8_t *p; + uint8_t *pstart; + uint8_t *pend1; + int littleEndian = 1; /* Run-time detection */ + int add; + + if(!st) { + errno = EINVAL; + return -1; + } + + buf = (uint8_t *)MALLOC(sizeof(value)); + if(!buf) return -1; + + if(*(char *)&littleEndian) { + pstart = (uint8_t *)&value + sizeof(value) - 1; + pend1 = (uint8_t *)&value; + add = -1; + } else { + pstart = (uint8_t *)&value; + pend1 = pstart + sizeof(value) - 1; + add = 1; + } + + /* + * If the contents octet consists of more than one octet, + * then bits of the first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + for(p = pstart; p != pend1; p += add) { + switch(*p) { + case 0x00: if((*(p+add) & 0x80) == 0) + continue; + break; + case 0xff: if((*(p+add) & 0x80)) + continue; + break; + } + break; + } + /* Copy the integer body */ + for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) + *bp++ = *p; + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = bp - buf; + + return 0; +} + +/* + * This function is going to be DEPRECATED soon. + */ +enum asn_strtol_result_e +asn_strtol(const char *str, const char *end, long *lp) { + const char *endp = end; + + switch(asn_strtol_lim(str, &endp, lp)) { + case ASN_STRTOL_ERROR_RANGE: + return ASN_STRTOL_ERROR_RANGE; + case ASN_STRTOL_ERROR_INVAL: + return ASN_STRTOL_ERROR_INVAL; + case ASN_STRTOL_EXPECT_MORE: + return ASN_STRTOL_ERROR_INVAL; /* Retain old behavior */ + case ASN_STRTOL_OK: + return ASN_STRTOL_OK; + case ASN_STRTOL_EXTRA_DATA: + return ASN_STRTOL_ERROR_INVAL; /* Retain old behavior */ + } + + return ASN_STRTOL_ERROR_INVAL; /* Retain old behavior */ +} + +/* + * Parse the number in the given string until the given *end position, + * returning the position after the last parsed character back using the + * same (*end) pointer. + * WARNING: This behavior is different from the standard strtol(3). + */ +enum asn_strtol_result_e +asn_strtol_lim(const char *str, const char **end, long *lp) { + int sign = 1; + long l; + + const long upper_boundary = LONG_MAX / 10; + long last_digit_max = LONG_MAX % 10; + + if(str >= *end) return ASN_STRTOL_ERROR_INVAL; + + switch(*str) { + case '-': + last_digit_max++; + sign = -1; + /* FALL THROUGH */ + case '+': + str++; + if(str >= *end) { + *end = str; + return ASN_STRTOL_EXPECT_MORE; + } + } + + for(l = 0; str < (*end); str++) { + switch(*str) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: { + int d = *str - '0'; + if(l < upper_boundary) { + l = l * 10 + d; + } else if(l == upper_boundary) { + if(d <= last_digit_max) { + if(sign > 0) { + l = l * 10 + d; + } else { + sign = 1; + l = -l * 10 - d; + } + } else { + *end = str; + return ASN_STRTOL_ERROR_RANGE; + } + } else { + *end = str; + return ASN_STRTOL_ERROR_RANGE; + } + } + continue; + default: + *end = str; + *lp = sign * l; + return ASN_STRTOL_EXTRA_DATA; + } + } + + *end = str; + *lp = sign * l; + return ASN_STRTOL_OK; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/INTEGER.h b/plugins/inmarsat_support/aero/libacars/asn1/INTEGER.h new file mode 100644 index 000000000..5a609d67b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/INTEGER.h @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _INTEGER_H_ +#define _INTEGER_H_ + +#include "asn_application.h" +#include "asn_codecs_prim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; + +extern asn_TYPE_descriptor_t asn_DEF_INTEGER; + +/* Map with to integer value association */ +typedef struct asn_INTEGER_enum_map_s { + long nat_value; /* associated native integer value */ + size_t enum_len; /* strlen("tag") */ + const char *enum_name; /* "tag" */ +} asn_INTEGER_enum_map_t; + +/* This type describes an enumeration for INTEGER and ENUMERATED types */ +typedef const struct asn_INTEGER_specifics_s { + const asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ + const unsigned int *enum2value; /* "tag" => N; sorted by tag */ + int map_count; /* Elements in either map */ + int extension; /* This map is extensible */ + int strict_enumeration; /* Enumeration set is fixed */ + int field_width; /* Size of native integer */ + int field_unsigned; /* Signed=0, unsigned=1 */ +} asn_INTEGER_specifics_t; + +asn_struct_print_f INTEGER_print; +ber_type_decoder_f INTEGER_decode_ber; +der_type_encoder_f INTEGER_encode_der; +xer_type_decoder_f INTEGER_decode_xer; +xer_type_encoder_f INTEGER_encode_xer; +per_type_decoder_f INTEGER_decode_uper; +per_type_encoder_f INTEGER_encode_uper; + +/*********************************** + * Some handy conversion routines. * + ***********************************/ + +/* + * Returns 0 if it was possible to convert, -1 otherwise. + * -1/EINVAL: Mandatory argument missing + * -1/ERANGE: Value encoded is out of range for long representation + * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). + */ +int asn_INTEGER2long(const INTEGER_t *i, long *l); +int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); +int asn_long2INTEGER(INTEGER_t *i, long l); +int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); + +/* A a reified version of strtol(3) with nicer error reporting. */ +enum asn_strtol_result_e { + ASN_STRTOL_ERROR_RANGE = -3, /* Input outside of numeric range for long type */ + ASN_STRTOL_ERROR_INVAL = -2, /* Invalid data encountered (e.g., "+-") */ + ASN_STRTOL_EXPECT_MORE = -1, /* More data expected (e.g. "+") */ + ASN_STRTOL_OK = 0, /* Conversion succeded, number ends at (*end) */ + ASN_STRTOL_EXTRA_DATA = 1 /* Conversion succeded, but the string has extra stuff */ +}; +enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long *l); + +/* The asn_strtol is going to be DEPRECATED soon */ +enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long *l); + +/* + * Convert the integer value into the corresponding enumeration map entry. + */ +const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); + +#ifdef __cplusplus +} +#endif + +#endif /* _INTEGER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NULL.c b/plugins/inmarsat_support/aero/libacars/asn1/NULL.c new file mode 100644 index 000000000..4a2a6d2dc --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NULL.c @@ -0,0 +1,151 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "asn_codecs_prim.h" +#include "NULL.h" +#include "BOOLEAN.h" /* Implemented in terms of BOOLEAN type */ + +/* + * NULL basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NULL_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NULL = { + "NULL", + "NULL", + BOOLEAN_free, + NULL_print, + asn_generic_no_constraint, + BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ + NULL_encode_der, /* Special handling of DER encoding */ + NULL_decode_xer, + NULL_encode_xer, + NULL_decode_uper, /* Unaligned PER decoder */ + NULL_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NULL_tags, + sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), + asn_DEF_NULL_tags, /* Same as above */ + sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval; + + erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = ptr; + } + + ASN__ENCODED_OK(erval); +} + +asn_enc_rval_t +NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + + (void)td; + (void)sptr; + (void)ilevel; + (void)flags; + (void)cb; + (void)app_key; + + /* XMLNullValue is empty */ + er.encoded = 0; + ASN__ENCODED_OK(er); +} + + +static enum xer_pbd_rval +NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { + (void)td; + (void)sptr; + (void)chunk_buf; /* Going to be empty according to the rules below. */ + + /* + * There must be no content in self-terminating tag. + */ + if(chunk_size) + return XPBD_BROKEN_ENCODING; + else + return XPBD_BODY_CONSUMED; +} + +asn_dec_rval_t +NULL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + + return xer_decode_primitive(opt_codec_ctx, td, + sptr, sizeof(NULL_t), opt_mname, buf_ptr, size, + NULL__xer_body_decode); +} + +int +NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(sptr) { + return (cb("", 9, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +asn_dec_rval_t +NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)opt_codec_ctx; + (void)td; + (void)constraints; + (void)pd; + + if(!*sptr) { + *sptr = MALLOC(sizeof(NULL_t)); + if(*sptr) { + *(NULL_t *)*sptr = 0; + } else { + ASN__DECODE_FAILED; + } + } + + /* + * NULL type does not have content octets. + */ + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + +asn_enc_rval_t +NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) { + asn_enc_rval_t er; + + (void)td; + (void)constraints; + (void)sptr; + (void)po; + + er.encoded = 0; + ASN__ENCODED_OK(er); +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NULL.h b/plugins/inmarsat_support/aero/libacars/asn1/NULL.h new file mode 100644 index 000000000..04c707945 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NULL.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_TYPE_NULL_H +#define ASN_TYPE_NULL_H + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The value of the NULL type is meaningless: see BOOLEAN if you want to + * carry true/false semantics. + */ +typedef int NULL_t; + +extern asn_TYPE_descriptor_t asn_DEF_NULL; + +asn_struct_print_f NULL_print; +der_type_encoder_f NULL_encode_der; +xer_type_decoder_f NULL_decode_xer; +xer_type_encoder_f NULL_encode_xer; +per_type_decoder_f NULL_decode_uper; +per_type_encoder_f NULL_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* NULL_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NativeEnumerated.c b/plugins/inmarsat_support/aero/libacars/asn1/NativeEnumerated.c new file mode 100644 index 000000000..734c14cbd --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NativeEnumerated.c @@ -0,0 +1,207 @@ +/*- + * Copyright (c) 2004, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include "asn_internal.h" +#include "NativeEnumerated.h" + +/* + * NativeEnumerated basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { + "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ + "ENUMERATED", + NativeInteger_free, + NativeInteger_print, + asn_generic_no_constraint, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeEnumerated_encode_xer, + NativeEnumerated_decode_uper, + NativeEnumerated_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NativeEnumerated_tags, + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + asn_DEF_NativeEnumerated_tags, /* Same as above */ + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + const long *native = (const long *)sptr; + const asn_INTEGER_enum_map_t *el; + + (void)ilevel; + (void)flags; + + if(!native) ASN__ENCODE_FAILED; + + el = INTEGER_map_value2enum(specs, *native); + if(el) { + size_t srcsize = el->enum_len + 5; + char *src = (char *)alloca(srcsize); + + er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); + assert(er.encoded > 0 && (size_t)er.encoded < srcsize); + if(cb(src, er.encoded, app_key) < 0) ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } else { + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + ASN__ENCODE_FAILED; + } +} + +asn_dec_rval_t +NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + long *native = (long *)*sptr; + asn_per_constraint_t *ct; + long value; + + (void)opt_codec_ctx; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ASN__DECODE_FAILED; /* Mandatory! */ + if(!specs) ASN__DECODE_FAILED; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); + + if(ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) ASN__DECODE_STARVED; + if(inext) ct = 0; + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + if(value >= (specs->extension + ? specs->extension - 1 : specs->map_count)) + ASN__DECODE_FAILED; + } else { + if(!specs->extension) + ASN__DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if(value < 0) ASN__DECODE_STARVED; + value += specs->extension - 1; + if(value >= specs->map_count) + ASN__DECODE_FAILED; + } + + *native = specs->value2enum[value].nat_value; + ASN_DEBUG("Decoded %s = %ld", td->name, *native); + + return rval; +} + +static int +NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { + const asn_INTEGER_enum_map_t *a = ap; + const asn_INTEGER_enum_map_t *b = bp; + if(a->nat_value == b->nat_value) + return 0; + if(a->nat_value < b->nat_value) + return -1; + return 1; +} + +asn_enc_rval_t +NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native, value; + asn_per_constraint_t *ct; + int inext = 0; + asn_INTEGER_enum_map_t key; + const asn_INTEGER_enum_map_t *kf; + + if(!sptr) ASN__ENCODE_FAILED; + if(!specs) ASN__ENCODE_FAILED; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ASN__ENCODE_FAILED; /* Mandatory! */ + + ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); + + er.encoded = 0; + + native = *(long *)sptr; + if(native < 0) ASN__ENCODE_FAILED; + + key.nat_value = native; + kf = bsearch(&key, specs->value2enum, specs->map_count, + sizeof(key), NativeEnumerated__compar_value2enum); + if(!kf) { + ASN_DEBUG("No element corresponds to %ld", native); + ASN__ENCODE_FAILED; + } + value = kf - specs->value2enum; + + if(ct->range_bits >= 0) { + int cmpWith = specs->extension + ? specs->extension - 1 : specs->map_count; + if(value >= cmpWith) + inext = 1; + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + ASN__ENCODE_FAILED; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, value, ct->range_bits)) + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + if(!specs->extension) + ASN__ENCODE_FAILED; + + /* + * X.691, #10.6: normally small non-negative whole number; + */ + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", + value, specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NativeEnumerated.h b/plugins/inmarsat_support/aero/libacars/asn1/NativeEnumerated.h new file mode 100644 index 000000000..4006594b6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NativeEnumerated.h @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard ENUMERATED in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeEnumerated_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeEnumerated_H_ +#define _NativeEnumerated_H_ + +#include "NativeInteger.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; + +xer_type_encoder_f NativeEnumerated_encode_xer; +per_type_decoder_f NativeEnumerated_decode_uper; +per_type_encoder_f NativeEnumerated_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeEnumerated_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NativeInteger.c b/plugins/inmarsat_support/aero/libacars/asn1/NativeInteger.c new file mode 100644 index 000000000..02f1e7172 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NativeInteger.c @@ -0,0 +1,332 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include "asn_internal.h" +#include "NativeInteger.h" + +/* + * NativeInteger basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NativeInteger = { + "INTEGER", /* The ASN.1 type is still INTEGER */ + "INTEGER", + NativeInteger_free, + NativeInteger_print, + asn_generic_no_constraint, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeInteger_encode_xer, + NativeInteger_decode_uper, /* Unaligned PER decoder */ + NativeInteger_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NativeInteger_tags, + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + asn_DEF_NativeInteger_tags, /* Same as above */ + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode INTEGER type. + */ +asn_dec_rval_t +NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + long *native = (long *)*nint_ptr; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + /* + * If the structure is not there, allocate it. + */ + if(native == NULL) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(native == NULL) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + } + + ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", + td->name, tag_mode); + + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, + tag_mode, 0, &length, 0); + if(rval.code != RC_OK) + return rval; + + ASN_DEBUG("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this length. + */ + buf_ptr = ((const char *)buf_ptr) + rval.consumed; + size -= rval.consumed; + if(length > (ber_tlv_len_t)size) { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } + + /* + * ASN.1 encoded INTEGER: buf_ptr, length + * Fill the native, at the same time checking for overflow. + * If overflow occured, return with RC_FAIL. + */ + { + INTEGER_t tmp; + union { + const void *constbuf; + void *nonconstbuf; + } unconst_buf; + long l; + + unconst_buf.constbuf = buf_ptr; + tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; + tmp.size = length; + + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmp, (unsigned long *)&l) /* sic */ + : asn_INTEGER2long(&tmp, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + + *native = l; + } + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", + (long)rval.consumed, (long)length, td->name, (long)*native); + + return rval; +} + +/* + * Encode the NativeInteger using the standard INTEGER type DER encoder. + */ +asn_enc_rval_t +NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */ + asn_enc_rval_t erval; + INTEGER_t tmp; + +#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ + + tmp.buf = (uint8_t *)&native; + tmp.size = sizeof(native); + +#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ + uint8_t buf[sizeof(native)]; + uint8_t *p; + + /* Prepare a fake INTEGER */ + for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) + *p = (uint8_t)native; + + tmp.buf = buf; + tmp.size = sizeof(buf); +#endif /* WORDS_BIGENDIAN */ + + /* Encode fake INTEGER */ + erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); + if(erval.encoded == -1) { + assert(erval.structure_ptr == &tmp); + erval.structure_ptr = ptr; + } + return erval; +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +asn_dec_rval_t +NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + INTEGER_t st; + void *st_ptr = (void *)&st; + long *native = (long *)*sptr; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + memset(&st, 0, sizeof(st)); + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, + opt_mname, buf_ptr, size); + if(rval.code == RC_OK) { + long l; + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&st, (unsigned long *)&l) /* sic */ + : asn_INTEGER2long(&st, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + } else { + *native = l; + } + } else { + /* + * Cannot restart from the middle; + * there is no place to save state in the native type. + * Request a continuation from the very beginning. + */ + rval.consumed = 0; + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); + return rval; +} + + +asn_enc_rval_t +NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit int */ + asn_enc_rval_t er; + const long *native = (const long *)sptr; + + (void)ilevel; + (void)flags; + + if(!native) ASN__ENCODE_FAILED; + + er.encoded = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) + || cb(scratch, er.encoded, app_key) < 0) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} + +asn_dec_rval_t +NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + long *native = (long *)*sptr; + INTEGER_t tmpint; + void *tmpintptr = &tmpint; + + (void)opt_codec_ctx; + ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + memset(&tmpint, 0, sizeof tmpint); + rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, + &tmpintptr, pd); + if(rval.code == RC_OK) { + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", + td->name, *native); + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + + return rval; +} + +asn_enc_rval_t +NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native; + INTEGER_t tmpint; + + if(!sptr) ASN__ENCODE_FAILED; + + native = *(long *)sptr; + + ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); + + memset(&tmpint, 0, sizeof(tmpint)); + if((specs&&specs->field_unsigned) + ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) + ASN__ENCODE_FAILED; + er = INTEGER_encode_uper(td, constraints, &tmpint, po); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; +} + +/* + * INTEGER specific human-readable output. + */ +int +NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + const long *native = (const long *)sptr; + char scratch[32]; /* Enough for 64-bit int */ + int ret; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(native) { + ret = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + assert(ret > 0 && (size_t)ret < sizeof(scratch)); + return (cb(scratch, ret, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", + td->name, contents_only, ptr); + + if(!contents_only) { + FREEMEM(ptr); + } +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NativeInteger.h b/plugins/inmarsat_support/aero/libacars/asn1/NativeInteger.h new file mode 100644 index 000000000..fb8ebec3a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NativeInteger.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard INTEGER in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeInteger_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeInteger_H_ +#define _NativeInteger_H_ + +#include "asn_application.h" +#include "INTEGER.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeInteger; + +asn_struct_free_f NativeInteger_free; +asn_struct_print_f NativeInteger_print; +ber_type_decoder_f NativeInteger_decode_ber; +der_type_encoder_f NativeInteger_encode_der; +xer_type_decoder_f NativeInteger_decode_xer; +xer_type_encoder_f NativeInteger_encode_xer; +per_type_decoder_f NativeInteger_decode_uper; +per_type_encoder_f NativeInteger_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeInteger_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NumericString.c b/plugins/inmarsat_support/aero/libacars/asn1/NumericString.c new file mode 100644 index 000000000..f1cdd526c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NumericString.c @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 2003, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "NumericString.h" + +/* + * NumericString basic type description. + */ +static const ber_tlv_tag_t asn_DEF_NumericString_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (18 << 2)), /* [UNIVERSAL 18] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +static int asn_DEF_NumericString_v2c(unsigned int value) { + switch(value) { + case 0x20: return 0; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + return value - (0x30 - 1); + } + return -1; +} +static int asn_DEF_NumericString_c2v(unsigned int code) { + if(code > 0) { + if(code <= 10) + return code + (0x30 - 1); + else + return -1; + } else { + return 0x20; + } +} +static asn_per_constraints_t asn_DEF_NumericString_constraints = { + { APC_CONSTRAINED, 4, 4, 0x20, 0x39 }, /* Value */ + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ + asn_DEF_NumericString_v2c, + asn_DEF_NumericString_c2v +}; +asn_TYPE_descriptor_t asn_DEF_NumericString = { + "NumericString", + "NumericString", + OCTET_STRING_free, + OCTET_STRING_print_utf8, /* ASCII subset */ + NumericString_constraint, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_utf8, + OCTET_STRING_encode_xer_utf8, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NumericString_tags, + sizeof(asn_DEF_NumericString_tags) + / sizeof(asn_DEF_NumericString_tags[0]) - 1, + asn_DEF_NumericString_tags, + sizeof(asn_DEF_NumericString_tags) + / sizeof(asn_DEF_NumericString_tags[0]), + &asn_DEF_NumericString_constraints, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +int +NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const NumericString_t *st = (const NumericString_t *)sptr; + + if(st && st->buf) { + uint8_t *buf = st->buf; + uint8_t *end = buf + st->size; + + /* + * Check the alphabet of the NumericString. + * ASN.1:1984 (X.409) + */ + for(; buf < end; buf++) { + switch(*buf) { + case 0x20: + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + continue; + } + ASN__CTFAIL(app_key, td, sptr, + "%s: value byte %ld (%d) " + "not in NumericString alphabet (%s:%d)", + td->name, + (long)((buf - st->buf) + 1), + *buf, + __FILE__, __LINE__); + return -1; + } + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/NumericString.h b/plugins/inmarsat_support/aero/libacars/asn1/NumericString.h new file mode 100644 index 000000000..9b9fb543f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/NumericString.h @@ -0,0 +1,24 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _NumericString_H_ +#define _NumericString_H_ + +#include "OCTET_STRING.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t NumericString_t; /* Implemented via OCTET STRING */ + +extern asn_TYPE_descriptor_t asn_DEF_NumericString; + +asn_constr_check_f NumericString_constraint; + +#ifdef __cplusplus +} +#endif + +#endif /* _NumericString_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/OCTET_STRING.c b/plugins/inmarsat_support/aero/libacars/asn1/OCTET_STRING.c new file mode 100644 index 000000000..ebe33bc5c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/OCTET_STRING.c @@ -0,0 +1,1807 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "OCTET_STRING.h" +#include "BIT_STRING.h" /* for .bits_unused member */ +#include + +/* + * OCTET STRING basic type description. + */ +static const ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +static const asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = { + sizeof(OCTET_STRING_t), + offsetof(OCTET_STRING_t, _asn_ctx), + ASN_OSUBV_STR +}; +static const asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = { + { APC_CONSTRAINED, 8, 8, 0, 255 }, + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { + "OCTET STRING", /* Canonical name */ + "OCTET_STRING", /* XML tag name */ + OCTET_STRING_free, + OCTET_STRING_print, /* non-ascii stuff, generally */ + asn_generic_no_constraint, + OCTET_STRING_decode_ber, + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_hex, + OCTET_STRING_encode_xer, + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OCTET_STRING_tags, + sizeof(asn_DEF_OCTET_STRING_tags) + / sizeof(asn_DEF_OCTET_STRING_tags[0]), + asn_DEF_OCTET_STRING_tags, /* Same as above */ + sizeof(asn_DEF_OCTET_STRING_tags) + / sizeof(asn_DEF_OCTET_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_DEF_OCTET_STRING_specs +}; + +#undef _CH_PHASE +#undef NEXT_PHASE +#undef PREV_PHASE +#define _CH_PHASE(ctx, inc) do { \ + if(ctx->phase == 0) \ + ctx->context = 0; \ + ctx->phase += inc; \ + } while(0) +#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) +#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +#undef RETURN +#define RETURN(_code) do { \ + asn_dec_rval_t tmprval; \ + tmprval.code = _code; \ + tmprval.consumed = consumed_myself; \ + return tmprval; \ + } while(0) + +#undef APPEND +#define APPEND(bufptr, bufsize) do { \ + size_t _bs = (bufsize); /* Append size */ \ + size_t _ns = ctx->context; /* Allocated now */ \ + size_t _es = st->size + _bs; /* Expected size */ \ + /* int is really a typeof(st->size): */ \ + if((int)_es < 0) RETURN(RC_FAIL); \ + if(_ns <= _es) { \ + void *ptr; \ + /* Be nice and round to the memory allocator */ \ + do { _ns = _ns ? _ns << 1 : 16; } \ + while(_ns <= _es); \ + /* int is really a typeof(st->size): */ \ + if((int)_ns < 0) RETURN(RC_FAIL); \ + ptr = REALLOC(st->buf, _ns); \ + if(ptr) { \ + st->buf = (uint8_t *)ptr; \ + ctx->context = _ns; \ + } else { \ + RETURN(RC_FAIL); \ + } \ + ASN_DEBUG("Reallocating into %ld", (long)_ns); \ + } \ + memcpy(st->buf + st->size, bufptr, _bs); \ + /* Convenient nul-termination */ \ + st->buf[_es] = '\0'; \ + st->size = _es; \ + } while(0) + +/* + * The main reason why ASN.1 is still alive is that too much time and effort + * is necessary for learning it more or less adequately, thus creating a gut + * necessity to demonstrate that aquired skill everywhere afterwards. + * No, I am not going to explain what the following stuff is. + */ +struct _stack_el { + ber_tlv_len_t left; /* What's left to read (or -1) */ + ber_tlv_len_t got; /* What was actually processed */ + int cont_level; /* Depth of subcontainment */ + int want_nulls; /* Want null "end of content" octets? */ + int bits_chopped; /* Flag in BIT STRING mode */ + ber_tlv_tag_t tag; /* For debugging purposes */ + struct _stack_el *prev; + struct _stack_el *next; +}; +struct _stack { + struct _stack_el *tail; + struct _stack_el *cur_ptr; +}; + +static struct _stack_el * +OS__add_stack_el(struct _stack *st) { + struct _stack_el *nel; + + /* + * Reuse the old stack frame or allocate a new one. + */ + if(st->cur_ptr && st->cur_ptr->next) { + nel = st->cur_ptr->next; + nel->bits_chopped = 0; + nel->got = 0; + /* Retain the nel->cont_level, it's correct. */ + } else { + nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); + if(nel == NULL) + return NULL; + + if(st->tail) { + /* Increase a subcontainment depth */ + nel->cont_level = st->tail->cont_level + 1; + st->tail->next = nel; + } + nel->prev = st->tail; + st->tail = nel; + } + + st->cur_ptr = nel; + + return nel; +} + +static struct _stack * +_new_stack() { + return (struct _stack *)CALLOC(1, sizeof(struct _stack)); +} + +/* + * Decode OCTET STRING type. + */ +asn_dec_rval_t +OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const void *buf_ptr, size_t size, int tag_mode) { + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + asn_dec_rval_t rval; + asn_struct_ctx_t *ctx; + ssize_t consumed_myself = 0; + struct _stack *stck; /* Expectations stack structure */ + struct _stack_el *sel = 0; /* Stack element */ + int tlv_constr; + enum asn_OS_Subvariant type_variant = specs->subvariant; + + ASN_DEBUG("Decoding %s as %s (frame %ld)", + td->name, + (type_variant == ASN_OSUBV_STR) ? + "OCTET STRING" : "OS-SpecialCase", + (long)size); + + /* + * Create the string if does not exist. + */ + if(st == NULL) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(st == NULL) RETURN(RC_FAIL); + } + + /* Restore parsing context */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + switch(ctx->phase) { + case 0: + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, ctx, + buf_ptr, size, tag_mode, -1, + &ctx->left, &tlv_constr); + if(rval.code != RC_OK) + return rval; + + if(tlv_constr) { + /* + * Complex operation, requires stack of expectations. + */ + ctx->ptr = _new_stack(); + if(ctx->ptr) { + stck = (struct _stack *)ctx->ptr; + } else { + RETURN(RC_FAIL); + } + } else { + /* + * Jump into stackless primitive decoding. + */ + _CH_PHASE(ctx, 3); + if(type_variant == ASN_OSUBV_ANY && tag_mode != 1) + APPEND(buf_ptr, rval.consumed); + ADVANCE(rval.consumed); + goto phase3; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + phase1: + /* + * Fill the stack with expectations. + */ + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + do { + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_tag_t expected_tag; + ssize_t tl, ll, tlvl; + /* This one works even if (sel->left == -1) */ + ssize_t Left = ((!sel||(size_t)sel->left >= size) + ?(ssize_t)size:sel->left); + + + ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, + (long)(sel?sel->left:0), + (long)(sel?sel->want_nulls:0), + (long)(sel?sel->got:0) + ); + if(sel && sel->left <= 0 && sel->want_nulls == 0) { + if(sel->prev) { + struct _stack_el *prev = sel->prev; + if(prev->left != -1) { + if(prev->left < sel->got) + RETURN(RC_FAIL); + prev->left -= sel->got; + } + prev->got += sel->got; + sel = stck->cur_ptr = prev; + if(!sel) break; + tlv_constr = 1; + continue; + } else { + sel = stck->cur_ptr = 0; + break; /* Nothing to wait */ + } + } + + tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); + ASN_DEBUG("fetch tag(size=%ld,L=%ld), %sstack, left=%ld, wn=%ld, tl=%ld", + (long)size, (long)Left, sel?"":"!", + (long)(sel?sel->left:0), + (long)(sel?sel->want_nulls:0), + (long)tl); + switch(tl) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); + + ll = ber_fetch_length(tlv_constr, + (const char *)buf_ptr + tl,Left - tl,&tlv_len); + ASN_DEBUG("Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld", + ber_tlv_tag_string(tlv_tag), tlv_constr, + (long)Left, (long)tl, (long)tlv_len, (long)ll); + switch(ll) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + if(sel && sel->want_nulls + && ((const uint8_t *)buf_ptr)[0] == 0 + && ((const uint8_t *)buf_ptr)[1] == 0) + { + + ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); + + if(type_variant == ASN_OSUBV_ANY + && (tag_mode != 1 || sel->cont_level)) + APPEND("\0\0", 2); + + ADVANCE(2); + sel->got += 2; + if(sel->left != -1) { + sel->left -= 2; /* assert(sel->left >= 2) */ + } + + sel->want_nulls--; + if(sel->want_nulls == 0) { + /* Move to the next expectation */ + sel->left = 0; + tlv_constr = 1; + } + + continue; + } + + /* + * Set up expected tags, + * depending on ASN.1 type being decoded. + */ + switch(type_variant) { + case ASN_OSUBV_BIT: + /* X.690: 8.6.4.1, NOTE 2 */ + /* Fall through */ + case ASN_OSUBV_STR: + default: + if(sel) { + int level = sel->cont_level; + if(level < td->all_tags_count) { + expected_tag = td->all_tags[level]; + break; + } else if(td->all_tags_count) { + expected_tag = td->all_tags + [td->all_tags_count - 1]; + break; + } + /* else, Fall through */ + } + /* Fall through */ + case ASN_OSUBV_ANY: + expected_tag = tlv_tag; + break; + } + + + if(tlv_tag != expected_tag) { + char buf[2][32]; + ber_tlv_tag_snprint(tlv_tag, + buf[0], sizeof(buf[0])); + ber_tlv_tag_snprint(td->tags[td->tags_count-1], + buf[1], sizeof(buf[1])); + ASN_DEBUG("Tag does not match expectation: %s != %s", + buf[0], buf[1]); + RETURN(RC_FAIL); + } + + tlvl = tl + ll; /* Combined length of T and L encoding */ + if((tlv_len + tlvl) < 0) { + /* tlv_len value is too big */ + ASN_DEBUG("TLV encoding + length (%ld) is too big", + (long)tlv_len); + RETURN(RC_FAIL); + } + + /* + * Append a new expectation. + */ + sel = OS__add_stack_el(stck); + if(!sel) RETURN(RC_FAIL); + + sel->tag = tlv_tag; + + sel->want_nulls = (tlv_len==-1); + if(sel->prev && sel->prev->left != -1) { + /* Check that the parent frame is big enough */ + if(sel->prev->left < tlvl + (tlv_len==-1?0:tlv_len)) + RETURN(RC_FAIL); + if(tlv_len == -1) + sel->left = sel->prev->left - tlvl; + else + sel->left = tlv_len; + } else { + sel->left = tlv_len; + } + if(type_variant == ASN_OSUBV_ANY + && (tag_mode != 1 || sel->cont_level)) + APPEND(buf_ptr, tlvl); + sel->got += tlvl; + ADVANCE(tlvl); + + ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", + (long)sel->got, (long)sel->left, + sel->want_nulls, sel->cont_level); + + } while(tlv_constr); + if(sel == NULL) { + /* Finished operation, "phase out" */ + ASN_DEBUG("Phase out"); + _CH_PHASE(ctx, +3); + break; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 2: + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", + (long)sel->left, (long)size, (long)sel->got, + sel->want_nulls); + { + ber_tlv_len_t len; + + assert(sel->left >= 0); + + len = ((ber_tlv_len_t)size < sel->left) + ? (ber_tlv_len_t)size : sel->left; + if(len > 0) { + if(type_variant == ASN_OSUBV_BIT + && sel->bits_chopped == 0) { + /* Put the unused-bits-octet away */ + st->bits_unused = *(const uint8_t *)buf_ptr; + APPEND(((const char *)buf_ptr+1), (len - 1)); + sel->bits_chopped = 1; + } else { + APPEND(buf_ptr, len); + } + ADVANCE(len); + sel->left -= len; + sel->got += len; + } + + if(sel->left) { + ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", + (long)sel->left, (long)size, sel->want_nulls); + RETURN(RC_WMORE); + } + + PREV_PHASE(ctx); + goto phase1; + } + break; + case 3: + phase3: + /* + * Primitive form, no stack required. + */ + assert(ctx->left >= 0); + + if(size < (size_t)ctx->left) { + if(!size) RETURN(RC_WMORE); + if(type_variant == ASN_OSUBV_BIT && !ctx->context) { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, size); + assert(ctx->context > 0); + ctx->left -= size; + ADVANCE(size); + RETURN(RC_WMORE); + } else { + if(type_variant == ASN_OSUBV_BIT + && !ctx->context && ctx->left) { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, ctx->left); + ADVANCE(ctx->left); + ctx->left = 0; + + NEXT_PHASE(ctx); + } + break; + } + + if(sel) { + ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", + sel->prev, sel->want_nulls, + (long)sel->left, (long)sel->got, (long)size); + if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { + RETURN(RC_WMORE); + } + } + + /* + * BIT STRING-specific processing. + */ + if(type_variant == ASN_OSUBV_BIT && st->size) { + /* Finalize BIT STRING: zero out unused bits. */ + st->buf[st->size-1] &= 0xff << st->bits_unused; + } + + ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", + (long)consumed_myself, td->name, + (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", + (long)st->size); + + + RETURN(RC_OK); +} + +/* + * Encode OCTET STRING type using DER. + */ +asn_enc_rval_t +OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + BIT_STRING_t *st = (BIT_STRING_t *)sptr; + enum asn_OS_Subvariant type_variant = specs->subvariant; + int fix_last_byte = 0; + + ASN_DEBUG("%s %s as OCTET STRING", + cb?"Estimating":"Encoding", td->name); + + /* + * Write tags. + */ + if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) { + er.encoded = der_write_tags(td, + (type_variant == ASN_OSUBV_BIT) + st->size, + tag_mode, type_variant == ASN_OSUBV_ANY, tag, + cb, app_key); + if(er.encoded == -1) { + er.failed_type = td; + er.structure_ptr = sptr; + return er; + } + } else { + /* Disallow: [] IMPLICIT ANY */ + assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); + er.encoded = 0; + } + + if(!cb) { + er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; + ASN__ENCODED_OK(er); + } + + /* + * Prepare to deal with the last octet of BIT STRING. + */ + if(type_variant == ASN_OSUBV_BIT) { + uint8_t b = st->bits_unused & 0x07; + if(b && st->size) fix_last_byte = 1; + ASN__CALLBACK(&b, 1); + er.encoded++; + } + + /* Invoke callback for the main part of the buffer */ + ASN__CALLBACK(st->buf, st->size - fix_last_byte); + + /* The last octet should be stripped off the unused bits */ + if(fix_last_byte) { + uint8_t b = st->buf[st->size-1] & (0xff << st->bits_unused); + ASN__CALLBACK(&b, 1); + } + + er.encoded += st->size; + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +asn_enc_rval_t +OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + const char * const h2c = "0123456789ABCDEF"; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + asn_enc_rval_t er; + char scratch[16 * 3 + 4]; + char *p = scratch; + uint8_t *buf; + uint8_t *end; + size_t i; + + if(!st || (!st->buf && st->size)) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + /* + * Dump the contents of the buffer in hexadecimal. + */ + buf = st->buf; + end = buf + st->size; + if(flags & XER_F_CANONICAL) { + char *scend = scratch + (sizeof(scratch) - 2); + for(; buf < end; buf++) { + if(p >= scend) { + ASN__CALLBACK(scratch, p - scratch); + er.encoded += p - scratch; + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + } + + ASN__CALLBACK(scratch, p-scratch); /* Dump the rest */ + er.encoded += p - scratch; + } else { + for(i = 0; buf < end; buf++, i++) { + if(!(i % 16) && (i || st->size > 16)) { + ASN__CALLBACK(scratch, p-scratch); + er.encoded += (p-scratch); + p = scratch; + ASN__TEXT_INDENT(1, ilevel); + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + if(p - scratch) { + p--; /* Remove the tail space */ + ASN__CALLBACK(scratch, p-scratch); /* Dump the rest */ + er.encoded += p - scratch; + if(st->size > 16) + ASN__TEXT_INDENT(1, ilevel-1); + } + } + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +static const struct OCTET_STRING__xer_escape_table_s { + const char *string; + int size; +} OCTET_STRING__xer_escape_table[] = { +#define OSXET(s) { s, sizeof(s) - 1 } + OSXET("\074\156\165\154\057\076"), /* */ + OSXET("\074\163\157\150\057\076"), /* */ + OSXET("\074\163\164\170\057\076"), /* */ + OSXET("\074\145\164\170\057\076"), /* */ + OSXET("\074\145\157\164\057\076"), /* */ + OSXET("\074\145\156\161\057\076"), /* */ + OSXET("\074\141\143\153\057\076"), /* */ + OSXET("\074\142\145\154\057\076"), /* */ + OSXET("\074\142\163\057\076"), /* */ + OSXET("\011"), /* \t */ + OSXET("\012"), /* \n */ + OSXET("\074\166\164\057\076"), /* */ + OSXET("\074\146\146\057\076"), /* */ + OSXET("\015"), /* \r */ + OSXET("\074\163\157\057\076"), /* */ + OSXET("\074\163\151\057\076"), /* */ + OSXET("\074\144\154\145\057\076"), /* */ + OSXET("\074\144\143\061\057\076"), /* */ + OSXET("\074\144\143\062\057\076"), /* */ + OSXET("\074\144\143\063\057\076"), /* */ + OSXET("\074\144\143\064\057\076"), /* */ + OSXET("\074\156\141\153\057\076"), /* */ + OSXET("\074\163\171\156\057\076"), /* */ + OSXET("\074\145\164\142\057\076"), /* */ + OSXET("\074\143\141\156\057\076"), /* */ + OSXET("\074\145\155\057\076"), /* */ + OSXET("\074\163\165\142\057\076"), /* */ + OSXET("\074\145\163\143\057\076"), /* */ + OSXET("\074\151\163\064\057\076"), /* */ + OSXET("\074\151\163\063\057\076"), /* */ + OSXET("\074\151\163\062\057\076"), /* */ + OSXET("\074\151\163\061\057\076"), /* */ + { 0, 0 }, /* " " */ + { 0, 0 }, /* ! */ + { 0, 0 }, /* \" */ + { 0, 0 }, /* # */ + { 0, 0 }, /* $ */ + { 0, 0 }, /* % */ + OSXET("\046\141\155\160\073"), /* & */ + { 0, 0 }, /* ' */ + {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */ + {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */ + {0,0},{0,0},{0,0},{0,0}, /* 89:; */ + OSXET("\046\154\164\073"), /* < */ + { 0, 0 }, /* = */ + OSXET("\046\147\164\073"), /* > */ +}; + +static int +OS__check_escaped_control_char(const void *buf, int size) { + size_t i; + /* + * Inefficient algorithm which translates the escape sequences + * defined above into characters. Returns -1 if not found. + * TODO: replace by a faster algorithm (bsearch(), hash or + * nested table lookups). + */ + for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) { + const struct OCTET_STRING__xer_escape_table_s *el; + el = &OCTET_STRING__xer_escape_table[i]; + if(el->size == size && memcmp(buf, el->string, size) == 0) + return i; + } + return -1; +} + +static int +OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) { + /* + * This might be one of the escape sequences + * for control characters. Check it out. + * #11.15.5 + */ + int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size); + if(control_char >= 0) { + OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; + void *p = REALLOC(st->buf, st->size + 2); + if(p) { + st->buf = (uint8_t *)p; + st->buf[st->size++] = control_char; + st->buf[st->size] = '\0'; /* nul-termination */ + return 0; + } + } + + return -1; /* No, it's not */ +} + +asn_enc_rval_t +OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + asn_enc_rval_t er; + uint8_t *buf, *end; + uint8_t *ss; /* Sequence start */ + ssize_t encoded_len = 0; + + (void)ilevel; /* Unused argument */ + (void)flags; /* Unused argument */ + + if(!st || (!st->buf && st->size)) + ASN__ENCODE_FAILED; + + buf = st->buf; + end = buf + st->size; + for(ss = buf; buf < end; buf++) { + unsigned int ch = *buf; + int s_len; /* Special encoding sequence length */ + + /* + * Escape certain characters: X.680/11.15 + */ + if(ch < sizeof(OCTET_STRING__xer_escape_table) + /sizeof(OCTET_STRING__xer_escape_table[0]) + && (s_len = OCTET_STRING__xer_escape_table[ch].size)) { + if(((buf - ss) && cb(ss, buf - ss, app_key) < 0) + || cb(OCTET_STRING__xer_escape_table[ch].string, s_len, + app_key) < 0) + ASN__ENCODE_FAILED; + encoded_len += (buf - ss) + s_len; + ss = buf + 1; + } + } + + encoded_len += (buf - ss); + if((buf - ss) && cb(ss, buf - ss, app_key) < 0) + ASN__ENCODE_FAILED; + + er.encoded = encoded_len; + ASN__ENCODED_OK(er); +} + +/* + * Convert from hexadecimal format (cstring): "AB CD EF" + */ +static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + const char *chunk_stop = (const char *)chunk_buf; + const char *p = chunk_stop; + const char *pend = p + chunk_size; + unsigned int clv = 0; + int half = 0; /* Half bit */ + uint8_t *buf; + + /* Reallocate buffer according to high cap estimation */ + ssize_t _ns = st->size + (chunk_size + 1) / 2; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + /* + * If something like " a b c " appears here, the " a b":3 will be + * converted, and the rest skipped. That is, unless buf_size is greater + * than chunk_size, then it'll be equivalent to "ABC0". + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + switch(ch) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* Ignore whitespace */ + continue; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ + clv = (clv << 4) + (ch - 0x30); + break; + case 0x41: case 0x42: case 0x43: /* ABC */ + case 0x44: case 0x45: case 0x46: /* DEF */ + clv = (clv << 4) + (ch - 0x41 + 10); + break; + case 0x61: case 0x62: case 0x63: /* abc */ + case 0x64: case 0x65: case 0x66: /* def */ + clv = (clv << 4) + (ch - 0x61 + 10); + break; + default: + *buf = 0; /* JIC */ + return -1; + } + if(half++) { + half = 0; + *buf++ = clv; + chunk_stop = p + 1; + } + } + + /* + * Check partial decoding. + */ + if(half) { + if(have_more) { + /* + * Partial specification is fine, + * because no more more PXER_TEXT data is available. + */ + *buf++ = clv << 4; + chunk_stop = p; + } + } else { + chunk_stop = p; + } + + st->size = buf - st->buf; /* Adjust the buffer size */ + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return (chunk_stop - (const char *)chunk_buf); /* Converted size */ +} + +/* + * Convert from binary format: "00101011101" + */ +static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + BIT_STRING_t *st = (BIT_STRING_t *)sptr; + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + int bits_unused = st->bits_unused & 0x7; + uint8_t *buf; + + /* Reallocate buffer according to high cap estimation */ + ssize_t _ns = st->size + (chunk_size + 7) / 8; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + (void)have_more; + + if(bits_unused == 0) + bits_unused = 8; + else if(st->size) + buf--; + + /* + * Convert series of 0 and 1 into the octet string. + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + switch(ch) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* Ignore whitespace */ + break; + case 0x30: + case 0x31: + if(bits_unused-- <= 0) { + *++buf = 0; /* Clean the cell */ + bits_unused = 7; + } + *buf |= (ch&1) << bits_unused; + break; + default: + st->bits_unused = bits_unused; + return -1; + } + } + + if(bits_unused == 8) { + st->size = buf - st->buf; + st->bits_unused = 0; + } else { + st->size = buf - st->buf + 1; + st->bits_unused = bits_unused; + } + + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return chunk_size; /* Converted in full */ +} + +/* + * Something like strtod(), but with stricter rules. + */ +static int +OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { + int32_t val = 0; + const char *p; + + for(p = buf; p < end; p++) { + int ch = *p; + + /* Strange huge value */ + if((val * base + base) < 0) + return -1; + + switch(ch) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ + val = val * base + (ch - 0x30); + break; + case 0x41: case 0x42: case 0x43: /* ABC */ + case 0x44: case 0x45: case 0x46: /* DEF */ + val = val * base + (ch - 0x41 + 10); + break; + case 0x61: case 0x62: case 0x63: /* abc */ + case 0x64: case 0x65: case 0x66: /* def */ + val = val * base + (ch - 0x61 + 10); + break; + case 0x3b: /* ';' */ + *ret_value = val; + return (p - buf) + 1; + default: + return -1; /* Character set error */ + } + } + + *ret_value = -1; + return (p - buf); +} + +/* + * Convert from the plain UTF-8 format, expanding entity references: "2 < 3" + */ +static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + uint8_t *buf; + + /* Reallocate buffer */ + ssize_t _ns = st->size + chunk_size; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + /* + * Convert series of 0 and 1 into the octet string. + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + int len; /* Length of the rest of the chunk */ + + if(ch != 0x26 /* '&' */) { + *buf++ = ch; + continue; /* That was easy... */ + } + + /* + * Process entity reference. + */ + len = chunk_size - (p - (const char *)chunk_buf); + if(len == 1 /* "&" */) goto want_more; + if(p[1] == 0x23 /* '#' */) { + const char *pval; /* Pointer to start of digits */ + int32_t val = 0; /* Entity reference value */ + int base; + + if(len == 2 /* "&#" */) goto want_more; + if(p[2] == 0x78 /* 'x' */) + pval = p + 3, base = 16; + else + pval = p + 2, base = 10; + len = OS__strtoent(base, pval, p + len, &val); + if(len == -1) { + /* Invalid charset. Just copy verbatim. */ + *buf++ = ch; + continue; + } + if(!len || pval[len-1] != 0x3b) goto want_more; + assert(val > 0); + p += (pval - p) + len - 1; /* Advance past entref */ + + if(val < 0x80) { + *buf++ = (char)val; + } else if(val < 0x800) { + *buf++ = 0xc0 | ((val >> 6)); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x10000) { + *buf++ = 0xe0 | ((val >> 12)); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x200000) { + *buf++ = 0xf0 | ((val >> 18)); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x4000000) { + *buf++ = 0xf8 | ((val >> 24)); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else { + *buf++ = 0xfc | ((val >> 30) & 0x1); + *buf++ = 0x80 | ((val >> 24) & 0x3f); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + } else { + /* + * Ugly, limited parsing of & > < + */ + char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); + if(!sc) goto want_more; + if((sc - p) == 4 + && p[1] == 0x61 /* 'a' */ + && p[2] == 0x6d /* 'm' */ + && p[3] == 0x70 /* 'p' */) { + *buf++ = 0x26; + p = sc; + continue; + } + if((sc - p) == 3) { + if(p[1] == 0x6c) { + *buf = 0x3c; /* '<' */ + } else if(p[1] == 0x67) { + *buf = 0x3e; /* '>' */ + } else { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + if(p[2] != 0x74) { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + buf++; + p = sc; + continue; + } + /* Unsupported entity reference */ + *buf++ = ch; + } + + continue; + want_more: + if(have_more) { + /* + * We know that no more data (of the same type) + * is coming. Copy the rest verbatim. + */ + *buf++ = ch; + continue; + } + chunk_size = (p - (const char *)chunk_buf); + /* Processing stalled: need more data */ + break; + } + + st->size = buf - st->buf; + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return chunk_size; /* Converted in full */ +} + +/* + * Decode OCTET STRING from the XML element's body. + */ +static asn_dec_rval_t +OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_ptr, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_ptr, const void *chunk_buf, size_t chunk_size, + int have_more) +) { + OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr; + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + asn_struct_ctx_t *ctx; /* Per-structure parser context */ + asn_dec_rval_t rval; /* Return value from the decoder */ + int st_allocated; + + /* + * Create the string if does not exist. + */ + if(!st) { + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + *sptr = (void *)st; + if(!st) goto sta_failed; + st_allocated = 1; + } else { + st_allocated = 0; + } + if(!st->buf) { + /* This is separate from above section */ + st->buf = (uint8_t *)CALLOC(1, 1); + if(!st->buf) { + if(st_allocated) { + *sptr = 0; + goto stb_failed; + } else { + goto sta_failed; + } + } + } + + /* Restore parsing context */ + ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset); + + return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, + buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); + +stb_failed: + FREEMEM(st); +sta_failed: + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; +} + +/* + * Decode OCTET STRING from the hexadecimal data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal); +} + +/* + * Decode OCTET STRING from the binary (0/1) data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, 0, OCTET_STRING__convert_binary); +} + +/* + * Decode OCTET STRING from the string (ASCII/UTF-8) data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, + OCTET_STRING__handle_control_chars, + OCTET_STRING__convert_entrefs); +} + +static int +OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, + size_t units, unsigned int bpc, unsigned int unit_bits, + long lb, long ub, asn_per_constraints_t *pc) { + uint8_t *end = buf + units * bpc; + + ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", + (int)units, lb, ub, unit_bits); + + /* X.691: 27.5.4 */ + if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + /* Decode without translation */ + lb = 0; + } else if(pc && pc->code2value) { + if(unit_bits > 16) + return 1; /* FATAL: can't have constrained + * UniversalString with more than + * 16 million code points */ + for(; buf < end; buf += bpc) { + int value; + int code = per_get_few_bits(po, unit_bits); + if(code < 0) return -1; /* WMORE */ + value = pc->code2value(code); + if(value < 0) { + ASN_DEBUG("Code %d (0x%02x) is" + " not in map (%ld..%ld)", + code, code, lb, ub); + return 1; /* FATAL */ + } + switch(bpc) { + case 1: *buf = value; break; + case 2: buf[0] = value >> 8; buf[1] = value; break; + case 4: buf[0] = value >> 24; buf[1] = value >> 16; + buf[2] = value >> 8; buf[3] = value; break; + } + } + return 0; + } + + /* Shortcut the no-op copying to the aligned structure */ + if(lb == 0 && (unit_bits == 8 * bpc)) { + return per_get_many_bits(po, buf, 0, unit_bits * units); + } + + for(; buf < end; buf += bpc) { + int code = per_get_few_bits(po, unit_bits); + int ch = code + lb; + if(code < 0) return -1; /* WMORE */ + if(ch > ub) { + ASN_DEBUG("Code %d is out of range (%ld..%ld)", + ch, lb, ub); + return 1; /* FATAL */ + } + switch(bpc) { + case 1: *buf = ch; break; + case 2: buf[0] = ch >> 8; buf[1] = ch; break; + case 4: buf[0] = ch >> 24; buf[1] = ch >> 16; + buf[2] = ch >> 8; buf[3] = ch; break; + } + } + + return 0; +} + +static int +OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, + size_t units, unsigned int bpc, unsigned int unit_bits, + long lb, long ub, asn_per_constraints_t *pc) { + const uint8_t *end = buf + units * bpc; + + ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", + (int)units, lb, ub, unit_bits, bpc); + + /* X.691: 27.5.4 */ + if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + /* Encode as is */ + lb = 0; + } else if(pc && pc->value2code) { + for(; buf < end; buf += bpc) { + int code; + uint32_t value; + switch(bpc) { + case 1: value = *(const uint8_t *)buf; break; + case 2: value = (buf[0] << 8) | buf[1]; break; + case 4: value = (buf[0] << 24) | (buf[1] << 16) + | (buf[2] << 8) | buf[3]; break; + default: return -1; + } + code = pc->value2code(value); + if(code < 0) { + ASN_DEBUG("Character %d (0x%02x) is" + " not in map (%ld..%ld)", + *buf, *buf, lb, ub); + return -1; + } + if(per_put_few_bits(po, code, unit_bits)) + return -1; + } + } + + /* Shortcut the no-op copying to the aligned structure */ + if(lb == 0 && (unit_bits == 8 * bpc)) { + return per_put_many_bits(po, buf, unit_bits * units); + } + + for(ub -= lb; buf < end; buf += bpc) { + int ch; + uint32_t value; + switch(bpc) { + case 1: value = *(const uint8_t *)buf; break; + case 2: value = (buf[0] << 8) | buf[1]; break; + case 4: value = (buf[0] << 24) | (buf[1] << 16) + | (buf[2] << 8) | buf[3]; break; + default: return -1; + } + ch = value - lb; + if(ch < 0 || ch > ub) { + ASN_DEBUG("Character %d (0x%02x)" + " is out of range (%ld..%ld)", + *buf, *buf, lb, ub + lb); + return -1; + } + if(per_put_few_bits(po, ch, unit_bits)) + return -1; + } + + return 0; +} + +asn_dec_rval_t +OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + asn_dec_rval_t rval = { RC_OK, 0 }; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + ssize_t consumed_myself = 0; + int repeat; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + + (void)opt_codec_ctx; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + + switch(specs->subvariant) { + default: + case ASN_OSUBV_ANY: + ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); + RETURN(RC_FAIL); + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + break; + } + + /* + * Allocate the string. + */ + if(!st) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(!st) RETURN(RC_FAIL); + } + + ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + + if(csiz->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) RETURN(RC_WMORE); + if(inext) { + csiz = &asn_DEF_OCTET_STRING_constraints.size; + cval = &asn_DEF_OCTET_STRING_constraints.value; + unit_bits = canonical_unit_bits; + } + } + + if(csiz->effective_bits >= 0) { + FREEMEM(st->buf); + if(bpc) { + st->size = csiz->upper_bound * bpc; + } else { + st->size = (csiz->upper_bound + 7) >> 3; + } + st->buf = (uint8_t *)MALLOC(st->size + 1); + if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits == 0) { + int ret; + if(bpc) { + ASN_DEBUG("Encoding OCTET STRING size %ld", + csiz->upper_bound); + ret = OCTET_STRING_per_get_characters(pd, st->buf, + csiz->upper_bound, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ASN_DEBUG("Encoding BIT STRING size %ld", + csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, + unit_bits * csiz->upper_bound); + } + if(ret < 0) RETURN(RC_WMORE); + consumed_myself += unit_bits * csiz->upper_bound; + st->buf[st->size] = 0; + if(bpc == 0) { + int ubs = (csiz->upper_bound & 0x7); + st->bits_unused = ubs ? 8 - ubs : 0; + } + RETURN(RC_OK); + } + + st->size = 0; + do { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; + + /* Get the PER length */ + raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); + if(raw_len < 0) RETURN(RC_WMORE); + raw_len += csiz->lower_bound; + + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + if(bpc) { + len_bytes = raw_len * bpc; + len_bits = len_bytes * unit_bits; + } else { + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if(len_bits & 0x7) + st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + } + p = REALLOC(st->buf, st->size + len_bytes + 1); + if(!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + if(bpc) { + ret = OCTET_STRING_per_get_characters(pd, + &st->buf[st->size], raw_len, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ret = per_get_many_bits(pd, &st->buf[st->size], + 0, len_bits); + } + if(ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; + } while(repeat); + st->buf[st->size] = 0; /* nul-terminate */ + + return rval; +} + +asn_enc_rval_t +OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; + int inext = 0; /* Lies not within extension root */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + unsigned int sizeinunits; + const uint8_t *buf; + int ret; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + int ct_extensible; + + if(!st || (!st->buf && st->size)) + ASN__ENCODE_FAILED; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + ct_extensible = csiz->flags & APC_EXTENSIBLE; + + switch(specs->subvariant) { + default: + case ASN_OSUBV_ANY: + ASN__ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", + sizeinunits, st->bits_unused); + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + sizeinunits = st->size; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + sizeinunits = st->size / 2; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + sizeinunits = st->size / 4; + break; + } + + ASN_DEBUG("Encoding %s into %d units of %d bits" + " (%ld..%ld, effective %d)%s", + td->name, sizeinunits, unit_bits, + csiz->lower_bound, csiz->upper_bound, + csiz->effective_bits, ct_extensible ? " EXT" : ""); + + /* Figure out whether size lies within PER visible constraint */ + + if(csiz->effective_bits >= 0) { + if((int)sizeinunits < csiz->lower_bound + || (int)sizeinunits > csiz->upper_bound) { + if(ct_extensible) { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + unit_bits = canonical_unit_bits; + inext = 1; + } else + ASN__ENCODE_FAILED; + } + } else { + inext = 0; + } + + if(ct_extensible) { + /* Declare whether length is [not] within extension root */ + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits >= 0) { + ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", + st->size, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + if(ret) ASN__ENCODE_FAILED; + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, st->buf, + sizeinunits, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, st->buf, + sizeinunits * unit_bits); + } + if(ret) ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + ASN_DEBUG("Encoding %d bytes", st->size); + + if(sizeinunits == 0) { + if(uper_put_length(po, 0)) + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + buf = st->buf; + while(sizeinunits) { + ssize_t maySave = uper_put_length(po, sizeinunits); + if(maySave < 0) ASN__ENCODE_FAILED; + + ASN_DEBUG("Encoding %ld of %ld", + (long)maySave, (long)sizeinunits); + + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, buf, + maySave, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, buf, maySave * unit_bits); + } + if(ret) ASN__ENCODE_FAILED; + + if(bpc) + buf += maySave * bpc; + else + buf += maySave >> 3; + sizeinunits -= maySave; + assert(!(maySave & 0x07) || !sizeinunits); + } + + ASN__ENCODED_OK(er); +} + +int +OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const char * const h2c = "0123456789ABCDEF"; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + char scratch[16 * 3 + 4]; + char *p = scratch; + uint8_t *buf; + uint8_t *end; + size_t i; + + (void)td; /* Unused argument */ + + if(!st || (!st->buf && st->size)) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* + * Dump the contents of the buffer in hexadecimal. + */ + buf = st->buf; + end = buf + st->size; + for(i = 0; buf < end; buf++, i++) { + if(!(i % 16) && (i || st->size > 16)) { + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + _i_INDENT(1); + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Remove the tail space */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + return 0; +} + +int +OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(st && (st->buf || !st->size)) { + return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + asn_OCTET_STRING_specifics_t *specs; + asn_struct_ctx_t *ctx; + struct _stack *stck; + + if(!td || !st) + return; + + specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + ASN_DEBUG("Freeing %s as OCTET STRING", td->name); + + if(st->buf) { + FREEMEM(st->buf); + st->buf = 0; + } + + /* + * Remove decode-time stack. + */ + stck = (struct _stack *)ctx->ptr; + if(stck) { + while(stck->tail) { + struct _stack_el *sel = stck->tail; + stck->tail = sel->prev; + FREEMEM(sel); + } + FREEMEM(stck); + } + + if(!contents_only) { + FREEMEM(st); + } +} + +/* + * Conversion routines. + */ +int +OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { + void *buf; + + if(st == 0 || (str == 0 && len)) { + errno = EINVAL; + return -1; + } + + /* + * Clear the OCTET STRING. + */ + if(str == NULL) { + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + return 0; + } + + /* Determine the original string size, if not explicitly given */ + if(len < 0) + len = strlen(str); + + /* Allocate and fill the memory */ + buf = MALLOC(len + 1); + if(buf == NULL) + return -1; + + memcpy(buf, str, len); + ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ + FREEMEM(st->buf); + st->buf = (uint8_t *)buf; + st->size = len; + + return 0; +} + +OCTET_STRING_t * +OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + OCTET_STRING_t *st; + + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + if(st && str && OCTET_STRING_fromBuf(st, str, len)) { + FREEMEM(st); + st = NULL; + } + + return st; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/OCTET_STRING.h b/plugins/inmarsat_support/aero/libacars/asn1/OCTET_STRING.h new file mode 100644 index 000000000..75c995de9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/OCTET_STRING.h @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _OCTET_STRING_H_ +#define _OCTET_STRING_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OCTET_STRING { + uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */ + int size; /* Size of the buffer */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} OCTET_STRING_t; + +extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING; + +asn_struct_free_f OCTET_STRING_free; +asn_struct_print_f OCTET_STRING_print; +asn_struct_print_f OCTET_STRING_print_utf8; +ber_type_decoder_f OCTET_STRING_decode_ber; +der_type_encoder_f OCTET_STRING_encode_der; +xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */ +xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */ +xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */ +xer_type_encoder_f OCTET_STRING_encode_xer; +xer_type_encoder_f OCTET_STRING_encode_xer_utf8; +per_type_decoder_f OCTET_STRING_decode_uper; +per_type_encoder_f OCTET_STRING_encode_uper; + +/****************************** + * Handy conversion routines. * + ******************************/ + +/* + * This function clears the previous value of the OCTET STRING (if any) + * and then allocates a new memory with the specified content (str/size). + * If size = -1, the size of the original string will be determined + * using strlen(str). + * If str equals to NULL, the function will silently clear the + * current contents of the OCTET STRING. + * Returns 0 if it was possible to perform operation, -1 otherwise. + */ +int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size); + +/* Handy conversion from the C string into the OCTET STRING. */ +#define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1) + +/* + * Allocate and fill the new OCTET STRING and return a pointer to the newly + * allocated object. NULL is permitted in str: the function will just allocate + * empty OCTET STRING. + */ +OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, + const char *str, int size); + +/**************************** + * Internally useful stuff. * + ****************************/ + +typedef const struct asn_OCTET_STRING_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the structure */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + enum asn_OS_Subvariant { + ASN_OSUBV_ANY, /* The open type (ANY) */ + ASN_OSUBV_BIT, /* BIT STRING */ + ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */ + ASN_OSUBV_U16, /* 16-bit character (BMPString) */ + ASN_OSUBV_U32 /* 32-bit character (UniversalString) */ + } subvariant; +} asn_OCTET_STRING_specifics_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _OCTET_STRING_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_SEQUENCE_OF.c b/plugins/inmarsat_support/aero/libacars/asn1/asn_SEQUENCE_OF.c new file mode 100644 index 000000000..f65b3ee73 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_SEQUENCE_OF.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "asn_SEQUENCE_OF.h" + +typedef A_SEQUENCE_OF(void) asn_sequence; + +void +asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) { + asn_sequence *as = (asn_sequence *)asn_sequence_of_x; + + if(as) { + void *ptr; + int n; + + if(number < 0 || number >= as->count) + return; /* Nothing to delete */ + + if(_do_free && as->free) { + ptr = as->array[number]; + } else { + ptr = 0; + } + + /* + * Shift all elements to the left to hide the gap. + */ + --as->count; + for(n = number; n < as->count; n++) + as->array[n] = as->array[n+1]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if(ptr) as->free(ptr); + } +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_SEQUENCE_OF.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_SEQUENCE_OF.h new file mode 100644 index 000000000..bc6020fae --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_SEQUENCE_OF.h @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_SEQUENCE_OF_H +#define ASN_SEQUENCE_OF_H + +#include "asn_SET_OF.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SEQUENCE OF is the same as SET OF with a tiny difference: + * the delete operation preserves the initial order of elements + * and thus MAY operate in non-constant time. + */ +#define A_SEQUENCE_OF(type) A_SET_OF(type) + +#define ASN_SEQUENCE_ADD(headptr, ptr) \ + asn_sequence_add((headptr), (ptr)) + +/*********************************************** + * Implementation of the SEQUENCE OF structure. + */ + +#define asn_sequence_add asn_set_add +#define asn_sequence_empty asn_set_empty + +/* + * Delete the element from the set by its number (base 0). + * This is NOT a constant-time operation. + * The order of elements is preserved. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ +void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); + +/* + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ +typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; +#define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) +#define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_SEQUENCE_OF_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_SET_OF.c b/plugins/inmarsat_support/aero/libacars/asn1/asn_SET_OF.c new file mode 100644 index 000000000..edf3eb30f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_SET_OF.c @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "asn_SET_OF.h" +#include + +/* + * Add another element into the set. + */ +int +asn_set_add(void *asn_set_of_x, void *ptr) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as == 0 || ptr == 0) { + errno = EINVAL; /* Invalid arguments */ + return -1; + } + + /* + * Make sure there's enough space to insert an element. + */ + if(as->count == as->size) { + int _newsize = as->size ? (as->size << 1) : 4; + void *_new_arr; + _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); + if(_new_arr) { + as->array = (void **)_new_arr; + as->size = _newsize; + } else { + /* ENOMEM */ + return -1; + } + } + + as->array[as->count++] = ptr; + + return 0; +} + +void +asn_set_del(void *asn_set_of_x, int number, int _do_free) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as) { + void *ptr; + if(number < 0 || number >= as->count) + return; + + if(_do_free && as->free) { + ptr = as->array[number]; + } else { + ptr = 0; + } + + as->array[number] = as->array[--as->count]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if(ptr) as->free(ptr); + } +} + +/* + * Free the contents of the set, do not free the set itself. + */ +void +asn_set_empty(void *asn_set_of_x) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as) { + if(as->array) { + if(as->free) { + while(as->count--) + as->free(as->array[as->count]); + } + FREEMEM(as->array); + as->array = 0; + } + as->count = 0; + as->size = 0; + } + +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_SET_OF.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_SET_OF.h new file mode 100644 index 000000000..7edf14b51 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_SET_OF.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_SET_OF_H +#define ASN_SET_OF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define A_SET_OF(type) \ + struct { \ + type **array; \ + int count; /* Meaningful size */ \ + int size; /* Allocated size */ \ + void (*free)(type *); \ + } + +#define ASN_SET_ADD(headptr, ptr) \ + asn_set_add((headptr), (ptr)) + +/******************************************* + * Implementation of the SET OF structure. + */ + +/* + * Add another structure into the set by its pointer. + * RETURN VALUES: + * 0 for success and -1/errno for failure. + */ +int asn_set_add(void *asn_set_of_x, void *ptr); + +/* + * Delete the element from the set by its number (base 0). + * This is a constant-time operation. The order of elements before the + * deleted ones is guaranteed, the order of elements after the deleted + * one is NOT guaranteed. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ +void asn_set_del(void *asn_set_of_x, int number, int _do_free); + +/* + * Empty the contents of the set. Will free the elements, if (*free) is given. + * Will NOT free the set itself. + */ +void asn_set_empty(void *asn_set_of_x); + +/* + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ +typedef A_SET_OF(void) asn_anonymous_set_; +#define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) +#define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_SET_OF_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_application.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_application.h new file mode 100644 index 000000000..71e9ba61b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_application.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Application-level ASN.1 callbacks. + */ +#ifndef ASN_APPLICATION_H +#define ASN_APPLICATION_H + +#include "asn_system.h" /* for platform-dependent types */ +#include "asn_codecs.h" /* for ASN.1 codecs specifics */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Generic type of an application-defined callback to return various + * types of data to the application. + * EXPECTED RETURN VALUES: + * -1: Failed to consume bytes. Abort the mission. + * Non-negative return values indicate success, and ignored. + */ +typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, + void *application_specific_key); + +/* + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ +typedef void (asn_app_constraint_failed_f)(void *application_specific_key, + struct asn_TYPE_descriptor_s *type_descriptor_which_failed, + const void *structure_which_failed_ptr, + const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); + +#ifdef __cplusplus +} +#endif + +#include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ + +#endif /* ASN_APPLICATION_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs.h new file mode 100644 index 000000000..4b2a29429 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_CODECS_H +#define ASN_CODECS_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * This structure defines a set of parameters that may be passed + * to every ASN.1 encoder or decoder function. + * WARNING: if max_stack_size member is set, and you are calling the + * function pointers of the asn_TYPE_descriptor_t directly, + * this structure must be ALLOCATED ON THE STACK! + * If you can't always satisfy this requirement, use ber_decode(), + * xer_decode() and uper_decode() functions instead. + */ +typedef struct asn_codec_ctx_s { + /* + * Limit the decoder routines to use no (much) more stack than a given + * number of bytes. Most of decoders are stack-based, and this + * would protect against stack overflows if the number of nested + * encodings is high. + * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, + * and are safe from this kind of overflow. + * A value from getrlimit(RLIMIT_STACK) may be used to initialize + * this variable. Be careful in multithreaded environments, as the + * stack size is rather limited. + */ + size_t max_stack_size; /* 0 disables stack bounds checking */ +} asn_codec_ctx_t; + +/* + * Type of the return value of the encoding functions (der_encode, xer_encode). + */ +typedef struct asn_enc_rval_s { + /* + * Number of bytes encoded. + * -1 indicates failure to encode the structure. + * In this case, the members below this one are meaningful. + */ + ssize_t encoded; + + /* + * Members meaningful when (encoded == -1), for post mortem analysis. + */ + + /* Type which cannot be encoded */ + struct asn_TYPE_descriptor_s *failed_type; + + /* Pointer to the structure of that type */ + void *structure_ptr; +} asn_enc_rval_t; +#define ASN__ENCODE_FAILED do { \ + asn_enc_rval_t tmp_error; \ + tmp_error.encoded = -1; \ + tmp_error.failed_type = td; \ + tmp_error.structure_ptr = sptr; \ + ASN_DEBUG("Failed to encode element %s", td ? td->name : ""); \ + return tmp_error; \ +} while(0) +#define ASN__ENCODED_OK(rval) do { \ + rval.structure_ptr = 0; \ + rval.failed_type = 0; \ + return rval; \ +} while(0) + +/* + * Type of the return value of the decoding functions (ber_decode, xer_decode) + * + * Please note that the number of consumed bytes is ALWAYS meaningful, + * even if code==RC_FAIL. This is to indicate the number of successfully + * decoded bytes, hence providing a possibility to fail with more diagnostics + * (i.e., print the offending remainder of the buffer). + */ +enum asn_dec_rval_code_e { + RC_OK, /* Decoded successfully */ + RC_WMORE, /* More data expected, call again */ + RC_FAIL /* Failure to decode data */ +}; +typedef struct asn_dec_rval_s { + enum asn_dec_rval_code_e code; /* Result code */ + size_t consumed; /* Number of bytes consumed */ +} asn_dec_rval_t; +#define ASN__DECODE_FAILED do { \ + asn_dec_rval_t tmp_error; \ + tmp_error.code = RC_FAIL; \ + tmp_error.consumed = 0; \ + ASN_DEBUG("Failed to decode element %s", td ? td->name : ""); \ + return tmp_error; \ +} while(0) +#define ASN__DECODE_STARVED do { \ + asn_dec_rval_t tmp_error; \ + tmp_error.code = RC_WMORE; \ + tmp_error.consumed = 0; \ + return tmp_error; \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_CODECS_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs_prim.c b/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs_prim.c new file mode 100644 index 000000000..2346d15c9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs_prim.c @@ -0,0 +1,312 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "asn_codecs_prim.h" +#include + +/* + * Decode an always-primitive type. + */ +asn_dec_rval_t +ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const void *buf_ptr, size_t size, int tag_mode) { + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr; + asn_dec_rval_t rval; + ber_tlv_len_t length = 0; /* =0 to avoid [incorrect] warning. */ + + /* + * If the structure is not there, allocate it. + */ + if(st == NULL) { + st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); + if(st == NULL) ASN__DECODE_FAILED; + *sptr = (void *)st; + } + + ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", + td->name, tag_mode); + + /* + * Check tags and extract value length. + */ + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, + tag_mode, 0, &length, 0); + if(rval.code != RC_OK) + return rval; + + ASN_DEBUG("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this length. + */ + buf_ptr = ((const char *)buf_ptr) + rval.consumed; + size -= rval.consumed; + if(length > (ber_tlv_len_t)size) { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } + + st->size = (int)length; + /* The following better be optimized away. */ + if(sizeof(st->size) != sizeof(length) + && (ber_tlv_len_t)st->size != length) { + st->size = 0; + ASN__DECODE_FAILED; + } + + st->buf = (uint8_t *)MALLOC(length + 1); + if(!st->buf) { + st->size = 0; + ASN__DECODE_FAILED; + } + + memcpy(st->buf, buf_ptr, length); + st->buf[length] = '\0'; /* Just in case */ + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s", + (long)rval.consumed, + (long)length, td->name); + + return rval; +} + +/* + * Encode an always-primitive type using DER. + */ +asn_enc_rval_t +der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval; + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; + + ASN_DEBUG("%s %s as a primitive type (tm=%d)", + cb?"Encoding":"Estimating", td->name, tag_mode); + + erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, + cb, app_key); + ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + + if(cb && st->buf) { + if(cb(st->buf, st->size, app_key) < 0) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } else { + assert(st->buf || st->size == 0); + } + + erval.encoded += st->size; + ASN__ENCODED_OK(erval); +} + +void +ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, + int contents_only) { + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; + + if(!td || !sptr) + return; + + ASN_DEBUG("Freeing %s as a primitive type", td->name); + + if(st->buf) + FREEMEM(st->buf); + + if(!contents_only) + FREEMEM(st); +} + + +/* + * Local internal type passed around as an argument. + */ +struct xdp_arg_s { + asn_TYPE_descriptor_t *type_descriptor; + void *struct_key; + xer_primitive_body_decoder_f *prim_body_decoder; + int decoded_something; + int want_more; +}; + +/* + * Since some kinds of primitive values can be encoded using value-specific + * tags (, , etc), the primitive decoder must + * be supplied with such tags to parse them as needed. + */ +static int +xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) { + struct xdp_arg_s *arg = (struct xdp_arg_s *)key; + enum xer_pbd_rval bret; + + /* + * The chunk_buf is guaranteed to start at '<'. + */ + assert(chunk_size && ((const char *)chunk_buf)[0] == 0x3c); + + /* + * Decoding was performed once already. Prohibit doing it again. + */ + if(arg->decoded_something) + return -1; + + bret = arg->prim_body_decoder(arg->type_descriptor, + arg->struct_key, chunk_buf, chunk_size); + switch(bret) { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return 0; + } + + return -1; +} + +static ssize_t +xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) { + struct xdp_arg_s *arg = (struct xdp_arg_s *)key; + enum xer_pbd_rval bret; + size_t lead_wsp_size; + + if(arg->decoded_something) { + if(xer_whitespace_span(chunk_buf, chunk_size) == chunk_size) { + /* + * Example: + * "123 " + * ^- chunk_buf position. + */ + return chunk_size; + } + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } + + if(!have_more) { + /* + * If we've received something like "1", we can't really + * tell whether it is really `1` or `123`, until we know + * that there is no more data coming. + * The have_more argument will be set to 1 once something + * like this is available to the caller of this callback: + * "1want_more = 1; + return -1; + } + + lead_wsp_size = xer_whitespace_span(chunk_buf, chunk_size); + chunk_buf = (const char *)chunk_buf + lead_wsp_size; + chunk_size -= lead_wsp_size; + + bret = arg->prim_body_decoder(arg->type_descriptor, + arg->struct_key, chunk_buf, chunk_size); + switch(bret) { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return lead_wsp_size + chunk_size; + } + + return -1; +} + + +asn_dec_rval_t +xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, + size_t struct_size, + const char *opt_mname, + const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder +) { + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + asn_struct_ctx_t s_ctx; + struct xdp_arg_s s_arg; + asn_dec_rval_t rc; + + /* + * Create the structure if does not exist. + */ + if(!*sptr) { + *sptr = CALLOC(1, struct_size); + if(!*sptr) ASN__DECODE_FAILED; + } + + memset(&s_ctx, 0, sizeof(s_ctx)); + s_arg.type_descriptor = td; + s_arg.struct_key = *sptr; + s_arg.prim_body_decoder = prim_body_decoder; + s_arg.decoded_something = 0; + s_arg.want_more = 0; + + rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, + xml_tag, buf_ptr, size, + xer_decode__unexpected_tag, xer_decode__primitive_body); + switch(rc.code) { + case RC_OK: + if(!s_arg.decoded_something) { + char ch; + ASN_DEBUG("Primitive body is not recognized, " + "supplying empty one"); + /* + * Decoding opportunity has come and gone. + * Where's the result? + * Try to feed with empty body, see if it eats it. + */ + if(prim_body_decoder(s_arg.type_descriptor, + s_arg.struct_key, &ch, 0) + != XPBD_BODY_CONSUMED) { + /* + * This decoder does not like empty stuff. + */ + ASN__DECODE_FAILED; + } + } + break; + case RC_WMORE: + /* + * Redo the whole thing later. + * We don't have a context to save intermediate parsing state. + */ + rc.consumed = 0; + break; + case RC_FAIL: + rc.consumed = 0; + if(s_arg.want_more) + rc.code = RC_WMORE; + else + ASN__DECODE_FAILED; + break; + } + return rc; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs_prim.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs_prim.h new file mode 100644 index 000000000..be673ba19 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_codecs_prim.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_CODECS_PRIM_H +#define ASN_CODECS_PRIM_H + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ASN__PRIMITIVE_TYPE_s { + uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ + int size; /* Size of the buffer */ +} ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ + +asn_struct_free_f ASN__PRIMITIVE_TYPE_free; +ber_type_decoder_f ber_decode_primitive; +der_type_encoder_f der_encode_primitive; + +/* + * A callback specification for the xer_decode_primitive() function below. + */ +enum xer_pbd_rval { + XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ + XPBD_DECODER_LIMIT, /* Hit some decoder limitation or deficiency */ + XPBD_BROKEN_ENCODING, /* Encoding of a primitive body is broken */ + XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ + XPBD_BODY_CONSUMED /* Body is recognized and consumed */ +}; +typedef enum xer_pbd_rval (xer_primitive_body_decoder_f) + (asn_TYPE_descriptor_t *td, void *struct_ptr, + const void *chunk_buf, size_t chunk_size); + +/* + * Specific function to decode simple primitive types. + * Also see xer_decode_general() in xer_decoder.h + */ +asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, size_t struct_size, + const char *opt_mname, + const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder +); + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_CODECS_PRIM_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_internal.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_internal.h new file mode 100644 index 000000000..583cbf1ba --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_internal.h @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Declarations internally useful for the ASN.1 support code. + */ +#ifndef ASN_INTERNAL_H +#define ASN_INTERNAL_H + +#include "asn_application.h" /* Application-visible API */ + +#ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */ +#include /* for assert() macro */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Environment version might be used to avoid running with the old library */ +#define ASN1C_ENVIRONMENT_VERSION 923 /* Compile-time version */ +int get_asn1c_environment_version(void); /* Run-time version */ + +#define CALLOC(nmemb, size) calloc(nmemb, size) +#define MALLOC(size) malloc(size) +#define REALLOC(oldptr, size) realloc(oldptr, size) +#define FREEMEM(ptr) free(ptr) + +#define asn_debug_indent 0 +#define ASN_DEBUG_INDENT_ADD(i) do{}while(0) + +/* + * A macro for debugging the ASN.1 internals. + * You may enable or override it. + */ +#ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */ +#if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */ +#ifdef __GNUC__ +#ifdef ASN_THREAD_SAFE +/* Thread safety requires sacrifice in output indentation: + * Retain empty definition of ASN_DEBUG_INDENT_ADD. */ +#else /* !ASN_THREAD_SAFE */ +#undef ASN_DEBUG_INDENT_ADD +#undef asn_debug_indent +extern int asn_debug_indent; +#define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0) +#endif /* ASN_THREAD_SAFE */ +#define ASN_DEBUG(fmt, args...) do { \ + int adi = asn_debug_indent; \ + while(adi--) fprintf(stderr, " "); \ + fprintf(stderr, fmt, ##args); \ + fprintf(stderr, " (%s:%d)\n", \ + __FILE__, __LINE__); \ + } while(0) +#else /* !__GNUC__ */ +void ASN_DEBUG_f(const char *fmt, ...); +#define ASN_DEBUG ASN_DEBUG_f +#endif /* __GNUC__ */ +#else /* EMIT_ASN_DEBUG != 1 */ +static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } +#endif /* EMIT_ASN_DEBUG */ +#endif /* ASN_DEBUG */ + +/* + * Invoke the application-supplied callback and fail, if something is wrong. + */ +#define ASN__E_cbc(buf, size) (cb((buf), (size), app_key) < 0) +#define ASN__E_CALLBACK(foo) do { \ + if(foo) goto cb_failed; \ + } while(0) +#define ASN__CALLBACK(buf, size) \ + ASN__E_CALLBACK(ASN__E_cbc(buf, size)) +#define ASN__CALLBACK2(buf1, size1, buf2, size2) \ + ASN__E_CALLBACK(ASN__E_cbc(buf1, size1) || ASN__E_cbc(buf2, size2)) +#define ASN__CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ + ASN__E_CALLBACK(ASN__E_cbc(buf1, size1) \ + || ASN__E_cbc(buf2, size2) \ + || ASN__E_cbc(buf3, size3)) + +#define ASN__TEXT_INDENT(nl, level) do { \ + int tmp_level = (level); \ + int tmp_nl = ((nl) != 0); \ + int tmp_i; \ + if(tmp_nl) ASN__CALLBACK("\n", 1); \ + if(tmp_level < 0) tmp_level = 0; \ + for(tmp_i = 0; tmp_i < tmp_level; tmp_i++) \ + ASN__CALLBACK(" ", 4); \ + er.encoded += tmp_nl + 4 * tmp_level; \ + } while(0) + +#define _i_INDENT(nl) do { \ + int tmp_i; \ + if((nl) && cb("\n", 1, app_key) < 0) \ + return -1; \ + for(tmp_i = 0; tmp_i < ilevel; tmp_i++) \ + if(cb(" ", 1, app_key) < 0) \ + return -1; \ + } while(0) + +/* + * Check stack against overflow, if limit is set. + */ +#define ASN__DEFAULT_STACK_MAX (30000) +static int /*__attribute__((unused))*/ +ASN__STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) { + if(ctx && ctx->max_stack_size) { + + /* ctx MUST be allocated on the stack */ + ptrdiff_t usedstack = ((char *)ctx - (char *)&ctx); + if(usedstack > 0) usedstack = -usedstack; /* grows up! */ + + /* double negative required to avoid int wrap-around */ + if(usedstack < -(ptrdiff_t)ctx->max_stack_size) { + ASN_DEBUG("Stack limit %ld reached", + (long)ctx->max_stack_size); + return -1; + } + } + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_INTERNAL_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/asn_system.h b/plugins/inmarsat_support/aero/libacars/asn1/asn_system.h new file mode 100644 index 000000000..0955d86fb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/asn_system.h @@ -0,0 +1,137 @@ +/*- + * Copyright (c) 2003, 2004, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Miscellaneous system-dependent types. + */ +#ifndef ASN_SYSTEM_H +#define ASN_SYSTEM_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +//#ifndef _BSD_SOURCE +//#define _BSD_SOURCE /* for snprintf() on some linux systems */ +//#endif + +#include /* For snprintf(3) */ +#include /* For *alloc(3) */ +#include /* For memcpy(3) */ +#include /* For size_t */ +#include /* For LONG_MAX */ +#include /* For va_start */ +#include /* for offsetof and ptrdiff_t */ + +#ifdef HAVE_ALLOCA_H +#include /* For alloca(3) */ +#endif + +#ifdef _WIN32 + +#include +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ +#define sys_ntohl(l) ((((l) << 24) & 0xff000000) \ + | (((l) << 8) & 0xff0000) \ + | (((l) >> 8) & 0xff00) \ + | ((l >> 24) & 0xff)) + +#ifdef _MSC_VER /* MSVS.Net */ +#ifndef __cplusplus +#define inline __inline +#endif +#ifndef ASSUMESTDTYPES /* Standard types have been defined elsewhere */ +#define ssize_t SSIZE_T +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif /* ASSUMESTDTYPES */ +#define WIN32_LEAN_AND_MEAN +#include +#include +#define isnan _isnan +#define finite _finite +#define copysign _copysign +#define ilogb _logb +#else /* !_MSC_VER */ +#include +#endif /* _MSC_VER */ + +#else /* !_WIN32 */ + +#if defined(__vxworks) +#include +#else /* !defined(__vxworks) */ + +#include /* C99 specifies this file */ +/* + * 1. Earlier FreeBSD version didn't have , + * but was present. + * 2. Sun Solaris requires for alloca(3), + * but does not have . + */ +#if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_)) +#if defined(sun) +#include /* For alloca(3) */ +#include /* for finite(3) */ +#elif defined(__hpux) +#ifdef __GNUC__ +#include /* For alloca(3) */ +#else /* !__GNUC__ */ +#define inline +#endif /* __GNUC__ */ +#else +#include /* SUSv2+ and C99 specify this file, for uintXX_t */ +#endif /* defined(sun) */ +#endif + +#include /* for ntohl() */ +#define sys_ntohl(foo) ntohl(foo) + +#endif /* defined(__vxworks) */ + +#endif /* _WIN32 */ + +#if __GNUC__ >= 3 +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#endif +#ifndef GCC_NOTUSED +#define GCC_NOTUSED __attribute__((unused)) +#endif +#else +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) /* nothing */ +#endif +#ifndef GCC_NOTUSED +#define GCC_NOTUSED +#endif +#endif + +/* Figure out if thread safety is requested */ +#if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT)) +#define ASN_THREAD_SAFE +#endif /* Thread safety */ + +#ifndef offsetof /* If not defined by */ +#define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0)) +#endif /* offsetof */ + +#ifndef MIN /* Suitable for comparing primitive types (integers) */ +#if defined(__GNUC__) +#define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \ + ((_a)<(_b)?(_a):(_b)); }) +#else /* !__GNUC__ */ +#define MIN(a,b) ((a)<(b)?(a):(b)) /* Unsafe variant */ +#endif /* __GNUC__ */ +#endif /* MIN */ + +#endif /* ASN_SYSTEM_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/ber_decoder.c b/plugins/inmarsat_support/aero/libacars/asn1/ber_decoder.c new file mode 100644 index 000000000..a4883d8c6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/ber_decoder.c @@ -0,0 +1,283 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) +#undef RETURN +#define RETURN(_code) do { \ + asn_dec_rval_t rval; \ + rval.code = _code; \ + if(opt_ctx) opt_ctx->step = step; /* Save context */ \ + if(_code == RC_OK || opt_ctx) \ + rval.consumed = consumed_myself; \ + else \ + rval.consumed = 0; /* Context-free */ \ + return rval; \ + } while(0) + +/* + * The BER decoder of any type. + */ +asn_dec_rval_t +ber_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, const void *ptr, size_t size) { + asn_codec_ctx_t s_codec_ctx; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* + * Invoke type-specific decoder. + */ + return type_descriptor->ber_decoder(opt_codec_ctx, type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + ptr, size, /* Buffer and its size */ + 0 /* Default tag mode is 0 */ + ); +} + +/* + * Check the set of >> tags matches the definition. + */ +asn_dec_rval_t +ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, + const void *ptr, size_t size, int tag_mode, int last_tag_form, + ber_tlv_len_t *last_length, int *opt_tlv_form) { + ssize_t consumed_myself = 0; + ssize_t tag_len; + ssize_t len_len; + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_len_t limit_len = -1; + int expect_00_terminators = 0; + int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ + int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ + int tagno; + + /* + * Make sure we didn't exceed the maximum stack size. + */ + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) + RETURN(RC_FAIL); + + /* + * So what does all this implicit skip stuff mean? + * Imagine two types, + * A ::= [5] IMPLICIT T + * B ::= [2] EXPLICIT T + * Where T is defined as + * T ::= [4] IMPLICIT SEQUENCE { ... } + * + * Let's say, we are starting to decode type A, given the + * following TLV stream: <5> <0>. What does this mean? + * It means that the type A contains type T which is, + * in turn, empty. + * Remember though, that we are still in A. We cannot + * just pass control to the type T decoder. Why? Because + * the type T decoder expects <4> <0>, not <5> <0>. + * So, we must make sure we are going to receive <5> while + * still in A, then pass control to the T decoder, indicating + * that the tag <4> was implicitly skipped. The decoder of T + * hence will be prepared to treat <4> as valid tag, and decode + * it appropriately. + */ + + tagno = step /* Continuing where left previously */ + + (tag_mode==1?-1:0) + ; + ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)", + td->name, (long)size, tag_mode, step, tagno); + /* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */ + + if(tag_mode == 0 && tagno == td->tags_count) { + /* + * This must be the _untagged_ ANY type, + * which outermost tag isn't known in advance. + * Fetch the tag and length separately. + */ + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + switch(tag_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + len_len = ber_fetch_length(tlv_constr, + (const char *)ptr + tag_len, size - tag_len, &tlv_len); + switch(len_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + ASN_DEBUG("Advancing %ld in ANY case", + (long)(tag_len + len_len)); + ADVANCE(tag_len + len_len); + } else { + assert(tagno < td->tags_count); /* At least one loop */ + } + for((void)tagno; tagno < td->tags_count; tagno++, step++) { + + /* + * Fetch and process T from TLV. + */ + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + ASN_DEBUG("Fetching tag from {%p,%ld}: " + "len %ld, step %d, tagno %d got %s", + ptr, (long)size, + (long)tag_len, step, tagno, + ber_tlv_tag_string(tlv_tag)); + switch(tag_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + + /* + * If {I}, don't check anything. + * If {I,B,C}, check B and C unless we're at I. + */ + if(tag_mode != 0 && step == 0) { + /* + * We don't expect tag to match here. + * It's just because we don't know how the tag + * is supposed to look like. + */ + } else { + assert(tagno >= 0); /* Guaranteed by the code above */ + if(tlv_tag != td->tags[tagno]) { + /* + * Unexpected tag. Too bad. + */ + ASN_DEBUG("Expected: %s, " + "expectation failed (tn=%d, tm=%d)", + ber_tlv_tag_string(td->tags[tagno]), + tagno, tag_mode + ); + RETURN(RC_FAIL); + } + } + + /* + * Attention: if there are more tags expected, + * ensure that the current tag is presented + * in constructed form (it contains other tags!). + * If this one is the last one, check that the tag form + * matches the one given in descriptor. + */ + if(tagno < (td->tags_count - 1)) { + if(tlv_constr == 0) { + ASN_DEBUG("tlv_constr = %d, expfail", + tlv_constr); + RETURN(RC_FAIL); + } + } else { + if(last_tag_form != tlv_constr + && last_tag_form != -1) { + ASN_DEBUG("last_tag_form %d != %d", + last_tag_form, tlv_constr); + RETURN(RC_FAIL); + } + } + + /* + * Fetch and process L from TLV. + */ + len_len = ber_fetch_length(tlv_constr, + (const char *)ptr + tag_len, size - tag_len, &tlv_len); + ASN_DEBUG("Fetching len = %ld", (long)len_len); + switch(len_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + /* + * FIXME + * As of today, the chain of tags + * must either contain several indefinite length TLVs, + * or several definite length ones. + * No mixing is allowed. + */ + if(tlv_len == -1) { + /* + * Indefinite length. + */ + if(limit_len == -1) { + expect_00_terminators++; + } else { + ASN_DEBUG("Unexpected indefinite length " + "in a chain of definite lengths"); + RETURN(RC_FAIL); + } + ADVANCE(tag_len + len_len); + continue; + } else { + if(expect_00_terminators) { + ASN_DEBUG("Unexpected definite length " + "in a chain of indefinite lengths"); + RETURN(RC_FAIL); + } + } + + /* + * Check that multiple TLVs specify ever decreasing length, + * which is consistent. + */ + if(limit_len == -1) { + limit_len = tlv_len + tag_len + len_len; + if(limit_len < 0) { + /* Too great tlv_len value? */ + RETURN(RC_FAIL); + } + } else if(limit_len != tlv_len + tag_len + len_len) { + /* + * Inner TLV specifies length which is inconsistent + * with the outer TLV's length value. + */ + ASN_DEBUG("Outer TLV is %ld and inner is %ld", + (long)limit_len, (long)tlv_len); + RETURN(RC_FAIL); + } + + ADVANCE(tag_len + len_len); + + limit_len -= (tag_len + len_len); + if((ssize_t)size > limit_len) { + /* + * Make sure that we won't consume more bytes + * from the parent frame than the inferred limit. + */ + size = limit_len; + } + } + + if(opt_tlv_form) + *opt_tlv_form = tlv_constr; + if(expect_00_terminators) + *last_length = -expect_00_terminators; + else + *last_length = tlv_len; + + RETURN(RC_OK); +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/ber_decoder.h b/plugins/inmarsat_support/aero/libacars/asn1/ber_decoder.h new file mode 100644 index 000000000..a3e5c5a3d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/ber_decoder.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_DECODER_H_ +#define _BER_DECODER_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ +struct asn_codec_ctx_s; /* Forward declaration */ + +/* + * The BER decoder of any type. + * This function may be invoked directly from the application. + * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). + */ +asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of that buffer */ + ); + +/* + * Type of generic function which decodes the byte stream into the structure. + */ +typedef asn_dec_rval_t (ber_type_decoder_f)( + struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, const void *buf_ptr, size_t size, + int tag_mode); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Check that all tags correspond to the type definition (as given in head). + * On return, last_length would contain either a non-negative length of the + * value part of the last TLV, or the negative number of expected + * "end of content" sequences. The number may only be negative if the + * head->last_tag_form is non-zero. + */ +asn_dec_rval_t ber_check_tags( + struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ + struct asn_TYPE_descriptor_s *type_descriptor, + asn_struct_ctx_t *opt_ctx, /* saved decoding context */ + const void *ptr, size_t size, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {-1,0:1}: any, primitive, constr */ + ber_tlv_len_t *last_length, + int *opt_tlv_form /* optional tag form */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_DECODER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_length.c b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_length.c new file mode 100644 index 000000000..b438ba510 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_length.c @@ -0,0 +1,178 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "ber_tlv_length.h" +#include "ber_tlv_tag.h" + +ssize_t +ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r) { + const uint8_t *buf = (const uint8_t *)bufptr; + unsigned oct; + + if(size == 0) + return 0; /* Want more */ + + oct = *(const uint8_t *)buf; + if((oct & 0x80) == 0) { + /* + * Short definite length. + */ + *len_r = oct; /* & 0x7F */ + return 1; + } else { + ber_tlv_len_t len; + size_t skipped; + + if(_is_constructed && oct == 0x80) { + *len_r = -1; /* Indefinite length */ + return 1; + } + + if(oct == 0xff) { + /* Reserved in standard for future use. */ + return -1; + } + + oct &= 0x7F; /* Leave only the 7 LS bits */ + for(len = 0, buf++, skipped = 1; + oct && (++skipped <= size); buf++, oct--) { + + len = (len << 8) | *buf; + if(len < 0 + || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) { + /* + * Too large length value. + */ + return -1; + } + } + + if(oct == 0) { + ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; + /* + * Here length may be very close or equal to 2G. + * However, the arithmetics used in some decoders + * may add some (small) quantities to the length, + * to check the resulting value against some limits. + * This may result in integer wrap-around, which + * we try to avoid by checking it earlier here. + */ + if(lenplusepsilon < 0) { + /* Too large length value */ + return -1; + } + + *len_r = len; + return skipped; + } + + return 0; /* Want more */ + } + +} + +ssize_t +ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, + int _is_constructed, const void *ptr, size_t size) { + ber_tlv_len_t vlen; /* Length of V in TLV */ + ssize_t tl; /* Length of L in TLV */ + ssize_t ll; /* Length of L in TLV */ + size_t skip; + + /* + * Make sure we didn't exceed the maximum stack size. + */ + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) + return -1; + + /* + * Determine the size of L in TLV. + */ + ll = ber_fetch_length(_is_constructed, ptr, size, &vlen); + if(ll <= 0) return ll; + + /* + * Definite length. + */ + if(vlen >= 0) { + skip = ll + vlen; + if(skip > size) + return 0; /* Want more */ + return skip; + } + + /* + * Indefinite length! + */ + ASN_DEBUG("Skipping indefinite length"); + for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) { + ber_tlv_tag_t tag; + + /* Fetch the tag */ + tl = ber_fetch_tag(ptr, size, &tag); + if(tl <= 0) return tl; + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + ((const char *)ptr) + tl, size - tl); + if(ll <= 0) return ll; + + skip += tl + ll; + + /* + * This may be the end of the indefinite length structure, + * two consecutive 0 octets. + * Check if it is true. + */ + if(((const uint8_t *)ptr)[0] == 0 + && ((const uint8_t *)ptr)[1] == 0) + return skip; + + ptr = ((const char *)ptr) + tl + ll; + size -= tl + ll; + } + + /* UNREACHABLE */ +} + +size_t +der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) { + size_t required_size; /* Size of len encoding */ + uint8_t *buf = (uint8_t *)bufp; + uint8_t *end; + size_t i; + + if(len <= 127) { + /* Encoded in 1 octet */ + if(size) *buf = (uint8_t)len; + return 1; + } + + /* + * Compute the size of the subsequent bytes. + */ + for(required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) { + if(len >> i) + required_size++; + else + break; + } + + if(size <= required_size) + return required_size + 1; + + *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ + + /* + * Produce the len encoding, space permitting. + */ + end = buf + required_size; + for(i -= 8; buf < end; i -= 8, buf++) + *buf = (uint8_t)(len >> i); + + return required_size + 1; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_length.h b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_length.h new file mode 100644 index 000000000..349680224 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_length.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_TLV_LENGTH_H_ +#define _BER_TLV_LENGTH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ssize_t ber_tlv_len_t; + +/* + * This function tries to fetch the length of the BER TLV value and place it + * in *len_r. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering length. + * >0: Number of bytes used from bufptr. + * On return with >0, len_r is constrained as -1..MAX, where -1 mean + * that the value is of indefinite length. + */ +ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r); + +/* + * This function expects bufptr to be positioned over L in TLV. + * It returns number of bytes occupied by L and V together, suitable + * for skipping. The function properly handles indefinite length. + * RETURN VALUES: + * Standard {-1,0,>0} convention. + */ +ssize_t ber_skip_length( + struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ + int _is_constructed, const void *bufptr, size_t size); + +/* + * This function serializes the length (L from TLV) in DER format. + * It always returns number of bytes necessary to represent the length, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ +size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_TLV_LENGTH_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_tag.c b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_tag.c new file mode 100644 index 000000000..9ae5566a7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_tag.c @@ -0,0 +1,144 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "ber_tlv_tag.h" +#include + +ssize_t +ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { + ber_tlv_tag_t val; + ber_tlv_tag_t tclass; + size_t skipped; + + if(size == 0) + return 0; + + val = *(const uint8_t *)ptr; + tclass = (val >> 6); + if((val &= 0x1F) != 0x1F) { + /* + * Simple form: everything encoded in a single octet. + * Tag Class is encoded using two least significant bits. + */ + *tag_r = (val << 2) | tclass; + return 1; + } + + /* + * Each octet contains 7 bits of useful information. + * The MSB is 0 if it is the last octet of the tag. + */ + for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; + skipped <= size; + ptr = ((const char *)ptr) + 1, skipped++) { + unsigned int oct = *(const uint8_t *)ptr; + if(oct & 0x80) { + val = (val << 7) | (oct & 0x7F); + /* + * Make sure there are at least 9 bits spare + * at the MS side of a value. + */ + if(val >> ((8 * sizeof(val)) - 9)) { + /* + * We would not be able to accomodate + * any more tag bits. + */ + return -1; + } + } else { + val = (val << 7) | oct; + *tag_r = (val << 2) | tclass; + return skipped; + } + } + + return 0; /* Want more */ +} + + +ssize_t +ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) { + char buf[sizeof("[APPLICATION ]") + 32]; + ssize_t ret; + + ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf)); + if(ret >= (ssize_t)sizeof(buf) || ret < 2) { + errno = EPERM; + return -1; + } + + return fwrite(buf, 1, ret, f); +} + +ssize_t +ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) { + char *type = 0; + int ret; + + switch(tag & 0x3) { + case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break; + case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break; + case ASN_TAG_CLASS_CONTEXT: type = ""; break; + case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break; + } + + ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2); + if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ + + return ret; +} + +char * +ber_tlv_tag_string(ber_tlv_tag_t tag) { + static char buf[sizeof("[APPLICATION ]") + 32]; + + (void)ber_tlv_tag_snprint(tag, buf, sizeof(buf)); + + return buf; +} + + +size_t +ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { + int tclass = BER_TAG_CLASS(tag); + ber_tlv_tag_t tval = BER_TAG_VALUE(tag); + uint8_t *buf = (uint8_t *)bufp; + uint8_t *end; + size_t required_size; + size_t i; + + if(tval <= 30) { + /* Encoded in 1 octet */ + if(size) buf[0] = (tclass << 6) | tval; + return 1; + } else if(size) { + *buf++ = (tclass << 6) | 0x1F; + size--; + } + + /* + * Compute the size of the subsequent bytes. + */ + for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) { + if(tval >> i) + required_size++; + else + break; + } + + if(size < required_size) + return required_size + 1; + + /* + * Fill in the buffer, space permitting. + */ + end = buf + required_size - 1; + for(i -= 7; buf < end; i -= 7, buf++) + *buf = 0x80 | ((tval >> i) & 0x7F); + *buf = (tval & 0x7F); /* Last octet without high bit */ + + return required_size + 1; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_tag.h b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_tag.h new file mode 100644 index 000000000..60e866861 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/ber_tlv_tag.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_TLV_TAG_H_ +#define _BER_TLV_TAG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum asn_tag_class { + ASN_TAG_CLASS_UNIVERSAL = 0, /* 0b00 */ + ASN_TAG_CLASS_APPLICATION = 1, /* 0b01 */ + ASN_TAG_CLASS_CONTEXT = 2, /* 0b10 */ + ASN_TAG_CLASS_PRIVATE = 3 /* 0b11 */ +}; +typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */ + +/* + * Tag class is encoded together with tag value for optimization purposes. + */ +#define BER_TAG_CLASS(tag) ((tag) & 0x3) +#define BER_TAG_VALUE(tag) ((tag) >> 2) +#define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr)&0x20)?1:0) + +#define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) + +/* + * Several functions for printing the TAG in the canonical form + * (i.e. "[PRIVATE 0]"). + * Return values correspond to their libc counterparts (if any). + */ +ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen); +ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *); +char *ber_tlv_tag_string(ber_tlv_tag_t tag); + + +/* + * This function tries to fetch the tag from the input stream. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering tag. + * >0: Number of bytes used from bufptr. tag_r will contain the tag. + */ +ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); + +/* + * This function serializes the tag (T from TLV) in BER format. + * It always returns number of bytes necessary to represent the tag, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ +size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_TLV_TAG_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_CHOICE.c b/plugins/inmarsat_support/aero/libacars/asn1/constr_CHOICE.c new file mode 100644 index 000000000..d2d5abe20 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_CHOICE.c @@ -0,0 +1,1114 @@ +/* + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "constr_CHOICE.h" +#include "per_opentype.h" + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * See the definitions. + */ +int _fetch_present_idx(const void *struct_ptr, int off, int size); +static void _set_present_idx(void *sptr, int offset, int size, int pres); + +/* + * Tags are canonically sorted in the tag to member table. + */ +static int +_search4tag(const void *ap, const void *bp) { + const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; + const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; + + int a_class = BER_TAG_CLASS(a->el_tag); + int b_class = BER_TAG_CLASS(b->el_tag); + + if(a_class == b_class) { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + + if(a_value == b_value) + return 0; + else if(a_value < b_value) + return -1; + else + return 1; + } else if(a_class < b_class) { + return -1; + } else { + return 1; + } +} + +/* + * The decoder of the CHOICE type. + */ +asn_dec_rval_t +CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + ssize_t tag_len; /* Length of TLV's T */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + ASN_DEBUG("Decoding %s as CHOICE", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + if(tag_mode || td->tags_count) { + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, -1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) { + /* ?Substracted below! */ + ctx->left += rval.consumed; + } + ADVANCE(rval.consumed); + } else { + ctx->left = -1; + } + + NEXT_PHASE(ctx); + + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); + + /* Fall through */ + case 1: + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + do { + const asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + + key.el_tag = tlv_tag; + t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, + specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _search4tag); + if(t2m) { + /* + * Found the element corresponding to the tag. + */ + NEXT_PHASE(ctx); + ctx->step = t2m->el_no; + break; + } else if(specs->ext_start == -1) { + ASN_DEBUG("Unexpected tag %s " + "in non-extensible CHOICE %s", + ber_tlv_tag_string(tlv_tag), td->name); + RETURN(RC_FAIL); + } else { + /* Skip this tag */ + ssize_t skip; + + ASN_DEBUG("Skipping unknown tag %s", + ber_tlv_tag_string(tlv_tag)); + + skip = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + + switch(skip) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + RETURN(RC_OK); + } + } while(0); + + case 2: + /* + * PHASE 2. + * Read in the element. + */ + do { + asn_TYPE_member_t *elm;/* CHOICE's element */ + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &elements[ctx->step]; + + /* + * Compute the position of the member inside a structure, + * and also a type of containment (it may be contained + * as pointer or using inline inclusion). + */ + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + /* Set presence to be able to free it properly at any time */ + _set_present_idx(st, specs->pres_offset, + specs->pres_size, ctx->step + 1); + /* + * Invoke the member fetch routine according to member's type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + memb_ptr2, ptr, LEFT, elm->tag_mode); + switch(rval.code) { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + RETURN(RC_FAIL); + case RC_FAIL: /* Fatal error */ + RETURN(rval.code); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } while(0); + + NEXT_PHASE(ctx); + + /* Fall through */ + case 3: + ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", + td->name, (long)ctx->left, (long)size, + tag_mode, td->tags_count); + + if(ctx->left > 0) { + /* + * The type must be fully decoded + * by the CHOICE member-specific decoder. + */ + RETURN(RC_FAIL); + } + + if(ctx->left == -1 + && !(tag_mode || td->tags_count)) { + /* + * This is an untagged CHOICE. + * It doesn't contain nothing + * except for the member itself, including all its tags. + * The decoding is completed. + */ + NEXT_PHASE(ctx); + break; + } + + /* + * Read in the "end of data chunks"'s. + */ + while(ctx->left < 0) { + ssize_t tl; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tl) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + /* + * Expected <0><0>... + */ + if(((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + continue; + } + } else { + ASN_DEBUG("Unexpected continuation in %s", + td->name); + RETURN(RC_FAIL); + } + + /* UNREACHABLE */ + } + + NEXT_PHASE(ctx); + case 4: + /* No meaningful work here */ + break; + } + + RETURN(RC_OK); +} + +asn_enc_rval_t +CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE element */ + asn_enc_rval_t erval; + void *memb_ptr; + size_t computed_size = 0; + int present; + + if(!sptr) ASN__ENCODE_FAILED; + + ASN_DEBUG("%s %s as CHOICE", + cb?"Encoding":"Estimating", td->name); + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) { + if(present == 0 && td->elements_count == 0) { + /* The CHOICE is empty?! */ + erval.encoded = 0; + ASN__ENCODED_OK(erval); + } + ASN__ENCODE_FAILED; + } + + /* + * Seek over the present member of the structure. + */ + elm = &td->elements[present-1]; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(memb_ptr == 0) { + if(elm->optional) { + erval.encoded = 0; + ASN__ENCODED_OK(erval); + } + /* Mandatory element absent */ + ASN__ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + /* + * If the CHOICE itself is tagged EXPLICIT: + * T ::= [2] EXPLICIT CHOICE { ... } + * Then emit the appropriate tags. + */ + if(tag_mode == 1 || td->tags_count) { + /* + * For this, we need to pre-compute the member. + */ + ssize_t ret; + + /* Encode member with its tag */ + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, 0, 0); + if(erval.encoded == -1) + return erval; + + /* Encode CHOICE with parent or my own tag */ + ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, + cb, app_key); + if(ret == -1) + ASN__ENCODE_FAILED; + computed_size += ret; + } + + /* + * Encode the single underlying member. + */ + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, cb, app_key); + if(erval.encoded == -1) + return erval; + + ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", + (long)erval.encoded, (long)computed_size); + + erval.encoded += computed_size; + + return erval; +} + +ber_tlv_tag_t +CHOICE_outmost_tag(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + assert(tag_mode == 0); (void)tag_mode; + assert(tag == 0); (void)tag; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); + + if(present > 0 || present <= td->elements_count) { + const asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *) + ((const char *)ptr + elm->memb_offset); + } else { + memb_ptr = (const void *) + ((const char *)ptr + elm->memb_offset); + } + + return asn_TYPE_outmost_tag(elm->type, memb_ptr, + elm->tag_mode, elm->tag); + } else { + return (ber_tlv_tag_t)-1; + } +} + +int +CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + return 0; + ASN__CTFAIL(app_key, td, sptr, + "%s: mandatory CHOICE element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + if(elm->memb_constraints) { + return elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + } else { + int ret = elm->type->check_constraints(elm->type, + memb_ptr, ctfailcb, app_key); + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + return ret; + } + } else { + ASN__CTFAIL(app_key, td, sptr, + "%s: no CHOICE element given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = (const void *)(((const char *)buf_ptr) + num); \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value of a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + if(ctx->phase == 0 && !*xml_tag) + ctx->phase = 1; /* Skip the outer tag checking phase */ + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + * Phase 3: Only waiting for closing tag. + * Phase 4: Skipping unknown extensions. + * Phase 5: PHASED OUT + */ + for(edx = ctx->step; ctx->phase <= 4;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + + /* + * Go inside the member. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &td->elements[edx]; + + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Start/Continue decoding the inner member */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, + elm->type, memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", + elm->type->name, tmprval.code); + if(tmprval.code != RC_OK) + RETURN(tmprval.code); + assert(_fetch_present_idx(st, + specs->pres_offset, specs->pres_size) == 0); + /* Record what we've got */ + _set_present_idx(st, + specs->pres_offset, specs->pres_size, edx + 1); + ctx->phase = 3; + /* Fall through */ + } + + /* No need to wait for closing tag; special mode. */ + if(ctx->phase == 3 && !*xml_tag) { + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + if(ch_size == -1) { + RETURN(RC_FAIL); + } else { + switch(ch_type) { + case PXER_WMORE: + RETURN(RC_WMORE); + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", + ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', + ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', + ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', + ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', + xml_tag, tcv); + + /* Skip the extensions section */ + if(ctx->phase == 4) { + ASN_DEBUG("skip_unknown(%d, %ld)", + tcv, (long)ctx->left); + switch(xer_skip_unknown(tcv, &ctx->left)) { + case -1: + ctx->phase = 5; + RETURN(RC_FAIL); + continue; + case 1: + ctx->phase = 3; + /* Fall through */ + case 0: + XER_ADVANCE(ch_size); + continue; + case 2: + ctx->phase = 3; + break; + } + } + + switch(tcv) { + case XCT_BOTH: + break; /* No CHOICE? */ + case XCT_CLOSING: + if(ctx->phase != 3) + break; + XER_ADVANCE(ch_size); + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + if(ctx->phase != 1) + break; /* Really unexpected */ + + /* + * Search which inner member corresponds to this tag. + */ + for(edx = 0; edx < td->elements_count; edx++) { + elm = &td->elements[edx]; + tcv = xer_check_tag(buf_ptr,ch_size,elm->name); + switch(tcv) { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + edx = td->elements_count; + break; /* Phase out */ + } + break; + } + if(edx != td->elements_count) + continue; + + /* It is expected extension */ + if(specs->ext_start != -1) { + ASN_DEBUG("Got anticipated extension"); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if(tcv & XCT_CLOSING) { + /* Found without body */ + ctx->phase = 3; /* Terminating */ + } else { + ctx->left = 1; + ctx->phase = 4; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" + " (ph=%d, tag=%s)", + ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', + ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', + ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', + ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', + td->name, ctx->phase, xml_tag); + break; + } + + ctx->phase = 5; /* Phase out, just in case */ + RETURN(RC_FAIL); +} + + +asn_enc_rval_t +CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs=(asn_CHOICE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int present; + + if(!sptr) + ASN__ENCODE_FAILED; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + + if(present <= 0 || present > td->elements_count) { + ASN__ENCODE_FAILED; + } else { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[present-1]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) ASN__ENCODE_FAILED; + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + er.encoded = 0; + + if(!(flags & XER_F_CANONICAL)) ASN__TEXT_INDENT(1, ilevel); + ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + ASN__CALLBACK3("", 1); + + er.encoded += 5 + (2 * mlen) + tmper.encoded; + } + + if(!(flags & XER_F_CANONICAL)) ASN__TEXT_INDENT(1, ilevel - 1); + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +asn_dec_rval_t +CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_dec_rval_t rv; + asn_per_constraint_t *ct; + asn_TYPE_member_t *elm; /* CHOICE's element */ + void *memb_ptr; + void **memb_ptr2; + void *st = *sptr; + int value; + + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) + ASN__DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) ASN__DECODE_FAILED; + } + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + value = per_get_few_bits(pd, 1); + if(value < 0) ASN__DECODE_STARVED; + if(value) ct = 0; /* Not restricted */ + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + ASN_DEBUG("CHOICE %s got index %d in range %d", + td->name, value, ct->range_bits); + if(value > ct->upper_bound) + ASN__DECODE_FAILED; + } else { + if(specs->ext_start == -1) + ASN__DECODE_FAILED; + value = uper_get_nsnnwn(pd); + if(value < 0) ASN__DECODE_STARVED; + value += specs->ext_start; + if(value >= td->elements_count) + ASN__DECODE_FAILED; + } + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + value = specs->canonical_order[value]; + + /* Set presence to be able to free it later */ + _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); + + elm = &td->elements[value]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); + + if(ct && ct->range_bits >= 0) { + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } else { + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } + + if(rv.code != RC_OK) + ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", + elm->name, td->name, rv.code); + return rv; +} + +asn_enc_rval_t +CHOICE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_per_constraint_t *ct; + void *memb_ptr; + int present; + int present_enc; + + if(!sptr) ASN__ENCODE_FAILED; + + ASN_DEBUG("Encoding %s as CHOICE", td->name); + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized properly, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) + ASN__ENCODE_FAILED; + else + present--; + + ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + present_enc = specs->canonical_order[present]; + else + present_enc = present; + + if(ct && ct->range_bits >= 0) { + if(present_enc < ct->lower_bound + || present_enc > ct->upper_bound) { + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, 1, 1)) + ASN__ENCODE_FAILED; + } else { + ASN__ENCODE_FAILED; + } + ct = 0; + } + } + if(ct && ct->flags & APC_EXTENSIBLE) + if(per_put_few_bits(po, 0, 1)) + ASN__ENCODE_FAILED; + + elm = &td->elements[present]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) ASN__ENCODE_FAILED; + } else { + memb_ptr = (char *)sptr + elm->memb_offset; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, present_enc, ct->range_bits)) + ASN__ENCODE_FAILED; + + return elm->type->uper_encoder(elm->type, elm->per_constraints, + memb_ptr, po); + } else { + asn_enc_rval_t rval; + if(specs->ext_start == -1) + ASN__ENCODE_FAILED; + if(uper_put_nsnnwn(po, present_enc - specs->ext_start)) + ASN__ENCODE_FAILED; + if(uper_open_type_put(elm->type, elm->per_constraints, + memb_ptr, po)) + ASN__ENCODE_FAILED; + rval.encoded = 0; + ASN__ENCODED_OK(rval); + } +} + + +int +CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + + /* + * Print that element. + */ + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Print member's name and stuff */ + if(1) { + if(cb(elm->name, strlen(elm->name), app_key) < 0 + || cb(": ", 2, app_key) < 0) + return -1; + } + + return elm->type->print_struct(elm->type, memb_ptr, ilevel, + cb, app_key); + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as CHOICE", td->name); + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); + + /* + * Free that element. + */ + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)ptr + elm->memb_offset); + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } else { + memb_ptr = (void *)((char *)ptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } + } + + if(!contents_only) { + FREEMEM(ptr); + } +} + + +/* + * The following functions functions offer protection against -fshort-enums, + * compatible with little- and big-endian machines. + * If assertion is triggered, either disable -fshort-enums, or add an entry + * here with the ->pres_size of your target stracture. + * Unless the target structure is packed, the ".present" member + * is guaranteed to be aligned properly. ASN.1 compiler itself does not + * produce packed code. + */ +int +_fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { + const void *present_ptr; + int present; + + present_ptr = ((const char *)struct_ptr) + pres_offset; + + switch(pres_size) { + case sizeof(int): present = *(const int *)present_ptr; break; + case sizeof(short): present = *(const short *)present_ptr; break; + case sizeof(char): present = *(const char *)present_ptr; break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + return 0; /* If not aborted, pass back safe value */ + } + + return present; +} + +static void +_set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { + void *present_ptr; + present_ptr = ((char *)struct_ptr) + pres_offset; + + switch(pres_size) { + case sizeof(int): *(int *)present_ptr = present; break; + case sizeof(short): *(short *)present_ptr = present; break; + case sizeof(char): *(char *)present_ptr = present; break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + } +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_CHOICE.h b/plugins/inmarsat_support/aero/libacars/asn1/constr_CHOICE.h new file mode 100644 index 000000000..69386c571 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_CHOICE.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_CHOICE_H_ +#define _CONSTR_CHOICE_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef const struct asn_CHOICE_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_codec_ctx_t member */ + int pres_offset; /* Identifier of the present member */ + int pres_size; /* Size of the identifier (enum) */ + + /* + * Tags to members mapping table. + */ + const asn_TYPE_tag2member_t *tag2el; + int tag2el_count; + + /* Canonical ordering of CHOICE elements, for PER */ + int *canonical_order; + + /* + * Extensions-related stuff. + */ + int ext_start; /* First member of extensions, or -1 */ +} asn_CHOICE_specifics_t; + +/* + * A set specialized functions dealing with the CHOICE type. + */ +asn_struct_free_f CHOICE_free; +asn_struct_print_f CHOICE_print; +asn_constr_check_f CHOICE_constraint; +ber_type_decoder_f CHOICE_decode_ber; +der_type_encoder_f CHOICE_encode_der; +xer_type_decoder_f CHOICE_decode_xer; +xer_type_encoder_f CHOICE_encode_xer; +per_type_decoder_f CHOICE_decode_uper; +per_type_encoder_f CHOICE_encode_uper; +asn_outmost_tag_f CHOICE_outmost_tag; + +int _fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size); + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_CHOICE_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE.c b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE.c new file mode 100644 index 000000000..9ded30508 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE.c @@ -0,0 +1,1425 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "constr_SEQUENCE.h" +#include "per_opentype.h" + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) +#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * Check whether we are inside the extensions group. + */ +#define IN_EXTENSION_GROUP(specs, memb_idx) \ + ( ((memb_idx) > (specs)->ext_after) \ + &&((memb_idx) < (specs)->ext_before)) + + +/* + * Tags are canonically sorted in the tag2element map. + */ +static int +_t2e_cmp(const void *ap, const void *bp) { + const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; + const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; + + int a_class = BER_TAG_CLASS(a->el_tag); + int b_class = BER_TAG_CLASS(b->el_tag); + + if(a_class == b_class) { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + + if(a_value == b_value) { + if(a->el_no > b->el_no) + return 1; + /* + * Important: we do not check + * for a->el_no <= b->el_no! + */ + return 0; + } else if(a_value < b_value) + return -1; + else + return 1; + } else if(a_class < b_class) { + return -1; + } else { + return 1; + } +} + + +/* + * The decoder of the SEQUENCE type. + */ +asn_dec_rval_t +SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* SEQUENCE element's index */ + + ASN_DEBUG("Decoding %s as SEQUENCE", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) + ctx->left += rval.consumed; /* ?Substracted below! */ + ADVANCE(rval.consumed); + + NEXT_PHASE(ctx); + + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); + + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next member from the list of + * this structure's elements. + * (ctx->step) stores the member being processed + * between invocations and the microphase {0,1} of parsing + * that member: + * step = ( * 2 + ). + */ + for(edx = (ctx->step >> 1); edx < td->elements_count; + edx++, ctx->step = (ctx->step & ~1) + 2) { + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + ssize_t tag_len; /* Length of TLV's T */ + int opt_edx_end; /* Next non-optional element */ + int use_bsearch; + int n; + + if(ctx->step & 1) + goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + ASN_DEBUG("In %s SEQUENCE left %d, edx=%d flags=%d" + " opt=%d ec=%d", + td->name, (int)ctx->left, edx, + elements[edx].flags, elements[edx].optional, + td->elements_count); + + if(ctx->left == 0 /* No more stuff is expected */ + && ( + /* Explicit OPTIONAL specification reaches the end */ + (edx + elements[edx].optional + == td->elements_count) + || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before > td->elements_count) + ) + ) { + ASN_DEBUG("End of SEQUENCE %s", td->name); + /* + * Found the legitimate end of the structure. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("Current tag in %s SEQUENCE for element %d " + "(%s) is %s encoded in %d bytes, of frame %ld", + td->name, edx, elements[edx].name, + ber_tlv_tag_string(tlv_tag), (int)tag_len, (long)LEFT); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + ASN_DEBUG("edx = %d, opt = %d, ec=%d", + edx, elements[edx].optional, + td->elements_count); + if((edx + elements[edx].optional + == td->elements_count) + || (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before + > td->elements_count)) { + /* + * Yeah, baby! Found the terminator + * of the indefinite length structure. + */ + /* + * Proceed to the canonical + * finalization function. + * No advancing is necessary. + */ + goto phase3; + } + } + } + + /* + * Find the next available type with this tag. + */ + use_bsearch = 0; + opt_edx_end = edx + elements[edx].optional + 1; + if(opt_edx_end > td->elements_count) + opt_edx_end = td->elements_count; /* Cap */ + else if(opt_edx_end - edx > 8) { + /* Limit the scope of linear search... */ + opt_edx_end = edx + 8; + use_bsearch = 1; + /* ... and resort to bsearch() */ + } + for(n = edx; n < opt_edx_end; n++) { + if(BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) { + /* + * Found element corresponding to the tag + * being looked at. + * Reposition over the right element. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } else if(elements[n].flags & ATF_OPEN_TYPE) { + /* + * This is the ANY type, which may bear + * any flag whatsoever. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } else if(elements[n].tag == (ber_tlv_tag_t)-1) { + use_bsearch = 1; + break; + } + } + if(use_bsearch) { + /* + * Resort to a binary search over + * sorted array of tags. + */ + const asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + key.el_tag = tlv_tag; + key.el_no = edx; + t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, + specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _t2e_cmp); + if(t2m) { + const asn_TYPE_tag2member_t *best = 0; + const asn_TYPE_tag2member_t *t2m_f, *t2m_l; + int edx_max = edx + elements[edx].optional; + /* + * Rewind to the first element with that tag, + * `cause bsearch() does not guarantee order. + */ + t2m_f = t2m + t2m->toff_first; + t2m_l = t2m + t2m->toff_last; + for(t2m = t2m_f; t2m <= t2m_l; t2m++) { + if(t2m->el_no > edx_max) break; + if(t2m->el_no < edx) continue; + best = t2m; + } + if(best) { + edx = best->el_no; + ctx->step = 1 + 2 * edx; + goto microphase2; + } + } + n = opt_edx_end; + } + if(n == opt_edx_end) { + /* + * If tag is unknown, it may be either + * an unknown (thus, incorrect) tag, + * or an extension (...), + * or an end of the indefinite-length structure. + */ + if(!IN_EXTENSION_GROUP(specs, + edx + elements[edx].optional)) { + ASN_DEBUG("Unexpected tag %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + ASN_DEBUG("Expected tag %s (%s)%s", + ber_tlv_tag_string(elements[edx].tag), + elements[edx].name, + elements[edx].optional + ?" or alternatives":""); + RETURN(RC_FAIL); + } else { + /* Skip this tag */ + ssize_t skip; + edx += elements[edx].optional; + + ASN_DEBUG("Skipping unexpected %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + skip = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + ASN_DEBUG("Skip length %d in %s", + (int)skip, td->name); + switch(skip) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + ctx->step -= 2; + edx--; + continue; /* Try again with the next tag */ + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); + + /* + * Compute the position of the member inside a structure, + * and also a type of containment (it may be contained + * as pointer or using inline inclusion). + */ + if(elements[edx].flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); + } else { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elements[edx].memb_offset; + memb_ptr2 = &memb_ptr; + } + /* + * Invoke the member fetch routine according to member's type + */ + rval = elements[edx].type->ber_decoder(opt_codec_ctx, + elements[edx].type, + memb_ptr2, ptr, LEFT, + elements[edx].tag_mode); + ASN_DEBUG("In %s SEQUENCE decoded %d %s of %d " + "in %d bytes rval.code %d, size=%d", + td->name, edx, elements[edx].type->name, + (int)LEFT, (int)rval.consumed, rval.code, (int)size); + switch(rval.code) { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + ASN_DEBUG("Size violation (c->l=%ld <= s=%ld)", + (long)ctx->left, (long)size); + /* Fall through */ + case RC_FAIL: /* Fatal error */ + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all structure members) */ + + phase3: + ctx->phase = 3; + case 3: /* 00 and other tags expected */ + case 4: /* only 00's expected */ + + ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", + td->name, (long)ctx->left, (long)size); + + /* + * Skip everything until the end of the SEQUENCE. + */ + while(ctx->left) { + ssize_t tl, ll; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tl) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + /* + * If expected <0><0>... + */ + if(ctx->left < 0 + && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + ctx->phase = 4; + continue; + } + } + + if(!IN_EXTENSION_GROUP(specs, td->elements_count) + || ctx->phase == 4) { + ASN_DEBUG("Unexpected continuation " + "of a non-extensible type " + "%s (SEQUENCE): %s", + td->name, + ber_tlv_tag_string(tlv_tag)); + RETURN(RC_FAIL); + } + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tl, LEFT - tl); + switch(ll) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(tl + ll); + } + + PHASE_OUT(ctx); + } + + RETURN(RC_OK); +} + + +/* + * The DER encoder of the SEQUENCE type. + */ +asn_enc_rval_t +SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, + void *sptr, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + size_t computed_size = 0; + asn_enc_rval_t erval; + ssize_t ret; + int edx; + + ASN_DEBUG("%s %s as SEQUENCE", + cb?"Encoding":"Estimating", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) continue; + /* Mandatory element is missing */ + ASN__ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, + 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + ASN_DEBUG("Member %d %s estimated %ld bytes", + edx, elm->name, (long)erval.encoded); + } + + /* + * Encode the TLV for the sequence itself. + */ + ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + ASN_DEBUG("Wrote tags: %ld (+%ld)", (long)ret, (long)computed_size); + if(ret == -1) + ASN__ENCODE_FAILED; + erval.encoded = computed_size + ret; + + if(!cb) ASN__ENCODED_OK(erval); + + /* + * Encode all members. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmperval; + void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) continue; + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + tmperval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, + cb, app_key); + if(tmperval.encoded == -1) + return tmperval; + computed_size -= tmperval.encoded; + ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", + edx, elm->name, td->name, (long)tmperval.encoded); + } + + if(computed_size != 0) + /* + * Encoded size is not equal to the computed size. + */ + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(erval); +} + + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * ... and parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ + int edx_end; + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + * Phase 3: Skipping unknown extensions. + * Phase 4: PHASED OUT + */ + for(edx = ctx->step; ctx->phase <= 3;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + int n; + + /* + * Go inside the inner member of a sequence. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &td->elements[edx]; + + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Invoke the inner type decoder, m.b. multiple times */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, + elm->type, memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + if(tmprval.code != RC_OK) + RETURN(tmprval.code); + ctx->phase = 1; /* Back to body processing */ + ctx->step = ++edx; + ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", + ctx->phase, ctx->step); + /* Fall through */ + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, + &ch_type); + if(ch_size == -1) { + RETURN(RC_FAIL); + } else { + switch(ch_type) { + case PXER_WMORE: + RETURN(RC_WMORE); + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", + tcv, ctx->phase, xml_tag); + + /* Skip the extensions section */ + if(ctx->phase == 3) { + switch(xer_skip_unknown(tcv, &ctx->left)) { + case -1: + ctx->phase = 4; + RETURN(RC_FAIL); + case 0: + XER_ADVANCE(ch_size); + continue; + case 1: + XER_ADVANCE(ch_size); + ctx->phase = 1; + continue; + case 2: + ctx->phase = 1; + break; + } + } + + switch(tcv) { + case XCT_CLOSING: + if(ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if(ctx->phase == 0) { + if(edx >= td->elements_count + || + /* Explicit OPTIONAL specs reaches the end */ + (edx + elements[edx].optional + == td->elements_count) + || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before + > td->elements_count) + ) { + XER_ADVANCE(ch_size); + ctx->phase = 4; /* Phase out */ + RETURN(RC_OK); + } else { + ASN_DEBUG("Premature end of XER SEQUENCE"); + RETURN(RC_FAIL); + } + } + /* Fall through */ + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", + tcv, ctx->phase, edx); + if(ctx->phase != 1) { + break; /* Really unexpected */ + } + + if(edx < td->elements_count) { + /* + * Search which member corresponds to this tag. + */ + edx_end = edx + elements[edx].optional + 1; + if(edx_end > td->elements_count) + edx_end = td->elements_count; + for(n = edx; n < edx_end; n++) { + elm = &td->elements[n]; + tcv = xer_check_tag(buf_ptr, + ch_size, elm->name); + switch(tcv) { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx = n; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + n = edx_end; + break; /* Phase out */ + } + break; + } + if(n != edx_end) + continue; + } else { + ASN_DEBUG("Out of defined members: %d/%d", + edx, td->elements_count); + } + + /* It is expected extension */ + if(IN_EXTENSION_GROUP(specs, + edx + (edx < td->elements_count + ? elements[edx].optional : 0))) { + ASN_DEBUG("Got anticipated extension at %d", + edx); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if(tcv & XCT_CLOSING) { + /* Found without body */ + } else { + ctx->left = 1; + ctx->phase = 3; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", + size>0?((const char *)buf_ptr)[0]:'.', + size>1?((const char *)buf_ptr)[1]:'.', + size>2?((const char *)buf_ptr)[2]:'.', + size>3?((const char *)buf_ptr)[3]:'.', + size>4?((const char *)buf_ptr)[4]:'.', + size>5?((const char *)buf_ptr)[5]:'.'); + break; + } + + ctx->phase = 4; /* "Phase out" on hard failure */ + RETURN(RC_FAIL); +} + +asn_enc_rval_t +SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + int xcan = (flags & XER_F_CANONICAL); + int edx; + + if(!sptr) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + for(edx = 0; edx < td->elements_count; edx++) { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + continue; + /* Mandatory element is missing */ + ASN__ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + if(!xcan) ASN__TEXT_INDENT(1, ilevel); + ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); + + /* Print the member itself */ + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + ASN__CALLBACK3("", 1); + er.encoded += 5 + (2 * mlen) + tmper.encoded; + } + + if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +int +SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + int edx; + int ret; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* Dump preamble */ + if(cb(td->name, strlen(td->name), app_key) < 0 + || cb(" ::= {", 6, app_key) < 0) + return -1; + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) continue; + /* Print line */ + /* Fall through */ + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Indentation */ + _i_INDENT(1); + + /* Print the member's name and stuff */ + if(cb(elm->name, strlen(elm->name), app_key) < 0 + || cb(": ", 2, app_key) < 0) + return -1; + + /* Print the member itself */ + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, + cb, app_key); + if(ret) return ret; + } + + ilevel--; + _i_INDENT(1); + + return (cb("}", 1, app_key) < 0) ? -1 : 0; +} + +void +SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { + int edx; + + if(!td || !sptr) + return; + + ASN_DEBUG("Freeing %s as SEQUENCE", td->name); + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } + } + + if(!contents_only) { + FREEMEM(sptr); + } +} + +int +SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + int edx; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* + * Iterate over structure members and check their validity. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + continue; + ASN__CTFAIL(app_key, td, sptr, + "%s: mandatory element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + if(elm->memb_constraints) { + int ret = elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if(ret) return ret; + } else { + int ret = elm->type->check_constraints(elm->type, + memb_ptr, ctfailcb, app_key); + if(ret) return ret; + /* + * Cannot inherit it earlier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + } + } + + return 0; +} + +asn_dec_rval_t +SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + void *st = *sptr; /* Target structure. */ + int extpresent; /* Extension additions are present */ + uint8_t *opres; /* Presence of optional root members */ + asn_per_data_t opmd; + asn_dec_rval_t rv; + int edx; + + (void)constraints; + + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) + ASN__DECODE_FAILED; + + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) ASN__DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as SEQUENCE (UPER)", td->name); + + /* Handle extensions */ + if(specs->ext_before >= 0) { + extpresent = per_get_few_bits(pd, 1); + if(extpresent < 0) ASN__DECODE_STARVED; + } else { + extpresent = 0; + } + + /* Prepare a place and read-in the presence bitmap */ + memset(&opmd, 0, sizeof(opmd)); + if(specs->roms_count) { + opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); + if(!opres) ASN__DECODE_FAILED; + /* Get the presence map */ + if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { + FREEMEM(opres); + ASN__DECODE_STARVED; + } + opmd.buffer = opres; + opmd.nbits = specs->roms_count; + ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", + td->name, specs->roms_count, *opres); + } else { + opres = 0; + } + + /* + * Get the sequence ROOT elements. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Deal with optionality */ + if(elm->optional) { + int present = per_get_few_bits(&opmd, 1); + ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", + td->name, elm->name, present, + (int)opmd.nboff, (int)opmd.nbits); + if(present == 0) { + /* This element is not present */ + if(elm->default_value) { + /* Fill-in DEFAULT */ + if(elm->default_value(1, memb_ptr2)) { + FREEMEM(opres); + ASN__DECODE_FAILED; + } + ASN_DEBUG("Filled-in default"); + } + /* The member is just not present */ + continue; + } + /* Fall through */ + } + + /* Fetch the member from the stream */ + ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + ASN_DEBUG("Failed decode %s in %s", + elm->name, td->name); + FREEMEM(opres); + return rv; + } + } + + /* Optionality map is not needed anymore */ + FREEMEM(opres); + + /* + * Deal with extensions. + */ + if(extpresent) { + ssize_t bmlength; + uint8_t *epres; /* Presence of extension members */ + asn_per_data_t epmd; + + bmlength = uper_get_nslength(pd); + if(bmlength < 0) ASN__DECODE_STARVED; + + ASN_DEBUG("Extensions %ld present in %s", (long)bmlength, td->name); + + epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); + if(!epres) ASN__DECODE_STARVED; + + /* Get the extensions map */ + if(per_get_many_bits(pd, epres, 0, bmlength)) { + FREEMEM(epres); + ASN__DECODE_STARVED; + } + + memset(&epmd, 0, sizeof(epmd)); + epmd.buffer = epres; + epmd.nbits = bmlength; + ASN_DEBUG("Read in extensions bitmap for %s of %ld bits (%x..)", + td->name, (long)bmlength, *epres); + + /* Go over extensions and read them in */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%d is not extension", edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (void *)((char *)st + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + present = per_get_few_bits(&epmd, 1); + if(present <= 0) { + if(present < 0) break; /* No more extensions */ + continue; + } + + ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + FREEMEM(epres); + return rv; + } + } + + /* Skip over overflow extensions which aren't present + * in this system's version of the protocol */ + for(;;) { + ASN_DEBUG("Getting overflow extensions"); + switch(per_get_few_bits(&epmd, 1)) { + case -1: break; + case 0: continue; + default: + if(uper_open_type_skip(opt_codec_ctx, pd)) { + FREEMEM(epres); + ASN__DECODE_STARVED; + } + } + break; + } + + FREEMEM(epres); + } + + /* Fill DEFAULT members in extensions */ + for(edx = specs->roms_count; edx < specs->roms_count + + specs->aoms_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void **memb_ptr2; /* Pointer to member pointer */ + + if(!elm->default_value) continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + if(*memb_ptr2) continue; + } else { + continue; /* Extensions are all optionals */ + } + + /* Set default value */ + if(elm->default_value(1, memb_ptr2)) { + ASN__DECODE_FAILED; + } + } + + rv.consumed = 0; + rv.code = RC_OK; + return rv; +} + +static int +SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, + asn_per_outp_t *po1, asn_per_outp_t *po2) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + int exts_present = 0; + int exts_count = 0; + int edx; + + if(specs->ext_before < 0) + return 0; + + /* Find out which extensions are present */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + ASN_DEBUG("checking %s (@%d) present => %d", + elm->type->name, edx, present); + exts_count++; + exts_present += present; + + /* Encode as presence marker */ + if(po1 && per_put_few_bits(po1, present, 1)) + return -1; + /* Encode as open type field */ + if(po2 && present && uper_open_type_put(elm->type, + elm->per_constraints, *memb_ptr2, po2)) + return -1; + + } + + return exts_present ? exts_count : 0; +} + +asn_enc_rval_t +SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int n_extensions; + int edx; + int i; + + (void)constraints; + + if(!sptr) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE (UPER)", td->name); + + + /* + * X.691#18.1 Whether structure is extensible + * and whether to encode extensions + */ + if(specs->ext_before >= 0) { + n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + per_put_few_bits(po, n_extensions ? 1 : 0, 1); + } else { + n_extensions = 0; /* There are no extensions to encode */ + } + + /* Encode a presence bitmap */ + for(i = 0; i < specs->roms_count; i++) { + asn_TYPE_member_t *elm; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + edx = specs->oms[i]; + elm = &td->elements[edx]; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + /* Eliminate default values */ + if(present && elm->default_value + && elm->default_value(0, memb_ptr2) == 1) + present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", + td->name, elm->name, present ? "present" : "absent"); + if(per_put_few_bits(po, present, 1)) + ASN__ENCODE_FAILED; + } + + /* + * Encode the sequence ROOT elements. + */ + ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); + for(edx = 0; edx < ((specs->ext_after < 0) + ? td->elements_count : specs->ext_before - 1); edx++) { + + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + ASN_DEBUG("About to encode %s", elm->type->name); + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if(!*memb_ptr2) { + ASN_DEBUG("Element %s %d not present", + elm->name, edx); + if(elm->optional) + continue; + /* Mandatory element is missing */ + ASN__ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + /* Eliminate default values */ + if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) + continue; + + ASN_DEBUG("Encoding %s->%s", td->name, elm->name); + er = elm->type->uper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if(er.encoded == -1) + return er; + } + + /* No extensions to encode */ + if(!n_extensions) ASN__ENCODED_OK(er); + + ASN_DEBUG("Length of %d bit-map", n_extensions); + /* #18.8. Write down the presence bit-map length. */ + if(uper_put_nslength(po, n_extensions)) + ASN__ENCODE_FAILED; + + ASN_DEBUG("Bit-map of %d elements", n_extensions); + /* #18.7. Encoding the extensions presence bit-map. */ + /* TODO: act upon NOTE in #18.7 for canonical PER */ + if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + ASN__ENCODE_FAILED; + + ASN_DEBUG("Writing %d extensions", n_extensions); + /* #18.9. Encode extensions as open type fields. */ + if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE.h b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE.h new file mode 100644 index 000000000..6a7c6e5ed --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SEQUENCE_H_ +#define _CONSTR_SEQUENCE_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef const struct asn_SEQUENCE_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + /* + * Tags to members mapping table (sorted). + */ + const asn_TYPE_tag2member_t *tag2el; + int tag2el_count; + + /* + * Optional members of the extensions root (roms) or additions (aoms). + * Meaningful for PER. + */ + const int *oms; /* Optional MemberS */ + int roms_count; /* Root optional members count */ + int aoms_count; /* Additions optional members count */ + + /* + * Description of an extensions group. + */ + int ext_after; /* Extensions start after this member */ + int ext_before; /* Extensions stop before this member */ +} asn_SEQUENCE_specifics_t; + + +/* + * A set specialized functions dealing with the SEQUENCE type. + */ +asn_struct_free_f SEQUENCE_free; +asn_struct_print_f SEQUENCE_print; +asn_constr_check_f SEQUENCE_constraint; +ber_type_decoder_f SEQUENCE_decode_ber; +der_type_encoder_f SEQUENCE_encode_der; +xer_type_decoder_f SEQUENCE_decode_xer; +xer_type_encoder_f SEQUENCE_encode_xer; +per_type_decoder_f SEQUENCE_decode_uper; +per_type_encoder_f SEQUENCE_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SEQUENCE_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE_OF.c b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE_OF.c new file mode 100644 index 000000000..f6cd4f20f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE_OF.c @@ -0,0 +1,208 @@ +/*- + * Copyright (c) 2003, 2004, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "constr_SEQUENCE_OF.h" +#include "asn_SEQUENCE_OF.h" + +/* + * The DER encoder of the SEQUENCE OF type. + */ +asn_enc_rval_t +SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr); + size_t computed_size = 0; + ssize_t encoding_size = 0; + asn_enc_rval_t erval; + int edx; + + ASN_DEBUG("Estimating size of SEQUENCE OF %s", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, + 0, elm->tag, + 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + } + + /* + * Encode the TLV for the sequence itself. + */ + encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, + cb, app_key); + if(encoding_size == -1) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + computed_size += encoding_size; + if(!cb) { + erval.encoded = computed_size; + ASN__ENCODED_OK(erval); + } + + ASN_DEBUG("Encoding members of SEQUENCE OF %s", td->name); + + /* + * Encode all members. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, + 0, elm->tag, + cb, app_key); + if(erval.encoded == -1) + return erval; + encoding_size += erval.encoded; + } + + if(computed_size != (size_t)encoding_size) { + /* + * Encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } else { + erval.encoded = computed_size; + erval.structure_ptr = 0; + erval.failed_type = 0; + } + + return erval; +} + +asn_enc_rval_t +SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr); + const char *mname = specs->as_XMLValueList + ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + unsigned int mlen = mname ? strlen(mname) : 0; + int xcan = (flags & XER_F_CANONICAL); + int i; + + if(!sptr) ASN__ENCODE_FAILED; + + er.encoded = 0; + + for(i = 0; i < list->count; i++) { + asn_enc_rval_t tmper; + void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + if(mname) { + if(!xcan) ASN__TEXT_INDENT(1, ilevel); + ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); + } + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + if(tmper.encoded == 0 && specs->as_XMLValueList) { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + if(!xcan) ASN__TEXT_INDENT(1, ilevel + 1); + ASN__CALLBACK3("<", 1, name, len, "/>", 2); + } + + if(mname) { + ASN__CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; + } + + if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +asn_enc_rval_t +SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_anonymous_sequence_ *list; + asn_per_constraint_t *ct; + asn_enc_rval_t er; + asn_TYPE_member_t *elm = td->elements; + int seq; + + if(!sptr) ASN__ENCODE_FAILED; + list = _A_SEQUENCE_FROM_VOID(sptr); + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count); + + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->per_constraints->size; + else ct = 0; + + /* If extensible constraint, check if size is in root */ + if(ct) { + int not_in_root = (list->count < ct->lower_bound + || list->count > ct->upper_bound); + ASN_DEBUG("lb %ld ub %ld %s", + ct->lower_bound, ct->upper_bound, + ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); + if(ct->flags & APC_EXTENSIBLE) { + /* Declare whether size is in extension root */ + if(per_put_few_bits(po, not_in_root, 1)) + ASN__ENCODE_FAILED; + if(not_in_root) ct = 0; + } else if(not_in_root && ct->effective_bits >= 0) + ASN__ENCODE_FAILED; + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ + if(per_put_few_bits(po, list->count - ct->lower_bound, + ct->effective_bits)) + ASN__ENCODE_FAILED; + } + + for(seq = -1; seq < list->count;) { + ssize_t mayEncode; + if(seq < 0) seq = 0; + if(ct && ct->effective_bits >= 0) { + mayEncode = list->count; + } else { + mayEncode = uper_put_length(po, list->count - seq); + if(mayEncode < 0) ASN__ENCODE_FAILED; + } + + while(mayEncode--) { + void *memb_ptr = list->array[seq++]; + if(!memb_ptr) ASN__ENCODE_FAILED; + er = elm->type->uper_encoder(elm->type, + elm->per_constraints, memb_ptr, po); + if(er.encoded == -1) + ASN__ENCODE_FAILED; + } + } + + ASN__ENCODED_OK(er); +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE_OF.h b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE_OF.h new file mode 100644 index 000000000..a8dae9625 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_SEQUENCE_OF.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SEQUENCE_OF_H_ +#define _CONSTR_SEQUENCE_OF_H_ + +#include "asn_application.h" +#include "constr_SET_OF.h" /* Implemented using SET OF */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A set specialized functions dealing with the SEQUENCE OF type. + * Generally implemented using SET OF. + */ +#define SEQUENCE_OF_free SET_OF_free +#define SEQUENCE_OF_print SET_OF_print +#define SEQUENCE_OF_constraint SET_OF_constraint +#define SEQUENCE_OF_decode_ber SET_OF_decode_ber +#define SEQUENCE_OF_decode_xer SET_OF_decode_xer +#define SEQUENCE_OF_decode_uper SET_OF_decode_uper +der_type_encoder_f SEQUENCE_OF_encode_der; +xer_type_encoder_f SEQUENCE_OF_encode_xer; +per_type_encoder_f SEQUENCE_OF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SET_OF_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_SET_OF.c b/plugins/inmarsat_support/aero/libacars/asn1/constr_SET_OF.c new file mode 100644 index 000000000..4a4fe2acf --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_SET_OF.c @@ -0,0 +1,954 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "constr_SET_OF.h" +#include "asn_SET_OF.h" + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) +#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * The decoder of the SET OF type. + */ +asn_dec_rval_t +SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + ASN_DEBUG("Decoding %s as SET OF", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) + ctx->left += rval.consumed; /* ?Substracted below! */ + ADVANCE(rval.consumed); + + ASN_DEBUG("Structure consumes %ld bytes, " + "buffer %ld", (long)ctx->left, (long)size); + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next item. + */ + for(;; ctx->step = 0) { + ssize_t tag_len; /* Length of TLV's T */ + + if(ctx->step & 1) + goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + + if(ctx->left == 0) { + ASN_DEBUG("End of SET OF %s", td->name); + /* + * No more things to decode. + * Exit out of here. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Found the terminator of the + * indefinite length structure. + */ + break; + } + } + + /* Outmost tag may be unknown and cannot be fetched/compared */ + if(elm->tag != (ber_tlv_tag_t)-1) { + if(BER_TAGS_EQUAL(tlv_tag, elm->tag)) { + /* + * The new list member of expected type has arrived. + */ + } else { + ASN_DEBUG("Unexpected tag %s fixed SET OF %s", + ber_tlv_tag_string(tlv_tag), td->name); + ASN_DEBUG("%s SET OF has tag %s", + td->name, ber_tlv_tag_string(elm->tag)); + RETURN(RC_FAIL); + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + + /* + * Invoke the member fetch routine according to member's type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, + elm->type, &ctx->ptr, ptr, LEFT, 0); + ASN_DEBUG("In %s SET OF %s code %d consumed %d", + td->name, elm->type->name, + rval.code, (int)rval.consumed); + switch(rval.code) { + case RC_OK: + { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if(ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + else + ctx->ptr = 0; + } + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + /* Fall through */ + case RC_FAIL: /* Fatal error */ + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all list members) */ + + NEXT_PHASE(ctx); + case 2: + /* + * Read in all "end of content" TLVs. + */ + while(ctx->left < 0) { + if(LEFT < 2) { + if(LEFT > 0 && ((const char *)ptr)[0] != 0) { + /* Unexpected tag */ + RETURN(RC_FAIL); + } else { + RETURN(RC_WMORE); + } + } + if(((const char *)ptr)[0] == 0 + && ((const char *)ptr)[1] == 0) { + ADVANCE(2); + ctx->left++; + } else { + RETURN(RC_FAIL); + } + } + + PHASE_OUT(ctx); + } + + RETURN(RC_OK); +} + +/* + * Internally visible buffer holding a single encoded element. + */ +struct _el_buffer { + uint8_t *buf; + size_t length; + size_t size; +}; +/* Append bytes to the above structure */ +static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) { + struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr; + + if(el_buf->length + size > el_buf->size) + return -1; + + memcpy(el_buf->buf + el_buf->length, buffer, size); + + el_buf->length += size; + return 0; +} +static int _el_buf_cmp(const void *ap, const void *bp) { + const struct _el_buffer *a = (const struct _el_buffer *)ap; + const struct _el_buffer *b = (const struct _el_buffer *)bp; + int ret; + size_t common_len; + + if(a->length < b->length) + common_len = a->length; + else + common_len = b->length; + + ret = memcmp(a->buf, b->buf, common_len); + if(ret == 0) { + if(a->length < b->length) + ret = -1; + else if(a->length > b->length) + ret = 1; + } + + return ret; +} + +/* + * The DER encoder of the SET OF type. + */ +asn_enc_rval_t +SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_TYPE_descriptor_t *elm_type = elm->type; + der_type_encoder_f *der_encoder = elm_type->der_encoder; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + size_t computed_size = 0; + ssize_t encoding_size = 0; + struct _el_buffer *encoded_els; + ssize_t eels_count = 0; + size_t max_encoded_len = 1; + asn_enc_rval_t erval; + int ret; + int edx; + + ASN_DEBUG("Estimating size for SET OF %s", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + + /* Compute maximum encoding's size */ + if(max_encoded_len < (size_t)erval.encoded) + max_encoded_len = erval.encoded; + } + + /* + * Encode the TLV for the sequence itself. + */ + encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, + cb, app_key); + if(encoding_size == -1) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + computed_size += encoding_size; + + if(!cb || list->count == 0) { + erval.encoded = computed_size; + ASN__ENCODED_OK(erval); + } + + /* + * DER mandates dynamic sorting of the SET OF elements + * according to their encodings. Build an array of the + * encoded elements. + */ + encoded_els = (struct _el_buffer *)MALLOC( + list->count * sizeof(encoded_els[0])); + if(encoded_els == NULL) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + ASN_DEBUG("Encoding members of %s SET OF", td->name); + + /* + * Encode all members. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + struct _el_buffer *encoded_el = &encoded_els[eels_count]; + + if(!memb_ptr) continue; + + /* + * Prepare space for encoding. + */ + encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); + if(encoded_el->buf) { + encoded_el->length = 0; + encoded_el->size = max_encoded_len; + } else { + for(edx--; edx >= 0; edx--) + FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + /* + * Encode the member into the prepared space. + */ + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, + _el_addbytes, encoded_el); + if(erval.encoded == -1) { + for(; edx >= 0; edx--) + FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + return erval; + } + encoding_size += erval.encoded; + eels_count++; + } + + /* + * Sort the encoded elements according to their encoding. + */ + qsort(encoded_els, eels_count, sizeof(encoded_els[0]), _el_buf_cmp); + + /* + * Report encoded elements to the application. + * Dispose of temporary sorted members table. + */ + ret = 0; + for(edx = 0; edx < eels_count; edx++) { + struct _el_buffer *encoded_el = &encoded_els[edx]; + /* Report encoded chunks to the application */ + if(ret == 0 + && cb(encoded_el->buf, encoded_el->length, app_key) < 0) + ret = -1; + FREEMEM(encoded_el->buf); + } + FREEMEM(encoded_els); + + if(ret || computed_size != (size_t)encoding_size) { + /* + * Standard callback failed, or + * encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } else { + erval.encoded = computed_size; + } + + ASN__ENCODED_OK(erval); +} + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *element = td->elements; + const char *elm_tag; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * ... and parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* Which tag is expected for the downstream */ + if(specs->as_XMLValueList) { + elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; + } else { + elm_tag = (*element->name) + ? element->name : element->type->xml_tag; + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + */ + for(; ctx->phase <= 2;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + + /* + * Go inside the inner member of a set. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + + /* Invoke the inner type decoder, m.b. multiple times */ + ASN_DEBUG("XER/SET OF element [%s]", elm_tag); + tmprval = element->type->xer_decoder(opt_codec_ctx, + element->type, &ctx->ptr, elm_tag, + buf_ptr, size); + if(tmprval.code == RC_OK) { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if(ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + ctx->ptr = 0; + XER_ADVANCE(tmprval.consumed); + } else { + XER_ADVANCE(tmprval.consumed); + RETURN(tmprval.code); + } + ctx->phase = 1; /* Back to body processing */ + ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); + /* Fall through */ + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, + buf_ptr, size, &ch_type); + if(ch_size == -1) { + RETURN(RC_FAIL); + } else { + switch(ch_type) { + case PXER_WMORE: + RETURN(RC_WMORE); + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", + tcv, ctx->phase, xml_tag); + switch(tcv) { + case XCT_CLOSING: + if(ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if(ctx->phase == 0) { + /* No more things to decode */ + XER_ADVANCE(ch_size); + ctx->phase = 3; /* Phase out */ + RETURN(RC_OK); + } + /* Fall through */ + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); + if(ctx->phase == 1) { + /* + * Process a single possible member. + */ + ctx->phase = 2; + continue; + } + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SET OF"); + break; + } + + ctx->phase = 3; /* "Phase out" on hard failure */ + RETURN(RC_FAIL); +} + + + +typedef struct xer_tmp_enc_s { + void *buffer; + size_t offset; + size_t size; +} xer_tmp_enc_t; +static int +SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { + xer_tmp_enc_t *t = (xer_tmp_enc_t *)key; + if(t->offset + size >= t->size) { + size_t newsize = (t->size << 2) + size; + void *p = REALLOC(t->buffer, newsize); + if(!p) return -1; + t->buffer = p; + t->size = newsize; + } + memcpy((char *)t->buffer + t->offset, buffer, size); + t->offset += size; + return 0; +} +static int +SET_OF_xer_order(const void *aptr, const void *bptr) { + const xer_tmp_enc_t *a = (const xer_tmp_enc_t *)aptr; + const xer_tmp_enc_t *b = (const xer_tmp_enc_t *)bptr; + size_t minlen = a->offset; + int ret; + if(b->offset < minlen) minlen = b->offset; + /* Well-formed UTF-8 has this nice lexicographical property... */ + ret = memcmp(a->buffer, b->buffer, minlen); + if(ret != 0) return ret; + if(a->offset == b->offset) + return 0; + if(a->offset == minlen) + return -1; + return 1; +} + + +asn_enc_rval_t +SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr); + const char *mname = specs->as_XMLValueList + ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + size_t mlen = mname ? strlen(mname) : 0; + int xcan = (flags & XER_F_CANONICAL); + xer_tmp_enc_t *encs = 0; + size_t encs_count = 0; + void *original_app_key = app_key; + asn_app_consume_bytes_f *original_cb = cb; + int i; + + if(!sptr) ASN__ENCODE_FAILED; + + if(xcan) { + encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); + if(!encs) ASN__ENCODE_FAILED; + cb = SET_OF_encode_xer_callback; + } + + er.encoded = 0; + + for(i = 0; i < list->count; i++) { + asn_enc_rval_t tmper; + + void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + if(encs) { + memset(&encs[encs_count], 0, sizeof(encs[0])); + app_key = &encs[encs_count]; + encs_count++; + } + + if(mname) { + if(!xcan) ASN__TEXT_INDENT(1, ilevel); + ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); + } + + if(!xcan && specs->as_XMLValueList == 1) + ASN__TEXT_INDENT(1, ilevel + 1); + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + (specs->as_XMLValueList != 2), + flags, cb, app_key); + if(tmper.encoded == -1) { + td = tmper.failed_type; + sptr = tmper.structure_ptr; + goto cb_failed; + } + if(tmper.encoded == 0 && specs->as_XMLValueList) { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + ASN__CALLBACK3("<", 1, name, len, "/>", 2); + } + + if(mname) { + ASN__CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; + } + + if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); + + if(encs) { + xer_tmp_enc_t *enc = encs; + xer_tmp_enc_t *end = encs + encs_count; + ssize_t control_size = 0; + + cb = original_cb; + app_key = original_app_key; + qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); + + for(; enc < end; enc++) { + ASN__CALLBACK(enc->buffer, enc->offset); + FREEMEM(enc->buffer); + enc->buffer = 0; + control_size += enc->offset; + } + assert(control_size == er.encoded); + } + + goto cleanup; +cb_failed: + er.encoded = -1; + er.failed_type = td; + er.structure_ptr = sptr; +cleanup: + if(encs) { + while(encs_count-- > 0) { + if(encs[encs_count].buffer) + FREEMEM(encs[encs_count].buffer); + } + FREEMEM(encs); + } + ASN__ENCODED_OK(er); +} + +int +SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); + int ret; + int i; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* Dump preamble */ + if(cb(td->name, strlen(td->name), app_key) < 0 + || cb(" ::= {", 6, app_key) < 0) + return -1; + + for(i = 0; i < list->count; i++) { + const void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + _i_INDENT(1); + + ret = elm->type->print_struct(elm->type, memb_ptr, + ilevel + 1, cb, app_key); + if(ret) return ret; + } + + ilevel--; + _i_INDENT(1); + + return (cb("}", 1, app_key) < 0) ? -1 : 0; +} + +void +SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + if(td && ptr) { + asn_SET_OF_specifics_t *specs; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + asn_struct_ctx_t *ctx; /* Decoder context */ + int i; + + /* + * Could not use set_of_empty() because of (*free) + * incompatibility. + */ + for(i = 0; i < list->count; i++) { + void *memb_ptr = list->array[i]; + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + list->count = 0; /* No meaningful elements left */ + + asn_set_empty(list); /* Remove (list->array) */ + + specs = (asn_SET_OF_specifics_t *)td->specifics; + ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); + if(ctx->ptr) { + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + } + + if(!contents_only) { + FREEMEM(ptr); + } + } +} + +int +SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_constr_check_f *constr; + const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); + int i; + + if(!sptr) { + ASN__CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + constr = elm->memb_constraints; + if(!constr) constr = elm->type->check_constraints; + + /* + * Iterate over the members of an array. + * Validate each in turn, until one fails. + */ + for(i = 0; i < list->count; i++) { + const void *memb_ptr = list->array[i]; + int ret; + + if(!memb_ptr) continue; + + ret = constr(elm->type, memb_ptr, ctfailcb, app_key); + if(ret) return ret; + } + + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + if(!elm->memb_constraints) + elm->memb_constraints = elm->type->check_constraints; + + return 0; +} + +asn_dec_rval_t +SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + void *st = *sptr; + asn_anonymous_set_ *list; + asn_per_constraint_t *ct; + int repeat = 0; + ssize_t nelems; + + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) + ASN__DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) ASN__DECODE_FAILED; + } + list = _A_SET_FROM_VOID(st); + + /* Figure out which constraints to use */ + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->per_constraints->size; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int value = per_get_few_bits(pd, 1); + if(value < 0) ASN__DECODE_STARVED; + if(value) ct = 0; /* Not restricted! */ + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ + nelems = per_get_few_bits(pd, ct->effective_bits); + ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", + (long)nelems, ct->lower_bound, td->name); + if(nelems < 0) ASN__DECODE_STARVED; + nelems += ct->lower_bound; + } else { + nelems = -1; + } + + do { + int i; + if(nelems < 0) { + nelems = uper_get_length(pd, + ct ? ct->effective_bits : -1, &repeat); + ASN_DEBUG("Got to decode %d elements (eff %d)", + (int)nelems, (int)(ct ? ct->effective_bits : -1)); + if(nelems < 0) ASN__DECODE_STARVED; + } + + for(i = 0; i < nelems; i++) { + void *ptr = 0; + ASN_DEBUG("SET OF %s decoding", elm->type->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, &ptr, pd); + ASN_DEBUG("%s SET OF %s decoded %d, %p", + td->name, elm->type->name, rv.code, ptr); + if(rv.code == RC_OK) { + if(ASN_SET_ADD(list, ptr) == 0) + continue; + ASN_DEBUG("Failed to add element into %s", + td->name); + /* Fall through */ + rv.code = RC_FAIL; + } else { + ASN_DEBUG("Failed decoding %s of %s (SET OF)", + elm->type->name, td->name); + } + if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); + return rv; + } + + nelems = -1; /* Allow uper_get_length() */ + } while(repeat); + + ASN_DEBUG("Decoded %s as SET OF", td->name); + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_SET_OF.h b/plugins/inmarsat_support/aero/libacars/asn1/constr_SET_OF.h new file mode 100644 index 000000000..c0f1db8d9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_SET_OF.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SET_OF_H_ +#define _CONSTR_SET_OF_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef const struct asn_SET_OF_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + /* XER-specific stuff */ + int as_XMLValueList; /* The member type must be encoded like this */ +} asn_SET_OF_specifics_t; + +/* + * A set specialized functions dealing with the SET OF type. + */ +asn_struct_free_f SET_OF_free; +asn_struct_print_f SET_OF_print; +asn_constr_check_f SET_OF_constraint; +ber_type_decoder_f SET_OF_decode_ber; +der_type_encoder_f SET_OF_encode_der; +xer_type_decoder_f SET_OF_decode_xer; +xer_type_encoder_f SET_OF_encode_xer; +per_type_decoder_f SET_OF_decode_uper; +per_type_encoder_f SET_OF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SET_OF_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_TYPE.c b/plugins/inmarsat_support/aero/libacars/asn1/constr_TYPE.c new file mode 100644 index 000000000..75b0631be --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_TYPE.c @@ -0,0 +1,108 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "constr_TYPE.h" +#include +#include + +/* + * Version of the ASN.1 infrastructure shipped with compiler. + */ +int get_asn1c_environment_version() { return ASN1C_ENVIRONMENT_VERSION; } + +static asn_app_consume_bytes_f _print2fp; + +/* + * Return the outmost tag of the type. + */ +ber_tlv_tag_t +asn_TYPE_outmost_tag(const asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag) { + + if(tag_mode) + return tag; + + if(type_descriptor->tags_count) + return type_descriptor->tags[0]; + + return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0); +} + +/* + * Print the target language's structure in human readable form. + */ +int +asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr, int indent) { + if(!stream) stream = stdout; + if(!td || !struct_ptr) { + errno = EINVAL; + return -1; + } + + /* Invoke type-specific printer */ + if(td->print_struct(td, struct_ptr, indent, _print2fp, stream)) + return -1; + + /* Terminate the output */ + if(_print2fp("\n", 1, stream)) + return -1; + + return fflush(stream); +} + +/* Dump the data into the specified stdio stream */ +static int +_print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + +/* Append the data to the specified vstring */ +static int +_print2vstring(const void *buffer, size_t size, void *app_key) { + la_vstring *vstr = (la_vstring *)app_key; + la_vstring_append_buffer(vstr, buffer, size); + return 0; +} + +/* libacars-specific printer */ +int +asn_sprintf(la_vstring *vstr, asn_TYPE_descriptor_t *td, const void *struct_ptr, int indent) { + if(!vstr || !td || !struct_ptr) { + errno = EINVAL; + return -1; + } + + /* Invoke type-specific printer */ + if(td->print_struct(td, struct_ptr, indent, _print2vstring, vstr)) + return -1; + + return 0; +} + +/* + * Some compilers do not support variable args macros. + * This function is a replacement of ASN_DEBUG() macro. + */ +void ASN_DEBUG_f(const char *fmt, ...); +void ASN_DEBUG_f(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + +#if EMIT_ASN_DEBUG == 1 +#ifdef __GNUC__ +#ifndef ASN_THREAD_SAFE +int asn_debug_indent; +#endif +#endif +#endif diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constr_TYPE.h b/plugins/inmarsat_support/aero/libacars/asn1/constr_TYPE.h new file mode 100644 index 000000000..08ca8af95 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constr_TYPE.h @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This file contains the declaration structure called "ASN.1 Type Definition", + * which holds all information necessary for encoding and decoding routines. + * This structure even contains pointer to these encoding and decoding routines + * for each defined ASN.1 type. + */ +#ifndef _CONSTR_TYPE_H_ +#define _CONSTR_TYPE_H_ + +#include "ber_tlv_length.h" +#include "ber_tlv_tag.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ +struct asn_TYPE_member_s; /* Forward declaration */ + +/* + * This type provides the context information for various ASN.1 routines, + * primarily ones doing decoding. A member _asn_ctx of this type must be + * included into certain target language's structures, such as compound types. + */ +typedef struct asn_struct_ctx_s { + short phase; /* Decoding phase */ + short step; /* Elementary step of a phase */ + int context; /* Other context information */ + void *ptr; /* Decoder-specific stuff (stack elements) */ + ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */ +} asn_struct_ctx_t; + +#include "ber_decoder.h" /* Basic Encoding Rules decoder */ +#include "der_encoder.h" /* Distinguished Encoding Rules encoder */ +#include "xer_decoder.h" /* Decoder of XER (XML, text) */ +#include "xer_encoder.h" /* Encoder into XER (XML, text) */ +#include "per_decoder.h" /* Packet Encoding Rules decoder */ +#include "per_encoder.h" /* Packet Encoding Rules encoder */ +#include "constraints.h" /* Subtype constraints support */ +#include /* libacars vstring */ + +/* + * Free the structure according to its specification. + * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) + * will not be freed. (It may be useful in case the structure is allocated + * statically or arranged on the stack, yet its elements are allocated + * dynamically.) + */ +typedef void (asn_struct_free_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, int free_contents_only); +#define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF),ptr,0) +#define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ + (asn_DEF).free_struct(&(asn_DEF),ptr,1) + +/* + * Print the structure according to its specification. + */ +typedef int (asn_struct_print_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, + int level, /* Indentation level */ + asn_app_consume_bytes_f *callback, void *app_key); + +/* + * Return the outmost tag of the type. + * If the type is untagged CHOICE, the dynamic operation is performed. + * NOTE: This function pointer type is only useful internally. + * Do not use it in your application. + */ +typedef ber_tlv_tag_t (asn_outmost_tag_f)( + const struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); +/* The instance of the above function type; used internally. */ +asn_outmost_tag_f asn_TYPE_outmost_tag; + + +/* + * The definitive description of the destination language's structure. + */ +typedef struct asn_TYPE_descriptor_s { + const char *name; /* A name of the ASN.1 type. "" in some cases. */ + const char *xml_tag; /* Name used in XML tag */ + + /* + * Generalized functions for dealing with the specific type. + * May be directly invoked by applications. + */ + asn_struct_free_f *free_struct; /* Free the structure */ + asn_struct_print_f *print_struct; /* Human readable output */ + asn_constr_check_f *check_constraints; /* Constraints validator */ + ber_type_decoder_f *ber_decoder; /* Generic BER decoder */ + der_type_encoder_f *der_encoder; /* Canonical DER encoder */ + xer_type_decoder_f *xer_decoder; /* Generic XER decoder */ + xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */ + per_type_decoder_f *uper_decoder; /* Unaligned PER decoder */ + per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ + + /*********************************************************************** + * Internally useful members. Not to be used by applications directly. * + **********************************************************************/ + + /* + * Tags that are expected to occur. + */ + asn_outmost_tag_f *outmost_tag; /* */ + const ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ + int tags_count; /* Number of tags which are expected */ + const ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */ + int all_tags_count; /* Number of tags */ + + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + + /* + * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). + */ + struct asn_TYPE_member_s *elements; + int elements_count; + + /* + * Additional information describing the type, used by appropriate + * functions above. + */ + const void *specifics; +} asn_TYPE_descriptor_t; + +/* + * This type describes an element of the constructed type, + * i.e. SEQUENCE, SET, CHOICE, etc. + */ + enum asn_TYPE_flags_e { + ATF_NOFLAGS, + ATF_POINTER = 0x01, /* Represented by the pointer */ + ATF_OPEN_TYPE = 0x02 /* ANY type, without meaningful tag */ + }; +typedef struct asn_TYPE_member_s { + enum asn_TYPE_flags_e flags; /* Element's presentation flags */ + int optional; /* Following optional members, including current */ + int memb_offset; /* Offset of the element */ + ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ + int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_constr_check_f *memb_constraints; /* Constraints validator */ + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + int (*default_value)(int setval, void **sptr); /* DEFAULT */ + const char *name; /* ASN.1 identifier of the element */ +} asn_TYPE_member_t; + +/* + * BER tag to element number mapping. + */ +typedef struct asn_TYPE_tag2member_s { + ber_tlv_tag_t el_tag; /* Outmost tag of the member */ + int el_no; /* Index of the associated member, base 0 */ + int toff_first; /* First occurence of the el_tag, relative */ + int toff_last; /* Last occurence of the el_tag, relatvie */ +} asn_TYPE_tag2member_t; + +/* + * This function is a wrapper around (td)->print_struct, which prints out + * the contents of the target language's structure (struct_ptr) into the + * file pointer (stream) in human readable form. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem dumping the structure. + * (See also xer_fprint() in xer_encoder.h) + */ +int asn_fprint(FILE *stream, /* Destination stream descriptor */ + asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ + const void *struct_ptr, /* Structure to be printed */ + int indent); /* Indentation level */ + +/* libacars-specific printing routine */ + +int asn_sprintf(la_vstring *vstr, /* Destination vstring pointer */ + asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ + const void *struct_ptr, /* Structure to be printed */ + int indent); /* Indentation level */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_TYPE_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constraints.c b/plugins/inmarsat_support/aero/libacars/asn1/constraints.c new file mode 100644 index 000000000..1bdda73e5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constraints.c @@ -0,0 +1,93 @@ +#include "asn_internal.h" +#include "constraints.h" + +int +asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { + + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ + + /* Nothing to check */ + return 0; +} + +int +asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { + + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ + + /* Unknown how to check */ + return 0; +} + +struct errbufDesc { + asn_TYPE_descriptor_t *failed_type; + const void *failed_struct_ptr; + char *errbuf; + size_t errlen; +}; + +static void +_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { + struct errbufDesc *arg = key; + va_list ap; + ssize_t vlen; + ssize_t maxlen; + + arg->failed_type = td; + arg->failed_struct_ptr = sptr; + + maxlen = arg->errlen; + if(maxlen <= 0) + return; + + va_start(ap, fmt); + vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); + va_end(ap); + if(vlen >= maxlen) { + arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ + arg->errlen = maxlen - 1; /* Not counting termination */ + return; + } else if(vlen >= 0) { + arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ + arg->errlen = vlen; /* Not counting termination */ + } else { + /* + * The libc on this system is broken. + */ + vlen = sizeof("") - 1; + maxlen--; + arg->errlen = vlen < maxlen ? vlen : maxlen; + memcpy(arg->errbuf, "", arg->errlen); + arg->errbuf[arg->errlen] = 0; + } + + return; +} + +int +asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, char *errbuf, size_t *errlen) { + struct errbufDesc arg; + int ret; + + arg.failed_type = 0; + arg.failed_struct_ptr = 0; + arg.errbuf = errbuf; + arg.errlen = errlen ? *errlen : 0; + + ret = type_descriptor->check_constraints(type_descriptor, + struct_ptr, _asn_i_ctfailcb, &arg); + if(ret == -1 && errlen) + *errlen = arg.errlen; + + return ret; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/constraints.h b/plugins/inmarsat_support/aero/libacars/asn1/constraints.h new file mode 100644 index 000000000..a38e586c8 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/constraints.h @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN1_CONSTRAINTS_VALIDATOR_H +#define ASN1_CONSTRAINTS_VALIDATOR_H + +#include "asn_system.h" /* Platform-dependent types */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Validate the structure according to the ASN.1 constraints. + * If errbuf and errlen are given, they shall be pointing to the appropriate + * buffer space and its length before calling this function. Alternatively, + * they could be passed as NULL's. If constraints validation fails, + * errlen will contain the actual number of bytes taken from the errbuf + * to encode an error message (properly 0-terminated). + * + * RETURN VALUES: + * This function returns 0 in case all ASN.1 constraints are met + * and -1 if one or more constraints were failed. + */ +int +asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, /* Target language's structure */ + char *errbuf, /* Returned error description */ + size_t *errlen /* Length of the error description */ + ); + + +/* + * Generic type for constraint checking callback, + * associated with every type descriptor. + */ +typedef int (asn_constr_check_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *optional_callback, /* Log the error */ + void *optional_app_key /* Opaque key passed to a callback */ + ); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ +asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ + +/* + * Invoke the callback with a complete error message. + */ +#define ASN__CTFAIL if(ctfailcb) ctfailcb + +#ifdef __cplusplus +} +#endif + +#endif /* ASN1_CONSTRAINTS_VALIDATOR_H */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/der_encoder.c b/plugins/inmarsat_support/aero/libacars/asn1/der_encoder.c new file mode 100644 index 000000000..3eb53b189 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/der_encoder.c @@ -0,0 +1,201 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include + +static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, int constructed); + +/* + * The DER encoder of any type. + */ +asn_enc_rval_t +der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, + asn_app_consume_bytes_f *consume_bytes, void *app_key) { + + ASN_DEBUG("DER encoder invoked for %s", + type_descriptor->name); + + /* + * Invoke type-specific encoder. + */ + return type_descriptor->der_encoder(type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + 0, 0, + consume_bytes, app_key); +} + +/* + * Argument type and callback necessary for der_encode_to_buffer(). + */ +typedef struct enc_to_buf_arg { + void *buffer; + size_t left; +} enc_to_buf_arg; +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { + enc_to_buf_arg *arg = (enc_to_buf_arg *)key; + + if(arg->left < size) + return -1; /* Data exceeds the available buffer size */ + + memcpy(arg->buffer, buffer, size); + arg->buffer = ((char *)arg->buffer) + size; + arg->left -= size; + + return 0; +} + +/* + * A variant of the der_encode() which encodes the data into the provided buffer + */ +asn_enc_rval_t +der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, + void *buffer, size_t buffer_size) { + enc_to_buf_arg arg; + asn_enc_rval_t ec; + + arg.buffer = buffer; + arg.left = buffer_size; + + ec = type_descriptor->der_encoder(type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + 0, 0, encode_to_buffer_cb, &arg); + if(ec.encoded != -1) { + assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); + /* Return the encoded contents size */ + } + return ec; +} + + +/* + * Write out leading TL[v] sequence according to the type definition. + */ +ssize_t +der_write_tags(asn_TYPE_descriptor_t *sd, + size_t struct_length, + int tag_mode, int last_tag_form, + ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ + asn_app_consume_bytes_f *cb, + void *app_key) { + const ber_tlv_tag_t *tags; /* Copy of tags stream */ + int tags_count; /* Number of tags */ + size_t overall_length; + ssize_t *lens; + int i; + + ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", + sd->name, tag_mode, sd->tags_count, + ber_tlv_tag_string(tag), + tag_mode + ?(sd->tags_count+1 + -((tag_mode == -1) && sd->tags_count)) + :sd->tags_count + ); + + if(tag_mode) { + /* + * Instead of doing shaman dance like we do in ber_check_tags(), + * allocate a small array on the stack + * and initialize it appropriately. + */ + int stag_offset; + ber_tlv_tag_t *tags_buf; + tags_buf = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t)); + if(!tags_buf) { /* Can fail on !x86 */ + errno = ENOMEM; + return -1; + } + tags_count = sd->tags_count + + 1 /* EXPLICIT or IMPLICIT tag is given */ + - ((tag_mode == -1) && sd->tags_count); + /* Copy tags over */ + tags_buf[0] = tag; + stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); + for(i = 1; i < tags_count; i++) + tags_buf[i] = sd->tags[i + stag_offset]; + tags = tags_buf; + } else { + tags = sd->tags; + tags_count = sd->tags_count; + } + + /* No tags to write */ + if(tags_count == 0) + return 0; + + lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); + if(!lens) { + errno = ENOMEM; + return -1; + } + + /* + * Array of tags is initialized. + * Now, compute the size of the TLV pairs, from right to left. + */ + overall_length = struct_length; + for(i = tags_count - 1; i >= 0; --i) { + lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); + if(lens[i] == -1) return -1; + overall_length += lens[i]; + lens[i] = overall_length - lens[i]; + } + + if(!cb) return overall_length - struct_length; + + ASN_DEBUG("%s %s TL sequence (%d elements)", + cb?"Encoding":"Estimating", sd->name, tags_count); + + /* + * Encode the TL sequence for real. + */ + for(i = 0; i < tags_count; i++) { + ssize_t len; + int _constr; + + /* Check if this tag happens to be constructed */ + _constr = (last_tag_form || i < (tags_count - 1)); + + len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); + if(len == -1) return -1; + } + + return overall_length - struct_length; +} + +static ssize_t +der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, + int constructed) { + uint8_t buf[32]; + size_t size = 0; + int buf_size = cb?sizeof(buf):0; + ssize_t tmp; + + /* Serialize tag (T from TLV) into possibly zero-length buffer */ + tmp = ber_tlv_tag_serialize(tag, buf, buf_size); + if(tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; + size += tmp; + + /* Serialize length (L from TLV) into possibly zero-length buffer */ + tmp = der_tlv_length_serialize(len, buf+size, buf_size?buf_size-size:0); + if(tmp == -1) return -1; + size += tmp; + + if(size > sizeof(buf)) + return -1; + + /* + * If callback is specified, invoke it, and check its return value. + */ + if(cb) { + if(constructed) *buf |= 0x20; + if(cb(buf, size, app_key) < 0) + return -1; + } + + return size; +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/der_encoder.h b/plugins/inmarsat_support/aero/libacars/asn1/der_encoder.h new file mode 100644 index 000000000..b7debab3f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/der_encoder.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _DER_ENCODER_H_ +#define _DER_ENCODER_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * The DER encoder of any type. May be invoked by the application. + * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). + */ +asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ + ); + +/* A variant of der_encode() which encodes data into the pre-allocated buffer */ +asn_enc_rval_t der_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (maximum) */ + ); + +/* + * Type of the generic DER encoder. + */ +typedef asn_enc_rval_t (der_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ + ); + + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Write out leading TL[v] sequence according to the type definition. + */ +ssize_t der_write_tags( + struct asn_TYPE_descriptor_s *type_descriptor, + size_t struct_length, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {0,!0}: prim, constructed */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_ENCODER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_decoder.c b/plugins/inmarsat_support/aero/libacars/asn1/per_decoder.c new file mode 100644 index 000000000..b1ae6051c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_decoder.c @@ -0,0 +1,93 @@ +#include "asn_application.h" +#include "asn_internal.h" +#include "per_decoder.h" + +/* + * Decode a "Production of a complete encoding", X.691#10.1. + * The complete encoding contains at least one byte, and is an integral + * multiple of 8 bytes. + */ +asn_dec_rval_t +uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { + asn_dec_rval_t rval; + + rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); + if(rval.consumed) { + /* + * We've always given 8-aligned data, + * so convert bits to integral bytes. + */ + rval.consumed += 7; + rval.consumed >>= 3; + } else if(rval.code == RC_OK) { + if(size) { + if(((const uint8_t *)buffer)[0] == 0) { + rval.consumed = 1; /* 1 byte */ + } else { + ASN_DEBUG("Expecting single zeroed byte"); + rval.code = RC_FAIL; + } + } else { + /* Must contain at least 8 bits. */ + rval.code = RC_WMORE; + } + } + + return rval; +} + +asn_dec_rval_t +uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { + asn_codec_ctx_t s_codec_ctx; + asn_dec_rval_t rval; + asn_per_data_t pd; + + if(skip_bits < 0 || skip_bits > 7 + || unused_bits < 0 || unused_bits > 7 + || (unused_bits > 0 && !size)) + ASN__DECODE_FAILED; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* Fill in the position indicator */ + memset(&pd, 0, sizeof(pd)); + pd.buffer = (const uint8_t *)buffer; + pd.nboff = skip_bits; + pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ + if(pd.nboff > pd.nbits) + ASN__DECODE_FAILED; + + /* + * Invoke type-specific decoder. + */ + if(!td->uper_decoder) + ASN__DECODE_FAILED; /* PER is not compiled in */ + rval = td->uper_decoder(opt_codec_ctx, td, 0, sptr, &pd); + if(rval.code == RC_OK) { + /* Return the number of consumed bits */ + rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + + pd.nboff - skip_bits; + ASN_DEBUG("PER decoding consumed %ld, counted %ld", + (long)rval.consumed, (long)pd.moved); + assert(rval.consumed == pd.moved); + } else { + /* PER codec is not a restartable */ + rval.consumed = 0; + } + return rval; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_decoder.h b/plugins/inmarsat_support/aero/libacars/asn1/per_decoder.h new file mode 100644 index 000000000..9fe08887a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_decoder.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2005, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_DECODER_H_ +#define _PER_DECODER_H_ + +#include "asn_application.h" +#include "per_support.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. + * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. + */ +asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); + +/* + * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. + * WARNING: This call returns the number of BITS read from the stream. Beware. + */ +asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size, /* Size of data buffer */ + int skip_bits, /* Number of unused leading bits, 0..7 */ + int unused_bits /* Number of unused tailing bits, 0..7 */ + ); + + +/* + * Type of the type-specific PER decoder function. + */ +typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void **struct_ptr, + asn_per_data_t *per_data + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_DECODER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_encoder.c b/plugins/inmarsat_support/aero/libacars/asn1/per_encoder.c new file mode 100644 index 000000000..a9439bc1e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_encoder.c @@ -0,0 +1,151 @@ +#include "asn_application.h" +#include "asn_internal.h" +#include "per_encoder.h" + +static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); + +asn_enc_rval_t +uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + return uper_encode_internal(td, 0, sptr, cb, app_key); +} + +/* + * Argument type and callback necessary for uper_encode_to_buffer(). + */ +typedef struct enc_to_buf_arg { + void *buffer; + size_t left; +} enc_to_buf_arg; +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { + enc_to_buf_arg *arg = (enc_to_buf_arg *)key; + + if(arg->left < size) + return -1; /* Data exceeds the available buffer size */ + + memcpy(arg->buffer, buffer, size); + arg->buffer = ((char *)arg->buffer) + size; + arg->left -= size; + + return 0; +} + +asn_enc_rval_t +uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { + enc_to_buf_arg key; + + key.buffer = buffer; + key.left = buffer_size; + + if(td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); + + return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); +} + +typedef struct enc_dyn_arg { + void *buffer; + size_t length; + size_t allocated; +} enc_dyn_arg; +static int +encode_dyn_cb(const void *buffer, size_t size, void *key) { + enc_dyn_arg *arg = key; + if(arg->length + size >= arg->allocated) { + void *p; + arg->allocated = arg->allocated ? (arg->allocated << 2) : size; + p = REALLOC(arg->buffer, arg->allocated); + if(!p) { + FREEMEM(arg->buffer); + memset(arg, 0, sizeof(*arg)); + return -1; + } + arg->buffer = p; + } + memcpy(((char *)arg->buffer) + arg->length, buffer, size); + arg->length += size; + return 0; +} +ssize_t +uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { + asn_enc_rval_t er; + enc_dyn_arg key; + + memset(&key, 0, sizeof(key)); + + er = uper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); + switch(er.encoded) { + case -1: + FREEMEM(key.buffer); + return -1; + case 0: + FREEMEM(key.buffer); + key.buffer = MALLOC(1); + if(key.buffer) { + *(char *)key.buffer = '\0'; + *buffer_r = key.buffer; + return 1; + } else { + return -1; + } + default: + *buffer_r = key.buffer; + ASN_DEBUG("Complete encoded in %ld bits", (long)er.encoded); + return ((er.encoded + 7) >> 3); + } +} + +/* + * Internally useful functions. + */ + +/* Flush partially filled buffer */ +static int +_uper_encode_flush_outp(asn_per_outp_t *po) { + uint8_t *buf; + + if(po->nboff == 0 && po->buffer == po->tmpspace) + return 0; + + buf = po->buffer + (po->nboff >> 3); + /* Make sure we account for the last, partially filled */ + if(po->nboff & 0x07) { + buf[0] &= 0xff << (8 - (po->nboff & 0x07)); + buf++; + } + + return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); +} + +static asn_enc_rval_t +uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + asn_per_outp_t po; + asn_enc_rval_t er; + + /* + * Invoke type-specific encoder. + */ + if(!td || !td->uper_encoder) + ASN__ENCODE_FAILED; /* PER is not compiled in */ + + po.buffer = po.tmpspace; + po.nboff = 0; + po.nbits = 8 * sizeof(po.tmpspace); + po.outper = cb; + po.op_key = app_key; + po.flushed_bytes = 0; + + er = td->uper_encoder(td, constraints, sptr, &po); + if(er.encoded != -1) { + size_t bits_to_flush; + + bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; + + /* Set number of bits encoded to a firm value */ + er.encoded = (po.flushed_bytes << 3) + bits_to_flush; + + if(_uper_encode_flush_outp(&po)) + ASN__ENCODE_FAILED; + } + + return er; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_encoder.h b/plugins/inmarsat_support/aero/libacars/asn1/per_encoder.h new file mode 100644 index 000000000..0c4501791 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_encoder.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2006, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_ENCODER_H_ +#define _PER_ENCODER_H_ + +#include "asn_application.h" +#include "per_support.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. Use the following formula to convert to bytes: + * bytes = ((.encoded + 7) / 8) + */ +asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ + void *app_key /* Arbitrary callback argument */ +); + +/* + * A variant of uper_encode() which encodes data into the existing buffer + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. + */ +asn_enc_rval_t uper_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (max) */ +); + +/* + * A variant of uper_encode_to_buffer() which allocates buffer itself. + * Returns the number of bytes in the buffer or -1 in case of failure. + * WARNING: This function produces a "Production of the complete encoding", + * with length of at least one octet. Contrast this to precise bit-packing + * encoding of uper_encode() and uper_encode_to_buffer(). + */ +ssize_t uper_encode_to_new_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void *struct_ptr, /* Structure to be encoded */ + void **buffer_r /* Buffer allocated and returned */ +); + +/* + * Type of the generic PER encoder function. + */ +typedef asn_enc_rval_t (per_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void *struct_ptr, + asn_per_outp_t *per_output +); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_ENCODER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_opentype.c b/plugins/inmarsat_support/aero/libacars/asn1/per_opentype.c new file mode 100644 index 000000000..e95586b16 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_opentype.c @@ -0,0 +1,378 @@ +/* + * Copyright (c) 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include "per_support.h" +#include "constr_TYPE.h" +#include "per_opentype.h" + +typedef struct uper_ugot_key { + asn_per_data_t oldpd; /* Old per data source */ + size_t unclaimed; + size_t ot_moved; /* Number of bits moved by OT processing */ + int repeat; +} uper_ugot_key; + +static int uper_ugot_refill(asn_per_data_t *pd); +static int per_skip_bits(asn_per_data_t *pd, int skip_nbits); +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + +/* + * Encode an "open type field". + * #10.1, #10.2 + */ +int +uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + void *buf; + void *bptr; + ssize_t size; + size_t toGo; + + ASN_DEBUG("Open type put %s ...", td->name); + + size = uper_encode_to_new_buffer(td, constraints, sptr, &buf); + if(size <= 0) return -1; + + for(bptr = buf, toGo = size; toGo;) { + ssize_t maySave = uper_put_length(po, toGo); + ASN_DEBUG("Prepending length %d to %s and allowing to save %d", + (int)size, td->name, (int)maySave); + if(maySave < 0) break; + if(per_put_many_bits(po, bptr, maySave * 8)) break; + bptr = (char *)bptr + maySave; + toGo -= maySave; + } + + FREEMEM(buf); + if(toGo) return -1; + + ASN_DEBUG("Open type put %s of length %ld + overhead (1byte?)", + td->name, (long)size); + + return 0; +} + +static asn_dec_rval_t +uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + ssize_t chunk_bytes; + int repeat; + uint8_t *buf = 0; + size_t bufLen = 0; + size_t bufSize = 0; + asn_per_data_t spd; + size_t padding; + + ASN__STACK_OVERFLOW_CHECK(ctx); + + ASN_DEBUG("Getting open type %s...", td->name); + + do { + chunk_bytes = uper_get_length(pd, -1, &repeat); + if(chunk_bytes < 0) { + FREEMEM(buf); + ASN__DECODE_STARVED; + } + if(bufLen + chunk_bytes > bufSize) { + void *ptr; + bufSize = chunk_bytes + (bufSize << 2); + ptr = REALLOC(buf, bufSize); + if(!ptr) { + FREEMEM(buf); + ASN__DECODE_FAILED; + } + buf = ptr; + } + if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { + FREEMEM(buf); + ASN__DECODE_STARVED; + } + bufLen += chunk_bytes; + } while(repeat); + + ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name, + (long)bufLen); + + memset(&spd, 0, sizeof(spd)); + spd.buffer = buf; + spd.nbits = bufLen << 3; + + ASN_DEBUG_INDENT_ADD(+4); + rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); + ASN_DEBUG_INDENT_ADD(-4); + + if(rv.code == RC_OK) { + /* Check padding validity */ + padding = spd.nbits - spd.nboff; + if ((padding < 8 || + /* X.691#10.1.3 */ + (spd.nboff == 0 && spd.nbits == 8 && spd.buffer == buf)) && + per_get_few_bits(&spd, padding) == 0) { + /* Everything is cool */ + FREEMEM(buf); + return rv; + } + FREEMEM(buf); + if(padding >= 8) { + ASN_DEBUG("Too large padding %d in open type", (int)padding); + ASN__DECODE_FAILED; + } else { + ASN_DEBUG("Non-zero padding"); + ASN__DECODE_FAILED; + } + } else { + FREEMEM(buf); + /* rv.code could be RC_WMORE, nonsense in this context */ + rv.code = RC_FAIL; /* Noone would give us more */ + } + + return rv; +} + +static asn_dec_rval_t GCC_NOTUSED +uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + uper_ugot_key arg; + asn_dec_rval_t rv; + ssize_t padding; + + ASN__STACK_OVERFLOW_CHECK(ctx); + + ASN_DEBUG("Getting open type %s from %s", td->name, + per_data_string(pd)); + arg.oldpd = *pd; + arg.unclaimed = 0; + arg.ot_moved = 0; + arg.repeat = 1; + pd->refill = uper_ugot_refill; + pd->refill_key = &arg; + pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */ + pd->moved = 0; /* This now counts the open type size in bits */ + + ASN_DEBUG_INDENT_ADD(+4); + rv = td->uper_decoder(ctx, td, constraints, sptr, pd); + ASN_DEBUG_INDENT_ADD(-4); + +#define UPDRESTOREPD do { \ + /* buffer and nboff are valid, preserve them. */ \ + pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ + pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ + pd->refill = arg.oldpd.refill; \ + pd->refill_key = arg.oldpd.refill_key; \ + } while(0) + + if(rv.code != RC_OK) { + UPDRESTOREPD; + return rv; + } + + ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name, + per_data_string(pd), + per_data_string(&arg.oldpd), + (int)arg.unclaimed, (int)arg.repeat); + + padding = pd->moved % 8; + if(padding) { + int32_t pvalue; + if(padding > 7) { + ASN_DEBUG("Too large padding %d in open type", + (int)padding); + rv.code = RC_FAIL; + UPDRESTOREPD; + return rv; + } + padding = 8 - padding; + ASN_DEBUG("Getting padding of %d bits", (int)padding); + pvalue = per_get_few_bits(pd, padding); + switch(pvalue) { + case -1: + ASN_DEBUG("Padding skip failed"); + UPDRESTOREPD; + ASN__DECODE_STARVED; + case 0: break; + default: + ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", + (int)padding, (int)pvalue); + UPDRESTOREPD; + ASN__DECODE_FAILED; + } + } + if(pd->nboff != pd->nbits) { + ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, + per_data_string(pd), per_data_string(&arg.oldpd)); + if(1) { + UPDRESTOREPD; + ASN__DECODE_FAILED; + } else { + arg.unclaimed += pd->nbits - pd->nboff; + } + } + + /* Adjust pd back so it points to original data */ + UPDRESTOREPD; + + /* Skip data not consumed by the decoder */ + if(arg.unclaimed) { + ASN_DEBUG("Getting unclaimed %d", (int)arg.unclaimed); + switch(per_skip_bits(pd, arg.unclaimed)) { + case -1: + ASN_DEBUG("Claim of %d failed", (int)arg.unclaimed); + ASN__DECODE_STARVED; + case 0: + ASN_DEBUG("Got claim of %d", (int)arg.unclaimed); + break; + default: + /* Padding must be blank */ + ASN_DEBUG("Non-blank unconsumed padding"); + ASN__DECODE_FAILED; + } + arg.unclaimed = 0; + } + + if(arg.repeat) { + ASN_DEBUG("Not consumed the whole thing"); + rv.code = RC_FAIL; + return rv; + } + + return rv; +} + + +asn_dec_rval_t +uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + return uper_open_type_get_simple(ctx, td, constraints, sptr, pd); +} + +int +uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) { + asn_TYPE_descriptor_t s_td; + asn_dec_rval_t rv; + + s_td.name = ""; + s_td.uper_decoder = uper_sot_suck; + + rv = uper_open_type_get(ctx, &s_td, 0, 0, pd); + if(rv.code != RC_OK) + return -1; + else + return 0; +} + +/* + * Internal functions. + */ + +static asn_dec_rval_t +uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)ctx; + (void)td; + (void)constraints; + (void)sptr; + + while(per_get_few_bits(pd, 24) >= 0); + + rv.code = RC_OK; + rv.consumed = pd->moved; + + return rv; +} + +static int +uper_ugot_refill(asn_per_data_t *pd) { + uper_ugot_key *arg = pd->refill_key; + ssize_t next_chunk_bytes, next_chunk_bits; + ssize_t avail; + + asn_per_data_t *oldpd = &arg->oldpd; + + ASN_DEBUG("REFILLING pd->moved=%ld, oldpd->moved=%ld", + (long)pd->moved, (long)oldpd->moved); + + /* Advance our position to where pd is */ + oldpd->buffer = pd->buffer; + oldpd->nboff = pd->nboff; + oldpd->nbits -= pd->moved - arg->ot_moved; + oldpd->moved += pd->moved - arg->ot_moved; + arg->ot_moved = pd->moved; + + if(arg->unclaimed) { + /* Refill the container */ + if(per_get_few_bits(oldpd, 1)) + return -1; + if(oldpd->nboff == 0) { + assert(0); + return -1; + } + pd->buffer = oldpd->buffer; + pd->nboff = oldpd->nboff - 1; + pd->nbits = oldpd->nbits; + ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%ld)", + (long)pd->moved); + return 0; + } + + if(!arg->repeat) { + ASN_DEBUG("Want more but refill doesn't have it"); + return -1; + } + + next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); + ASN_DEBUG("Open type LENGTH %ld bytes at off %ld, repeat %ld", + (long)next_chunk_bytes, (long)oldpd->moved, (long)arg->repeat); + if(next_chunk_bytes < 0) return -1; + if(next_chunk_bytes == 0) { + pd->refill = 0; /* No more refills, naturally */ + assert(!arg->repeat); /* Implementation guarantee */ + } + next_chunk_bits = next_chunk_bytes << 3; + avail = oldpd->nbits - oldpd->nboff; + if(avail >= next_chunk_bits) { + pd->nbits = oldpd->nboff + next_chunk_bits; + arg->unclaimed = 0; + ASN_DEBUG("!+Parent frame %ld bits, alloting %ld [%ld..%ld] (%ld)", + (long)next_chunk_bits, (long)oldpd->moved, + (long)oldpd->nboff, (long)oldpd->nbits, + (long)(oldpd->nbits - oldpd->nboff)); + } else { + pd->nbits = oldpd->nbits; + arg->unclaimed = next_chunk_bits - avail; + ASN_DEBUG("!-Parent frame %ld, require %ld, will claim %ld", + (long)avail, (long)next_chunk_bits, + (long)arg->unclaimed); + } + pd->buffer = oldpd->buffer; + pd->nboff = oldpd->nboff; + ASN_DEBUG("Refilled pd%s old%s", + per_data_string(pd), per_data_string(oldpd)); + return 0; +} + +static int +per_skip_bits(asn_per_data_t *pd, int skip_nbits) { + int hasNonZeroBits = 0; + while(skip_nbits > 0) { + int skip; + + /* per_get_few_bits() is more efficient when nbits <= 24 */ + if(skip_nbits < 24) + skip = skip_nbits; + else + skip = 24; + skip_nbits -= skip; + + switch(per_get_few_bits(pd, skip)) { + case -1: return -1; /* Starving */ + case 0: continue; /* Skipped empty space */ + default: hasNonZeroBits = 1; continue; + } + } + return hasNonZeroBits; +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_opentype.h b/plugins/inmarsat_support/aero/libacars/asn1/per_opentype.h new file mode 100644 index 000000000..facfaa637 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_opentype.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_OPENTYPE_H_ +#define _PER_OPENTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + +int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); + +int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_OPENTYPE_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_support.c b/plugins/inmarsat_support/aero/libacars/asn1/per_support.c new file mode 100644 index 000000000..bf9b281b5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_support.c @@ -0,0 +1,483 @@ +/* + * Copyright (c) 2005-2014 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_system.h" +#include "asn_internal.h" +#include "per_support.h" + +char * +per_data_string(asn_per_data_t *pd) { + static char buf[2][32]; + static int n; + n = (n+1) % 2; + snprintf(buf[n], sizeof(buf[n]), + "{m=%ld span %+ld[%d..%d] (%d)}", + (long)pd->moved, + (((long)pd->buffer) & 0xf), + (int)pd->nboff, (int)pd->nbits, + (int)(pd->nbits - pd->nboff)); + return buf[n]; +} + +void +per_get_undo(asn_per_data_t *pd, int nbits) { + if((ssize_t)pd->nboff < nbits) { + assert((ssize_t)pd->nboff < nbits); + } else { + pd->nboff -= nbits; + pd->moved -= nbits; + } +} + +/* + * Extract a small number of bits (<= 31) from the specified PER data pointer. + */ +int32_t +per_get_few_bits(asn_per_data_t *pd, int nbits) { + size_t off; /* Next after last bit offset */ + ssize_t nleft; /* Number of bits left in this stream */ + uint32_t accum; + const uint8_t *buf; + + if(nbits < 0) + return -1; + + nleft = pd->nbits - pd->nboff; + if(nbits > nleft) { + int32_t tailv, vhead; + if(!pd->refill || nbits > 31) return -1; + /* Accumulate unused bytes before refill */ + ASN_DEBUG("Obtain the rest %d bits (want %d)", + (int)nleft, (int)nbits); + tailv = per_get_few_bits(pd, nleft); + if(tailv < 0) return -1; + /* Refill (replace pd contents with new data) */ + if(pd->refill(pd)) + return -1; + nbits -= nleft; + vhead = per_get_few_bits(pd, nbits); + /* Combine the rest of previous pd with the head of new one */ + tailv = (tailv << nbits) | vhead; /* Could == -1 */ + return tailv; + } + + /* + * Normalize position indicator. + */ + if(pd->nboff >= 8) { + pd->buffer += (pd->nboff >> 3); + pd->nbits -= (pd->nboff & ~0x07); + pd->nboff &= 0x07; + } + pd->moved += nbits; + pd->nboff += nbits; + off = pd->nboff; + buf = pd->buffer; + + /* + * Extract specified number of bits. + */ + if(off <= 8) + accum = nbits ? (buf[0]) >> (8 - off) : 0; + else if(off <= 16) + accum = ((buf[0] << 8) + buf[1]) >> (16 - off); + else if(off <= 24) + accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); + else if(off <= 31) + accum = ((buf[0] << 24) + (buf[1] << 16) + + (buf[2] << 8) + (buf[3])) >> (32 - off); + else if(nbits <= 31) { + asn_per_data_t tpd = *pd; + /* Here are we with our 31-bits limit plus 1..7 bits offset. */ + per_get_undo(&tpd, nbits); + /* The number of available bits in the stream allow + * for the following operations to take place without + * invoking the ->refill() function */ + accum = per_get_few_bits(&tpd, nbits - 24) << 24; + accum |= per_get_few_bits(&tpd, 24); + } else { + per_get_undo(pd, nbits); + return -1; + } + + accum &= (((uint32_t)1 << nbits) - 1); + + ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", + (int)nbits, (int)nleft, + (int)pd->moved, + (((long)pd->buffer) & 0xf), + (int)pd->nboff, (int)pd->nbits, + ((pd->buffer != NULL)?pd->buffer[0]:0), + (int)(pd->nbits - pd->nboff), + (int)accum); + + return accum; +} + +/* + * Extract a large number of bits from the specified PER data pointer. + */ +int +per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { + int32_t value; + + if(alright && (nbits & 7)) { + /* Perform right alignment of a first few bits */ + value = per_get_few_bits(pd, nbits & 0x07); + if(value < 0) return -1; + *dst++ = value; /* value is already right-aligned */ + nbits &= ~7; + } + + while(nbits) { + if(nbits >= 24) { + value = per_get_few_bits(pd, 24); + if(value < 0) return -1; + *(dst++) = value >> 16; + *(dst++) = value >> 8; + *(dst++) = value; + nbits -= 24; + } else { + value = per_get_few_bits(pd, nbits); + if(value < 0) return -1; + if(nbits & 7) { /* implies left alignment */ + value <<= 8 - (nbits & 7), + nbits += 8 - (nbits & 7); + if(nbits > 24) + *dst++ = value >> 24; + } + if(nbits > 16) + *dst++ = value >> 16; + if(nbits > 8) + *dst++ = value >> 8; + *dst++ = value; + break; + } + } + + return 0; +} + +/* + * Get the length "n" from the stream. + */ +ssize_t +uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { + ssize_t value; + + *repeat = 0; + + if(ebits >= 0) return per_get_few_bits(pd, ebits); + + value = per_get_few_bits(pd, 8); + if(value < 0) return -1; + if((value & 128) == 0) /* #10.9.3.6 */ + return (value & 0x7F); + if((value & 64) == 0) { /* #10.9.3.7 */ + value = ((value & 63) << 8) | per_get_few_bits(pd, 8); + if(value < 0) return -1; + return value; + } + value &= 63; /* this is "m" from X.691, #10.9.3.8 */ + if(value < 1 || value > 4) + return -1; + *repeat = 1; + return (16384 * value); +} + +/* + * Get the normally small length "n". + * This procedure used to decode length of extensions bit-maps + * for SET and SEQUENCE types. + */ +ssize_t +uper_get_nslength(asn_per_data_t *pd) { + ssize_t length; + + ASN_DEBUG("Getting normally small length"); + + if(per_get_few_bits(pd, 1) == 0) { + length = per_get_few_bits(pd, 6) + 1; + if(length <= 0) return -1; + ASN_DEBUG("l=%d", (int)length); + return length; + } else { + int repeat; + length = uper_get_length(pd, -1, &repeat); + if(length >= 0 && !repeat) return length; + return -1; /* Error, or do not support >16K extensions */ + } +} + +/* + * Get the normally small non-negative whole number. + * X.691, #10.6 + */ +ssize_t +uper_get_nsnnwn(asn_per_data_t *pd) { + ssize_t value; + + value = per_get_few_bits(pd, 7); + if(value & 64) { /* implicit (value < 0) */ + value &= 63; + value <<= 2; + value |= per_get_few_bits(pd, 2); + if(value & 128) /* implicit (value < 0) */ + return -1; + if(value == 0) + return 0; + if(value >= 3) + return -1; + value = per_get_few_bits(pd, 8 * value); + return value; + } + + return value; +} + +/* + * X.691-11/2008, #11.6 + * Encoding of a normally small non-negative whole number + */ +int +uper_put_nsnnwn(asn_per_outp_t *po, int n) { + int bytes; + + if(n <= 63) { + if(n < 0) return -1; + return per_put_few_bits(po, n, 7); + } + if(n < 256) + bytes = 1; + else if(n < 65536) + bytes = 2; + else if(n < 256 * 65536) + bytes = 3; + else + return -1; /* This is not a "normally small" value */ + if(per_put_few_bits(po, bytes, 8)) + return -1; + + return per_put_few_bits(po, n, 8 * bytes); +} + + +/* X.691-2008/11, #11.5.6 -> #11.3 */ +int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { + unsigned long lhalf; /* Lower half of the number*/ + long half; + + if(nbits <= 31) { + half = per_get_few_bits(pd, nbits); + if(half < 0) return -1; + *out_value = half; + return 0; + } + + if((size_t)nbits > 8 * sizeof(*out_value)) + return -1; /* RANGE */ + + half = per_get_few_bits(pd, 31); + if(half < 0) return -1; + + if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) + return -1; + + *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; + return 0; +} + + +/* X.691-2008/11, #11.5.6 -> #11.3 */ +int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) { + /* + * Assume signed number can be safely coerced into + * unsigned of the same range. + * The following testing code will likely be optimized out + * by compiler if it is true. + */ + unsigned long uvalue1 = ULONG_MAX; + long svalue = uvalue1; + unsigned long uvalue2 = svalue; + assert(uvalue1 == uvalue2); + return uper_put_constrained_whole_number_u(po, v, nbits); +} + +int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits) { + if(nbits <= 31) { + return per_put_few_bits(po, v, nbits); + } else { + /* Put higher portion first, followed by lower 31-bit */ + if(uper_put_constrained_whole_number_u(po, v >> 31, nbits - 31)) + return -1; + return per_put_few_bits(po, v, 31); + } +} + +/* + * Put a small number of bits (<= 31). + */ +int +per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { + size_t off; /* Next after last bit offset */ + size_t omsk; /* Existing last byte meaningful bits mask */ + uint8_t *buf; + + if(obits <= 0 || obits >= 32) return obits ? -1 : 0; + + ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", + obits, (int)bits, po->buffer, (int)po->nboff); + + /* + * Normalize position indicator. + */ + if(po->nboff >= 8) { + po->buffer += (po->nboff >> 3); + po->nbits -= (po->nboff & ~0x07); + po->nboff &= 0x07; + } + + /* + * Flush whole-bytes output, if necessary. + */ + if(po->nboff + obits > po->nbits) { + int complete_bytes = (po->buffer - po->tmpspace); + ASN_DEBUG("[PER output %ld complete + %ld]", + (long)complete_bytes, (long)po->flushed_bytes); + if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + return -1; + if(po->nboff) + po->tmpspace[0] = po->buffer[0]; + po->buffer = po->tmpspace; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; + } + + /* + * Now, due to sizeof(tmpspace), we are guaranteed large enough space. + */ + buf = po->buffer; + omsk = ~((1 << (8 - po->nboff)) - 1); + off = (po->nboff + obits); + + /* Clear data of debris before meaningful bits */ + bits &= (((uint32_t)1 << obits) - 1); + + ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, + (int)bits, (int)bits, + (int)po->nboff, (int)off, + buf[0], (int)(omsk&0xff), + (int)(buf[0] & omsk)); + + if(off <= 8) /* Completely within 1 byte */ + po->nboff = off, + bits <<= (8 - off), + buf[0] = (buf[0] & omsk) | bits; + else if(off <= 16) + po->nboff = off, + bits <<= (16 - off), + buf[0] = (buf[0] & omsk) | (bits >> 8), + buf[1] = bits; + else if(off <= 24) + po->nboff = off, + bits <<= (24 - off), + buf[0] = (buf[0] & omsk) | (bits >> 16), + buf[1] = bits >> 8, + buf[2] = bits; + else if(off <= 31) + po->nboff = off, + bits <<= (32 - off), + buf[0] = (buf[0] & omsk) | (bits >> 24), + buf[1] = bits >> 16, + buf[2] = bits >> 8, + buf[3] = bits; + else { + per_put_few_bits(po, bits >> (obits - 24), 24); + per_put_few_bits(po, bits, obits - 24); + } + + ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", + (int)bits, (int)bits, buf[0], + (long)(po->buffer - po->tmpspace)); + + return 0; +} + + +/* + * Output a large number of bits. + */ +int +per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { + + while(nbits) { + uint32_t value; + + if(nbits >= 24) { + value = (src[0] << 16) | (src[1] << 8) | src[2]; + src += 3; + nbits -= 24; + if(per_put_few_bits(po, value, 24)) + return -1; + } else { + value = src[0]; + if(nbits > 8) + value = (value << 8) | src[1]; + if(nbits > 16) + value = (value << 8) | src[2]; + if(nbits & 0x07) + value >>= (8 - (nbits & 0x07)); + if(per_put_few_bits(po, value, nbits)) + return -1; + break; + } + } + + return 0; +} + +/* + * Put the length "n" (or part of it) into the stream. + */ +ssize_t +uper_put_length(asn_per_outp_t *po, size_t length) { + + if(length <= 127) /* #10.9.3.6 */ + return per_put_few_bits(po, length, 8) + ? -1 : (ssize_t)length; + else if(length < 16384) /* #10.9.3.7 */ + return per_put_few_bits(po, length|0x8000, 16) + ? -1 : (ssize_t)length; + + length >>= 14; + if(length > 4) length = 4; + + return per_put_few_bits(po, 0xC0 | length, 8) + ? -1 : (ssize_t)(length << 14); +} + + +/* + * Put the normally small length "n" into the stream. + * This procedure used to encode length of extensions bit-maps + * for SET and SEQUENCE types. + */ +int +uper_put_nslength(asn_per_outp_t *po, size_t length) { + + if(length <= 64) { + /* #10.9.3.4 */ + if(length == 0) return -1; + return per_put_few_bits(po, length-1, 7) ? -1 : 0; + } else { + if(uper_put_length(po, length) != (ssize_t)length) { + /* This might happen in case of >16K extensions */ + return -1; + } + } + + return 0; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/per_support.h b/plugins/inmarsat_support/aero/libacars/asn1/per_support.h new file mode 100644 index 000000000..cc470ce2f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/per_support.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2005-2014 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_SUPPORT_H_ +#define _PER_SUPPORT_H_ + +#include "asn_system.h" /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Pre-computed PER constraints. + */ +typedef const struct asn_per_constraint_s { + enum asn_per_constraint_flags { + APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ + APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ + APC_CONSTRAINED = 0x2, /* Fully constrained */ + APC_EXTENSIBLE = 0x4 /* May have extension */ + } flags; + int range_bits; /* Full number of bits in the range */ + int effective_bits; /* Effective bits */ + long lower_bound; /* "lb" value */ + long upper_bound; /* "ub" value */ +} asn_per_constraint_t; +typedef const struct asn_per_constraints_s { + struct asn_per_constraint_s value; + struct asn_per_constraint_s size; + int (*value2code)(unsigned int value); + int (*code2value)(unsigned int code); +} asn_per_constraints_t; + +/* + * This structure describes a position inside an incoming PER bit stream. + */ +typedef struct asn_per_data_s { + const uint8_t *buffer; /* Pointer to the octet stream */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits in the stream */ + size_t moved; /* Number of bits moved through this bit stream */ + int (*refill)(struct asn_per_data_s *); + void *refill_key; +} asn_per_data_t; + +/* + * Extract a small number of bits (<= 31) from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ +int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); + +/* Undo the immediately preceeding "get_few_bits" operation */ +void per_get_undo(asn_per_data_t *per_data, int get_nbits); + +/* + * Extract a large number of bits from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ +int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, + int get_nbits); + +/* + * Get the length "n" from the Unaligned PER stream. + */ +ssize_t uper_get_length(asn_per_data_t *pd, + int effective_bound_bits, + int *repeat); + +/* + * Get the normally small length "n". + */ +ssize_t uper_get_nslength(asn_per_data_t *pd); + +/* + * Get the normally small non-negative whole number. + */ +ssize_t uper_get_nsnnwn(asn_per_data_t *pd); + +/* X.691-2008/11, #11.5.6 */ +int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); + +/* Non-thread-safe debugging function, don't use it */ +char *per_data_string(asn_per_data_t *pd); + +/* + * This structure supports forming PER output. + */ +typedef struct asn_per_outp_s { + uint8_t *buffer; /* Pointer into the (tmpspace) */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits left in (tmpspace) */ + uint8_t tmpspace[32]; /* Preliminary storage to hold data */ + int (*outper)(const void *data, size_t size, void *op_key); + void *op_key; /* Key for (outper) data callback */ + size_t flushed_bytes; /* Bytes already flushed through (outper) */ +} asn_per_outp_t; + +/* Output a small number of bits (<= 31) */ +int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); + +/* Output a large number of bits */ +int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); + +/* X.691-2008/11, #11.5 */ +int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits); +int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); + +/* + * Put the length "n" to the Unaligned PER stream. + * This function returns the number of units which may be flushed + * in the next units saving iteration. + */ +ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); + +/* + * Put the normally small length "n" to the Unaligned PER stream. + * Returns 0 or -1. + */ +int uper_put_nslength(asn_per_outp_t *po, size_t length); + +/* + * Put the normally small non-negative whole number. + */ +int uper_put_nsnnwn(asn_per_outp_t *po, int n); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_SUPPORT_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/xer_decoder.c b/plugins/inmarsat_support/aero/libacars/asn1/xer_decoder.c new file mode 100644 index 000000000..7a83e6d54 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/xer_decoder.c @@ -0,0 +1,368 @@ +/* + * Copyright (c) 2004, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_application.h" +#include "asn_internal.h" +#include "xer_support.h" /* XER/XML parsing support */ + + +/* + * Decode the XER encoding of a given type. + */ +asn_dec_rval_t +xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *buffer, size_t size) { + asn_codec_ctx_t s_codec_ctx; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* + * Invoke type-specific decoder. + */ + return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size); +} + + + +struct xer__cb_arg { + pxml_chunk_type_e chunk_type; + size_t chunk_size; + const void *chunk_buf; + int callback_not_invoked; +}; + +static int +xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key) { + struct xer__cb_arg *arg = (struct xer__cb_arg *)key; + arg->chunk_type = type; + arg->chunk_size = _chunk_size; + arg->chunk_buf = _chunk_data; + arg->callback_not_invoked = 0; + return -1; /* Terminate the XML parsing */ +} + +/* + * Fetch the next token from the XER/XML stream. + */ +ssize_t +xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type) { + struct xer__cb_arg arg; + int new_stateContext = *stateContext; + ssize_t ret; + + arg.callback_not_invoked = 1; + ret = pxml_parse(&new_stateContext, buffer, size, xer__token_cb, &arg); + if(ret < 0) return -1; + if(arg.callback_not_invoked) { + assert(ret == 0); /* No data was consumed */ + *ch_type = PXER_WMORE; + return 0; /* Try again with more data */ + } else { + assert(arg.chunk_size); + assert(arg.chunk_buf == buffer); + } + + /* + * Translate the XML chunk types into more convenient ones. + */ + switch(arg.chunk_type) { + case PXML_TEXT: + *ch_type = PXER_TEXT; + break; + case PXML_TAG: + *ch_type = PXER_WMORE; + return 0; /* Want more */ + case PXML_TAG_END: + *ch_type = PXER_TAG; + break; + case PXML_COMMENT: + case PXML_COMMENT_END: + *ch_type = PXER_COMMENT; + break; + } + + *stateContext = new_stateContext; + return arg.chunk_size; +} + +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define RANGLE 0x3e /* '>' */ + +xer_check_tag_e +xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { + const char *buf = (const char *)buf_ptr; + const char *end; + xer_check_tag_e ct = XCT_OPENING; + + if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) { + if(size >= 2) + ASN_DEBUG("Broken XML tag: \"%c...%c\"", + buf[0], buf[size - 1]); + return XCT_BROKEN; + } + + /* + * Determine the tag class. + */ + if(buf[1] == CSLASH) { + buf += 2; /* advance past "" */ + ct = XCT_CLOSING; + if(size > 0 && buf[size-1] == CSLASH) + return XCT_BROKEN; /* */ + } else { + buf++; /* advance past "<" */ + size -= 2; /* strip "<" and ">" */ + if(size > 0 && buf[size-1] == CSLASH) { + ct = XCT_BOTH; + size--; /* One more, for "/" */ + } + } + + /* Sometimes we don't care about the tag */ + if(!need_tag || !*need_tag) + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + + /* + * Determine the tag name. + */ + for(end = buf + size; buf < end; buf++, need_tag++) { + int b = *buf, n = *need_tag; + if(b != n) { + if(n == 0) { + switch(b) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* "": whitespace is normal */ + return ct; + } + } + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + } + if(b == 0) + return XCT_BROKEN; /* Embedded 0 in buf?! */ + } + if(*need_tag) + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + + return ct; +} + + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + if(rval.code != RC_OK) \ + ASN_DEBUG("Failed with %d", rval.code); \ + return rval; \ + } while(0) + +#define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ + ssize_t converted_size = body_receiver \ + (struct_key, chunk_buf, chunk_size, \ + (size_t)chunk_size < size); \ + if(converted_size == -1) RETURN(RC_FAIL); \ + if(converted_size == 0 \ + && size == (size_t)chunk_size) \ + RETURN(RC_WMORE); \ + chunk_size = converted_size; \ + } while(0) +#define XER_GOT_EMPTY() do { \ + if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ + RETURN(RC_FAIL); \ + } while(0) + +/* + * Generalized function for decoding the primitive values. + */ +asn_dec_rval_t +xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, + const char *xml_tag, /* Expected XML tag */ + const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_key, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_key, const void *chunk_buf, size_t chunk_size, + int have_more) + ) { + + asn_dec_rval_t rval; + ssize_t consumed_myself = 0; + + (void)opt_codec_ctx; + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + */ + if(ctx->phase > 1) RETURN(RC_FAIL); + for(;;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, + &ch_type); + if(ch_size == -1) { + RETURN(RC_FAIL); + } else { + switch(ch_type) { + case PXER_WMORE: + RETURN(RC_WMORE); + case PXER_COMMENT: /* Got XML comment */ + ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TEXT: + if(ctx->phase == 0) { + /* + * We have to ignore whitespace here, + * but in order to be forward compatible + * with EXTENDED-XER (EMBED-VALUES, #25) + * any text is just ignored here. + */ + } else { + XER_GOT_BODY(buf_ptr, ch_size, size); + } + ADVANCE(ch_size); + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + assert(ch_type == PXER_TAG && size); + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + /* + * Phase 0: + * Expecting the opening tag + * for the type being processed. + * Phase 1: + * Waiting for the closing XML tag. + */ + switch(tcv) { + case XCT_BOTH: + if(ctx->phase) break; + /* Finished decoding of an empty element */ + XER_GOT_EMPTY(); + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if(ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + case XCT_CLOSING: + if(!ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_UNKNOWN_BO: + /* + * Certain tags in the body may be expected. + */ + if(opt_unexpected_tag_decoder + && opt_unexpected_tag_decoder(struct_key, + buf_ptr, ch_size) >= 0) { + /* Tag's processed fine */ + ADVANCE(ch_size); + if(!ctx->phase) { + /* We are not expecting + * the closing tag anymore. */ + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + } + continue; + } + /* Fall through */ + default: + break; /* Unexpected tag */ + } + + ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); + break; /* Dark and mysterious things have just happened */ + } + + RETURN(RC_FAIL); +} + + +size_t +xer_whitespace_span(const void *chunk_buf, size_t chunk_size) { + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + + for(; p < pend; p++) { + switch(*p) { + /* X.693, #8.1.4 + * HORISONTAL TAB (9) + * LINE FEED (10) + * CARRIAGE RETURN (13) + * SPACE (32) + */ + case 0x09: case 0x0a: case 0x0d: case 0x20: + continue; + default: + break; + } + break; + } + return (p - (const char *)chunk_buf); +} + +/* + * This is a vastly simplified, non-validating XML tree skipper. + */ +int +xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) { + assert(*depth > 0); + switch(tcv) { + case XCT_BOTH: + case XCT_UNKNOWN_BO: + /* These negate each other. */ + return 0; + case XCT_OPENING: + case XCT_UNKNOWN_OP: + ++(*depth); + return 0; + case XCT_CLOSING: + case XCT_UNKNOWN_CL: + if(--(*depth) == 0) + return (tcv == XCT_CLOSING) ? 2 : 1; + return 0; + default: + return -1; + } +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/xer_decoder.h b/plugins/inmarsat_support/aero/libacars/asn1/xer_decoder.h new file mode 100644 index 000000000..06a434989 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/xer_decoder.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_DECODER_H_ +#define _XER_DECODER_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * The XER decoder of any ASN.1 type. May be invoked by the application. + */ +asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); + +/* + * Type of the type-specific XER decoder function. + */ +typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, + const char *opt_mname, /* Member name */ + const void *buf_ptr, size_t size + ); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Generalized function for decoding the primitive values. + * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 + * and others. This function should not be used by applications, as its API + * is subject to changes. + */ +asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, /* Treated as opaque pointer */ + const char *xml_tag, /* Expected XML tag name */ + const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_key, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_key, const void *chunk_buf, size_t chunk_size, + int have_more) + ); + + +/* + * Fetch the next XER (XML) token from the stream. + * The function returns the number of bytes occupied by the chunk type, + * returned in the _ch_type. The _ch_type is only set (and valid) when + * the return value is >= 0. + */ + typedef enum pxer_chunk_type { + PXER_WMORE, /* Chunk type is not clear, more data expected. */ + PXER_TAG, /* Complete XER tag */ + PXER_TEXT, /* Plain text between XER tags */ + PXER_COMMENT /* A comment, may be part of */ + } pxer_chunk_type_e; +ssize_t xer_next_token(int *stateContext, + const void *buffer, size_t size, pxer_chunk_type_e *_ch_type); + +/* + * This function checks the buffer against the tag name is expected to occur. + */ + typedef enum xer_check_tag { + XCT_BROKEN = 0, /* The tag is broken */ + XCT_OPENING = 1, /* This is the tag */ + XCT_CLOSING = 2, /* This is the tag */ + XCT_BOTH = 3, /* This is the tag */ + XCT__UNK__MASK = 4, /* Mask of everything unexpected */ + XCT_UNKNOWN_OP = 5, /* Unexpected tag */ + XCT_UNKNOWN_CL = 6, /* Unexpected tag */ + XCT_UNKNOWN_BO = 7 /* Unexpected tag */ + } xer_check_tag_e; +xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, + const char *need_tag); + +/* + * Get the number of bytes consisting entirely of XER whitespace characters. + * RETURN VALUES: + * >=0: Number of whitespace characters in the string. + */ +size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size); + +/* + * Skip the series of anticipated extensions. + */ +int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_DECODER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/xer_encoder.c b/plugins/inmarsat_support/aero/libacars/asn1/xer_encoder.c new file mode 100644 index 000000000..e66c320a0 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/xer_encoder.c @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_internal.h" +#include +#include + +/* + * The XER encoder of any type. May be invoked by the application. + */ +asn_enc_rval_t +xer_encode(asn_TYPE_descriptor_t *td, void *sptr, + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er, tmper; + const char *mname; + size_t mlen; + int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2; + + if(!td || !sptr) goto cb_failed; + + mname = td->xml_tag; + mlen = strlen(mname); + + ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + ASN__CALLBACK3("\n", xcan); + + er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded; + + ASN__ENCODED_OK(er); +cb_failed: + ASN__ENCODE_FAILED; +} + +/* + * This is a helper function for xer_fprint, which directs all incoming data + * into the provided file descriptor. + */ +static int +xer__print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + +int +xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) { + asn_enc_rval_t er; + + if(!stream) stream = stdout; + if(!td || !sptr) + return -1; + + er = xer_encode(td, sptr, XER_F_BASIC, xer__print2fp, stream); + if(er.encoded == -1) + return -1; + + return fflush(stream); +} diff --git a/plugins/inmarsat_support/aero/libacars/asn1/xer_encoder.h b/plugins/inmarsat_support/aero/libacars/asn1/xer_encoder.h new file mode 100644 index 000000000..f86dc543e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/xer_encoder.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_ENCODER_H_ +#define _XER_ENCODER_H_ + +#include "asn_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ +enum xer_encoder_flags_e { + /* Mode of encoding */ + XER_F_BASIC = 0x01, /* BASIC-XER (pretty-printing) */ + XER_F_CANONICAL = 0x02 /* Canonical XER (strict rules) */ +}; + +/* + * The XER encoder of any type. May be invoked by the application. + */ +asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ + ); + +/* + * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) + * output into the chosen file pointer. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem printing the structure. + * WARNING: No sensible errno value is returned. + */ +int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); + +/* + * Type of the generic XER encoder. + */ +typedef asn_enc_rval_t (xer_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + int ilevel, /* Level of indentation */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_ENCODER_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/asn1/xer_support.c b/plugins/inmarsat_support/aero/libacars/asn1/xer_support.c new file mode 100644 index 000000000..e14e1887d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/xer_support.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include "asn_system.h" +#include "xer_support.h" + +/* Parser states */ +typedef enum { + ST_TEXT, + ST_TAG_START, + ST_TAG_BODY, + ST_TAG_QUOTE_WAIT, + ST_TAG_QUOTED_STRING, + ST_TAG_UNQUOTED_STRING, + ST_COMMENT_WAIT_DASH1, /* ""[0] */ + ST_COMMENT_CLO_RT /* "-->"[1] */ +} pstate_e; + +static const int +_charclass[256] = { + 0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0, + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */ + 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */ + 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */ + 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */ + 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */ +}; +#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) +#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) +#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) + +/* Aliases for characters, ASCII/UTF-8 */ +#define EXCLAM 0x21 /* '!' */ +#define CQUOTE 0x22 /* '"' */ +#define CDASH 0x2d /* '-' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define CEQUAL 0x3d /* '=' */ +#define RANGLE 0x3e /* '>' */ +#define CQUEST 0x3f /* '?' */ + +/* Invoke token callback */ +#define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ + int _ret; \ + pstate_e ns = _ns; \ + ssize_t _sz = (p - chunk_start) + _current_too; \ + if (!_sz) { \ + /* Shortcut */ \ + state = _ns; \ + break; \ + } \ + _ret = cb(type, chunk_start, _sz, key); \ + if(_ret < _sz) { \ + if(_current_too && _ret == -1) \ + state = ns; \ + goto finish; \ + } \ + chunk_start = p + _current_too; \ + state = ns; \ + } while(0) + +#define TOKEN_CB(_type, _ns, _current_too) \ + TOKEN_CB_CALL(_type, _ns, _current_too, 0) + +#define PXML_TAG_FINAL_CHUNK_TYPE PXML_TAG_END +#define PXML_COMMENT_FINAL_CHUNK_TYPE PXML_COMMENT_END + +#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ + TOKEN_CB_CALL( _type ## _FINAL_CHUNK_TYPE , _ns, _current_too, 1) + +/* + * Parser itself + */ +ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) { + pstate_e state = (pstate_e)*stateContext; + const char *chunk_start = (const char *)xmlbuf; + const char *p = chunk_start; + const char *end = p + size; + + for(; p < end; p++) { + int C = *(const unsigned char *)p; + switch(state) { + case ST_TEXT: + /* + * Initial state: we're in the middle of some text, + * or just have started. + */ + if (C == LANGLE) + /* We're now in the tag, probably */ + TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); + break; + case ST_TAG_START: + if (ALPHA(C) || (C == CSLASH)) + state = ST_TAG_BODY; + else if (C == EXCLAM) + state = ST_COMMENT_WAIT_DASH1; + else + /* + * Not characters and not whitespace. + * Must be something like "3 < 4". + */ + TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */ + break; + case ST_TAG_BODY: + switch(C) { + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + case LANGLE: + /* + * The previous tag wasn't completed, but still + * recognized as valid. (Mozilla-compatible) + */ + TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); + break; + case CEQUAL: + state = ST_TAG_QUOTE_WAIT; + break; + } + break; + case ST_TAG_QUOTE_WAIT: + /* + * State after the equal sign ("=") in the tag. + */ + switch(C) { + case CQUOTE: + state = ST_TAG_QUOTED_STRING; + break; + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + default: + if(!WHITESPACE(C)) + /* Unquoted string value */ + state = ST_TAG_UNQUOTED_STRING; + } + break; + case ST_TAG_QUOTED_STRING: + /* + * Tag attribute's string value in quotes. + */ + if(C == CQUOTE) { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_TAG_UNQUOTED_STRING: + if(C == RANGLE) { + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + } else if(WHITESPACE(C)) { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH1: + if(C == CDASH) { + state = ST_COMMENT_WAIT_DASH2; + } else { + /* Some ordinary tag. */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH2: + if(C == CDASH) { + /* Seen "<--" */ + state = ST_COMMENT; + } else { + /* Some ordinary tag */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT: + if(C == CDASH) { + state = ST_COMMENT_CLO_DASH2; + } + break; + case ST_COMMENT_CLO_DASH2: + if(C == CDASH) { + state = ST_COMMENT_CLO_RT; + } else { + /* This is not an end of a comment */ + state = ST_COMMENT; + } + break; + case ST_COMMENT_CLO_RT: + if(C == RANGLE) { + TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); + } else if(C == CDASH) { + /* Maintain current state, still waiting for '>' */ + } else { + state = ST_COMMENT; + } + break; + } /* switch(*ptr) */ + } /* for() */ + + /* + * Flush the partially processed chunk, state permitting. + */ + if(p - chunk_start) { + switch (state) { + case ST_COMMENT: + TOKEN_CB(PXML_COMMENT, state, 0); + break; + case ST_TEXT: + TOKEN_CB(PXML_TEXT, state, 0); + break; + default: break; /* a no-op */ + } + } + +finish: + *stateContext = (int)state; + return chunk_start - (const char *)xmlbuf; +} + diff --git a/plugins/inmarsat_support/aero/libacars/asn1/xer_support.h b/plugins/inmarsat_support/aero/libacars/asn1/xer_support.h new file mode 100644 index 000000000..39a748150 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/asn1/xer_support.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_SUPPORT_H_ +#define _XER_SUPPORT_H_ + +#include "asn_system.h" /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Types of data transferred to the application. + */ +typedef enum { + PXML_TEXT, /* Plain text between XML tags. */ + PXML_TAG, /* A tag, starting with '<'. */ + PXML_COMMENT, /* An XML comment, including "". */ + /* + * The following chunk types are reported if the chunk + * terminates the specified XML element. + */ + PXML_TAG_END, /* Tag ended */ + PXML_COMMENT_END /* Comment ended */ +} pxml_chunk_type_e; + +/* + * Callback function that is called by the parser when parsed data is + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the text + * data is the piece of buffer identified by _bufid (as supplied to + * pxml_feed() call) starting at offset _offset and of _size bytes size. + * The chunk is NOT '\0'-terminated. + */ +typedef int (pxml_callback_f)(pxml_chunk_type_e _type, + const void *_chunk_data, size_t _chunk_size, void *_key); + +/* + * Parse the given buffer as it were a chunk of XML data. + * Invoke the specified callback each time the meaninful data is found. + * This function returns number of bytes consumed from the bufer. + * It will always be lesser than or equal to the specified _size. + * The next invocation of this function must account the difference. + */ +ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size, + pxml_callback_f *cb, void *_key); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_SUPPORT_H_ */ diff --git a/plugins/inmarsat_support/aero/libacars/bitstream.c b/plugins/inmarsat_support/aero/libacars/bitstream.c new file mode 100644 index 000000000..381431a00 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/bitstream.c @@ -0,0 +1,44 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#include +#include // LA_XCALLOC, LA_XFREE +#include // la_bitstream_t + +la_bitstream_t *la_bitstream_init(uint32_t len) { + la_bitstream_t *ret; + if(len == 0) return NULL; + ret = LA_XCALLOC(1, sizeof(la_bitstream_t)); + ret->buf = LA_XCALLOC(len, sizeof(uint8_t)); + ret->start = ret->end = 0; + ret->len = len; + return ret; +} + +void la_bitstream_destroy(la_bitstream_t *bs) { + if(bs != NULL) LA_XFREE(bs->buf); + LA_XFREE(bs); +} + +int la_bitstream_append_msbfirst(la_bitstream_t *bs, uint8_t const *v, uint32_t numbytes, uint32_t numbits) { + if(bs->end + numbits * numbytes > bs->len) + return -1; + for(uint32_t i = 0; i < numbytes; i++) { + uint8_t t = v[i]; + for(int j = numbits - 1; j >= 0; j--) + bs->buf[bs->end++] = (t >> j) & 0x01; + } + return 0; +} + +int la_bitstream_read_word_msbfirst(la_bitstream_t *bs, uint32_t *ret, uint32_t numbits) { + if(bs->start + numbits > bs->end) + return -1; + *ret = 0; + for(uint32_t i = 0; i < numbits; i++) { + *ret |= (0x01 & bs->buf[bs->start++]) << (numbits-i-1); + } + return 0; +} diff --git a/plugins/inmarsat_support/aero/libacars/bitstream.h b/plugins/inmarsat_support/aero/libacars/bitstream.h new file mode 100644 index 000000000..548a913c6 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/bitstream.h @@ -0,0 +1,22 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef _LA_BITSTREAM_H +#define _LA_BITSTREAM_H 1 +#include + +typedef struct { + uint8_t *buf; + uint32_t start; + uint32_t end; + uint32_t len; +} la_bitstream_t; + +la_bitstream_t *la_bitstream_init(uint32_t len); +void la_bitstream_destroy(la_bitstream_t *bs); +int la_bitstream_append_msbfirst(la_bitstream_t *bs, uint8_t const *v, uint32_t numbytes, uint32_t numbits); +int la_bitstream_read_word_msbfirst(la_bitstream_t *bs, uint32_t *ret, uint32_t numbits); +#endif // !_LA_BITSTREAM_H diff --git a/plugins/inmarsat_support/aero/libacars/config.h b/plugins/inmarsat_support/aero/libacars/config.h new file mode 100644 index 000000000..ec4dcab7b --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/config.h @@ -0,0 +1,16 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#ifndef _CONFIG_H +#define _CONFIG_H + +#define WITH_ZLIB +// #define WITH_LIBXML2 +/* #undef IS_BIG_ENDIAN */ +#define HAVE_STRSEP +#define LFIND_NMEMB_SIZE_SIZE_T +/* #undef LFIND_NMEMB_SIZE_UINT */ + +#endif // !_CONFIG_H diff --git a/plugins/inmarsat_support/aero/libacars/config_defaults.h b/plugins/inmarsat_support/aero/libacars/config_defaults.h new file mode 100644 index 000000000..e0264f6f5 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/config_defaults.h @@ -0,0 +1,31 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +/* Default libacars configuration settings */ + +{ +// Output raw dump of ASN.1 structure for all ASN.1-encoded messages? + + LA_CONFIG_SETTING_BOOLEAN("dump_asn1", false), + +// Try to decode ACARS applications in fragmented messages, when +// reassembly is in progress? +// If reassembly is disabled, this setting has no effect (ie. applications +// are always decoded). +// + LA_CONFIG_SETTING_BOOLEAN("decode_fragments", false), + +// Radio link type (bearer) used to transmit ACARS messages processed by +// libacars. Must be set correctly when message reassembly is used (it +// determines timer values for the reassembly process). Default is 1 (VHF). +// See acars.h for full list of supported values. + + LA_CONFIG_SETTING_INTEGER("acars_bearer", 1), + +// Pretty-print XML in ACARS and MIAM Core payloads? + + LA_CONFIG_SETTING_BOOLEAN("prettify_xml", false) +}; diff --git a/plugins/inmarsat_support/aero/libacars/configuration.c b/plugins/inmarsat_support/aero/libacars/configuration.c new file mode 100644 index 000000000..1901a98f9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/configuration.c @@ -0,0 +1,204 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include // strdup +#include // la_assert +#include // LA_XCALLOC, LA_XFREE +#include // la_hash + +typedef enum { + LA_CONFVAR_UNKNOWN = 0, + LA_CONFVAR_BOOLEAN = 1, + LA_CONFVAR_INTEGER = 2, + LA_CONFVAR_DOUBLE = 3, + LA_CONFVAR_STRING = 4 +} la_config_item_type; +#define LA_CONFIG_ITEM_TYPE_MAX 4 + +typedef union { + bool _bool; + long int _int; + double _double; + char *_str; +} la_config_item_value; + +typedef struct { + la_config_item_type type; + la_config_item_value value; +} la_config_item; + +typedef struct { + char const *name; + la_config_item value; +} la_config_option; + +#define LA_CONFIG_ITEM_VALUE(_member, _value) \ +{ ._member = (_value)} +#define LA_CONFIG_ITEM(_type, _member, _value) \ +{ .type = _type, .value = LA_CONFIG_ITEM_VALUE(_member, _value) } +#define LA_CONFIG_SETTING_BOOLEAN(_name, _value) \ +{ .name = _name, .value = LA_CONFIG_ITEM(LA_CONFVAR_BOOLEAN, _bool, _value) } +#define LA_CONFIG_SETTING_DOUBLE(_name, _value) \ +{ .name = _name, .value = LA_CONFIG_ITEM(LA_CONFVAR_DOUBLE, _double, _value) } +#define LA_CONFIG_SETTING_INTEGER(_name, _value) \ +{ .name = _name, .value = LA_CONFIG_ITEM(LA_CONFVAR_INTEGER, _int, _value) } +#define LA_CONFIG_SETTING_STRING(_name, _value) \ +{ .name = _name, .value = LA_CONFIG_ITEM(LA_CONFVAR_STRING, _str, _value) } + +static const la_config_option config_defaults[] = +#include + +#define CONFIG_DEFAULTS_COUNT (sizeof(config_defaults) / sizeof(la_config_option)) + +static la_hash *config = NULL; +static void la_config_init(); + +// Sets the given config option to the given type/value. +// Returns true if the option already existed in the config, false otherwise. +static bool la_config_option_set(char const *name, la_config_item const item) { + la_assert(name != NULL); + la_assert(item.type >= 0); + la_assert(item.type <= LA_CONFIG_ITEM_TYPE_MAX); + + if(config == NULL) { + la_config_init(); + } + LA_NEW(la_config_item, new_item); + char *new_name = strdup(name); + new_item->type = item.type; + new_item->value = item.value; + return la_hash_insert(config, new_name, new_item); +} + +bool la_config_set_bool(char const *name, bool value) { + if(name == NULL) { + return false; + } + (void)la_config_option_set(name, (la_config_item){ + .type = LA_CONFVAR_BOOLEAN, + .value = { ._bool = value } + }); + return true; +} + +bool la_config_set_int(char const *name, long int value) { + if(name == NULL) { + return false; + } + (void)la_config_option_set(name, (la_config_item){ + .type = LA_CONFVAR_INTEGER, + .value = { ._int = value } + }); + return true; +} + +bool la_config_set_double(char const *name, double value) { + if(name == NULL) { + return false; + } + (void)la_config_option_set(name, (la_config_item){ + .type = LA_CONFVAR_DOUBLE, + .value = { ._double = value } + }); + return true; +} + +bool la_config_set_str(char const *name, char const *value) { + if(name == NULL) { + return false; + } + (void)la_config_option_set(name, (la_config_item){ + .type = LA_CONFVAR_STRING, + .value = { ._str = value ? strdup(value) : NULL } + }); + return true; +} + +static la_config_item *la_config_option_get(char const *name) { + if(name == NULL) { + return false; + } + if(config == NULL) { + la_config_init(); + } + return la_hash_lookup(config, name); +} + +bool la_config_get_bool(char const *name, bool *result) { + la_config_item *item = la_config_option_get(name); + if(item && item->type == LA_CONFVAR_BOOLEAN) { + *result = item->value._bool; + return true; + } + return false; +} + +bool la_config_get_int(char const *name, long int *result) { + la_config_item *item = la_config_option_get(name); + if(item && item->type == LA_CONFVAR_INTEGER) { + *result = item->value._int; + return true; + } + return false; +} + +bool la_config_get_double(char const *name, double *result) { + la_config_item *item = la_config_option_get(name); + if(item && item->type == LA_CONFVAR_DOUBLE) { + *result = item->value._double; + return true; + } + return false; +} + +bool la_config_get_str(char const *name, char **result) { + la_config_item *item = la_config_option_get(name); + if(item && item->type == LA_CONFVAR_STRING) { + *result = item->value._str; + return true; + } + return false; +} + +bool la_config_unset(char *name) { + if(config == NULL) { + la_config_init(); + } + return la_hash_remove(config, name); +} + +static void la_config_item_destroy(void *data) { + if(data == NULL) { + return; + } + la_config_item *item = data; + if(item->type == LA_CONFVAR_STRING) { + LA_XFREE(item->value._str); + } + LA_XFREE(item); +} + +void la_config_destroy() { + la_hash_destroy(config); +} + +void la_config_init() { + if(config != NULL) { + la_config_destroy(); + } + config = la_hash_new(la_hash_key_str, la_hash_compare_keys_str, + la_simple_free, la_config_item_destroy); + la_assert(config != NULL); + for(size_t i = 0; i < CONFIG_DEFAULTS_COUNT; i++) { + la_config_option const *opt = config_defaults + i; + if(opt->value.type == LA_CONFVAR_STRING) { + (void)la_config_set_str(opt->name, opt->value.value._str); + } else { + (void)la_config_option_set(opt->name, opt->value); + } + } +} diff --git a/plugins/inmarsat_support/aero/libacars/cpdlc.c b/plugins/inmarsat_support/aero/libacars/cpdlc.c new file mode 100644 index 000000000..24e12d73c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/cpdlc.c @@ -0,0 +1,127 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#include +#include +#include +#include +#include +#include // asn_DEF_FANSATCDownlinkMessage +#include // asn_DEF_FANSATCUplinkMessage +#include // asn_sprintf() +#include // la_assert +#include // la_asn1_decode_as() +#include // la_asn1_output_cpdlc_as_*() +#include // la_cpdlc_msg +#include // la_proto_node, la_config_get_bool, la_proto_tree_find_protocol +#include // la_debug_print +#include // LA_XFREE +#include // la_vstring, la_vstring_append_sprintf() +#include // la_json_append_bool() + +la_proto_node *la_cpdlc_parse(uint8_t const *buf, int len, la_msg_dir msg_dir) { + if(buf == NULL) + return NULL; + + la_proto_node *node = la_proto_node_new(); + LA_NEW(la_cpdlc_msg, msg); + node->data = msg; + node->td = &la_DEF_cpdlc_message; + + if(msg_dir == LA_MSG_DIR_GND2AIR) { + msg->asn_type = &asn_DEF_FANSATCUplinkMessage; + } else if(msg_dir == LA_MSG_DIR_AIR2GND) { + msg->asn_type = &asn_DEF_FANSATCDownlinkMessage; + } + la_assert(msg->asn_type != NULL); + if(len == 0) { + // empty payload is not an error + la_debug_print(D_INFO, "Empty CPDLC message, decoding skipped\n"); + return node; + } + + la_debug_print(D_INFO, "Decoding as %s, len: %d\n", msg->asn_type->name, len); + if(la_asn1_decode_as(msg->asn_type, &msg->data, buf, len) != 0) { + msg->err = true; + } else { + msg->err = false; + } + return node; +} + +void la_cpdlc_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_cpdlc_msg const *msg = data; + if(msg->err == true) { + LA_ISPRINTF(vstr, indent, "-- Unparseable FANS-1/A message\n"); + return; + } + if(msg->asn_type != NULL) { + if(msg->data != NULL) { + bool dump_asn1 = false; + (void)la_config_get_bool("dump_asn1", &dump_asn1); + if(dump_asn1 == true) { + LA_ISPRINTF(vstr, indent, "ASN.1 dump:\n"); + // asn_fprint does not indent the first line + LA_ISPRINTF(vstr, indent + 1, ""); + asn_sprintf(vstr, msg->asn_type, msg->data, indent + 2); + LA_EOL(vstr); + } + la_asn1_output_cpdlc_as_text((la_asn1_formatter_params){ + .vstr = vstr, + .td = msg->asn_type, + .sptr = msg->data, + .indent = indent + }); + } else { + LA_ISPRINTF(vstr, indent, "-- \n"); + } + } +} + +void la_cpdlc_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_cpdlc_msg const *msg = data; + la_json_append_bool(vstr, "err", msg->err); + if(msg->err == true) { + return; + } + if(msg->asn_type != NULL) { + if(msg->data != NULL) { + la_asn1_output_cpdlc_as_json((la_asn1_formatter_params){ + .vstr = vstr, + .td = msg->asn_type, + .sptr = msg->data, + }); + } + } +} + +void la_cpdlc_destroy(void *data) { + if(data == NULL) { + return; + } + la_cpdlc_msg *msg = data; + if(msg->asn_type != NULL) { + msg->asn_type->free_struct(msg->asn_type, msg->data, 0); + } + LA_XFREE(data); +} + +la_type_descriptor const la_DEF_cpdlc_message = { + .format_text = la_cpdlc_format_text, + .format_json = la_cpdlc_format_json, + .json_key = "cpdlc", + .destroy = la_cpdlc_destroy +}; + +la_proto_node *la_proto_tree_find_cpdlc(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_cpdlc_message); +} diff --git a/plugins/inmarsat_support/aero/libacars/cpdlc.h b/plugins/inmarsat_support/aero/libacars/cpdlc.h new file mode 100644 index 000000000..1b6aa3600 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/cpdlc.h @@ -0,0 +1,43 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_CPDLC_H +#define LA_CPDLC_H 1 + +#include +#include +#include // la_type_descriptor, la_proto_node +#include // la_vstring +#include // asn_TYPE_descriptor_t + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + asn_TYPE_descriptor_t *asn_type; + void *data; + bool err; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_cpdlc_msg; + +// cpdlc.c +extern la_type_descriptor const la_DEF_cpdlc_message; +la_proto_node *la_cpdlc_parse(uint8_t const *buf, int len, la_msg_dir msg_dir); +void la_cpdlc_format_text(la_vstring *vstr, void const *data, int indent); +void la_cpdlc_format_json(la_vstring *vstr, void const *data); +void la_cpdlc_destroy(void *data); +la_proto_node *la_proto_tree_find_cpdlc(la_proto_node *root); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_CPDLC_H diff --git a/plugins/inmarsat_support/aero/libacars/crc.c b/plugins/inmarsat_support/aero/libacars/crc.c new file mode 100644 index 000000000..84d4fec51 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/crc.c @@ -0,0 +1,193 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include +#include + +/*****************************************************************/ +/* */ +/* CRC LOOKUP TABLE */ +/* ================ */ +/* The following CRC lookup table was generated automagically */ +/* by the Rocksoft^tm Model CRC Algorithm Table Generation */ +/* Program V1.0 using the following model parameters: */ +/* */ +/* Width : 2 bytes. */ +/* Poly : 0x1021 */ +/* Reverse : FALSE. */ +/* */ +/* For more information on the Rocksoft^tm Model CRC Algorithm, */ +/* see the document titled "A Painless Guide to CRC Error */ +/* Detection Algorithms" by Ross Williams */ +/* (ross@guest.adelaide.edu.au.). This document is likely to be */ +/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ +/* */ +/*****************************************************************/ +uint16_t la_crc16_arinc(uint8_t const *data, uint32_t len, uint16_t crc_init) { + static uint16_t const crctable[256] = + { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, + 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, + 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, + 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, + 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, + 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, + 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, + 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, + 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, + 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, + 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70, + 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78, + 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F, + 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, + 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, + 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C, + 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3, + 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, + 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, + 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, + 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, + 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, + 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 + }; + uint16_t crc = crc_init; + while (len-- > 0) { + crc = (crc << 8) ^ crctable[((crc >> 8) ^ *data++) & 0xff]; + } + return crc; +} + +uint16_t la_crc16_ccitt(uint8_t const *data, uint32_t len, uint16_t crc_init) { + /* CRC-16-CCITT, poly: 0x1021 */ + static uint16_t const crctable[256] = + { + 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, + 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, + 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, + 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, + 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, + 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, + 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, + 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, + 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, + 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, + 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, + 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, + 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, + 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, + 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, + 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, + 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, + 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, + 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, + 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, + 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, + 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, + 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, + 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, + 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, + 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, + 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, + 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, + 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, + 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, + 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, + 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 + }; + uint16_t crc = crc_init; + while (len-- > 0) { + crc = (crc >> 8) ^ crctable[(crc ^ *data++) & 0xff]; + } + return crc; +} + +uint32_t la_crc32_arinc665(uint8_t const *data, uint32_t len, uint32_t crc_init) { + // Width : 4 bytes + // Poly : 0x04C11DB7L + // Reverse : FALSE + static uint32_t const crctable[256] = + { + 0x00000000L, 0x04C11DB7L, 0x09823B6EL, 0x0D4326D9L, + 0x130476DCL, 0x17C56B6BL, 0x1A864DB2L, 0x1E475005L, + 0x2608EDB8L, 0x22C9F00FL, 0x2F8AD6D6L, 0x2B4BCB61L, + 0x350C9B64L, 0x31CD86D3L, 0x3C8EA00AL, 0x384FBDBDL, + 0x4C11DB70L, 0x48D0C6C7L, 0x4593E01EL, 0x4152FDA9L, + 0x5F15ADACL, 0x5BD4B01BL, 0x569796C2L, 0x52568B75L, + 0x6A1936C8L, 0x6ED82B7FL, 0x639B0DA6L, 0x675A1011L, + 0x791D4014L, 0x7DDC5DA3L, 0x709F7B7AL, 0x745E66CDL, + 0x9823B6E0L, 0x9CE2AB57L, 0x91A18D8EL, 0x95609039L, + 0x8B27C03CL, 0x8FE6DD8BL, 0x82A5FB52L, 0x8664E6E5L, + 0xBE2B5B58L, 0xBAEA46EFL, 0xB7A96036L, 0xB3687D81L, + 0xAD2F2D84L, 0xA9EE3033L, 0xA4AD16EAL, 0xA06C0B5DL, + 0xD4326D90L, 0xD0F37027L, 0xDDB056FEL, 0xD9714B49L, + 0xC7361B4CL, 0xC3F706FBL, 0xCEB42022L, 0xCA753D95L, + 0xF23A8028L, 0xF6FB9D9FL, 0xFBB8BB46L, 0xFF79A6F1L, + 0xE13EF6F4L, 0xE5FFEB43L, 0xE8BCCD9AL, 0xEC7DD02DL, + 0x34867077L, 0x30476DC0L, 0x3D044B19L, 0x39C556AEL, + 0x278206ABL, 0x23431B1CL, 0x2E003DC5L, 0x2AC12072L, + 0x128E9DCFL, 0x164F8078L, 0x1B0CA6A1L, 0x1FCDBB16L, + 0x018AEB13L, 0x054BF6A4L, 0x0808D07DL, 0x0CC9CDCAL, + 0x7897AB07L, 0x7C56B6B0L, 0x71159069L, 0x75D48DDEL, + 0x6B93DDDBL, 0x6F52C06CL, 0x6211E6B5L, 0x66D0FB02L, + 0x5E9F46BFL, 0x5A5E5B08L, 0x571D7DD1L, 0x53DC6066L, + 0x4D9B3063L, 0x495A2DD4L, 0x44190B0DL, 0x40D816BAL, + 0xACA5C697L, 0xA864DB20L, 0xA527FDF9L, 0xA1E6E04EL, + 0xBFA1B04BL, 0xBB60ADFCL, 0xB6238B25L, 0xB2E29692L, + 0x8AAD2B2FL, 0x8E6C3698L, 0x832F1041L, 0x87EE0DF6L, + 0x99A95DF3L, 0x9D684044L, 0x902B669DL, 0x94EA7B2AL, + 0xE0B41DE7L, 0xE4750050L, 0xE9362689L, 0xEDF73B3EL, + 0xF3B06B3BL, 0xF771768CL, 0xFA325055L, 0xFEF34DE2L, + 0xC6BCF05FL, 0xC27DEDE8L, 0xCF3ECB31L, 0xCBFFD686L, + 0xD5B88683L, 0xD1799B34L, 0xDC3ABDEDL, 0xD8FBA05AL, + 0x690CE0EEL, 0x6DCDFD59L, 0x608EDB80L, 0x644FC637L, + 0x7A089632L, 0x7EC98B85L, 0x738AAD5CL, 0x774BB0EBL, + 0x4F040D56L, 0x4BC510E1L, 0x46863638L, 0x42472B8FL, + 0x5C007B8AL, 0x58C1663DL, 0x558240E4L, 0x51435D53L, + 0x251D3B9EL, 0x21DC2629L, 0x2C9F00F0L, 0x285E1D47L, + 0x36194D42L, 0x32D850F5L, 0x3F9B762CL, 0x3B5A6B9BL, + 0x0315D626L, 0x07D4CB91L, 0x0A97ED48L, 0x0E56F0FFL, + 0x1011A0FAL, 0x14D0BD4DL, 0x19939B94L, 0x1D528623L, + 0xF12F560EL, 0xF5EE4BB9L, 0xF8AD6D60L, 0xFC6C70D7L, + 0xE22B20D2L, 0xE6EA3D65L, 0xEBA91BBCL, 0xEF68060BL, + 0xD727BBB6L, 0xD3E6A601L, 0xDEA580D8L, 0xDA649D6FL, + 0xC423CD6AL, 0xC0E2D0DDL, 0xCDA1F604L, 0xC960EBB3L, + 0xBD3E8D7EL, 0xB9FF90C9L, 0xB4BCB610L, 0xB07DABA7L, + 0xAE3AFBA2L, 0xAAFBE615L, 0xA7B8C0CCL, 0xA379DD7BL, + 0x9B3660C6L, 0x9FF77D71L, 0x92B45BA8L, 0x9675461FL, + 0x8832161AL, 0x8CF30BADL, 0x81B02D74L, 0x857130C3L, + 0x5D8A9099L, 0x594B8D2EL, 0x5408ABF7L, 0x50C9B640L, + 0x4E8EE645L, 0x4A4FFBF2L, 0x470CDD2BL, 0x43CDC09CL, + 0x7B827D21L, 0x7F436096L, 0x7200464FL, 0x76C15BF8L, + 0x68860BFDL, 0x6C47164AL, 0x61043093L, 0x65C52D24L, + 0x119B4BE9L, 0x155A565EL, 0x18197087L, 0x1CD86D30L, + 0x029F3D35L, 0x065E2082L, 0x0B1D065BL, 0x0FDC1BECL, + 0x3793A651L, 0x3352BBE6L, 0x3E119D3FL, 0x3AD08088L, + 0x2497D08DL, 0x2056CD3AL, 0x2D15EBE3L, 0x29D4F654L, + 0xC5A92679L, 0xC1683BCEL, 0xCC2B1D17L, 0xC8EA00A0L, + 0xD6AD50A5L, 0xD26C4D12L, 0xDF2F6BCBL, 0xDBEE767CL, + 0xE3A1CBC1L, 0xE760D676L, 0xEA23F0AFL, 0xEEE2ED18L, + 0xF0A5BD1DL, 0xF464A0AAL, 0xF9278673L, 0xFDE69BC4L, + 0x89B8FD09L, 0x8D79E0BEL, 0x803AC667L, 0x84FBDBD0L, + 0x9ABC8BD5L, 0x9E7D9662L, 0x933EB0BBL, 0x97FFAD0CL, + 0xAFB010B1L, 0xAB710D06L, 0xA6322BDFL, 0xA2F33668L, + 0xBCB4666DL, 0xB8757BDAL, 0xB5365D03L, 0xB1F740B4L + }; + uint32_t crc = crc_init; + while (len-- > 0) { + crc = (crc << 8) ^ crctable[(crc >> 24) ^ *data++]; + } + return crc; +} diff --git a/plugins/inmarsat_support/aero/libacars/crc.h b/plugins/inmarsat_support/aero/libacars/crc.h new file mode 100644 index 000000000..88e9a156c --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/crc.h @@ -0,0 +1,17 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_CRC_ARINC_H +#define LA_CRC_ARINC_H + +#include +#include + +uint16_t la_crc16_arinc(uint8_t const *data, uint32_t len, uint16_t crc_init); +uint16_t la_crc16_ccitt(uint8_t const *data, uint32_t len, uint16_t crc_init); +uint32_t la_crc32_arinc665(uint8_t const *data, uint32_t len, uint32_t crc_init); + +#endif // !LA_CRC_ARINC_H diff --git a/plugins/inmarsat_support/aero/libacars/dict.c b/plugins/inmarsat_support/aero/libacars/dict.c new file mode 100644 index 000000000..4563b29ba --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/dict.c @@ -0,0 +1,17 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include + +void *la_dict_search(la_dict const *list, int id) { + if(list == NULL) return NULL; + la_dict *ptr; + for(ptr = (la_dict *)list; ; ptr++) { + if(ptr->val == NULL) return NULL; + if(ptr->id == id) return ptr->val; + } +} diff --git a/plugins/inmarsat_support/aero/libacars/dict.h b/plugins/inmarsat_support/aero/libacars/dict.h new file mode 100644 index 000000000..616a25e9f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/dict.h @@ -0,0 +1,24 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#ifndef LA_DICT_H +#define LA_DICT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int id; + void *val; +} la_dict; + +void *la_dict_search(la_dict const *list, int id); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_DICT_H diff --git a/plugins/inmarsat_support/aero/libacars/hash.c b/plugins/inmarsat_support/aero/libacars/hash.c new file mode 100644 index 000000000..62d1ec697 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/hash.c @@ -0,0 +1,230 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include +#include // strcmp +#include // la_assert +#include // la_hash +#include // la_list +#include // LA_XCALLOC, LA_XFREE + +#define LA_HASH_SIZE 173 + +struct la_hash_s { + la_hash_func *compute_hash; + la_hash_compare_func *compare_keys; + la_hash_key_destroy_func *destroy_key; + la_hash_value_destroy_func *destroy_value; + la_list *buckets[LA_HASH_SIZE]; +}; + +typedef struct { + void *key; + void *value; +} la_hash_element; + +uint32_t la_hash_string(char const *str, uint32_t h) { + int h_work = (int)h; + for(char const *p = str; *p != '\0'; p++) { + h_work = h_work * LA_HASH_MULTIPLIER + (int)(*p); + } + return (uint32_t)h_work; +} + +uint32_t la_hash_key_str(void const *k) { + la_assert(k != NULL); + char const *str = k; + return la_hash_string(str, LA_HASH_INIT); +} + +void la_simple_free(void *data) { + LA_XFREE(data); +} + +static void la_hash_destroy_key(la_hash *h, void *key) { + la_assert(h != NULL); + if(h->destroy_key != NULL) { + h->destroy_key(key); + } +} + +static void la_hash_destroy_value(la_hash *h, void *value) { + la_assert(h != NULL); + if(h->destroy_value != NULL) { + h->destroy_value(value); + } +} + +bool la_hash_compare_keys_str(void const *key1, void const *key2) { + return (key1 != NULL && key2 != NULL && strcmp(key1, key2) == 0); +} + +la_hash *la_hash_new(la_hash_func *compute_hash, la_hash_compare_func *compare_keys, + la_hash_key_destroy_func *destroy_key, la_hash_value_destroy_func *destroy_value) { + + LA_NEW(la_hash, h); + h->compute_hash = (compute_hash ? compute_hash : la_hash_key_str); + h->compare_keys = (compare_keys ? compare_keys : la_hash_compare_keys_str); + h->destroy_key = destroy_key; // no default; might be NULL + h->destroy_value = destroy_value; // no default; might be NULL + return h; +} + +static size_t la_hash_get_bucket(la_hash const *h, void const *key) { + return h->compute_hash(key) % LA_HASH_SIZE; +} + +static la_list *la_hash_lookup_list_node(la_hash const *h, void const *key, + la_list **prev_node) { + la_assert(h != NULL); + la_assert(key != NULL); + + size_t bucket = la_hash_get_bucket(h, key); + la_list *l = h->buckets[bucket]; + la_list *pl = NULL; + la_hash_element *elem; + for(; l != NULL; pl = l, l = la_list_next(l)) { + elem = l->data; + if(h->compare_keys(key, elem->key) == true) { + break; + } + } + // Give back pointer to the previous node if the caller wants it + if(prev_node != NULL) { + *prev_node = pl; + } + // Return the node containing the requested key (or NULL if not found) + return l; +} + +void *la_hash_lookup(la_hash const *h, void const *key) { + la_assert(h != NULL); + la_assert(key != NULL); + + la_list *list_node = la_hash_lookup_list_node(h, key, NULL); + if(list_node == NULL) { + return NULL; + } + la_hash_element *elem = list_node->data; + return (void *)elem->value; +} + +// Inserts the new key into the hash and assigns it a value. Key and value +// pointers are copied directly into the hash, so these variables must exist +// during the entire lifetime of the hash entry (no automatic / static +// variables here). If the key already exists in the hash, the old value is +// freed, and the key value is replaced with the new one. The key in the hash +// is not replaced, but the key given as argument is freed in this case. +bool la_hash_insert(la_hash *h, void *key, void *value) { + la_assert(h != NULL); + la_assert(key != NULL); + + la_list *list_node = la_hash_lookup_list_node(h, key, NULL); + if(list_node != NULL) { + // Key already exists - insert the new value, free the old value, + // preserve the old key, free the new key + la_hash_element *elem = list_node->data; + la_hash_destroy_key(h, key); + la_hash_destroy_value(h, elem->value); + elem->value = value; + return true; + } + // Key not found - create new hash entry + LA_NEW(la_hash_element, elem); + elem->key = key; + elem->value = value; + size_t bucket = la_hash_get_bucket(h, key); + h->buckets[bucket] = la_list_append(h->buckets[bucket], elem); + return false; +} + +// Removes the key from the hash. Frees both key and value which were +// stored in the hash. The key given as an argument is not freed, +// so a static value is allowed here. +bool la_hash_remove(la_hash *h, void *key) { + la_assert(h != NULL); + la_assert(key != NULL); + + la_list *prev_node = NULL; + la_list *list_node = la_hash_lookup_list_node(h, key, &prev_node); + if(list_node == NULL) { + return false; + } + // If prev_node is not NULL, then join two list parts together. + // Otherwise replace the top of the list in the bucket. + if(prev_node != NULL) { + prev_node->next = list_node->next; + } else { + size_t bucket = la_hash_get_bucket(h, key); + h->buckets[bucket] = list_node->next; + } + list_node->next = NULL; + // Now free the key and value + la_hash_element *elem = list_node->data; + la_hash_destroy_key(h, elem->key); + la_hash_destroy_value(h, elem->value); + // This will free elem too + // XXX: use la_hash_element_destroy instead? + la_list_free(list_node); + return true; +} + +static void la_free_noop(void *data) { + LA_UNUSED(data); + // noop +} + +// Iterates over hash entries executing la_hash_if_func() for each key-value +// pair. If the func returns true, removes the entry from the hash. +int la_hash_foreach_remove(la_hash *h, la_hash_if_func *if_func, void *if_func_ctx) { + la_assert(h != NULL); + la_assert(if_func != NULL); + + la_list *keys_to_delete = NULL; + int num_keys_deleted = 0; + for(size_t i = 0; i < LA_HASH_SIZE; i++) { + for(la_list *l = h->buckets[i]; l != NULL; l = la_list_next(l)) { + la_hash_element *elem = l->data; + if(if_func(elem->key, elem->value, if_func_ctx) == true) { + keys_to_delete = la_list_append(keys_to_delete, elem->key); + num_keys_deleted++; + } + } + } + for(la_list *l = keys_to_delete; l != NULL; l = la_list_next(l)) { + la_hash_remove(h, l->data); + } + // can't use la_list_free() here, as keys have already been freed by la_hash_remove() + la_list_free_full(keys_to_delete, la_free_noop); + return num_keys_deleted; +} + +// This is a callback for la_list_free_full_with_ctx() +static void la_hash_element_destroy(void *elemptr, void *hashptr) { + la_assert(hashptr != NULL); + if(elemptr == NULL) { + return; + } + la_hash *h = hashptr; + la_hash_element *elem = elemptr; + la_hash_destroy_key(h, elem->key); + la_hash_destroy_value(h, elem->value); + LA_XFREE(elem); +} + +// Deallocates all keys and values (if destroy functions have been provided) +// and then frees the memory used by the hash. +void la_hash_destroy(la_hash *h) { + if(h == NULL) { + return; + } + for(size_t i = 0; i < LA_HASH_SIZE; i++) { + la_list_free_full_with_ctx(h->buckets[i], la_hash_element_destroy, h); + h->buckets[i] = NULL; + } + LA_XFREE(h); +} diff --git a/plugins/inmarsat_support/aero/libacars/hash.h b/plugins/inmarsat_support/aero/libacars/hash.h new file mode 100644 index 000000000..47ad6a532 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/hash.h @@ -0,0 +1,42 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#ifndef LA_HASH_H +#define LA_HASH_H 1 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct la_hash_s la_hash; +typedef uint32_t (la_hash_func)(void const *key); +typedef bool (la_hash_compare_func)(void const *key1, void const *key2); +typedef bool (la_hash_if_func)(void const *key, void const *value, void *ctx); +typedef void (la_hash_key_destroy_func)(void *key); +typedef void (la_hash_value_destroy_func)(void *value); + +#define LA_HASH_INIT 5381 +#define LA_HASH_MULTIPLIER 17 + +la_hash *la_hash_new(la_hash_func *compute_hash, la_hash_compare_func *compare_keys, + la_hash_key_destroy_func *destroy_key, la_hash_value_destroy_func *destroy_value); +bool la_hash_insert(la_hash *h, void *key, void *value); +bool la_hash_remove(la_hash *h, void *key); +void *la_hash_lookup(la_hash const *h, void const *key); +uint32_t la_hash_key_str(void const *k); +uint32_t la_hash_string(char const *str, uint32_t h); +bool la_hash_compare_keys_str(void const *key1, void const *key2); +void la_simple_free(void *data); +int la_hash_foreach_remove(la_hash *h, la_hash_if_func *if_func, void *if_func_ctx); +void la_hash_destroy(la_hash *h); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_HASH_H diff --git a/plugins/inmarsat_support/aero/libacars/json.c b/plugins/inmarsat_support/aero/libacars/json.c new file mode 100644 index 000000000..fd9e3cfbe --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/json.c @@ -0,0 +1,181 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include // PRI* macros +#include +#include +#include // strlen() +#include // la_assert() +#include // la_vstring +#include // LA_XCALLOC(), LA_XFREE() + +static void la_json_trim_comma(la_vstring *vstr) { + la_assert(vstr != NULL); + size_t len = vstr->len; + if(len > 0 && vstr->str[len-1] == ',') { + vstr->str[len-1] = '\0'; + vstr->len--; + } +} + +// Note: this function escapes raw ASCII bytes. It does not assume that the input +// is valid Unicode, so it does not attempt to guess Unicode codepoints from +// the input byte string. +static char *la_json_escapechars(uint8_t const *buf, size_t len) { + la_assert(buf != NULL); + size_t new_len = len; + if(len > 0) { + for(size_t i = 0; i < len; i++) { + la_debug_print(D_INFO, "char: 0x%x\n", buf[i]); + if(buf[i] < ' ' || buf[i] > 0x7e || buf[i] == '\"' || buf[i] == '\\') { + la_debug_print(D_INFO, "char: 0x%x needs escaping\n", buf[i]); + new_len += 5; // to fit the \uNNNN form + } + } + } + char *out = LA_XCALLOC(new_len + 1, sizeof(uint8_t)); // Add space for NULL terminator + if(new_len == len) { + memcpy(out, buf, len); + goto end; + } + char *outptr = out; + for(size_t i = 0; i < len; i++) { + if(buf[i] < ' ' || buf[i] > 0x7e || buf[i] == '\"' || buf[i] == '\\') { + *outptr++ = '\\'; + switch(buf[i]) { + case '\b': + *outptr++ = 'b'; + break; + case '\t': + *outptr++ = 't'; + break; + case '\n': + *outptr++ = 'n'; + break; + case '\f': + *outptr++ = 'f'; + break; + case '\r': + *outptr++ = 'r'; + break; + case '\"': + *outptr++ = '\"'; + break; + case '\\': + *outptr++ = '\\'; + break; + default: + sprintf(outptr, "u%04x", buf[i]); + outptr += 5; + } + } else { + *outptr++ = buf[i]; + } + } +end: + out[new_len] = '\0'; + return out; +} + +static inline void la_json_print_key(la_vstring *vstr, char const *key) { + la_assert(vstr != NULL); + if(key != NULL && key[0] != '\0') { + // Warning: no character escaping is performed here. For libacars this is fine + // as all key names are static. Escaping them would add unnecessary overhead. + la_vstring_append_sprintf(vstr, "\"%s\":", key); + } +} + +void la_json_append_bool(la_vstring *vstr, char const *key, bool val) { + la_assert(vstr != NULL); + la_json_print_key(vstr, key); + la_vstring_append_sprintf(vstr, "%s,", (val == true ? "true" : "false")); +} + +void la_json_append_double(la_vstring *vstr, char const *key, double val) { + la_assert(vstr != NULL); + la_json_print_key(vstr, key); + la_vstring_append_sprintf(vstr, "%f,", val); +} + +void la_json_append_int64(la_vstring *vstr, char const *key, int64_t val) { + la_assert(vstr != NULL); + la_json_print_key(vstr, key); + la_vstring_append_sprintf(vstr, "%" PRId64 ",", val); +} + +void la_json_append_long(la_vstring *vstr, char const *key, long val) { + la_json_append_int64(vstr, key, val); +} + +void la_json_append_octet_string_as_string(la_vstring *vstr, char const *key, + uint8_t const *buf, size_t len) { + la_assert(vstr != NULL); + if(buf == NULL) { + return; + } + la_json_print_key(vstr, key); + char *escaped = la_json_escapechars(buf, len); + la_vstring_append_sprintf(vstr, "\"%s\",", escaped); + LA_XFREE(escaped); +} + +// Note: this function does not handle NULL characters inside the string. +// Whenever this might be an issue, la_json_append_octet_string_as_string shall be used instead. +void la_json_append_string(la_vstring *vstr, char const *key, char const *val) { + la_json_append_octet_string_as_string(vstr, key, (uint8_t const *)val, strlen(val)); +} + +void la_json_append_char(la_vstring *vstr, char const *key, char val) { + la_json_append_octet_string_as_string(vstr, key, (uint8_t * const)&val, 1); +} + +void la_json_object_start(la_vstring *vstr, char const *key) { + la_assert(vstr != NULL); + la_json_print_key(vstr, key); + la_vstring_append_sprintf(vstr, "%s", "{"); +} + +void la_json_object_end(la_vstring *vstr) { + la_assert(vstr != NULL); + la_json_trim_comma(vstr); + la_vstring_append_sprintf(vstr, "%s", "},"); +} + +void la_json_array_start(la_vstring *vstr, char const *key) { + la_assert(vstr != NULL); + la_json_print_key(vstr, key); + la_vstring_append_sprintf(vstr, "%s", "["); +} + +void la_json_array_end(la_vstring *vstr) { + la_assert(vstr != NULL); + la_json_trim_comma(vstr); + la_vstring_append_sprintf(vstr, "%s", "],"); +} + +void la_json_append_octet_string(la_vstring *vstr, char const *key, + uint8_t const *buf, size_t len) { + la_assert(vstr != NULL); + la_json_array_start(vstr, key); + if(buf != NULL && len > 0) { + for(size_t i = 0; i < len; i++) { + la_json_append_long(vstr, NULL, buf[i]); + } + } + la_json_array_end(vstr); +} + +void la_json_start(la_vstring *vstr) { + la_assert(vstr != NULL); + la_json_object_start(vstr, NULL); +} + +void la_json_end(la_vstring *vstr) { + la_assert(vstr != NULL); + la_json_object_end(vstr); + la_json_trim_comma(vstr); +} diff --git a/plugins/inmarsat_support/aero/libacars/json.h b/plugins/inmarsat_support/aero/libacars/json.h new file mode 100644 index 000000000..db198e42a --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/json.h @@ -0,0 +1,41 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_JSON_H +#define LA_JSON_H 1 + +#include +#include +#include // la_vstring + +#ifdef __cplusplus +extern "C" { +#endif + +// json.c +void la_json_object_start(la_vstring *vstr, char const *key); +void la_json_object_end(la_vstring *vstr); +void la_json_array_start(la_vstring *vstr, char const *key); +void la_json_array_end(la_vstring *vstr); +void la_json_append_bool(la_vstring *vstr, char const *key, bool val); +void la_json_append_double(la_vstring *vstr, char const *key, double val); +void la_json_append_int64(la_vstring *vstr, char const *key, int64_t val); +void la_json_append_long(la_vstring *vstr, char const *key, long val); +// __attribute__ ((deprecated("This function is not portable; use la_json_append_int64 instead"))); +void la_json_append_char(la_vstring *vstr, char const *key, char val); +void la_json_append_string(la_vstring *vstr, char const *key, char const *val); +void la_json_append_octet_string(la_vstring *vstr, char const *key, + uint8_t const *buf, size_t len); +void la_json_append_octet_string_as_string(la_vstring *vstr, char const *key, + uint8_t const *buf, size_t len); +void la_json_start(la_vstring *vstr); +void la_json_end(la_vstring *vstr); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_JSON_H diff --git a/plugins/inmarsat_support/aero/libacars/libacars.c b/plugins/inmarsat_support/aero/libacars/libacars.c new file mode 100644 index 000000000..45823972f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/libacars.c @@ -0,0 +1,123 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#include +#ifdef DEBUG +#include // getenv, strtoul +#endif +#include // la_assert +#include // la_proto_node +#include +#include +#include // LA_XCALLOC, LA_XFREE + +static void la_proto_node_format_text(la_vstring *vstr, la_proto_node const *node, int indent) { + la_assert(indent >= 0); + if(node->data != NULL) { + la_assert(node->td); + node->td->format_text(vstr, node->data, indent); + } + if(node->next != NULL) { + la_proto_node_format_text(vstr, node->next, indent+1); + } +} + +static void la_proto_node_format_json(la_vstring *vstr, la_proto_node const *node) { + if(node->td != NULL) { + if(node->td->json_key != NULL) { + la_json_object_start(vstr, node->td->json_key); + // Missing JSON handler for a node is not fatal. + // In this case an empty JSON object is produced. + if(node->data != NULL && node->td->format_json != NULL) { + node->td->format_json(vstr, node->data); + } + } + } + if(node->next != NULL) { + la_proto_node_format_json(vstr, node->next); + } + if(node->td != NULL && node->td->json_key != NULL) { + // We've started a JSON object above, so it needs to be closed + la_json_object_end(vstr); + } +} + +la_proto_node *la_proto_node_new() { + LA_NEW(la_proto_node, node); + return node; +} + +la_vstring *la_proto_tree_format_text(la_vstring *vstr, la_proto_node const *root) { + la_assert(root); + + if(vstr == NULL) { + vstr = la_vstring_new(); + } + la_proto_node_format_text(vstr, root, 0); + return vstr; +} + +la_vstring *la_proto_tree_format_json(la_vstring *vstr, la_proto_node const *root) { + la_assert(root); + + if(vstr == NULL) { + vstr = la_vstring_new(); + } + la_json_start(vstr); + la_proto_node_format_json(vstr, root); + la_json_end(vstr); + return vstr; +} + +void la_proto_tree_destroy(la_proto_node *root) { + if(root == NULL) { + return; + } + if(root->next != NULL) { + la_proto_tree_destroy(root->next); + } + if(root->td != NULL && root->td->destroy != NULL) { + root->td->destroy(root->data); + } else { + LA_XFREE(root->data); + } + LA_XFREE(root); +} + +la_proto_node *la_proto_tree_find_protocol(la_proto_node *root, la_type_descriptor const *td) { + while(root != NULL) { + if(root->td == td) { + return root; + } + root = root->next; + } + return NULL; +} + +#ifdef DEBUG + +uint32_t Debug = 0; + +void __attribute__ ((constructor)) la_debug_init() { + char *la_debug = getenv("LA_DEBUG"); + if(la_debug != NULL) { + Debug = strtoul(la_debug, NULL, 10); + } +} + +#endif + +#ifdef _WIN32 +char * strsep(char **sp, char *sep) +{ + char *p, *s; + if (sp == NULL || *sp == NULL || **sp == '\0') return(NULL); + s = *sp; + p = s + strcspn(s, sep); + if (*p != '\0') *p++ = '\0'; + *sp = p; + return(s); +} +#endif \ No newline at end of file diff --git a/plugins/inmarsat_support/aero/libacars/libacars.h b/plugins/inmarsat_support/aero/libacars/libacars.h new file mode 100644 index 000000000..507922885 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/libacars.h @@ -0,0 +1,82 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_LIBACARS_H +#define LA_LIBACARS_H 1 +#include +#include +#include // la_vstring + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + LA_MSG_DIR_UNKNOWN, + LA_MSG_DIR_GND2AIR, + LA_MSG_DIR_AIR2GND +} la_msg_dir; + +typedef void (la_format_text_func)(la_vstring *vstr, void const *data, int indent); +typedef void (la_format_json_func)(la_vstring *vstr, void const *data); +typedef void (la_destroy_type_f)(void *data); + +typedef struct { + la_format_text_func *format_text; + la_destroy_type_f *destroy; + la_format_json_func *format_json; + char *json_key; +// reserved for future use + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_type_descriptor; + +typedef struct la_proto_node la_proto_node; + +struct la_proto_node { + la_type_descriptor const *td; + void *data; + la_proto_node *next; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +}; + +// libacars.c +la_proto_node *la_proto_node_new(); +la_vstring *la_proto_tree_format_text(la_vstring *vstr, la_proto_node const *root); +la_vstring *la_proto_tree_format_json(la_vstring *vstr, la_proto_node const *root); +void la_proto_tree_destroy(la_proto_node *root); +la_proto_node *la_proto_tree_find_protocol(la_proto_node *root, la_type_descriptor const *td); + +// configuration.c +void la_config_init(); +void la_config_destroy(); +bool la_config_set_bool(char const *name, bool value); +bool la_config_set_int(char const *name, long int value); +bool la_config_set_double(char const *name, double value); +bool la_config_set_str(char const *name, char const *value); +bool la_config_get_bool(char const *name, bool *result); +bool la_config_get_int(char const *name, long int *result); +bool la_config_get_double(char const *name, double *result); +bool la_config_get_str(char const *name, char **result); +bool la_config_unset(char *name); + +// configuration.c + +#ifdef __cplusplus +} +#endif + +#endif // !LA_LIBACARS_H diff --git a/plugins/inmarsat_support/aero/libacars/list.c b/plugins/inmarsat_support/aero/libacars/list.c new file mode 100644 index 000000000..54dac7173 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/list.c @@ -0,0 +1,76 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include // la_assert +#include // la_list +#include // LA_XCALLOC, LA_XFREE + +la_list *la_list_next(la_list const *l) { + if(l == NULL) { + return NULL; + } + return l->next; +} + +la_list *la_list_append(la_list *l, void *data) { + LA_NEW(la_list, new); + new->data = data; + if(l == NULL) { + return new; + } else { + la_list *ptr; + for(ptr = l; ptr->next != NULL; ptr = la_list_next(ptr)) + ; + ptr->next = new; + return l; + } +} + +size_t la_list_length(la_list const *l) { + size_t len = 0; + for(; l != NULL; l = la_list_next(l), len++) + ; + return len; +} + +void la_list_foreach(la_list *l, void (*cb)(), void *ctx) { + la_assert(cb != NULL); + for(; l != NULL; l = la_list_next(l)) { + cb(l->data, ctx); + } +} + +void la_list_free_full_with_ctx(la_list *l, void (*node_free)(), void *ctx) { + if(l == NULL) { + return; + } + la_list_free_full_with_ctx(l->next, node_free, ctx); + l->next = NULL; + if(node_free != NULL) { + node_free(l->data, ctx); + } else { + LA_XFREE(l->data); + } + LA_XFREE(l); +} + +void la_list_free_full(la_list *l, void (*node_free)()) { + if(l == NULL) { + return; + } + la_list_free_full(l->next, node_free); + l->next = NULL; + if(node_free != NULL) { + node_free(l->data); + } else { + LA_XFREE(l->data); + } + LA_XFREE(l); +} + +void la_list_free(la_list *l) { + la_list_free_full(l, NULL); +} diff --git a/plugins/inmarsat_support/aero/libacars/list.h b/plugins/inmarsat_support/aero/libacars/list.h new file mode 100644 index 000000000..ae03ed2e9 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/list.h @@ -0,0 +1,34 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#ifndef LA_LIST_H +#define LA_LIST_H 1 + +#include // size_t + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct la_list la_list; + +struct la_list { + void *data; + la_list *next; +}; + +la_list *la_list_next(la_list const *l); +la_list *la_list_append(la_list *l, void *data); +size_t la_list_length(la_list const *l); +void la_list_foreach(la_list *l, void (*cb)(), void *ctx); +void la_list_free(la_list *l); +void la_list_free_full(la_list *l, void (*node_free)()); +void la_list_free_full_with_ctx(la_list *l, void (*node_free)(), void *ctx); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_LIST_H diff --git a/plugins/inmarsat_support/aero/libacars/macros.h b/plugins/inmarsat_support/aero/libacars/macros.h new file mode 100644 index 000000000..29cada5db --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/macros.h @@ -0,0 +1,86 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_MACROS_H +#define LA_MACROS_H 1 + +#include +#include +#include + +#ifdef __GNUC__ +#define LA_LIKELY(x) (__builtin_expect(!!(x),1)) +#define LA_UNLIKELY(x) (__builtin_expect(!!(x),0)) +#else +#define LA_LIKELY(x) (x) +#define LA_UNLIKELY(x) (x) +#endif + +#ifdef __GNUC__ +#define LA_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else +#define LA_PRETTY_FUNCTION "" +#endif + +#define la_assert_se(expr) \ + do { \ + if (LA_UNLIKELY(!(expr))) { \ + fprintf(stderr, "Assertion '%s' failed at %s:%u, function %s(). Aborting.\n", \ + #expr , __FILE__, __LINE__, LA_PRETTY_FUNCTION); \ + abort(); \ + } \ + } while (false) + +#define la_nop() do {} while (false) + +#ifdef NDEBUG +#define la_assert(expr) la_nop() +#else +#define la_assert(expr) la_assert_se(expr) +#endif + +#define LA_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define LA_MIN(a, b) ((a) < (b) ? (a) : (b)) + +#ifdef DEBUG +#include + +extern uint32_t Debug; + +// debug levels +#define D_NONE 0 +#define D_ERROR 1 +#define D_INFO 2 +#define D_VERBOSE 3 + +#define la_debug_print(level, fmt, ...) \ + do { \ + if(Debug >= (level)) { \ + fprintf(stderr, "%s(): " fmt, __func__, ##__VA_ARGS__); \ + } \ + } while (0) + +#define la_debug_print_buf_hex(level, buf, len, fmt, ...) \ + do { \ + if(Debug >= (level)) { \ + fprintf(stderr, "%s(): " fmt, __func__, ##__VA_ARGS__); \ + fprintf(stderr, "%s(): ", __func__); \ + for(int zz = 0; zz < (len); zz++) { \ + fprintf(stderr, "%02x ", buf[zz]); \ + if(zz && (zz+1) % 32 == 0) fprintf(stderr, "\n%s(): ", __func__); \ + } \ + fprintf(stderr, "\n"); \ + } \ + } while(0) +#else +#define la_debug_print(level, fmt, ...) la_nop() +#define la_debug_print_buf_hex(level, buf, len, fmt, ...) la_nop() +#endif + +#define LA_NEW(type, x) type *(x) = LA_XCALLOC(1, sizeof(type)) +#define LA_UNUSED(x) (void)(x) + +#endif // !LA_MACROS_H diff --git a/plugins/inmarsat_support/aero/libacars/media-adv.c b/plugins/inmarsat_support/aero/libacars/media-adv.c new file mode 100644 index 000000000..f33ce5aae --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/media-adv.c @@ -0,0 +1,195 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include // isupper(), isdigit() +#include // strchr(), strcpy(), strncpy(), strlen() +#include // la_proto_node, la_proto_tree_find_protocol() +#include // la_arinc_msg, LA_ARINC_IMI_CNT +#include // la_assert() +#include // la_vstring, la_vstring_append_sprintf(), LA_ISPRINTF() +#include // la_json_*() +#include // LA_XCALLOC(), ATOI2() + +typedef struct { + char code; + char const *description; +} la_media_adv_link_type_map; + +static la_media_adv_link_type_map const link_type_map[LA_MEDIA_ADV_LINK_TYPE_CNT] = { + { .code = 'V', .description = "VHF ACARS" }, + { .code = 'S', .description = "Default SATCOM" }, + { .code = 'H', .description = "HF" }, + { .code = 'G', .description = "Global Star Satcom" }, + { .code = 'C', .description = "ICO Satcom" }, + { .code = '2', .description = "VDL2" }, + { .code = 'X', .description = "Inmarsat Aero H/H+/I/L" }, + { .code = 'I', .description = "Iridium Satcom" } +}; + +static char const *get_link_description(char code) { + for(int k = 0; k < LA_MEDIA_ADV_LINK_TYPE_CNT; k++) { + if(link_type_map[k].code == code) { + return link_type_map[k].description; + } + } + return NULL; +} + +bool is_valid_link(char link) { + return strchr("VSHGC2XI", link) != NULL; +} + +la_proto_node *la_media_adv_parse(char const *txt) { + if(txt == NULL) { + return NULL; + } + + LA_NEW(la_media_adv_msg, msg); + msg->err = true; + + la_proto_node *node = la_proto_node_new(); + node->data = msg; + node->td = &la_DEF_media_adv_message; + node->next = NULL; + + if(strlen(txt) < 10) { + goto end; + } + msg->version = txt[0] - '0'; + if(msg->version != 0) { + goto end; + } + msg->state = txt[1]; + if(msg->state != 'E' && msg->state != 'L') { + goto end; + } + msg->current_link = txt[2]; + if(!is_valid_link(msg->current_link)) { + goto end; + } + for(size_t i = 3; i < 9; i++) { + if(!isdigit(txt[i])) { + goto end; + } + } + msg->hour = ATOI2(txt[3], txt[4]); + msg->minute = ATOI2(txt[5], txt[6]); + msg->second = ATOI2(txt[7], txt[8]); + if(msg->hour > 23 || msg->minute > 59 || msg->second > 59) { + goto end; + } + txt += 9; + msg->available_links = la_vstring_new(); + // Copy all link until / character or end of string + for(; *txt != '/' && *txt != '\0'; txt++) { + if(is_valid_link(*txt)) { + la_vstring_append_buffer(msg->available_links, txt, 1); + } else { + goto end; + } + } + if(txt[0] == '/' && txt[1] != '\0') { + msg->text = strdup(txt + 1); + } + msg->err = false; +end: + return node; +} + +void la_media_adv_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_media_adv_msg const *msg = data; + + if(msg->err == true) { + LA_ISPRINTF(vstr, indent, "-- Unparseable Media Advisory message\n"); + return; + } + + LA_ISPRINTF(vstr, indent, "Media Advisory, version %d:\n", msg->version); + indent++; + + LA_ISPRINTF(vstr, indent, "Link %s %s at %02d:%02d:%02d UTC\n", + get_link_description(msg->current_link), + (msg->state == 'E') ? "established" : "lost", + msg->hour, msg->minute, msg->second + ); + + LA_ISPRINTF(vstr, indent, "Available links: "); + size_t count = strlen(msg->available_links->str); + for(size_t i = 0; i < count; i++) { + char const *link = get_link_description(msg->available_links->str[i]); + if(i == count - 1) { + la_vstring_append_sprintf(vstr, "%s\n", link); + } else { + la_vstring_append_sprintf(vstr, "%s, ", link); + } + } + + if(msg->text != NULL && msg->text[0] != '\0') { + LA_ISPRINTF(vstr, indent, "Text: %s\n", msg->text); + } +} + +void la_media_adv_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_media_adv_msg const *msg = data; + + la_json_append_bool(vstr, "err", msg->err); + if(msg->err == true) { + return; + } + la_json_append_int64(vstr, "version", msg->version); + la_json_object_start(vstr, "current_link"); + la_json_append_char(vstr, "code", msg->current_link); + la_json_append_string(vstr, "descr", get_link_description(msg->current_link)); + la_json_append_bool(vstr, "established", (msg->state == 'E') ? true : false); + la_json_object_start(vstr, "time"); + la_json_append_int64(vstr, "hour", msg->hour); + la_json_append_int64(vstr, "min", msg->minute); + la_json_append_int64(vstr, "sec", msg->second); + la_json_object_end(vstr); + la_json_object_end(vstr); + + la_json_array_start(vstr, "links_avail"); + size_t count = strlen(msg->available_links->str); + for(size_t i = 0; i < count; i++) { + la_json_object_start(vstr, NULL); + la_json_append_char(vstr, "code", msg->available_links->str[i]); + la_json_append_string(vstr, "descr", get_link_description(msg->available_links->str[i])); + la_json_object_end(vstr); + } + la_json_array_end(vstr); + if(msg->text != NULL && msg->text[0] != '\0') { + la_json_append_string(vstr, "text", msg->text); + } +} + +void la_media_adv_destroy(void *data) { + if(data == NULL) { + return; + } + la_media_adv_msg *msg = data; + la_vstring_destroy(msg->available_links, true); + LA_XFREE(msg->text); + LA_XFREE(msg); +} + +la_type_descriptor const la_DEF_media_adv_message = { + .format_text = la_media_adv_format_text, + .format_json = la_media_adv_format_json, + .json_key = "media-adv", + .destroy = la_media_adv_destroy +}; + +la_proto_node *la_proto_tree_find_media_adv(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_media_adv_message); +} diff --git a/plugins/inmarsat_support/aero/libacars/media-adv.h b/plugins/inmarsat_support/aero/libacars/media-adv.h new file mode 100644 index 000000000..31ef5e0cb --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/media-adv.h @@ -0,0 +1,47 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_MEDIA_ADV_H +#define LA_MEDIA_ADV_H 1 + +#include +#include // la_type_descriptor, la_proto_node +#include // la_vstring + +#ifdef __cplusplus +extern "C" { +#endif + +#define LA_MEDIA_ADV_LINK_TYPE_CNT 8 + +typedef struct { + bool err; + uint8_t version; + uint8_t hour; + uint8_t minute; + uint8_t second; + char state; + char current_link; + la_vstring *available_links; + char *text; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_media_adv_msg; + +la_proto_node *la_media_adv_parse(char const *txt); +void la_media_adv_format_text(la_vstring *vstr, void const *data, int indent); +void la_media_adv_format_json(la_vstring *vstr, void const *data); +extern la_type_descriptor const la_DEF_media_adv_message; +la_proto_node *la_proto_tree_find_media_adv(la_proto_node *root); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_MEDIA_ADV_H diff --git a/plugins/inmarsat_support/aero/libacars/miam-core.c b/plugins/inmarsat_support/aero/libacars/miam-core.c new file mode 100644 index 000000000..b5608ce05 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/miam-core.c @@ -0,0 +1,1391 @@ +/* This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include +#include // calloc +#include // strchr(), strdup(), strtok_r(), strlen +#include "config.h" +#ifdef WITH_ZLIB +#include // z_stream, inflateInit2(), inflate(), inflateEnd() +#endif +#ifdef WITH_LIBXML2 +#include // xmlBufferPtr, xmlBufferFree() +#endif +#include // la_assert(), LA_UNLIKELY() +#include // la_proto_node +#include // la_vstring, LA_ISPRINTF, la_isprintf_multiline_text() +#include // la_json_append_*() +#include // la_dict, la_dict_search() +#include // XCALLOC(), la_hexdump() +#include // la_crc16_arinc(), la_crc32_arinc665() +#include + +/********************** + * Forward declarations + **********************/ + +static la_proto_node *la_miam_core_v1_data_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen); +static la_proto_node *la_miam_core_v1_ack_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen); +static la_proto_node *la_miam_core_v2_data_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen); +static la_proto_node *la_miam_core_v2_ack_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen); +static la_proto_node *la_miam_core_v1v2_alo_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen); +static la_proto_node *la_miam_core_v1v2_alr_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen); + +/************************************************* + * MIAM CORE v1/v2 common definitions and routines + *************************************************/ + +typedef la_proto_node* (la_miam_core_pdu_parse_f)(uint8_t const *hdrbuf, int hdrlen, + uint8_t const *bodybuf, int bodylen); + +static la_dict const la_miam_core_v1_pdu_parser_table[] = { + { .id = LA_MIAM_CORE_PDU_DATA, .val = &la_miam_core_v1_data_parse }, + { .id = LA_MIAM_CORE_PDU_ACK, .val = &la_miam_core_v1_ack_parse }, + { .id = LA_MIAM_CORE_PDU_ALO, .val = &la_miam_core_v1v2_alo_parse }, + { .id = LA_MIAM_CORE_PDU_ALR, .val = &la_miam_core_v1v2_alr_parse }, + { .id = LA_MIAM_CORE_PDU_UNKNOWN, .val = NULL } +}; +static la_dict const la_miam_core_v2_pdu_parser_table[] = { + { .id = LA_MIAM_CORE_PDU_DATA, .val = &la_miam_core_v2_data_parse }, + { .id = LA_MIAM_CORE_PDU_ACK, .val = &la_miam_core_v2_ack_parse }, + { .id = LA_MIAM_CORE_PDU_ALO, .val = &la_miam_core_v1v2_alo_parse }, + { .id = LA_MIAM_CORE_PDU_ALR, .val = &la_miam_core_v1v2_alr_parse }, + { .id = LA_MIAM_CORE_PDU_UNKNOWN, .val = NULL } +}; + +static la_dict const la_miam_core_v1v2_alo_alr_compression_names[] = { + { .id = 0, .val = "deflate" }, + { .id = 0, .val = NULL } +}; + +static la_dict const la_miam_core_v1v2_alo_alr_network_names[] = { + { .id = 0, .val = "ACARS" }, + { .id = 1, .val = "IP Middleware" }, + { .id = 2, .val = "TCP/IP" }, + { .id = 3, .val = "Satcom Data 3" }, + { .id = 4, .val = "UDP" }, + { .id = 5, .val = NULL } +}; + +typedef struct { + uint8_t *buf; + int len; +} la_base85_decode_result; + +#ifdef WITH_ZLIB +typedef struct { + uint8_t *buf; + size_t buflen; + bool success; +} la_inflate_result; + +#define MAX_INFLATED_LEN (1<<20) + +static la_inflate_result la_inflate(uint8_t const *buf, int in_len) { + la_assert(buf != NULL); + la_assert(in_len > 0); + + z_stream stream; + memset(&stream, 0, sizeof(stream)); + la_inflate_result result; + memset(&result, 0, sizeof(result)); + + int ret = inflateInit2(&stream, -15); // raw deflate with max window size + if(ret != Z_OK) { + la_debug_print(D_ERROR, "inflateInit failed: %d\n", ret); + goto end; + } + stream.avail_in = (uInt)in_len; + stream.next_in = (uint8_t *)buf; + int chunk_len = 4 * in_len; + int out_len = chunk_len; // rough initial approximation + uint8_t *outbuf = LA_XCALLOC(out_len, sizeof(uint8_t)); + stream.next_out = outbuf; + stream.avail_out = out_len; + + while((ret = inflate(&stream, Z_FINISH)) == Z_BUF_ERROR) { + la_debug_print(D_INFO, "Z_BUF_ERROR, avail_in=%u avail_out=%u\n", stream.avail_in, stream.avail_out); + if(stream.avail_out == 0) { + // Not enough output space + int new_len = out_len + chunk_len; + la_debug_print(D_INFO, "outbuf grow: %d -> %d\n", out_len, new_len); + if(new_len > MAX_INFLATED_LEN) { + // Do not go overboard with memory usage + la_debug_print(D_ERROR, "new_len too large: %d > %d\n", new_len, MAX_INFLATED_LEN); + break; + } + outbuf = LA_XREALLOC(outbuf, new_len * sizeof(uint8_t)); + stream.next_out = outbuf + out_len; + stream.avail_out = chunk_len; + out_len = new_len; + } else if(stream.avail_in == 0) { + // Input stream is truncated - error out + break; + } + } + la_debug_print(D_INFO, "zlib ret=%d avail_out=%u total_out=%lu\n", ret, stream.avail_out, stream.total_out); + // Make sure the buffer is larger than the result. + // We need space to append NULL terminator later for printing it. + if(stream.avail_out == 0) { + outbuf = LA_XREALLOC(outbuf, (out_len + 1) * sizeof(uint8_t)); + } + result.buf = outbuf; + result.buflen = stream.total_out; + result.success = (ret == Z_STREAM_END ? true : false); +end: + (void)inflateEnd(&stream); + return result; +} +#endif + +static la_base85_decode_result la_base85_decode(char const *str, char const *end) { + static uint32_t const base85[] = { + 85 * 85 * 85 * 85, + 85 * 85 * 85, + 85 * 85, + 85, + 1 + }; + la_assert(str != NULL); + la_assert(str < end); + + // A rough approximation of the output buffer size needed. + // Five base85 digits encode a single 32-bit word + // Allow four extra words for potential 'z' occurrences + // (all-zero word encoded with a single character) + size_t outsize = ((end - str) / 5 + 4) * 4; + la_debug_print(D_INFO, "approx outsize: %zu\n", outsize); + uint8_t *out = LA_XCALLOC(outsize, sizeof(uint8_t)); + + char const *ptr = str; + size_t inpos = 0, outpos = 0; + union { + uint32_t val; + struct { +#ifdef IS_BIG_ENDIAN + uint8_t b3,b2,b1,b0; +#else + uint8_t b0,b1,b2,b3; +#endif + } b; + } v; + + while(end - ptr >= 5 || *ptr == 'z') { + v.val = 0; + if(*ptr == 'z') { + ptr++; + inpos++; + } else { + for(int i = 0; i < 5; i++, inpos++, ptr++) { + // shall we reject 'z' inside the 5-digit group? + v.val += (*ptr - 0x21) * base85[i]; + } + } + if(LA_UNLIKELY(outpos + 5 >= outsize)) { + // grow the buffer by 25 percent, but not less than 5 elements + outsize += 5; + outsize += outsize / 4; + la_debug_print(D_INFO, "outbuf too small; resizing to %zu elements\n", outsize); + out = LA_XREALLOC(out, outsize * sizeof(uint8_t)); + } + out[outpos++] = v.b.b3; + out[outpos++] = v.b.b2; + out[outpos++] = v.b.b1; + out[outpos++] = v.b.b0; + } + if(ptr != end) { + la_debug_print(D_ERROR, "Input truncated, %td bytes left\n", end - ptr); + } + return (la_base85_decode_result){ + .buf = out, + .len = outpos + }; +} + +static bool is_printable(uint8_t const *buf, uint32_t data_len) { + if(buf == NULL || data_len == 0) { + return false; + } + for(uint32_t i = 0; i < data_len; i++) { + if((buf[i] >= 7 && buf[i] <= 13) || + (buf[i] >= 32 && buf[i] <= 126)) { + // noop + } else { + la_debug_print(D_VERBOSE, "false due to character %u at position %u\n", buf[i], i); + return false; + } + } + la_debug_print(D_VERBOSE, "true\n"); + return true; +} + +// MIAM CORE v1/v2 common parsers + +static la_proto_node *v1v2_alo_alr_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, + int bodylen, la_miam_core_pdu_type pdu_type) { + LA_UNUSED(bodybuf); + LA_UNUSED(bodylen); + + la_assert(hdrbuf != NULL); + la_assert(pdu_type == LA_MIAM_CORE_PDU_ALO || pdu_type == LA_MIAM_CORE_PDU_ALR); + + LA_NEW(la_miam_core_v1v2_alo_alr_pdu, pdu); + la_proto_node *node = la_proto_node_new(); + if(pdu_type == LA_MIAM_CORE_PDU_ALO) { + node->td = &la_DEF_miam_core_v1v2_alo_pdu; + } else if(pdu_type == LA_MIAM_CORE_PDU_ALR) { + node->td = &la_DEF_miam_core_v1v2_alr_pdu; + } + node->data = pdu; + node->next = NULL; + + if(hdrlen < 13) { // should be 16, but let's not be overly pedantic on unused octets + la_debug_print(D_ERROR, "Header too short: %d < 16\n", hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + + pdu->pdu_len = (hdrbuf[1] << 16) | (hdrbuf[2] << 8) | hdrbuf[3]; + hdrbuf += 4; hdrlen -= 4; + + memcpy(&pdu->aircraft_id, hdrbuf, 7); + pdu->aircraft_id[7] = '\0'; + la_debug_print(D_INFO, "len: %u aircraft_id: %s\n", pdu->pdu_len, pdu->aircraft_id); + hdrbuf += 7; hdrlen -= 7; + + pdu->compression = hdrbuf[0]; + pdu->networks = hdrbuf[1]; + la_debug_print(D_INFO, "compression: 0x%02x networks: 0x%02x\n", + pdu->compression, pdu->networks); +end: + return node; +} + +static la_proto_node *la_miam_core_v1v2_alo_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen) { + return v1v2_alo_alr_parse(hdrbuf, hdrlen, bodybuf, bodylen, LA_MIAM_CORE_PDU_ALO); +} + +static la_proto_node *la_miam_core_v1v2_alr_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen) { + return v1v2_alo_alr_parse(hdrbuf, hdrlen, bodybuf, bodylen, LA_MIAM_CORE_PDU_ALR); +} + +la_proto_node *la_miam_core_pdu_parse(char const *txt) { + la_assert(txt != NULL); + + // Determine if it's a MIAM CORE PDU - check body/header padding counts and look for header/body delimiter + if(strlen(txt) < 3) { + return NULL; + } + la_miam_core_pdu *pdu = NULL; + + char bpad = txt[0]; // valid values: 0, 1, 2, 3, -, . + char hpad = txt[1]; // valid values: 0, 1, 2, 3 + txt += 2; + if(!((bpad >= '0' && bpad <= '3') || bpad == '-' || bpad == '.')) { + la_debug_print(D_INFO, "Invalid body padding: %c\n", bpad); + return NULL; + } + if(!(hpad >= '0' && hpad <= '3')) { + la_debug_print(D_INFO, "Invalid header padding: %c\n", hpad); + return NULL; + } + hpad -= 0x30; // get digit value: '1' -> 1 + char *delim = strchr(txt, '|'); + if(delim == NULL) { + la_debug_print(D_ERROR, "Header/body delimiter not found\n"); + return NULL; + } + if(delim == txt) { + la_debug_print(D_ERROR, "Empty header\n"); + return NULL; + } + // Assume the initial part is the Header - try to decode it + la_base85_decode_result header = la_base85_decode(txt, delim); + if(header.buf == NULL || header.len < hpad) { // BASE85 decoder failed or result too short + return NULL; + } + la_debug_print_buf_hex(D_VERBOSE, header.buf, header.len, "Decoded header:\n"); + + // Decode message body, if exists and if it's encoded + uint8_t *bodybuf = NULL; + int bodylen = 0; + la_base85_decode_result body = { .buf = NULL, .len = 0 }; + if(delim[1] != '\0') { + if(bpad >= '0' && bpad <= '3') { + char *end = strchr(delim, '\0'); + body = la_base85_decode(delim + 1, end); + bpad -= 0x30; // get digit value: '1' -> 1 + if(body.buf != NULL && body.len >= bpad) { + body.len -= bpad; // cut off padding bytes + } + bodybuf = body.buf; + bodylen = body.len; + } else if(bpad == '-') { + // Payload not encoded - just point at the start of it + bodybuf = (uint8_t *)delim + 1; + bodylen = strlen(delim + 1); + } + } + + // From now on we assume that this is a MIAM frame and we return a non-NULL PDU with an + // error code if something goes wrong, so that a proper error message is printed to the output. + uint8_t *b = header.buf; + header.len -= hpad; // cut off padding bytes + + uint8_t version = b[0] & 0xf; + uint8_t pdu_type = (b[0] >> 4) & 0xf; + la_debug_print(D_INFO, "ver: %u pdu_type: %u\n", version, pdu_type); + + pdu = LA_XCALLOC(1, sizeof(la_miam_core_pdu)); + pdu->pdu_type = LA_MIAM_CORE_PDU_UNKNOWN; + pdu->version = version; + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_core_pdu; + node->data = pdu; + node->next = NULL; + + la_dict const *pdu_parse_dict = NULL; + if(version == 1) { + pdu_parse_dict = la_miam_core_v1_pdu_parser_table; + } else if(version == 2) { + pdu_parse_dict = la_miam_core_v2_pdu_parser_table; + } else { + la_debug_print(D_ERROR, "Unknown version %u\n", version); + pdu->err |= LA_MIAM_ERR_HDR_PDU_VERSION_UNKNOWN; + goto end; + } + + la_miam_core_pdu_parse_f *pdu_parse = la_dict_search(pdu_parse_dict, pdu_type); + if(pdu_parse == NULL) { + la_debug_print(D_ERROR, "No parser for PDU type %u\n", pdu_type); + pdu->err |= LA_MIAM_ERR_HDR_PDU_TYPE_UNKNOWN; + goto end; + } + + pdu->pdu_type = pdu_type; + node->next = pdu_parse(header.buf, header.len, bodybuf, bodylen); + +end: + LA_XFREE(header.buf); + LA_XFREE(body.buf); + return node; +} + +// MIAM CORE v1/v2 common formatters + +static void la_miam_errors_format_text(la_vstring *vstr, uint32_t err, int indent) { + static la_dict const la_miam_error_messages[] = { + { .id = LA_MIAM_ERR_SUCCESS, .val = "No error" }, + { .id = LA_MIAM_ERR_HDR_PDU_TYPE_UNKNOWN, .val = "Unknown PDU type" }, + { .id = LA_MIAM_ERR_HDR_PDU_VERSION_UNKNOWN, .val = "Unsupported MIAM version" }, + { .id = LA_MIAM_ERR_HDR_TRUNCATED, .val = "Header truncated" }, + { .id = LA_MIAM_ERR_HDR_APP_TYPE_UNKNOWN, .val = "Unknown application type" }, + { .id = LA_MIAM_ERR_BODY_TRUNCATED, .val = "Message truncated" }, + { .id = LA_MIAM_ERR_BODY_INFLATE_FAILED, .val = "Decompression failed" }, + { .id = LA_MIAM_ERR_BODY_COMPR_UNSUPPORTED, .val = "Unsupported compression algorithm" }, + { .id = LA_MIAM_ERR_BODY_CRC_FAILED, .val = "CRC check failed" }, + { .id = 0, .val = NULL } + }; + la_assert(vstr != NULL); + la_assert(indent >= 0); + for(uint32_t i = 0; i < 32; i++) { + if((err & (1 << i)) != 0) { + char *errmsg = la_dict_search(la_miam_error_messages, (int)(err & (1 << i))); + if(errmsg != NULL) { + LA_ISPRINTF(vstr, indent, "-- %s\n", errmsg); + } else { + LA_ISPRINTF(vstr, indent, "-- Unknown error (%u)\n", err); + } + } + } +} + +static void la_miam_errors_format_json(la_vstring *vstr, uint32_t err) { + la_assert(vstr != NULL); + la_json_append_int64(vstr, "err", err); +} + +static void la_miam_bitmask_format_text(la_vstring *vstr, uint8_t bitmask, + la_dict const *dict, int indent) { + la_assert(vstr != NULL); + la_assert(dict != NULL); + la_assert(indent >= 0); + + for(int i = 0; i < 8; i++) { + if((bitmask & (1 << i)) != 0) { + char *name = la_dict_search(dict, i); + if(name != NULL) { + LA_ISPRINTF(vstr, indent, "%s\n", name); + } else { + LA_ISPRINTF(vstr, indent, "unknown (%u)\n", 1 << i); + } + } + } +} + +static void la_miam_bitmask_format_json(la_vstring *vstr, uint8_t bitmask, + la_dict const *dict) { + la_assert(vstr != NULL); + la_assert(dict != NULL); + + for(int i = 0; i < 8; i++) { + if((bitmask & (1 << i)) != 0) { + char *name = la_dict_search(dict, i); + if(name != NULL) { + la_json_append_string(vstr, NULL, name); + } else { + la_json_append_int64(vstr, NULL, 1 << i); + } + } + } +} + +static void v1v2_alo_alr_format_text(la_vstring *vstr, void const *data, int indent, + la_miam_core_pdu_type pdu_type) { + la_assert(vstr != NULL); + la_assert(data != NULL); + la_assert(indent >= 0); + + if(pdu_type != LA_MIAM_CORE_PDU_ALO && pdu_type != LA_MIAM_CORE_PDU_ALR) { + return; + } + + la_miam_core_v1v2_alo_alr_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_HDR, indent); + return; + } + LA_ISPRINTF(vstr, indent, "PDU Length: %u\n", pdu->pdu_len); + LA_ISPRINTF(vstr, indent, "Aircraft ID: %s\n", pdu->aircraft_id); + LA_ISPRINTF(vstr, indent, "Compressions %s:\n", + (pdu_type == LA_MIAM_CORE_PDU_ALO ? "supported" : "selected")); + la_miam_bitmask_format_text(vstr, pdu->compression, + la_miam_core_v1v2_alo_alr_compression_names, indent + 1); + LA_ISPRINTF(vstr, indent, "Networks supported:\n"); + la_miam_bitmask_format_text(vstr, pdu->networks, + la_miam_core_v1v2_alo_alr_network_names, indent + 1); + // Not checking for body errors here, as there is no body in ALO and ALR PDUs +} + +static void v1v2_alo_alr_format_json(la_vstring *vstr, void const *data, + la_miam_core_pdu_type pdu_type) { + la_assert(vstr != NULL); + la_assert(data != NULL); + + if(pdu_type != LA_MIAM_CORE_PDU_ALO && pdu_type != LA_MIAM_CORE_PDU_ALR) { + return; + } + + la_miam_core_v1v2_alo_alr_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_HDR); + return; + } + la_json_append_int64(vstr, "pdu_len", pdu->pdu_len); + la_json_append_string(vstr, "aircraft_id", pdu->aircraft_id); + la_json_array_start(vstr, + pdu_type == LA_MIAM_CORE_PDU_ALO ? "comp_supported" : "comp_selected"); + la_miam_bitmask_format_json(vstr, pdu->compression, + la_miam_core_v1v2_alo_alr_compression_names); + la_json_array_end(vstr); + la_json_array_start(vstr, "networks_supported"); + la_miam_bitmask_format_json(vstr, pdu->networks, + la_miam_core_v1v2_alo_alr_network_names); + la_json_array_end(vstr); +} + +static void la_miam_core_v1v2_alo_format_text(la_vstring *vstr, void const *data, int indent) { + v1v2_alo_alr_format_text(vstr, data, indent, LA_MIAM_CORE_PDU_ALO); +} + +static void la_miam_core_v1v2_alo_format_json(la_vstring *vstr, void const *data) { + v1v2_alo_alr_format_json(vstr, data, LA_MIAM_CORE_PDU_ALO); +} + +static void la_miam_core_v1v2_alr_format_text(la_vstring *vstr, void const *data, int indent) { + v1v2_alo_alr_format_text(vstr, data, indent, LA_MIAM_CORE_PDU_ALR); +} + +static void la_miam_core_v1v2_alr_format_json(la_vstring *vstr, void const *data) { + v1v2_alo_alr_format_json(vstr, data, LA_MIAM_CORE_PDU_ALR); +} + +void la_miam_core_format_text(la_vstring *vstr, void const *data, int indent) { + static char const *la_miam_core_pdu_type_names[] = { + [LA_MIAM_CORE_PDU_DATA] = "Data", + [LA_MIAM_CORE_PDU_ACK] = "Ack", + [LA_MIAM_CORE_PDU_ALO] = "Aloha", + [LA_MIAM_CORE_PDU_ALR] = "Aloha Reply", + [LA_MIAM_CORE_PDU_UNKNOWN] = "unknown PDU" + }; + + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_core_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_HDR, indent); + return; + } + la_assert(pdu->pdu_type <= LA_MIAM_CORE_PDU_TYPE_MAX); + LA_ISPRINTF(vstr, indent, "MIAM CORE %s, version %u:\n", + la_miam_core_pdu_type_names[pdu->pdu_type], pdu->version); + indent++; +} + +void la_miam_core_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_core_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_HDR); + return; + } + la_json_append_int64(vstr, "version", pdu->version); + la_json_append_int64(vstr, "pdu_type", pdu->pdu_type); +} + +// MIAM CORE v1/v2 common type descriptors + +la_type_descriptor const la_DEF_miam_core_pdu = { + .format_text = la_miam_core_format_text, + .format_json = la_miam_core_format_json, + .json_key = "miam_core", + .destroy = NULL +}; +la_type_descriptor const la_DEF_miam_core_v1v2_alo_pdu = { + .format_text = la_miam_core_v1v2_alo_format_text, + .format_json = la_miam_core_v1v2_alo_format_json, + .json_key = "aloha", + .destroy = NULL +}; +la_type_descriptor const la_DEF_miam_core_v1v2_alr_pdu = { + .format_text = la_miam_core_v1v2_alr_format_text, + .format_json = la_miam_core_v1v2_alr_format_json, + .json_key = "aloha_reply", + .destroy = NULL +}; + +la_proto_node *la_proto_tree_find_miam_core(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_miam_core_pdu); +} + +/********************************************** + * MIAM CORE version 1 definitions and routines + **********************************************/ + +#define LA_MIAM_CORE_V1_CRC_LEN 4 + +#define LA_MIAM_CORE_V1_COMP_NONE 0x0 +#define LA_MIAM_CORE_V1_COMP_DEFLATE 0x1 + +#define LA_MIAM_CORE_V1_ENC_ISO5 0x0 +#define LA_MIAM_CORE_V1_ENC_BINARY 0x1 + +#define LA_MIAM_CORE_V1_APP_ACARS_2CHAR 0x0 +#define LA_MIAM_CORE_V1_APP_ACARS_4CHAR 0x1 +#define LA_MIAM_CORE_V1_APP_ACARS_6CHAR 0x2 +#define LA_MIAM_CORE_V1_APP_NONACARS_6CHAR 0x3 + +// MIAM Core v1-specific parsers + +static la_proto_node *la_miam_core_v1_data_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen) { + la_assert(hdrbuf != NULL); + + LA_NEW(la_miam_core_v1_data_pdu, pdu); + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_core_v1_data_pdu; + node->data = pdu; + node->next = NULL; + + if(hdrlen < 20) { + la_debug_print(D_ERROR, "Header too short: %d < 20\n", hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + + pdu->pdu_len = (hdrbuf[1] << 16) | (hdrbuf[2] << 8) | hdrbuf[3]; + if(pdu->pdu_len > (uint32_t)(hdrlen + bodylen)) { + la_debug_print(D_ERROR, "PDU truncated: length from header: %d > pdu_len %d (%d+%d)\n", + pdu->pdu_len, hdrlen + bodylen, hdrlen, bodylen); + pdu->err |= LA_MIAM_ERR_BODY_TRUNCATED; + } + hdrbuf += 4; hdrlen -= 4; + + memcpy(&pdu->aircraft_id, hdrbuf, 7); + pdu->aircraft_id[7] = '\0'; + la_debug_print(D_INFO, "len: %u aircraft_id: %s\n", pdu->pdu_len, pdu->aircraft_id); + hdrbuf += 7; hdrlen -= 7; + + uint8_t bytes_needed = 0; + pdu->msg_num = (hdrbuf[0] >> 1) & 0x7f; + pdu->ack_option = hdrbuf[0] & 0x1; + la_debug_print(D_INFO, "msg_num: %u ack_option: %u\n", pdu->msg_num, pdu->ack_option); + hdrbuf++; hdrlen--; + + pdu->compression = ((hdrbuf[0] << 2) | ((hdrbuf[1] >> 6) & 0x3)) & 0x7; + pdu->encoding = (hdrbuf[1] >> 4) & 0x3; + pdu->app_type = hdrbuf[1] & 0xf; + la_debug_print(D_INFO, "compression: 0x%x encoding: 0x%x app_type: 0x%x\n", + pdu->compression, pdu->encoding, pdu->app_type); + hdrbuf += 2; hdrlen -= 2; + + uint8_t app_id_len = 0; + if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_2CHAR) { + app_id_len = 2; + } else if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_4CHAR) { + app_id_len = 4; + } else if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_6CHAR || + pdu->app_type == LA_MIAM_CORE_V1_APP_NONACARS_6CHAR) { + app_id_len = 6; + } else { + la_debug_print(D_ERROR, "Unknown app type 0x%u\n", pdu->app_type); + pdu->err |= LA_MIAM_ERR_HDR_APP_TYPE_UNKNOWN; + goto end; + } + bytes_needed = app_id_len + LA_MIAM_CORE_V1_CRC_LEN; + if(hdrlen < bytes_needed) { + la_debug_print(D_ERROR, "Header too short for app_type 0x%x: " + "need %u more bytes but only %u available\n", + pdu->app_type, bytes_needed, hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + memcpy(pdu->app_id, hdrbuf, app_id_len); + pdu->app_id[6] = '\0'; + la_debug_print(D_INFO, "app_id: '%s'\n", pdu->app_id); + hdrbuf += app_id_len; hdrlen -= app_id_len; + + pdu->crc = (hdrbuf[0] << 24) | (hdrbuf[1] << 16) | (hdrbuf[2] << 8) | hdrbuf[3]; + hdrbuf += LA_MIAM_CORE_V1_CRC_LEN; hdrlen -= LA_MIAM_CORE_V1_CRC_LEN; + if(hdrlen > 0) { + la_debug_print(D_ERROR, "Warning: %u bytes left after MIAM header\n", hdrlen); + } + if(bodybuf != NULL && bodylen > 0) { +#ifdef WITH_ZLIB + if(pdu->compression == LA_MIAM_CORE_V1_COMP_DEFLATE) { + la_inflate_result inflated = la_inflate(bodybuf, bodylen); + la_debug_print_buf_hex(D_VERBOSE, inflated.buf, (int)inflated.buflen, + "Decompressed content:\n"); + // If it's text, it needs a NULL terminator. + // If it's not text, it doesn't hurt either. The buffer is larger than len anyway. + inflated.buf[inflated.buflen] = '\0'; + pdu->data = inflated.buf; + pdu->data_len = inflated.buflen; + if(inflated.success == false) { + pdu->err |= LA_MIAM_ERR_BODY_INFLATE_FAILED; + } + } else +#endif + if(pdu->compression == LA_MIAM_CORE_V1_COMP_NONE) { + uint8_t *pdu_data = LA_XCALLOC(bodylen + 1, sizeof(uint8_t)); + memcpy(pdu_data, bodybuf, bodylen); + pdu_data[bodylen] = '\0'; + pdu->data = pdu_data; + pdu->data_len = bodylen; + } else { + pdu->err |= LA_MIAM_ERR_BODY_COMPR_UNSUPPORTED; + } + uint32_t crc_check = la_crc32_arinc665(pdu->data, pdu->data_len, 0xFFFFFFFFu); + crc_check = ~crc_check; + la_debug_print(D_INFO, "crc: %08x crc_check: %08x\n", pdu->crc, crc_check); + if(crc_check != pdu->crc) { + pdu->err |= LA_MIAM_ERR_BODY_CRC_FAILED; + } + } +end: + return node; +} + +static la_proto_node *la_miam_core_v1_ack_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen) { + la_assert(hdrbuf != NULL); + LA_UNUSED(bodybuf); + LA_UNUSED(bodylen); + + LA_NEW(la_miam_core_v1_ack_pdu, pdu); + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_core_v1_ack_pdu; + node->data = pdu; + node->next = NULL; + + if(hdrlen < 20) { + la_debug_print(D_ERROR, "Header too short: %d < 20\n", hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + + pdu->pdu_len = (hdrbuf[1] << 16) | (hdrbuf[2] << 8) | hdrbuf[3]; + hdrbuf += 4; hdrlen -=4; + + memcpy(&pdu->aircraft_id, hdrbuf, 7); + pdu->aircraft_id[7] = '\0'; + la_debug_print(D_INFO, "len: %u aircraft_id: %s\n", pdu->pdu_len, pdu->aircraft_id); + hdrbuf += 7; hdrlen -= 7; + + pdu->msg_ack_num = (hdrbuf[0] >> 1) & 0x7f; + hdrbuf++; hdrlen--; + + pdu->ack_xfer_result = (hdrbuf[0] >> 4) & 0xf; + la_debug_print(D_INFO, "msg_ack_num: %u ack_xfer_result: 0x%x\n", pdu->msg_ack_num, pdu->ack_xfer_result); + hdrbuf += 4; hdrlen -= 4; + + memcpy(pdu->crc, hdrbuf, LA_MIAM_CORE_V1_CRC_LEN); + hdrbuf += LA_MIAM_CORE_V1_CRC_LEN; hdrlen -= LA_MIAM_CORE_V1_CRC_LEN; + if(hdrlen > 0) { + la_debug_print(D_ERROR, "Warning: %u bytes left after MIAM header\n", hdrlen); + } +end: + return node; +} + +// MIAM Core v1-specific formatters + +static void la_miam_core_v1_data_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr != NULL); + la_assert(data != NULL); + la_assert(indent >= 0); + + static la_dict const v1_compression_names[] = { + { .id = LA_MIAM_CORE_V1_COMP_NONE, .val = "none" }, + { .id = LA_MIAM_CORE_V1_COMP_DEFLATE, .val = "deflate" }, + { .id = 0x0, .val = NULL } + }; + + static la_dict const v1_encoding_names[] = { + { .id = LA_MIAM_CORE_V1_ENC_ISO5, .val = "ISO #5" }, + { .id = LA_MIAM_CORE_V1_ENC_BINARY, .val = "binary" }, + { .id = 0x0, .val = NULL } + }; + + la_miam_core_v1_data_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_HDR, indent); + return; + } + LA_ISPRINTF(vstr, indent, "PDU Length: %u\n", pdu->pdu_len); + LA_ISPRINTF(vstr, indent, "Aircraft ID: %s\n", pdu->aircraft_id); + LA_ISPRINTF(vstr, indent, "Msg num: %u\n", pdu->msg_num); + LA_ISPRINTF(vstr, indent, "ACK: %srequired\n", + (pdu->ack_option == 1 ? "" : "not ")); + + char *name = la_dict_search(v1_compression_names, pdu->compression); + if(name != NULL) { + LA_ISPRINTF(vstr, indent, "Compression: %s\n", name); + } else { + LA_ISPRINTF(vstr, indent, "Compression: unknown (%u)\n", pdu->compression); + } + + name = la_dict_search(v1_encoding_names, pdu->encoding); + if(name != NULL) { + LA_ISPRINTF(vstr, indent, "Encoding: %s\n", name); + } else { + LA_ISPRINTF(vstr, indent, "Encoding: unknown (%u)\n", pdu->encoding); + } + + switch(pdu->app_type) { + case LA_MIAM_CORE_V1_APP_ACARS_2CHAR: + case LA_MIAM_CORE_V1_APP_ACARS_4CHAR: + case LA_MIAM_CORE_V1_APP_ACARS_6CHAR: + LA_ISPRINTF(vstr, indent, "ACARS:\n"); + indent++; + LA_ISPRINTF(vstr, indent, "Label: %c%c", + pdu->app_id[0], pdu->app_id[1]); + + if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_4CHAR || + pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_6CHAR) { + la_vstring_append_sprintf(vstr, " Sublabel: %c%c", + pdu->app_id[2], pdu->app_id[3]); + } + + if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_6CHAR) { + la_vstring_append_sprintf(vstr, " MFI: %c%c", + pdu->app_id[4], pdu->app_id[5]); + } + + la_vstring_append_sprintf(vstr, "%s", "\n"); + + break; + case LA_MIAM_CORE_V1_APP_NONACARS_6CHAR: + LA_ISPRINTF(vstr, indent, "Non-ACARS payload:\n"); + indent++; + LA_ISPRINTF(vstr, indent, "Application ID: %s\n", pdu->app_id); + break; + default: + break; + } + + if(pdu->data != NULL) { + // Don't trust pdu->encoding - if the payload is printable, then print it as text. + // Otherwise print a hexdump. + if(is_printable(pdu->data, pdu->data_len)) { + // Parser has appended '\0' at the end, so it's safe to print it directly + bool prettify_xml = false; +#ifdef WITH_LIBXML2 + (void)la_config_get_bool("prettify_xml", &prettify_xml); + if(prettify_xml == true) { + xmlBufferPtr xmlbufptr = NULL; + if((xmlbufptr = la_prettify_xml((char *)pdu->data)) != NULL) { + LA_ISPRINTF(vstr, indent, "Message (reformatted):\n"); + la_isprintf_multiline_text(vstr, indent + 1, (char *)xmlbufptr->content); + xmlBufferFree(xmlbufptr); + } else { + // Doesn't look like XML - print it as normal + prettify_xml = false; + } + } +#endif + if(prettify_xml == false) { + LA_ISPRINTF(vstr, indent, "Message:\n"); + la_isprintf_multiline_text(vstr, indent + 1, (char *)pdu->data); + } + } else { + char *hexdump = la_hexdump((uint8_t *)pdu->data, pdu->data_len); + LA_ISPRINTF(vstr, indent, "Message:\n"); + la_isprintf_multiline_text(vstr, indent + 1, hexdump); + LA_XFREE(hexdump); + } + } + + if(pdu->err & LA_MIAM_ERR_BODY) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_BODY, indent + 1); + return; + } +} + +static void la_miam_core_v1_data_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr != NULL); + la_assert(data != NULL); + + la_miam_core_v1_data_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_HDR); + return; + } + la_json_append_int64(vstr, "pdu_len", pdu->pdu_len); + la_json_append_string(vstr, "aircraft_id", pdu->aircraft_id); + la_json_append_int64(vstr, "msg_num", pdu->msg_num); + la_json_append_bool(vstr, "ack_required", pdu->ack_option == 1 ? true : false); + la_json_append_int64(vstr, "compression", pdu->compression); + la_json_append_int64(vstr, "encoding", pdu->encoding); + la_json_append_int64(vstr, "app_type", pdu->app_type); + + switch(pdu->app_type) { + case LA_MIAM_CORE_V1_APP_ACARS_2CHAR: + case LA_MIAM_CORE_V1_APP_ACARS_4CHAR: + case LA_MIAM_CORE_V1_APP_ACARS_6CHAR: + la_json_object_start(vstr, "acars"); + la_json_append_string(vstr, "label", + (char const *)(&((char[]){pdu->app_id[0], pdu->app_id[1], '\0'}))); + if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_4CHAR || + pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_6CHAR) { + la_json_append_string(vstr, "sublabel", + (char const *)(&((char[]){pdu->app_id[2], pdu->app_id[3], '\0'}))); + + } + if(pdu->app_type == LA_MIAM_CORE_V1_APP_ACARS_6CHAR) { + la_json_append_string(vstr, "mfi", + (char const *)(&((char[]){pdu->app_id[4], pdu->app_id[5], '\0'}))); + } + break; + case LA_MIAM_CORE_V1_APP_NONACARS_6CHAR: + la_json_object_start(vstr, "non_acars"); + la_json_append_string(vstr, "app_id", pdu->app_id); + break; + default: + la_json_object_start(vstr, "unknown_payload_type"); + break; + } + la_json_object_start(vstr, "message"); + if(pdu->data != NULL) { + if(is_printable(pdu->data, pdu->data_len)) { + la_json_append_string(vstr, "text", (char *)pdu->data); + } else { + la_json_append_octet_string(vstr, "octet_string", + (uint8_t *)pdu->data, pdu->data_len); + } + } + if(pdu->err & LA_MIAM_ERR_BODY) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_BODY); + } + la_json_object_end(vstr); // message + la_json_object_end(vstr); // acars / non_acars / unknown_payload_type +} + +static void la_miam_core_v1_ack_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr != NULL); + la_assert(data != NULL); + la_assert(indent >= 0); + + static la_dict const v1_ack_xfer_result_names[] = { + { .id = 0x0, .val = "ack" }, + { .id = 0x1, .val = "nack" }, + { .id = 0x2, .val = "time_expiry" }, + { .id = 0x3, .val = "peer_abort" }, + { .id = 0x4, .val = "local_abort" }, + { .id = 0x0, .val = NULL } + }; + + la_miam_core_v1_ack_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_HDR, indent); + return; + } + LA_ISPRINTF(vstr, indent, "PDU Length: %u\n", pdu->pdu_len); + LA_ISPRINTF(vstr, indent, "Aircraft ID: %s\n", pdu->aircraft_id); + LA_ISPRINTF(vstr, indent, "Msg ACK num: %u\n", pdu->msg_ack_num); + char *xfer_result_name = la_dict_search(v1_ack_xfer_result_names, pdu->ack_xfer_result); + if(xfer_result_name != NULL) { + LA_ISPRINTF(vstr, indent, "Transfer result: %s\n", xfer_result_name); + } else { + LA_ISPRINTF(vstr, indent, "Transfer result: unknown (%u)\n", pdu->ack_xfer_result); + } + // Not checking for body errors here, as there is no body in an ack PDU +} + +static void la_miam_core_v1_ack_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr != NULL); + la_assert(data != NULL); + + la_miam_core_v1_ack_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_HDR); + return; + } + la_json_append_int64(vstr, "pdu_len", pdu->pdu_len); + la_json_append_string(vstr, "aircraft_id", pdu->aircraft_id); + la_json_append_int64(vstr, "msg_ack_num", pdu->msg_ack_num); + la_json_append_int64(vstr, "ack_xfer_result", pdu->ack_xfer_result); +} + +// MIAM Core v1-specific destructors + +static void la_miam_core_v1_data_destroy(void *data) { + if(data == NULL) { + return; + } + la_miam_core_v1_data_pdu *pdu = data; + LA_XFREE(pdu->data); + LA_XFREE(pdu); +} + +// MIAM Core v1-specific type descriptors + +la_type_descriptor const la_DEF_miam_core_v1_data_pdu = { + .format_text = la_miam_core_v1_data_format_text, + .format_json = la_miam_core_v1_data_format_json, + .json_key = "data", + .destroy = la_miam_core_v1_data_destroy +}; +la_type_descriptor const la_DEF_miam_core_v1_ack_pdu = { + .format_text = la_miam_core_v1_ack_format_text, + .format_json = la_miam_core_v1_ack_format_json, + .json_key = "ack", + .destroy = NULL +}; + +/********************************************** + * MIAM CORE version 2 definitions and routines + **********************************************/ + +#define LA_MIAM_CORE_V2_CRC_LEN 2 + +#define LA_MIAM_CORE_V2_COMP_NONE 0x0 +#define LA_MIAM_CORE_V2_COMP_DEFLATE 0x1 + +#define LA_MIAM_CORE_V2_ENC_ISO5 0x0 +#define LA_MIAM_CORE_V2_ENC_BINARY 0x1 + +#define LA_MIAM_CORE_V2_APP_ACARS_2CHAR 0x0 +#define LA_MIAM_CORE_V2_APP_ACARS_4CHAR 0x1 +#define LA_MIAM_CORE_V2_APP_ACARS_6CHAR 0x2 +#define LA_MIAM_CORE_V2_APP_NONACARS_6CHAR 0x3 +// No need to have these macros for other non-ACARS V2-specific app types, +// as the app ID length can be derived from the value of the app type field. + +// MIAM CORE v2-specific parsers + +static la_proto_node *la_miam_core_v2_data_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen) { + la_assert(hdrbuf != NULL); + + LA_NEW(la_miam_core_v2_data_pdu, pdu); + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_core_v2_data_pdu; + node->data = pdu; + node->next = NULL; + + if(hdrlen < 7) { + la_debug_print(D_ERROR, "Header too short: %d < 7\n", hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + hdrbuf++; hdrlen--; + + uint8_t bytes_needed = 0; + pdu->msg_num = (hdrbuf[0] >> 1) & 0x7f; + pdu->ack_option = hdrbuf[0] & 0x1; + la_debug_print(D_INFO, "msg_num: %u ack_option: %u\n", pdu->msg_num, pdu->ack_option); + hdrbuf++; hdrlen--; + + pdu->compression = ((hdrbuf[0] << 2) | ((hdrbuf[1] >> 6) & 0x3)) & 0x7; + pdu->encoding = (hdrbuf[1] >> 4) & 0x3; + pdu->app_type = hdrbuf[1] & 0xf; + la_debug_print(D_INFO, "compression: 0x%x encoding: 0x%x app_type: 0x%x\n", + pdu->compression, pdu->encoding, pdu->app_type); + hdrbuf += 2; hdrlen -= 2; + + uint8_t app_id_len = 0; + if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_2CHAR) { + app_id_len = 2; + } else if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_4CHAR) { + app_id_len = 4; + } else if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_6CHAR || + pdu->app_type == LA_MIAM_CORE_V2_APP_NONACARS_6CHAR) { + app_id_len = 6; + } else if((pdu->app_type & 0x8) != 0 && pdu->app_type != 0xd /* reserved value */) { + app_id_len = (pdu->app_type & 0x7) + 1; + } else { + la_debug_print(D_ERROR, "Unknown app type 0x%u\n", pdu->app_type); + pdu->err |= LA_MIAM_ERR_HDR_APP_TYPE_UNKNOWN; + goto end; + } + bytes_needed = app_id_len + LA_MIAM_CORE_V2_CRC_LEN; + if(hdrlen < bytes_needed) { + la_debug_print(D_ERROR, "Header too short for app_type 0x%x: " + "need %u more bytes but only %u available\n", + pdu->app_type, bytes_needed, hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + memcpy(pdu->app_id, hdrbuf, app_id_len); + pdu->app_id[6] = '\0'; + la_debug_print(D_INFO, "app_id: '%s'\n", pdu->app_id); + hdrbuf += app_id_len; hdrlen -= app_id_len; + + pdu->crc = (hdrbuf[0] << 8) | hdrbuf[1]; + hdrbuf += LA_MIAM_CORE_V2_CRC_LEN; hdrlen -= LA_MIAM_CORE_V2_CRC_LEN; + if(hdrlen > 0) { + la_debug_print(D_ERROR, "Warning: %u bytes left after MIAM header\n", hdrlen); + } + if(bodybuf != NULL && bodylen > 0) { +#ifdef WITH_ZLIB + if(pdu->compression == LA_MIAM_CORE_V2_COMP_DEFLATE) { + la_inflate_result inflated = la_inflate(bodybuf, bodylen); + la_debug_print_buf_hex(D_VERBOSE, inflated.buf, (int)inflated.buflen, + "Decompressed content:\n"); + // If it's text, it needs a NULL terminator. + // If it's not text, it doesn't hurt either. The buffer is larger than len anyway. + inflated.buf[inflated.buflen] = '\0'; + pdu->data = inflated.buf; + pdu->data_len = inflated.buflen; + if(inflated.success == false) { + pdu->err |= LA_MIAM_ERR_BODY_INFLATE_FAILED; + } + } else +#endif + if(pdu->compression == LA_MIAM_CORE_V2_COMP_NONE) { + uint8_t *pdu_data = LA_XCALLOC(bodylen + 1, sizeof(uint8_t)); + memcpy(pdu_data, bodybuf, bodylen); + pdu_data[bodylen] = '\0'; + pdu->data = pdu_data; + pdu->data_len = bodylen; + } else { + pdu->err |= LA_MIAM_ERR_BODY_COMPR_UNSUPPORTED; + } + uint16_t crc_check = la_crc16_arinc(pdu->data, pdu->data_len, 0xFFFFu); + la_debug_print(D_INFO, "crc: %04x crc_check: %04x\n", pdu->crc, crc_check); + if(crc_check != pdu->crc) { + pdu->err |= LA_MIAM_ERR_BODY_CRC_FAILED; + } + } +end: + return node; +} + +static la_proto_node *la_miam_core_v2_ack_parse(uint8_t const *hdrbuf, int hdrlen, uint8_t const *bodybuf, int bodylen) { + la_assert(hdrbuf != NULL); + LA_UNUSED(bodybuf); + LA_UNUSED(bodylen); + + LA_NEW(la_miam_core_v2_ack_pdu, pdu); + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_core_v2_ack_pdu; + node->data = pdu; + node->next = NULL; + + if(hdrlen < 8) { + la_debug_print(D_ERROR, "Header too short: %d < 8\n", hdrlen); + pdu->err |= LA_MIAM_ERR_HDR_TRUNCATED; + goto end; + } + + hdrbuf++; hdrlen--; + + pdu->msg_ack_num = (hdrbuf[0] >> 1) & 0x7f; + pdu->ack_xfer_result = ((hdrbuf[0] << 3) | (hdrbuf[1] >> 5)) & 0xf; + la_debug_print(D_INFO, "msg_ack_num: %u ack_xfer_result: 0x%x\n", pdu->msg_ack_num, pdu->ack_xfer_result); + hdrbuf += 3; hdrlen -= 3; + + memcpy(pdu->crc, hdrbuf, LA_MIAM_CORE_V2_CRC_LEN); + hdrbuf += LA_MIAM_CORE_V2_CRC_LEN; hdrlen -= LA_MIAM_CORE_V2_CRC_LEN; + + hdrbuf += 2; hdrlen -= 2; // jump over 2 spare octets + if(hdrlen > 0) { + la_debug_print(D_INFO, "Warning: %u bytes left after MIAM header\n", hdrlen); + } +end: + return node; +} + +// MIAM CORE v2-specific formatters + +static void la_miam_core_v2_data_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr != NULL); + la_assert(data != NULL); + la_assert(indent >= 0); + + static la_dict const v2_compression_names[] = { + { .id = LA_MIAM_CORE_V2_COMP_NONE, .val = "none" }, + { .id = LA_MIAM_CORE_V2_COMP_DEFLATE, .val = "deflate" }, + { .id = 0x0, .val = NULL } + }; + + static la_dict const v2_encoding_names[] = { + { .id = LA_MIAM_CORE_V2_ENC_ISO5, .val = "ISO #5" }, + { .id = LA_MIAM_CORE_V2_ENC_BINARY, .val = "binary" }, + { .id = 0x0, .val = NULL } + }; + + la_miam_core_v2_data_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_HDR, indent); + return; + } + LA_ISPRINTF(vstr, indent, "Msg num: %u\n", pdu->msg_num); + LA_ISPRINTF(vstr, indent, "ACK: %srequired\n", + (pdu->ack_option == 1 ? "" : "not ")); + + char *name = la_dict_search(v2_compression_names, pdu->compression); + if(name != NULL) { + LA_ISPRINTF(vstr, indent, "Compression: %s\n", name); + } else { + LA_ISPRINTF(vstr, indent, "Compression: unknown (%u)\n", pdu->compression); + } + + name = la_dict_search(v2_encoding_names, pdu->encoding); + if(name != NULL) { + LA_ISPRINTF(vstr, indent, "Encoding: %s\n", name); + } else { + LA_ISPRINTF(vstr, indent, "Encoding: unknown (%u)\n", pdu->encoding); + } + + switch(pdu->app_type) { + case LA_MIAM_CORE_V2_APP_ACARS_2CHAR: + case LA_MIAM_CORE_V2_APP_ACARS_4CHAR: + case LA_MIAM_CORE_V2_APP_ACARS_6CHAR: + LA_ISPRINTF(vstr, indent, "ACARS:\n"); + indent++; + LA_ISPRINTF(vstr, indent, "Label: %c%c", + pdu->app_id[0], pdu->app_id[1]); + + if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_4CHAR || + pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_6CHAR) { + la_vstring_append_sprintf(vstr, " Sublabel: %c%c", + pdu->app_id[2], pdu->app_id[3]); + } + + if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_6CHAR) { + la_vstring_append_sprintf(vstr, " MFI: %c%c", + pdu->app_id[4], pdu->app_id[5]); + } + + la_vstring_append_sprintf(vstr, "%s", "\n"); + break; + case 0x4: + case 0x5: + case 0x6: + case 0x7: + case 0xd: + // reserved for future use + break; + case LA_MIAM_CORE_V2_APP_NONACARS_6CHAR: + default: // including 0x8-0x15 + LA_ISPRINTF(vstr, indent, "Non-ACARS payload:\n"); + indent++; + LA_ISPRINTF(vstr, indent, "Application ID: %s\n", pdu->app_id); + break; + } + + if(pdu->data != NULL) { + // Don't trust pdu->encoding - if the payload is printable, then print it as text. + // Otherwise print a hexdump. + if(is_printable(pdu->data, pdu->data_len)) { + // Parser has appended '\0' at the end, so it's safe to print it directly + bool prettify_xml = false; +#ifdef WITH_LIBXML2 + (void)la_config_get_bool("prettify_xml", &prettify_xml); + if(prettify_xml == true) { + xmlBufferPtr xmlbufptr = NULL; + if((xmlbufptr = la_prettify_xml((char *)pdu->data)) != NULL) { + LA_ISPRINTF(vstr, indent, "Message (reformatted):\n"); + la_isprintf_multiline_text(vstr, indent + 1, (char *)xmlbufptr->content); + xmlBufferFree(xmlbufptr); + } else { + // Doesn't look like XML - print it as normal + prettify_xml = false; + } + } +#endif + if(prettify_xml == false) { + LA_ISPRINTF(vstr, indent, "Message:\n"); + la_isprintf_multiline_text(vstr, indent + 1, (char *)pdu->data); + } + } else { + char *hexdump = la_hexdump((uint8_t *)pdu->data, pdu->data_len); + LA_ISPRINTF(vstr, indent, "Message:\n"); + la_isprintf_multiline_text(vstr, indent + 1, hexdump); + LA_XFREE(hexdump); + } + } + + if(pdu->err & LA_MIAM_ERR_BODY) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_BODY, indent + 1); + return; + } +} + +static void la_miam_core_v2_data_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr != NULL); + la_assert(data != NULL); + + la_miam_core_v2_data_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_HDR); + return; + } + la_json_append_int64(vstr, "msg_num", pdu->msg_num); + la_json_append_bool(vstr, "ack_required", pdu->ack_option == 1 ? true : false); + la_json_append_int64(vstr, "compression", pdu->compression); + la_json_append_int64(vstr, "encoding", pdu->encoding); + la_json_append_int64(vstr, "app_type", pdu->app_type); + + switch(pdu->app_type) { + case LA_MIAM_CORE_V2_APP_ACARS_2CHAR: + case LA_MIAM_CORE_V2_APP_ACARS_4CHAR: + case LA_MIAM_CORE_V2_APP_ACARS_6CHAR: + la_json_object_start(vstr, "acars"); + la_json_append_string(vstr, "label", + (char const *)(&((char[]){pdu->app_id[0], pdu->app_id[1], '\0'}))); + if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_4CHAR || + pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_6CHAR) { + la_json_append_string(vstr, "sublabel", + (char const *)(&((char[]){pdu->app_id[2], pdu->app_id[3], '\0'}))); + + } + if(pdu->app_type == LA_MIAM_CORE_V2_APP_ACARS_6CHAR) { + la_json_append_string(vstr, "mfi", + (char const *)(&((char[]){pdu->app_id[4], pdu->app_id[5], '\0'}))); + } + break; + case 0x4: + case 0x5: + case 0x6: + case 0x7: + case 0xd: + // reserved for future use + break; + case LA_MIAM_CORE_V2_APP_NONACARS_6CHAR: + default: // including 0x8-0x15 + la_json_object_start(vstr, "non_acars"); + la_json_append_string(vstr, "app_id", pdu->app_id); + break; + } + la_json_object_start(vstr, "message"); + if(pdu->data != NULL) { + if(is_printable(pdu->data, pdu->data_len)) { + la_json_append_string(vstr, "text", (char *)pdu->data); + } else { + la_json_append_octet_string(vstr, "octet_string", + (uint8_t *)pdu->data, pdu->data_len); + } + } + if(pdu->err & LA_MIAM_ERR_BODY) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_BODY); + } + la_json_object_end(vstr); // message + la_json_object_end(vstr); // acars / non_acars +} + +static void la_miam_core_v2_ack_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr != NULL); + la_assert(data != NULL); + la_assert(indent >= 0); + + static la_dict const v2_ack_xfer_result_names[] = { + { .id = 0x0, .val = "ack" }, + { .id = 0x1, .val = "nack" }, + { .id = 0x2, .val = "time_expiry" }, + { .id = 0x3, .val = "peer_abort" }, + { .id = 0x4, .val = "local_abort" }, + { .id = 0x5, .val = "miam_version_not_supported" }, + { .id = 0x0, .val = NULL } + }; + + la_miam_core_v2_ack_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_text(vstr, pdu->err & LA_MIAM_ERR_HDR, indent); + return; + } + LA_ISPRINTF(vstr, indent, "Msg ACK num: %u\n", pdu->msg_ack_num); + char *xfer_result_name = la_dict_search(v2_ack_xfer_result_names, pdu->ack_xfer_result); + if(xfer_result_name != NULL) { + LA_ISPRINTF(vstr, indent, "Transfer result: %s\n", xfer_result_name); + } else { + LA_ISPRINTF(vstr, indent, "Transfer result: unknown (%u)\n", pdu->ack_xfer_result); + } + // Not checking for body errors here, as there is no body in an ack PDU +} + +static void la_miam_core_v2_ack_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr != NULL); + la_assert(data != NULL); + + la_miam_core_v2_ack_pdu const *pdu = data; + if(pdu->err & LA_MIAM_ERR_HDR) { + la_miam_errors_format_json(vstr, pdu->err & LA_MIAM_ERR_HDR); + return; + } + la_json_append_int64(vstr, "msg_ack_num", pdu->msg_ack_num); + la_json_append_int64(vstr, "ack_xfer_result", pdu->ack_xfer_result); +} + +// MIAM CORE v2-specific destructors + +static void la_miam_core_v2_data_destroy(void *data) { + if(data == NULL) { + return; + } + la_miam_core_v2_data_pdu *pdu = data; + LA_XFREE(pdu->data); + LA_XFREE(pdu); +} + +// MIAM CORE v2-specific type descriptors + +la_type_descriptor const la_DEF_miam_core_v2_data_pdu = { + .format_text = la_miam_core_v2_data_format_text, + .format_json = la_miam_core_v2_data_format_json, + .json_key = "data", + .destroy = &la_miam_core_v2_data_destroy +}; +la_type_descriptor const la_DEF_miam_core_v2_ack_pdu = { + .format_text = la_miam_core_v2_ack_format_text, + .format_json = la_miam_core_v2_ack_format_json, + .json_key = "ack", + .destroy = NULL +}; diff --git a/plugins/inmarsat_support/aero/libacars/miam-core.h b/plugins/inmarsat_support/aero/libacars/miam-core.h new file mode 100644 index 000000000..ac01d86e7 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/miam-core.h @@ -0,0 +1,197 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_MIAM_CORE_H +#define LA_MIAM_CORE_H 1 + +#include +#include // la_type_descriptor, la_proto_node +#include // la_vstring + +#ifdef __cplusplus +extern "C" { +#endif + +// MIAM decoder error codes. Expressed as uint32_t: +// Lower half: header errors +// Upper half: body errors +#define LA_MIAM_ERR_SUCCESS (0) +#define LA_MIAM_ERR_HDR_PDU_TYPE_UNKNOWN (1 << 1) +#define LA_MIAM_ERR_HDR_PDU_VERSION_UNKNOWN (1 << 2) +#define LA_MIAM_ERR_HDR_TRUNCATED (1 << 3) +#define LA_MIAM_ERR_HDR_APP_TYPE_UNKNOWN (1 << 4) + +#define LA_MIAM_ERR_BODY_TRUNCATED (1 << 16) +#define LA_MIAM_ERR_BODY_INFLATE_FAILED (1 << 17) +#define LA_MIAM_ERR_BODY_COMPR_UNSUPPORTED (1 << 18) +#define LA_MIAM_ERR_BODY_CRC_FAILED (1 << 19) + +// header/body error masks +#define LA_MIAM_ERR_HDR 0x0000ffffu +#define LA_MIAM_ERR_BODY 0xffff0000u + +typedef struct { + void *data; + uint32_t pdu_len; + uint32_t data_len; + uint32_t err; + uint32_t crc; + char aircraft_id[8]; + char app_id[7]; + uint8_t msg_num; + uint8_t ack_option; + uint8_t compression; + uint8_t encoding; + uint8_t app_type; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_miam_core_v1_data_pdu; + +typedef struct { + void *data; + uint32_t err; + uint32_t pdu_len; + uint32_t data_len; + char aircraft_id[8]; + uint8_t msg_ack_num; + uint8_t ack_xfer_result; + uint8_t crc[4]; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_miam_core_v1_ack_pdu; + +typedef struct { + void *data; + uint32_t err; + uint32_t data_len; + uint16_t crc; + char app_id[9]; + uint8_t msg_num; + uint8_t ack_option; + uint8_t compression; + uint8_t encoding; + uint8_t app_type; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_miam_core_v2_data_pdu; + +typedef struct { + void *data; + uint32_t err; + uint32_t data_len; + uint8_t msg_ack_num; + uint8_t ack_xfer_result; + uint8_t crc[2]; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_miam_core_v2_ack_pdu; + +typedef struct { + void *data; + uint32_t err; + uint32_t pdu_len; + uint32_t data_len; + char aircraft_id[8]; + uint8_t compression; + uint8_t networks; + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_miam_core_v1v2_alo_alr_pdu; + +#define LA_MIAM_CORE_VER_MAX 2 + +typedef enum { + LA_MIAM_CORE_PDU_DATA = 0, + LA_MIAM_CORE_PDU_ACK = 1, + LA_MIAM_CORE_PDU_ALO = 2, + LA_MIAM_CORE_PDU_ALR = 3, + LA_MIAM_CORE_PDU_UNKNOWN = 4 +} la_miam_core_pdu_type; +#define LA_MIAM_CORE_PDU_TYPE_MAX 4 + +typedef struct { + uint32_t err; // PDU decoding error code + uint8_t version; // MIAM CORE PDU version + la_miam_core_pdu_type pdu_type; // MIAM CORE PDU type + // reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + void (*reserved6)(void); + void (*reserved7)(void); + void (*reserved8)(void); + void (*reserved9)(void); +} la_miam_core_pdu; + +// miam-core.c +la_proto_node *la_miam_core_pdu_parse(char const *txt); +void la_miam_core_format_text(la_vstring *vstr, void const *data, int indent); +void la_miam_core_format_json(la_vstring *vstr, void const *data); +la_proto_node *la_proto_tree_find_miam_core(la_proto_node *root); + +extern la_type_descriptor const la_DEF_miam_core_pdu; +extern la_type_descriptor const la_DEF_miam_core_v1v2_alo_pdu; +extern la_type_descriptor const la_DEF_miam_core_v1v2_alr_pdu; + +extern la_type_descriptor const la_DEF_miam_core_v1_data_pdu; +extern la_type_descriptor const la_DEF_miam_core_v1_ack_pdu; + +extern la_type_descriptor const la_DEF_miam_core_v2_data_pdu; +extern la_type_descriptor const la_DEF_miam_core_v2_ack_pdu; + +#ifdef __cplusplus +} +#endif + +#endif // !LA_MIAM_CORE_H diff --git a/plugins/inmarsat_support/aero/libacars/miam.c b/plugins/inmarsat_support/aero/libacars/miam.c new file mode 100644 index 000000000..0c047db2e --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/miam.c @@ -0,0 +1,792 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include +#include +#include /* calloc() */ +#include /* strchr(), strlen(), strncmp(), strcmp() */ +#ifdef WIN32 +#else +#include /* struct timeval */ +#endif +#include /* la_assert() */ +#include /* la_proto_node, la_type_descriptor */ +#include /* la_vstring */ +#include /* la_json_append_*() */ +#include /* la_strntouint16_t(), la_simple_strptime() */ +#include /* la_dict, la_dict_search() */ +#include +#include /* la_miam_core_pdu_parse(), la_miam_core_format_*() */ +#include + +// Clean up stale reassembly entries every 20 File Segment frames. +#define LA_MIAM_FILE_REASM_TABLE_CLEANUP_INTERVAL 20 + +typedef struct { + char fid_char; + la_miam_frame_id frame_id; +} la_miam_frame_id_map; + +static la_miam_frame_id_map const frame_id_map[LA_MIAM_FRAME_ID_CNT] = { + { .fid_char= 'T', .frame_id = LA_MIAM_FID_SINGLE_TRANSFER }, + { .fid_char= 'F', .frame_id = LA_MIAM_FID_FILE_TRANSFER_REQ }, + { .fid_char= 'K', .frame_id = LA_MIAM_FID_FILE_TRANSFER_ACCEPT }, + { .fid_char= 'S', .frame_id = LA_MIAM_FID_FILE_SEGMENT }, + { .fid_char= 'A', .frame_id = LA_MIAM_FID_FILE_TRANSFER_ABORT }, + { .fid_char= 'Y', .frame_id = LA_MIAM_FID_XOFF_IND }, + { .fid_char= 'X', .frame_id = LA_MIAM_FID_XON_IND }, + { .fid_char= '\0', .frame_id = LA_MIAM_FID_UNKNOWN }, +}; + +static la_dict const la_miam_frame_names[] = { + { .id = LA_MIAM_FID_SINGLE_TRANSFER, .val = "Single Transfer" }, + { .id = LA_MIAM_FID_FILE_TRANSFER_REQ, .val = "File Transfer Request" }, + { .id = LA_MIAM_FID_FILE_TRANSFER_ACCEPT, .val = "File Transfer Accept" }, + { .id = LA_MIAM_FID_FILE_SEGMENT, .val = "File Segment" }, + { .id = LA_MIAM_FID_FILE_TRANSFER_ABORT, .val = "File Transfer Abort" }, + { .id = LA_MIAM_FID_XOFF_IND, .val = "File Transfer Pause" }, + { .id = LA_MIAM_FID_XON_IND, .val = "File Transfer Resume" }, + { .id = 0, .val = NULL } +}; + +/******************************************************************************** + * MIAM File Transfer reassembly constants and callbacks + ********************************************************************************/ + +// MIAM File Transfer reassembly timeout. +// XXX: shall we respect message validity field from File Transfer Request frames, +// which often sets this timeout to many hours? +static struct timeval const la_miam_file_reasm_timeout = { + .tv_sec = 900, + .tv_usec = 0 +}; + +typedef struct { + char *reg; + uint16_t file_id; +} la_miam_file_key; + +static uint32_t la_miam_file_key_hash(void const *key) { + la_miam_file_key const *k = key; + uint32_t h = la_hash_string(k->reg, LA_HASH_INIT); + h += k->file_id; + return h; +} + +static bool la_miam_file_key_compare(void const *key1, void const *key2) { + la_miam_file_key const *k1 = key1; + la_miam_file_key const *k2 = key2; + return (!strcmp(k1->reg, k2->reg) && + (k1->file_id == k2->file_id)); +} + +static void *la_miam_file_key_get(void const *msg_info) { + la_assert(msg_info != NULL); + la_miam_file_key const *msg = msg_info; + LA_NEW(la_miam_file_key, key); + key->reg = strdup(msg->reg); + key->file_id = msg->file_id; + la_debug_print(D_INFO, "ALLOC KEY %s %d\n", key->reg, key->file_id); + return (void *)key; +} + +static void *la_miam_file_tmp_key_get(void const *msg_info) { + la_assert(msg_info != NULL); + la_miam_file_key const *msg = msg_info; + LA_NEW(la_miam_file_key, key); + key->reg = (char *)msg->reg; + key->file_id = msg->file_id; + return (void *)key; +} + +static void la_miam_file_key_destroy(void *ptr) { + if(ptr == NULL) { + return; + } + la_miam_file_key *key = ptr; + la_debug_print(D_INFO, "DESTROY KEY %s %d\n", key->reg, key->file_id); + LA_XFREE(key->reg); + LA_XFREE(key); +} + +static la_reasm_table_funcs miam_file_reasm_funcs = { + .get_key = la_miam_file_key_get, + .get_tmp_key = la_miam_file_tmp_key_get, + .hash_key = la_miam_file_key_hash, + .compare_keys = la_miam_file_key_compare, + .destroy_key = la_miam_file_key_destroy +}; + +/******************************************************************************** + * MIAM frame parsers + ********************************************************************************/ + +static la_proto_node *la_miam_single_transfer_parse(char const *txt) { + void *next = la_miam_core_pdu_parse(txt); + if(next == NULL) { + return NULL; + } + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_single_transfer_message; + node->data = NULL; + node->next = next; + return node; +} + +static la_proto_node *la_miam_file_transfer_request_parse(char const *reg, char const *txt, + la_reasm_ctx *rtables, struct timeval rx_time) { + la_assert(txt != NULL); + + la_miam_file_transfer_request_msg *msg = NULL; + if(chomped_strlen(txt) != 21) { + goto hdr_error; + } + + msg = LA_XCALLOC(1, sizeof(la_miam_file_transfer_request_msg)); + int i; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->file_id = (uint16_t)i; + txt += 3; + + if((i = la_strntouint16_t(txt, 6)) < 0) { + goto hdr_error; + } + msg->file_size = (size_t)i; + txt += 6; + + la_debug_print(D_INFO, "file_id: %u file_size: %zu\n", msg->file_id, msg->file_size); + char const *ptr = la_simple_strptime(txt, &msg->validity_time); + if(ptr == NULL) { + goto hdr_error; + } + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_file_transfer_request_message; + node->data = msg; + node->next = NULL; + + // If reassembly engine is enabled, then we have to create a reassembly table + // entry for this transfer now, because File Segment frames do not contain + // all necessary state information (file size, in particular). + if(rtables != NULL && reg != NULL) { + la_reasm_table *miam_file_table = la_reasm_table_lookup(rtables, + &la_DEF_miam_file_segment_message); + if(miam_file_table == NULL) { + miam_file_table = la_reasm_table_new(rtables, + &la_DEF_miam_file_segment_message, miam_file_reasm_funcs, + LA_MIAM_FILE_REASM_TABLE_CLEANUP_INTERVAL); + } + // Add the initial empty fragment to the table. + // Can't use msg as msg_info directly, because we will be adding subsequent + // fragments from la_miam_file_segment_parse(), where the type of msg is + // different. + msg->reasm_status = la_reasm_fragment_add(miam_file_table, + &(la_reasm_fragment_info){ + .msg_info = &(la_miam_file_key){ + .reg = (char *)reg, + .file_id = msg->file_id + }, + .msg_data = NULL, // payload will start in the next segment + .msg_data_len = 0, + .total_pdu_len = msg->file_size, + .seq_num = 0, // in sequence with file segment numbers, which go from 1 + .seq_num_first = 0, + .seq_num_wrap = SEQ_WRAP_NONE, + .is_final_fragment = false, + .rx_time = rx_time, + .reasm_timeout = la_miam_file_reasm_timeout + }); + } + return node; +hdr_error: + la_debug_print(D_VERBOSE, "Not a file_transfer_request header\n"); + LA_XFREE(msg); + return NULL; +} + +static la_proto_node *la_miam_file_transfer_accept_parse(char const *txt) { + la_assert(txt != NULL); + + la_miam_file_transfer_accept_msg *msg = NULL; + if(chomped_strlen(txt) != 10) { + goto hdr_error; + } + msg = LA_XCALLOC(1, sizeof(la_miam_file_transfer_accept_msg)); + int i; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->file_id = (uint16_t)i; + txt += 3; + + if(txt[0] >= '0' && txt[0] <= '9') { + msg->segment_size = txt[0] - '0'; + } else if(txt[0] >= 'A' && txt[0] <= 'F') { + msg->segment_size = txt[0] - 'A' + 10; + } else { + goto hdr_error; + } + txt++; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->onground_segment_tempo = (uint16_t)i; + txt += 3; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->inflight_segment_tempo = (uint16_t)i; + txt += 3; + + la_debug_print(D_INFO, "file_id: %u seg_size: %u onground_tempo: %u inflight_tempo: %u\n", + msg->file_id, msg->segment_size, msg->onground_segment_tempo, msg->inflight_segment_tempo); + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_file_transfer_accept_message; + node->data = msg; + node->next = NULL; + return node; +hdr_error: + la_debug_print(D_VERBOSE, "Not a file_transfer_accept header\n"); + LA_XFREE(msg); + return NULL; +} + +static la_proto_node *la_miam_file_segment_parse(char const *reg, char const *txt, + la_reasm_ctx *rtables, struct timeval rx_time) { + la_assert(txt != NULL); + LA_NEW(la_miam_file_segment_msg, msg); + int i; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->file_id = (uint16_t)i; + txt += 3; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->segment_id = (uint16_t)i; + txt += 3; + + la_debug_print(D_INFO, "file_id: %u segment_id: %u\n", msg->file_id, msg->segment_id); + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_file_segment_message; + node->data = msg; + node->next = NULL; + + // Can't use msg as msg_info directly in la_reasm_fragment_info, because the + // initial fragment is added by la_miam_file_transfer_request_parse(), where + // the type of msg is different. + la_miam_file_key msg_key = { + .reg = (char *)reg, + .file_id = msg->file_id + }; + la_reasm_table *miam_file_table = NULL; + + if(rtables != NULL && reg != NULL) { + miam_file_table = la_reasm_table_lookup(rtables, &la_DEF_miam_file_segment_message); + if(miam_file_table == NULL) { + miam_file_table = la_reasm_table_new(rtables, + &la_DEF_miam_file_segment_message, miam_file_reasm_funcs, + LA_MIAM_FILE_REASM_TABLE_CLEANUP_INTERVAL); + } + // Add the fragment to the table. + msg->reasm_status = la_reasm_fragment_add(miam_file_table, + &(la_reasm_fragment_info){ + .msg_info = &msg_key, + .msg_data = (uint8_t *)txt, + .msg_data_len = strlen(txt), + .total_pdu_len = 0, // already set in 1st fragment + .seq_num = msg->segment_id, + .seq_num_first = 0, + .seq_num_wrap = SEQ_WRAP_NONE, + .is_final_fragment = false, // not used here + .rx_time = rx_time, + .reasm_timeout = la_miam_file_reasm_timeout + }); + } + + uint8_t *reassembled_msg = NULL; + if(msg->reasm_status == LA_REASM_COMPLETE && + la_reasm_payload_get(miam_file_table, &msg_key, &reassembled_msg) > 0) { + // reassembled_msg is a newly allocated byte buffer, which is guaranteed to + // be NULL-terminated, so we can cast it to char * directly. + // Store the pointer to it in msg struct for freeing it later. + txt = msg->txt = (char *)reassembled_msg; + + } + + bool decode_payload = true; + // If reassembly is enabled and is now in progress (ie. the message is not yet complete), + // then decode_fragments config flag decides whether to decode apps in this message + // or not. + if(rtables != NULL && (msg->reasm_status == LA_REASM_IN_PROGRESS || + msg->reasm_status == LA_REASM_DUPLICATE)) { + (void)la_config_get_bool("decode_fragments", &decode_payload); + } + if(decode_payload) { + node->next = la_miam_core_pdu_parse(txt); + } + + return node; +hdr_error: + la_debug_print(D_VERBOSE, "Not a file_segment header\n"); + LA_XFREE(msg); + return NULL; +} + +static void la_miam_file_segment_destroy(void *data) { + if(data == NULL) { + return; + } + la_miam_file_segment_msg *msg = data; + LA_XFREE(msg->txt); + LA_XFREE(msg); +} + +static la_proto_node *la_miam_file_transfer_abort_parse(char const *txt) { + la_assert(txt != NULL); + + la_miam_file_transfer_abort_msg *msg = NULL; + if(chomped_strlen(txt) != 4) { + goto hdr_error; + } + msg = LA_XCALLOC(1, sizeof(la_miam_file_transfer_abort_msg)); + int i; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->file_id = (uint16_t)i; + txt += 3; + + if(txt[0] >= '0' && txt[0] <= '9') { + msg->reason = txt[0] - '0'; + } else { + goto hdr_error; + } + txt++; + + la_debug_print(D_INFO, "file_id: %u reason: %u\n", msg->file_id, msg->reason); + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_file_transfer_abort_message; + node->data = msg; + node->next = NULL; + return node; +hdr_error: + la_debug_print(D_VERBOSE, "Not a file_transfer_abort header\n"); + LA_XFREE(msg); + return NULL; +} + +static la_proto_node *la_miam_xoff_ind_parse(char const *txt) { + la_assert(txt != NULL); + + la_miam_xoff_ind_msg *msg = NULL; + if(chomped_strlen(txt) != 3) { + goto hdr_error; + } + msg = LA_XCALLOC(1, sizeof(la_miam_xoff_ind_msg)); + int i; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + if(strncmp(txt, "FFF", 3) == 0) { + i = 0xFFF; + } else { + goto hdr_error; + } + } + msg->file_id = (uint16_t)i; + txt += 3; + la_debug_print(D_INFO, "file_id: %u\n", msg->file_id); + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_xoff_ind_message; + node->data = msg; + node->next = NULL; + return node; +hdr_error: + la_debug_print(D_VERBOSE, "Not a xoff_ind header\n"); + LA_XFREE(msg); + return NULL; +} + +static la_proto_node *la_miam_xon_ind_parse(char const *txt) { + la_assert(txt != NULL); + + la_miam_xon_ind_msg *msg = NULL; + if(chomped_strlen(txt) != 9) { + goto hdr_error; + } + msg = LA_XCALLOC(1, sizeof(la_miam_xon_ind_msg)); + int i; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + if(strncmp(txt, "FFF", 3) == 0) { + i = 0xFFF; + } else { + goto hdr_error; + } + } + msg->file_id = (uint16_t)i; + txt += 3; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->onground_segment_tempo = (uint16_t)i; + txt += 3; + + if((i = la_strntouint16_t(txt, 3)) < 0) { + goto hdr_error; + } + msg->inflight_segment_tempo = (uint16_t)i; + txt += 3; + + la_debug_print(D_INFO, "file_id: %u onground_tempo: %u inflight_tempo: %u\n", + msg->file_id, msg->onground_segment_tempo, msg->inflight_segment_tempo); + + la_proto_node *node = la_proto_node_new(); + node->td = &la_DEF_miam_xon_ind_message; + node->data = msg; + node->next = NULL; + return node; +hdr_error: + la_debug_print(D_VERBOSE, "Not a xon_ind header\n"); + LA_XFREE(msg); + return NULL; +} + +la_proto_node *la_miam_parse_and_reassemble(char const *reg, char const *txt, + la_reasm_ctx *rtables, struct timeval rx_time) { + if(txt == NULL) { + return NULL; + } + size_t len = strlen(txt); + + // First character identifies the ACARS CF frame + if(len == 0) { + return NULL; + } + la_miam_frame_id fid = LA_MIAM_FID_UNKNOWN; // safe default + for(int i = 0; i < LA_MIAM_FRAME_ID_CNT; i++) { + if(txt[0] == frame_id_map[i].fid_char) { + fid = frame_id_map[i].frame_id; + la_debug_print(D_INFO, "txt[0]: %c frame_id: %d\n", txt[0], fid); + break; + } + } + if(fid == LA_MIAM_FID_UNKNOWN) { + la_debug_print(D_VERBOSE, "not a MIAM message (unknown ACARS CF frame)\n"); + return NULL; + } + txt++; len--; + la_proto_node *next_node = NULL; + switch(fid) { + case LA_MIAM_FID_SINGLE_TRANSFER: + next_node = la_miam_single_transfer_parse(txt); + break; + case LA_MIAM_FID_FILE_TRANSFER_REQ: + next_node = la_miam_file_transfer_request_parse(reg, txt, rtables, rx_time); + break; + case LA_MIAM_FID_FILE_TRANSFER_ACCEPT: + next_node = la_miam_file_transfer_accept_parse(txt); + break; + case LA_MIAM_FID_FILE_SEGMENT: + next_node = la_miam_file_segment_parse(reg, txt, rtables, rx_time); + break; + case LA_MIAM_FID_FILE_TRANSFER_ABORT: + next_node = la_miam_file_transfer_abort_parse(txt); + break; + case LA_MIAM_FID_XOFF_IND: + next_node = la_miam_xoff_ind_parse(txt); + break; + case LA_MIAM_FID_XON_IND: + next_node = la_miam_xon_ind_parse(txt); + break; + default: + break; + } + if(next_node == NULL) { + return NULL; + } + LA_NEW(la_miam_msg, msg); + msg->frame_id = fid; + la_proto_node *node = la_proto_node_new(); + node->data = msg; + node->td = &la_DEF_miam_message; + node->next = next_node; + return node; +} + +la_proto_node *la_miam_parse(char const *txt) { + return la_miam_parse_and_reassemble(NULL, txt, NULL, + (struct timeval){ .tv_sec = 0, .tv_usec = 0}); +} + +static void la_miam_single_transfer_format_text(la_vstring *vstr, void const *data, int indent) { + la_miam_core_format_text(vstr, data, indent); +} + +static void la_miam_single_transfer_format_json(la_vstring *vstr, void const *data) { + la_miam_core_format_json(vstr, data); +} + +static void la_miam_file_transfer_request_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_file_transfer_request_msg const *msg = data; + indent++; + LA_ISPRINTF(vstr, indent, "File ID: %u\n", msg->file_id); + LA_ISPRINTF(vstr, indent, "File size: %zu bytes\n", msg->file_size); + struct tm const *t = &msg->validity_time; + LA_ISPRINTF(vstr, indent, "Complete until: %d-%02d-%02d %02d:%02d:%02d\n", + t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec + ); + LA_ISPRINTF(vstr, indent, "Reassembly: %s\n", la_reasm_status_name_get(msg->reasm_status)); +} + +static void la_miam_file_transfer_request_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_file_transfer_request_msg const *msg = data; + la_json_append_int64(vstr, "file_id", msg->file_id); + la_json_append_int64(vstr, "file_size", msg->file_size); + struct tm const *t = &msg->validity_time; + la_json_object_start(vstr, "complete_until_datetime"); + la_json_object_start(vstr, "date"); + la_json_append_int64(vstr, "year", t->tm_year + 1900); + la_json_append_int64(vstr, "month", t->tm_mon + 1); + la_json_append_int64(vstr, "day", t->tm_mday); + la_json_object_end(vstr); + la_json_object_start(vstr, "time"); + la_json_append_int64(vstr, "hour", t->tm_hour); + la_json_append_int64(vstr, "minute", t->tm_min); + la_json_append_int64(vstr, "second", t->tm_sec); + la_json_object_end(vstr); + la_json_object_end(vstr); +} + +static void la_miam_file_transfer_accept_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_file_transfer_accept_msg const *msg = data; + indent++; + LA_ISPRINTF(vstr, indent, "File ID: %u\n", msg->file_id); + LA_ISPRINTF(vstr, indent, "Segment size: %u\n", msg->segment_size); + LA_ISPRINTF(vstr, indent, "On-ground segment temporization: %u sec\n", msg->onground_segment_tempo); + LA_ISPRINTF(vstr, indent, "In-flight segment temporization: %u sec\n", msg->inflight_segment_tempo); +} + +static void la_miam_file_transfer_accept_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_file_transfer_accept_msg const *msg = data; + la_json_append_int64(vstr, "file_id", msg->file_id); + la_json_append_int64(vstr, "segment_size", msg->segment_size); + la_json_append_int64(vstr, "on_ground_seg_temp_secs", msg->onground_segment_tempo); + la_json_append_int64(vstr, "in_flight_seg_temp_secs", msg->inflight_segment_tempo); +} + +static void la_miam_file_segment_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_file_segment_msg const *msg = data; + indent++; + LA_ISPRINTF(vstr, indent, "File ID: %u\n", msg->file_id); + LA_ISPRINTF(vstr, indent, "Segment ID: %u\n", msg->segment_id); + LA_ISPRINTF(vstr, indent, "Reassembly: %s\n", la_reasm_status_name_get(msg->reasm_status)); +} + +static void la_miam_file_segment_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_file_segment_msg const *msg = data; + la_json_append_int64(vstr, "file_id", msg->file_id); + la_json_append_int64(vstr, "segment_id", msg->segment_id); +} + +static void la_miam_file_transfer_abort_format_text(la_vstring *vstr, void const *data, int indent) { + static la_dict const abort_reasons[] = { + { .id = 0, .val = "File transfer request refused by receiver" }, + { .id = 1, .val = "File segment out of context" }, + { .id = 2, .val = "File transfer stopped by sender" }, + { .id = 3, .val = "File transfer stopped by receiver" }, + { .id = 4, .val = "File segment transmission failed" }, + { .id = 0, .val = NULL } + }; + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_file_transfer_abort_msg const *msg = data; + indent++; + LA_ISPRINTF(vstr, indent, "File ID: %u\n", msg->file_id); + char *descr = la_dict_search(abort_reasons, msg->reason); + LA_ISPRINTF(vstr, indent, "Reason: %u (%s)\n", msg->reason, + (descr != NULL ? descr : "unknown")); +} + +static void la_miam_file_transfer_abort_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_file_transfer_abort_msg const *msg = data; + la_json_append_int64(vstr, "file_id", msg->file_id); + la_json_append_int64(vstr, "reason", msg->reason); +} + +static void la_miam_xoff_ind_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_xoff_ind_msg const *msg = data; + indent++; + if(msg->file_id == 0xFFF) { + LA_ISPRINTF(vstr, indent, "File ID: 0xFFF (all)\n"); + } else { + LA_ISPRINTF(vstr, indent, "File ID: %u\n", msg->file_id); + } +} + +static void la_miam_xoff_ind_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_xoff_ind_msg const *msg = data; + la_json_append_bool(vstr, "all_files", msg->file_id == 0xFFF); + if(msg->file_id != 0xFFF) { + la_json_append_int64(vstr, "file_id", msg->file_id); + } +} + +static void la_miam_xon_ind_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_xon_ind_msg const *msg = data; + indent++; + if(msg->file_id == 0xFFF) { + LA_ISPRINTF(vstr, indent, "File ID: 0xFFF (all)\n"); + } else { + LA_ISPRINTF(vstr, indent, "File ID: %u\n", msg->file_id); + } + LA_ISPRINTF(vstr, indent, "On-ground segment temporization: %u sec\n", msg->onground_segment_tempo); + LA_ISPRINTF(vstr, indent, "In-flight segment temporization: %u sec\n", msg->inflight_segment_tempo); +} + +static void la_miam_xon_ind_format_json(la_vstring *vstr, void const *data) { + la_assert(vstr); + la_assert(data); + + la_miam_xon_ind_msg const *msg = data; + la_json_append_bool(vstr, "all_files", msg->file_id == 0xFFF); + if(msg->file_id != 0xFFF) { + la_json_append_int64(vstr, "file_id", msg->file_id); + } + la_json_append_int64(vstr, "on_ground_seg_temp_secs", msg->onground_segment_tempo); + la_json_append_int64(vstr, "in_flight_seg_temp_secs", msg->inflight_segment_tempo); +} + +void la_miam_format_text(la_vstring *vstr, void const *data, int indent) { + la_assert(vstr); + la_assert(data); + la_assert(indent >= 0); + + la_miam_msg const *msg = data; + char *frame_name = la_dict_search(la_miam_frame_names, msg->frame_id); + la_assert(frame_name != NULL); + LA_ISPRINTF(vstr, indent, "MIAM:\n"); + LA_ISPRINTF(vstr, indent+1, "%s:\n", frame_name); +} + +void la_miam_format_json(la_vstring *vstr, void const *data) { + LA_UNUSED(vstr); + LA_UNUSED(data); + // NOOP +} + +la_type_descriptor const la_DEF_miam_message = { + .format_text = la_miam_format_text, + .format_json = la_miam_format_json, + .json_key = "miam", + .destroy = NULL +}; + +la_type_descriptor const la_DEF_miam_single_transfer_message = { + .format_text = la_miam_single_transfer_format_text, + .format_json = la_miam_single_transfer_format_json, + .json_key = "single_transfer", + .destroy = NULL +}; + +la_type_descriptor const la_DEF_miam_file_transfer_request_message = { + .format_text = la_miam_file_transfer_request_format_text, + .format_json = la_miam_file_transfer_request_format_json, + .json_key = "file_transfer_request", + .destroy = NULL +}; + +la_type_descriptor const la_DEF_miam_file_transfer_accept_message = { + .format_text = la_miam_file_transfer_accept_format_text, + .format_json = la_miam_file_transfer_accept_format_json, + .json_key = "file_transfer_accept", + .destroy = NULL +}; + +la_type_descriptor const la_DEF_miam_file_segment_message = { + .format_text = la_miam_file_segment_format_text, + .format_json = la_miam_file_segment_format_json, + .json_key = "file_segment", + .destroy = la_miam_file_segment_destroy +}; + +la_type_descriptor const la_DEF_miam_file_transfer_abort_message = { + .format_text = la_miam_file_transfer_abort_format_text, + .format_json = la_miam_file_transfer_abort_format_json, + .json_key = "file_transfer_abort", + .destroy = NULL +}; + +la_type_descriptor const la_DEF_miam_xoff_ind_message = { + .format_text = la_miam_xoff_ind_format_text, + .format_json = la_miam_xoff_ind_format_json, + .json_key = "file_xoff_ind", + .destroy = NULL +}; + +la_type_descriptor const la_DEF_miam_xon_ind_message = { + .format_text = la_miam_xon_ind_format_text, + .format_json = la_miam_xon_ind_format_json, + .json_key = "file_xon_ind", + .destroy = NULL +}; + +la_proto_node *la_proto_tree_find_miam(la_proto_node *root) { + return la_proto_tree_find_protocol(root, &la_DEF_miam_message); +} diff --git a/plugins/inmarsat_support/aero/libacars/miam.h b/plugins/inmarsat_support/aero/libacars/miam.h new file mode 100644 index 000000000..a411992ab --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/miam.h @@ -0,0 +1,135 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_MIAM_H +#define LA_MIAM_H 1 + +#include +#include // struct tm +#include // la_type_descriptor, la_proto_node +#include // la_vstring +#include // la_reasm_ctx, la_reasm_status reasm_status + +#ifdef __cplusplus +extern "C" { +#endif + +// MIAM frame identifier +typedef enum { + LA_MIAM_FID_UNKNOWN = 0, + LA_MIAM_FID_SINGLE_TRANSFER, + LA_MIAM_FID_FILE_TRANSFER_REQ, + LA_MIAM_FID_FILE_TRANSFER_ACCEPT, + LA_MIAM_FID_FILE_SEGMENT, + LA_MIAM_FID_FILE_TRANSFER_ABORT, + LA_MIAM_FID_XOFF_IND, + LA_MIAM_FID_XON_IND +} la_miam_frame_id; +#define LA_MIAM_FRAME_ID_CNT 8 + +// MIAM ACARS CF frame +typedef struct { + la_miam_frame_id frame_id; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_msg; + +// MIAM File Transfer Request +typedef struct { + size_t file_size; + uint16_t file_id; + struct tm validity_time; + la_reasm_status reasm_status; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_file_transfer_request_msg; + +// MIAM File Transfer Accept +typedef struct { + uint16_t file_id; + uint16_t segment_size; + uint16_t onground_segment_tempo; + uint16_t inflight_segment_tempo; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_file_transfer_accept_msg; + +// MIAM File Segment +typedef struct { + char *txt; + uint16_t file_id; + uint16_t segment_id; + la_reasm_status reasm_status; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_file_segment_msg; + +// MIAM File Transfer Abort +typedef struct { + uint16_t file_id; + uint16_t reason; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_file_transfer_abort_msg; + +// MIAM XOFF IND +typedef struct { + uint16_t file_id; // 0-127 or 0xFFF = pause all transfers +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_xoff_ind_msg; + +// MIAM XON IND +typedef struct { + uint16_t file_id; // 0-127 or 0xFFF = resume all transfers + uint16_t onground_segment_tempo; + uint16_t inflight_segment_tempo; +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_miam_xon_ind_msg; + +la_proto_node *la_miam_parse(char const *txt); +la_proto_node *la_miam_parse_and_reassemble(char const *reg, char const *txt, + la_reasm_ctx *rtables, struct timeval rx_time); +void la_miam_format_text(la_vstring *vstr, void const *data, int indent); +void la_miam_format_json(la_vstring *vstr, void const *data); + +extern la_type_descriptor const la_DEF_miam_message; +extern la_type_descriptor const la_DEF_miam_single_transfer_message; +extern la_type_descriptor const la_DEF_miam_file_transfer_request_message; +extern la_type_descriptor const la_DEF_miam_file_transfer_accept_message; +extern la_type_descriptor const la_DEF_miam_file_segment_message; +extern la_type_descriptor const la_DEF_miam_file_transfer_abort_message; +extern la_type_descriptor const la_DEF_miam_xoff_ind_message; +extern la_type_descriptor const la_DEF_miam_xon_ind_message; +la_proto_node *la_proto_tree_find_miam(la_proto_node *root); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_MIAM_H diff --git a/plugins/inmarsat_support/aero/libacars/reassembly.c b/plugins/inmarsat_support/aero/libacars/reassembly.c new file mode 100644 index 000000000..a4f8aad1f --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/reassembly.c @@ -0,0 +1,383 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifdef WIN32 +#else +#include // struct timeval +#endif +#include // strdup +#include // la_assert +#include // la_hash +#include // la_list +#include // LA_XCALLOC, LA_XFREE, la_octet_string +#include + +typedef struct la_reasm_table_s { + void const *key; /* a pointer identifying the protocol + owning this reasm_table (la_type_descriptor + can be used for this purpose). Due to small + number of protocols, hash would be an overkill + here. */ + la_hash *fragment_table; /* keyed with packet identifiers, values are + la_reasm_table_entries */ + la_reasm_table_funcs funcs; /* protocol-specific callbacks */ + int cleanup_interval; /* expire old entries every cleanup_interval + number of processed fragments */ + int frag_cnt; /* counts added fragments (up to cleanup_interval) */ +} la_reasm_table; + +struct la_reasm_ctx_s { + la_list *rtables; /* list of reasm_tables, one per protocol */ +}; + +// the header of the fragment list +typedef struct { + int prev_seq_num; /* sequence number of previous fragment */ + + int frags_collected_total_len; /* sum of msg_data_len for all fragments received */ + + int total_pdu_len; /* total length of the reassembled message + (copied from la_reasm_fragment_info of the 1st fragment) */ + + struct timeval first_frag_rx_time; /* time of arrival of the first fragment */ + + struct timeval reasm_timeout; /* reassembly timeout to be applied to this message */ + + la_list *fragment_list; /* payloads of all fragments gathered so far */ +} la_reasm_table_entry; + +la_reasm_ctx *la_reasm_ctx_new() { + LA_NEW(la_reasm_ctx, rctx); + return rctx; +} + +static void la_reasm_table_entry_destroy(void *rt_ptr) { + if(rt_ptr == NULL) { + return; + } + la_reasm_table_entry *rt_entry = rt_ptr; + la_list_free_full(rt_entry->fragment_list, la_octet_string_destroy); + LA_XFREE(rt_entry); +} + +static void la_reasm_table_destroy(void *table) { + if(table == NULL) { + return; + } + la_reasm_table *rtable = table; + la_hash_destroy(rtable->fragment_table); + LA_XFREE(rtable); +} + +void la_reasm_ctx_destroy(void *ctx) { + if(ctx == NULL) { + return; + } + la_reasm_ctx *rctx = ctx; + la_list_free_full(rctx->rtables, la_reasm_table_destroy); + LA_XFREE(rctx); +} + +la_reasm_table *la_reasm_table_lookup(la_reasm_ctx *rctx, void const *table_id) { + la_assert(rctx != NULL); + la_assert(table_id != NULL); + + for(la_list *l = rctx->rtables; l != NULL; l = la_list_next(l)) { + la_reasm_table *rt = l->data; + if(rt->key == table_id) { + return rt; + } + } + return NULL; +} + +#define LA_REASM_DEFAULT_CLEANUP_INTERVAL 100 + +la_reasm_table *la_reasm_table_new(la_reasm_ctx *rctx, void const *table_id, + la_reasm_table_funcs funcs, int cleanup_interval) { + la_assert(rctx != NULL); + la_assert(table_id != NULL); + la_assert(funcs.get_key); + la_assert(funcs.get_tmp_key); + la_assert(funcs.hash_key); + la_assert(funcs.compare_keys); + la_assert(funcs.destroy_key); + + la_reasm_table *rtable = la_reasm_table_lookup(rctx, table_id); + if(rtable != NULL) { + goto end; + } + rtable = LA_XCALLOC(1, sizeof(la_reasm_table)); + rtable->key = table_id; + rtable->fragment_table = la_hash_new(funcs.hash_key, funcs.compare_keys, + funcs.destroy_key, la_reasm_table_entry_destroy); + rtable->funcs = funcs; + + // Replace insane values with reasonable default + rtable->cleanup_interval = cleanup_interval > 0 ? + cleanup_interval : LA_REASM_DEFAULT_CLEANUP_INTERVAL; + rctx->rtables = la_list_append(rctx->rtables, rtable); +end: + return rtable; +} + +// Checks if time difference between rx_first and rx_last is greater than timeout. +static bool la_reasm_timed_out(struct timeval rx_last, struct timeval rx_first, + struct timeval timeout) { + if(timeout.tv_sec == 0 && timeout.tv_usec == 0) { + return false; + } + struct timeval to = { + .tv_sec = rx_first.tv_sec + timeout.tv_sec, + .tv_usec = rx_first.tv_usec + timeout.tv_usec + }; + if(to.tv_usec > 1e9) { + to.tv_sec++; + to.tv_usec -= 1e9; + } + la_debug_print(D_INFO, "rx_first: %lu.%lu to: %lu.%lu rx_last: %lu.%lu\n", + rx_first.tv_sec, rx_first.tv_usec, to.tv_sec, to.tv_usec, rx_last.tv_sec, rx_last.tv_usec); + return (rx_last.tv_sec > to.tv_sec || + (rx_last.tv_sec == to.tv_sec && rx_last.tv_usec > to.tv_usec)); +} + +// Callback for la_hash_foreach_remove used during reassembly table cleanups. +static bool is_rt_entry_expired(void const *keyptr, void const *valptr, void *ctx) { + LA_UNUSED(keyptr); + la_assert(valptr != NULL); + la_assert(ctx != NULL); + + la_reasm_table_entry const *rt_entry = valptr; + struct timeval *now = ctx; + return la_reasm_timed_out(*now, rt_entry->first_frag_rx_time, rt_entry->reasm_timeout); +} + +// Removes expired entries from the given reassembly table. +static void la_reasm_table_cleanup(la_reasm_table *rtable, struct timeval now) { + la_assert(rtable != NULL); + la_assert(rtable->fragment_table != NULL); + int deleted_count = la_hash_foreach_remove(rtable->fragment_table, + is_rt_entry_expired, &now); + // Avoid compiler warning when DEBUG is off + LA_UNUSED(deleted_count); + la_debug_print(D_INFO, "Expired %d entries\n", deleted_count); +} + +#define SEQ_UNINITIALIZED -2 + +// Checks if the given sequence number follows the previous one seen. +static bool is_seq_num_in_sequence(int prev_seq_num, int cur_seq_num) { + return (prev_seq_num == SEQ_UNINITIALIZED || prev_seq_num + 1 == cur_seq_num); +} + +// Core reassembly logic. +// Validates the given message fragment and appends it to the reassembly table +// fragment list. +la_reasm_status la_reasm_fragment_add(la_reasm_table *rtable, la_reasm_fragment_info const *finfo) { + la_assert(rtable != NULL); + la_assert(finfo != NULL); + if(finfo->msg_info == NULL) { + return LA_REASM_ARGS_INVALID; + } + + // Don't allow zero timeout. This would prevent stale rt_entries from being expired, + // causing a massive memory leak. + + if(finfo->reasm_timeout.tv_sec == 0 && finfo->reasm_timeout.tv_usec == 0) { + return LA_REASM_ARGS_INVALID; + } + + la_reasm_status ret = LA_REASM_UNKNOWN; + void *lookup_key = rtable->funcs.get_tmp_key(finfo->msg_info); + la_assert(lookup_key != NULL); + la_reasm_table_entry *rt_entry = NULL; +restart: + rt_entry = la_hash_lookup(rtable->fragment_table, lookup_key); + if(rt_entry == NULL) { + + // Don't add if we know that this is not the first fragment of the message. + + if(finfo->seq_num_first != SEQ_FIRST_NONE && finfo->seq_num_first != finfo->seq_num) { + la_debug_print(D_INFO, "No rt_entry found and seq_num %d != seq_num_first %d," + " not creating rt_entry\n", finfo->seq_num, finfo->seq_num_first); + ret = LA_REASM_FRAG_OUT_OF_SEQUENCE; + goto end; + } + if(finfo->is_final_fragment) { + + // This is the first received fragment of this message and it's the final + // fragment. Either this message is not fragmented or all fragments except the + // last one have been lost. In either case there is no point in adding it to + // the fragment table. + + la_debug_print(D_INFO, "No rt_entry found and is_final_fragment=true, not creating rt_entry\n"); + ret = LA_REASM_SKIPPED; + goto end; + } + rt_entry = LA_XCALLOC(1, sizeof(la_reasm_table_entry)); + rt_entry->prev_seq_num = SEQ_UNINITIALIZED; + rt_entry->first_frag_rx_time = finfo->rx_time; + rt_entry->reasm_timeout = finfo->reasm_timeout; + rt_entry->total_pdu_len = LA_MAX(finfo->total_pdu_len, 0); + rt_entry->frags_collected_total_len = 0; + la_debug_print(D_INFO, "Adding new rt_table entry (rx_time: %lu.%lu timeout: %lu.%lu)\n", + rt_entry->first_frag_rx_time.tv_sec, rt_entry->first_frag_rx_time.tv_usec, + rt_entry->reasm_timeout.tv_sec, rt_entry->reasm_timeout.tv_usec); + void *msg_key = rtable->funcs.get_key(finfo->msg_info); + la_assert(msg_key != NULL); + la_hash_insert(rtable->fragment_table, msg_key, rt_entry); + } else { + la_debug_print(D_INFO, "rt_entry found, prev_seq_num: %d\n", rt_entry->prev_seq_num); + } + + // Check if the sequence number has wrapped (if we're supposed to handle wraparounds) + + if(finfo->seq_num_wrap != SEQ_WRAP_NONE && finfo->seq_num == 0 && + finfo->seq_num_wrap == rt_entry->prev_seq_num + 1) { + la_debug_print(D_INFO, "seq_num wrap at %d: %d -> %d\n", finfo->seq_num_wrap, + rt_entry->prev_seq_num, finfo->seq_num); + + // Current seq_num is 0, so set prev_seq_num to -1 to cause the seq_num check to succeed + + rt_entry->prev_seq_num = -1; + } + + // Check reassembly timeout + + if(la_reasm_timed_out(finfo->rx_time, rt_entry->first_frag_rx_time, rt_entry->reasm_timeout) == true) { + + // If reassembly timeout has expired, we treat this fragment as a part of + // a new message. Remove the old rt_entry and create new one. + + la_debug_print(D_INFO, "reasm timeout expired; creating new rt_entry\n"); + la_hash_remove(rtable->fragment_table, lookup_key); + goto restart; + } + + // Skip duplicates / retransmissions. + // If sequence numbers don't wrap, then treat fragments we've seen before as + // duplicates too. + + if(rt_entry->prev_seq_num == finfo->seq_num || + (finfo->seq_num_wrap == SEQ_WRAP_NONE && finfo->seq_num < rt_entry->prev_seq_num)) { + la_debug_print(D_INFO, "skipping duplicate fragment (seq_num: %d)\n", finfo->seq_num); + ret = LA_REASM_DUPLICATE; + goto end; + } + + // Check If the sequence number has incremented. + + if(is_seq_num_in_sequence(rt_entry->prev_seq_num, finfo->seq_num) == false) { + + // Probably one or more fragments have been lost. Reassembly is not possible. + + la_debug_print(D_INFO, "seq_num %d out of sequence (prev: %d)\n", + finfo->seq_num, rt_entry->prev_seq_num); + la_hash_remove(rtable->fragment_table, lookup_key); + ret = LA_REASM_FRAG_OUT_OF_SEQUENCE; + goto end; + } + + // All checks succeeded. Add the fragment to the list. + + la_debug_print(D_INFO, "Good seq_num %d (prev: %d), adding fragment to the list\n", + finfo->seq_num, rt_entry->prev_seq_num); + // Don't append fragments with empty payload (but increment seq_num anyway, + // because empty fragment is not an error) + if(finfo->msg_data != NULL && finfo->msg_data_len > 0) { + uint8_t *msg_data = LA_XCALLOC(finfo->msg_data_len, sizeof(uint8_t)); + memcpy(msg_data, finfo->msg_data, finfo->msg_data_len); + la_octet_string *ostring = la_octet_string_new(msg_data, finfo->msg_data_len); + rt_entry->fragment_list = la_list_append(rt_entry->fragment_list, ostring); + } + rt_entry->frags_collected_total_len += finfo->msg_data_len; + rt_entry->prev_seq_num = finfo->seq_num; + + // If we've come to this point successfully, then reassembly is complete if: + // + // - total_pdu_len for this rt_entry is set and we've already collected + // required amount of data, or + // + // - total_pdu_len for this rt_entry is not known and the caller indicates + // that this is the final fragment of this message. + // + // Otherwise we expect more fragments to come. + + if(rt_entry->total_pdu_len > 0) { + ret = rt_entry->frags_collected_total_len >= rt_entry->total_pdu_len ? + LA_REASM_COMPLETE : LA_REASM_IN_PROGRESS; + } else { + ret = finfo->is_final_fragment ? LA_REASM_COMPLETE : LA_REASM_IN_PROGRESS; + } + +end: + + // Update fragment counter and expire old entries if necessary. + // Expiration is performed in relation to rx_time of the fragment currently + // being processed. This allows processing historical data with timestamps in + // the past. + + if(++rtable->frag_cnt > rtable->cleanup_interval) { + la_reasm_table_cleanup(rtable, finfo->rx_time); + rtable->frag_cnt = 0; + } + la_debug_print(D_INFO, "Result: %d\n", ret); + LA_XFREE(lookup_key); + return ret; +} + +// Returns the reassembled payload and removes the packet data from reassembly table +int la_reasm_payload_get(la_reasm_table *rtable, void const *msg_info, uint8_t **result) { + la_assert(rtable != NULL); + la_assert(msg_info != NULL); + la_assert(result != NULL); + + void *tmp_key = rtable->funcs.get_tmp_key(msg_info); + la_assert(tmp_key); + + size_t result_len = -1; + la_reasm_table_entry *rt_entry = la_hash_lookup(rtable->fragment_table, tmp_key); + if(rt_entry == NULL) { + result_len = -1; + goto end; + } + if(rt_entry->frags_collected_total_len < 1) { + result_len = 0; + goto end; + } + // Append a NULL byte at the end of the reassembled buffer, so that it can be + // cast to char * if this is a text message. + uint8_t *reasm_buf = LA_XCALLOC(rt_entry->frags_collected_total_len + 1, sizeof(uint8_t)); + uint8_t *ptr = reasm_buf; + for(la_list *l = rt_entry->fragment_list; l != NULL; l = la_list_next(l)) { + la_octet_string *ostring = l->data; + memcpy(ptr, ostring->buf, ostring->len); + ptr += ostring->len; + } + reasm_buf[rt_entry->frags_collected_total_len] = '\0'; // buffer len is frags_collected_total_len + 1 + *result = reasm_buf; + result_len = rt_entry->frags_collected_total_len; + la_hash_remove(rtable->fragment_table, tmp_key); +end: + LA_XFREE(tmp_key); + return result_len; +} + +char const *la_reasm_status_name_get(la_reasm_status status) { + static char const *reasm_status_names[] = { + [LA_REASM_UNKNOWN] = "unknown", + [LA_REASM_COMPLETE] = "complete", + [LA_REASM_IN_PROGRESS] = "in progress", + [LA_REASM_SKIPPED] = "skipped", + [LA_REASM_DUPLICATE] = "duplicate", + [LA_REASM_FRAG_OUT_OF_SEQUENCE] = "out of sequence", + [LA_REASM_ARGS_INVALID] = "invalid args" + }; + if(status < 0 || status > LA_REASM_STATUS_MAX) { + return NULL; + } + return reasm_status_names[status]; +} diff --git a/plugins/inmarsat_support/aero/libacars/reassembly.h b/plugins/inmarsat_support/aero/libacars/reassembly.h new file mode 100644 index 000000000..d0d4b2f31 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/reassembly.h @@ -0,0 +1,99 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#ifndef LA_REASSEMBLY_H +#define LA_REASSEMBLY_H 1 + +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifndef _MSC_VER +#include +#else +#include +#endif +#include + +typedef struct la_reasm_ctx_s la_reasm_ctx; +typedef struct la_reasm_table_s la_reasm_table; + +typedef void *(la_reasm_get_key_func)(void const *msg); +typedef la_hash_func la_reasm_hash_func; +typedef la_hash_compare_func la_reasm_compare_func; +typedef la_hash_key_destroy_func la_reasm_key_destroy_func; +typedef struct { + la_reasm_get_key_func *get_key; + la_reasm_get_key_func *get_tmp_key; + la_reasm_hash_func *hash_key; + la_reasm_compare_func *compare_keys; + la_reasm_key_destroy_func *destroy_key; +} la_reasm_table_funcs; + +#define SEQ_FIRST_NONE -1 +#define SEQ_WRAP_NONE -1 + +typedef struct { + void const *msg_info; /* pointer to message metadata (eg. header), + used as hash key */ + + uint8_t *msg_data; /* packet data buffer */ + + int msg_data_len; /* packet data buffer length */ + + int total_pdu_len; /* Total length of the reassembled message. + If > 0, then reassembly is completed when + total length of collected fragments reaches + this value. If <= 0, then caller must signal + the final fragment using is_final_fragment flag. */ + + struct timeval rx_time; /* fragment receive timestamp */ + + struct timeval reasm_timeout; /* reassembly timeout to be applied to this message */ + + int seq_num; /* sequence number of this fragment (non-negative) */ + + int seq_num_first; /* this sequence number indicates the first fragment + of the message (SEQ_FIRST_NONE if there is no + indication of the first fragment) */ + + int seq_num_wrap; /* the value at which the sequence number wraps + to 0 (SEQ_WRAP_NONE if it doesn't wrap) */ + + bool is_final_fragment; /* is this the final fragment of this message? */ + +// reserved for future use + void (*reserved0)(void); + void (*reserved1)(void); + void (*reserved2)(void); + void (*reserved3)(void); +} la_reasm_fragment_info; + +typedef enum { + LA_REASM_UNKNOWN, + LA_REASM_COMPLETE, + LA_REASM_IN_PROGRESS, + LA_REASM_SKIPPED, + LA_REASM_DUPLICATE, + LA_REASM_FRAG_OUT_OF_SEQUENCE, + LA_REASM_ARGS_INVALID +} la_reasm_status; +#define LA_REASM_STATUS_MAX LA_REASM_ARGS_INVALID + +// reassembly.c +la_reasm_ctx *la_reasm_ctx_new(); +void la_reasm_ctx_destroy(void *ctx); +la_reasm_table *la_reasm_table_new(la_reasm_ctx *rctx, void const *table_id, + la_reasm_table_funcs funcs, int cleanup_interval); +la_reasm_table *la_reasm_table_lookup(la_reasm_ctx *rctx, void const *table_id); +la_reasm_status la_reasm_fragment_add(la_reasm_table *rtable, la_reasm_fragment_info const *finfo); +int la_reasm_payload_get(la_reasm_table *rtable, void const *msg_info, uint8_t **result); +char const *la_reasm_status_name_get(la_reasm_status status); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_REASSEMBLY_H diff --git a/plugins/inmarsat_support/aero/libacars/util.c b/plugins/inmarsat_support/aero/libacars/util.c new file mode 100644 index 000000000..a7cdb1db1 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/util.c @@ -0,0 +1,261 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#include // fprintf +#include +#include // calloc, realloc, free +#include // strerror, strlen, strdup, strnlen, strspn, strpbrk +#include // struct tm +#include // CHAR_BIT +#include // errno +#ifdef WIN32 +#else +#include // _exit +#endif +#include "config.h" // HAVE_STRSEP, WITH_LIBXML2 +#ifdef WITH_LIBXML2 +#include // xmlParseDoc +#include // xmlBuffer.*, xmlNodeDump, xmlDocGetRootElement, xmlFreeDoc +#include // initGenericErrorDefaultFunc, xmlGenericError +#endif +#include // la_debug_print() +#include + +void *la_xcalloc(size_t nmemb, size_t size, char const *file, int line, char const *func) { + void *ptr = calloc(nmemb, size); + if(ptr == NULL) { + fprintf(stderr, "%s:%d: %s(): calloc(%zu, %zu) failed: %s\n", + file, line, func, nmemb, size, strerror(errno)); + _exit(1); + } + return ptr; +} + +void *la_xrealloc(void *ptr, size_t size, char const *file, int line, char const *func) { + ptr = realloc(ptr, size); + if(ptr == NULL) { + fprintf(stderr, "%s:%d: %s(): realloc(%zu) failed: %s\n", + file, line, func, size, strerror(errno)); + _exit(1); + } + return ptr; +} + +size_t la_slurp_hexstring(char* string, uint8_t **buf) { + if(string == NULL) + return 0; + size_t slen = strlen(string); + if(slen & 1) + slen--; + size_t dlen = slen / 2; + if(dlen == 0) + return 0; + *buf = LA_XCALLOC(dlen, sizeof(uint8_t)); + + for(size_t i = 0; i < slen; i++) { + char c = string[i]; + int value = 0; + if(c >= '0' && c <= '9') { + value = (c - '0'); + } else if (c >= 'A' && c <= 'F') { + value = (10 + (c - 'A')); + } else if (c >= 'a' && c <= 'f') { + value = (10 + (c - 'a')); + } else { + la_debug_print(D_ERROR, "stopped at invalid char %u at pos %zu\n", c, i); + return i/2; + } + (*buf)[(i/2)] |= value << (((i + 1) % 2) * 4); + } + return dlen; +} + +char *la_hexdump(uint8_t *data, size_t len) { + static char const hex[] = "0123456789abcdef"; + if(data == NULL) return strdup(""); + if(len == 0) return strdup(""); + + size_t rows = len / 16; + if((len & 0xf) != 0) { + rows++; + } + size_t rowlen = 16 * 2 + 16; // 32 hex digits + 16 spaces per row + rowlen += 16; // ASCII characters per row + rowlen += 10; // extra space for separators + size_t alloc_size = rows * rowlen + 1; // terminating NULL + char *buf = LA_XCALLOC(alloc_size, sizeof(char)); + char *ptr = buf; + size_t i = 0, j = 0; + while(i < len) { + for(j = i; j < i + 16; j++) { + if(j < len) { + *ptr++ = hex[((data[j] >> 4) & 0xf)]; + *ptr++ = hex[data[j] & 0xf]; + } else { + *ptr++ = ' '; + *ptr++ = ' '; + } + *ptr++ = ' '; + if(j == i + 7) { + *ptr++ = ' '; + } + } + *ptr++ = ' '; + *ptr++ = '|'; + for(j = i; j < i + 16; j++) { + if(j < len) { + if(data[j] < 32 || data[j] > 126) { + *ptr++ = '.'; + } else { + *ptr++ = data[j]; + } + } else { + *ptr++ = ' '; + } + if(j == i + 7) { + *ptr++ = ' '; + } + } + *ptr++ = '|'; + *ptr++ = '\n'; + i += 16; + } + return buf; +} + +int la_strntouint16_t(char const *txt, int charcnt) { + if(txt == NULL || + charcnt < 1 || + charcnt > 9 || // prevent overflowing int + strnlen(txt, charcnt) < (size_t)charcnt) + { + return -1; + } + int ret = 0; + int base = 1; + int j; + for(int i = 0; i < charcnt; i++) { + j = charcnt - 1 - i; + if(txt[j] < '0' || txt[j] > '9') { + return -2; + } + ret += (txt[j] - '0') * base; + base *= 10; + } + return ret; +} + +// returns the length of the string ignoring the terminating +// newline characters +size_t chomped_strlen(char const *s) { + char *p = strchr(s, '\0'); + size_t ret = p - s; + while(--p >= s) { + if(*p != '\n' && *p != '\r') { + break; + } + ret--; + } + return ret; +} + +// parse and perform basic sanitization of timestamp +// in YYMMDDHHMMSS format. +// Do not use strptime() - it's not available on WIN32 +// Do not use sscanf() - it's too liberal on the input +// (we do not want whitespaces between fields, for example) +char *la_simple_strptime(char const *s, struct tm *t) { + if(strspn(s, "0123456789") < 12) { + return NULL; + } + t->tm_year = ATOI2(s[0], s[1]) + 100; + t->tm_mon = ATOI2(s[2], s[3]) - 1; + t->tm_mday = ATOI2(s[4], s[5]); + t->tm_hour = ATOI2(s[6], s[7]); + t->tm_min = ATOI2(s[8], s[9]); + t->tm_sec = ATOI2(s[10], s[11]); + t->tm_isdst = -1; + if(t->tm_mon > 11 || t->tm_mday > 31 || t->tm_hour > 23 || t->tm_min > 59 || t->tm_sec > 59) { + return NULL; + } + return (char *)s + 12; +} + +la_octet_string *la_octet_string_new(void *buf, size_t len) { + LA_NEW(la_octet_string, ostring); + ostring->buf = buf; + ostring->len = len; + return ostring; +} + +void la_octet_string_destroy(void *ostring_ptr) { + if(ostring_ptr == NULL) { + return; + } + la_octet_string *ostring = ostring_ptr; + LA_XFREE(ostring->buf); + LA_XFREE(ostring); +} + +#ifndef HAVE_STRSEP +char *la_strsep(char **stringp, char const *delim) { + char *start = *stringp; + char *p; + + p = (start != NULL) ? strpbrk(start, delim) : NULL; + if (p == NULL) { + *stringp = NULL; + } else { + *p = '\0'; + *stringp = p + 1; + } + return start; +} +#endif + +#ifdef WITH_LIBXML2 +void la_xml_errfunc_noop(void * ctx, char const *msg, ...) { + (void)ctx; + (void)msg; +} + +xmlBufferPtr la_prettify_xml(char const *buf) { + if(buf == NULL) { + return NULL; + } + // Disables printing XML parser errors to stderr by setting error handler to noop. + // Can't do this once in library constructor, because this is a per-thread setting. + if(xmlGenericError != la_xml_errfunc_noop) { + xmlGenericErrorFunc errfuncptr = la_xml_errfunc_noop; + initGenericErrorDefaultFunc(&errfuncptr); + } + xmlDocPtr doc = xmlParseDoc((uint8_t const *)buf); + if(doc == NULL) { + return NULL; + } + xmlBufferPtr outbufptr = xmlBufferCreate(); + int result_len = xmlNodeDump(outbufptr, doc, xmlDocGetRootElement(doc), 0, 1); + xmlFreeDoc(doc); + if(result_len > 0) { + return outbufptr; + } + xmlBufferFree(outbufptr); + return NULL; +} +#endif + +uint32_t la_reverse(uint32_t v, int numbits) { + uint32_t r = v; // r will be reversed bits of v; first get LSB of v + int s = sizeof(v) * CHAR_BIT - 1; // extra shift needed at end + + for (v >>= 1; v; v >>= 1) { + r <<= 1; + r |= v & 1; + s--; + } + r <<= s; // shift when v's highest bits are zero + r >>= 32 - numbits; + return r; +} diff --git a/plugins/inmarsat_support/aero/libacars/util.h b/plugins/inmarsat_support/aero/libacars/util.h new file mode 100644 index 000000000..77e0ce8af --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/util.h @@ -0,0 +1,51 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ +#ifndef LA_UTIL_H +#define LA_UTIL_H 1 +#include +#include // size_t +#include // free() +#include // struct tm +#include "config.h" // HAVE_STRSEP, WITH_LIBXML2 +#ifdef WITH_LIBXML2 +#include // xmlBufferPtr +#endif + +typedef struct { + uint8_t *buf; + size_t len; +} la_octet_string; + +void *la_xcalloc(size_t nmemb, size_t size, char const *file, int line, char const *func); +void *la_xrealloc(void *ptr, size_t size, char const *file, int line, char const *func); + +#define LA_XCALLOC(nmemb, size) la_xcalloc((nmemb), (size), __FILE__, __LINE__, __func__) +#define LA_XREALLOC(ptr, size) la_xrealloc((ptr), (size), __FILE__, __LINE__, __func__) +#define LA_XFREE(ptr) do { free(ptr); ptr = NULL; } while(0) + +#ifdef HAVE_STRSEP +#include +#define LA_STRSEP strsep +#else +char *la_strsep(char **stringp, char const *delim); +#define LA_STRSEP la_strsep +#endif + +#define ATOI2(x,y) (10 * ((x) - '0') + ((y) - '0')) + +size_t la_slurp_hexstring(char *string, uint8_t **buf); +char *la_hexdump(uint8_t *data, size_t len); +int la_strntouint16_t(char const *txt, int charcnt); +size_t chomped_strlen(char const *s); +char *la_simple_strptime(char const *s, struct tm *t); +la_octet_string *la_octet_string_new(void *buf, size_t len); +void la_octet_string_destroy(void *ostring_ptr); +#ifdef WITH_LIBXML2 +xmlBufferPtr la_prettify_xml(char const *buf); +#endif +uint32_t la_reverse(uint32_t v, int numbits); + +#endif // !LA_UTIL_H diff --git a/plugins/inmarsat_support/aero/libacars/version.h b/plugins/inmarsat_support/aero/libacars/version.h new file mode 100644 index 000000000..2496e171d --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/version.h @@ -0,0 +1,20 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_VERSION_H +#define LA_VERSION_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +extern char const * const LA_VERSION; + +#ifdef __cplusplus +} +#endif + +#endif // !LA_VERSION_H diff --git a/plugins/inmarsat_support/aero/libacars/vstring.c b/plugins/inmarsat_support/aero/libacars/vstring.c new file mode 100644 index 000000000..77d1e7446 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/vstring.c @@ -0,0 +1,118 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#include // INT_MAX +#include // vsnprintf +#include +#include +#include +#include // memcpy, strdup, strsep +#include // la_assert, la_debug_print +#include // LA_XCALLOC, LA_XFREE, LA_STRSEP +#include // la_vstring + +#define LA_VSTR_INITIAL_SIZE 256 +#define LA_VSTR_SIZE_MULT 2 +#define LA_VSTR_SIZE_MAX INT_MAX + +static void la_vstring_grow(la_vstring *vstr, size_t space_needed) { + la_assert(vstr); + + size_t new_size = vstr->allocated_size; + while(vstr->len + space_needed >= new_size) { + new_size *= LA_VSTR_SIZE_MULT; + } + la_debug_print(D_VERBOSE, "allocated_size=%zu len=%zu space_needed=%zu new_size: %zu\n", + vstr->allocated_size, vstr->len, space_needed, new_size); + la_assert(new_size <= LA_VSTR_SIZE_MAX); + vstr->str = LA_XREALLOC(vstr->str, new_size); + vstr->allocated_size = new_size; +} + +static size_t la_vstring_space_left(la_vstring const *vstr) { + la_assert(vstr); + la_assert(vstr->allocated_size >= vstr->len); + return vstr->allocated_size - vstr->len; +} + +la_vstring *la_vstring_new() { + LA_NEW(la_vstring, vstr); + vstr->str = LA_XCALLOC(LA_VSTR_INITIAL_SIZE, sizeof(char)); + vstr->allocated_size = LA_VSTR_INITIAL_SIZE; + vstr->len = 0; + return vstr; +} + +void la_vstring_destroy(la_vstring *vstr, bool destroy_buffer) { + if(vstr && destroy_buffer == true) { + LA_XFREE(vstr->str); + } + LA_XFREE(vstr); +} + +void la_isprintf_multiline_text(la_vstring *vstr, int indent, char const *txt) { + la_assert(vstr != NULL); + la_assert(indent >= 0); + if(txt == NULL) { + return; + } + // have to work on a copy, because strsep modifies its first argument + char *copy = strdup(txt); + char *ptr = copy; + char *line = NULL; + do { + line = LA_STRSEP(&ptr, "\n"); + LA_ISPRINTF(vstr, indent, "%s\n", line); + } while(ptr != NULL && ptr[0] != '\0'); + LA_XFREE(copy); +} + +void la_vstring_append_sprintf(la_vstring *vstr, char const *fmt, ...) { + la_assert(vstr); + la_assert(fmt); + + size_t space_left = la_vstring_space_left(vstr); + size_t result_size; + int ret; + va_list ap; + va_start(ap, fmt); + ret = vsnprintf(vstr->str + vstr->len, space_left, fmt, ap); + va_end(ap); + la_assert(ret >= 0); + result_size = 1 + (size_t)ret; + if(result_size < space_left) { // we have enough space + goto end; + } else { + // Not enough space - realloc and retry once + la_vstring_grow(vstr, result_size); + space_left = la_vstring_space_left(vstr); + va_start(ap, fmt); + ret = vsnprintf(vstr->str + vstr->len, space_left, fmt, ap); + va_end(ap); + la_assert(ret >= 0); + result_size = 1 + (size_t)ret; + la_assert(result_size < space_left); + } +end: + vstr->len += result_size - 1; // not including '\0' + return; +} + +void la_vstring_append_buffer(la_vstring *vstr, void const *buffer, size_t len) { + la_assert(vstr); + if(buffer == NULL || len == 0) { + return; + } + size_t space_left = la_vstring_space_left(vstr); + if(len >= space_left) { + la_vstring_grow(vstr, len); + } + la_assert(vstr->len + len <= LA_VSTR_SIZE_MAX); + memcpy(vstr->str + vstr->len, buffer, len); + vstr->len += len; + vstr->str[vstr->len] = '\0'; + return; +} diff --git a/plugins/inmarsat_support/aero/libacars/vstring.h b/plugins/inmarsat_support/aero/libacars/vstring.h new file mode 100644 index 000000000..de1f5bc56 --- /dev/null +++ b/plugins/inmarsat_support/aero/libacars/vstring.h @@ -0,0 +1,48 @@ +/* + * This file is a part of libacars + * + * Copyright (c) 2018-2021 Tomasz Lemiech + */ + +#ifndef LA_VSTRING_H +#define LA_VSTRING_H 1 + +#include // size_t +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __GNUC__ +#ifdef __MINGW32__ +#define LA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (gnu_printf, a, b))) +#else +#define LA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b))) +#endif +#else +#define LA_GCC_PRINTF_ATTR(a,b) +#endif + +// la_vstring_append_sprintf with variable indentation +#define LA_ISPRINTF(vstr, i, f, ...) la_vstring_append_sprintf(vstr, "%*s" f, i, "", ##__VA_ARGS__) + +#define LA_EOL(x) la_vstring_append_sprintf((x), "%s", "\n") + +typedef struct { + char *str; // string buffer pointer + size_t len; // current length of the string (excl. '\0') + size_t allocated_size; // current allocated buffer size (ie. max len = allocated_len - 1) +} la_vstring; + +la_vstring *la_vstring_new(); +void la_vstring_destroy(la_vstring *vstr, bool destroy_buffer); +void la_vstring_append_sprintf(la_vstring *vstr, char const *fmt, ...) LA_GCC_PRINTF_ATTR(2, 3); +void la_vstring_append_buffer(la_vstring *vstr, void const *buffer, size_t size); +void la_isprintf_multiline_text(la_vstring *vstr, int indent, char const *txt); + +#ifdef __cplusplus +} +#endif + +#endif // !LA_VSTRING_H diff --git a/plugins/inmarsat_support/aero/module_aero_parser.cpp b/plugins/inmarsat_support/aero/module_aero_parser.cpp index 379a7dfb6..2e4bc5425 100644 --- a/plugins/inmarsat_support/aero/module_aero_parser.cpp +++ b/plugins/inmarsat_support/aero/module_aero_parser.cpp @@ -183,7 +183,11 @@ namespace inmarsat final_pkt = ac.value(); final_pkt["msg_name"] = "ACARS"; final_pkt["signal_unit"] = wip_user_data.isu; - logger->info("ACARS message ({:s}) : \n {:s}", + auto libac = acars::parse_libacars(ac.value(), la_msg_dir::LA_MSG_DIR_GND2AIR); + if (!libac.empty()) + final_pkt["libacars"] = libac; + // logger->critical(final_pkt["libacars"].dump(4)); + logger->info("ACARS message ({:s}) : \n{:s}", final_pkt["plane_reg"].get().c_str(), final_pkt["message"].get().c_str()); } diff --git a/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt b/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt index 891fb7dbc..f7432eba6 100644 --- a/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt @@ -1,21 +1,39 @@ -cmake_minimum_required (VERSION 3.0.0) +cmake_minimum_required(VERSION 3.0.0) project(bladerf_sdr_support) - +include(CheckCXXSourceCompiles) find_library(BLADERF_LIBRARY bladeRF) -if(BLADERF_LIBRARY OR MSVC)# OR ANDROID) +if(BLADERF_LIBRARY OR MSVC) # OR ANDROID) message("Building with BladeRF support") file(GLOB_RECURSE bladerf_sdr_support_CPPS *.cpp) add_library(bladerf_sdr_support SHARED ${bladerf_sdr_support_CPPS}) + set(BLADERF_WIDEBAND_TEST_SOURCE + " + #include + int main() { + bladerf *bladerf_dev_obj; + bladerf_set_feature(bladerf_dev_obj, BLADERF_FEATURE_OVERSAMPLE); + } + ") + if(MSVC) target_link_libraries(bladerf_sdr_support PUBLIC satdump_core bladerf.dll) + set(CMAKE_REQUIRED_LIBRARIES bladerf.dll) + check_cxx_source_compiles("${BLADERF_WIDEBAND_TEST_SOURCE}" BLADERF_HAVE_WIDEBAND) elseif(ANDROID) target_link_libraries(bladerf_sdr_support PUBLIC satdump_core bladerf usb) target_include_directories(bladerf_sdr_support PUBLIC ../../../android/deps/libbladerf) else() target_link_libraries(bladerf_sdr_support PUBLIC satdump_core ${BLADERF_LIBRARY}) + set(CMAKE_REQUIRED_LIBRARIES ${BLADERF_LIBRARY}) + check_cxx_source_compiles("${BLADERF_WIDEBAND_TEST_SOURCE}" BLADERF_HAVE_WIDEBAND) + endif() + + if(BLADERF_HAVE_WIDEBAND) + message("libBladeRF has wideband feature, enabling support!") + target_compile_definitions(bladerf_sdr_support PUBLIC BLADERF_HAS_WIDEBAND=1) endif() target_include_directories(bladerf_sdr_support PUBLIC src) diff --git a/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.cpp b/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.cpp index fb0fd04b5..f37b9ee57 100644 --- a/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.cpp +++ b/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.cpp @@ -116,8 +116,34 @@ void BladeRFSource::start() if (bladerf_open_with_devinfo(&bladerf_dev_obj, &devs_list[selected_dev_id]) != 0) throw std::runtime_error("Could not open BladeRF device!"); +#ifdef BLADERF_HAS_WIDEBAND + if (current_samplerate > 61.44e6) + { + is_8bit = true; + if (bladerf_set_feature(bladerf_dev_obj, BLADERF_FEATURE_OVERSAMPLE) != 0) + logger->error("Could not set Oversample mode"); + logger->debug("Using BladeRF Wideband mode"); + } + else + { + is_8bit = false; + if (bladerf_set_feature(bladerf_dev_obj, BLADERF_FEATURE_DEFAULT) != 0) + logger->error("Could not set Default mode"); + logger->debug("Using BladeRF Default mode"); + } +#endif + logger->debug("Set BladeRF samplerate to " + std::to_string(current_samplerate)); - bladerf_set_sample_rate(bladerf_dev_obj, BLADERF_CHANNEL_RX(channel_id), current_samplerate, NULL); + + // bladerf_set_sample_rate(bladerf_dev_obj, BLADERF_CHANNEL_RX(channel_id), current_samplerate, NULL); + struct bladerf_rational_rate rational_rate, actual; + rational_rate.integer = static_cast(current_samplerate); + rational_rate.den = 10000; + rational_rate.num = (current_samplerate - rational_rate.integer) * rational_rate.den; + bladerf_set_rational_sample_rate(bladerf_dev_obj, BLADERF_CHANNEL_RX(channel_id), &rational_rate, &actual); + uint64_t actuals = actual.integer + (actual.num / static_cast(actual.den)); + logger->info("Actual samplerate {:d}", actuals); + bladerf_set_bandwidth(bladerf_dev_obj, BLADERF_CHANNEL_RX(channel_id), std::clamp(current_samplerate, bladerf_range_bandwidth->min, bladerf_range_bandwidth->max), NULL); // Setup and start streaming @@ -125,7 +151,11 @@ void BladeRFSource::start() sample_buffer_size = (sample_buffer_size / 1024) * 1024; if (sample_buffer_size < 1024) sample_buffer_size = 1024; +#ifdef BLADERF_HAS_WIDEBAND + bladerf_sync_config(bladerf_dev_obj, BLADERF_RX_X1, is_8bit ? BLADERF_FORMAT_SC8_Q7 : BLADERF_FORMAT_SC16_Q11, 16, sample_buffer_size, 8, 4000); +#else bladerf_sync_config(bladerf_dev_obj, BLADERF_RX_X1, BLADERF_FORMAT_SC16_Q11, 16, sample_buffer_size, 8, 4000); +#endif bladerf_enable_module(bladerf_dev_obj, BLADERF_CHANNEL_RX(channel_id), true); thread_should_run = true; diff --git a/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.h b/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.h index bb93d6d2a..f98eed979 100644 --- a/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.h +++ b/plugins/sdr_sources/bladerf_sdr_support/bladerf_sdr.h @@ -37,25 +37,45 @@ protected: void set_bias(); int sample_buffer_size = 8192; - int16_t *sample_buffer; + + bool is_8bit = false; std::thread work_thread; bool thread_should_run = false; void mainThread() { + int16_t *sample_buffer; + int8_t *sample_buffer_8; bladerf_metadata meta; - sample_buffer = new int16_t[dsp::STREAM_BUFFER_SIZE * 2]; - - while (thread_should_run) + if (is_8bit) { - if (bladerf_sync_rx(bladerf_dev_obj, sample_buffer, sample_buffer_size, &meta, 4000) != 0) - std::this_thread::sleep_for(std::chrono::seconds(1)); - volk_16i_s32f_convert_32f((float *)output_stream->writeBuf, sample_buffer, 4096.0f, sample_buffer_size * 2); - output_stream->swap(sample_buffer_size); - } + sample_buffer_8 = new int8_t[dsp::STREAM_BUFFER_SIZE * 2]; - delete[] sample_buffer; + while (thread_should_run) + { + if (bladerf_sync_rx(bladerf_dev_obj, sample_buffer_8, sample_buffer_size, &meta, 4000) != 0) + std::this_thread::sleep_for(std::chrono::seconds(1)); + volk_8i_s32f_convert_32f((float *)output_stream->writeBuf, sample_buffer_8, 127.0f, sample_buffer_size * 2); + output_stream->swap(sample_buffer_size); + } + + delete[] sample_buffer_8; + } + else + { + sample_buffer = new int16_t[dsp::STREAM_BUFFER_SIZE * 2]; + + while (thread_should_run) + { + if (bladerf_sync_rx(bladerf_dev_obj, sample_buffer, sample_buffer_size, &meta, 4000) != 0) + std::this_thread::sleep_for(std::chrono::seconds(1)); + volk_16i_s32f_convert_32f((float *)output_stream->writeBuf, sample_buffer, 4096.0f, sample_buffer_size * 2); + output_stream->swap(sample_buffer_size); + } + + delete[] sample_buffer; + } } public: diff --git a/src-core/common/dsp/resamp/power_decim.cpp b/src-core/common/dsp/resamp/power_decim.cpp index e0c48ddd9..64c071dd4 100644 --- a/src-core/common/dsp/resamp/power_decim.cpp +++ b/src-core/common/dsp/resamp/power_decim.cpp @@ -13,14 +13,14 @@ namespace dsp { int id = log2(d_decimation) - 1; - if (id > power_decim::plans_len) + if (id > (int)power_decim::plans_len) throw std::runtime_error("Power Decimator Plan ID over 13!"); if ((d_decimation & (d_decimation - 1)) != 0) throw std::runtime_error("Power Decimator Plan decimation is NOT a power of 2!"); power_decim::plan plan = power_decim::plans[id]; - for (int i = 0; i < plan.stageCount; i++) + for (int i = 0; i < (int)plan.stageCount; i++) { auto &s = plan.stages[i]; std::vector taps = std::vector(s.taps, s.taps + s.tapcount); diff --git a/src-core/common/lrit/lrit_demux.cpp b/src-core/common/lrit/lrit_demux.cpp index ae3695ee4..3dfc37e48 100644 --- a/src-core/common/lrit/lrit_demux.cpp +++ b/src-core/common/lrit/lrit_demux.cpp @@ -67,6 +67,7 @@ namespace lrit current_file.lrit_data.clear(); processLRITHeader(current_file, pkt); + current_file.vcid = vcdu.vcid; current_file.header_parsed = false; current_file.file_in_progress = true; } diff --git a/src-core/common/lrit/lrit_file.h b/src-core/common/lrit/lrit_file.h index 293465ae9..7f1910899 100644 --- a/src-core/common/lrit/lrit_file.h +++ b/src-core/common/lrit/lrit_file.h @@ -103,6 +103,8 @@ namespace lrit struct LRITFile { + int vcid = -1; + bool file_in_progress = false; bool header_parsed = false;