Skip to content

Commit

Permalink
handle address of null pdu in the uplink
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Sep 6, 2024
1 parent e960185 commit 6e93e4d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
34 changes: 28 additions & 6 deletions include/l2/upper_mac_packet_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@ struct UpperMacPackets {
}
}

/// Distribute the information of the uplink c-plane signalling null pdu to all other c-plane signalling packets.
/// This operation will associate uplink packets with no address (MacFragmentUplink and MacEndUplink) with the
/// address of the uplink null pdu.
auto apply_uplink_null_pdu_information() -> void {
std::optional<UpperMacCPlaneSignallingPacket> null_pdu;

for (auto const& packet : c_plane_signalling_packets_) {
if (packet.is_null_pdu()) {
null_pdu = packet;
}
}

if (null_pdu) {
for (auto& packet : c_plane_signalling_packets_) {
if ((packet.type_ == MacPacketType::kMacFragmentUplink) ||
(packet.type_ == MacPacketType::kMacEndUplink)) {
packet.address_ = null_pdu->address_;
}
}
}
}

/// Check if the packet contains data that is of importance for C-Plane or U-Plane
/// \return true if the UpperMacPackets contain user or control plane data (either signalling or traffic)
[[nodiscard]] auto has_user_or_control_plane_data() const -> bool {
Expand Down Expand Up @@ -108,22 +130,22 @@ class UpperMacPacketBuilder {
/// \param channel the logical channel on which the packets are sent
/// \param data the BitVector which holds the packets
/// \return the parsed c-plane signalling packets
[[nodiscard]] static auto parse_c_plane_signalling(BurstType burst_type, LogicalChannel channel, BitVector&& data)
-> std::vector<UpperMacCPlaneSignallingPacket>;
[[nodiscard]] static auto parse_c_plane_signalling(BurstType burst_type, LogicalChannel channel,
BitVector&& data) -> std::vector<UpperMacCPlaneSignallingPacket>;

/// Parse the user plane signalling packet contained in a BitVector
/// \param channel the logical channel on which the packet is sent
/// \param data the BitVector which holds the packet
/// \return the parsed u-plane signalling packet
[[nodiscard]] static auto parse_u_plane_signalling(LogicalChannel channel, BitVector&& data)
-> UpperMacUPlaneSignallingPacket;
[[nodiscard]] static auto parse_u_plane_signalling(LogicalChannel channel,
BitVector&& data) -> UpperMacUPlaneSignallingPacket;

/// Parse the user plane traffic packet contained in a BitVector
/// \param channel the logical channel on which the packet is sent
/// \param data the BitVector which holds the packet
/// \return the parsed u-plane traffic packet
[[nodiscard]] static auto parse_u_plane_traffic(LogicalChannel channel, BitVector&& data)
-> UpperMacUPlaneTrafficPacket;
[[nodiscard]] static auto parse_u_plane_traffic(LogicalChannel channel,
BitVector&& data) -> UpperMacUPlaneTrafficPacket;

public:
UpperMacPacketBuilder() = default;
Expand Down
3 changes: 3 additions & 0 deletions src/l2/upper_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ auto UpperMac::process(const Slots& slots) -> void {
}
}

/// This step takes care of adding the correct adresses for some uplink packets.
packets.apply_uplink_null_pdu_information();

try {
processPackets(std::move(packets));
} catch (std::runtime_error& e) {
Expand Down

0 comments on commit 6e93e4d

Please sign in to comment.