Continuing to work on context setup response.

master
Pedro Alvarez 7 years ago
parent 0a36f00d2e
commit c4c0a61d3c

@ -101,11 +101,11 @@ private:
hss *m_hss; hss *m_hss;
int m_s1mme; int m_s1mme;
std::map<uint16_t, enb_ctx_t*> m_active_enbs; std::map<uint16_t, enb_ctx_t*> m_active_enbs;
std::map<int32_t, uint16_t> m_sctp_to_enb_id; std::map<int32_t, uint16_t> m_sctp_to_enb_id;
std::map<uint32_t, ue_ctx_t*> m_active_ues; std::map<uint32_t, ue_ctx_t*> m_active_ues;
std::map<uint16_t,std::set<uint32_t> > m_enb_id_to_ue_ids; std::map<uint16_t,std::set<uint32_t> > m_enb_id_to_ue_ids;
uint32_t m_next_mme_ue_s1ap_id; uint32_t m_next_mme_ue_s1ap_id;
s1ap_mngmt_proc m_s1ap_mngmt_proc; s1ap_mngmt_proc m_s1ap_mngmt_proc;
s1ap_nas_transport m_s1ap_nas_transport; s1ap_nas_transport m_s1ap_nas_transport;

@ -22,11 +22,13 @@
#define S1AP_COMMON_H #define S1AP_COMMON_H
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/asn1/gtpc_ies.h"
namespace srsepc{ namespace srsepc{
static const uint8_t MAX_TA=255; //Maximum TA supported static const uint8_t MAX_TA=255; //Maximum TA supported
static const uint8_t MAX_BPLMN=6; //Maximum broadcasted PLMNs per TAC static const uint8_t MAX_BPLMN=6; //Maximum broadcasted PLMNs per TAC
static const uint8_t MAX_ERABS_PER_UE = 16;
typedef struct{ typedef struct{
uint8_t mme_code; uint8_t mme_code;
@ -52,22 +54,32 @@ typedef struct{
struct sctp_sndrcvinfo sri; struct sctp_sndrcvinfo sri;
} enb_ctx_t; } enb_ctx_t;
typedef struct{
uint8_t k_asme[32];
uint8_t xres[8];
uint32_t dl_nas_count;
uint32_t ul_nas_count;
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
uint8_t k_nas_enc[32];
uint8_t k_nas_int[32];
} eps_security_ctx_t;
typedef struct{
bool active;
uint8_t erab_id;
srslte::gtpc_f_teid_ie enb_fteid;
//gtpc_f_teid_ie sgw_fteid; //?
} erab_ctx_t;
typedef struct{ typedef struct{
uint64_t imsi; uint64_t imsi;
uint32_t enb_ue_s1ap_id; uint32_t enb_ue_s1ap_id;
uint32_t mme_ue_s1ap_id; uint32_t mme_ue_s1ap_id;
uint16_t enb_id; uint16_t enb_id;
struct sctp_sndrcvinfo enb_sri; struct sctp_sndrcvinfo enb_sri;
struct eps_security_ctxt{ eps_security_ctx_t security_ctxt;
uint8_t k_asme[32]; erab_ctx_t erabs[MAX_ERABS_PER_UE];
uint8_t xres[8];
uint32_t dl_nas_count;
uint32_t ul_nas_count;
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
uint8_t k_nas_enc[32];
uint8_t k_nas_int[32];
} security_ctxt;
} ue_ctx_t; } ue_ctx_t;
}//namespace }//namespace
#endif #endif

@ -707,18 +707,32 @@ s1ap::handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSE
bool iE_Extensions_present; bool iE_Extensions_present;
}LIBLTE_S1AP_E_RABSETUPITEMCTXTSURES_STRUCT; }LIBLTE_S1AP_E_RABSETUPITEMCTXTSURES_STRUCT;
*/ */
erabs_it = m_active_erabs.find(in_ctxt_resp->MME_UE_S1AP_ID.MME_UE_S1AP_ID); uint32_t mme_ue_s1ap_id = in_ctxt_resp->MME_UE_S1AP_ID.MME_UE_S1AP_ID;
if (erabs_it == m_active_erabs.end()) std::map<uint32_t,ue_ctx_t*> ue_ctx_it = m_acive_ues.find(mme_ue_s1ap_id);
if (ue_ctx_it == m_active_ues.end())
{ {
m_s1ap_log->error("Could not find UE's in UE active bearers map\n"); m_s1ap_log->error("Could not find UE's context in active UE's map\n");
return false; return false;
} }
else{ for(uint32_t i; i<in_ctxt_resp->E_RABSetupListCtxtSURes.len;i++)
for(int i; i<E_RABSetupListCtxtSURes;i++) {
uint8_t erab_id = in_ctxt_resp->E_RABSetupListCtxtSURes.buffer[i].e_RAB_ID.E_RAB_ID;
if (erab_ctx->active == false)
{
m_s1ap_log->error("E-RAB requested was not active %d\n",);
return false;
}
erab_ctx_t *erab_ctx = &ue_ctx_it->second->erab_ctx[i];
for(uint32_t i; i<in_ctxt_resp->E_RABSetupListCtxtSURes.len;i++)
{ {
erabs_it->second.insert(std::pair<>()); uint8_t erab_id = in_ctxt_resp->E_RABSetupListCtxtSURes.buffer[i].e_RAB_ID.E_RAB_ID;
std::set<uint8_t, > ue_erab_it = erabs_it->second.find(erab_id);
if(ue_erab_it == erabs_it->second.end() )
{
m_s1ap_log->error("Could not find UE's in UE active bearers map\n");
return false;
}
} }
}
return true; return true;
} }

Loading…
Cancel
Save