Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Jul 8, 2024
1 parent 2daf2a9 commit 9c39215
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions include/l2/logical_link_control_packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<BasicLinkInformation> basic_link_information_;
/// The data that is passed from the Logical Link Control layer to the Mobile Link Entity
BitVector tl_sdu_;

LogicalLinkControlPacket() = delete;
Expand Down
2 changes: 1 addition & 1 deletion include/l2/logical_link_control_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class LogicalLinkControlParser : public PacketParser<UpperMacCPlaneSignallingPac
};

private:
auto packet_name(const LogicalLinkControlPacket& packet) -> 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) {
Expand Down
2 changes: 1 addition & 1 deletion include/l3/circuit_mode_control_entity_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CircuitModeControlEntityParser : public PacketParser<MobileLinkEntityPacke
, sds_(prometheus_exporter){};

private:
auto packet_name(const CircuitModeControlEntityPacket& packet) -> std::string override {
[[nodiscard]] auto packet_name(const CircuitModeControlEntityPacket& packet) const -> std::string override {
return to_string(packet.packet_type_);
};

Expand Down
2 changes: 1 addition & 1 deletion include/l3/mobile_link_entity_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MobileLinkEntityParser : public PacketParser<LogicalLinkControlPacket, Mob
};

private:
auto packet_name(const MobileLinkEntityPacket& packet) -> 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);

Expand Down
2 changes: 1 addition & 1 deletion include/l3/mobile_management_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MobileManagementParser : public PacketParser<MobileLinkEntityPacket, Mobil
: PacketParser(prometheus_exporter, "mobile_management"){};

private:
auto packet_name(const MobileManagementPacket& packet) -> std::string override {
[[nodiscard]] auto packet_name(const MobileManagementPacket& packet) const -> std::string override {
return to_string(packet.packet_type_);
}

Expand Down
2 changes: 1 addition & 1 deletion include/l3/short_data_service_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ShortDataServiceParser : public PacketParser<CircuitModeControlEntityPacke
};

private:
auto packet_name(const ShortDataServicePacket& packet) -> std::string override {
[[nodiscard]] auto packet_name(const ShortDataServicePacket& packet) const -> std::string override {
return sds_pdu_description_.at(packet.protocol_identifier_);
}

Expand Down
2 changes: 1 addition & 1 deletion include/utils/packet_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ template <typename Input, typename Output> 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.
Expand Down
2 changes: 2 additions & 0 deletions include/utils/type234_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ template <typename ElementIdentifier> 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.");
Expand Down

0 comments on commit 9c39215

Please sign in to comment.