Skip to content

Commit

Permalink
Merge pull request SysSec-KAIST#4 from SysSec-KAIST/LTESniffer-v1.2.0
Browse files Browse the repository at this point in the history
Fixed error, improved stableness
  • Loading branch information
hdtuanss authored Apr 28, 2023
2 parents ccbf5ef + 24bc776 commit 5eac982
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
60 changes: 34 additions & 26 deletions src/src/DL_Sniffer_PDSCH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ int PDSCH_Decoder::run_rar_decode(srsran_dci_format_t cur_format,
}
return SRSRAN_ERROR;
} else {
std::cout << "Config MIMO wrong: " << mimo_ret << std::endl;
// std::cout << "Config MIMO wrong: " << mimo_ret << std::endl;
return SRSRAN_ERROR;
}
}
Expand Down Expand Up @@ -989,98 +989,106 @@ void PDSCH_Decoder::print_debug_dl( std::string name,

std::string PDSCH_Decoder::dci_format(int format)
{
std::string ret = "UNKNOWN";
switch (format)
{
case 0:
return "0";
ret = "0";
break;
case 1:
return "1";
ret = "1";
break;
case 2:
return "1A";
ret = "1A";
break;
case 3:
return "1B";
ret = "1B";
break;
case 4:
return "1C";
ret = "1C";
break;
case 5:
return "1D";
ret = "1D";
break;
case 6:
return "2";
ret = "2";
break;
case 7:
return "2A";
ret = "2A";
break;
case 8:
return "2B";
ret = "2B";
break;
default:
return "UNKNOWN";
ret = "UNKNOWN";
break;
}
return ret;
}

std::string PDSCH_Decoder::mod_sche(int sche)
{
std::string ret = "UNKNOWN";
switch (sche)
{
case 0:
return "BPSK";
ret = "BPSK";
break;
case 1:
return "QPSK";
ret = "QPSK";
break;
case 2:
return "16QAM";
ret = "16QAM";
break;
case 3:
return "64QAM";
ret = "64QAM";
break;
case 4:
return "256QAM";
ret = "256QAM";
break;
default:
return "UNKNOWN";
ret = "UNKNOWN";
break;
}
return ret;
}

std::string PDSCH_Decoder::rnti_name(uint16_t rnti){
std::string ret = "";
if (rnti == SRSRAN_SIRNTI) {
return "SI_RNTI";
ret = "SI_RNTI";
}else if (rnti == SRSRAN_PRNTI) {
return "P_RNTI";
ret = "P_RNTI";
}else if ((rnti > SRSRAN_RARNTI_START) && (rnti < SRSRAN_RARNTI_END)) {
return "RA_RNTI";
ret = "RA_RNTI";
}else {
return "C_RNTI" ;
ret = "C_RNTI" ;
}
return ret;
}


std::string convert_id_name_dl(int id){
std::string ret = "-";
switch (id)
{
case 0:
return "RandomValue";
ret = "RandomValue";
break;
case 1:
return "TMSI";
ret = "TMSI";
break;
case 2:
return "Contention Resolution";
ret = "Contention Resolution";
break;
case 3:
return "IMSI";
ret = "IMSI";
break;
default:
return "-";
ret = "-";
break;
}
return ret;
}
std::string convert_msg_name_dl(int msg){
std::string ret = "-";
Expand Down
56 changes: 32 additions & 24 deletions src/src/UL_Sniffer_PUSCH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,38 +517,42 @@ int PUSCH_Decoder::check_valid_prb_ul(uint32_t nof_prb){

std::string PUSCH_Decoder::modulation_mode_string(int idx, bool max_64qam)
{
std::string ret = "";
if (idx <= 10){
return "QPSK";
ret = "QPSK";
}
else if (idx <= 20) {
return "16QAM";
ret = "16QAM";
}
else if (idx <= 28 && max_64qam){
return "64QAM";
ret = "64QAM";
}
else if (idx <= 28 && !max_64qam){
return "16QAM";
ret = "16QAM";
}else {
return "ReTx";
ret = "ReTx";
}
return ret;
}

std::string PUSCH_Decoder::modulation_mode_string_256(int idx)
{
std::string ret = "";
if (idx <= 5){
return "QPSK";
ret = "QPSK";
}
else if (idx <= 13) {
return "16QAM";
ret = "16QAM";
}
else if (idx <= 22){
return "64QAM";
ret = "64QAM";
}
else if (idx <= 28){
return "256QAM";
ret = "256QAM";
}else {
return "ReTx";
ret = "ReTx";
}
return ret;
}


Expand Down Expand Up @@ -700,54 +704,58 @@ void PUSCH_Decoder::print_uci(srsran_uci_value_t *uci){
}
}

std::string convert_id_name(int id){
std::string convert_id_name(int id){\
std::string ret = "-";
switch (id)
{
case ID_RAN_VAL:
return "RandomValue";
ret = "RandomValue";
break;
case ID_TMSI:
return "TMSI";
ret = "TMSI";
break;
case ID_CON_RES:
return "Contention Resolution";
ret = "Contention Resolution";
break;
case ID_IMSI:
return "IMSI";
ret = "IMSI";
break;
case ID_IMEI:
return "IMEI";
ret = "IMEI";
break;
case ID_IMEISV:
return "IMEISV";
ret = "IMEISV";
break;
default:
return "-";
ret = "-";
break;
}
return ret;
}
std::string convert_msg_name(int msg){
std::string ret = "-";
switch (msg)
{
case 0:
return "RRC Connection Request";
ret = "RRC Connection Request";
break;
case 1:
return "RRC Connection Setup";
ret = "RRC Connection Setup";
break;
case 2:
return "Attach Request";
ret = "Attach Request";
break;
case 3:
return "Identity Response";
ret = "Identity Response";
break;
case 4:
return "UECapability";
ret = "UECapability";
break;
default:
return "-";
ret = "-";
break;
}
return ret;
}
void PUSCH_Decoder::print_api(uint32_t tti, uint16_t rnti, int id, std::string value, int msg){
std::cout << std::left << std::setw(4) << tti/10 << "-" << std::left << std::setw(5) << tti%10;
Expand Down

0 comments on commit 5eac982

Please sign in to comment.