Commit 5ec0e13d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Process PDU Session Resource Release Command

parent 21bb2917
......@@ -203,12 +203,11 @@ void amf_app::handle_itti_message(
itti_downlink_nas_transfer *dl_msg = new itti_downlink_nas_transfer(
TASK_AMF_APP, TASK_AMF_N1);
dl_msg->dl_nas = dl_nas;
if (!itti_msg.is_n2sm_set) {
dl_msg->is_n2sm_set = false;
} else {
if (itti_msg.is_n2sm_set) {
dl_msg->n2sm = itti_msg.n2sm;
dl_msg->pdu_session_id = itti_msg.pdu_session_id;
dl_msg->is_n2sm_set = true;
dl_msg->n2sm_info_type = itti_msg.n2sm_info_type;
}
dl_msg->amf_ue_ngap_id = amf_n1_inst->supi2amfId.at(itti_msg.supi);
dl_msg->ran_ue_ngap_id = amf_n1_inst->supi2ranId.at(itti_msg.supi);
......
......@@ -21,7 +21,7 @@
/*! \file amf_config.cpp
\brief
\author Keliang DU, BUPT
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......
......@@ -21,7 +21,7 @@
/*! \file amf_n1.cpp
\brief
\author Keliang DU, BUPT, Tien-Thinh NGUYEN, EURECOM
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......@@ -109,10 +109,11 @@ amf_n1::amf_n1() {
Logger::amf_n1().startup("Started");
Logger::amf_n1().debug("Construct amf_n1 successfully");
}
//------------------------------------------------------------------------------
amf_n1::~amf_n1() {
}
// itti msg handlers
//------------------------------------------------------------------------------
void amf_n1::handle_itti_message(itti_downlink_nas_transfer &itti_msg) {
long amf_ue_ngap_id = itti_msg.amf_ue_ngap_id;
......@@ -128,25 +129,46 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer &itti_msg) {
nas_secu_ctx *secu = nc.get()->security_ctx;
bstring protected_nas;
encode_nas_message_protected(secu, false, INTEGRITY_PROTECTED_AND_CIPHERED,
NAS_MESSAGE_DOWNLINK,
NAS_MESSAGE_DOWNLINK,
(uint8_t*) bdata(itti_msg.dl_nas),
blength(itti_msg.dl_nas), protected_nas);
if (itti_msg.is_n2sm_set) {
itti_pdu_session_resource_setup_request *psrsr =
new itti_pdu_session_resource_setup_request(TASK_AMF_N1, TASK_AMF_N2);
psrsr->nas = protected_nas;
psrsr->n2sm = itti_msg.n2sm;
psrsr->amf_ue_ngap_id = amf_ue_ngap_id;
psrsr->ran_ue_ngap_id = ran_ue_ngap_id;
psrsr->pdu_session_id = itti_msg.pdu_session_id;
std::shared_ptr<itti_pdu_session_resource_setup_request> i = std::shared_ptr
< itti_pdu_session_resource_setup_request > (psrsr);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2",
i->get_msg_name());
if (itti_msg.n2sm_info_type.compare("PDU_RES_REL_CMD") == 0) { //PDU SESSION RESOURCE RELEASE COMMAND
itti_pdu_session_resource_release_command *release_command =
new itti_pdu_session_resource_release_command(TASK_AMF_N1,
TASK_AMF_N2);
release_command->nas = protected_nas;
release_command->n2sm = itti_msg.n2sm;
release_command->amf_ue_ngap_id = amf_ue_ngap_id;
release_command->ran_ue_ngap_id = ran_ue_ngap_id;
release_command->pdu_session_id = itti_msg.pdu_session_id;
std::shared_ptr < itti_pdu_session_resource_release_command > i =
std::shared_ptr < itti_pdu_session_resource_release_command
> (release_command);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2",
i->get_msg_name());
}
} else { //PDU SESSION RESOURCE SETUP_REQUEST
itti_pdu_session_resource_setup_request *psrsr =
new itti_pdu_session_resource_setup_request(TASK_AMF_N1, TASK_AMF_N2);
psrsr->nas = protected_nas;
psrsr->n2sm = itti_msg.n2sm;
psrsr->amf_ue_ngap_id = amf_ue_ngap_id;
psrsr->ran_ue_ngap_id = ran_ue_ngap_id;
psrsr->pdu_session_id = itti_msg.pdu_session_id;
std::shared_ptr<itti_pdu_session_resource_setup_request> i =
std::shared_ptr < itti_pdu_session_resource_setup_request > (psrsr);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2",
i->get_msg_name());
}
}
} else {
itti_dl_nas_transport *dnt = new itti_dl_nas_transport(TASK_AMF_N1,
TASK_AMF_N2);
......@@ -171,7 +193,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
std::string nas_context_key = "app_ue_ranid_" + to_string(ran_ue_ngap_id)
+ ":amfid_" + to_string(amf_ue_ngap_id); // key for nas_context, option 1
std::string snn;
if (nas_data_ind.mnc.length() == 2)
if (nas_data_ind.mnc.length() == 2) //TODO: remove hardcoded value
snn = "5G:mnc0" + nas_data_ind.mnc + ".mcc" + nas_data_ind.mcc
+ ".3gppnetwork.org";
else
......@@ -469,6 +491,7 @@ bool amf_n1::check_security_header_type(SecurityHeaderType &type,
return false;
octet = *(buffer + decoded_size);
decoded_size++;
//TODO: remove hardcoded value
switch (octet & 0x0f) {
case 0x0:
type = PlainNasMsg;
......@@ -503,8 +526,8 @@ void amf_n1::service_request_handle(bool isNasSig,
serApt->setHeader(PLAIN_5GS_MSG);
serApt->setPDU_session_status(0x2000);
serApt->setPDU_session_reactivation_result(0x0000);
uint8_t buffer[100];
int encoded_size = serApt->encode2buffer(buffer, 100);
uint8_t buffer[BUFFER_SIZE_256];
int encoded_size = serApt->encode2buffer(buffer, BUFFER_SIZE_256);
bstring protectedNas;
encode_nas_message_protected(secu, false, INTEGRITY_PROTECTED_AND_CIPHERED,
NAS_MESSAGE_DOWNLINK, buffer, encoded_size,
......@@ -796,8 +819,8 @@ void amf_n1::response_registration_reject_msg(uint8_t cause_value,
RegistrationReject *registrationRej = new RegistrationReject();
registrationRej->setHeader(PLAIN_5GS_MSG);
registrationRej->set_5GMM_Cause(cause_value);
uint8_t buffer[1024] = { 0 };
int encoded_size = registrationRej->encode2buffer(buffer, 1024);
uint8_t buffer[BUFFER_SIZE_1024] = { 0 };
int encoded_size = registrationRej->encode2buffer(buffer, BUFFER_SIZE_1024);
//dump_nas_message(buffer, encoded_size);
print_buffer("amf_n1", "Registration-Reject message buffer", buffer,
encoded_size);
......@@ -1485,8 +1508,8 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
//TODO: remove hardcoded values
regAccept->set_5GS_Network_Feature_Support(0x00, 0x00);
regAccept->setT3512_Value(0x5, 0x1e);
uint8_t buffer[1024] = { 0 };
int encoded_size = regAccept->encode2buffer(buffer, 1024);
uint8_t buffer[BUFFER_SIZE_1024] = { 0 };
int encoded_size = regAccept->encode2buffer(buffer, BUFFER_SIZE_1024);
print_buffer("amf_n1", "Registration-Accept message buffer", buffer,
encoded_size);
if (!encoded_size) {
......@@ -1772,8 +1795,8 @@ void amf_n1::ue_initiate_de_registration_handle(uint32_t ran_ue_ngap_id,
DeregistrationAccept *deregAccept = new DeregistrationAccept();
deregAccept->setHeader(PLAIN_5GS_MSG);
uint8_t buffer[512] = { 0 };
int encoded_size = deregAccept->encode2buffer(buffer, 1024);
uint8_t buffer[BUFFER_SIZE_512] = { 0 };
int encoded_size = deregAccept->encode2buffer(buffer, BUFFER_SIZE_512);
print_buffer("amf_n1", "De-registration Accept message buffer", buffer,
encoded_size);
......
......@@ -21,7 +21,7 @@
/*! \file amf_n1.hpp
\brief
\author Keliang DU, BUPT
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......
......@@ -21,7 +21,7 @@
/*! \file amf_n11.cpp
\brief
\author Keliang DU, BUPT, Tien-Thinh NGUYEN, EURECOM
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......@@ -420,7 +420,11 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
std::string supi, uint8_t pdu_session_id) {
Logger::amf_n11().debug("Call SMF service: %s", remoteUri.c_str());
uint8_t number_parts = 0;
mime_parser parser = { };
std::string body;
std::shared_ptr<pdu_session_context> psc;
if (is_supi_to_pdu_ctx(supi)) {
psc = supi_to_pdu_ctx(supi);
} else {
......@@ -429,10 +433,6 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
//TODO:
}
uint8_t number_parts = 0;
mime_parser parser = { };
std::string body;
if ((n1SmMsg.size() > 0) and (n2SmMsg.size() > 0)) {
//prepare the body content for Curl
parser.create_multipart_related_content(body, jsonData, CURL_MIME_BOUNDARY,
......@@ -494,10 +494,12 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
std::string json_data_response = "";
std::string n1sm = "";
std::string n2sm = "";
bool is_response_ok = true;
nlohmann::json response_data = { };
bstring n1sm_hex, n2sm_hex;
Logger::amf_n11().debug("Get response with HTTP code (%d)", httpCode);
//TODO: remove hardcoded HTTP Code
if (httpCode == 0) {
if (static_cast<http_response_codes_e>(httpCode)
== http_response_codes_e::HTTP_RESPONSE_CODE_0) {
Logger::amf_n11().error("Cannot get response when calling %s",
remoteUri.c_str());
//free curl before returning
......@@ -506,8 +508,17 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
return;
}
if (httpCode != 200 && httpCode != 201 && httpCode != 204) {
is_response_ok = false;
if (response.size() > 0) {
number_parts = multipart_parser(response, json_data_response, n1sm, n2sm);
}
if ((static_cast<http_response_codes_e>(httpCode)
!= http_response_codes_e::HTTP_RESPONSE_CODE_200_OK)
&& (static_cast<http_response_codes_e>(httpCode)
!= http_response_codes_e::HTTP_RESPONSE_CODE_201_CREATED)
&& (static_cast<http_response_codes_e>(httpCode)
!= http_response_codes_e::HTTP_RESPONSE_CODE_204_UPDATED)) {
//ERROR
if (response.size() < 1) {
Logger::amf_n11().error("There's no content in the response");
curl_slist_free_all(headers);
......@@ -515,33 +526,7 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
//TODO: send context response error
return;
}
number_parts = multipart_parser(response, json_data_response, n1sm, n2sm);
} else {
//store location of the created context
std::string header_response = *httpHeaderData.get();
std::string CRLF = "\r\n";
std::size_t location_pos = header_response.find("Location");
if (location_pos != std::string::npos) {
std::size_t crlf_pos = header_response.find(CRLF, location_pos);
if (crlf_pos != std::string::npos) {
std::string location = header_response.substr(
location_pos + 10, crlf_pos - (location_pos + 10));
Logger::amf_n11().info("Location of the created SMF context: %s",
location.c_str());
psc.get()->smf_context_location = location;
}
}
if (response.size() > 0) {
number_parts = multipart_parser(response, json_data_response, n1sm, n2sm);
}
}
nlohmann::json response_data = { };
bstring n1sm_hex, n2sm_hex;
if (!is_response_ok) {
try {
response_data = nlohmann::json::parse(json_data_response);
} catch (nlohmann::json::exception &e) {
......@@ -552,50 +537,77 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
Logger::amf_n11().debug("Get response with jsonData: %s",
json_data_response.c_str());
msg_str_2_msg_hex(n1sm.substr(0, n1sm.length() - 2), n1sm_hex); //pdu session establishment reject bugs from SMF
msg_str_2_msg_hex(n1sm.substr(0, n1sm.length() - 2), n1sm_hex); //TODO: pdu session establishment reject bugs from SMF
print_buffer("amf_n11", "Get response with n1sm:",
(uint8_t*) bdata(n1sm_hex), blength(n1sm_hex));
std::string cause = response_data["error"]["cause"];
Logger::amf_n11().error("Call Network Function services failure");
Logger::amf_n11().debug("Cause value: %s", cause.c_str());
Logger::amf_n11().warn(
"Call Network Function services failure (with cause %s)",
cause.c_str());
if (!cause.compare("DNN_DENIED"))
handle_post_sm_context_response_error(httpCode, cause, n1sm_hex, supi,
pdu_session_id);
} else {
//If N1,N2 exist then forward to UE/gNB
itti_n1n2_message_transfer_request *itti_msg =
new itti_n1n2_message_transfer_request(TASK_AMF_N11, TASK_AMF_APP);
if (n1sm.size() > 0) {
msg_str_2_msg_hex(n1sm.substr(0, n1sm.length() - 2), n1sm_hex);
print_buffer("amf_n11", "Get response n1sm:",
(uint8_t*) bdata(n1sm_hex), blength(n1sm_hex));
itti_msg->n1sm = n1sm_hex;
itti_msg->is_n1sm_set = true;
} else if (n2sm.size() > 0) {
msg_str_2_msg_hex(n2sm.substr(0, n2sm.length() - 2), n2sm_hex);
print_buffer("amf_n11", "Get response n1sm:",
(uint8_t*) bdata(n2sm_hex), blength(n2sm_hex));
itti_msg->n2sm = n2sm_hex;
itti_msg->is_n2sm_set = true;
}
//itti_msg->supi = supi;
itti_msg->pdu_session_id = pdu_session_id;
std::shared_ptr<itti_n1n2_message_transfer_request> i = std::shared_ptr
< itti_n1n2_message_transfer_request > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_APP",
i->get_msg_name());
handle_post_sm_context_response_error(httpCode,
cause,
n1sm_hex, supi, pdu_session_id);
} else { //Response with success code
//Store location of the created context in case of PDU Session Establishment
std::string header_response = *httpHeaderData.get();
std::string CRLF = "\r\n";
std::size_t location_pos = header_response.find("Location");
if (location_pos != std::string::npos) {
std::size_t crlf_pos = header_response.find(CRLF, location_pos);
if (crlf_pos != std::string::npos) {
std::string location = header_response.substr(
location_pos + 10, crlf_pos - (location_pos + 10));
Logger::amf_n11().info("Location of the created SMF context: %s",
location.c_str());
psc.get()->smf_context_location = location;
}
}
//Transfer N1/N2 to gNB/UE if available
if (number_parts > 1) {
try {
response_data = nlohmann::json::parse(json_data_response);
} catch (nlohmann::json::exception &e) {
Logger::amf_n11().warn(
"Could not get Json content from the response");
//TODO:
}
itti_n1n2_message_transfer_request *itti_msg =
new itti_n1n2_message_transfer_request(TASK_AMF_N11, TASK_AMF_APP);
if (n1sm.size() > 0) {
msg_str_2_msg_hex(n1sm, n1sm_hex);
print_buffer("amf_n11", "Get response n1sm:",
(uint8_t*) bdata(n1sm_hex), blength(n1sm_hex));
itti_msg->n1sm = n1sm_hex;
itti_msg->is_n1sm_set = true;
} else if (n2sm.size() > 0) {
msg_str_2_msg_hex(n2sm, n2sm_hex);
print_buffer("amf_n11", "Get response n1sm:",
(uint8_t*) bdata(n2sm_hex), blength(n2sm_hex));
itti_msg->n2sm = n2sm_hex;
itti_msg->is_n2sm_set = true;
itti_msg->n2sm_info_type = response_data["n2SmInfoType"];
}
itti_msg->supi = supi;
itti_msg->pdu_session_id = pdu_session_id;
std::shared_ptr<itti_n1n2_message_transfer_request> i = std::shared_ptr
< itti_n1n2_message_transfer_request > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_APP",
i->get_msg_name());
}
}
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
......
......@@ -21,7 +21,7 @@
/*! \file amf_n11.hpp
\brief
\author Keliang DU, BUPT
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......
......@@ -21,7 +21,7 @@
/*! \file amf_n2.cpp
\brief
\author Keliang DU, BUPT
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......@@ -42,6 +42,7 @@
#include "DownLinkNasTransport.hpp"
#include "InitialContextSetupRequest.hpp"
#include "PduSessionResourceSetupRequest.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "UEContextReleaseCommand.hpp"
#include "amf_statistics.hpp"
#include "Ngap_Cause.h"
......@@ -113,6 +114,15 @@ void amf_n2_task(void *args_p) {
amf_n2_inst->handle_itti_message(ref(*m));
}
break;
case PDU_SESSION_RESOURCE_RELEASE_COMMAND: {
Logger::amf_n2().info(
"Encoding PDU SESSION RESOURCE RELEASE COMMAND message, sending ");
itti_pdu_session_resource_release_command *m =
dynamic_cast<itti_pdu_session_resource_release_command*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
}
break;
case INITIAL_CONTEXT_SETUP_REQUEST: {
Logger::amf_n2().info(
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending ");
......@@ -536,7 +546,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request &itti_msg) {
guami.AmfSetID = amf_cfg.guami.AmfSetID;
guami.AmfPointer = amf_cfg.guami.AmfPointer;
msg->setGuami(guami);
msg->setUESecurityCapability(0xe000, 0xe000, 0xe000, 0xe000);
msg->setUESecurityCapability(0xe000, 0xe000, 0xe000, 0xe000); //TODO: remove hardcoded value
msg->setSecurityKey((uint8_t*) bdata(itti_msg.kgnb));
msg->setNasPdu((uint8_t*) bdata(itti_msg.nas), blength(itti_msg.nas));
......@@ -550,7 +560,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request &itti_msg) {
std::vector<PDUSessionResourceSetupRequestItem_t> list;
PDUSessionResourceSetupRequestItem_t item;
item.pduSessionId = itti_msg.pdu_session_id;
item.s_nssai.sst = "01";
item.s_nssai.sst = "01"; //TODO: remove hardcoded value
item.s_nssai.sd = "";
item.pduSessionNAS_PDU = NULL;
bstring n2sm = itti_msg.n2sm;
......@@ -634,7 +644,7 @@ void amf_n2::handle_itti_message(
list.push_back(item);
psrsr->setPduSessionResourceSetupRequestList(list);
size_t buffer_size = 512; //TODO: remove hardcoded value
size_t buffer_size = BUFFER_SIZE_512;
char *buffer = (char*) calloc(1, buffer_size);
int encoded_size = 0;
......@@ -653,6 +663,67 @@ void amf_n2::handle_itti_message(
free_wrapper((void**) &buffer);
}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_pdu_session_resource_release_command &itti_msg) {
std::shared_ptr<ue_ngap_context> unc;
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error("Illegal UE with ran_ue_ngap_id (0x%x)",
itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc;
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error("Illegal gNB with assoc id (0x%x)",
unc.get()->gnb_assoc_id);
return;
}
PduSessionResourceReleaseCommandMsg *release_cmd_msg =
new PduSessionResourceReleaseCommandMsg();
release_cmd_msg->setMessageType();
release_cmd_msg->setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
release_cmd_msg->setRanUeNgapId(itti_msg.ran_ue_ngap_id);
uint8_t *nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
memcpy(nas_pdu, (uint8_t*) bdata(itti_msg.nas), blength(itti_msg.nas));
nas_pdu[blength(itti_msg.nas)] = '\0';
release_cmd_msg->setNasPdu(nas_pdu, blength(itti_msg.nas));
std::vector<PDUSessionResourceToReleaseItem_t> list;
PDUSessionResourceToReleaseItem_t item;
item.pduSessionId = itti_msg.pdu_session_id;
item.pduSessionResourceReleaseCommandTransfer.buf = (uint8_t*) bdata(
itti_msg.n2sm);
item.pduSessionResourceReleaseCommandTransfer.size = blength(itti_msg.n2sm);
list.push_back(item);
release_cmd_msg->setPduSessionResourceToReleaseList(list);
size_t buffer_size = BUFFER_SIZE_512;
char *buffer = (char*) calloc(1, buffer_size);
int encoded_size = 0;
release_cmd_msg->encode2buffer_new(buffer, encoded_size);
#if DEBUG_IS_ON
Logger::amf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++)
printf("%02x ", (char) buffer[i]);
#endif
Logger::amf_n2().debug(" (%d bytes) \n", encoded_size);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(gc.get()->sctp_assoc_id,
unc.get()->sctp_stream_send, &b);
//free memory
free_wrapper((void**) &nas_pdu);
free_wrapper((void**) &buffer);
}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ue_context_release_request &itti_msg) {
Logger::amf_n2().debug("Handling UE context release request ...");
......@@ -664,8 +735,8 @@ void amf_n2::handle_itti_message(itti_ue_context_release_request &itti_msg) {
ueCtxRelCmd->setMessageType();
ueCtxRelCmd->setUeNgapIdPair(amf_ue_ngap_id, ran_ue_ngap_id);
ueCtxRelCmd->setCauseRadioNetwork(cause);
uint8_t buffer[200];
int encoded_size = ueCtxRelCmd->encode2buffer(buffer, 200);
uint8_t buffer[BUFFER_SIZE_512];
int encoded_size = ueCtxRelCmd->encode2buffer(buffer, BUFFER_SIZE_512);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(itti_msg.assoc_id, itti_msg.stream, &b);
}
......
......@@ -47,6 +47,7 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_dl_nas_transport &dl_nas_transport);
void handle_itti_message(itti_initial_context_setup_request &itti_msg);
void handle_itti_message(itti_pdu_session_resource_setup_request &itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command &itti_msg);
void handle_itti_message(itti_ue_context_release_request &itti_msg);
void handle_itti_message(itti_ue_radio_capability_indication &itti_msg);
bool verifyPlmn(std::vector<SupportedItem_t> list);
......
......@@ -21,7 +21,7 @@
/*! \file amf_statistics.cpp
\brief
\author Keliang DU, BUPT
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......
/*
* 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_29_502_SMF_SEEN
#define FILE_3GPP_29_502_SMF_SEEN
enum pdu_session_application_error_e {
PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR = 1,
PDU_SESSION_APPLICATION_ERROR_SNSSAI_DENIED = 2,
PDU_SESSION_APPLICATION_ERROR_DNN_DENIED = 3,
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_DENIED = 4,
PDU_SESSION_APPLICATION_ERROR_SSC_DENIED = 5,
PDU_SESSION_APPLICATION_ERROR_SUBSCRIPTION_DENIED = 6,
PDU_SESSION_APPLICATION_ERROR_DNN_NOT_SUPPORTED = 7,
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_NOT_SUPPORTED = 8,
PDU_SESSION_APPLICATION_ERROR_SSC_NOT_SUPPORTED = 9,
PDU_SESSION_APPLICATION_ERROR_HOME_ROUTED_ROAMING_REQUIRED = 10,
PDU_SESSION_APPLICATION_ERROR_OUT_OF_LADN_SERVICE_AREA = 11,
PDU_SESSION_APPLICATION_ERROR_N2_SM_ERROR = 12,
PDU_SESSION_APPLICATION_ERROR_PRIORITIZED_SERVICES_ONLY = 13,
PDU_SESSION_APPLICATION_ERROR_PDU_SESSION_ANCHOR_CHANGE = 14,
PDU_SESSION_APPLICATION_ERROR_TARGET_MME_CAPABILITY = 15,
PDU_SESSION_APPLICATION_ERROR_NO_EPS_5GS_CONTINUITY = 16,
PDU_SESSION_APPLICATION_ERROR_UNABLE_TO_PAGE_UE = 17,
PDU_SESSION_APPLICATION_ERROR_UE_NOT_RESPONDING = 18,
PDU_SESSION_APPLICATION_ERROR_REJECTED_BY_UE = 19,
PDU_SESSION_APPLICATION_ERROR_REJECTED_DUE_VPLMN_POLICY = 20,
PDU_SESSION_APPLICATION_ERROR_HO_TAU_IN_PROGRESS = 21,
PDU_SESSION_APPLICATION_ERROR_INTEGRITY_PROTECTED_MDR_NOT_ACCEPTABLE = 22,
PDU_SESSION_APPLICATION_ERROR_EBI_EXHAUSTED = 23,
PDU_SESSION_APPLICATION_ERROR_EBI_REJECTED_LOCAL_POLICY = 24,
PDU_SESSION_APPLICATION_ERROR_EBI_REJECTED_NO_N26 = 25,
PDU_SESSION_APPLICATION_ERROR_DEFAULT_EPS_BEARER_INACTIVE = 26,
PDU_SESSION_APPLICATION_ERROR_HANDOVER_RESOURCE_ALLOCATION_FAILURE = 27,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND = 28,
PDU_SESSION_APPLICATION_ERROR_INSUFFICIENT_RESOURCES_SLICE = 29,
PDU_SESSION_APPLICATION_ERROR_INSUFFICIENT_RESOURCES_SLICE_DNN = 30,
PDU_SESSION_APPLICATION_ERROR_DNN_CONGESTION = 31,
PDU_SESSION_APPLICATION_ERROR_S_NSSAI_CONGESTION = 32,
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING = 33,
PDU_SESSION_APPLICATION_ERROR_NETWORK_FAILURE = 34
};
static const std::vector<std::string> pdu_session_application_error_e2str = {
"UNKNOWN ERROR", "N1_SM_ERROR", "SNSSAI_DENIED", "DNN_DENIED",
"PDUTYPE_DENIED", "SSC_DENIED", "SUBSCRIPTION_DENIED", "DNN_NOT_SUPPORTED",
"PDUTYPE_NOT_SUPPORTED", "SSC_NOT_SUPPORTED",
"HOME_ROUTED_ROAMING_REQUIRED", "OUT_OF_LADN_SERVICE_AREA", "N2_SM_ERROR",
"PRIORITIZED_SERVICES_ONLY", "PDU_SESSION_ANCHOR_CHANGE",
"TARGET_MME_CAPABILITY", "NO_EPS_5GS_CONTINUITY", "UNABLE_TO_PAGE_UE",
"UE_NOT_RESPONDING", "REJECTED_BY_UE", "REJECTED_DUE_VPLMN_POLICY",
"HO_TAU_IN_PROGRESS", "INTEGRITY_PROTECTED_MDR_NOT_ACCEPTABLE",
"EBI_EXHAUSTED", "EBI_REJECTED_LOCAL_POLICY", "EBI_REJECTED_NO_N26",
"DEFAULT_EPS_BEARER_INACTIVE", "HANDOVER_RESOURCE_ALLOCATION_FAILURE",
"CONTEXT_NOT_FOUND", "INSUFFICIENT_RESOURCES_SLICE",
"INSUFFICIENT_RESOURCES_SLICE_DNN", "DNN_CONGESTION", "S_NSSAI_CONGESTION",
"PEER_NOT_RESPONDING", "NETWORK_FAILURE" };
//6.1.6.3.12 Enumeration: N2SmInfoType @3GPP TS 29.502 V16.0.0
enum 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 = { "UNKNOWN_TYPE",
"PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL",
"PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP",
"PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND",
"PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL",
"PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED",
"HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK",
"HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" };
#endif
......@@ -66,6 +66,7 @@ typedef struct s_nssai // section 28.4, TS23.003
//SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e {
HTTP_RESPONSE_CODE_0 = 0,
HTTP_RESPONSE_CODE_200_OK = 200,
HTTP_RESPONSE_CODE_201_CREATED = 201,
HTTP_RESPONSE_CODE_202_ACCEPTED = 202,
......@@ -89,7 +90,6 @@ enum class http_response_codes_e {
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504
};
//for CURL
......@@ -97,5 +97,9 @@ enum class http_response_codes_e {
#define SMF_NUMBER_RETRIES 3
constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define BUFFER_SIZE_1024 1024
#define BUFFER_SIZE_512 512
#define BUFFER_SIZE_256 256
#endif
......@@ -66,6 +66,7 @@ typedef enum {
ITTI_DL_NAS_TRANSPORT,
INITIAL_CONTEXT_SETUP_REQUEST,
PDU_SESSION_RESOURCE_SETUP_REQUEST,
PDU_SESSION_RESOURCE_RELEASE_COMMAND,
UE_CONTEXT_RELEASE_REQUEST,
UE_RADIO_CAP_IND,
UL_NAS_DATA_IND, //task amf_n1 message id
......
......@@ -66,6 +66,7 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
bool is_n2sm_set;
bool is_n1sm_set;
uint8_t pdu_session_id;
std::string n2sm_info_type;
//other parameters
};
......
......@@ -59,6 +59,7 @@ class itti_downlink_nas_transfer : public itti_msg_n1 {
bstring n2sm;
bool is_n2sm_set;
uint8_t pdu_session_id;
std::string n2sm_info_type;
};
#endif
......@@ -135,6 +135,26 @@ class itti_pdu_session_resource_setup_request : public itti_msg_n2 {
uint8_t pdu_session_id;
};
class itti_pdu_session_resource_release_command : public itti_msg_n2 {
public:
itti_pdu_session_resource_release_command(const task_id_t origin,
const task_id_t destination)
:
itti_msg_n2(PDU_SESSION_RESOURCE_RELEASE_COMMAND, origin, destination) {
}
itti_pdu_session_resource_release_command(
const itti_pdu_session_resource_release_command &i)
:
itti_msg_n2(i) {
}
bstring nas;
bstring n2sm;
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
uint8_t pdu_session_id;
};
class itti_ue_context_release_request : public itti_msg_n2 {
public:
itti_ue_context_release_request(const task_id_t origin,
......
......@@ -91,7 +91,7 @@ typedef struct Guami_s {
typedef struct {
std::string sst;
std::string sd; //可选
std::string sd;
} S_Nssai;
typedef struct {
......@@ -102,6 +102,12 @@ typedef struct {
OCTET_STRING_t pduSessionResourceSetupRequestTransfer;
} PDUSessionResourceSetupRequestItem_t;
//section 9.2.1.3 PDU Session Resource Release Command (3GPP TS 38.413 V16.0.0 (2019-12))
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t pduSessionResourceReleaseCommandTransfer;
} PDUSessionResourceToReleaseItem_t;
typedef struct {
std::string ip_address;
uint32_t gtp_teid;
......
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceToReleaseItemRelCmd.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceToReleaseItemRelCmd::PDUSessionResourceToReleaseItemRelCmd() {
pDUSessionID = NULL;
}
//------------------------------------------------------------------------------
PDUSessionResourceToReleaseItemRelCmd::~PDUSessionResourceToReleaseItemRelCmd() {
}
//------------------------------------------------------------------------------
void PDUSessionResourceToReleaseItemRelCmd::setPDUSessionResourceToReleaseItemRelCmd(
PDUSessionID *m_pDUSessionID,
OCTET_STRING_t m_pDUSessionResourceReleaseCommandTransfer) {
pDUSessionID = m_pDUSessionID;
pDUSessionResourceReleaseCommandTransfer =
m_pDUSessionResourceReleaseCommandTransfer;
}
//------------------------------------------------------------------------------
void PDUSessionResourceToReleaseItemRelCmd::getPDUSessionResourceToReleaseItemRelCmd(
PDUSessionID *&m_pDUSessionID,
OCTET_STRING_t &m_pDUSessionResourceReleaseCommandTransfer) {
m_pDUSessionID = pDUSessionID;
pDUSessionResourceReleaseCommandTransfer =
m_pDUSessionResourceReleaseCommandTransfer;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceToReleaseItemRelCmd::encode2PDUSessionResourceToReleaseItemRelCmd(
Ngap_PDUSessionResourceToReleaseItemRelCmd_t *pduSessionResourceToReleaseItemRelCmd) {
if (!pDUSessionID->encode2PDUSessionID(
pduSessionResourceToReleaseItemRelCmd->pDUSessionID))
return false;
pduSessionResourceToReleaseItemRelCmd
->pDUSessionResourceReleaseCommandTransfer =
pDUSessionResourceReleaseCommandTransfer;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceToReleaseItemRelCmd::decodefromPDUSessionResourceToReleaseItemRelCmd(
Ngap_PDUSessionResourceToReleaseItemRelCmd_t *pduSessionResourceToReleaseItemRelCmd) {
pDUSessionID = new PDUSessionID();
pDUSessionResourceReleaseCommandTransfer =
pduSessionResourceToReleaseItemRelCmd
->pDUSessionResourceReleaseCommandTransfer;
return true;
}
}
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_TO_RELEASE_ITEM_REL_CMD_H_
#define _PDU_SESSION_RESOURCE_TO_RELEASE_ITEM_REL_CMD_H_
#include "PDUSessionID.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceToReleaseItemRelCmd.h"
}
namespace ngap {
class PDUSessionResourceToReleaseItemRelCmd {
public:
PDUSessionResourceToReleaseItemRelCmd();
virtual ~PDUSessionResourceToReleaseItemRelCmd();
void setPDUSessionResourceToReleaseItemRelCmd(
PDUSessionID *m_pDUSessionID,
OCTET_STRING_t m_pDUSessionResourceReleaseCommandTransfer);
void getPDUSessionResourceToReleaseItemRelCmd(
PDUSessionID *&m_pDUSessionID,
OCTET_STRING_t &m_pDUSessionResourceReleaseCommandTransfer);
bool encode2PDUSessionResourceToReleaseItemRelCmd(
Ngap_PDUSessionResourceToReleaseItemRelCmd_t *pduSessionResourceToReleaseItemRelCmd);
bool decodefromPDUSessionResourceToReleaseItemRelCmd(
Ngap_PDUSessionResourceToReleaseItemRelCmd_t *pduSessionResourceToReleaseItemRelCmd);
private:
PDUSessionID *pDUSessionID;
OCTET_STRING_t pDUSessionResourceReleaseCommandTransfer;
// ProtocolExtensionContainer (OPTIONAL)
};
}
#endif
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceToReleaseListRelCmd.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceToReleaseListRelCmd::PDUSessionResourceToReleaseListRelCmd() {
pduSessionResourceToReleaseItemRelCmd = NULL;
maxnoofPDUSessions = 0;
}
//------------------------------------------------------------------------------
PDUSessionResourceToReleaseListRelCmd::~PDUSessionResourceToReleaseListRelCmd() {
}
//------------------------------------------------------------------------------
void PDUSessionResourceToReleaseListRelCmd::setPDUSessionResourceToReleaseListRelCmd(
PDUSessionResourceToReleaseItemRelCmd *m_pduSessionResourceToReleaseItemRelCmd,
int num) {
pduSessionResourceToReleaseItemRelCmd =
m_pduSessionResourceToReleaseItemRelCmd;
maxnoofPDUSessions = num;
}
//------------------------------------------------------------------------------
void PDUSessionResourceToReleaseListRelCmd::getPDUSessionResourceToReleaseListRelCmd(
PDUSessionResourceToReleaseItemRelCmd *&m_pduSessionResourceToReleaseItemRelCmd,
int &num) {
m_pduSessionResourceToReleaseItemRelCmd =
pduSessionResourceToReleaseItemRelCmd;
num = maxnoofPDUSessions;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceToReleaseListRelCmd::encode2PDUSessionResourceToReleaseListRelCmd(
Ngap_PDUSessionResourceToReleaseListRelCmd_t *pduSessionResourceToReleaseListRelCmd) {
for (int i = 0; i < maxnoofPDUSessions; i++) {
Ngap_PDUSessionResourceToReleaseItemRelCmd_t *rel =
(Ngap_PDUSessionResourceToReleaseItemRelCmd_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceToReleaseItemRelCmd_t));
if (!rel)
return false;
if (!pduSessionResourceToReleaseItemRelCmd[i]
.encode2PDUSessionResourceToReleaseItemRelCmd(rel))
return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceToReleaseListRelCmd->list, rel)
!= 0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceToReleaseListRelCmd::decodefromPDUSessionResourceToReleaseListRelCmd(
Ngap_PDUSessionResourceToReleaseListRelCmd_t *pduSessionResourceToReleaseListRelCmd) {
maxnoofPDUSessions = pduSessionResourceToReleaseListRelCmd->list.count;
pduSessionResourceToReleaseItemRelCmd =
new PDUSessionResourceToReleaseItemRelCmd[maxnoofPDUSessions]();
for (int i = 0; i < maxnoofPDUSessions; i++) {
if (!pduSessionResourceToReleaseItemRelCmd[i]
.decodefromPDUSessionResourceToReleaseItemRelCmd(
pduSessionResourceToReleaseListRelCmd->list.array[i]))
return false;
}
return true;
}
}
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_TO_RELEASE_LIST_REL_CMD_H_
#define _PDU_SESSION_RESOURCE_TO_RELEASE_LIST_REL_CMD_H_
#include "PDUSessionResourceToReleaseItemRelCmd.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceToReleaseItemRelCmd.h"
#include "Ngap_PDUSessionResourceToReleaseListRelCmd.h"
}
namespace ngap {
class PDUSessionResourceToReleaseListRelCmd {
public:
PDUSessionResourceToReleaseListRelCmd();
virtual ~PDUSessionResourceToReleaseListRelCmd();
void setPDUSessionResourceToReleaseListRelCmd(
PDUSessionResourceToReleaseItemRelCmd *m_pduSessionResourceToReleaseItemRelCmd,
int num);
void getPDUSessionResourceToReleaseListRelCmd(
PDUSessionResourceToReleaseItemRelCmd *&m_pduSessionResourceToReleaseItemRelCmd,
int &num);
bool encode2PDUSessionResourceToReleaseListRelCmd(
Ngap_PDUSessionResourceToReleaseListRelCmd_t *pduSessionResourceToReleaseListRelCmd);
bool decodefromPDUSessionResourceToReleaseListRelCmd(
Ngap_PDUSessionResourceToReleaseListRelCmd_t *pduSessionResourceToReleaseListRelCmd);
private:
PDUSessionResourceToReleaseItemRelCmd *pduSessionResourceToReleaseItemRelCmd;
int maxnoofPDUSessions;
};
}
#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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_RELEASE_COMMAND_H_
#define _PDU_SESSION_RESOURCE_RELEASE_COMMAND_H_
#include "NgapIEsStruct.hpp"
#include "MessageType.hpp"
#include "AMF-UE-NGAP-ID.hpp"
#include "RAN-UE-NGAP-ID.hpp"
#include "RANPagingPriority.hpp"
#include "NAS-PDU.hpp"
#include "PDUSessionResourceToReleaseListRelCmd.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
class PduSessionResourceReleaseCommandMsg {
public:
PduSessionResourceReleaseCommandMsg();
virtual ~PduSessionResourceReleaseCommandMsg();
void setMessageType();
void setAmfUeNgapId(unsigned long id); //40 bits
void setRanUeNgapId(uint32_t id); // 32 bits
void setRanPagingPriority(uint8_t priority);
void setNasPdu(uint8_t *nas, size_t sizeofnas);
void setPduSessionResourceToReleaseList(
std::vector<PDUSessionResourceToReleaseItem_t> list);
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
int getRanPagingPriority();
bool getNasPdu(uint8_t *&nas, size_t &sizeofnas);
bool getPduSessionResourceToReleaseList(
std::vector<PDUSessionResourceToReleaseItem_t> &list);
int encode2buffer(uint8_t *buf, int buf_size);
void encode2buffer_new(char *buf, int &encoded_size);
bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
private:
Ngap_NGAP_PDU_t *pduSessionResourceReleaseCommandPdu;
Ngap_PDUSessionResourceReleaseCommand_t *pduSessionResourceReleaseCommandIEs; //store list of IEs
//section 9.2.1.3 PDU Session Resource Release Command (3GPP TS 38.413 V16.0.0 (2019-12))
AMF_UE_NGAP_ID *amfUeNgapId;
RAN_UE_NGAP_ID *ranUeNgapId;
RANPagingPriority *ranPagingPriority;
NAS_PDU *nasPdu;
PDUSessionResourceToReleaseListRelCmd *pduSessionResourceToReleaseList;
};
}
#endif
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