Starting to add Create Session Request function

master
Pedro Alvarez 7 years ago
parent 606520d244
commit a8a370ec21

@ -146,6 +146,20 @@ const uint8_t GTPC_MSG_TYPE_MBMS_SESSION_STOP_RESPONSE = 236;
//Other
//240 - 255 For future use
/****************************************************************************
* GTP-C v2 Message
* Ref: 3GPP TS 29.274 v10.14.0
*
* This is the main structure to represent a GTP-C message. It is composed
* of one GTP-C header and one union of structures, which can hold
* all the possible GTP-C messages
***************************************************************************/
typedef struct gtpc_pdu
{
struct gtpc_header;
union gtpc_msg_choice;
} gtpc_pdu_t;
/****************************************************************************
* GTP-C v2 Header
* Ref: 3GPP TS 29.274 v10.14.0 Section 5
@ -176,6 +190,16 @@ typedef struct gtpc_header
uint64_t sequence;
} gtpc_header_t;
/****************************************************************************
* GTP-C v2 Header
* Ref: 3GPP TS 29.274 v10.14.0 Section 5
*
* Union that hold the different structures for the possible message types.
***************************************************************************/
typedef union gtpc_msg_choice
{
struct gtpc_create_session_request create_session_request;
};
/****************************************************************************
*

@ -0,0 +1,48 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2017 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef MME_GTPC_H
#define MME_GTPC_H
namespace srsepc
{
class mme_gtpc
{
public:
mme_gtpc();
~mme_gtpc();
static mme_gtpc* get_instance(void);
static void cleanup(void);
void init();
void send_create_session_request(uint64_t imsi, struct create_session_response *cs_resp);
};
}
#endif

@ -42,6 +42,7 @@
#include "mme/s1ap_common.h"
#include "mme/s1ap_mngmt_proc.h"
#include "mme/s1ap_nas_transport.h"
#include "mme/mme_gtpc.h"
#include "hss/hss.h"
namespace srsepc{
@ -62,7 +63,6 @@ public:
void delete_enb_ctx(int32_t assoc_id);
void delete_ues_in_enb(uint16_t enb_id);
bool handle_s1ap_rx_pdu(srslte::byte_buffer_t *pdu, struct sctp_sndrcvinfo *enb_sri);
bool handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, struct sctp_sndrcvinfo *enb_sri);
@ -77,7 +77,6 @@ public:
bool handle_nas_authentication_response(srslte::byte_buffer_t *nas_buffer, srslte::byte_buffer_t *reply_buffer, ue_ctx_t *ue_ctx);
bool handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_msg, ue_ctx_t *ue_ctx);
void print_enb_ctx_info(const enb_ctx_t &enb_ctx);
private:
@ -98,6 +97,9 @@ private:
s1ap_mngmt_proc m_s1ap_mngmt_proc;
s1ap_nas_transport m_s1ap_nas_transport;
//FIXME the GTP-C should be moved to the MME class, the the packaging of GTP-C messages is done.
mme_gtpc *m_gtpc;
};

@ -0,0 +1,96 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2017 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <iostream>
namespace srsepc{
mme_gtpc* mme_gtpc::m_instance = NULL;
boost::mutex mme_gtpc_instance_mutex;
mme_gtpc::mme_gtpc():
{
}
mme_gtpc::~mme_gtpc()
{
}
mme_gtpc*
mme_gtpc::get_instance(void)
{
boost::mutex::scoped_lock lock(mme_gtpc_instance_mutex);
if(NULL == m_instance) {
m_instance = new mme_gtpc();
}
return(m_instance);
}
void
mme_gtpc::cleanup(void)
{
boost::mutex::scoped_lock lock(mme_gtpc_instance_mutex);
if(NULL != m_instance) {
delete m_instance;
m_instance = NULL;
}
}
void
mme_gtpc::init()
{
m_spgw = spgw::get_instance();
}
void
mme_gtpc::send_create_session_request(uint64_t imsi, struct create_session_response *cs_resp)
{
uint64_t imsi;
struct gtpc_pdu cs_req;
//Setup GTP-C Header. FIXME: Length, sequence and other fields need to be added.
cs_req.header.piggyback = false;
cs_req.header.teid_present = true;
cs_req.header.type = GTPC_MSG_TYPE_CREATE_SESSION_REQUEST;
cs_req.header.teid = 0; //Send create session request to the butler TEID
//Setup GTP-C Create Session Request IEs
// Control TEID allocated \\
cs_req.create_session_request.sender_f_teid.tied = get_new_ctrl_teid();
cs_req.create_session_request.sender_f_teid.ip = htonl(m_mme_ip);
// APN \\
memcpy(cs_req.create_session_request.apn, "internet", sizeof("internet"));
// RAT Type \\
cs_req.create_session_request.rat_type = GTPC_RAT_TYPE::EUTRAN;
//Save RX Control TEID
create_rx_control_teid(create_session_request.sender_f_tied);
spgw->handle_create_session_request(&cs_req, cs_resp);
return;
}
} //namespace srsepc

@ -44,6 +44,7 @@ s1ap::~s1ap()
int
s1ap::init(s1ap_args_t s1ap_args, srslte::log_filter *s1ap_log)
{
m_pool = srslte::byte_buffer_pool::get_instance();
m_s1ap_args = s1ap_args;
srslte::s1ap_mccmnc_to_plmn(s1ap_args.mcc, s1ap_args.mnc, &m_plmn);
@ -52,7 +53,7 @@ s1ap::init(s1ap_args_t s1ap_args, srslte::log_filter *s1ap_log)
m_s1ap_nas_transport.set_log(s1ap_log);
m_hss = hss::get_instance();
m_pool = srslte::byte_buffer_pool::get_instance();
m_gtpc = mme_gtpc::get_instance();
m_s1mme = enb_listen();
@ -483,7 +484,11 @@ s1ap::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, srslte:
//Send Security Mode Command
m_s1ap_nas_transport.pack_security_mode_command(reply_msg, ue_ctx);
//m_gtpc->send_create_session_request(ue_ctx->imsi);
//FIXME The packging of GTP-C messages is not ready
//This means that GTP-U tunnels are created with function calls, as oposed to GTP-C.
//In future send_create_session_request will return void and the handle_create_session_response will be called from the GTP-C class itself.
struct gtpc_create_session_response *cs_resp = m_gtpc->send_create_session_request(ue_ctx->imsi);
m_gtpc->handle_create_session_response(cs_resp);
}
return true;
}

Loading…
Cancel
Save