diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 0e8996072..89d4789c2 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include // for typeid @@ -121,13 +122,6 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) d_osnma_data.d_nma_header.cid = get_cid(nma_header); d_osnma_data.d_nma_header.cpks = get_cpks(nma_header); d_osnma_data.d_nma_header.reserved = get_nma_header_reserved(nma_header); - - // debug - const auto it = OSNMA_TABLE_2.find(d_osnma_data.d_nma_header.cpks); - if (it != OSNMA_TABLE_2.cend()) - { - LOG(WARNING) << "Chain and Public Key Status: " << it->second; - } } @@ -194,10 +188,9 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ dsm_msg[i * 13 + j] = d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][i * 13 + j]; } } - process_dsm_message(dsm_msg); d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; - // d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; + process_dsm_message(dsm_msg); } } @@ -273,7 +266,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); for (uint32_t k = 0; k < l_ds_bytes; k++) { - d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; + d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } // validation? } @@ -291,7 +284,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_pkr_message.npkt = (dsm_msg[129] & 0b11110000) >> 4; d_osnma_data.d_dsm_pkr_message.npktid = (dsm_msg[129] & 0b00001111); - // Table 5 uint32_t l_npk = 0; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); if (it != OSNMA_TABLE_5.cend()) @@ -343,25 +335,34 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } - read_mack_header(osnma_msg); - read_mack_info_and_tags(osnma_msg); - read_mack_key(osnma_msg); - read_mack_padding(osnma_msg); + read_mack_header(); + read_mack_info_and_tags(); + read_mack_key(); + read_mack_padding(); } -void osnma_msg_receiver::read_mack_header(const std::shared_ptr& osnma_msg) + +void osnma_msg_receiver::read_mack_header() { + uint8_t lt_bits = 0; + const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it != OSNMA_TABLE_11.cend()) + { + lt_bits = it->second; + } } -void osnma_msg_receiver::read_mack_info_and_tags(const std::shared_ptr& osnma_msg) + +void osnma_msg_receiver::read_mack_info_and_tags() { } -void osnma_msg_receiver::read_mack_key(const std::shared_ptr& osnma_msg) +void osnma_msg_receiver::read_mack_key() { } -void osnma_msg_receiver::read_mack_padding(const std::shared_ptr& osnma_msg) + +void osnma_msg_receiver::read_mack_padding() { } \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 65bcac037..56790d9df 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -62,10 +62,10 @@ private: void read_mack_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg); - void read_mack_header(const std::shared_ptr& osnma_msg); - void read_mack_info_and_tags(const std::shared_ptr& osnma_msg); - void read_mack_key(const std::shared_ptr& osnma_msg); - void read_mack_padding(const std::shared_ptr& osnma_msg); + void read_mack_header(); + void read_mack_info_and_tags(); + void read_mack_key(); + void read_mack_padding(); std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 6e0b1a6f8..9d243d6fc 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -123,6 +123,25 @@ const std::unordered_map OSNMA_TABLE_10 = { {15, 0}, {15, 0}}; // key: ks, value: lk_bits +const std::unordered_map OSNMA_TABLE_11 = { + {0, 0}, + {1, 0}, + {2, 0}, + {3, 0}, + {4, 0}, + {5, 20}, + {6, 24}, + {7, 26}, + {8, 32}, + {9, 40}, + {10, 0}, + {11, 0}, + {12, 0}, + {13, 0}, + {14, 0}, + {15, 0}, +}; + const std::unordered_map OSNMA_TABLE_15 = { {std::string("ECDSA P-256"), 512}, {std::string("ECDSA P-521"), 1056},