Commit 08e7ab7c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

solve conflits after merging

parents b6d14237 24916e33
# openair-cn-cups
Control User Plane Separation of SPGW-C and SPGW-U
├── http://www.openairinterface.org/?page_id=698
# openair-cn5g-smf
It is distributed under OAI Public License V1.0.
The license information is distributed under LICENSE file in the same directory.
The OpenAirInterface CN CUPS software is composed of the following parts:
The OpenAirInterface CN SMF software is composed of the following parts:
openair-cn-cups
├── build : Build directory, contains targets and object files generated by compilation of network functions.
├── log : Directory containing build log files.
├── scripts : Directory containing scripts for building network functions
├── spgw_c : Directory containing CMakefile.txt and object files generated by compilation of SPGW-C network function.
├── spgw_u : Directory containing CMakefile.txt and object files generated by compilation of SPGW-U network function.
├── etc : Directory containing the configuration files to be deployed for each network function.
└── src : Source files of network functions.
├── common : Common header files
│   ├── msg : ITTI messages definitions.
│   └── utils : Common utilities.
├── gtpv1u : Generic GTPV1-U stack implementation
├── gtpv2c : Generic GTPV2-C stack implementation
├── itti : Inter task interface
├── oai_spgwc : SPGW-C main directory, contains the "main" CMakeLists.txt file.
├── oai_spgwu : SPGW-U main directory, contains the "main" CMakeLists.txt file.
├── pfcp : Generic PFCP stack implementation.
├── pgwc : PGW-C network fonctions procedures and contexts.
├── sgwc : SGW-C network fonctions procedures and contexts.
├── spgwu : SPGW-U network fonctions procedures and contexts.
│   └── simpleswitch : Very Basic Switch implementation.
└── udp : UDP server implementation.
RELEASE NOTES:
v1.0.0 -> First release, Able to serve a MME with basic attach, detach, release, paging procedures, default bearer only.
openair-cn5g-smf
├── build: Build directory, contains targets and object files generated by compilation of network functions.
├── log: Directory containing build log files.
├── scripts: Directory containing scripts for building network functions
└── smf: Directory containing CMakefile.txt and object files generated by compilation of SMF network function.
├── etc: Directory containing the configuration file to be deployed for SMF.
└── src: Source files of SMF.
├── common: Common header files
│   ├── msg: ITTI messages definitions.
│   └── utils: Common utilities.
├── gtpv1u: Generic GTPV1-U stack implementation
├── gtpv2c: Generic GTPV2-C stack implementation
├── itti: Inter task interface
├── nas: NAS protocol implememtation
├── mgap: NGAP protocol implememtation
├── oai_smf: SMF main directory, contains the "main" CMakeLists.txt file.
├── pfcp: Generic PFCP stack implementation.
├── smf_app: SMF network functions procedures and contexts.
├── test: Minimal implementation for AMF, UDM network functions for testing purpose.
├── utils: Common utilities.  
└── udp : UDP server implementation.
# OAI-SMF
......
......@@ -31,24 +31,6 @@ SMF =
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 85;
#};
#S11_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#S5S8_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#SX_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#SMF_APP_SCHED_PARAMS :
#{
#CPU_ID = 1;
......@@ -81,25 +63,13 @@ SMF =
PORT = @SMF_INTERFACE_PORT_FOR_N11@
};
SX :
{
# P-GW binded interface for SX communication
INTERFACE_NAME = "@PGW_INTERFACE_NAME_FOR_SX@"; # STRING, interface name
IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address
#PORT = 8805;
#SCHED_PARAMS : # SCHEADULING PARAMS OF THE LOOPING RECEIVER THREAD BOUND TO THIS INTERFACE/PROTOCOL
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 95;
#};
};
TEST_UPF :
{
# P-GW binded interface for SX communication
IS_TEST = "0"; # 0: no test,1:test
GNB_IPV4_ADDRESS = "192.168.20.136"; # STRING,gnb_ip
};
};
......@@ -158,6 +128,10 @@ SMF =
IPV4_ADDRESS="@SMF_UDM_IPV4_ADDRESS@";
PORT = @SMF_UDM_PORT@;
};
UPF_LIST = (
{IPV4_ADDRESS="192.168.160.100" ;}
);
};
# REST API Server for Nsmf_PDUSession
## Overview
This API Server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
It uses the [Pistache](https://github.com/oktal/pistache) Framework.
## Files organization
The Pistache C++ REST server generator creates three folders:
- `api`: This folder contains the handlers for each method specified in the OpenAPI definition. Every handler extracts
the path and body parameters (if any) from the requests and tries to parse and possibly validate them.
Once this step is completed, the main API class calls the corresponding abstract method that should be implemented
by the developer (a basic implementation is provided under the `impl` folder)
- `impl`: As written above, the implementation folder contains, for each API, the corresponding implementation class,
which extends the main API class and implements the abstract methods.
Every method receives the path and body parameters as constant reference variables and a reference to the response
object, that should be filled with the right response and sent at the end of the method with the command:
response.send(returnCode, responseBody, [mimeType])
- `model`: This folder contains the corresponding class for every object schema found in the OpenAPI specification.
The main folder contains also a file with a main that can be used to start the server.
Of course, is you should customize this file based on your needs
## Installation
First of all, you need to download and install the libraries listed [here](#libraries-required).
Once the libraries are installed, in order to compile and run the server please follow the steps below:
```bash
mkdir build
cd build
cmake ..
make
```
Once compiled run the server:
```bash
cd build
./api-server
```
## Libraries required
- [pistache](http://pistache.io/quickstart)
- [JSON for Modern C++](https://github.com/nlohmann/json/#integration): Please download the `json.hpp` file and
put it under the model/nlohmann folder
## Namespaces
oai.smf.api
oai.smf.model
......@@ -15,6 +15,29 @@
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef IndividualSMContextApi_H_
#define IndividualSMContextApi_H_
......@@ -32,7 +55,13 @@
#include "SmContextUpdateData.h"
#include "SmContextUpdateError.h"
#include "SmContextUpdatedData.h"
#include <string>
#include "SmContextUpdateMessage.h"
#include "SmContextReleaseMessage.h"
#include "SmContextMessage.h"
#include "SmContextCreateError.h"
#include "SmContextCreatedData.h"
namespace oai {
namespace smf_server {
......@@ -46,7 +75,7 @@ public:
virtual ~IndividualSMContextApi() {}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
......@@ -66,7 +95,7 @@ private:
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextReleaseData">representation of the data to be sent to the SMF when releasing the SM context (optional)</param>
virtual void release_sm_context(const std::string &smContextRef, const SmContextReleaseData &smContextReleaseData, Pistache::Http::ResponseWriter &response) = 0;
virtual void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieve SM Context
......@@ -86,7 +115,7 @@ private:
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextUpdateData">representation of the updates to apply to the SM context</param>
virtual void update_sm_context(const std::string &smContextRef, const SmContextUpdateData &smContextUpdateData, Pistache::Http::ResponseWriter &response) = 0;
virtual void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response) = 0;
};
......
......@@ -46,88 +46,6 @@ extern "C" {
#include <map>
#include <string>
#define BOUNDARY "----Boundary"
typedef struct part {
std::map<std::string,std::string> headers;
std::string body;
} part;
static multipartparser_callbacks g_callbacks;
static bool g_body_begin_called;
static std::string g_header_name;
static std::string g_header_value;
static std::list<part> g_parts;
static bool g_body_end_called;
static void init_globals()
{
g_body_begin_called = false;
g_header_name.clear();
g_header_value.clear();
g_parts.clear();
g_body_end_called = false;
}
static int on_body_begin(multipartparser* /*parser*/)
{
g_body_begin_called = true;
return 0;
}
static int on_part_begin(multipartparser* /*parser*/)
{
g_parts.push_back(part());
return 0;
}
static void on_header_done()
{
g_parts.back().headers[g_header_name] = g_header_value;
g_header_name.clear();
g_header_value.clear();
}
static int on_header_field(multipartparser* /*parser*/, const char* data, size_t size)
{
if (g_header_value.size() > 0)
on_header_done();
g_header_name.append(data, size);
return 0;
}
static int on_header_value(multipartparser* /*parser*/, const char* data, size_t size)
{
g_header_value.append(data, size);
return 0;
}
static int on_headers_complete(multipartparser* /*parser*/)
{
if (g_header_value.size() > 0)
on_header_done();
return 0;
}
static int on_data(multipartparser* /*parser*/, const char* data, size_t size)
{
g_parts.back().body.append(data, size);
return 0;
}
static int on_part_end(multipartparser* /*parser*/)
{
return 0;
}
static int on_body_end(multipartparser* /*parser*/)
{
g_body_end_called = true;
return 0;
}
namespace oai {
namespace smf_server {
namespace api {
......@@ -136,82 +54,92 @@ using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
SMContextsCollectionApi::SMContextsCollectionApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
router = rtr;
}
void SMContextsCollectionApi::init() {
setupRoutes();
setupRoutes();
}
void SMContextsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
using namespace Pistache::Rest;
Routes::Post(*router, base + "/sm-contexts", Routes::bind(&SMContextsCollectionApi::post_sm_contexts_handler, this));
Routes::Post(*router, base + "/sm-contexts", Routes::bind(&SMContextsCollectionApi::post_sm_contexts_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&SMContextsCollectionApi::sm_contexts_collection_api_default_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&SMContextsCollectionApi::sm_contexts_collection_api_default_handler, this));
}
void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
Logger::smf_api_server().info("Received a SM context create request from AMF");
Logger::smf_api_server().debug("Request body: %s\n",request.body().c_str());
SmContextMessage smContextMessage;
SmContextCreateData smContextCreateData;
//step 1. use multipartparser to decode the request
multipartparser_callbacks_init(&g_callbacks);
g_callbacks.on_body_begin = &on_body_begin;
g_callbacks.on_part_begin = &on_part_begin;
g_callbacks.on_header_field = &on_header_field;
g_callbacks.on_header_value = &on_header_value;
g_callbacks.on_headers_complete = &on_headers_complete;
g_callbacks.on_data = &on_data;
g_callbacks.on_part_end = &on_part_end;
g_callbacks.on_body_end = &on_body_end;
multipartparser parser;
init_globals();
multipartparser_init(&parser, BOUNDARY);
if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) != strlen(request.body().c_str())) or (!g_body_begin_called)){
response.send(Pistache::Http::Code::Bad_Request, "");
return;
}
//at least 2 parts for Json data and N1 (+ N2)
if (g_parts.size() < 2){
response.send(Pistache::Http::Code::Bad_Request, "");
return;
}
part p0 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 1: \n%s", p0.body.c_str());
part p1 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 2: \n %s",p1.body.c_str());
if (g_parts.size() == 3) {
part p2 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 3: \n %s",p2.body.c_str());
}
//step 2. process the request
try {
nlohmann::json::parse(p0.body.c_str()).get_to(smContextCreateData);
smContextMessage.setJsonData(smContextCreateData);
smContextMessage.setBinaryDataN1SmMessage(p1.body.c_str());
this->post_sm_contexts(smContextMessage, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
Logger::smf_api_server().info("Received a SM context create request from AMF");
Logger::smf_api_server().debug("Request body: %s\n",request.body().c_str());
std::size_t found = request.body().find("Content-Type");
std::string boundary_str = request.body().substr(2, found - 4);
Logger::smf_api_server().debug("Boundary: %s", boundary_str.c_str());
SmContextMessage smContextMessage;
SmContextCreateData smContextCreateData;
//step 1. use multipartparser to decode the request
multipartparser_callbacks_init(&g_callbacks);
g_callbacks.on_body_begin = &on_body_begin;
g_callbacks.on_part_begin = &on_part_begin;
g_callbacks.on_header_field = &on_header_field;
g_callbacks.on_header_value = &on_header_value;
g_callbacks.on_headers_complete = &on_headers_complete;
g_callbacks.on_data = &on_data;
g_callbacks.on_part_end = &on_part_end;
g_callbacks.on_body_end = &on_body_end;
multipartparser parser;
init_globals();
multipartparser_init(&parser, reinterpret_cast<const char*>(boundary_str.c_str()));
if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) != strlen(request.body().c_str())) or (!g_body_begin_called)){
Logger::smf_api_server().warn("The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
//return;
}
Logger::smf_api_server().debug("Number of g_parts %d", g_parts.size());
//at least 2 parts for Json data and N1 (+ N2)
if (g_parts.size() < 2){
response.send(Pistache::Http::Code::Bad_Request, "");
return;
}
part p0 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 1: \n%s", p0.body.c_str());
part p1 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 2: \n %s",p1.body.c_str());
if (g_parts.size() > 0) {
part p2 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 3: \n %s",p2.body.c_str());
}
//step 2. process the request
try {
nlohmann::json::parse(p0.body.c_str()).get_to(smContextCreateData);
smContextMessage.setJsonData(smContextCreateData);
smContextMessage.setBinaryDataN1SmMessage(p1.body.c_str());
this->post_sm_contexts(smContextMessage, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
Logger::smf_api_server().warn("Can not parse the json data!");
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void SMContextsCollectionApi::sm_contexts_collection_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
}
......
......@@ -15,6 +15,28 @@
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef SMContextsCollectionApi_H_
#define SMContextsCollectionApi_H_
......@@ -42,7 +64,7 @@ public:
virtual ~SMContextsCollectionApi() {}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
......@@ -33,6 +33,7 @@
#include "IndividualSMContextApiImpl.h"
namespace oai {
namespace smf_server {
namespace api {
......@@ -40,42 +41,104 @@ namespace api {
using namespace oai::smf_server::model;
IndividualSMContextApiImpl::IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: IndividualSMContextApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
: IndividualSMContextApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
void IndividualSMContextApiImpl::release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) {
//TODO: to be updated as update_sm_context_handler
Logger::smf_api_server().info("release_sm_context...");
//handle Nsmf_PDUSession_UpdateSMContext Request
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request: PDU Session Release request from AMF.");
//Get the SmContextUpdateData from this message and process in smf_app
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
SmContextReleaseData smContextReleaseData = smContextReleaseMessage.getJsonData();
if (smContextReleaseData.n2SmInfoIsSet()){
//N2 SM (for Session establishment)
std::string n2_sm_information = smContextReleaseMessage.getBinaryDataN2SmInformation();
//std::string n2_sm_information = (smContextUpdateData.getN2SmInfo()).getContentId();
std::string n2_sm_msg_hex;
m_smf_app->convert_string_2_hex(n2_sm_information, n2_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s", n2_sm_information.c_str());
std::string n2_sm_info_type = smContextReleaseData.getN2SmInfoType();
sm_context_req_msg.set_n2_sm_information(n2_sm_msg_hex);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
}
//Step 2. TODO: initialize necessary values for sm context req from smContextReleaseData
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
//std::shared_ptr<itti_n11_update_sm_context_request> itti_msg = std::make_shared<itti_n11_update_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response, smContextRef);
//itti_msg->req = sm_context_req_msg;
//itti_msg->scid = smContextRef;
//m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
void IndividualSMContextApiImpl::release_sm_context(const std::string &smContextRef, const SmContextReleaseData &smContextReleaseData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("release_sm_context...");
response.send(Pistache::Http::Code::Ok, "Release_sm_context API has not been implemented yet!\n");
}
void IndividualSMContextApiImpl::retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("retrieve_sm_context...");
response.send(Pistache::Http::Code::Ok, "Retrieve_sm_context API has not been implemented yet!\n");
Logger::smf_api_server().info("retrieve_sm_context...");
response.send(Pistache::Http::Code::Ok, "Retrieve_sm_context API has not been implemented yet!\n");
}
void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextRef, const SmContextUpdateData &smContextUpdateData, Pistache::Http::ResponseWriter &response) {
//handle Nsmf_PDUSession_UpdateSMContext Request
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request from AMF.");
//Get the SmContextUpdateData from this message and process in smf_app
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
std::string n2_sm_information = (smContextUpdateData.getN2SmInfo()).getContentId();
std::string n2_sm_msg_hex;
m_smf_app->convert_string_2_hex(n2_sm_information, n2_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s",n2_sm_information.c_str());
std::string n2_sm_info_type = smContextUpdateData.getN2SmInfoType();
sm_context_req_msg.set_n2_sm_information(n2_sm_msg_hex);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
//Step 2. TODO: initialize necessary values for sm context req from smContextUpdateData
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg = std::make_shared<itti_n11_update_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response, smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->scid = smContextRef;
m_smf_app->handle_amf_msg(itti_msg);
void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response) {
//Get the SmContextUpdateData from this message and process in smf_app
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request from AMF.");
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
SmContextUpdateData smContextUpdateData = smContextUpdateMessage.getJsonData();
if (smContextUpdateData.n2SmInfoIsSet()){
//N2 SM (for Session establishment)
std::string n2_sm_information = smContextUpdateMessage.getBinaryDataN2SmInformation();
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s", n2_sm_information.c_str());
std::string n2_sm_info_type = smContextUpdateData.getN2SmInfoType();
sm_context_req_msg.set_n2_sm_information(n2_sm_information);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
} else if (smContextUpdateData.n1SmMsgIsSet()){
//N1 SM (for session modification)
std::string n1_sm_message = smContextUpdateMessage.getBinaryDataN1SmMessage();
Logger::smf_api_server().debug("smContextMessage, n1 sm message %s", n1_sm_message.c_str());
sm_context_req_msg.set_n1_sm_message(n1_sm_message);
}
//Step 2. TODO: initialize necessary values for sm context req from smContextUpdateData
/* UE-initiated Service Request Operation, section 4.2.3.2@3GPP TS 23.502 */
//Step 4: PDU Session IDs, Operation Type, UE location Info, Access Type, RAT Type, UE presence in LADN service area, Indication of Access Type can be changed
//PDU Session IDs
//UpCnxState, for activation of user plane (see 5.2.2.3.2.2@3GPP TS 29.502)
if(smContextUpdateData.upCnxStateIsSet()) sm_context_req_msg.set_upCnx_state(smContextUpdateData.getUpCnxState());
//Access Type
if (smContextUpdateData.anTypeIsSet()) sm_context_req_msg.set_an_type(smContextUpdateData.getAnType());
//RAT Type
if (smContextUpdateData.ratTypeIsSet()) sm_context_req_msg.set_rat_type(smContextUpdateData.getRatType());
//TODO:
//UE presence in LADN service area
//UE location information
//Indication of Access Type can be changed
//if (smContextUpdateData.anTypeCanBeChangedIsSet()) sm_context_req_msg.set_access_type_can_be_changed(smContextUpdateData.isAnTypeCanBeChanged());
//Step 15: N2 SM Info (AN Tunnel Info, List of accepted QoS Flow, List of rejected Qos Flows, PDU Session ID), RAT Type, Access Type
/* UE-initiated PDU Session Establishment Operation - section 4.3.2.2.1@3GPP TS 23.502 */
//TODO: Existing PDU session, step 3, SUPI, DNN, S-NSSAIs, SM Context ID, AMF ID, Request Type, N1 SM Container (PDU Session Establishment Request), User location, Access Type, RAT Type, PEI
//step 15. (SM Context ID -> SCID, N2 SM, Request Type)(Initial Request)
//TODO: verify why Request Type is not define in smContextUpdateData
/* PDU Session Modification (SM Context ID -> SCID, N1/N2), section 4.3.3.2@3GPP TS 23.502: */
//step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification Request)
//step 1.e (AN initiated modification): SM Context ID, N2 SM information (QFI, User location Information and an indication that the QoS Flow is released)
//step 7a, SM Context ID, N2 SM information, UE location information
//Step 11, SM Context ID, N1 SM (PDU Session Modification Command ACK), User location
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg = std::make_shared<itti_n11_update_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response, smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->scid = smContextRef;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
}
......
......@@ -15,6 +15,26 @@
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef INDIVIDUAL_SM_CONTEXT_API_IMPL_H_
#define INDIVIDUAL_SM_CONTEXT_API_IMPL_H_
......@@ -36,6 +56,8 @@
#include "SmContextUpdateData.h"
#include "SmContextUpdateError.h"
#include "SmContextUpdatedData.h"
#include "SmContextUpdateMessage.h"
#include "SmContextReleaseMessage.h"
#include <string>
#include "smf_app.hpp"
......@@ -50,9 +72,9 @@ public:
IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualSMContextApiImpl() {}
void release_sm_context(const std::string &smContextRef, const SmContextReleaseData &smContextReleaseData, Pistache::Http::ResponseWriter &response);
void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response);
void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response);
void update_sm_context(const std::string &smContextRef, const SmContextUpdateData &smContextUpdateData, Pistache::Http::ResponseWriter &response);
void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
......
......@@ -51,84 +51,90 @@ SMContextsCollectionApiImpl::SMContextsCollectionApiImpl(std::shared_ptr<Pistach
void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("Process SmContextMessage ...");
//Assign the necessary informations to smf::pdu_session_create_sm_context_request
//and pass this message to SMF to handle this message
//decode NAS should be done in SMF APP
SmContextCreateData smContextCreateData = smContextMessage.getJsonData();
std::string n1_sm_msg = smContextMessage.getBinaryDataN1SmMessage();
std::string n1_sm_msg_hex;
m_smf_app->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s",n1_sm_msg.c_str());
//Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
Logger::smf_api_server().debug("Create a pdu_session_create_sm_context_request message and store the necessary information\n");
smf::pdu_session_create_sm_context_request sm_context_req_msg = {};
//set N1 SM Message
sm_context_req_msg.set_n1_sm_message(n1_sm_msg_hex);
//set api root to be used as location header in HTTP response
sm_context_req_msg.set_api_root(m_address + base + "/sm-contexts");
//supi
supi_t supi = {.length = 0};
std::size_t pos = smContextCreateData.getSupi().find("-");
std::string supi_str = smContextCreateData.getSupi().substr(pos +1);
std::string supi_prefix = smContextCreateData.getSupi().substr(0, pos);
smf_string_to_supi(&supi, supi_str.c_str());
sm_context_req_msg.set_supi(supi);
sm_context_req_msg.set_supi_prefix(supi_prefix);
Logger::smf_api_server().debug("SmContextCreateData, supi %s, prefix %s, imsi %s \n", smContextCreateData.getSupi().c_str(), supi_prefix.c_str(), supi_str.c_str());
//dnn
Logger::smf_api_server().debug("SmContextCreateData, dnn %s \n", smContextCreateData.getDnn().c_str());
sm_context_req_msg.set_dnn(smContextCreateData.getDnn().c_str());
//S-Nssai
Logger::smf_api_server().debug("SmContextCreateData, S-NSSAI sst %d, sd %s\n", smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSd().c_str());
snssai_t snssai(smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSd().c_str());
sm_context_req_msg.set_snssai(snssai);
//PDU session ID
Logger::smf_api_server().debug("SmContextCreateData, PDU SessionID %d \n", smContextCreateData.getPduSessionId());
sm_context_req_msg.set_pdu_session_id(smContextCreateData.getPduSessionId());
//AMF ID
Logger::smf_api_server().debug("SmContextCreateDatea, ServingNfId %s\n", smContextCreateData.getServingNfId().c_str());
sm_context_req_msg.set_serving_nf_id(smContextCreateData.getServingNfId().c_str()); //TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
//Request Type
Logger::smf_api_server().debug("SmContextCreateData, RequestType %s\n", smContextCreateData.getRequestType().c_str());
sm_context_req_msg.set_request_type(smContextCreateData.getRequestType());
//PCF ID
// Priority Access
//User Location Information
//Access Type
// PEI
// GPSI
// UE presence in LADN service area
// DNN Selection Mode
Logger::smf_api_server().debug("SmContextCreateData, SelMode %s\n", smContextCreateData.getSelMode().c_str());
sm_context_req_msg.set_dnn_selection_mode(smContextCreateData.getSelMode().c_str());
//Subscription for PDU Session Status Notification
// Trace requirement
//SSC mode (Optional)
//5GSM capability (Optional)
//Maximum number of supported (Optional)
//Maximum number of supported packet filters (Optional)
//Always-on PDU session requested (Optional)
//SM PDU DN request container (Optional)
//Extended protocol configuration options (Optional) e.g, FOR DHCP
//Step 3. Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg = std::make_shared<itti_n11_create_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response);
itti_msg->req = sm_context_req_msg;
m_smf_app->handle_amf_msg(itti_msg);
Logger::smf_api_server().info("PDU Session Create SM Context Request ...");
//Assign the necessary informations to smf::pdu_session_create_sm_context_request
//and pass this message to SMF to handle this message
//decode NAS should be done in SMF APP
SmContextCreateData smContextCreateData = smContextMessage.getJsonData();
std::string n1_sm_msg = smContextMessage.getBinaryDataN1SmMessage();
std::string n1_sm_msg_hex;
m_smf_app->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s",n1_sm_msg.c_str());
//Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
Logger::smf_api_server().debug("Create a pdu_session_create_sm_context_request message and store the necessary information\n");
smf::pdu_session_create_sm_context_request sm_context_req_msg = {};
//set N1 SM Message
sm_context_req_msg.set_n1_sm_message(n1_sm_msg_hex);
//set api root to be used as location header in HTTP response
sm_context_req_msg.set_api_root(m_address + base + "/sm-contexts");
//supi
supi_t supi = {.length = 0};
std::size_t pos = smContextCreateData.getSupi().find("-");
std::string supi_str = smContextCreateData.getSupi().substr(pos +1);
std::string supi_prefix = smContextCreateData.getSupi().substr(0, pos);
smf_string_to_supi(&supi, supi_str.c_str());
sm_context_req_msg.set_supi(supi);
sm_context_req_msg.set_supi_prefix(supi_prefix);
Logger::smf_api_server().debug("SmContextCreateData, supi %s, prefix %s, imsi %s \n", smContextCreateData.getSupi().c_str(), supi_prefix.c_str(), supi_str.c_str());
//dnn
Logger::smf_api_server().debug("SmContextCreateData, dnn %s \n", smContextCreateData.getDnn().c_str());
sm_context_req_msg.set_dnn(smContextCreateData.getDnn().c_str());
//S-Nssai
Logger::smf_api_server().debug("SmContextCreateData, S-NSSAI sst %d, sd %s\n", smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSd().c_str());
snssai_t snssai(smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSd().c_str());
sm_context_req_msg.set_snssai(snssai);
//PDU session ID
Logger::smf_api_server().debug("SmContextCreateData, PDU SessionID %d \n", smContextCreateData.getPduSessionId());
sm_context_req_msg.set_pdu_session_id(smContextCreateData.getPduSessionId());
//AMF ID (ServingNFId)
Logger::smf_api_server().debug("SmContextCreateDatea, ServingNfId %s\n", smContextCreateData.getServingNfId().c_str());
sm_context_req_msg.set_serving_nf_id(smContextCreateData.getServingNfId().c_str()); //TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
//Request Type
Logger::smf_api_server().debug("SmContextCreateData, RequestType %s\n", smContextCreateData.getRequestType().c_str());
sm_context_req_msg.set_request_type(smContextCreateData.getRequestType());
//PCF ID
// Priority Access
//User Location Information
//Access Type
// PEI
// GPSI
// UE presence in LADN service area
//Guami
//servingNetwork
//anType
//UETimeZone
//SMContextStatusUri
//PCFId
// DNN Selection Mode
Logger::smf_api_server().debug("SmContextCreateData, SelMode %s\n", smContextCreateData.getSelMode().c_str());
sm_context_req_msg.set_dnn_selection_mode(smContextCreateData.getSelMode().c_str());
//Subscription for PDU Session Status Notification
// Trace requirement
//SSC mode (Optional)
//5GSM capability (Optional)
//Maximum number of supported (Optional)
//Maximum number of supported packet filters (Optional)
//Always-on PDU session requested (Optional)
//SM PDU DN request container (Optional)
//Extended protocol configuration options (Optional) e.g, FOR DHCP
//Step 3. Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg = std::make_shared<itti_n11_create_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response);
itti_msg->req = sm_context_req_msg;
m_smf_app->handle_pdu_session_create_sm_context_request(itti_msg);
}
......
......@@ -15,6 +15,26 @@
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef SM_CONTEXTS_COLLECTION_API_IMPL_H_
#define SM_CONTEXTS_COLLECTION_API_IMPL_H_
......
......@@ -260,11 +260,11 @@ void SmContextReleaseData::unsetN2SmInfo()
{
m_N2SmInfoIsSet = false;
}
N2SmInfoType SmContextReleaseData::getN2SmInfoType() const
std::string SmContextReleaseData::getN2SmInfoType() const
{
return m_N2SmInfoType;
}
void SmContextReleaseData::setN2SmInfoType(N2SmInfoType const& value)
void SmContextReleaseData::setN2SmInfoType(std::string const& value)
{
m_N2SmInfoType = value;
m_N2SmInfoTypeIsSet = true;
......
......@@ -104,8 +104,8 @@ public:
/// <summary>
///
/// </summary>
N2SmInfoType getN2SmInfoType() const;
void setN2SmInfoType(N2SmInfoType const& value);
std::string getN2SmInfoType() const;
void setN2SmInfoType(std::string const& value);
bool n2SmInfoTypeIsSet() const;
void unsetN2SmInfoType();
/// <summary>
......@@ -135,7 +135,7 @@ protected:
bool m_VsmfReleaseOnlyIsSet;
RefToBinaryData m_N2SmInfo;
bool m_N2SmInfoIsSet;
N2SmInfoType m_N2SmInfoType;
std::string m_N2SmInfoType;
bool m_N2SmInfoTypeIsSet;
bool m_IsmfReleaseOnly;
bool m_IsmfReleaseOnlyIsSet;
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include <iostream>
#include "SmContextReleaseMessage.h"
namespace oai {
namespace smf_server {
namespace model {
SmContextReleaseMessage::SmContextReleaseMessage()
{
m_JsonDataIsSet = false;
m_BinaryDataN2SmInformationIsSet = false;
}
SmContextReleaseMessage::~SmContextReleaseMessage()
{
}
void SmContextReleaseMessage::validate()
{
// TODO: implement validation
}
void to_json(nlohmann::json& j, const SmContextReleaseMessage& o)
{
j = nlohmann::json();
if(o.jsonDataIsSet())
j["jsonData"] = o.m_JsonData;
if(o.binaryDataN2SmInformationIsSet())
j["binaryDataN2SmInformation"] = o.m_BinaryDataN2SmInformation;
}
void from_json(const nlohmann::json& j, SmContextReleaseMessage& o)
{
if(j.find("jsonData") != j.end())
{
j.at("jsonData").get_to(o.m_JsonData);
o.m_JsonDataIsSet = true;
}
if(j.find("binaryDataN2SmInformation") != j.end())
{
j.at("binaryDataN2SmInformation").get_to(o.m_BinaryDataN2SmInformation);
o.m_BinaryDataN2SmInformationIsSet = true;
}
}
SmContextReleaseData SmContextReleaseMessage::getJsonData() const
{
return m_JsonData;
}
void SmContextReleaseMessage::setJsonData(SmContextReleaseData const& value)
{
m_JsonData = value;
m_JsonDataIsSet = true;
}
bool SmContextReleaseMessage::jsonDataIsSet() const
{
return m_JsonDataIsSet;
}
void SmContextReleaseMessage::unsetJsonData()
{
m_JsonDataIsSet = false;
}
std::string SmContextReleaseMessage::getBinaryDataN2SmInformation() const
{
return m_BinaryDataN2SmInformation;
}
void SmContextReleaseMessage::setBinaryDataN2SmInformation(std::string const& value)
{
m_BinaryDataN2SmInformation = value;
m_BinaryDataN2SmInformationIsSet = true;
}
bool SmContextReleaseMessage::binaryDataN2SmInformationIsSet() const
{
return m_BinaryDataN2SmInformationIsSet;
}
void SmContextReleaseMessage::unsetBinaryDataN2SmInformation()
{
m_BinaryDataN2SmInformationIsSet = false;
}
}
}
}
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Inline_object.h
*
*
*/
#ifndef Sm_Context_Release_Message_H_
#define Sm_Context_Release_Message_H_
#include "SmContextReleaseData.h"
#include <string>
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class SmContextReleaseMessage
{
public:
SmContextReleaseMessage();
virtual ~SmContextReleaseMessage();
void validate();
/////////////////////////////////////////////
/// Inline_object members
/// <summary>
///
/// </summary>
SmContextReleaseData getJsonData() const;
void setJsonData(SmContextReleaseData const& value);
bool jsonDataIsSet() const;
void unsetJsonData();
/// </summary>
std::string getBinaryDataN2SmInformation() const;
void setBinaryDataN2SmInformation(std::string const& value);
bool binaryDataN2SmInformationIsSet() const;
void unsetBinaryDataN2SmInformation();
friend void to_json(nlohmann::json& j, const SmContextReleaseMessage& o);
friend void from_json(const nlohmann::json& j, SmContextReleaseMessage& o);
protected:
SmContextReleaseData m_JsonData;
bool m_JsonDataIsSet;
std::string m_BinaryDataN2SmInformation;
bool m_BinaryDataN2SmInformationIsSet;
};
}
}
}
#endif /* Sm_Context_Release_Message_H_ */
......@@ -427,11 +427,11 @@ void SmContextUpdateData::unsetBackupAmfInfo()
{
m_BackupAmfInfoIsSet = false;
}
AccessType SmContextUpdateData::getAnType() const
std::string SmContextUpdateData::getAnType() const
{
return m_AnType;
}
void SmContextUpdateData::setAnType(AccessType const& value)
void SmContextUpdateData::setAnType(std::string const& value)
{
m_AnType = value;
m_AnTypeIsSet = true;
......@@ -461,11 +461,11 @@ void SmContextUpdateData::unsetSecondAnType()
{
m_SecondAnTypeIsSet = false;
}
RatType SmContextUpdateData::getRatType() const
std::string SmContextUpdateData::getRatType() const
{
return m_RatType;
}
void SmContextUpdateData::setRatType(RatType const& value)
void SmContextUpdateData::setRatType(std::string const& value)
{
m_RatType = value;
m_RatTypeIsSet = true;
......@@ -546,11 +546,11 @@ void SmContextUpdateData::unsetAddUeLocation()
{
m_AddUeLocationIsSet = false;
}
UpCnxState SmContextUpdateData::getUpCnxState() const
std::string SmContextUpdateData::getUpCnxState() const
{
return m_UpCnxState;
}
void SmContextUpdateData::setUpCnxState(UpCnxState const& value)
void SmContextUpdateData::setUpCnxState(std::string const& value)
{
m_UpCnxState = value;
m_UpCnxStateIsSet = true;
......
......@@ -97,8 +97,9 @@ public:
/// <summary>
///
/// </summary>
AccessType getAnType() const;
void setAnType(AccessType const& value);
//AccessType getAnType() const;
std::string getAnType() const;
void setAnType(std::string const& value);
bool anTypeIsSet() const;
void unsetAnType();
/// <summary>
......@@ -111,8 +112,9 @@ public:
/// <summary>
///
/// </summary>
RatType getRatType() const;
void setRatType(RatType const& value);
//RatType getRatType() const;
std::string getRatType() const;
void setRatType(std::string const& value);
bool ratTypeIsSet() const;
void unsetRatType();
/// <summary>
......@@ -146,8 +148,9 @@ public:
/// <summary>
///
/// </summary>
UpCnxState getUpCnxState() const;
void setUpCnxState(UpCnxState const& value);
//UpCnxState getUpCnxState() const;
std::string getUpCnxState() const;
void setUpCnxState(std::string const& value);
bool upCnxStateIsSet() const;
void unsetUpCnxState();
/// <summary>
......@@ -333,11 +336,11 @@ protected:
bool m_ServingNetworkIsSet;
std::vector<BackupAmfInfo> m_BackupAmfInfo;
bool m_BackupAmfInfoIsSet;
AccessType m_AnType;
std::string m_AnType;
bool m_AnTypeIsSet;
AccessType m_SecondAnType;
bool m_SecondAnTypeIsSet;
RatType m_RatType;
std::string m_RatType;
bool m_RatTypeIsSet;
PresenceState m_PresenceInLadn;
bool m_PresenceInLadnIsSet;
......@@ -347,7 +350,8 @@ protected:
bool m_UeTimeZoneIsSet;
UserLocation m_AddUeLocation;
bool m_AddUeLocationIsSet;
UpCnxState m_UpCnxState;
//UpCnxState m_UpCnxState;
std::string m_UpCnxState;
bool m_UpCnxStateIsSet;
HoState m_HoState;
bool m_HoStateIsSet;
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include <iostream>
#include "SmContextUpdateMessage.h"
namespace oai {
namespace smf_server {
namespace model {
SmContextUpdateMessage::SmContextUpdateMessage()
{
m_JsonDataIsSet = false;
m_BinaryDataN1SmMessageIsSet = false;
m_BinaryDataN2SmInformationIsSet = false;
}
SmContextUpdateMessage::~SmContextUpdateMessage()
{
}
void SmContextUpdateMessage::validate()
{
// TODO: implement validation
}
void to_json(nlohmann::json& j, const SmContextUpdateMessage& o)
{
j = nlohmann::json();
if(o.jsonDataIsSet())
j["jsonData"] = o.m_JsonData;
if(o.binaryDataN1SmMessageIsSet())
j["binaryDataN1SmMessage"] = o.m_BinaryDataN1SmMessage;
if(o.binaryDataN2SmInformationIsSet())
j["binaryDataN2SmInformation"] = o.m_BinaryDataN2SmInformation;
}
void from_json(const nlohmann::json& j, SmContextUpdateMessage& o)
{
if(j.find("jsonData") != j.end())
{
j.at("jsonData").get_to(o.m_JsonData);
o.m_JsonDataIsSet = true;
}
if(j.find("binaryDataN1SmMessage") != j.end())
{
j.at("binaryDataN1SmMessage").get_to(o.m_BinaryDataN1SmMessage);
o.m_BinaryDataN1SmMessageIsSet = true;
}
if(j.find("binaryDataN2SmInformation") != j.end())
{
j.at("binaryDataN2SmInformation").get_to(o.m_BinaryDataN2SmInformation);
o.m_BinaryDataN2SmInformationIsSet = true;
}
}
SmContextUpdateData SmContextUpdateMessage::getJsonData() const
{
return m_JsonData;
}
void SmContextUpdateMessage::setJsonData(SmContextUpdateData const& value)
{
m_JsonData = value;
m_JsonDataIsSet = true;
}
bool SmContextUpdateMessage::jsonDataIsSet() const
{
return m_JsonDataIsSet;
}
void SmContextUpdateMessage::unsetJsonData()
{
m_JsonDataIsSet = false;
}
std::string SmContextUpdateMessage::getBinaryDataN1SmMessage() const
{
return m_BinaryDataN1SmMessage;
}
void SmContextUpdateMessage::setBinaryDataN1SmMessage(std::string const& value)
{
m_BinaryDataN1SmMessage = value;
m_BinaryDataN1SmMessageIsSet = true;
}
bool SmContextUpdateMessage::binaryDataN1SmMessageIsSet() const
{
return m_BinaryDataN1SmMessageIsSet;
}
void SmContextUpdateMessage::unsetBinaryDataN1SmMessage()
{
m_BinaryDataN1SmMessageIsSet = false;
}
std::string SmContextUpdateMessage::getBinaryDataN2SmInformation() const
{
return m_BinaryDataN2SmInformation;
}
void SmContextUpdateMessage::setBinaryDataN2SmInformation(std::string const& value)
{
m_BinaryDataN2SmInformation = value;
m_BinaryDataN2SmInformationIsSet = true;
}
bool SmContextUpdateMessage::binaryDataN2SmInformationIsSet() const
{
return m_BinaryDataN2SmInformationIsSet;
}
void SmContextUpdateMessage::unsetBinaryDataN2SmInformation()
{
m_BinaryDataN2SmInformationIsSet = false;
}
}
}
}
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Inline_object.h
*
*
*/
#ifndef Sm_Context_Update_Message_H_
#define Sm_Context_Update_Message_H_
#include "SmContextUpdateData.h"
#include <string>
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class SmContextUpdateMessage
{
public:
SmContextUpdateMessage();
virtual ~SmContextUpdateMessage();
void validate();
/////////////////////////////////////////////
/// Inline_object members
/// <summary>
///
/// </summary>
SmContextUpdateData getJsonData() const;
void setJsonData(SmContextUpdateData const& value);
bool jsonDataIsSet() const;
void unsetJsonData();
/// <summary>
///
/// </summary>
std::string getBinaryDataN1SmMessage() const;
void setBinaryDataN1SmMessage(std::string const& value);
bool binaryDataN1SmMessageIsSet() const;
void unsetBinaryDataN1SmMessage();
/// <summary>
///
/// </summary>
std::string getBinaryDataN2SmInformation() const;
void setBinaryDataN2SmInformation(std::string const& value);
bool binaryDataN2SmInformationIsSet() const;
void unsetBinaryDataN2SmInformation();
friend void to_json(nlohmann::json& j, const SmContextUpdateMessage& o);
friend void from_json(const nlohmann::json& j, SmContextUpdateMessage& o);
protected:
SmContextUpdateData m_JsonData;
bool m_JsonDataIsSet;
std::string m_BinaryDataN1SmMessage;
bool m_BinaryDataN1SmMessageIsSet;
std::string m_BinaryDataN2SmInformation;
bool m_BinaryDataN2SmInformationIsSet;
};
}
}
}
#endif /* Sm_Context_Update_Message_H_ */
......@@ -9,7 +9,26 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "pistache/endpoint.h"
#include "pistache/http.h"
......
......@@ -10,6 +10,27 @@
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "pistache/endpoint.h"
#include "pistache/http.h"
......
......@@ -495,6 +495,7 @@ typedef struct imsi_s imsi_t;
// 8.4 Cause
enum cause_value_e {
/* Request / Initial message */
UNKNOWN_ERROR = -1,
LOCAL_DETACH = 2,
COMPLETE_DETACH = 3,
RAT_CHANGE_3GPP_TO_NON_3GPP = 4, ///< RAT changed from 3GPP to Non-3GPP
......
......@@ -100,29 +100,31 @@ static const std::vector<std::string> pdu_session_application_error_e2str = {
"NETWORK_FAILURE"
};
enum n2_sm_info_type_e {
PDU_RES_SETUP_REQ = 1,
PDU_RES_SETUP_RSP = 2,
PDU_RES_SETUP_FAIL = 3,
PDU_RES_REL_CMD = 4,
PDU_RES_REL_RSP = 5,
PDU_RES_MOD_REQ = 6,
PDU_RES_MOD_RSP = 7,
PDU_RES_MOD_FAIL = 8,
PDU_RES_NTY = 9,
PDU_RES_NTY_REL = 10,
PDU_RES_MOD_IND = 11,
PDU_RES_MOD_CFM = 12,
PATH_SWITCH_REQ = 13,
PATH_SWITCH_SETUP_FAIL = 14,
PATH_SWITCH_REQ_ACK = 15,
PATH_SWITCH_REQ_FAIL = 16,
HANDOVER_REQUIRED = 17,
HANDOVER_CMD = 18,
HANDOVER_PREP_FAIL = 19,
HANDOVER_REQ_ACK = 20,
HANDOVER_RES_ALLOC_FAIL = 21,
SECONDARY_RAT_USAGE = 22
//6.1.6.3.12 Enumeration: N2SmInfoType @3GPP TS 29.502 V16.0.0
enum class n2_sm_info_type_e {
PDU_RES_SETUP_REQ = 1, //PDU Session Resource Setup Request Transfer
PDU_RES_SETUP_RSP = 2, //PDU Session Resource Setup Response Transfer
PDU_RES_SETUP_FAIL = 3, //PDU Session Resource Setup Unsuccessful Transfer
PDU_RES_REL_CMD = 4, //PDU Session Resource Release Command Transfer
PDU_RES_REL_RSP = 5, //PDU Session Resource Release Response Transfer
PDU_RES_MOD_REQ = 6, //PDU Session Resource Modify Request Transfer
PDU_RES_MOD_RSP = 7, //PDU Session Resource Modify Response Transfer
PDU_RES_MOD_FAIL = 8, //PDU Session Resource Modify Unsuccessful Transfer
PDU_RES_NTY = 9, //PDU Session Resource Notify Transfer
PDU_RES_NTY_REL = 10, //PDU Session Resource Notify Released Transfer
PDU_RES_MOD_IND = 11, //PDU Session Resource Modify Indication Transfer
PDU_RES_MOD_CFM = 12, //PDU Session Resource Modify Confirm Transfer
PATH_SWITCH_REQ = 13, //Path Switch Request Transfer
PATH_SWITCH_SETUP_FAIL = 14, //Path Switch Request Setup Failed Transfer
PATH_SWITCH_REQ_ACK = 15, //Path Switch Request Acknowledge Transfer
PATH_SWITCH_REQ_FAIL = 16, //Path Switch Request Unsuccessful Transfer
HANDOVER_REQUIRED = 17, //Handover Required Transfer
HANDOVER_CMD = 18, //Handover Command Transfer
HANDOVER_PREP_FAIL = 19, //Handover Preparation Unsuccessful Transfer
HANDOVER_REQ_ACK = 20, //Handover Request Acknowledge Transfer
HANDOVER_RES_ALLOC_FAIL = 21, //Handover Resource Allocation Unsuccessful Transfer
SECONDARY_RAT_USAGE = 22 //Secondary RAT Data Usage Report Transfer
};
static const std::vector<std::string> n2_sm_info_type_e2str = {
......@@ -151,5 +153,18 @@ static const std::vector<std::string> n2_sm_info_type_e2str = {
"SECONDARY_RAT_USAGE"
};
enum class upCnx_state_e {
UPCNX_STATE_ACTIVATED = 0,
UPCNX_STATE_DEACTIVATED = 1,
UPCNX_STATE_ACTIVATING =2
};
static const std::vector<std::string> upCnx_state_e2str = {
"UPCNX_STATE_ACTIVATED",
"UPCNX_STATE_DEACTIVATED",
"UPCNX_STATE_ACTIVATING"
};
#endif
......@@ -69,13 +69,15 @@ public:
class itti_n11_create_sm_context_response : public itti_n11_msg {
public:
itti_n11_create_sm_context_response(const task_id_t orig, const task_id_t dest, Pistache::Http::ResponseWriter& response):
itti_n11_msg(N11_SESSION_CREATE_SM_CONTEXT_RESPONSE, orig, dest), http_response(response.clone()) {}
itti_n11_create_sm_context_response(const itti_n11_create_sm_context_response& i) : itti_n11_msg(i), res(i.res), http_response(i.http_response.clone()) {}
itti_n11_msg(N11_SESSION_CREATE_SM_CONTEXT_RESPONSE, orig, dest), http_response(response.clone()), scid(0) {}
itti_n11_create_sm_context_response(const itti_n11_create_sm_context_response& i) : itti_n11_msg(i), res(i.res), http_response(i.http_response.clone()), scid(i.scid) {}
itti_n11_create_sm_context_response(const itti_n11_create_sm_context_response& i, const task_id_t orig, const task_id_t dest) :
itti_n11_msg(i, orig, dest), res(i.res), http_response(i.http_response.clone()) {}
itti_n11_msg(i, orig, dest), res(i.res), http_response(i.http_response.clone()), scid(i.scid) {}
const char* get_msg_name() {return "N11_SESSION_CREATE_SM_CONTEXT_RESPONSE";};
smf::pdu_session_create_sm_context_response res;
Pistache::Http::ResponseWriter http_response;
void set_scid(scid_t id) {scid = id;};
scid_t scid; //SM Context ID
};
......@@ -109,4 +111,56 @@ public:
};
//-----------------------------------------------------------------------------
class itti_n11_modify_session_request_smf_requested : public itti_n11_msg {
public:
itti_n11_modify_session_request_smf_requested(const task_id_t orig, const task_id_t dest):
itti_n11_msg(N11_SESSION_MODIFICATION_REQUEST_SMF_REQUESTED, orig, dest) {}
itti_n11_modify_session_request_smf_requested(const itti_n11_modify_session_request_smf_requested& i) : itti_n11_msg(i), req(i.req) {}
itti_n11_modify_session_request_smf_requested(const itti_n11_modify_session_request_smf_requested& i, const task_id_t orig, const task_id_t dest) :
itti_n11_msg(i, orig, dest), req(i.req) {}
const char* get_msg_name() {return "N11_SESSION_MODIFICATION_REQUEST_SMF_REQUESTED";};
smf::pdu_session_create_sm_context_request req;
};
//-----------------------------------------------------------------------------
class itti_n11_update_pdu_session_status : public itti_n11_msg {
public:
itti_n11_update_pdu_session_status(const task_id_t orig, const task_id_t dest):
itti_n11_msg(N11_SESSION_UPDATE_PDU_SESSION_STATUS, orig, dest), scid(0), pdu_session_status(pdu_session_status_e::PDU_SESSION_INACTIVE) {}
itti_n11_update_pdu_session_status(const itti_n11_update_pdu_session_status& i) : itti_n11_msg(i), scid(i.scid), pdu_session_status(i.pdu_session_status) {}
itti_n11_update_pdu_session_status(const itti_n11_update_pdu_session_status& i, const task_id_t orig, const task_id_t dest) :
itti_n11_msg(i, orig, dest), scid(i.scid), pdu_session_status(i.pdu_session_status){}
const char* get_msg_name() {return "N11_SESSION_UPDATE_PDU_SESSION_STATUS";};
void set_scid(scid_t id) {scid = id;};
scid_t scid; //SM Context ID
pdu_session_status_e pdu_session_status;
void set_pdu_session_status(pdu_session_status_e status) {pdu_session_status = status;};
};
//-----------------------------------------------------------------------------
class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
public:
itti_n11_n1n2_message_transfer_response_status(const task_id_t orig, const task_id_t dest):
itti_n11_msg(N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS, orig, dest), scid(0), response_code(0), msg_type(0) {}
itti_n11_n1n2_message_transfer_response_status(const itti_n11_n1n2_message_transfer_response_status& i) : itti_n11_msg(i), scid(i.scid), response_code(i.response_code), msg_type(i.msg_type) {}
itti_n11_n1n2_message_transfer_response_status(const itti_n11_n1n2_message_transfer_response_status& i, const task_id_t orig, const task_id_t dest) :
itti_n11_msg(i, orig, dest), scid(i.scid), response_code(i.response_code), msg_type(i.msg_type){}
const char* get_msg_name() {return "N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS";};
void set_scid(scid_t id) {scid = id;};
void set_response_code(int16_t code) {response_code = code;};
void set_cause(std::string c) {cause = c;};
void set_msg_type(uint8_t type) {msg_type = type;};
scid_t scid; //SM Context ID
int16_t response_code;
std::string cause;
uint8_t msg_type;
};
#endif /* ITTI_MSG_N11_HPP_INCLUDED_ */
......@@ -36,7 +36,7 @@
class itti_n4_restore : public itti_msg {
public:
itti_n4_restore(const task_id_t origin, const task_id_t destination):
itti_msg(RESTORE_SX_SESSIONS, origin, destination), sessions() {}
itti_msg(RESTORE_N4_SESSIONS, origin, destination), sessions() {}
itti_n4_restore(const itti_n4_restore& i) : itti_msg(i), sessions(i.sessions) {}
itti_n4_restore(const itti_n4_restore& i, const task_id_t orig, const task_id_t dest) : itti_n4_restore(i) {
origin = orig;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* itti_msg_nx.hpp
*
* Created on:
* Author:
*/
#ifndef ITTI_MSG_NX_HPP_INCLUDED_
#define ITTI_MSG_NX_HPP_INCLUDED_
#include "itti_msg.hpp"
#include "smf_msg.hpp"
#include "pistache/http.h"
class itti_nx_msg : public itti_msg {
public:
itti_nx_msg(const itti_msg_type_t msg_type, const task_id_t orig, const task_id_t dest):
itti_msg(msg_type, orig, dest) {
}
itti_nx_msg(const itti_nx_msg& i) : itti_msg(i) {}
itti_nx_msg(const itti_nx_msg& i, const task_id_t orig, const task_id_t dest) :
itti_nx_msg(i)
{
origin = orig;
destination = dest;
}
};
//-----------------------------------------------------------------------------
class itti_nx_modify_pdu_session_request_network_requested : public itti_nx_msg {
public:
itti_nx_modify_pdu_session_request_network_requested(const task_id_t orig, const task_id_t dest):
itti_nx_msg(NX_SESSION_MODIFICATION_REQUEST_NETWORK_REQUESTED, orig, dest) {}
itti_nx_modify_pdu_session_request_network_requested(const itti_nx_modify_pdu_session_request_network_requested& i) : itti_nx_msg(i) {}
itti_nx_modify_pdu_session_request_network_requested(const itti_nx_modify_pdu_session_request_network_requested& i, const task_id_t orig, const task_id_t dest) :
itti_nx_msg(i, orig, dest){}
const char* get_msg_name() {return "NX_SESSION_MODIFICATION_REQUEST_NETWORK_REQUESTED";};
// smf::pdu_session_create_sm_context_request req;
};
#endif /* ITTI_MSG_NX_HPP_INCLUDED_ */
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_38_401_SEEN
#define FILE_3GPP_38_401_SEEN
......
......@@ -38,9 +38,9 @@ typedef uint32_t sctp_assoc_id_t;
#define INVALID_RAN_UE_NGAP_ID_KEY 0xFFFFFFFFFFFFFFFF
#define RAN_UE_NGAP_ID_MASK 0x00FFFFFF
#define RAN_UE_NGAP_ID_FMT "0x%06"PRIX32
#define GNB_UE_NGAP_ID_FMT "0x%06"PRIX32
#define AMF_UE_NGAP_ID_FMT "0x%08"PRIX32
#define RAN_UE_NGAP_ID_FMT "0x%06" PRIX32
#define GNB_UE_NGAP_ID_FMT "0x%06" PRIX32
#define AMF_UE_NGAP_ID_FMT "0x%08" PRIX32
#define INVALID_AMF_UE_NGAP_ID 0x0
#define AMF_UE_NGAP_ID_MASK_ 0x0000FFFFFFFFFF
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdint.h>
#include "ngap_common.h"
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_NGAP_COMMON_SEEN
#define FILE_NGAP_COMMON_SEEN
......
......@@ -107,5 +107,55 @@ typedef struct pdu_session_type_s {
const std::string& toString() const {return pdu_session_type_e2str.at(pdu_session_type);}
} pdu_session_type_t;
//SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e {
HTTP_RESPONSE_CODE_OK = 200,
HTTP_RESPONSE_CODE_ACCEPTED = 202,
HTTP_RESPONSE_CODE_BAD_REQUEST = 400,
HTTP_RESPONSE_CODE_UNAUTHORIZED = 401,
HTTP_RESPONSE_CODE_FORBIDDEN = 403,
HTTP_RESPONSE_CODE_NOT_FOUND = 404,
HTTP_RESPONSE_CODE_METHOD_NOT_ALLOWED = 405,
HTTP_RESPONSE_CODE_REQUEST_TIMEOUT = 408,
HTTP_RESPONSE_CODE_406_NOT_ACCEPTED = 406,
HTTP_RESPONSE_CODE_CONFLICT = 409,
HTTP_RESPONSE_CODE_GONE = 410,
HTTP_RESPONSE_CODE_LENGTH_REQUIRED = 411,
HTTP_RESPONSE_CODE_PRECONDITION_FAILED = 412,
HTTP_RESPONSE_CODE_PAYLOAD_TOO_LARGE = 413,
HTTP_RESPONSE_CODE_URI_TOO_LONG = 414,
HTTP_RESPONSE_CODE_UNSUPPORTED_MEDIA_TYPE = 415,
HTTP_RESPONSE_CODE_TOO_MANY_REQUESTS = 429,
HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR = 500,
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504
};
//From 23.502
enum class session_management_procedures_type_e {
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED = 0,
PDU_SESSION_MODIFICATION_UE_INITIATED = 1,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 2,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 3,
PDU_SESSION_RELEASE_UE_REQUESTED = 4,
PDU_SESSION_RELEASE_NETWORK_REQUESTED = 5,
SERVICE_REQUEST_UE_TRIGGERED = 6,
SERVICE_REQUEST_NETWORK_TRIGGERED = 7
};
static const std::vector<std::string> session_management_procedures_type_e2str = {
"PDU_SESSION_ESTABLISHMENT_UE_REQUESTED",
"PDU_SESSION_MODIFICATION_UE_INITIATED",
"PDU_SESSION_MODIFICATION_SMF_REQUESTED",
"PDU_SESSION_MODIFICATION_AN_REQUESTED",
"PDU_SESSION_RELEASE_UE_REQUESTED",
"PDU_SESSION_RELEASE_NETWORK_REQUESTED",
"SERVICE_REQUEST_UE_TRIGGERED",
"SERVICE_REQUEST_NETWORK_TRIGGERED"
};
#endif
......@@ -38,7 +38,6 @@ typedef enum {
TASK_GTPV2_C,
TASK_SMF_APP,
TASK_SMF_N4,
TASK_SPGWU_SX,
TASK_SMF_N10,
TASK_SMF_N11,
TASK_MAX,
......@@ -60,7 +59,7 @@ typedef enum {
ITTI_MSG_TYPE_NONE = -1,
ITTI_MSG_TYPE_FIRST = 0,
ASYNC_SHELL_CMD = ITTI_MSG_TYPE_FIRST,
RESTORE_SX_SESSIONS,
RESTORE_N4_SESSIONS,
S11_REMOTE_PEER_NOT_RESPONDING,
S11_CREATE_SESSION_REQUEST,
S11_CREATE_SESSION_RESPONSE,
......@@ -106,11 +105,16 @@ typedef enum {
N4_SESSION_DELETION_RESPONSE,
N4_SESSION_REPORT_REQUEST,
N4_SESSION_REPORT_RESPONSE,
N10_GET_SESSION_MANAGEMENT_SUBSCRIPTION,
N10_SESSION_GET_SESSION_MANAGEMENT_SUBSCRIPTION,
N10_SESSION_CREATE_SMF_REGISTRATION_REQUEST,
N11_SESSION_CREATE_SM_CONTEXT_REQUEST,
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE,
N11_SESSION_UPDATE_SM_CONTEXT_REQUEST,
N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE,
N11_SESSION_MODIFICATION_REQUEST_SMF_REQUESTED,
N11_SESSION_UPDATE_PDU_SESSION_STATUS,
N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS,
NX_SESSION_MODIFICATION_REQUEST_NETWORK_REQUESTED,
UDP_INIT,
UDP_DATA_REQ,
UDP_DATA_IND,
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_24_501_H_SEEN
#define FILE_3GPP_24_501_H_SEEN
#ifdef __cplusplus
......@@ -214,6 +236,126 @@ static const std::vector<std::string> request_type_e2str = {
"RESERVED"
};
enum class cause_value_5gsm_e {
CAUSE_0_UNKNOWN = 0,
CAUSE_8_OPERATOR_DETERMINED_BARRING = 8,
CAUSE_26_INSUFFICIENT_RESOURCES = 26,
CAUSE_27_MISSING_OR_UNKNOWN_DNN = 27,
CAUSE_28_UNKNOWN_PDU_SESSION_TYPE = 28,
CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED = 29,
CAUSE_31_REQUEST_REJECTED_UNSPECIFIED = 31,
CAUSE_32_SERVICE_OPTION_NOT_SUPPORTED = 32,
CAUSE_33_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED = 33,
CAUSE_35_PTI_ALREADY_IN_USE = 35,
CAUSE_36_REGULAR_DEACTIVATION = 36,
CAUSE_38_NETWORK_FAILURE = 38,
CAUSE_39_REACTIVATION_REQUESTED = 39,
CAUSE_41_SEMATIC_ERROR_IN_THE_TFT_OPERATION = 41,
CAUSE_42_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATIOIN = 42,
CAUSE_43_INVALID_PDU_SESSION_IDENTITY = 43,
CAUSE_44_SEMANTIC_ERRORS_IN_PACKET_FILTERS = 44,
CAUSE_45_SYNTACTICAL_ERROR_IN_PACKET_FILTERS = 45,
CAUSE_46_OUT_OF_LAND_SERVICE_AREA = 46,
CAUSE_47_PTI_MISMATCH = 47,
CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED = 50,
CAUSE_51_PDU_SESSION_TYPE_IPV6_ONLY_ALLOWED = 50,
CAUSE_54_PDU_SESSION_DOES_NOT_EXIST = 54,
CAUSE_67_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN =67,
CAUSE_68_NOT_SUPPORTED_SSC_MODE = 68,
CAUSE_69_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE = 69,
CAUSE_70_MISSING_OR_UNKNOWN_DNN_IN_A_SLICE = 70,
CAUSE_81_INVALID_PTI_VALUE = 81,
CAUSE_82_MAXIMUM_DATA_RATE_PER_UE_FOR_USER_PLANE_INTEGRITY_PROTECTION_IS_TOO_LOW = 82,
CAUSE_83_SEMANTIC_ERROR_IN_THE_QOS_OPERATION =83,
CAUSE_84_SYNTACTICAL_ERROR_IN_THE_QOS_OPERATION = 84,
CAUSE_85_INVALID_MAPPED_EPS_BEARER_IDENTITY = 85,
//Protocol errors
CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE = 95,
CAUSE_96_INVALID_MANDATORY_INFORMATION = 96,
CAUSE_97_MESSAGE_TYPE_NON_EXISTENT_OR_NOTIMPLEMENTED = 97,
CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98,
CAUSE_99_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99,
CAUSE_100_CONDITIONAL_IE_ERROR = 100,
CAUSE_101_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101,
CAUSE_111_PROTOCOL_ERROR_UNSPECIFIED = 111
/*
Cause #8 – Operator Determined Barring
Cause #26 – Insufficient resources
Cause #27 – Missing or unknown DNN
Cause #28 – Unknown PDU session type
Cause #29 – User authentication or authorization failed
Cause #31 – Request rejected, unspecified
Cause #32 – Service option not supported
Cause #33 – Requested service option not subscribed
Cause #35 – PTI already in use
Cause #36 – Regular deactivation
Cause #38 – Network failure
Cause #39 – Reactivation requested
Cause #41 – Semantic error in the TFT operation
Cause #42 – Syntactical error in the TFT operation
Cause #43 –Invalid PDU session identity
Cause #44 – Semantic errors in packet filter(s)
Cause #45 – Syntactical error in packet filter(s)
Cause #46 –Out of LADN service area
Cause #47 –PTI mismatch
Cause #50 – PDU session type IPv4 only allowed
Cause #51 – PDU session type IPv6 only allowed
Cause #54 –PDU session does not exist
Cause #67 – Insufficient resources for specific slice and DNN
Cause #68 – Not supported SSC mode
Cause #69 –Insufficient resources for specific slice
Cause #70 – Missing or unknown DNN in a slice
Cause #81 – Invalid PTI value
Cause #82 – Maximum data rate per UE for user-plane integrity protection is too low
Cause #83 – Semantic error in the QoS operation
Cause #84 – Syntactical error in the QoS operation
Cause #85 – Invalid mapped EPS bearer identity
//Protocol errors
Cause #95 – Semantically incorrect message
Cause #96 – Invalid mandatory information
Cause #97 – Message type non-existent or not implemented
Cause #98 – Message type not compatible with protocol state
Cause #99 – Information element non-existent or not implemented
Cause #100 – Conditional IE error
Cause #101 – Message not compatible with protocol state
Cause #111 – Protocol error, unspecified
*/
};
enum cause_value_protocol_errors_e {
CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE = 95
/*
Cause #95 – Semantically incorrect message
Cause #96 – Invalid mandatory information
Cause #97 – Message type non-existent or not implemented
Cause #98 – Message type not compatible with protocol state
Cause #99 – Information element non-existent or not implemented
Cause #100 – Conditional IE error
Cause #101 – Message not compatible with protocol state
Cause #111 – Protocol error, unspecified
*/
};
//The 5GSM sublayer states for PDU session handling in the network
//Section 6.1.3.3 @3GPP TS 24.501 V16.1.0
enum class pdu_session_status_e {
PDU_SESSION_INACTIVE = 0,
PDU_SESSION_INACTIVE_PENDING = 1,
PDU_SESSION_MODIFICATION_PENDING =2,
PDU_SESSION_ACTIVE = 3
};
static const std::vector<std::string> pdu_session_status_e2str = {
"PDU_SESSION_INACTIVE",
"PDU_SESSION_INACTIVE_PENDING",
"PDU_SESSION_MODIFICATION_PENDING",
"PDU_SESSION_ACTIVE"
};
#endif
#endif
......@@ -8,71 +8,71 @@
int encode_allowed_ssc_mode ( AllowedSSCMode allowedsscmode, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint32_t encoded = 0;
uint8_t bitStream = 0x00;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,ALLOWED_SSC_MODE_MINIMUM_LENGTH , len);
if(iei > 0){
bitStream |= (iei & 0xf0);
}
uint32_t encoded = 0;
uint8_t bitStream = 0x00;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,ALLOWED_SSC_MODE_MINIMUM_LENGTH , len);
if(allowedsscmode.is_ssc3_allowed)
{
bitStream |= 0x04;
}
if(allowedsscmode.is_ssc2_allowed)
{
bitStream |= 0x02;
}
if(allowedsscmode.is_ssc1_allowed)
{
bitStream |= 0x01;
}
if(iei > 0){
bitStream |= (iei & 0xf0);
}
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
if(allowedsscmode.is_ssc3_allowed)
{
bitStream |= 0x04;
}
if(allowedsscmode.is_ssc2_allowed)
{
bitStream |= 0x02;
}
if(allowedsscmode.is_ssc1_allowed)
{
bitStream |= 0x01;
}
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
}
int decode_allowed_ssc_mode ( AllowedSSCMode * allowedsscmode, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t bitStream = 0x00;
int decoded=0;
uint8_t bitStream = 0x00;
DECODE_U8(buffer+decoded,bitStream,decoded);
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != (bitStream&0xf0)){
return -1;
}
if(iei > 0){
bitStream = (bitStream & 0x07);
}
if(iei != bitStream&0xf0){
return -1;
}
if(iei > 0){
bitStream = (bitStream & 0x07);
}
if(bitStream & 0x01)
{
allowedsscmode->is_ssc1_allowed = true;
}
else
{
allowedsscmode->is_ssc1_allowed = false;
}
if(bitStream & 0x02)
{
allowedsscmode->is_ssc2_allowed = true;
}
else
{
allowedsscmode->is_ssc2_allowed = false;
}
if(bitStream & 0x04)
{
allowedsscmode->is_ssc3_allowed = true;
}
else
{
allowedsscmode->is_ssc3_allowed = false;
}
if(bitStream & 0x01)
{
allowedsscmode->is_ssc1_allowed = true;
}
else
{
allowedsscmode->is_ssc1_allowed = false;
}
if(bitStream & 0x02)
{
allowedsscmode->is_ssc2_allowed = true;
}
else
{
allowedsscmode->is_ssc2_allowed = false;
}
if(bitStream & 0x04)
{
allowedsscmode->is_ssc3_allowed = true;
}
else
{
allowedsscmode->is_ssc3_allowed = false;
}
return decoded;
return decoded;
}
......@@ -8,43 +8,43 @@
int encode_alwayson_pdu_session_requested ( AlwaysonPDUSessionRequested alwaysonpdusessionrequested, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint32_t encoded = 0;
uint8_t bitStream = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,ALWAYSON_PDU_SESSION_REQUESTED_MINIMUM_LENGTH , len);
if(iei > 0){
bitStream |= (iei & 0xf0);
}
if(alwaysonpdusessionrequested.apsr_requested)
bitStream |= 0x01;
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
uint32_t encoded = 0;
uint8_t bitStream = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,ALWAYSON_PDU_SESSION_REQUESTED_MINIMUM_LENGTH , len);
if(iei > 0){
bitStream |= (iei & 0xf0);
}
if(alwaysonpdusessionrequested.apsr_requested)
bitStream |= 0x01;
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
}
int decode_alwayson_pdu_session_requested ( AlwaysonPDUSessionRequested * alwaysonpdusessionrequested, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t bitStream = 0;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
return -1;
}
if(iei > 0){
bitStream = (bitStream & 0x01);
}
if(bitStream)
alwaysonpdusessionrequested->apsr_requested = true;
else
alwaysonpdusessionrequested->apsr_requested = false;
return decoded;
int decoded=0;
uint8_t bitStream = 0;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != (bitStream&0xf0)){
return -1;
}
if(iei > 0){
bitStream = (bitStream & 0x01);
}
if(bitStream)
alwaysonpdusessionrequested->apsr_requested = true;
else
alwaysonpdusessionrequested->apsr_requested = false;
return decoded;
}
......@@ -8,40 +8,29 @@
int encode_configuration_update_indication ( ConfigurationUpdateIndication configurationupdateindication, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,CONFIGURATION_UPDATE_INDICATION_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,CONFIGURATION_UPDATE_INDICATION_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (configurationupdateindication, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (configurationupdateindication, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_configuration_update_indication ( ConfigurationUpdateIndication * configurationupdateindication, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (configurationupdateindication, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (configurationupdateindication, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,51 +8,52 @@
int encode_dnn ( DNN dnn, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? DNN_MINIMUM_LENGTH_TLV : DNN_MINIMUM_LENGTH_TLV-1) , len);
if( iei > 0 )
{
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? DNN_MINIMUM_LENGTH_TLV : DNN_MINIMUM_LENGTH_TLV-1) , len);
if( iei > 0 )
{
*buffer=iei;
encoded++;
}
if ((encode_result = encode_bstring (dnn, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
lenPtr = (buffer + encoded);
encoded++;
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
if ((encode_result = encode_bstring (dnn, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
}
int decode_dnn ( DNN * dnn, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded = 0;
uint8_t ielen = 0;
int decode_result = 0;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
int decoded = 0;
uint8_t ielen = 0;
int decode_result = 0;
ielen = *(buffer + decoded);
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
if((decode_result = decode_bstring (dnn, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
if((decode_result = decode_bstring (dnn, ielen, buffer + decoded, len - decoded)) < 0)
{
return decode_result;
} else{
decoded += decode_result;
}
return decoded;
}
......@@ -8,40 +8,29 @@
int encode_deregistration_type ( DeregistrationType deregistrationtype, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,DEREGISTRATION_TYPE_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,DEREGISTRATION_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (deregistrationtype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (deregistrationtype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_deregistration_type ( DeregistrationType * deregistrationtype, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (deregistrationtype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (deregistrationtype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,62 +8,62 @@
int encode_extended_protocol_configuration_options ( ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE : EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE-1), len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
encoded++;
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE : EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE-1), len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
encoded++;
encoded++;
if ((encode_result = encode_bstring (extendedprotocolconfigurationoptions, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (extendedprotocolconfigurationoptions, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 2 - ((iei > 0) ? 1 : 0);
*lenPtr =res/(1<<8);
lenPtr++;
*lenPtr = res%(1<<8);
uint32_t res = encoded - 2 - ((iei > 0) ? 1 : 0);
*lenPtr =res/(1<<8);
lenPtr++;
*lenPtr = res%(1<<8);
return encoded;
return encoded;
}
int decode_extended_protocol_configuration_options ( ExtendedProtocolConfigurationOptions * extendedprotocolconfigurationoptions, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint32_t ielen=0;
int decode_result = 0;
int decoded=0;
uint32_t ielen=0;
int decode_result = 0;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
ielen = *(buffer + decoded);
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
ielen = ( ielen << 8) + *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
}
ielen = *(buffer + decoded);
decoded++;
ielen = ( ielen << 8) + *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
if((decode_result = decode_bstring (extendedprotocolconfigurationoptions, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
if((decode_result = decode_bstring (extendedprotocolconfigurationoptions, ielen, buffer + decoded, len - decoded)) < 0)
{
return decode_result;
}
else
{
decoded += decode_result;
}
return decoded;
return decoded;
}
......@@ -8,14 +8,13 @@
int encode_extended_protocol_discriminator ( ExtendedProtocolDiscriminator extendedprotocoldiscriminator, uint8_t iei, uint8_t * buffer, uint32_t len )
{
/*
uint8_t *lenPtr;
/*
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH , len);
ENCODE8
if ((encode_result = encode_bstring (extendedprotocoldiscriminator, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
......@@ -23,25 +22,23 @@ int encode_extended_protocol_discriminator ( ExtendedProtocolDiscriminator exte
return encoded;
*/
*/
return 0;
}
int decode_extended_protocol_discriminator ( ExtendedProtocolDiscriminator * extendedprotocoldiscriminator, uint8_t iei, uint8_t * buffer, uint32_t len )
{
/*
/*
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (extendedprotocoldiscriminator, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
*/
*/
return 0;
}
......@@ -8,43 +8,40 @@
int encode_intergrity_protection_maximum_data_rate ( IntergrityProtectionMaximumDataRate intergrityprotectionmaximumdatarate, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_TV : INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_V) , len);
if( iei > 0)
{
*buffer=iei;
encoded++;
}
if ((encode_result = encode_bstring (intergrityprotectionmaximumdatarate, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_TV : INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_V) , len);
if( iei > 0)
{
*buffer=iei;
encoded++;
}
if ((encode_result = encode_bstring (intergrityprotectionmaximumdatarate, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
int decode_intergrity_protection_maximum_data_rate ( IntergrityProtectionMaximumDataRate * intergrityprotectionmaximumdatarate, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=2;
int decode_result = 0;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
if((decode_result = decode_bstring (intergrityprotectionmaximumdatarate, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=2;
int decode_result = 0;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
if((decode_result = decode_bstring (intergrityprotectionmaximumdatarate, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,33 +8,32 @@
int encode_mico_indication ( MICOIndication micoindication, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,MICO_INDICATION_MINIMUM_LENGTH , len);
if(iei >0){
bitStream |= (iei&0xf0);
}
if(micoindication.raai){
bitStream |= 0x01;
}
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,MICO_INDICATION_MINIMUM_LENGTH , len);
if(iei >0){
bitStream |= (iei&0xf0);
}
if(micoindication.raai){
bitStream |= 0x01;
}
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
}
int decode_mico_indication ( MICOIndication * micoindication, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
uint8_t bitStream;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != (bitStream&0xf0))
return -1;
if(bitStream&0x01)
micoindication->raai = true;
return decoded;
int decoded=0;
uint8_t bitStream;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != (bitStream&0xf0))
return -1;
if(bitStream&0x01)
micoindication->raai = true;
return decoded;
}
......@@ -8,40 +8,28 @@
int encode_message_authentication_code ( MessageAuthenticationCode messageauthenticationcode, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,MESSAGE_AUTHENTICATION_CODE_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,MESSAGE_AUTHENTICATION_CODE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (messageauthenticationcode, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (messageauthenticationcode, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_message_authentication_code ( MessageAuthenticationCode * messageauthenticationcode, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (messageauthenticationcode, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (messageauthenticationcode, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,17 +8,11 @@
int encode_message_type ( MessageType messagetype, uint8_t iei, uint8_t * buffer, uint32_t len )
{
/*
/*
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,MESSAGE_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (messagetype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
......@@ -27,12 +21,12 @@ int encode_message_type ( MessageType messagetype, uint8_t iei, uint8_t * buffer
return encoded;
*/
*/
}
int decode_message_type ( MessageType * messagetype, uint8_t iei, uint8_t * buffer, uint32_t len )
{
/*
/*
int decoded=0;
int decode_result;
......@@ -42,6 +36,6 @@ int decode_message_type ( MessageType * messagetype, uint8_t iei, uint8_t * buff
else
decoded += decode_result;
return decoded;
*/
*/
}
......@@ -8,56 +8,51 @@
int encode_nssai ( NSSAI nssai, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NSSAI_MINIMUM_LENGTH , len);
uint8_t *lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NSSAI_MINIMUM_LENGTH , len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
encoded++;
/*
/*
if ((encode_result = encode_bstring (nssai, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
*/
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
*/
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
}
int decode_nssai ( NSSAI * nssai, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
if((decode_result = decode_bstring (nssai, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
if((decode_result = decode_bstring (nssai, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,43 +8,43 @@
int encode_network_slicing_indication ( NetworkSlicingIndication networkslicingindication, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NETWORK_SLICING_INDICATION_MINIMUM_LENGTH , len);
if(iei > 0){
bitStream |= (iei & 0xf0);
}
bitStream |= ((networkslicingindication.dcni&0x01)<<1);
bitStream |= ((networkslicingindication.nssci&0x01));
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NETWORK_SLICING_INDICATION_MINIMUM_LENGTH , len);
if(iei > 0){
bitStream |= (iei & 0xf0);
}
bitStream |= ((networkslicingindication.dcni&0x01)<<1);
bitStream |= ((networkslicingindication.nssci&0x01));
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
}
int decode_network_slicing_indication ( NetworkSlicingIndication * networkslicingindication, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
return -1;
}
if(iei > 0){
bitStream = (bitStream & 0x0f);
}
//networkslicingindication->dcni = bitStream&0x02;
networkslicingindication->dcni = (bitStream &0x02)>>1;
networkslicingindication->nssci = bitStream&0x01;
return decoded;
int decoded=0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != (bitStream&0xf0)){
return -1;
}
if(iei > 0){
bitStream = (bitStream & 0x0f);
}
//networkslicingindication->dcni = bitStream&0x02;
networkslicingindication->dcni = (bitStream &0x02)>>1;
networkslicingindication->nssci = bitStream&0x01;
return decoded;
}
......@@ -8,40 +8,28 @@
int encode_network_slicing_information ( NetworkSlicingInformation networkslicinginformation, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NETWORK_SLICING_INFORMATION_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NETWORK_SLICING_INFORMATION_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (networkslicinginformation, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (networkslicinginformation, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_network_slicing_information ( NetworkSlicingInformation * networkslicinginformation, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (networkslicinginformation, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (networkslicinginformation, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -26,7 +26,7 @@ int encode_pdu_address ( PDUAddress pduaddress, uint8_t iei, uint8_t * buffer, u
ENCODE_U8(buffer+encoded,(uint8_t)(pduaddress.pdu_session_type_value&0x07),encoded);
if ((encode_result = encode_bstring (pduaddress.pdu_address_information, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
if ((encode_result = encode_bstring (pduaddress.pdu_address_information, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......
......@@ -12,6 +12,7 @@
#define PDU_ADDRESS_IPV4V6 0x03
typedef struct{
uint8_t spare:5;
uint8_t pdu_session_type_value:3;
bstring pdu_address_information;
}PDUAddress;
......
......@@ -8,40 +8,28 @@
int encode_pdu_session_identity ( PDUSessionIdentity pdusessionidentity, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PDU_SESSION_IDENTITY_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PDU_SESSION_IDENTITY_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (pdusessionidentity, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (pdusessionidentity, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_pdu_session_identity ( PDUSessionIdentity * pdusessionidentity, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (pdusessionidentity, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (pdusessionidentity, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,50 +8,39 @@
int encode_pdu_session_identity2 ( PDUSessionIdentity2 pdusessionidentity2, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PDU_SESSION_IDENTITY2_MINIMUM_LENGTH , len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
if ((encode_result = encode_bstring (pdusessionidentity2, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PDU_SESSION_IDENTITY2_MINIMUM_LENGTH , len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
if ((encode_result = encode_bstring (pdusessionidentity2, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
int decode_pdu_session_identity2 ( PDUSessionIdentity2 * pdusessionidentity2, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
if((decode_result = decode_bstring (pdusessionidentity2, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
if((decode_result = decode_bstring (pdusessionidentity2, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,40 +8,28 @@
int encode_plain_5gsnas_message ( Plain5GSNASMessage plain5gsnasmessage, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PLAIN_5GSNAS_MESSAGE_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PLAIN_5GSNAS_MESSAGE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (plain5gsnasmessage, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (plain5gsnasmessage, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_plain_5gsnas_message ( Plain5GSNASMessage * plain5gsnasmessage, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (plain5gsnasmessage, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (plain5gsnasmessage, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,40 +8,28 @@
int encode_procedure_transaction_identity ( ProcedureTransactionIdentity proceduretransactionidentity, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PROCEDURE_TRANSACTION_IDENTITY_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,PROCEDURE_TRANSACTION_IDENTITY_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (proceduretransactionidentity, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (proceduretransactionidentity, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_procedure_transaction_identity ( ProcedureTransactionIdentity * proceduretransactionidentity, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (proceduretransactionidentity, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (proceduretransactionidentity, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
This diff is collapsed.
......@@ -118,5 +118,6 @@ typedef struct{
int encode_qos_flow_descriptions ( QOSFlowDescriptions qosflowdescriptions, uint8_t iei, uint8_t * buffer, uint32_t len ) ;
int decode_qos_flow_descriptions ( QOSFlowDescriptions * qosflowdescriptions, uint8_t iei, uint8_t * buffer, uint32_t len ) ;
void free_decode_qos_flow_descriptions(QOSFlowDescriptions * qosflowdescriptions);
#endif
This diff is collapsed.
......@@ -88,7 +88,8 @@ typedef struct{
QOSRulesIE *qosrulesie;
}QOSRules;
int encode_qos_rules ( QOSRules qosrules, uint8_t iei, uint8_t * buffer, uint32_t len ) ;
int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint32_t len ) ;
int encode_qos_rules ( QOSRules qosrules, uint8_t iei, uint8_t * buffer, uint32_t len );
int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint32_t len);
void free_decode_qos_rules(QOSRules * qosrules);
#endif
......@@ -8,40 +8,28 @@
int encode_request_type ( RequestType requesttype, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,REQUEST_TYPE_MINIMUM_LENGTH , len);
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,REQUEST_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (requesttype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (requesttype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
return encoded;
}
int decode_request_type ( RequestType * requesttype, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (requesttype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (requesttype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -8,45 +8,43 @@
int encode_s1_ue_network_capability ( S1UENetworkCapability s1uenetworkcapability, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,S1_UE_NETWORK_CAPABILITY_MINIMUM_LENGTH , len);
uint8_t *lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,S1_UE_NETWORK_CAPABILITY_MINIMUM_LENGTH , len);
if( iei >0 ){
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
if( iei >0 ){
*buffer=iei;
encoded++;
}
lenPtr = (buffer + encoded);
encoded++;
ENCODE_U8(buffer+encoded,s1uenetworkcapability.eea,encoded);
ENCODE_U8(buffer+encoded,s1uenetworkcapability.eia,encoded);
ENCODE_U8(buffer+encoded,s1uenetworkcapability.eea,encoded);
ENCODE_U8(buffer+encoded,s1uenetworkcapability.eia,encoded);
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
}
int decode_s1_ue_network_capability ( S1UENetworkCapability * s1uenetworkcapability, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
int decoded=0;
uint8_t ielen=0;
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
ielen = *(buffer + decoded);
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
}
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
DECODE_U8(buffer+decoded,s1uenetworkcapability->eea,decoded);
DECODE_U8(buffer+decoded,s1uenetworkcapability->eia,decoded);
DECODE_U8(buffer+decoded,s1uenetworkcapability->eea,decoded);
DECODE_U8(buffer+decoded,s1uenetworkcapability->eia,decoded);
return decoded;
return decoded;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,7 @@ int decode__pdu_session_type ( _PDUSessionType * _pdusessiontype, uint8_t iei, u
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
if(iei != (bitStream&0xf0)){
return -1;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -44,7 +44,7 @@ int encode_authentication_reject( authentication_reject_msg *authentication_reje
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len);
if(authentication_reject->presence & AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT
if((authentication_reject->presence & AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT)
== AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT){
if((encoded_result = encode_eap_message (authentication_reject->eapmessage, AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment