pcap: adding SL-SCH support

master
Andre Puschmann 5 years ago
parent 5a95af6ce1
commit 5d92111586

@ -51,6 +51,9 @@ public:
void write_ul_rrc_pdu(const uint8_t* input, const int32_t input_len);
// Sidelink
void write_sl_crnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t rnti, uint32_t reTX, uint32_t tti, uint8_t cc_idx);
private:
bool enable_write;
FILE* pcap_file;

@ -66,6 +66,10 @@ typedef struct pcaprec_hdr_s {
#define SI_RNTI 4
#define SPS_RNTI 5
#define M_RNTI 6
#define SL_BCH_RNTI 7
#define SL_RNTI 8
#define SC_RNTI 9
#define G_RNTI 10
#define MAC_LTE_START_STRING "mac-lte"
#define MAC_LTE_PAYLOAD_TAG 0x01

@ -114,6 +114,17 @@ void mac_pcap::write_ul_crnti(uint8_t* pdu,
{
pack_and_write(pdu, pdu_len_bytes, reTX, true, cc_idx, tti, rnti, DIRECTION_UPLINK, C_RNTI);
}
void mac_pcap::write_sl_crnti(uint8_t* pdu,
uint32_t pdu_len_bytes,
uint16_t rnti,
uint32_t reTX,
uint32_t tti,
uint8_t cc_idx)
{
pack_and_write(pdu, pdu_len_bytes, reTX, true, cc_idx, tti, rnti, DIRECTION_UPLINK, SL_RNTI);
}
void mac_pcap::write_dl_bch(uint8_t* pdu, uint32_t pdu_len_bytes, bool crc_ok, uint32_t tti, uint8_t cc_idx)
{
pack_and_write(pdu, pdu_len_bytes, 0, crc_ok, cc_idx, tti, 0, DIRECTION_DOWNLINK, NO_RNTI);

@ -730,6 +730,26 @@ int mac_sch_pdu_unpack_test2()
return SRSLTE_SUCCESS;
}
int mac_slsch_pdu_unpack_test1()
{
// SL-SCH PDU captures from UXM 5G CV2X
static uint8_t tv[] = {0x30, 0xED, 0x0E, 0x03, 0x00, 0x00, 0x01, 0x21, 0x2B, 0x1F, 0x9F, 0x75, 0x76,
0x87, 0x00, 0x00, 0x8E, 0x9E, 0xA5, 0xFD, 0xA1, 0xA3, 0xA7, 0xA9, 0x7F, 0x68,
0x6C, 0xB8, 0xBF, 0x0F, 0x96, 0x89, 0x2E, 0xDC, 0x80, 0x64, 0x06, 0x40, 0x00,
0x18, 0x6A, 0x07, 0x20, 0x7C, 0xE1, 0xE0, 0x04, 0x40, 0x02, 0x04, 0x80, 0x60,
0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
srslte::log_filter mac_log("MAC");
mac_log.set_level(srslte::LOG_LEVEL_DEBUG);
mac_log.set_hex_limit(100000);
#if HAVE_PCAP
pcap_handle->write_sl_crnti(tv, sizeof(tv), CRNTI, true, 1);
#endif
return SRSLTE_SUCCESS;
}
int main(int argc, char** argv)
{
#if HAVE_PCAP
@ -820,5 +840,7 @@ int main(int argc, char** argv)
TESTASSERT(mac_sch_pdu_pack_test8() == SRSLTE_SUCCESS);
TESTASSERT(mac_slsch_pdu_unpack_test1() == SRSLTE_SUCCESS);
return SRSLTE_SUCCESS;
}

Loading…
Cancel
Save