mirror of https://github.com/PentHertz/srsLTE.git
Fixed a bunch of compilation errors.
This commit is contained in:
parent
a8a370ec21
commit
ccbeb9e1c5
|
@ -146,68 +146,13 @@ 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
|
||||
*
|
||||
* | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
||||
*
|
||||
* 1 | Version | P | T | S | S | S |
|
||||
* 2 | Message Type |
|
||||
* 3 | Length (1st Octet) |
|
||||
* 4 | Length (2nd Octet) |
|
||||
* m | If T=1, TEID (1st Octet) |
|
||||
* m+1 | If T=1, TEID (2nd Octet) |
|
||||
* m+2 | If T=1, TEID (3st Octet) |
|
||||
* m+3 | If T=1, TEID (4st Octet) |
|
||||
* n | Sequence |
|
||||
* n+1 | Sequence |
|
||||
* n+2 | Sequence |
|
||||
* n+3 | Spare |
|
||||
***************************************************************************/
|
||||
|
||||
typedef struct gtpc_header
|
||||
{
|
||||
uint8_t version;
|
||||
bool piggyback;
|
||||
bool tied_present;
|
||||
uint8_t msg_type;
|
||||
uint64_t teid;
|
||||
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;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* GTP-C v2 Create Session Request
|
||||
* Ref: 3GPP TS 29.274 v10.14.0 Table 7.2.1-1
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
|
||||
typedef struct gtpc_create_session_request
|
||||
{
|
||||
bool imsi_present;
|
||||
|
@ -216,6 +161,7 @@ typedef struct gtpc_create_session_request
|
|||
uint64_t msisdn; // C
|
||||
bool mei_present;
|
||||
uint64_t mei; // C/CO
|
||||
/*
|
||||
bool user_location_info_present;
|
||||
struct user_location_info_ uli; // C/CO
|
||||
bool serving_network_present;
|
||||
|
@ -244,7 +190,7 @@ typedef struct gtpc_create_session_request
|
|||
uint8_t linked_eps_bearer_id; // C
|
||||
bool pco_present;
|
||||
uint8_t pco; // C
|
||||
|
||||
|
||||
struct bearer_context_ bearer_context_created; // M
|
||||
bool bearer_context_deleted_present;
|
||||
struct bearer_context_ bearer_context_deleted; // C
|
||||
|
@ -275,8 +221,68 @@ typedef struct gtpc_create_session_request
|
|||
bool acpo_present;
|
||||
uint8_t apco; // CO
|
||||
bool ext; // O
|
||||
*/
|
||||
} gtpc_create_session_request_t;
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* GTP-C v2 Header
|
||||
* Ref: 3GPP TS 29.274 v10.14.0 Section 5
|
||||
*
|
||||
* | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
||||
*
|
||||
* 1 | Version | P | T | S | S | S |
|
||||
* 2 | Message Type |
|
||||
* 3 | Length (1st Octet) |
|
||||
* 4 | Length (2nd Octet) |
|
||||
* m | If T=1, TEID (1st Octet) |
|
||||
* m+1 | If T=1, TEID (2nd Octet) |
|
||||
* m+2 | If T=1, TEID (3st Octet) |
|
||||
* m+3 | If T=1, TEID (4st Octet) |
|
||||
* n | Sequence |
|
||||
* n+1 | Sequence |
|
||||
* n+2 | Sequence |
|
||||
* n+3 | Spare |
|
||||
***************************************************************************/
|
||||
|
||||
typedef struct gtpc_header
|
||||
{
|
||||
uint8_t version;
|
||||
bool piggyback;
|
||||
bool teid_present;
|
||||
uint8_t type;
|
||||
uint64_t teid;
|
||||
uint64_t sequence;
|
||||
} gtpc_header_t;
|
||||
|
||||
/****************************************************************************
|
||||
* GTP-C v2 Payload
|
||||
* 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;
|
||||
} gtpc_msg_choice_t;
|
||||
|
||||
/****************************************************************************
|
||||
* 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 header;
|
||||
union gtpc_msg_choice choice;
|
||||
} gtpc_pdu_t;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -25,17 +25,16 @@
|
|||
*/
|
||||
#include <stdint.h>
|
||||
#include "srslte/asn1/gtpc.h"
|
||||
|
||||
#include "srslte/common/common.h"
|
||||
|
||||
namespace srslte{
|
||||
|
||||
/*
|
||||
|
||||
int
|
||||
gtpc_pack_create_session_request(gtpc_create_session_request_t, srslte::byte_buffer_t)
|
||||
{
|
||||
if (imsi_present)
|
||||
|
||||
//FIXME
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
};
|
||||
|
|
|
@ -26,22 +26,33 @@
|
|||
#ifndef MME_GTPC_H
|
||||
#define MME_GTPC_H
|
||||
|
||||
#include "srslte/common/buffer_pool.h"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include "spgw/spgw.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);
|
||||
|
||||
private:
|
||||
|
||||
mme_gtpc();
|
||||
virtual ~mme_gtpc();
|
||||
static mme_gtpc *m_instance;
|
||||
|
||||
srslte::byte_buffer_pool *m_pool;
|
||||
|
||||
spgw* m_spgw;
|
||||
in_addr_t m_mme_gtpc_ip;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -25,13 +25,15 @@
|
|||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "srslte/asn1/gtpc.h"
|
||||
#include "mme/mme_gtpc.h"
|
||||
|
||||
namespace srsepc{
|
||||
|
||||
mme_gtpc* mme_gtpc::m_instance = NULL;
|
||||
boost::mutex mme_gtpc_instance_mutex;
|
||||
|
||||
mme_gtpc::mme_gtpc():
|
||||
mme_gtpc::mme_gtpc()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,32 +65,33 @@ mme_gtpc::cleanup(void)
|
|||
void
|
||||
mme_gtpc::init()
|
||||
{
|
||||
m_mme_gtpc_ip = inet_addr("127.0.0.1");//FIXME At the moment, the GTP-C messages are not sent over the wire. So this parameter is not used.
|
||||
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;
|
||||
struct srslte::gtpc_pdu cs_req_pdu;
|
||||
struct srslte::gtpc_create_session_request *cs_req = &cs_req_pdu.choice.create_session_request;
|
||||
|
||||
//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
|
||||
cs_req_pdu.header.piggyback = false;
|
||||
cs_req_pdu.header.teid_present = true;
|
||||
cs_req_pdu.header.teid = 0; //Send create session request to the butler TEID
|
||||
cs_req_pdu.header.type = srslte::GTPC_MSG_TYPE_CREATE_SESSION_REQUEST;
|
||||
|
||||
//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);
|
||||
cs_req->sender_f_teid.tied = get_new_ctrl_teid();
|
||||
cs_req->sender_f_teid.ip = m_mme_gtpc_ip;
|
||||
// APN \\
|
||||
memcpy(cs_req.create_session_request.apn, "internet", sizeof("internet"));
|
||||
memcpy(cs_req->apn, "internet", sizeof("internet"));
|
||||
// RAT Type \\
|
||||
cs_req.create_session_request.rat_type = GTPC_RAT_TYPE::EUTRAN;
|
||||
cs_req->rat_type = GTPC_RAT_TYPE::EUTRAN;
|
||||
|
||||
//Save RX Control TEID
|
||||
create_rx_control_teid(create_session_request.sender_f_tied);
|
||||
create_rx_control_teid(cs_req->sender_f_tied);
|
||||
|
||||
spgw->handle_create_session_request(&cs_req, cs_resp);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue