Fixing up s1ap.cc

master
Pedro Alvarez 7 years ago
parent 05a34ec8e3
commit 85672d4a3f

@ -13,14 +13,14 @@ namespace srsepc {
class s1ap_interface_gtpc
{
public:
virtual bool send_initial_context_setup_request(uint64_t imsi) = 0;
virtual bool send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup) = 0;
};
//NAS -> S1AP
class s1ap_interface_nas
{
public:
virtual bool send_initial_context_setup_request(uint64_t imsi) = 0;
virtual bool send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup) = 0;
};
//S1AP -> HSS

@ -54,7 +54,8 @@ namespace srsepc{
const uint16_t S1MME_PORT = 36412;
class s1ap:
public s1ap_interface_nas
public s1ap_interface_nas,
public s1ap_interface_gtpc
{
public:
@ -106,6 +107,9 @@ public:
std::map<uint32_t, uint64_t> m_tmsi_to_imsi;
//Interfaces
virtual bool send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup);
private:
s1ap();
virtual ~s1ap();

@ -63,16 +63,14 @@ nas::handle_nas_detach_request(srslte::byte_buffer_t *nas_msg, ue_ctx_t* ue_ctx,
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req;
LIBLTE_ERROR_ENUM err = liblte_mme_unpack_detach_request_msg((LIBLTE_BYTE_MSG_STRUCT*) nas_msg, &detach_req);
if(err !=LIBLTE_SUCCESS)
{
if(err !=LIBLTE_SUCCESS) {
m_s1ap_log->error("Could not unpack detach request\n");
return false;
}
m_mme_gtpc->send_delete_session_request(ue_ctx->emm_ctx.imsi);
ue_ctx->emm_ctx.state = EMM_STATE_DEREGISTERED;
if(ue_ctx->ecm_ctx.mme_ue_s1ap_id!=0)
{
if(ue_ctx->ecm_ctx.mme_ue_s1ap_id!=0) {
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(&ue_ctx->ecm_ctx, reply_msg);
}
return true;
@ -737,8 +735,7 @@ nas::pack_esm_information_request(srslte::byte_buffer_t *reply_msg, ue_emm_ctx_t
//Pack Downlink NAS Transport Message
err = liblte_s1ap_pack_s1ap_pdu(&tx_pdu, (LIBLTE_BYTE_MSG_STRUCT *) reply_msg);
if(err != LIBLTE_SUCCESS)
{
if(err != LIBLTE_SUCCESS) {
m_s1ap_log->error("Error packing Dw NAS Transport: Authentication Reject\n");
m_s1ap_log->console("Error packing Downlink NAS Transport: Authentication Reject\n");
return false;
@ -762,14 +759,11 @@ nas::pack_attach_accept(LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT *erab_ctx
mcc += 100*( (0x0F00 & m_s1ap->m_s1ap_args.mcc) >> 8);
uint32_t mnc = 0;
if( 0xFF00 == (m_s1ap->m_s1ap_args.mnc & 0xFF00 ))
{
if( 0xFF00 == (m_s1ap->m_s1ap_args.mnc & 0xFF00 )) {
//Two digit MNC
mnc += 0x000F & m_s1ap->m_s1ap_args.mnc;
mnc += 10*((0x00F0 & m_s1ap->m_s1ap_args.mnc) >> 4);
}
else
{
} else {
//Three digit MNC
mnc += 0x000F & m_s1ap->m_s1ap_args.mnc;
mnc += 10*((0x00F0 & m_s1ap->m_s1ap_args.mnc) >> 4);

@ -608,5 +608,21 @@ s1ap::print_enb_ctx_info(const std::string &prefix, const enb_ctx_t &enb_ctx)
return;
}
/*
* Interfaces
*/
// NAS -> S1AP interfaces
bool
s1ap::send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup)
{
nas* nas_ctx = find_nas_ctx_from_imsi(imsi);
if (nas_ctx==NULL) {
m_s1ap_log->error("Error finding NAS context when sending initial context Setup Request\n");
return false;
}
m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(nas_ctx, erab_to_setup);
return true;
}
} //namespace srsepc

Loading…
Cancel
Save