Done decoding of s1 Setup message. Starting to store context and prepare a reply.

This commit is contained in:
Pedro Alvarez 2017-10-13 19:19:45 +01:00
parent 41aafbc9c8
commit 5aa91483c5
3 changed files with 64 additions and 12 deletions

View File

@ -24,6 +24,7 @@
* *
*/ */
#include "srslte/asn1/liblte_s1ap.h" #include "srslte/asn1/liblte_s1ap.h"
#include "srslte/common/common.h"
#include "srslte/common/log.h" #include "srslte/common/log.h"
namespace srsepc{ namespace srsepc{
@ -71,4 +72,7 @@ private:
int m_s1mme; int m_s1mme;
}; };
} //namespace srsepc } //namespace srsepc

View File

@ -23,7 +23,7 @@ target_link_libraries(srsepc srsepc_mme
${SCTP_LIBRARIES}) ${SCTP_LIBRARIES})
if (RPATH) if (RPATH)
set_target_properties(srsenb PROPERTIES INSTALL_RPATH ".") set_target_properties(srsepc PROPERTIES INSTALL_RPATH ".")
endif (RPATH) endif (RPATH)
install(TARGETS srsepc DESTINATION ${RUNTIME_DIR}) install(TARGETS srsepc DESTINATION ${RUNTIME_DIR})

View File

@ -33,7 +33,8 @@
#include <netinet/sctp.h> #include <netinet/sctp.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/common/common.h" #include "srslte/upper/s1ap_common.h"
#include "srslte/common/bcd_helpers.h"
#include "mme/s1ap.h" #include "mme/s1ap.h"
namespace srsepc{ namespace srsepc{
@ -188,15 +189,62 @@ bool
s1ap::handle_s1setuprequest(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg) s1ap::handle_s1setuprequest(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg)
{ {
uint8_t tmp[150]; uint8_t enb_name[150];
bzero(tmp,sizeof(tmp)); uint8_t enb_id[20];
memcpy(tmp,&msg->eNBname.buffer,msg->eNBname.n_octets); uint32_t plmn = 0;
std::cout <<"Wazuup" <<std::endl; std::string mnc_str, mcc_str;
//liblte_s1ap_unpack_enbname(&tmp, &msg->eNBname); uint16_t mcc, mnc;
std::cout << tmp <<std::endl; uint16_t tac, bplmn;
//free(tmp); uint32_t bplmns[32];
//std::cout << msg->Global_ENB_ID.eNB_ID.choice.macroENB_ID.buffer<<std::endl;
//s1ap_log->info("Received DownlinkNASTransport\n"); //eNB Name
if(msg->eNBname_present)
{
bzero(enb_name,sizeof(enb_name));
memcpy(enb_name,&msg->eNBname.buffer,msg->eNBname.n_octets);
std::cout <<"eNB Name: " << enb_name <<std::endl;
}
//eNB Id 9.2.1.37
memcpy(&enb_id, msg->Global_ENB_ID.eNB_ID.choice.macroENB_ID.buffer, LIBLTE_S1AP_MACROENB_ID_BIT_STRING_LEN);
std::cout << "eNB ID: ";
for (int i=0;i < 20;i++) {
std::cout<< (uint16_t)enb_id[i];
}
std::cout << std::endl;
//PLMN Id
((uint8_t*)&plmn)[1] = msg->Global_ENB_ID.pLMNidentity.buffer[0];
((uint8_t*)&plmn)[2] = msg->Global_ENB_ID.pLMNidentity.buffer[1];
((uint8_t*)&plmn)[3] = msg->Global_ENB_ID.pLMNidentity.buffer[2];
plmn = ntohl(plmn);
srslte::s1ap_plmn_to_mccmnc(plmn, &mcc, &mnc);
srslte::mnc_to_string(mnc, &mnc_str);
srslte::mnc_to_string(mcc, &mcc_str);
std::cout << "MCC: "<< mcc_str << " MNC: " << mnc_str << std::endl;
//SupportedTAs
for(uint16_t i=0; i<msg->SupportedTAs.len; i++)
{
//tac = msg->SupportedTAs.buffer[i].tAC.buffer[]; //broadcastPLMNs
((uint8_t*)&tac)[0] = msg->SupportedTAs.buffer[i].tAC.buffer[0];
((uint8_t*)&tac)[1] = msg->SupportedTAs.buffer[i].tAC.buffer[1];
std::cout << "TAC: " << ntohs(tac) << std::endl;
for (uint16_t j=0; j<msg->SupportedTAs.buffer[i].broadcastPLMNs.len; j++)
{
((uint8_t*)&bplmns[j])[1] = msg->SupportedTAs.buffer[i].broadcastPLMNs.buffer[j].buffer[0];
((uint8_t*)&bplmns[j])[2] = msg->SupportedTAs.buffer[i].broadcastPLMNs.buffer[j].buffer[1];
((uint8_t*)&bplmns[j])[3] = msg->SupportedTAs.buffer[i].broadcastPLMNs.buffer[j].buffer[2];
bplmns[j] = ntohl(bplmns[j]);
srslte::mnc_to_string(mnc, &mnc_str);
srslte::mnc_to_string(mcc, &mcc_str);
std::cout << "B_MCC: "<< mcc_str << " B_MNC: " << mnc_str << std::endl;
}
}
//Default Paging DRX
LIBLTE_S1AP_PAGINGDRX_ENUM drx = msg->DefaultPagingDRX.e;
std::cout << "Default Paging DRX" << drx << std::endl;
/* /*
if(msg->ext) { if(msg->ext) {
s1ap_log->warning("Not handling S1AP message extension\n"); s1ap_log->warning("Not handling S1AP message extension\n");
@ -224,4 +272,4 @@ s1ap::handle_s1setuprequest(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg)
} }
}//namespace srsepc } //namespace srsepc