diff --git a/include/l2/logical_link_control_packet.hpp b/include/l2/logical_link_control_packet.hpp index 17833cb..d4e3dec 100644 --- a/include/l2/logical_link_control_packet.hpp +++ b/include/l2/logical_link_control_packet.hpp @@ -62,6 +62,7 @@ auto operator<<(std::ostream& stream, const BasicLinkInformation& bli) -> std::o /// The packet that is parsed in the logical link control layer. Currently we only implement basic link. struct LogicalLinkControlPacket : public UpperMacCPlaneSignallingPacket { std::optional basic_link_information_; + /// The data that is passed from the Logical Link Control layer to the Mobile Link Entity BitVector tl_sdu_; LogicalLinkControlPacket() = delete; diff --git a/include/l2/logical_link_control_parser.hpp b/include/l2/logical_link_control_parser.hpp index 3f45fdf..5f22aa6 100644 --- a/include/l2/logical_link_control_parser.hpp +++ b/include/l2/logical_link_control_parser.hpp @@ -54,7 +54,7 @@ class LogicalLinkControlParser : public PacketParser std::string override { + [[nodiscard]] auto packet_name(const LogicalLinkControlPacket& packet) const -> std::string override { auto pdu_type = packet.tm_sdu_->look<4>(0); if (pdu_type == kSupplementaryLlcPdu) { diff --git a/include/l3/circuit_mode_control_entity_parser.hpp b/include/l3/circuit_mode_control_entity_parser.hpp index c2fdfd7..bb0f884 100644 --- a/include/l3/circuit_mode_control_entity_parser.hpp +++ b/include/l3/circuit_mode_control_entity_parser.hpp @@ -19,7 +19,7 @@ class CircuitModeControlEntityParser : public PacketParser std::string override { + [[nodiscard]] auto packet_name(const CircuitModeControlEntityPacket& packet) const -> std::string override { return to_string(packet.packet_type_); }; diff --git a/include/l3/mobile_link_entity_parser.hpp b/include/l3/mobile_link_entity_parser.hpp index 9ef050b..d3fd014 100644 --- a/include/l3/mobile_link_entity_parser.hpp +++ b/include/l3/mobile_link_entity_parser.hpp @@ -41,7 +41,7 @@ class MobileLinkEntityParser : public PacketParser std::string override { + [[nodiscard]] auto packet_name(const MobileLinkEntityPacket& packet) const -> std::string override { if (packet.mle_protocol_ == MobileLinkEntityProtocolDiscriminator::kMleProtocol) { auto pdu_type = packet.sdu_.look<3>(0); diff --git a/include/l3/mobile_management_parser.hpp b/include/l3/mobile_management_parser.hpp index a7d0b90..3de3782 100644 --- a/include/l3/mobile_management_parser.hpp +++ b/include/l3/mobile_management_parser.hpp @@ -19,7 +19,7 @@ class MobileManagementParser : public PacketParser std::string override { + [[nodiscard]] auto packet_name(const MobileManagementPacket& packet) const -> std::string override { return to_string(packet.packet_type_); } diff --git a/include/l3/short_data_service_parser.hpp b/include/l3/short_data_service_parser.hpp index af6762c..4abd864 100644 --- a/include/l3/short_data_service_parser.hpp +++ b/include/l3/short_data_service_parser.hpp @@ -63,7 +63,7 @@ class ShortDataServiceParser : public PacketParser std::string override { + [[nodiscard]] auto packet_name(const ShortDataServicePacket& packet) const -> std::string override { return sds_pdu_description_.at(packet.protocol_identifier_); } diff --git a/include/utils/packet_parser.hpp b/include/utils/packet_parser.hpp index 1c54da5..e2bc719 100644 --- a/include/utils/packet_parser.hpp +++ b/include/utils/packet_parser.hpp @@ -47,7 +47,7 @@ template class PacketParser { protected: /// This function needs to be implemented for each parsing layer. It should return the correct packet name. - virtual auto packet_name(const Output&) -> std::string = 0; + [[nodiscard]] virtual auto packet_name(const Output&) const -> std::string = 0; /// This function take the currently parsed packet and should forward it to the next parsing stage or return a /// unique pointer to it. diff --git a/include/utils/type234_parser.hpp b/include/utils/type234_parser.hpp index fe6bd73..696b0e2 100644 --- a/include/utils/type234_parser.hpp +++ b/include/utils/type234_parser.hpp @@ -91,6 +91,8 @@ template class Type234Parser { // Is this a type 4 element? if (allowed_type4_elements_.count(element_identifier)) { const auto repeated_elements = data.take<6>(); + // The length_indicator is the "Total length of the following type 4 Elements in bits (including the + // Number of repeated elements)" const auto element_data = data.take_vector(length_indicator - 6); if (elements.count(element_identifier)) { throw std::runtime_error("This element identifier already occured.");