Continuing to work on context setup response.

master
Pedro Alvarez 7 years ago
parent 0a36f00d2e
commit c4c0a61d3c

@ -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;
@ -53,12 +55,6 @@ typedef struct{
} enb_ctx_t; } enb_ctx_t;
typedef struct{ typedef struct{
uint64_t imsi;
uint32_t enb_ue_s1ap_id;
uint32_t mme_ue_s1ap_id;
uint16_t enb_id;
struct sctp_sndrcvinfo enb_sri;
struct eps_security_ctxt{
uint8_t k_asme[32]; uint8_t k_asme[32];
uint8_t xres[8]; uint8_t xres[8];
uint32_t dl_nas_count; uint32_t dl_nas_count;
@ -67,7 +63,23 @@ typedef struct{
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo; srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
uint8_t k_nas_enc[32]; uint8_t k_nas_enc[32];
uint8_t k_nas_int[32]; uint8_t k_nas_int[32];
} security_ctxt; } 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{
uint64_t imsi;
uint32_t enb_ue_s1ap_id;
uint32_t mme_ue_s1ap_id;
uint16_t enb_id;
struct sctp_sndrcvinfo enb_sri;
eps_security_ctx_t security_ctxt;
erab_ctx_t erabs[MAX_ERABS_PER_UE];
} ue_ctx_t; } ue_ctx_t;
}//namespace }//namespace
#endif #endif

@ -707,16 +707,30 @@ 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)
{ {
erabs_it->second.insert(std::pair<>()); 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++)
{
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