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.
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.
RELEASE NOTES:
v1.0.0 -> First release, Able to serve a MME with basic attach, detach, release, paging procedures, default bearer only.
# OAI-SMF
## Download source code from Gitlab
......
......@@ -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
/**
* 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
* 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 "IndividualSMContextApi.h"
#include "logger.hpp"
#include "Helpers.h"
extern "C" {
#include "multipartparser.h"
}
#include <cassert>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <string>
namespace oai {
namespace smf_server {
......@@ -40,16 +75,55 @@ void IndividualSMContextApi::setupRoutes() {
}
void IndividualSMContextApi::release_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
//TODO: to be updated as update_sm_context_handler
Logger::smf_api_server().info("Received a Nsmf_PDUSession_UpdateSMContext: PDU Session Release request from AMF");
Logger::smf_api_server().debug("Request body: %s\n",request.body().c_str());
SmContextReleaseMessage smContextReleaseMessage;
// Getting the path params
auto smContextRef = request.param(":smContextRef").as<std::string>();
// Getting the body param
//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());
//part p2 = g_parts.front(); g_parts.pop_front();
//Logger::smf_api_server().debug("Request body, part 3: \n %s",p2.body.c_str());
// Getting the body param
SmContextReleaseData smContextReleaseData;
try {
nlohmann::json::parse(request.body()).get_to(smContextReleaseData);
this->release_sm_context(smContextRef, smContextReleaseData, response);
nlohmann::json::parse(p0.body.c_str()).get_to(smContextReleaseData);
smContextReleaseMessage.setJsonData(smContextReleaseData);
smContextReleaseMessage.setBinaryDataN2SmInformation(p1.body.c_str());
this->release_sm_context(smContextRef, smContextReleaseMessage, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
......@@ -84,26 +158,93 @@ void IndividualSMContextApi::retrieve_sm_context_handler(const Pistache::Rest::R
}
void IndividualSMContextApi::update_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto smContextRef = request.param(":smContextRef").as<std::string>();
// Getting the body param
Logger::smf_api_server().info("Received a SM context update request from AMF");
Logger::smf_api_server().debug("Request body: %s\n",request.body().c_str());
SmContextUpdateData smContextUpdateData;
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());
SmContextUpdateMessage smContextUpdateMessage;
//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()));
unsigned int str_len = request.body().length();
unsigned char *data = (unsigned char *)malloc(str_len + 1);
memset(data,0,str_len + 1);
memcpy ((void *)data, (void *)request.body().c_str(),str_len);
//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)){
if ((multipartparser_execute(&parser, &g_callbacks, reinterpret_cast<const char*>(data), str_len) != 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;
}
free(data);
data = nullptr;
uint8_t size = g_parts.size();
Logger::smf_api_server().debug("Number of g_parts %d", g_parts.size());
part p0 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 1: %s", p0.body.c_str());
part p1 = {};
if (size > 1){
p1 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 2: %s (%d bytes)",p1.body.c_str(), p1.body.length());
//part p2 = g_parts.front(); g_parts.pop_front();
//Logger::smf_api_server().debug("Request body, part 3: \n %s",p2.body.c_str());
}
// Getting the body param
SmContextUpdateData smContextUpdateData;
try {
nlohmann::json::parse(request.body()).get_to(smContextUpdateData);
this->update_sm_context(smContextRef, smContextUpdateData, response);
nlohmann::json::parse(p0.body.c_str()).get_to(smContextUpdateData);
smContextUpdateMessage.setJsonData(smContextUpdateData);
if (size > 1){
if (smContextUpdateData.n2SmInfoIsSet()){
//N2 SM (for Session establishment, or for session modification)
Logger::smf_api_server().debug("N2 SM information is set");
smContextUpdateMessage.setBinaryDataN2SmInformation(p1.body);
}
if (smContextUpdateData.n1SmMsgIsSet()){
//N1 SM (for session modification, UE-initiated)
Logger::smf_api_server().debug("N1 SM message is set");
smContextUpdateMessage.setBinaryDataN1SmMessage(p1.body.c_str());
}
}
// Getting the path params
auto smContextRef = request.param(":smContextRef").as<std::string>();
this->update_sm_context(smContextRef, smContextUpdateMessage, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
Logger::smf_api_server().warn("Error in parsing json, send a msg with a 400 error code to AMF");
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
Logger::smf_api_server().warn("Send a msg with a 500 error code to AMF");
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void IndividualSMContextApi::individual_sm_context_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
......
......@@ -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 {
......@@ -156,6 +74,11 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
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;
......@@ -172,22 +95,26 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
multipartparser parser;
init_globals();
multipartparser_init(&parser, BOUNDARY);
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)){
response.send(Pistache::Http::Code::Bad_Request, "");
return;
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() == 3) {
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());
}
......@@ -200,6 +127,7 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
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) {
......
......@@ -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,12 +41,40 @@ 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) {
void IndividualSMContextApiImpl::release_sm_context(const std::string &smContextRef, const SmContextReleaseData &smContextReleaseData, Pistache::Http::ResponseWriter &response) {
//TODO: to be updated as update_sm_context_handler
Logger::smf_api_server().info("release_sm_context...");
response.send(Pistache::Http::Code::Ok, "Release_sm_context API has not been implemented yet!\n");
//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::retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response) {
......@@ -53,29 +82,63 @@ void IndividualSMContextApiImpl::retrieve_sm_context(const std::string &smContex
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.");
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 = {};
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());
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_msg_hex);
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_amf_msg(itti_msg);
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,7 +51,7 @@ 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 ...");
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
......@@ -95,7 +95,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
Logger::smf_api_server().debug("SmContextCreateData, PDU SessionID %d \n", smContextCreateData.getPduSessionId());
sm_context_req_msg.set_pdu_session_id(smContextCreateData.getPduSessionId());
//AMF ID
//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
......@@ -109,6 +109,12 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
// 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());
......@@ -128,7 +134,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//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);
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
......@@ -41,7 +41,7 @@ int decode_allowed_ssc_mode ( AllowedSSCMode * allowedsscmode, uint8_t iei, uint
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
if(iei != (bitStream&0xf0)){
return -1;
}
if(iei > 0){
......
......@@ -32,7 +32,7 @@ int decode_alwayson_pdu_session_requested ( AlwaysonPDUSessionRequested * always
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
if(iei != (bitStream&0xf0)){
return -1;
}
......
......@@ -8,17 +8,10 @@
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);
if ((encode_result = encode_bstring (configurationupdateindication, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
......@@ -34,10 +27,6 @@ int decode_configuration_update_indication ( ConfigurationUpdateIndication * con
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (configurationupdateindication, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -49,10 +49,11 @@ int decode_dnn ( DNN * dnn, uint8_t iei, uint8_t * buffer, uint32_t len )
CHECK_LENGTH_DECODER (len - decoded, ielen);
if((decode_result = decode_bstring (dnn, ielen, buffer + decoded, len - decoded)) < 0)
{
return decode_result;
else
} else{
decoded += decode_result;
}
return decoded;
}
......@@ -8,17 +8,10 @@
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);
if ((encode_result = encode_bstring (deregistrationtype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
......@@ -34,10 +27,6 @@ int decode_deregistration_type ( DeregistrationType * deregistrationtype, uint8_
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (deregistrationtype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -13,19 +13,16 @@ int encode_extended_protocol_configuration_options ( ExtendedProtocolConfigurati
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
......@@ -51,7 +48,6 @@ int decode_extended_protocol_configuration_options ( ExtendedProtocolConfigurati
decoded++;
}
ielen = *(buffer + decoded);
decoded++;
ielen = ( ielen << 8) + *(buffer + decoded);
......@@ -60,9 +56,13 @@ int decode_extended_protocol_configuration_options ( ExtendedProtocolConfigurati
if((decode_result = decode_bstring (extendedprotocolconfigurationoptions, ielen, buffer + decoded, len - decoded)) < 0)
{
return decode_result;
}
else
{
decoded += decode_result;
}
return decoded;
}
......
......@@ -8,8 +8,7 @@
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);
......@@ -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,12 +8,10 @@
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;
......@@ -25,7 +23,6 @@ int encode_intergrity_protection_maximum_data_rate ( IntergrityProtectionMaximum
else
encoded += encode_result;
return encoded;
}
......
......@@ -27,7 +27,6 @@ int encode_mico_indication ( MICOIndication micoindication, uint8_t iei, uint8_t
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))
......
......@@ -8,23 +8,15 @@
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);
if ((encode_result = encode_bstring (messageauthenticationcode, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_message_authentication_code ( MessageAuthenticationCode * messageauth
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (messageauthenticationcode, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -8,18 +8,12 @@
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;
else
......@@ -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;
*/
*/
}
......@@ -10,28 +10,23 @@ 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);
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;
}
......
......@@ -32,7 +32,7 @@ int decode_network_slicing_indication ( NetworkSlicingIndication * networkslicin
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
if(iei != (bitStream&0xf0)){
return -1;
}
......
......@@ -8,23 +8,15 @@
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);
if ((encode_result = encode_bstring (networkslicinginformation, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_network_slicing_information ( NetworkSlicingInformation * networkslic
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (networkslicinginformation, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -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,23 +8,15 @@
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);
if ((encode_result = encode_bstring (pdusessionidentity, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_pdu_session_identity ( PDUSessionIdentity * pdusessionidentity, uint8
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (pdusessionidentity, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -8,28 +8,20 @@
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;
}
......@@ -45,9 +37,6 @@ int decode_pdu_session_identity2 ( PDUSessionIdentity2 * pdusessionidentity2, ui
decoded++;
}
if((decode_result = decode_bstring (pdusessionidentity2, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -8,23 +8,15 @@
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);
if ((encode_result = encode_bstring (plain5gsnasmessage, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_plain_5gsnas_message ( Plain5GSNASMessage * plain5gsnasmessage, uint8
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (plain5gsnasmessage, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -8,23 +8,15 @@
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);
if ((encode_result = encode_bstring (proceduretransactionidentity, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_procedure_transaction_identity ( ProcedureTransactionIdentity * proce
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (proceduretransactionidentity, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -197,3 +197,15 @@ int decode_qos_flow_descriptions ( QOSFlowDescriptions * qosflowdescriptions, ui
return decoded;
}
void free_decode_qos_flow_descriptions(QOSFlowDescriptions * qosflowdescriptions)
{
for(int i=0;i<qosflowdescriptions->qosflowdescriptionsnumber;i++)
{
free(qosflowdescriptions->qosflowdescriptionscontents[i].parameterslist);
qosflowdescriptions->qosflowdescriptionscontents[i].parameterslist = NULL;
}
free(qosflowdescriptions->qosflowdescriptionscontents);
qosflowdescriptions->qosflowdescriptionscontents = NULL;
}
......
......@@ -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
......@@ -92,7 +92,6 @@ int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint3
uint16_t ielen=0;
int decode_result = 0;
uint16_t numberrules = 0;
uint8_t *buffer_tmp = NULL;
uint16_t lenqosrule = 0;
uint8_t bitstream = 0;
int i=0,j=0;
......@@ -108,7 +107,6 @@ int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint3
numberrules = ( numberrules << 8)+*(buffer + decoded);
decoded++;
buffer_tmp = buffer + decoded;
for(i=0;i<numberrules;i++)
{
ielen = *(buffer + ielen + 1) + 1;
......@@ -130,7 +128,7 @@ int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint3
lenqosrule = (lenqosrule << 8)+*(buffer + decoded);
decoded++;
lenmoment = encoded;
*/
*/
DECODE_U8(buffer+decoded,bitstream,decoded);
qosrules->qosrulesie[i].ruleoperationcode = (bitstream>>5);
qosrules->qosrulesie[i].dqrbit = (bitstream>>4)&0x01;
......@@ -159,7 +157,7 @@ int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint3
qosrules->qosrulesie[i].packetfilterlist.create_modifyandadd_modifyandreplace[j].packetfilterdirection = (bitstream>>4)&0x03;
qosrules->qosrulesie[i].packetfilterlist.create_modifyandadd_modifyandreplace[j].packetfilteridentifier = bitstream&0x0f;
uint8_t *lenghtofpacketfiltercontents = *(buffer + decoded)-1;
uint8_t *lenghtofpacketfiltercontents = (uint8_t * ) (*(buffer + decoded) - 1);
decoded++;
DECODE_U8(buffer+decoded,bitstream,decoded);
......@@ -185,3 +183,25 @@ int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint3
return decoded;
}
void free_decode_qos_rules(QOSRules * qosrules)
{
int i;
for(i=0;i<qosrules->lengthofqosrulesie;i++)
{
if(qosrules->qosrulesie[i].ruleoperationcode == MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS)
{
free(qosrules->qosrulesie[i].packetfilterlist.modifyanddelete);
qosrules->qosrulesie[i].packetfilterlist.modifyanddelete = NULL;
}
else if((qosrules->qosrulesie[i].ruleoperationcode == CREATE_NEW_QOS_RULE) || (qosrules->qosrulesie[i].ruleoperationcode == MODIFY_EXISTING_QOS_RULE_AND_ADD_PACKET_FILTERS) || (qosrules->qosrulesie[i].ruleoperationcode == MODIFY_EXISTING_QOS_RULE_AND_REPLACE_ALL_PACKET_FILTERS))
{
free(qosrules->qosrulesie[i].packetfilterlist.create_modifyandadd_modifyandreplace);
qosrules->qosrulesie[i].packetfilterlist.create_modifyandadd_modifyandreplace = NULL;
}
}
free(qosrules->qosrulesie);
qosrules->qosrulesie = NULL;
}
......@@ -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,23 +8,15 @@
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);
if ((encode_result = encode_bstring (requesttype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_request_type ( RequestType * requesttype, uint8_t iei, uint8_t * buff
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (requesttype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -10,7 +10,6 @@ int encode_s1_ue_network_capability ( S1UENetworkCapability s1uenetworkcapabilit
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,S1_UE_NETWORK_CAPABILITY_MINIMUM_LENGTH , len);
if( iei >0 ){
......@@ -32,7 +31,6 @@ int decode_s1_ue_network_capability ( S1UENetworkCapability * s1uenetworkcapabil
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
......
......@@ -8,23 +8,15 @@
int encode_sms_indication ( SMSIndication smsindication, 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,SMS_INDICATION_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (smsindication, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_sms_indication ( SMSIndication * smsindication, uint8_t iei, uint8_t
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (smsindication, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -12,7 +12,6 @@ int encode_ssc_mode ( SSCMode sscmode, uint8_t iei, uint8_t * buffer, uint32_t l
uint8_t bitStream = 0x00;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,SSC_MODE_MINIMUM_LENGTH , len);
if(iei > 0){
bitStream |= (iei & 0xf0);
}
......@@ -20,7 +19,6 @@ int encode_ssc_mode ( SSCMode sscmode, uint8_t iei, uint8_t * buffer, uint32_t l
bitStream |= (sscmode.ssc_mode_value & 0x07);
ENCODE_U8(buffer+encoded,bitStream,encoded);
return encoded;
}
......@@ -29,10 +27,9 @@ int decode_ssc_mode ( SSCMode * sscmode, uint8_t iei, uint8_t * buffer, uint32_t
int decoded=0;
uint8_t bitStream = 0x00;
DECODE_U8(buffer+decoded,bitStream,decoded);
if(iei != bitStream&0xf0){
if(iei != (bitStream&0xf0)){
return -1;
}
......
......@@ -8,23 +8,15 @@
int encode_security_header_type ( SecurityHeaderType securityheadertype, 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,SECURITY_HEADER_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (securityheadertype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_security_header_type ( SecurityHeaderType * securityheadertype, uint8
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (securityheadertype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -8,23 +8,15 @@
int encode_sequence_number ( SequenceNumber sequencenumber, 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,SEQUENCE_NUMBER_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (sequencenumber, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_sequence_number ( SequenceNumber * sequencenumber, uint8_t iei, uint8
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (sequencenumber, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -8,23 +8,15 @@
int encode_service_type ( ServiceType servicetype, 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,SERVICE_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (servicetype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode_service_type ( ServiceType * servicetype, uint8_t iei, uint8_t * buff
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (servicetype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -10,7 +10,6 @@ int encode_session_ambr ( SessionAMBR sessionambr, uint8_t iei, uint8_t * buffer
{
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? SESSION_AMBR_MINIMUM_LENGTH_TLV : SESSION_AMBR_MINIMUM_LENGTH_LV) , len);
if( iei >0 )
......
......@@ -8,28 +8,21 @@
int encode_time_zone_and_time ( TimeZoneAndTime timezoneandtime, 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,TIME_ZONE_AND_TIME_MINIMUM_LENGTH , len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
if ((encode_result = encode_bstring (timezoneandtime, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -45,9 +38,6 @@ int decode_time_zone_and_time ( TimeZoneAndTime * timezoneandtime, uint8_t iei,
decoded++;
}
if((decode_result = decode_bstring (timezoneandtime, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -10,7 +10,6 @@ int encode_ue_security_capability ( UESecurityCapability uesecuritycapability, u
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,UE_SECURITY_CAPABILITY_MINIMUM_LENGTH , len);
if( iei >0 ){
......@@ -32,7 +31,6 @@ int decode_ue_security_capability ( UESecurityCapability * uesecuritycapability,
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
......
......@@ -10,7 +10,6 @@ int encode_uplink_data_status ( UplinkDataStatus uplinkdatastatus, uint8_t iei,
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,UPLINK_DATA_STATUS_MINIMUM_LENGTH , len);
if( iei >0 ){
......@@ -31,7 +30,6 @@ int decode_uplink_data_status ( UplinkDataStatus * uplinkdatastatus, uint8_t iei
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
......
......@@ -10,7 +10,6 @@ int encode__5gmm_capability ( _5GMMCapability _5gmmcapability, uint8_t iei, uint
{
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
uint8_t _5gmmcapability_bits = 0;
......@@ -40,10 +39,8 @@ int decode__5gmm_capability ( _5GMMCapability * _5gmmcapability, uint8_t iei, ui
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
uint8_t _5gmmcapability_bits = 0;
uint8_t otherInformation = 0;
if (iei > 0){
CHECK_IEI_DECODER (iei, *buffer);
......
......@@ -8,9 +8,7 @@
int encode__5gs_tracking_area_identity ( _5GSTrackingAreaIdentity _5gstrackingareaidentity, 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,_5GS_TRACKING_AREA_IDENTITY_MINIMUM_LENGTH , len);
if( iei >0 ){
......@@ -29,10 +27,7 @@ int encode__5gs_tracking_area_identity ( _5GSTrackingAreaIdentity _5gstrackingar
int decode__5gs_tracking_area_identity ( _5GSTrackingAreaIdentity * _5gstrackingareaidentity, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
int decode_result;
uint8_t mcc_mnc_decode = 0;
uint32_t tac_decode = 0;
if (iei > 0)
{
......
......@@ -11,7 +11,6 @@ int encode__5gs_update_type ( _5GSUpdateType _5gsupdatetype, uint8_t iei, uint8_
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,_5GS_UPDATE_TYPE_MINIMUM_LENGTH , len);
if( iei >0 ){
......@@ -28,27 +27,27 @@ int encode__5gs_update_type ( _5GSUpdateType _5gsupdatetype, uint8_t iei, uint8_
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
#if 0
uint8_t *lenPtr;
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,_5GS_UPDATE_TYPE_MINIMUM_LENGTH , len);
#if 0
uint8_t *lenPtr;
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,_5GS_UPDATE_TYPE_MINIMUM_LENGTH , len);
if( iei >0 ){
if( iei >0 ){
*buffer=iei;
encoded++;
}
}
lenPtr = (buffer + encoded);
encoded++;
lenPtr = (buffer + encoded);
encoded++;
bitStream |= ((_5gsupdatetype.ng_ran_rcu&0x01)<<1);
bitStream |= (_5gsupdatetype.sms_requested&0x01);
ENCODE_U8(buffer+encoded,bitStream,encoded);
bitStream |= ((_5gsupdatetype.ng_ran_rcu&0x01)<<1);
bitStream |= (_5gsupdatetype.sms_requested&0x01);
ENCODE_U8(buffer+encoded,bitStream,encoded);
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
#endif
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
#endif
}
int decode__5gs_update_type ( _5GSUpdateType * _5gsupdatetype, uint8_t iei, uint8_t * buffer, uint32_t len )
......@@ -56,7 +55,6 @@ int decode__5gs_update_type ( _5GSUpdateType * _5gsupdatetype, uint8_t iei, uint
int decoded=0;
uint8_t ielen=0;
int decode_result;
if (iei > 0)
{
......@@ -72,26 +70,26 @@ int decode__5gs_update_type ( _5GSUpdateType * _5gsupdatetype, uint8_t iei, uint
DECODE_U8(buffer+decoded, _5gsupdatetype->sms_requested, decoded);
return decoded;
#if 0
int decoded=0;
uint8_t ielen=0;
uint8_t bitStream = 0x0;
#if 0
int decoded=0;
uint8_t ielen=0;
uint8_t bitStream = 0x0;
if (iei > 0)
{
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
}
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
DECODE_U8(buffer+decoded,bitStream,decoded);
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
DECODE_U8(buffer+decoded,bitStream,decoded);
_5gsupdatetype->ng_ran_rcu = bitStream&0x02;
_5gsupdatetype->sms_requested = bitStream&0x01;
return decoded;
#endif
_5gsupdatetype->ng_ran_rcu = bitStream&0x02;
_5gsupdatetype->sms_requested = bitStream&0x01;
return decoded;
#endif
}
......@@ -8,23 +8,15 @@
int encode__access_type ( _AccessType _accesstype, 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,_ACCESS_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (_accesstype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
}
......@@ -34,10 +26,6 @@ int decode__access_type ( _AccessType * _accesstype, uint8_t iei, uint8_t * buff
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (_accesstype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
......
......@@ -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;
}
......
/*
* 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_MM_DATA_H_SEEN
#define FILE_MM_DATA_H_SEEN
......
......@@ -52,7 +52,7 @@ int encode_authentication_failure( authentication_failure_msg *authentication_fa
// 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_FAILURE_MINIMUM_LENGTH, len);
if((encoded_result = encode__5gmm_cause (&authentication_failure->_5gmmcause, 0, buffer+encoded,len-encoded))<0)
if((encoded_result = encode__5gmm_cause (authentication_failure->_5gmmcause, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
......
......@@ -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;
......
......@@ -66,7 +66,7 @@ int decode_authentication_request( authentication_request_msg *authentication_re
}
break;
}
}
}
return decoded;
}
......
......@@ -14,8 +14,8 @@ int decode_authentication_response( authentication_response_msg *authentication_
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len);
// uint8_t ieiDecoded = *(buffer+decoded);
// printf("ieiDecoded(%x)\n",ieiDecoded);
// uint8_t ieiDecoded = *(buffer+decoded);
// printf("ieiDecoded(%x)\n",ieiDecoded);
while (len - decoded > 0) {
......@@ -62,7 +62,7 @@ int encode_authentication_response( authentication_response_msg *authentication_
// 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_RESPONSE_MINIMUM_LENGTH, len);
if(authentication_response->presence & AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT
if((authentication_response->presence & AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT)
== AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT){
if((encoded_result = encode_authentication_response_parameter (authentication_response->authenticationresponseparameter, AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
......@@ -70,7 +70,7 @@ int encode_authentication_response( authentication_response_msg *authentication_
encoded+=encoded_result;
}
if(authentication_response->presence & AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT
if((authentication_response->presence & AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT)
== AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT){
if((encoded_result = encode_eap_message (authentication_response->eapmessage, AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
......
......@@ -13,7 +13,7 @@ int decode_deregistration_request( deregistration_request_msg *deregistration_re
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, DEREGISTRATION_REQUEST_MINIMUM_LENGTH, len);
/*
/*
if((decoded_result = decode_extended_protocol_discriminator (&deregistration_request->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
......@@ -44,7 +44,7 @@ int decode_deregistration_request( deregistration_request_msg *deregistration_re
else
decoded+=decoded_result;
*/
*/
return decoded;
}
......@@ -56,7 +56,7 @@ int encode_deregistration_request( deregistration_request_msg *deregistration_re
// 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, DEREGISTRATION_REQUEST_MINIMUM_LENGTH, len);
/*
/*
if((encoded_result = encode_extended_protocol_discriminator (deregistration_request->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
......@@ -87,6 +87,6 @@ int encode_deregistration_request( deregistration_request_msg *deregistration_re
else
encoded+=encoded_result;
*/
*/
return encoded;
}
......@@ -68,7 +68,7 @@ int encode_registration_reject( registration_reject_msg *registration_reject, ui
else
encoded+=encoded_result;
if(registration_reject->presence & REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT
if((registration_reject->presence & REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT)
== REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT){
if((encoded_result = encode_gprs_timer2 (registration_reject->t3346, REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
......@@ -76,7 +76,7 @@ int encode_registration_reject( registration_reject_msg *registration_reject, ui
encoded+=encoded_result;
}
if(registration_reject->presence & REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT
if((registration_reject->presence & REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT)
== REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT){
if((encoded_result = encode_gprs_timer2 (registration_reject->t3502, REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
......@@ -84,7 +84,7 @@ int encode_registration_reject( registration_reject_msg *registration_reject, ui
encoded+=encoded_result;
}
if(registration_reject->presence & REGISTRATION_REJECT_EAP_MESSAGE_PRESENT
if((registration_reject->presence & REGISTRATION_REJECT_EAP_MESSAGE_PRESENT)
== REGISTRATION_REJECT_EAP_MESSAGE_PRESENT){
if((encoded_result = encode_eap_message (registration_reject->eapmessage, REGISTRATION_REJECT_EAP_MESSAGE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
......
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
*/
#include <stdint.h>
#include <asm/byteorder.h>
......@@ -5,11 +26,12 @@
typedef struct {
#ifdef __LITTLE_ENDIAN_BITFIELD
uint8_t extended_protocol_discriminator;
uint8_t security_header_type;
uint8_t security_header_type:4;
uint8_t spare_half_octet:4;
#endif
#ifdef __BIG_ENDIAN_BITFIELD
uint8_t security_header_type;
uint8_t extended_protocol_discriminator;
uint8_t spare_half_octet:4;
uint8_t security_header_type:4;
#endif
uint8_t message_type;
} __attribute__((__packed__)) mm_msg_header_t;
/*
* 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 "common_types.h"
#include "mm_msg.h"
//#include "log.h"
#include "TLVDecoder.h"
#include "TLVEncoder.h"
//#include "log.h"
//#include "nas_itti_messaging.h"
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
......@@ -14,12 +33,12 @@ static int _fivegmm_msg_decode_header (
mm_msg_header_t * header,
const uint8_t * buffer,
uint32_t len);
static int _fivegmm_msg_encode_header (
const mm_msg_header_t * header,
uint8_t * buffer,
uint32_t len);
/****************************************************************************
** **
** Name: emm_msg_encode() **
......@@ -67,46 +86,46 @@ fivegmm_msg_encode (
//encode_result = encode_authentication_request(&msg->authentication_request,buffer,len);/* msg define in openair5g-cn/src/amf/nas/mm/msg */
//break;
case AUTHENTICATION_REQUEST:
encode_result = encode_authentication_request(&msg->specific_msg.authentication_request, buffer, len);
encode_result = encode_authentication_request(&msg->authentication_request, buffer, len);
break;
case AUTHENTICATION_RESPONSE:
encode_result = encode_authentication_response(&msg->specific_msg.authentication_response, buffer, len);
encode_result = encode_authentication_response(&msg->authentication_response, buffer, len);
break;
case AUTHENTICATION_RESULT:
encode_result = encode_authentication_result(&msg->specific_msg.authentication_result, buffer, len);
encode_result = encode_authentication_result(&msg->authentication_result, buffer, len);
break;
case AUTHENTICATION_REJECT:
encode_result = encode_authentication_reject(&msg->specific_msg.authentication_reject, buffer, len);
encode_result = encode_authentication_reject(&msg->authentication_reject, buffer, len);
break;
case AUTHENTICATION_FAILURE:
encode_result = encode_authentication_failure(&msg->specific_msg.authentication_failure, buffer, len);
encode_result = encode_authentication_failure(&msg->authentication_failure, buffer, len);
break;
case REGISTRATION_REQUEST:
encode_result = encode_registration_request(&msg->specific_msg.registration_request, buffer, len);
encode_result = encode_registration_request(&msg->registration_request, buffer, len);
break;
case REGISTRATION_ACCEPT:
encode_result = encode_registration_accept(&msg->specific_msg.registration_accept, buffer, len);
encode_result = encode_registration_accept(&msg->registration_accept, buffer, len);
break;
case REGISTRATION_COMPLETE:
encode_result = encode_registration_complete(&msg->specific_msg.registration_complete, buffer, len);
encode_result = encode_registration_complete(&msg->registration_complete, buffer, len);
break;
case REGISTRATION_REJECT:
encode_result = encode_registration_reject(&msg->specific_msg.registration_reject, buffer, len);
encode_result = encode_registration_reject(&msg->registration_reject, buffer, len);
break;
case IDENTITY_REQUEST:
encode_result = encode_identity_request(&msg->specific_msg.identity_request, buffer, len);
encode_result = encode_identity_request(&msg->identity_request, buffer, len);
break;
case IDENTITY_RESPONSE:
encode_result = encode_identity_response(&msg->specific_msg.identity_response, buffer, len);
encode_result = encode_identity_response(&msg->identity_response, buffer, len);
break;
case SECURITY_MODE_COMMAND:
encode_result = encode_security_mode_command(&msg->specific_msg.security_mode_command, buffer, len);
encode_result = encode_security_mode_command(&msg->security_mode_command, buffer, len);
break;
case SECURITY_MODE_COMPLETE:
encode_result = encode_security_mode_complete(&msg->specific_msg.security_mode_complete, buffer, len);
encode_result = encode_security_mode_complete(&msg->security_mode_complete, buffer, len);
break;
case SECURITY_MODE_REJECT:
encode_result = encode_security_mode_reject(&msg->specific_msg.security_mode_reject, buffer, len);
encode_result = encode_security_mode_reject(&msg->security_mode_reject, buffer, len);
break;
}
......@@ -206,46 +225,46 @@ mm_msg_decode (
//OAILOG_INFO (LOG_NAS_EMM, "EMM-MSG - Message Type 0x%02x\n", msg->header.message_type);
switch (msg->header.message_type) {//plain nas message e.g. registrationrequest message
case AUTHENTICATION_REQUEST:
decode_result = decode_authentication_request(&msg->specific_msg.authentication_request, buffer, len);
decode_result = decode_authentication_request(&msg->authentication_request, buffer, len);
break;
case AUTHENTICATION_RESPONSE:
decode_result = decode_authentication_response(&msg->specific_msg.authentication_response, buffer, len);
decode_result = decode_authentication_response(&msg->authentication_response, buffer, len);
break;
case AUTHENTICATION_RESULT:
decode_result = decode_authentication_result(&msg->specific_msg.authentication_result, buffer, len);
decode_result = decode_authentication_result(&msg->authentication_result, buffer, len);
break;
case AUTHENTICATION_REJECT:
decode_result = decode_authentication_reject(&msg->specific_msg.authentication_reject, buffer, len);
decode_result = decode_authentication_reject(&msg->authentication_reject, buffer, len);
break;
case AUTHENTICATION_FAILURE:
decode_result = decode_authentication_failure(&msg->specific_msg.authentication_failure, buffer, len);
decode_result = decode_authentication_failure(&msg->authentication_failure, buffer, len);
break;
case REGISTRATION_REQUEST:
decode_result = decode_registration_request(&msg->specific_msg.registration_request, buffer, len);
decode_result = decode_registration_request(&msg->registration_request, buffer, len);
break;
case REGISTRATION_ACCEPT:
decode_result = decode_registration_accept(&msg->specific_msg.registration_accept, buffer, len);
decode_result = decode_registration_accept(&msg->registration_accept, buffer, len);
break;
case REGISTRATION_COMPLETE:
decode_result = decode_registration_complete(&msg->specific_msg.registration_complete, buffer, len);
decode_result = decode_registration_complete(&msg->registration_complete, buffer, len);
break;
case REGISTRATION_REJECT:
decode_result = decode_registration_reject(&msg->specific_msg.registration_reject, buffer, len);
decode_result = decode_registration_reject(&msg->registration_reject, buffer, len);
break;
case IDENTITY_REQUEST:
decode_result = decode_identity_request(&msg->specific_msg.identity_request, buffer, len);
decode_result = decode_identity_request(&msg->identity_request, buffer, len);
break;
case IDENTITY_RESPONSE:
decode_result = decode_identity_response(&msg->specific_msg.identity_response, buffer, len);
decode_result = decode_identity_response(&msg->identity_response, buffer, len);
break;
case SECURITY_MODE_COMMAND:
decode_result = decode_security_mode_command(&msg->specific_msg.security_mode_command, buffer, len);
decode_result = decode_security_mode_command(&msg->security_mode_command, buffer, len);
break;
case SECURITY_MODE_COMPLETE:
decode_result = decode_security_mode_complete(&msg->specific_msg.security_mode_complete, buffer, len);
decode_result = decode_security_mode_complete(&msg->security_mode_complete, buffer, len);
break;
case SECURITY_MODE_REJECT:
decode_result = decode_security_mode_reject(&msg->specific_msg.security_mode_reject, buffer, len);
decode_result = decode_security_mode_reject(&msg->security_mode_reject, buffer, len);
break;
}
if (decode_result < 0) {
......
/*
* 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 MM_MSG_H_
#define MM_MSG_H_
......@@ -35,9 +57,8 @@
* Structure of EMM plain NAS message
* ----------------------------------
*/
typedef struct {
typedef union {
mm_msg_header_t header;
union {
authentication_request_msg authentication_request;//Done 19/03/2019
authentication_response_msg authentication_response;//Done 19/03/2019
authentication_result_msg authentication_result;
......@@ -67,8 +88,17 @@ typedef struct {
security_mode_reject_msg security_mode_reject;
_5gmm_status_msg _5gmm_status;
}specific_msg;
}MM_msg;
int mm_msg_decode (
MM_msg * msg,
uint8_t * buffer,
uint32_t len);
int fivegmm_msg_encode (
MM_msg * msg,
uint8_t * buffer,
uint32_t len);
#endif
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 NAS_MESSAGE_H_
#define NAS_MESSAGE_H_
......@@ -22,11 +43,12 @@
typedef struct nas_message_security_header_s {
#ifdef __LITTLE_ENDIAN_BITFIELD
extended_protocol_discriminator_t extended_protocol_discriminator;//3gpp_24.501.h
uint8_t security_header_type;
uint8_t security_header_type:4;
uint8_t spare_half_octet:4;
#endif
#ifdef __BIG_ENDIAN_BITFIELD
uint8_t security_header_type;
uint8_t extended_protocol_discriminator;
uint8_t spare_half_octet:4;
uint8_t security_header_type:4;
#endif
uint32_t message_authentication_code;
uint8_t sequence_number;
......
/*****************************************************************************
/*
* 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
*/
/*****************************************************************************
Source networkDef.h
Version 0.1
Date 2019/08/05
Product NAS stack
Subsystem include
Author BUPT
Description Contains network's global definitions
*****************************************************************************/
#ifndef __NETWORK_DEF_H__
#define __NETWORK_DEF_H__
......@@ -36,4 +49,3 @@ Description Contains network's global definitions
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MCS_PRIORITY_ACCESS 9
#endif
......@@ -14,7 +14,7 @@ int decode_pdu_session_authentication_command( pdu_session_authentication_comman
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_AUTHENTICATION_COMMAND_MINIMUM_LENGTH, len);
#if 0
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_authentication_command->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
......@@ -34,19 +34,19 @@ int decode_pdu_session_authentication_command( pdu_session_authentication_comman
return decoded_result;
else
decoded+=decoded_result;
#endif
#endif
if((decoded_result = decode_eap_message (&pdu_session_authentication_command->eapmessage, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
}
else
{
decoded+=decoded_result;
}
while(len - decoded > 0)
{
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded = 0x%x\n",ieiDecoded);
//sleep(1);
if(ieiDecoded == 0)
break;
......@@ -77,7 +77,7 @@ int encode_pdu_session_authentication_command( pdu_session_authentication_comman
// 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, PDU_SESSION_AUTHENTICATION_COMMAND_MINIMUM_LENGTH, len);
#if 0
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_authentication_command->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
......@@ -97,7 +97,7 @@ int encode_pdu_session_authentication_command( pdu_session_authentication_comman
return encoded_result;
else
encoded+=encoded_result;
#endif
#endif
if((encoded_result = encode_eap_message (pdu_session_authentication_command->eapmessage, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
......@@ -107,10 +107,14 @@ int encode_pdu_session_authentication_command( pdu_session_authentication_comman
if((pdu_session_authentication_command->presence & PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_command->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
{
return encoded_result;
}
else
{
encoded+=encoded_result;
}
}
return encoded;
......
......@@ -14,7 +14,7 @@ int decode_pdu_session_authentication_complete( pdu_session_authentication_compl
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_AUTHENTICATION_COMPLETE_MINIMUM_LENGTH, len);
#if 0
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_authentication_complete->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
......@@ -34,20 +34,20 @@ int decode_pdu_session_authentication_complete( pdu_session_authentication_compl
return decoded_result;
else
decoded+=decoded_result;
#endif
#endif
if((decoded_result = decode_eap_message (&pdu_session_authentication_complete->eapmessage, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode_eap_message (&pdu_session_authentication_complete->eapmessage, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
else
}
else
{
decoded+=decoded_result;
}
while(len - decoded > 0)
{
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded = 0x%x\n",ieiDecoded);
//sleep(1);
if(ieiDecoded == 0)
break;
......@@ -64,9 +64,9 @@ int decode_pdu_session_authentication_complete( pdu_session_authentication_compl
}
break;
}
}
}
return decoded;
return decoded;
}
......@@ -78,7 +78,7 @@ int encode_pdu_session_authentication_complete( pdu_session_authentication_compl
// 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, PDU_SESSION_AUTHENTICATION_COMPLETE_MINIMUM_LENGTH, len);
#if 0
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_authentication_complete->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
......@@ -98,21 +98,25 @@ int encode_pdu_session_authentication_complete( pdu_session_authentication_compl
return encoded_result;
else
encoded+=encoded_result;
#endif
#endif
if((encoded_result = encode_eap_message (pdu_session_authentication_complete->eapmessage, 0, buffer+encoded,len-encoded))<0)
if((encoded_result = encode_eap_message (pdu_session_authentication_complete->eapmessage, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
else
encoded+=encoded_result;
if((pdu_session_authentication_complete->presence & PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE)
{
if((pdu_session_authentication_complete->presence & PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_complete->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
{
return encoded_result;
}
else
{
encoded+=encoded_result;
}
}
return encoded;
return encoded;
}
......@@ -35,33 +35,33 @@ int decode_pdu_session_establishment_accept( pdu_session_establishment_accept_ms
else
decoded+=decoded_result;
#endif
if((decoded_result = decode__pdu_session_type (&pdu_session_establishment_accept->_pdusessiontype, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode__pdu_session_type (&pdu_session_establishment_accept->_pdusessiontype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
else
decoded+=decoded_result;
if((decoded_result = decode_ssc_mode (&pdu_session_establishment_accept->sscmode, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode_ssc_mode (&pdu_session_establishment_accept->sscmode, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
else
decoded+=decoded_result;
if((decoded_result = decode_qos_rules (&pdu_session_establishment_accept->qosrules, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode_qos_rules (&pdu_session_establishment_accept->qosrules, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
else
decoded+=decoded_result;
if((decoded_result = decode_session_ambr (&pdu_session_establishment_accept->sessionambr, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode_session_ambr (&pdu_session_establishment_accept->sessionambr, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
else
}
else
{
decoded+=decoded_result;
}
while(len - decoded > 0)
{
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded = 0x%x\n",ieiDecoded);
//sleep(1);
if(ieiDecoded == 0)
break;
......@@ -163,9 +163,9 @@ int decode_pdu_session_establishment_accept( pdu_session_establishment_accept_ms
break;
}
}
}
return decoded;
return decoded;
}
......@@ -174,9 +174,10 @@ int encode_pdu_session_establishment_accept( pdu_session_establishment_accept_ms
uint32_t encoded = 0;
int encoded_result = 0;
printf ("\n******************* encode_pdu_session_establishment_accept*****************\n");
// 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, PDU_SESSION_ESTABLISHMENT_ACCEPT_MINIMUM_LENGTH, len);
/*
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_establishment_accept->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
......@@ -198,6 +199,8 @@ int encode_pdu_session_establishment_accept( pdu_session_establishment_accept_ms
else
encoded+=encoded_result;
#endif
*/
if((encoded_result = encode__pdu_session_type (pdu_session_establishment_accept->_pdusessiontype, 0, 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.
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