add basic rlc_am_base class containing data/control PDU check

master
Andre Puschmann 5 years ago
parent cea212b9f9
commit db2c43553e

@ -37,6 +37,9 @@ namespace srslte {
///< Add rlc_am_base here ///< Add rlc_am_base here
bool rlc_am_is_control_pdu(uint8_t* payload);
bool rlc_am_is_control_pdu(byte_buffer_t* pdu);
} // namespace srslte } // namespace srslte
#endif // SRSLTE_RLC_AM_BASE_H #endif // SRSLTE_RLC_AM_BASE_H

@ -23,15 +23,16 @@
#define SRSLTE_RLC_AM_LTE_H #define SRSLTE_RLC_AM_LTE_H
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/common/log.h"
#include "srslte/upper/rlc_tx_queue.h"
#include "srslte/common/timeout.h" #include "srslte/common/timeout.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/rlc_am_base.h"
#include "srslte/upper/rlc_common.h" #include "srslte/upper/rlc_common.h"
#include <map> #include "srslte/upper/rlc_tx_queue.h"
#include <deque> #include <deque>
#include <list> #include <list>
#include <map>
namespace srslte { namespace srslte {
@ -303,8 +304,6 @@ uint32_t rlc_am_packed_length(rlc_amd_pdu_header_t* header);
uint32_t rlc_am_packed_length(rlc_status_pdu_t* status); uint32_t rlc_am_packed_length(rlc_status_pdu_t* status);
uint32_t rlc_am_packed_length(rlc_amd_retx_t retx); uint32_t rlc_am_packed_length(rlc_amd_retx_t retx);
bool rlc_am_is_valid_status_pdu(const rlc_status_pdu_t& status); bool rlc_am_is_valid_status_pdu(const rlc_status_pdu_t& status);
bool rlc_am_is_control_pdu(byte_buffer_t* pdu);
bool rlc_am_is_control_pdu(uint8_t* payload);
bool rlc_am_is_pdu_segment(uint8_t* payload); bool rlc_am_is_pdu_segment(uint8_t* payload);
std::string rlc_am_status_pdu_to_string(rlc_status_pdu_t* status); std::string rlc_am_status_pdu_to_string(rlc_status_pdu_t* status);
std::string rlc_amd_pdu_header_to_string(const rlc_amd_pdu_header_t& header); std::string rlc_amd_pdu_header_to_string(const rlc_amd_pdu_header_t& header);

@ -28,6 +28,7 @@ set(SOURCES gtpu.cc
rlc_um_base.cc rlc_um_base.cc
rlc_um_lte.cc rlc_um_lte.cc
rlc_um_nr.cc rlc_um_nr.cc
rlc_am_base.cc
rlc_am_lte.cc rlc_am_lte.cc
rlc_am_nr.cc) rlc_am_nr.cc)
add_library(srslte_upper STATIC ${SOURCES}) add_library(srslte_upper STATIC ${SOURCES})

@ -0,0 +1,37 @@
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "srslte/upper/rlc_am_base.h"
#include <sstream>
namespace srslte {
bool rlc_am_is_control_pdu(uint8_t* payload)
{
return ((*(payload) >> 7) & 0x01) == RLC_DC_FIELD_CONTROL_PDU;
}
bool rlc_am_is_control_pdu(byte_buffer_t* pdu)
{
return rlc_am_is_control_pdu(pdu->msg);
}
} // namespace srslte

@ -2035,16 +2035,6 @@ uint32_t rlc_am_packed_length(rlc_status_pdu_t *status)
return (len_bits+7)/8; // Convert to bytes - integer rounding up return (len_bits+7)/8; // Convert to bytes - integer rounding up
} }
bool rlc_am_is_control_pdu(byte_buffer_t *pdu)
{
return rlc_am_is_control_pdu(pdu->msg);
}
bool rlc_am_is_control_pdu(uint8_t *payload)
{
return ((*(payload) >> 7) & 0x01) == RLC_DC_FIELD_CONTROL_PDU;
}
bool rlc_am_is_pdu_segment(uint8_t *payload) bool rlc_am_is_pdu_segment(uint8_t *payload)
{ {
return ((*(payload) >> 6) & 0x01) == 1; return ((*(payload) >> 6) & 0x01) == 1;

Loading…
Cancel
Save