Starting to add s1ap_interface_gtpc and s1ap_interface_nas. Adapting send initial context setup request accordingly.

master
Pedro Alvarez 6 years ago
parent fead1affaa
commit 3663d59920

@ -2,11 +2,28 @@
#define SRSLTE_EPC_INTERFACES_H #define SRSLTE_EPC_INTERFACES_H
#include "srslte/srslte.h" #include "srslte/srslte.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
namespace srsepc { namespace srsepc {
/*
* S1AP Interfaces
*/
//GTP-C -> S1AP
class s1ap_interface_gtpc
{
public:
virtual bool send_initial_context_setup_request(uint64_t imsi) = 0;
};
//NAS -> S1AP
class s1ap_interface_nas
{
public:
virtual bool send_initial_context_setup_request(uint64_t imsi) = 0;
};
//S1AP -> HSS
class hss_interface_s1ap class hss_interface_s1ap
{ {
public: public:

@ -32,6 +32,7 @@
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/log.h" #include "srslte/common/log.h"
#include "srslte/common/s1ap_pcap.h" #include "srslte/common/s1ap_pcap.h"
#include "srslte/interfaces/epc_interfaces.h"
#include <strings.h> #include <strings.h>
#include <arpa/inet.h> #include <arpa/inet.h>
@ -52,7 +53,8 @@ namespace srsepc{
const uint16_t S1MME_PORT = 36412; const uint16_t S1MME_PORT = 36412;
class s1ap class s1ap:
public s1ap_interface_nas
{ {
public: public:

@ -47,7 +47,7 @@ public:
void init(void); void init(void);
bool send_initial_context_setup_request(emm_ctx_t *emm_ctx, ecm_ctx_t *ecm_ctx, esm_ctx_t *esm_ctx, sec_ctx_t *sec_ctx); bool send_initial_context_setup_request(nas *nas_ctx);
bool handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *in_ctxt_resp); bool handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *in_ctxt_resp);
bool handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT *ue_rel, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT *ue_rel, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte::byte_buffer_t *reply_buffer); bool send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte::byte_buffer_t *reply_buffer);

@ -79,10 +79,7 @@ s1ap_ctx_mngmt_proc::init(void)
} }
bool bool
s1ap_ctx_mngmt_proc::send_initial_context_setup_request(emm_ctx_t *emm_ctx, s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx)
ecm_ctx_t *ecm_ctx,
esm_ctx_t *esm_ctx,
sec_ctx_t *sec_ctx)
{ {
//Prepare reply PDU //Prepare reply PDU
LIBLTE_S1AP_S1AP_PDU_STRUCT pdu; LIBLTE_S1AP_S1AP_PDU_STRUCT pdu;
@ -151,7 +148,7 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(emm_ctx_t *emm_ctx,
//Attach procedure initiated from an attach request //Attach procedure initiated from an attach request
m_s1ap_log->console("Adding attach accept to Initial Context Setup Request\n"); m_s1ap_log->console("Adding attach accept to Initial Context Setup Request\n");
m_s1ap_log->info("Adding attach accept to Initial Context Setup Request\n"); m_s1ap_log->info("Adding attach accept to Initial Context Setup Request\n");
m_s1ap_nas_transport->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer); nas_ctx->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer);
} }
srslte::byte_buffer_t *reply_buffer = m_pool->allocate(); srslte::byte_buffer_t *reply_buffer = m_pool->allocate();

@ -81,16 +81,13 @@ s1ap_nas_transport::init(hss_interface_s1ap * hss_)
} }
bool bool
s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag) s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag)
{ {
//Get info from initial UE message //Get info from initial UE message
uint32_t enb_ue_s1ap_id = init_ue->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID; uint32_t enb_ue_s1ap_id = init_ue->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID;
//Log unhandled Initial UE message IEs
log_unhandled_initial_ue_message_ies(init_ue);
/*Check whether NAS Attach Request or Service Request*/ /*Check whether NAS Attach Request or Service Request*/
bool mac_valid = false; bool mac_valid = false;
uint8_t pd, msg_type, sec_hdr_type; uint8_t pd, msg_type, sec_hdr_type;
@ -332,7 +329,6 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA
return false; return false;
} }
if(*reply_flag == true) if(*reply_flag == true)
{ {
m_s1ap_log->console("DL NAS: Sent Downlink NAS Message. DL NAS Count=%d, UL NAS count=%d\n",emm_ctx->security_ctxt.dl_nas_count,emm_ctx->security_ctxt.ul_nas_count ); m_s1ap_log->console("DL NAS: Sent Downlink NAS Message. DL NAS Count=%d, UL NAS count=%d\n",emm_ctx->security_ctxt.dl_nas_count,emm_ctx->security_ctxt.ul_nas_count );

Loading…
Cancel
Save