Commit 509ac490 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'develop' into 'amf-event-exposure'

# Conflicts:
#   src/common/3gpp_29.518.h
#   src/common/amf.hpp
parents 9433e64f 8d5c8bca
......@@ -40,6 +40,9 @@ def dsT_host = ""
def dsT_host_user = ""
def dsT_host_ip_addr = ""
// dsTester tag to use
def dsTesterTag = params.DSTESTER_TAG
// Flags
def scmEvent = false
def upstreamEvent = false
......@@ -205,7 +208,7 @@ pipeline {
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.dsTesterGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_token']
]) {
sh "git clone https://${git_username}:${git_token}@github.com/OPENAIRINTERFACE/chasseur.git . > ../git_clone.log 2>&1"
sh "git checkout edge >> ../git_clone.log 2>&1"
sh "git checkout -f " + dsTesterTag + " >> ../git_clone.log 2>&1"
dir ('jenkins') {
try {
sh "python3 ./dogmatix-agent.py -f ./suits/dc/amf-bracket.yaml -d true | tee ../../DS-TEST-RESULTS/dsTester_Summary.txt"
......
......@@ -115,6 +115,10 @@ pipeline {
error "Stopping pipeline!"
}
}
if (params.DockerHubCredentials == null) {
echo '\u26D4 \u001B[31mNo Credentials to push to DockerHub!\u001B[0m'
error "Stopping pipeline!"
}
}
}
}
......@@ -198,6 +202,10 @@ pipeline {
myShCmd('docker build --no-cache --target oai-amf --tag oai-amf:' + amf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/amf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
myShCmd('docker image ls >> archives/amf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
// We will keep also the TMP image in U18 case.
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker image tag oai-amf:' + amf_tag + ' oai-amf:' + rhel_amf_tag, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
}
}
}
......@@ -433,6 +441,25 @@ pipeline {
}
}
}
// For the moment it is Docker-Hub, but we might have a new one internally.
stage ('Pushing Image to Official Registry') {
steps {
script {
// Only in case of push to target branch!
if ("PUSH".equals(env.gitlabActionType)) {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.DockerHubCredentials}", usernameVariable: 'DH_Username', passwordVariable: 'DH_Password']
]) {
myShCmd("echo ${DH_Password} | docker login --username ${DH_Username} --password-stdin", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker image tag oai-amf:develop ${DH_Username}/oai-amf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker push ${DH_Username}/oai-amf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker rmi ${DH_Username}/oai-amf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker logout", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
}
}
}
}
}
post {
success {
......
......@@ -84,6 +84,7 @@ services:
- AUSF_IPV4_ADDRESS=0.0.0.0
- AUSF_PORT=80
- AUSF_API_VERSION=v1
- AUSF_FQDN=localhost
depends_on:
- cicd_mysql
networks:
......
......@@ -36,16 +36,17 @@ try:
result = re.search('(?:\/.+?\/)(.+?)(?:\/.+)', str(line))
if result:
result1 = re.search('^(.*/)([^/]*)$', str(result.group(0)))
subprocess.check_output(f'cp {result1.group(1)}* DS-TEST-RESULTS/', stderr=subprocess.STDOUT, shell=True, universal_newlines=True)
filename = re.search('[^/]*$', str(result1.group(0)))
subprocess.check_output(f'cp -r {result1.group(1)}* DS-TEST-RESULTS/', shell=True, universal_newlines=True)
locexist = True
except IOError:
sys.exit("File not accessible to check DSTester Summary: DS-TEST-RESULTS/dsTester_Summary.txt")
if locexist:
try:
with open(cwd + '/DS-TEST-RESULTS/dcamf.yaml') as f:
data = yaml.load(f)
with open(cwd + f'/DS-TEST-RESULTS/{filename.group(0)}') as f:
data = yaml.full_load(f)
if data["final-result"] == 'fail':
sys.exit('DsTester final result FAILED')
except IOError:
sys.exit("File not accessible to check DSTester result: DS-TEST-RESULTS/dcamf.yaml")
sys.exit(f'File not accessible to check DSTester result: DS-TEST-RESULTS/{filename.group(0)}')
......@@ -55,9 +55,9 @@ RUN rm -f /etc/rhsm-host && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" && \
git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-amf/
......@@ -70,7 +70,6 @@ RUN ./build_amf --install-deps --force
# Building AMF
WORKDIR /openair-amf/build/scripts
RUN ./build_amf --clean --Verbose --build-type Release --jobs
#RUN ./build_amf --clean --Verbose --build-type Debug --jobs
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -80,14 +79,14 @@ ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \
tzdata \
procps-ng \
psmisc \
net-tools \
libevent && \
tzdata \
libasan \
procps-ng \
psmisc \
net-tools \
libevent && \
rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-amf/bin
COPY --from=oai-amf-builder /openair-amf/build/amf/build/amf oai_amf
......@@ -108,15 +107,9 @@ COPY --from=oai-amf-builder /usr/lib64/libboost_regex.so.1.66.0 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libicudata.so.60 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libicui18n.so.60 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libicuuc.so.60 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libasan.so.5.0.0 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libasan.so.5 /usr/lib64/
COPY --from=oai-amf-builder /openair-amf/scripts/entrypoint.sh entrypoint.sh
# debug
#RUN ldconfig -v
#RUN ldd oai_amf
# Copying template configuration files
WORKDIR /openair-amf/etc
COPY --from=oai-amf-builder /openair-amf/etc/amf.conf .
......@@ -127,7 +120,4 @@ WORKDIR /openair-amf
EXPOSE 80/tcp 9090/tcp 38412/sctp
ENTRYPOINT ["/openair-amf/bin/entrypoint.sh"]
CMD ["/openair-amf/bin/oai_amf", "-c", "/openair-amf/etc/amf.conf", "-o"]
#CMD ["sleep", "infinity"]
......@@ -33,7 +33,7 @@ FROM ubuntu:bionic as oai-amf-builder
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
ENV TZ=Europe/Paris
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
......@@ -44,9 +44,9 @@ RUN apt-get update && \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration commands quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" && \
git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
WORKDIR /openair-amf/
COPY . /openair-amf
......
......@@ -85,7 +85,7 @@ AMF =
IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
FQDN = "@NRF_FQDN@"
FQDN = "@NRF_FQDN@" # YOUR NRF FQDN CONFIG HERE
};
AUSF :
......@@ -93,6 +93,7 @@ AMF =
IPV4_ADDRESS = "@AUSF_IPV4_ADDRESS@"; # YOUR AUSF CONFIG HERE
PORT = @AUSF_PORT@; # YOUR AUSF CONFIG HERE (default: 80)
API_VERSION = "@AUSF_API_VERSION@"; # YOUR AUSF API VERSION FOR SBI CONFIG HERE
FQDN = "@AUSF_FQDN@" # YOUR AUSF FQDN CONFIG HERE
};
};
......
......@@ -7,6 +7,12 @@ CONFIG_DIR="/openair-amf/etc"
# Default values
EXTERNAL_AUSF=${EXTERNAL_AUSF:-no}
EXTERNAL_UDM=${EXTERNAL_UDM:-no}
if [[ ${USE_FQDN_DNS} == "yes" ]];then
SMF_IPV4_ADDR_0=${SMF_IPV4_ADDR_0:-0.0.0.0}
SMF_IPV4_ADDR_1=${SMF_IPV4_ADDR_1:-0.0.0.0}
NRF_IPV4_ADDRESS=${NRF_IPV4_ADDRESS:-0.0.0.0}
AUSF_IPV4_ADDRESS=${AUSF_IPV4_ADDRESS:-0.0.0.0}
fi
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
......
......@@ -244,39 +244,56 @@ evsub_id_t amf_app::generate_ev_subscription_id() {
//------------------------------------------------------------------------------
void amf_app::handle_itti_message(
itti_n1n2_message_transfer_request& itti_msg) {
// Encode DL NAS TRANSPORT message(NAS message)
DLNASTransport* dl = new DLNASTransport();
dl->setHeader(PLAIN_5GS_MSG);
dl->setPayload_Container_Type(N1_SM_INFORMATION);
dl->setPayload_Container(
(uint8_t*) bdata(itti_msg.n1sm), blength(itti_msg.n1sm));
dl->setPDUSessionId(itti_msg.pdu_session_id);
uint8_t nas[1024];
int encoded_size = dl->encode2buffer(nas, 1024);
print_buffer("amf_app", "n1n2 transfer", nas, encoded_size);
bstring dl_nas = blk2bstr(nas, encoded_size);
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;
if (itti_msg.is_ppi_set) { // Paging procedure
Logger::amf_app().info(
"Handle ITTI N1N2 Message Transfer Request for Paging");
std::shared_ptr<itti_paging> i =
std::make_shared<itti_paging>(TASK_AMF_APP, TASK_AMF_N2);
i.get()->amf_ue_ngap_id = amf_n1_inst->supi2amfId.at(itti_msg.supi);
i.get()->ran_ue_ngap_id = amf_n1_inst->supi2ranId.at(itti_msg.supi);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N2",
i->get_msg_name());
}
} else {
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);
std::shared_ptr<itti_downlink_nas_transfer> i =
std::shared_ptr<itti_downlink_nas_transfer>(dl_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N1",
i->get_msg_name());
Logger::amf_app().info("Handle ITTI N1N2 Message Transfer Request");
// Encode DL NAS TRANSPORT message(NAS message)
DLNASTransport* dl = new DLNASTransport();
dl->setHeader(PLAIN_5GS_MSG);
dl->setPayload_Container_Type(N1_SM_INFORMATION);
dl->setPayload_Container(
(uint8_t*) bdata(itti_msg.n1sm), blength(itti_msg.n1sm));
dl->setPDUSessionId(itti_msg.pdu_session_id);
uint8_t nas[BUFFER_SIZE_1024];
int encoded_size = dl->encode2buffer(nas, BUFFER_SIZE_1024);
print_buffer("amf_app", "n1n2 transfer", nas, encoded_size);
bstring dl_nas = blk2bstr(nas, encoded_size);
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 {
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);
std::shared_ptr<itti_downlink_nas_transfer> i =
std::shared_ptr<itti_downlink_nas_transfer>(dl_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N1",
i->get_msg_name());
}
}
}
......
......@@ -58,29 +58,32 @@ namespace config {
//------------------------------------------------------------------------------
amf_config::amf_config() {
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
instance = 0;
n2 = {};
n11 = {};
statistics_interval = 0;
guami = {};
guami_list = {};
relativeAMFCapacity = 0;
plmn_list = {};
auth_conf auth_para = {};
nas_cfg = {};
smf_pool = {};
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
ausf_addr.ipv4_addr.s_addr = INADDR_ANY;
ausf_addr.port = 80;
ausf_addr.api_version = "v1";
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
instance = 0;
n2 = {};
n11 = {};
statistics_interval = 0;
guami = {};
guami_list = {};
relativeAMFCapacity = 0;
plmn_list = {};
auth_conf auth_para = {};
nas_cfg = {};
smf_pool = {};
enable_nf_registration = false;
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
struct {
struct in_addr ipv4_addr;
......@@ -129,7 +132,7 @@ int amf_config::load(const std::string& config_file) {
const Setting& amf_cfg = root[AMF_CONFIG_STRING_AMF_CONFIG];
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error("%s : %s", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Instance
......@@ -283,7 +286,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Network interfaces
......@@ -396,34 +399,52 @@ int amf_config::load(const std::string& config_file) {
}
// AUSF
// TODO: add FQDN option
const Setting& ausf_cfg = new_if_cfg[AMF_CONFIG_STRING_AUSF];
struct in_addr ausf_ipv4_addr = {};
unsigned int ausf_port = {};
std::string ausf_api_version = {};
ausf_cfg.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR AUSF !");
ausf_addr.ipv4_addr = ausf_ipv4_addr;
if (!(ausf_cfg.lookupValue(AMF_CONFIG_STRING_PORT, ausf_port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_PORT "failed");
throw(AMF_CONFIG_STRING_PORT "failed");
}
ausf_addr.port = ausf_port;
if (enable_external_ausf) {
const Setting& ausf_cfg = new_if_cfg[AMF_CONFIG_STRING_AUSF];
struct in_addr ausf_ipv4_addr = {};
unsigned int ausf_port = {};
std::string ausf_api_version = {};
if (!(ausf_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, ausf_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
if (!use_fqdn_dns) {
ausf_cfg.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR AUSF !");
ausf_addr.ipv4_addr = ausf_ipv4_addr;
if (!(ausf_cfg.lookupValue(AMF_CONFIG_STRING_PORT, ausf_port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_PORT "failed");
throw(AMF_CONFIG_STRING_PORT "failed");
}
ausf_addr.port = ausf_port;
if (!(ausf_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, ausf_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
ausf_addr.api_version = ausf_api_version;
} else {
std::string ausf_fqdn = {};
ausf_cfg.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, ausf_fqdn);
uint8_t addr_type = {};
fqdn::resolve(ausf_fqdn, address, ausf_port, addr_type);
if (addr_type != 0) { // IPv6: TODO
throw("DO NOT SUPPORT IPV6 ADDR FOR AUSF!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR AUSF !");
ausf_addr.ipv4_addr = ausf_ipv4_addr;
ausf_addr.port = ausf_port;
ausf_addr.api_version = "v1"; // TODO: get API version
}
}
}
ausf_addr.api_version = ausf_api_version;
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Emergency support
......@@ -434,7 +455,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Authentication Info
......@@ -452,7 +473,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Integrity/Ciphering algorithms (NAS)
......@@ -493,7 +514,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
return 1;
......@@ -501,6 +522,8 @@ int amf_config::load(const std::string& config_file) {
//------------------------------------------------------------------------------
void amf_config::display() {
Logger::config().info(
"==== OAI-CN5G %s v%s ====", PACKAGE_NAME, PACKAGE_VERSION);
Logger::config().info(
"====================== AMF =====================");
Logger::config().info("Configuration AMF:");
......
This diff is collapsed.
......@@ -106,6 +106,12 @@ class amf_n1 {
void run_mobility_registration_update_procedure(
std::shared_ptr<nas_context> nc, uint16_t uplink_data_status,
uint16_t pdu_session_status);
void run_periodic_registration_update_procedure(
std::shared_ptr<nas_context> nc, uint16_t);
void run_periodic_registration_update_procedure(
std::shared_ptr<nas_context> nc, bstring& nas_msg);
// authentication
bool auth_vectors_generator(std::shared_ptr<nas_context>& nc);
......
......@@ -170,12 +170,23 @@ void amf_n11::handle_itti_message(
string ue_context_key = "app_ue_ranid_" + to_string(itti_msg.ran_ue_ngap_id) +
":amfid_" + to_string(itti_msg.amf_ue_ngap_id);
std::shared_ptr<ue_context> uc = {};
if (!amf_app_inst->is_ran_amf_id_2_ue_context(ue_context_key)) {
Logger::amf_n11().error(
"No UE context for %s exit", ue_context_key.c_str());
return;
}
uc = amf_app_inst->ran_amf_id_2_ue_context(ue_context_key);
std::string supi = {};
if (uc.get() != nullptr) {
supi = uc->supi;
} else {
Logger::amf_n11().error(
"Could not find UE context with key %s", ue_context_key.c_str());
return;
}
Logger::amf_n11().debug(
"Send PDU Session Update SM Context Request to SMF (SUPI %s, PDU Session "
"ID %d)",
......@@ -217,35 +228,43 @@ void amf_n11::handle_itti_message(
Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str());
std::string n2SmMsg = {};
nlohmann::json pdu_session_update_request = {};
// if (itti_msg.is_n2sm_set){
pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type;
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg";
std::string json_part = pdu_session_update_request.dump();
std::string n2SmMsg = {};
octet_stream_2_hex_stream(
(uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), n2SmMsg);
if (itti_msg.is_n2sm_set) {
pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type;
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg";
octet_stream_2_hex_stream(
(uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), n2SmMsg);
}
// For N2 HO
if (itti_msg.n2sm_info_type.compare("HANDOVER_REQUIRED") == 0) {
if (itti_msg.ho_state.compare("PREPARING") == 0) {
pdu_session_update_request["hoState"] = "PREPARING";
} else if (itti_msg.n2sm_info_type.compare("HANDOVER_REQ_ACK") == 0) {
} else if (itti_msg.ho_state.compare("PREPARED") == 0) {
pdu_session_update_request["hoState"] = "PREPARED";
} else if (itti_msg.n2sm_info_type.compare("SECONDARY_RAT_USAGE") == 0) {
} else if (itti_msg.ho_state.compare("COMPLETED") == 0) {
pdu_session_update_request["hoState"] = "COMPLETED";
}
std::string json_part = pdu_session_update_request.dump();
curl_http_client(
remote_uri, json_part, "", n2SmMsg, supi, itti_msg.pdu_session_id,
itti_msg.promise_id);
stacs.display();
// stacs.display();
}
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
Logger::amf_n11().debug("Handle ITTI SMF_PDU_SESSION_CREATE_SM_CTX");
if (!amf_n1_inst->is_amf_ue_id_2_nas_context(smf.amf_ue_ngap_id)) {
Logger::amf_n2().error(
"No UE NAS context with amf_ue_ngap_id (0x%x)", smf.amf_ue_ngap_id);
return;
}
std::shared_ptr<nas_context> nc = {};
nc = amf_n1_inst->amf_ue_id_2_nas_context(smf.amf_ue_ngap_id);
std::string supi = "imsi-" + nc.get()->imsi;
......@@ -256,7 +275,20 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
Logger::amf_n11().info(
"Find ue_context in amf_app using UE Context Key: %s",
ue_context_key.c_str());
if (!amf_app_inst->is_ran_amf_id_2_ue_context(ue_context_key)) {
Logger::amf_n11().error(
"No UE context for %s exit", ue_context_key.c_str());
return;
}
uc = amf_app_inst->ran_amf_id_2_ue_context(ue_context_key);
if (!uc.get()) {
Logger::amf_n11().error(
"No UE context for %s exit", ue_context_key.c_str());
return;
}
std::shared_ptr<pdu_session_context> psc = {};
if (!uc.get()->find_pdu_session_context(smf.pdu_sess_id, psc)) {
psc = std::shared_ptr<pdu_session_context>(new pdu_session_context());
......@@ -264,6 +296,11 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
Logger::amf_n11().debug("Create a PDU Session Context");
}
if (!psc.get()) {
Logger::amf_n11().error("No PDU Session Context found");
return;
}
psc.get()->amf_ue_ngap_id = nc.get()->amf_ue_ngap_id;
psc.get()->ran_ue_ngap_id = nc.get()->ran_ue_ngap_id;
psc.get()->req_type = smf.req_type;
......@@ -543,6 +580,7 @@ void amf_n11::handle_post_sm_context_response_error(
itti_msg->is_n2sm_set = false;
itti_msg->supi = supi;
itti_msg->pdu_session_id = pdu_session_id;
itti_msg->is_ppi_set = false;
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);
......@@ -564,6 +602,7 @@ void amf_n11::curl_http_client(
mime_parser parser = {};
std::string body = {};
std::shared_ptr<pdu_session_context> psc = {};
bool is_multipart = true;
if (!amf_app_inst->find_pdu_session_context(supi, pdu_session_id, psc)) {
Logger::amf_n11().warn(
......@@ -585,6 +624,9 @@ void amf_n11::curl_http_client(
parser.create_multipart_related_content(
body, jsonData, CURL_MIME_BOUNDARY, n2SmMsg,
multipart_related_content_part_e::NGAP);
} else {
body = jsonData;
is_multipart = false;
}
Logger::amf_n11().debug(
......@@ -601,14 +643,18 @@ void amf_n11::curl_http_client(
if (curl) {
CURLcode res = {};
struct curl_slist* headers = nullptr;
std::string content_type = "content-type: multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY);
std::string content_type = {};
if (is_multipart) {
content_type = "content-type: multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY);
} else {
content_type = "content-type: application/json";
}
headers = curl_slist_append(headers, content_type.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, remoteUri.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, SMF_CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_INTERFACE, amf_cfg.n11.if_name.c_str());
// Response information
......@@ -635,8 +681,8 @@ void amf_n11::curl_http_client(
nlohmann::json response_data = {};
bstring n1sm_hex, n2sm_hex;
Logger::amf_n11().debug("Get response with HTTP code (%d)", httpCode);
Logger::amf_n11().debug("response body %s", response.c_str());
Logger::amf_n11().info("Get response with HTTP code (%d)", httpCode);
Logger::amf_n11().info("Response body %s", response.c_str());
if (static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_0) {
......@@ -655,6 +701,12 @@ void amf_n11::curl_http_client(
number_parts = parser.parse(response, json_data_response, n1sm, n2sm);
}
if (number_parts == 0) {
json_data_response = response;
}
Logger::amf_n11().info("Json part %s", json_data_response.c_str());
if ((static_cast<http_response_codes_e>(httpCode) !=
http_response_codes_e::HTTP_RESPONSE_CODE_200_OK) &&
(static_cast<http_response_codes_e>(httpCode) !=
......@@ -759,6 +811,10 @@ void amf_n11::curl_http_client(
itti_n1n2_message_transfer_request* itti_msg =
new itti_n1n2_message_transfer_request(TASK_AMF_N11, TASK_AMF_APP);
itti_msg->is_n1sm_set = false;
itti_msg->is_n2sm_set = false;
itti_msg->is_ppi_set = false;
if (n1sm.size() > 0) {
msg_str_2_msg_hex(n1sm, n1sm_hex);
print_buffer(
......@@ -826,7 +882,7 @@ bool amf_n11::discover_smf(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_INTERFACE, amf_cfg.n11.if_name.c_str());
// Response information
......@@ -937,7 +993,7 @@ void amf_n11::register_nf_instance(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_INTERFACE, amf_cfg.n11.if_name.c_str());
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
......@@ -1012,7 +1068,7 @@ bool amf_n11::send_ue_authentication_request(
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, AUSF_CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_INTERFACE, amf_cfg.n11.if_name.c_str());
if (http_version == 2) {
......@@ -1149,10 +1205,6 @@ void amf_n11::curl_http_client(
return;
}
else {
response = *httpData.get();
}
if (!is_response_ok) {
try {
response_data = nlohmann::json::parse(json_data_response);
......
This diff is collapsed.
......@@ -65,6 +65,7 @@ class amf_n2 : public ngap::ngap_app {
void send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id);
void handle_itti_message(itti_paging& itti_msg);
bool verifyPlmn(std::vector<SupportedItem_t> list);
std::vector<SupportedItem_t> get_common_plmn(
......
......@@ -129,4 +129,23 @@ typedef struct amf_event_report_s {
// bool m_r_5gsUserStateListIsSet;
*/
} amf_event_report_t;
enum n1_n2_message_transfer_cause_e {
ATTEMPTING_TO_REACH_UE = 1,
N1_N2_TRANSFER_INITIATED = 2,
WAITING_FOR_ASYNCHRONOUS_TRANSFER = 3,
UE_NOT_RESPONDING = 4,
N1_MSG_NOT_TRANSFERRED = 5,
UE_NOT_REACHABLE_FOR_SESSION = 6
};
static const std::vector<std::string> n1_n2_message_transfer_cause_e2str = {
"UNKNOWN ERROR",
"ATTEMPTING_TO_REACH_UE",
"N1_N2_TRANSFER_INITIATED",
"WAITING_FOR_ASYNCHRONOUS_TRANSFER",
"UE_NOT_RESPONDING",
"N1_MSG_NOT_TRANSFERRED",
"UE_NOT_REACHABLE_FOR_SESSION"};
#endif
......@@ -34,13 +34,10 @@
#include "stdio.h"
// for CURL
#define SMF_CURL_TIMEOUT_MS 100L
#define SMF_NUMBER_RETRIES 3
constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define NRF_CURL_TIMEOUT_MS 100L
#define AUSF_CURL_TIMEOUT_MS 100L
#define CURL_TIMEOUT_MS 100L
#define CURL_TIMEOUT_MS 1000L
#define BUFFER_SIZE_4096 4096
#define BUFFER_SIZE_2048 2048
#define BUFFER_SIZE_1024 1024
#define BUFFER_SIZE_512 512
......@@ -57,4 +54,7 @@ typedef uint32_t evsub_id_t;
constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#define UE_AGGREGATE_MAXIMUM_BIT_RATE_DL 300000000
#define UE_AGGREGATE_MAXIMUM_BIT_RATE_UL 200000000
#endif
......@@ -66,19 +66,18 @@ void Logger::_init(
std::stringstream ss;
ss << "[%Y-%m-%dT%H:%M:%S.%f] [" << app << "] [%n] [%l] %v";
m_async_cmd = new _Logger("asnyc_c", m_sinks, ss.str().c_str());
m_amf_app = new _Logger("amf_app", m_sinks, ss.str().c_str());
m_config = new _Logger("configurations", m_sinks, ss.str().c_str());
m_system = new _Logger("system ", m_sinks, ss.str().c_str());
m_sctp = new _Logger("sctp ", m_sinks, ss.str().c_str());
m_nas_mm = new _Logger("nas_mm ", m_sinks, ss.str().c_str());
m_ngap = new _Logger("ngap ", m_sinks, ss.str().c_str());
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_amf_n2 = new _Logger("amf_n2 ", m_sinks, ss.str().c_str());
m_amf_n1 = new _Logger("amf_n1 ", m_sinks, ss.str().c_str());
m_amf_n11 = new _Logger("amf_n11", m_sinks, ss.str().c_str());
m_amf_server = new _Logger("amf_server", m_sinks, ss.str().c_str());
m_task_amf_n2 = new _Logger("task_amf_n2", m_sinks, ss.str().c_str());
m_async_cmd = new _Logger("asnyc_c", m_sinks, ss.str().c_str());
m_amf_app = new _Logger("amf_app", m_sinks, ss.str().c_str());
m_config = new _Logger("config ", m_sinks, ss.str().c_str());
m_system = new _Logger("system ", m_sinks, ss.str().c_str());
m_sctp = new _Logger("sctp ", m_sinks, ss.str().c_str());
m_nas_mm = new _Logger("nas_mm ", m_sinks, ss.str().c_str());
m_ngap = new _Logger("ngap ", m_sinks, ss.str().c_str());
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_amf_n2 = new _Logger("amf_n2 ", m_sinks, ss.str().c_str());
m_amf_n1 = new _Logger("amf_n1 ", m_sinks, ss.str().c_str());
m_amf_n11 = new _Logger("amf_n11", m_sinks, ss.str().c_str());
m_amf_server = new _Logger("amf_sbi", m_sinks, ss.str().c_str());
}
//------------------------------------------------------------------------------
......
......@@ -94,7 +94,6 @@ class Logger {
static _Logger& amf_n1() { return *singleton().m_amf_n1; }
static _Logger& amf_n11() { return *singleton().m_amf_n11; }
static _Logger& amf_server() { return *singleton().m_amf_server; }
static _Logger& task_amf_n2() { return *singleton().m_task_amf_n2; }
private:
static Logger* m_singleton;
......@@ -124,7 +123,6 @@ class Logger {
_Logger* m_amf_n1;
_Logger* m_amf_n11;
_Logger* m_amf_server;
_Logger* m_task_amf_n2;
};
#endif
......@@ -37,7 +37,6 @@ include_directories(${SRC_TOP_DIR}/utils)
include_directories(${SRC_TOP_DIR}/utils/bstr)
add_library (CONTEXTS STATIC
${CMAKE_CURRENT_SOURCE_DIR}/gNB_context.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nas_context.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pdu_session_context.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ue_context.cpp
......
......@@ -45,10 +45,15 @@ extern "C" {
using namespace sctp;
using namespace ngap;
enum amf_ng_gnb_state_s { NGAP_INIT, NGAP_RESETING, NGAP_READY, NGAP_SHUTDOWN };
typedef enum {
NGAP_INIT,
NGAP_RESETING,
NGAP_READY,
NGAP_SHUTDOWN
} amf_ng_gnb_state_t;
class gnb_context {
public:
enum amf_ng_gnb_state_s ng_state;
amf_ng_gnb_state_t ng_state;
std::string gnb_name;
long globalRanNodeId;
......
......@@ -64,6 +64,7 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() {
is_auth_vectors_present = false;
to_be_register_by_new_suci = false;
ueSecurityCaplen = 0;
nas_status = {};
}
//------------------------------------------------------------------------------
......
......@@ -56,6 +56,11 @@ static const std::vector<std::string> _5gmm_state_e2str = {
"_5GMM_COMMON_PROCEDURE_INITIATED",
"_5GMM_STATE_MAX"};
typedef enum { CM_IDLE = 0, CM_CONNECTED } cm_state_t;
static const std::vector<std::string> cm_state_e2str = {"CM_IDLE",
"CM_CONNECTED"};
class nas_context {
public:
nas_context();
......@@ -64,7 +69,7 @@ class nas_context {
bool is_stacs_available;
long amf_ue_ngap_id;
uint32_t ran_ue_ngap_id;
std::string nas_status;
cm_state_t nas_status;
_5gmm_state_t _5gmm_state;
// parameters from Registration request
......
......@@ -44,6 +44,7 @@ pdu_session_context::pdu_session_context() {
smf_available = false;
snssai = {};
plmn = {};
is_ho_accepted = false;
}
//------------------------------------------------------------------------------
......
......@@ -53,12 +53,18 @@ class ue_ngap_context {
sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB
sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB
sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to
sctp_assoc_id_t target_gnb_assoc_id;
sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to
sctp_assoc_id_t target_gnb_assoc_id; // for HO
bool ueContextRequest;
uint32_t s_tmsi_5g;
std ::string s_setid;
std ::string s_pointer;
std ::string s_tmsi;
Tai_t tai;
// state management, ue status over the air
ng_ue_state_t ng_ue_state;
uint8_t ncc; // Next Hop Chaining Counter
......
......@@ -95,6 +95,7 @@ typedef enum {
HANDOVER_NOTIFY,
UPLINK_RAN_STATUS_TRANSFER,
PDU_SESSION_RESOURCE_SETUP_RESPONSE,
PAGING,
TIME_OUT,
HEALTH_PING,
TERMINATE,
......
......@@ -66,7 +66,11 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
public:
itti_n1n2_message_transfer_request(
const task_id_t origin, const task_id_t destination)
: itti_msg_amf_app(N1N2_MESSAGE_TRANSFER_REQ, origin, destination) {}
: itti_msg_amf_app(N1N2_MESSAGE_TRANSFER_REQ, origin, destination) {
is_n2sm_set = false;
is_n1sm_set = false;
is_ppi_set = false;
}
itti_n1n2_message_transfer_request(
const itti_n1n2_message_transfer_request& i)
: itti_msg_amf_app(i) {}
......@@ -78,6 +82,8 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
bool is_n1sm_set;
uint8_t pdu_session_id;
std::string n2sm_info_type;
bool is_ppi_set;
uint8_t ppi;
// other parameters
};
......
......@@ -34,6 +34,7 @@ class itti_msg_n1 : public itti_msg {
itti_msg_n1(const itti_msg_n1& i) : itti_msg(i) {
is_nas_signalling_estab_req = i.is_nas_signalling_estab_req;
ran_ue_ngap_id = i.ran_ue_ngap_id;
amf_ue_ngap_id = i.amf_ue_ngap_id;
}
public:
......
......@@ -94,7 +94,6 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
is_n2sm_set = i.is_n2sm_set;
n2sm_info_type = i.n2sm_info_type;
promise_id = i.promise_id;
;
}
public:
......@@ -106,6 +105,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
uint32_t promise_id;
std::string ho_state;
};
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
......@@ -114,8 +114,10 @@ class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_RELEASE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_update_sm_context& i)
: itti_msg_n11(i) {}
const itti_nsmf_pdusession_release_sm_context& i)
: itti_msg_n11(i) {
supi = i.supi;
}
public:
std::string supi;
......
......@@ -61,7 +61,9 @@ class itti_new_sctp_association : public itti_msg_n2 {
class itti_ng_setup_request : public itti_msg_n2 {
public:
itti_ng_setup_request(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(NG_SETUP_REQ, origin, destination) {}
: itti_msg_n2(NG_SETUP_REQ, origin, destination) {
ngSetupReq = nullptr;
}
itti_ng_setup_request(const itti_ng_setup_request& i) : itti_msg_n2(i) {}
public:
......@@ -71,7 +73,9 @@ class itti_ng_setup_request : public itti_msg_n2 {
class itti_ng_reset : public itti_msg_n2 {
public:
itti_ng_reset(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(NG_RESET, origin, destination) {}
: itti_msg_n2(NG_RESET, origin, destination) {
ngReset = nullptr;
}
itti_ng_reset(const itti_ng_reset& i) : itti_msg_n2(i) {}
public:
......@@ -88,7 +92,9 @@ class itti_ng_shutdown : public itti_msg_n2 {
class itti_initial_ue_message : public itti_msg_n2 {
public:
itti_initial_ue_message(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(INITIAL_UE_MSG, origin, destination) {}
: itti_msg_n2(INITIAL_UE_MSG, origin, destination) {
initUeMsg = nullptr;
}
itti_initial_ue_message(const itti_initial_ue_message& i) : itti_msg_n2(i) {}
InitialUEMessageMsg* initUeMsg;
......@@ -97,7 +103,9 @@ class itti_initial_ue_message : public itti_msg_n2 {
class itti_ul_nas_transport : public itti_msg_n2 {
public:
itti_ul_nas_transport(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(ITTI_UL_NAS_TRANSPORT, origin, destination) {}
: itti_msg_n2(ITTI_UL_NAS_TRANSPORT, origin, destination) {
ulNas = nullptr;
}
itti_ul_nas_transport(const itti_ul_nas_transport& i) : itti_msg_n2(i) {}
UplinkNASTransportMsg* ulNas;
......@@ -172,7 +180,9 @@ class itti_ue_context_release_request : public itti_msg_n2 {
public:
itti_ue_context_release_request(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UE_CONTEXT_RELEASE_REQUEST, origin, destination) {}
: itti_msg_n2(UE_CONTEXT_RELEASE_REQUEST, origin, destination) {
ueCtxRel = nullptr;
}
itti_ue_context_release_request(const itti_ue_context_release_request& i)
: itti_msg_n2(i) {}
UEContextReleaseRequestMsg* ueCtxRel;
......@@ -183,7 +193,7 @@ class itti_ue_context_release_command : public itti_msg_n2 {
itti_ue_context_release_command(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UE_CONTEXT_RELEASE_COMMAND, origin, destination) {}
itti_ue_context_release_command(const itti_dl_nas_transport& i)
itti_ue_context_release_command(const itti_ue_context_release_command& i)
: itti_msg_n2(i) {}
public:
......@@ -196,7 +206,9 @@ class itti_ue_context_release_complete : public itti_msg_n2 {
public:
itti_ue_context_release_complete(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UE_CONTEXT_RELEASE_COMPLETE, origin, destination) {}
: itti_msg_n2(UE_CONTEXT_RELEASE_COMPLETE, origin, destination) {
ueCtxRelCmpl = nullptr;
}
itti_ue_context_release_complete(const itti_ue_context_release_complete& i)
: itti_msg_n2(i) {}
UEContextReleaseCompleteMsg* ueCtxRelCmpl;
......@@ -206,7 +218,9 @@ class itti_ue_radio_capability_indication : public itti_msg_n2 {
public:
itti_ue_radio_capability_indication(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UE_RADIO_CAP_IND, origin, destination) {}
: itti_msg_n2(UE_RADIO_CAP_IND, origin, destination) {
ueRadioCap = nullptr;
}
itti_ue_radio_capability_indication(
const itti_ue_radio_capability_indication& i)
: itti_msg_n2(i) {}
......@@ -216,15 +230,30 @@ class itti_ue_radio_capability_indication : public itti_msg_n2 {
class itti_handover_required : public itti_msg_n2 {
public:
itti_handover_required(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {}
: itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {
handoverReq = nullptr;
}
itti_handover_required(const itti_handover_required& i) : itti_msg_n2(i) {}
HandoverRequiredMsg* handoverReq;
};
class itti_paging : public itti_msg_n2 {
public:
itti_paging(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(PAGING, origin, destination) {}
itti_paging(const itti_paging& i) : itti_msg_n2(i) {}
public:
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
};
class itti_handover_request_Ack : public itti_msg_n2 {
public:
itti_handover_request_Ack(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(HANDOVER_REQUEST_ACK, origin, destination) {}
: itti_msg_n2(HANDOVER_REQUEST_ACK, origin, destination) {
handoverrequestAck = nullptr;
}
itti_handover_request_Ack(const itti_handover_request_Ack& i)
: itti_msg_n2(i) {}
HandoverRequestAck* handoverrequestAck;
......@@ -233,7 +262,9 @@ class itti_handover_request_Ack : public itti_msg_n2 {
class itti_handover_notify : public itti_msg_n2 {
public:
itti_handover_notify(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(HANDOVER_NOTIFY, origin, destination) {}
: itti_msg_n2(HANDOVER_NOTIFY, origin, destination) {
handovernotify = nullptr;
}
itti_handover_notify(const itti_handover_notify& i) : itti_msg_n2(i) {}
HandoverNotifyMsg* handovernotify;
};
......@@ -242,7 +273,9 @@ class itti_uplink_ran_status_transfer : public itti_msg_n2 {
public:
itti_uplink_ran_status_transfer(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UPLINK_RAN_STATUS_TRANSFER, origin, destination) {}
: itti_msg_n2(UPLINK_RAN_STATUS_TRANSFER, origin, destination) {
uplinkrantransfer = nullptr;
}
itti_uplink_ran_status_transfer(const itti_uplink_ran_status_transfer& i)
: itti_msg_n2(i) {}
UplinkRANStatusTransfer* uplinkrantransfer;
......
......@@ -133,7 +133,7 @@ int _5GSMobilityIdentity::_5g_s_tmsi_encode2buffer(uint8_t* buf, int len) {
//------------------------------------------------------------------------------
int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) {
int decoded_size = 0;
_5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t));
if (!_5g_s_tmsi) _5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t));
decoded_size++; // type of identity
uint8_t octet = *(buf + decoded_size);
decoded_size++;
......
......@@ -36,6 +36,8 @@ UESecurityCapability::UESecurityCapability(uint8_t iei) {
_iei = iei;
_5g_EASel = 0;
_5g_IASel = 0;
EEASel = 0;
EIASel = 0;
length = 0;
}
......@@ -44,6 +46,8 @@ UESecurityCapability::UESecurityCapability() {
_iei = 0;
_5g_EASel = 0;
_5g_IASel = 0;
EEASel = 0;
EIASel = 0;
length = 0;
}
......
......@@ -243,7 +243,6 @@ asn_dec_rval_t NativeEnumerated_decode_aper(
}
ASN_DEBUG("Decoding %s as NativeEnumerated", td->name);
// printf("test0515 Decoding %s as NativeEnumerated\n", td->name);
if (ct->flags & APC_EXTENSIBLE) {
int inext = per_get_few_bits(pd, 1);
......
......@@ -321,7 +321,6 @@ asn_dec_rval_t NativeInteger_decode_aper(
(void) opt_codec_ctx;
ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name);
// printf("test0515 Decoding NativeInteger %s (APER)\n", td->name);
if (!native) {
native = (long*) (*sptr = CALLOC(1, sizeof(*native)));
......
......@@ -1033,8 +1033,6 @@ asn_dec_rval_t CHOICE_decode_aper(
if (value < 0) ASN__DECODE_STARVED;
ASN_DEBUG(
"CHOICE %s got index %d in range %d", td->name, value, ct->range_bits);
// printf("test0515 CHOICE %s got index %d in range %d\n", td->name, value,
// ct->range_bits);
if (value > ct->upper_bound) ASN__DECODE_FAILED;
} else {
if (specs->ext_start == -1) ASN__DECODE_FAILED;
......@@ -1059,7 +1057,6 @@ asn_dec_rval_t CHOICE_decode_aper(
memb_ptr2 = &memb_ptr;
}
ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name);
// printf("test0515 Discovered CHOICE %s encodes %s\n", td->name, elm->name);
if (ct && ct->range_bits >= 0) {
rv = elm->type->op->aper_decoder(
......@@ -1074,8 +1071,6 @@ asn_dec_rval_t CHOICE_decode_aper(
if (rv.code != RC_OK) {
ASN_DEBUG(
"Failed to decode %s in %s (CHOICE) %d", elm->name, td->name, rv.code);
// printf("test0515 Failed to decode %s in %s (CHOICE) %d\n", elm->name,
// td->name, rv.code);
}
return rv;
}
......
......@@ -1493,7 +1493,6 @@ asn_dec_rval_t SEQUENCE_decode_aper(
}
ASN_DEBUG("Decoding %s as SEQUENCE (APER)", td->name);
// printf("test0515 Decoding %s as SEQUENCE (APER)\n", td->name);
/* Handle extensions */
if (specs->first_extension < 0) {
......@@ -1566,9 +1565,6 @@ asn_dec_rval_t SEQUENCE_decode_aper(
ASN_DEBUG(
"Member %s->%s is optional, p=%d (%d->%d)", td->name, elm->name,
present, (int) opmd.nboff, (int) opmd.nbits);
// printf("test0515 Member %s->%s is optional, p=%d (%d->%d)\n",
// td->name, elm->name, present,
// (int)opmd.nboff, (int)opmd.nbits);
if (present == 0) {
/* This element is not present */
if (elm->default_value_set) {
......@@ -1587,7 +1583,6 @@ asn_dec_rval_t SEQUENCE_decode_aper(
/* Fetch the member from the stream */
ASN_DEBUG("Decoding member \"%s\" in %s", elm->name, td->name);
// printf("test0515 Decoding member \"%s\" in %s\n", elm->name, td->name);
if (elm->flags & ATF_OPEN_TYPE) {
rv = OPEN_TYPE_aper_get(opt_codec_ctx, td, st, elm, pd);
......
......@@ -406,7 +406,6 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN__STACK_OVERFLOW_CHECK(ctx);
ASN_DEBUG("Getting open type %s...", td->name);
// printf("test0515 Getting open type %s...\n", td->name);
do {
chunk_bytes = aper_get_length(pd, -1, -1, &repeat);
......@@ -433,8 +432,6 @@ static asn_dec_rval_t aper_open_type_get_simple(
ASN_DEBUG(
"Getting open type %s encoded in %ld bytes", td->name, (long) bufLen);
// printf("test0515 Getting open type %s encoded in %ld bytes\n", td->name,
//(long)bufLen);
memset(&spd, 0, sizeof(spd));
spd.buffer = buf;
......
......@@ -39,20 +39,20 @@ namespace ngap {
//------------------------------------------------------------------------------
AmfName::AmfName() {
amfname = NULL;
amfname = nullptr;
}
//------------------------------------------------------------------------------
AmfName::~AmfName() {
free(amfname);
amfname = NULL;
amfname = nullptr;
}
//------------------------------------------------------------------------------
void AmfName::setValue(const std::string m_amfName) {
if (amfname) {
free(amfname);
amfname = NULL;
amfname = nullptr;
}
amfname = (char*) calloc(1, m_amfName.size() + 1);
memcpy(amfname, m_amfName.c_str(), m_amfName.size());
......@@ -61,13 +61,14 @@ void AmfName::setValue(const std::string m_amfName) {
//------------------------------------------------------------------------------
void AmfName::getValue(std::string& m_amfName) {
m_amfName = amfname;
if (amfname) m_amfName = amfname;
}
//------------------------------------------------------------------------------
bool AmfName::encode2AmfName(Ngap_AMFName_t* amfNameIe) {
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
if (amfname)
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
return true;
}
......
......@@ -70,7 +70,6 @@ bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfsetid) {
//------------------------------------------------------------------------------
bool AMFSetID::decodefrombitstring(Ngap_AMFSetID_t& amfsetid) {
if (!amfsetid.buf) return false;
printf("test for amfsetid\n");
for (int i = 0; i < amfsetid.size; i++) {
printf("%x ", amfsetid.buf[i]);
}
......
......@@ -40,7 +40,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AllowedNSSAI::AllowedNSSAI() {
snssai = NULL;
snssai = nullptr;
numofSnssai = 0;
}
......@@ -66,7 +66,6 @@ bool AllowedNSSAI::getAllowedNSSAI(S_NSSAI*& m_snssai, int& m_numofsnssai) {
//------------------------------------------------------------------------------
bool AllowedNSSAI::encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList) {
cout << "AllowedNSSAI::numOfSnssai " << numofSnssai << endl;
for (int i = 0; i < numofSnssai; i++) {
Ngap_AllowedNSSAI_Item_t* allowednssaiitem =
(Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t));
......
......@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AssociatedQosFlowItem::AssociatedQosFlowItem() {
qosFlowIdentifier = NULL;
qosFlowIdentifier = nullptr;
qosFlowMappingIndication = -1;
}
......@@ -74,6 +74,8 @@ bool AssociatedQosFlowItem::encode2AssociatedQosFlowItem(
(long*) calloc(1, sizeof(long));
*associatedQosFlowItem->qosFlowMappingIndication = qosFlowMappingIndication;
}
if (!qosFlowIdentifier) return false;
if (!qosFlowIdentifier->encode2QosFlowIdentifier(
&associatedQosFlowItem->qosFlowIdentifier))
return false;
......
......@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AssociatedQosFlowList::AssociatedQosFlowList() {
associatedQosFlowItem = NULL;
associatedQosFlowItem = nullptr;
numofassociatedQosFlowItem = 0;
}
......@@ -65,6 +65,7 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList(
Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc(
1, sizeof(Ngap_AssociatedQosFlowItem_t));
if (!ie) return false;
if (!associatedQosFlowItem) return false;
if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie))
return false;
if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) return false;
......
......@@ -43,8 +43,8 @@ namespace ngap {
//------------------------------------------------------------------------------
BroadcastPLMNItem::BroadcastPLMNItem() {
plmn = NULL;
snssai = NULL;
plmn = nullptr;
snssai = nullptr;
numOfSnssai = 0;
}
......@@ -70,8 +70,9 @@ void BroadcastPLMNItem::getPlmnSliceSupportList(
//------------------------------------------------------------------------------
bool BroadcastPLMNItem::encode2BroadcastPLMNItem(
Ngap_BroadcastPLMNItem_t* plmnItem) {
if (!plmn) return false;
if (!snssai) return false;
if (!plmn->encode2octetstring(plmnItem->pLMNIdentity)) return false;
cout << "BroadcastPLMNItem::numOfSnssai " << numOfSnssai << endl;
for (int i = 0; i < numOfSnssai; i++) {
Ngap_SliceSupportItem_t* slice =
(Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t));
......@@ -89,7 +90,7 @@ bool BroadcastPLMNItem::decodefromBroadcastPLMNItem(
if (plmn == nullptr) plmn = new PlmnId();
if (!plmn->decodefromoctetstring(pdu->pLMNIdentity)) return false;
numOfSnssai = pdu->tAISliceSupportList.list.count;
snssai = new S_NSSAI[numOfSnssai]();
if (snssai == nullptr) snssai = new S_NSSAI[numOfSnssai]();
for (int i = 0; i < numOfSnssai; i++) {
if (!snssai[i].decodefromS_NSSAI(
&pdu->tAISliceSupportList.list.array[i]->s_NSSAI))
......
......@@ -43,16 +43,12 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t* countvalue) {
countvalue->pDCP_SN18 = pdcp;
countvalue->hFN_PDCP_SN18 = hfn_pdcp;
cout << "the encode pdcp_sn18 is" << countvalue->pDCP_SN18 << endl;
cout << "the encode hfn_pdcp_sn18 is" << countvalue->hFN_PDCP_SN18 << endl;
return true;
}
bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t& countValue) {
pdcp = countValue.pDCP_SN18;
hfn_pdcp = countValue.hFN_PDCP_SN18;
cout << "the decode pdcp_sn18 is" << countValue.pDCP_SN18 << endl;
cout << "the decode hfn_pdcp_sn18 is" << countValue.hFN_PDCP_SN18 << endl;
return true;
}
} // namespace ngap
......@@ -78,12 +78,15 @@ void CoreNetworkAssistanceInfo::setCoreNetworkAssistanceInfo(
//------------------------------------------------------------------------------
bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) {
if (!ueIdentityIndexValue) return false;
if (!ueIdentityIndexValue->encode2UEIdentityIndexValue(
&coreNetworkAssistanceInformation->uEIdentityIndexValue))
return false;
if (!periodicRegUpdateTimer) return false;
if (!periodicRegUpdateTimer->encode2PeriodicRegistrationUpdateTimer(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false;
if (!tai) return false;
for (int i = 0; i < numoftai; i++) {
Ngap_TAIListForInactiveItem_t* taiListForInactiveItem =
(Ngap_TAIListForInactiveItem_t*) calloc(
......@@ -129,7 +132,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false;
numoftai = coreNetworkAssistanceInformation->tAIListForInactive.list.count;
tai = new TAI[numoftai]();
if (tai == nullptr) tai = new TAI[numoftai]();
for (int i = 0; i < numoftai; i++) {
if (!tai[i].decodefromTAI(
&coreNetworkAssistanceInformation->tAIListForInactive.list.array[i]
......@@ -137,13 +140,13 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
return false;
}
if (coreNetworkAssistanceInformation->uESpecificDRX) {
pagingDRX = new DefaultPagingDRX();
if (pagingDRX == nullptr) pagingDRX = new DefaultPagingDRX();
if (!pagingDRX->decodefromDefaultPagingDRX(
*(coreNetworkAssistanceInformation->uESpecificDRX)))
return false;
}
if (coreNetworkAssistanceInformation->mICOModeIndication) {
micoModeInd = new MICOModeIndication();
if (micoModeInd == nullptr) micoModeInd = new MICOModeIndication();
if (!micoModeInd->decodefromMICOModeIndication(
coreNetworkAssistanceInformation->mICOModeIndication))
return false;
......
......@@ -101,6 +101,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
ie->value.choice.CriticalityDiagnostics.procedureCriticality =
procedureCriticalityIE;
}
if (numberOfIEsCriticalityDiagnostics) {
Ngap_CriticalityDiagnostics_IE_List_t* ieList =
(Ngap_CriticalityDiagnostics_IE_List_t*) calloc(
......@@ -109,8 +110,10 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
Ngap_CriticalityDiagnostics_IE_Item_t* ieItem =
(Ngap_CriticalityDiagnostics_IE_Item_t*) calloc(
1, sizeof(Ngap_CriticalityDiagnostics_IE_Item_t));
iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
if (iEsCriticalityDiagnostics) {
iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
}
}
ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics = ieList;
}
......
......@@ -35,8 +35,8 @@ namespace ngap {
//------------------------------------------------------------------------------
DLQoSFlowPerTNLInformation::DLQoSFlowPerTNLInformation() {
uPTransportLayerInformation = NULL;
associatedQosFlowList = NULL;
uPTransportLayerInformation = nullptr;
associatedQosFlowList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -63,9 +63,11 @@ bool DLQoSFlowPerTNLInformation::getDLQoSFlowPerTNLInformation(
//------------------------------------------------------------------------------
bool DLQoSFlowPerTNLInformation::encode2DLQoSFlowPerTNLInformation(
Ngap_QosFlowPerTNLInformation_t* qosFlowPerTNLInformation) {
if (!uPTransportLayerInformation) return false;
if (!uPTransportLayerInformation->encode2UpTransportLayerInformation(
qosFlowPerTNLInformation->uPTransportLayerInformation))
return false;
if (!associatedQosFlowList) return false;
if (!associatedQosFlowList->encode2AssociatedQosFlowList(
qosFlowPerTNLInformation->associatedQosFlowList))
return false;
......
......@@ -39,20 +39,6 @@ DataForwardingNotPossible::DataForwardingNotPossible() {}
//------------------------------------------------------------------------------
DataForwardingNotPossible::~DataForwardingNotPossible() {}
//------------------------------------------------------------------------------
#if 0
void DataForwardingNotPossible::setDataForwardingNotPossible(const uint32_t m_gtp_teid)
{
gtp_teid = m_gtp_teid;
}
bool DataForwardingNotPossible::getDataForwardingNotPossible(uint32_t &m_gtp_teid)
{
m_gtp_teid = gtp_teid;
return true;
}
#endif
//------------------------------------------------------------------------------
bool DataForwardingNotPossible::encode2DataForwardingNotPossible(
Ngap_DataForwardingNotPossible_t& dataForwardingNotPossible) {
......
......@@ -46,6 +46,7 @@ bool FiveGSTmsi::decodefrompdu(Ngap_FiveG_S_TMSI_t pdu) {
amfSetid.getAMFSetID(setId);
amfPointer.getAMFPointer(pointer);
_5g_s_tmsi = setId + pointer + std::to_string(tmsi);
tmsi_value = std::to_string(tmsi);
return true;
}
......@@ -53,3 +54,33 @@ bool FiveGSTmsi::decodefrompdu(Ngap_FiveG_S_TMSI_t pdu) {
void FiveGSTmsi::getValue(std::string& tmsi) {
tmsi = _5g_s_tmsi;
}
//------------------------------------------------------------------------------
void FiveGSTmsi::getValue(
std::string& setid, std::string& pointer, std::string& tmsi) {
amfSetid.getAMFSetID(setid);
amfPointer.getAMFPointer(pointer);
tmsi = tmsi_value;
}
//------------------------------------------------------------------------------
void FiveGSTmsi::setValue(
std::string& setid, std::string& pointer, std::string& tmsi) {
amfSetid.setAMFSetID(setid);
amfPointer.setAMFPointer(pointer);
_5g_s_tmsi = tmsi;
}
//------------------------------------------------------------------------------
bool FiveGSTmsi::encode2pdu(Ngap_FiveG_S_TMSI_t* pdu) {
amfSetid.encode2bitstring(pdu->aMFSetID);
amfPointer.encode2bitstring(pdu->aMFPointer);
uint32_t tmsi = (uint32_t) std::stol(_5g_s_tmsi);
uint8_t* buf = (uint8_t*) malloc(sizeof(uint32_t));
*(uint32_t*) buf = htonl(tmsi);
pdu->fiveG_TMSI.buf = buf;
pdu->fiveG_TMSI.size = sizeof(uint32_t);
return true;
}
......@@ -47,9 +47,13 @@ class FiveGSTmsi {
public:
bool decodefrompdu(Ngap_FiveG_S_TMSI_t pdu);
void getValue(std::string& value);
void getValue(std::string& setid, std::string& pointer, std::string& tmsi);
void setValue(std::string& setid, std::string& pointer, std::string& tmsi);
bool encode2pdu(Ngap_FiveG_S_TMSI_t* pdu);
private:
std::string _5g_s_tmsi;
std::string tmsi_value;
AMFSetID amfSetid;
AMFPointer amfPointer;
......
......@@ -68,7 +68,7 @@ bool GlobalgNBId::decodefromGlobalgNBId(Ngap_GlobalGNB_ID_t* globalgnbid) {
//------------------------------------------------------------------------------
void GlobalgNBId::getGlobalgNBId(PlmnId*& plmn, GNB_ID*& gnbid) {
plmn = plmnId;
gnbid = gNB_ID;
if (plmnId) plmn = plmnId;
if (gNB_ID) gnbid = gNB_ID;
}
} // namespace ngap
......@@ -65,7 +65,6 @@ bool PDUSessionResourceHandoverRequestAckTransfer::
// return false;
}
cout << "rc.consumed to decode = " << rc.consumed << endl;
cout << endl;
dLForwardingUP_TNLInformation = new UpTransportLayerInformation();
if (!dLForwardingUP_TNLInformation->decodefromUpTransportLayerInformation(
*handoverRequestAcknowledegTransferIEs
......
......@@ -94,7 +94,7 @@ bool PDUSessionResourceHandoverRequiredTransfer::decodefromIE(
bool PDUSessionResourceHandoverRequiredTransfer::
getDirectForwardingPathAvailability(
long* directForwardingPathAvailability) {
directForwardingPathAvailability = (long*) DirectForwardingPathAvailability;
*directForwardingPathAvailability = (long) *DirectForwardingPathAvailability;
return true;
}
......
......@@ -67,8 +67,10 @@ bool PDUSessionResourceListHORqd::decodefromPDUSessionResourceListHORqd(
}
void PDUSessionResourceListHORqd::getPDUSessionResourceListHORqd(
PDUSessionResourceItemHORqd*& m_pduSessionResourceItemHORqd, int& num) {
m_pduSessionResourceItemHORqd = pduSessionResourceItemHORqd;
num = numofpduSessionResourceItemHORqd;
if (pduSessionResourceItemHORqd) {
m_pduSessionResourceItemHORqd = pduSessionResourceItemHORqd;
num = numofpduSessionResourceItemHORqd;
}
}
} // namespace ngap
......@@ -34,7 +34,9 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
PacketLossRate::PacketLossRate() {}
PacketLossRate::PacketLossRate() {
packetlossrate = 0;
}
//------------------------------------------------------------------------------
PacketLossRate::~PacketLossRate() {}
......
......@@ -38,10 +38,7 @@ QosFlowItemWithDataForWarding::QosFlowItemWithDataForWarding() {
QosFlowItemWithDataForWarding::~QosFlowItemWithDataForWarding() {}
void QosFlowItemWithDataForWarding::getQosFlowItemWithDataForWarding(
Ngap_QosFlowIdentifier_t& m_QosFlowIdentifier) {
if (!qosFlowIdentifier)
printf("qosFlowIdentifier null\n");
else
printf("qosFlowIdentifier \n");
if (!qosFlowIdentifier) return;
if (qosFlowIdentifier->getQosFlowIdentifier(value)) {
m_QosFlowIdentifier = (Ngap_QosFlowIdentifier_t) value;
}
......@@ -51,10 +48,8 @@ bool QosFlowItemWithDataForWarding::decodeformQosFlowItemWithDataForWarding(
if (qosFlowIdentifier == nullptr) qosFlowIdentifier = new QosFlowIdentifier();
if (!qosFlowIdentifier->decodefromQosFlowIdentifier(
&(qosFlowItemWithDataForWarding->qosFlowIdentifier))) {
printf("false\n");
return false;
}
printf("true\n");
return true;
}
} // namespace ngap
......@@ -89,9 +89,11 @@ bool SecurityIndication::encode2SecurityIndication(
//------------------------------------------------------------------------------
bool SecurityIndication::decodefromSecurityIndication(
Ngap_SecurityIndication_t* securityIndication) {
integrityProtectionIndication = new IntegrityProtectionIndication();
confidentialityProtectionIndication =
new ConfidentialityProtectionIndication();
if (!integrityProtectionIndication)
integrityProtectionIndication = new IntegrityProtectionIndication();
if (!confidentialityProtectionIndication)
confidentialityProtectionIndication =
new ConfidentialityProtectionIndication();
if (!integrityProtectionIndication->decodefromIntegrityProtectionIndication(
securityIndication->integrityProtectionIndication))
......
......@@ -70,7 +70,7 @@ bool ServedGUAMIItem::encode2ServedGUAMIItem(
//------------------------------------------------------------------------------
bool ServedGUAMIItem::decodefromServedGUAMIItem(Ngap_ServedGUAMIItem* pdu) {
guamiGroup = new GUAMI();
if (!guamiGroup) guamiGroup = new GUAMI();
if (!guamiGroup->decodefromGUAMI(&pdu->gUAMI)) return false;
if (pdu->backupAMFName) {
backupAMFNameIsSet = true;
......
......@@ -35,8 +35,8 @@ namespace ngap {
//------------------------------------------------------------------------------
TAI::TAI() {
plmnId = NULL;
tac = NULL;
plmnId = nullptr;
tac = nullptr;
}
//------------------------------------------------------------------------------
......@@ -68,7 +68,7 @@ bool TAI::decodefromTAI(Ngap_TAI_t* tai) {
//------------------------------------------------------------------------------
void TAI::getTAI(PlmnId*& m_plmnId, TAC*& m_tac) {
m_plmnId = plmnId;
m_tac = tac;
if (plmnId) m_plmnId = plmnId;
if (tac) m_tac = tac;
}
} // namespace ngap
/*
* 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 "TAIListforPaging.hpp"
extern "C" {
#include "Ngap_TAIListForPagingItem.h"
}
#include <iostream>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
TAIListForPaging::TAIListForPaging() {
tai = nullptr;
numOftai = 0;
}
//------------------------------------------------------------------------------
TAIListForPaging::~TAIListForPaging() {
if (!tai) delete[] tai;
}
//------------------------------------------------------------------------------
bool TAIListForPaging::encode2TAIListForPaging(Ngap_TAIListForPaging_t* pdu) {
for (int i = 0; i < numOftai; i++) {
Ngap_TAIListForPagingItem_t* ta = (Ngap_TAIListForPagingItem_t*) calloc(
1, sizeof(Ngap_TAIListForPagingItem_t));
if (!tai[i].encode2TAI(&ta->tAI)) return false;
if (ASN_SEQUENCE_ADD(&pdu->list, ta) != 0) return false;
}
return true;
}
//------------------------------------------------------------------------------
bool TAIListForPaging::decodefromTAIListForPaging(
Ngap_TAIListForPaging_t* pdu) {
numOftai = pdu->list.count;
if (numOftai < 0) return false;
tai = new TAI[numOftai];
for (int i = 0; i < numOftai; i++) {
if (!tai[i].decodefromTAI(&pdu->list.array[i]->tAI)) return false;
}
return true;
}
//------------------------------------------------------------------------------
void TAIListForPaging::setTAIListForPaging(TAI* m_tai, int numOfItem) {
tai = m_tai;
numOftai = numOfItem;
}
//------------------------------------------------------------------------------
void TAIListForPaging::getTAIListForPaging(TAI*& m_tai, int& numOfItem) {
m_tai = tai;
numOfItem = numOftai;
}
} // namespace ngap
/*
* 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 gNB_context.cpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "gNB_context.hpp"
/*
* 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 _TAILISTFORPAGING_H_
#define _TAILISTFORPAGING_H_
#include "TAI.hpp"
extern "C" {
#include "Ngap_TAIListForPaging.h"
}
namespace ngap {
class TAIListForPaging {
public:
TAIListForPaging();
virtual ~TAIListForPaging();
void setTAIListForPaging(TAI* m_tai, int numOfItem);
void getTAIListForPaging(TAI*& m_tai, int& numOfItem);
bool encode2TAIListForPaging(Ngap_TAIListForPaging_t* pdu);
bool decodefromTAIListForPaging(Ngap_TAIListForPaging_t* pdu);
private:
TAI* tai;
int numOftai;
};
} // namespace ngap
#endif
......@@ -105,7 +105,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
//------------------------------------------------------------------------------
bool UEAssociationLogicalNGConnectionItem::decode(
Ngap_UE_associatedLogicalNG_connectionItem_t* item) {
amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(*item->aMF_UE_NGAP_ID)) {
cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << endl;
return false;
......
/*
* 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 "UEPagingIdentity.hpp"
namespace ngap {
//------------------------------------------------------------------------------
UEPagingIdentity::UEPagingIdentity() {}
//------------------------------------------------------------------------------
UEPagingIdentity::~UEPagingIdentity() {}
//------------------------------------------------------------------------------
void UEPagingIdentity::setUEPagingIdentity(
std::string& setid, std::string& pointer, std::string& tmsi) {
fiveGSTmsi.setValue(setid, pointer, tmsi);
}
//------------------------------------------------------------------------------
void UEPagingIdentity::getUEPagingIdentity(std::string& _5g_s_tmsi) {
fiveGSTmsi.getValue(_5g_s_tmsi);
}
//------------------------------------------------------------------------------
void UEPagingIdentity::getUEPagingIdentity(
std::string& setid, std::string& pointer, std::string& tmsi) {
fiveGSTmsi.getValue(setid, pointer, tmsi);
}
//------------------------------------------------------------------------------
bool UEPagingIdentity::encode2pdu(Ngap_UEPagingIdentity_t* pdu) {
pdu->present = Ngap_UEPagingIdentity_PR_fiveG_S_TMSI;
Ngap_FiveG_S_TMSI_t* ie =
(Ngap_FiveG_S_TMSI_t*) calloc(1, sizeof(Ngap_FiveG_S_TMSI_t));
pdu->choice.fiveG_S_TMSI = ie;
if (!fiveGSTmsi.encode2pdu(pdu->choice.fiveG_S_TMSI)) return false;
return true;
}
//------------------------------------------------------------------------------
bool UEPagingIdentity::decodefrompdu(Ngap_UEPagingIdentity_t pdu) {
if (pdu.present != Ngap_UEPagingIdentity_PR_fiveG_S_TMSI) return false;
if (!fiveGSTmsi.decodefrompdu(*pdu.choice.fiveG_S_TMSI)) return false;
return true;
}
} // namespace ngap
/*
* 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 _UEPAGINGIDENTITY_H_
#define _UEPAGINGIDENTITY_H_
#include "FiveGSTmsi.hpp"
extern "C" {
#include "Ngap_UEPagingIdentity.h"
}
namespace ngap {
class UEPagingIdentity {
public:
UEPagingIdentity();
virtual ~UEPagingIdentity();
void setUEPagingIdentity(
std::string& setid, std::string& pointer, std::string& tmsi);
void getUEPagingIdentity(std::string& _5g_s_tmsi);
void getUEPagingIdentity(
std::string& setid, std::string& pointer, std::string& tmsi);
bool encode2pdu(Ngap_UEPagingIdentity_t* pdu);
bool decodefrompdu(Ngap_UEPagingIdentity_t pdu);
private:
FiveGSTmsi fiveGSTmsi;
};
} // namespace ngap
#endif
......@@ -20,64 +20,69 @@
*/
#include "dRBsSubjectToStatusTransferItem.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
using namespace std;
namespace ngap {
dRBSubjectItem::dRBSubjectItem() {
drb_id = NULL;
drb_ul = NULL;
drb_dl = NULL;
drb_id = nullptr;
drb_ul = nullptr;
drb_dl = nullptr;
}
dRBSubjectItem::~dRBSubjectItem() {}
void dRBSubjectItem::setdRBSubjectItem(
Ngap_DRB_ID_t* dRB_ID, dRBStatusUL* dRB_UL, dRBStatusDL* dRB_DL) {
drb_id = dRB_ID;
drb_ul = dRB_UL;
drb_dl = dRB_DL;
}
void dRBSubjectItem::getdRBSubjectItem(
Ngap_DRB_ID_t*& dRB_ID, dRBStatusUL*& dRB_UL, dRBStatusDL*& dRB_DL) {
dRB_ID = drb_id;
dRB_UL = drb_ul;
dRB_DL = drb_dl;
}
bool dRBSubjectItem::decodefromdRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (dRB_item->dRB_ID) {
drb_id = &dRB_item->dRB_ID;
cout << "the decode drb_id is" << *drb_id << endl;
}
drb_ul = new dRBStatusUL();
if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "decode from dRBSubjectItem dRBStatusUL error" << endl;
return false;
}
drb_dl = new dRBStatusDL();
if (!drb_dl->decodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "decode from dRBSubjectItem dRBStatusDL error" << endl;
return false;
}
cout << "decode from dRBSubjectItem successfully" << endl;
return true;
}
bool dRBSubjectItem::encodedRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (drb_id) {
dRB_item->dRB_ID = *drb_id;
cout << "the encode drb_id is" << *drb_id << endl;
}
if (!drb_ul) return false;
if (!drb_ul->encodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "encode from dRBSubjectItem dRBStatusUL error" << endl;
return false;
}
if (!drb_dl) return false;
if (!drb_dl->encodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "encode from dRBSubjectItem dRBStatusDL error" << endl;
return false;
}
cout << "encode from dRBSubjectItem successfully" << endl;
Logger::ngap().debug("Encode from dRBSubjectItem successfully");
return true;
}
} // namespace ngap
......@@ -24,9 +24,14 @@
#include <iostream>
#include <vector>
using namespace std;
extern "C" {
#include "dynamic_memory_check.h"
}
namespace ngap {
dRBSubjectList::dRBSubjectList() {
drbsubjectitem = NULL;
drbsubjectitem = nullptr;
numofitem = 0;
}
dRBSubjectList::~dRBSubjectList() {}
......@@ -45,6 +50,11 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
(Ngap_DRBsSubjectToStatusTransferItem_t*) calloc(
1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t));
if (!ie) return false;
if (!drbsubjectitem) {
free_wrapper((void**) &ie);
return false;
}
if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) {
cout << "encodefromdRBSubjectlist error" << endl;
return false;
......
......@@ -45,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------
DownLinkNasTransportMsg::DownLinkNasTransportMsg() {
downLinkNasTransportPdu = NULL;
downLinkNasTransportIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
oldAmfName = NULL;
ranPagingPriority = NULL;
nasPdu = NULL;
indexToRFSP = NULL;
downLinkNasTransportPdu = nullptr;
downLinkNasTransportIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
oldAmfName = nullptr;
ranPagingPriority = nullptr;
nasPdu = nullptr;
indexToRFSP = nullptr;
}
//------------------------------------------------------------------------------
......@@ -241,7 +241,7 @@ int DownLinkNasTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, downLinkNasTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, downLinkNasTransportPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......
......@@ -20,6 +20,7 @@
*/
#include "DownlinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
......@@ -31,6 +32,7 @@ extern "C" {
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -39,8 +41,10 @@ DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
DownlinkranstatustransferPDU = nullptr;
}
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -55,16 +59,18 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(id);
......@@ -79,16 +85,17 @@ void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
long drb_id, long ul_pcdp, long ul_hfn_pdcp, long dl_pcdp,
long dl_hfn_pdcp) {
......@@ -97,7 +104,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
new RANStatusTransferTransparentContainer();
}
Ngap_DRB_ID_t* dRB_id = (Ngap_DRB_ID_t*) calloc(1, sizeof(Ngap_DRB_ID_t));
dRB_id = &drb_id;
*dRB_id = drb_id;
COUNTValueForPDCP_SN18* UL_value =
(COUNTValueForPDCP_SN18*) calloc(1, sizeof(COUNTValueForPDCP_SN18));
UL_value->setvalue(ul_pcdp, ul_hfn_pdcp);
......@@ -128,7 +135,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
->encoderanstatustransfer_transparentcontainer(
&ie->value.choice.RANStatusTransfer_TransparentContainer);
if (!ret) {
cout << "encode ranstatustransfer_transparentcontainer error" << endl;
Logger::ngap().error(
"Encode RANStatusTransfer_TransparentContainer IE error");
// free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value);
free_wrapper((void**) &DL_value);
......@@ -142,7 +150,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
}
if (ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie) !=
0) {
cout << "encode ranstatustransfer_transparentcontainer error 2" << endl;
Logger::ngap().error(
"Encode ranstatustransfer_transparentcontainer IE error");
}
/* free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value);
......@@ -157,6 +166,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
*/
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setmessagetype() {
if (!DownlinkranstatustransferPDU) {
DownlinkranstatustransferPDU =
......@@ -180,18 +190,18 @@ void DownlinkRANStatusTransfer::setmessagetype() {
&(DownlinkranstatustransferPDU->choice.initiatingMessage->value.choice
.DownlinkRANStatusTransfer);
} else {
cout << "[warning] This information doesn't refer to "
"downlinkranstatustransfer Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to DownlinkRANStatusTransfer Message");
}
}
//------------------------------------------------------------------------------
int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, DownlinkranstatustransferPDU, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
} // namespace ngap
......@@ -40,6 +40,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverCommandMsg::HandoverCommandMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -52,8 +53,11 @@ HandoverCommandMsg::HandoverCommandMsg() {
handoverCommandPdu = nullptr;
handoverCommandIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverCommandMsg::~HandoverCommandMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverCommandMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -61,6 +65,7 @@ unsigned long HandoverCommandMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverCommandMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -68,6 +73,7 @@ uint32_t HandoverCommandMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverCommandPdu = ngap_msg_pdu;
......@@ -83,11 +89,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs = &handoverCommandPdu->choice.successfulOutcome->value
.choice.HandoverCommand;
} else {
Logger::ngap().error("Check HandoverCommand message error");
Logger::ngap().error("Check Handover Command message error");
return false;
}
} else {
Logger::ngap().error("HandoverRequired MessageType error");
Logger::ngap().error("Handover Command MessageType error");
return false;
}
for (int i = 0; i < handoverCommandIEs->protocolIEs.list.count; i++) {
......@@ -101,11 +107,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -118,11 +124,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -135,7 +141,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*ngap_handovertype = handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.HandoverType;
} else {
Logger::ngap().error("Decoded ngap Handover Type IE error");
Logger::ngap().error("Decoded NGAP Handover Type IE error");
return false;
}
} break;
......@@ -146,7 +152,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList) {
} else {
Logger::ngap().error(
"Decoded ngap PDUSessionResourceHandoverList IE error");
"Decoded NGAP PDUSessionResourceHandoverList IE error");
return false;
}
} break;
......@@ -157,7 +163,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd) {
} else {
Logger::ngap().error(
"Decoded ngap PDUSessionResourceToReleaseListHOCmd IE error");
"Decoded NGAP PDUSessionResourceToReleaseListHOCmd IE error");
return false;
}
} break;
......@@ -168,7 +174,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer) {
} else {
Logger::ngap().error(
"Decoded ngap TargetToSource_TransparentContainer IE error");
"Decoded NGAP TargetToSource_TransparentContainer IE error");
return false;
}
} break;
......@@ -178,7 +184,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_CriticalityDiagnostics) {
} else {
Logger::ngap().error("Decoded ngap CriticalityDiagnostics IE error");
Logger::ngap().error("Decoded NGAP CriticalityDiagnostics IE error");
return false;
}
} break;
......@@ -192,14 +198,17 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverCommandPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverCommandPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug(
"Encode Handover Command to buffer, er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setMessageType() {
if (!handoverCommandPdu)
handoverCommandPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
......@@ -222,10 +231,11 @@ void HandoverCommandMsg::setMessageType() {
.choice.HandoverCommand);
} else {
Logger::ngap().warn(
"This information doesn't refer to HandoverCommand message");
"This information doesn't refer to Handover Command message");
}
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -248,6 +258,7 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
......@@ -271,6 +282,7 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setHandoverType(long type) {
if (!ngap_handovertype) ngap_handovertype = new Ngap_HandoverType_t();
Ngap_HandoverCommandIEs_t* ie =
......@@ -285,6 +297,7 @@ void HandoverCommandMsg::setHandoverType(long type) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setPduSessionResourceHandoverList(
std::vector<PDUSessionResourceHandoverItem_t> list) {
if (!PDUSessionResourceHandoverList)
......@@ -320,6 +333,7 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setTargetToSource_TransparentContainer(
OCTET_STRING_t targetTosource) {
if (!TargetToSource_TransparentContainer)
......
......@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
/*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID);
......@@ -73,7 +73,6 @@ class HandoverCommandMsg {
private:
Ngap_NGAP_PDU_t* handoverCommandPdu;
Ngap_HandoverCommand_t* handoverCommandIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* ngap_handovertype;
......
......@@ -42,6 +42,8 @@ extern "C" {
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverNotifyMsg::HandoverNotifyMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -50,7 +52,16 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
handoverNotifyIEs = nullptr;
}
HandoverNotifyMsg::~HandoverNotifyMsg(){};
//------------------------------------------------------------------------------
HandoverNotifyMsg::~HandoverNotifyMsg() {
if (amfUeNgapId) delete (amfUeNgapId);
if (ranUeNgapId) delete (ranUeNgapId);
if (userLocationInformation) delete (userLocationInformation);
if (handoverNotifyPdu) free(handoverNotifyPdu);
if (handoverNotifyIEs) free(handoverNotifyIEs);
};
//------------------------------------------------------------------------------
unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -58,14 +69,17 @@ unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverNotifyPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug(
"Encode Handover Notify to buffer, er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverNotifyPdu = ngap_msg_pdu;
......@@ -99,11 +113,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -116,29 +130,33 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_UserLocationInformation: {
if (handoverNotifyIEs->protocolIEs.list.array[i]->criticality ==
Ngap_Criticality_ignore &&
handoverNotifyIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) {
// TODO: Temporarily disable Criticality check to be tested with dsTest
/*if (handoverNotifyIEs->protocolIEs.list.array[i]->criticality ==
Ngap_Criticality_ignore &&
handoverNotifyIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) {
*/
if (handoverNotifyIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) {
userLocationInformation = new UserLocationInformation();
if (!userLocationInformation->decodefromUserLocationInformation(
&handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) {
Logger::ngap().error(
"Decoded ngap UserLocationInformation IE error");
"Decoded NGAP UserLocationInformation IE error");
return false;
}
} else {
Logger::ngap().error("Decoded ngap UserLocationInformation IE error");
Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false;
}
} break;
......@@ -150,13 +168,13 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
}
return true;
}
//------------------------------------------------------------------------------
void HandoverNotifyMsg::setUserLocationInfoNR(
struct NrCgi_s cig, struct Tai_s tai) {
if (!userLocationInformation)
userLocationInformation = new UserLocationInformation();
// userLocationInformation->setInformation(UserLocationInformationEUTRA *
// informationEUTRA);
UserLocationInformationNR* informationNR = new UserLocationInformationNR();
NR_CGI* nR_CGI = new NR_CGI();
PlmnId* plmnId_cgi = new PlmnId();
......@@ -194,6 +212,7 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
uint32_t HandoverNotifyMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -201,28 +220,37 @@ uint32_t HandoverNotifyMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) {
if (!userLocationInformation) return false;
UserLocationInformationNR* informationNR;
UserLocationInformationNR* informationNR = nullptr;
userLocationInformation->getInformation(informationNR);
if (!informationNR) return false;
if (userLocationInformation->getChoiceOfUserLocationInformation() !=
Ngap_UserLocationInformation_PR_userLocationInformationNR)
return false;
NR_CGI* nR_CGI;
TAI* nR_TAI;
NR_CGI* nR_CGI = nullptr;
TAI* nR_TAI = nullptr;
informationNR->getInformationNR(nR_CGI, nR_TAI);
PlmnId* cgi_plmnId;
NRCellIdentity* nRCellIdentity;
if (!nR_CGI or !nR_TAI) return false;
PlmnId* cgi_plmnId = nullptr;
NRCellIdentity* nRCellIdentity = nullptr;
nR_CGI->getNR_CGI(cgi_plmnId, nRCellIdentity);
if (!cgi_plmnId or !nRCellIdentity) return false;
cgi_plmnId->getMcc(cig.mcc);
cgi_plmnId->getMnc(cig.mnc);
cig.nrCellID = nRCellIdentity->getNRCellIdentity();
PlmnId* tai_plmnId;
TAC* tac;
PlmnId* tai_plmnId = nullptr;
TAC* tac = nullptr;
nR_TAI->getTAI(tai_plmnId, tac);
if (!tai_plmnId or !tac) return false;
tai_plmnId->getMcc(tai.mcc);
tai_plmnId->getMnc(tai.mnc);
tai.tac = tac->getTac();
......
......@@ -39,16 +39,20 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverPreparationFailure::HandoverPreparationFailure() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
cause = nullptr;
hoPreparationFailureIEs = nullptr;
hoPreparationFailurePdu = nullptr;
CriticalityDiagnostics = nullptr;
}
//------------------------------------------------------------------------------
HandoverPreparationFailure::~HandoverPreparationFailure() {}
//------------------------------------------------------------------------------
unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -56,6 +60,7 @@ unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -63,6 +68,7 @@ uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
hoPreparationFailurePdu = ngap_msg_pdu;
......@@ -162,14 +168,18 @@ bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverPreparationFailure::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, hoPreparationFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, hoPreparationFailurePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug(
"Encode Handover Preparation Failure to buffer, er.encoded( %d )",
er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setMessageType() {
if (!hoPreparationFailurePdu)
hoPreparationFailurePdu =
......@@ -198,6 +208,7 @@ void HandoverPreparationFailure::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -222,6 +233,7 @@ void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
......@@ -247,10 +259,11 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setCause(
Ngap_Cause_PR m_causePresent, long value) //
{
if (!cause) cause = new Cause;
if (!cause) cause = new Cause();
Ngap_HandoverPreparationFailureIEs_t* ie =
(Ngap_HandoverPreparationFailureIEs_t*) calloc(
1, sizeof(Ngap_HandoverPreparationFailureIEs_t));
......@@ -266,6 +279,7 @@ void HandoverPreparationFailure::setCause(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverPreparationFailure::getChoiceOfCause() const {
if (cause)
return cause->getChoiceOfCause();
......
......@@ -39,6 +39,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequest::HandoverRequest() {
amfUeNgapId = nullptr;
handovertype = nullptr;
......@@ -54,8 +55,11 @@ HandoverRequest::HandoverRequest() {
handoverRequestPdu = nullptr;
handoverRequestIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequest::~HandoverRequest() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequest::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -63,6 +67,7 @@ unsigned long HandoverRequest::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
/*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu)
{
handoverCommandPdu = ngap_msg_pdu;
......@@ -219,14 +224,17 @@ error" << endl; return false;
return true;
}*/
//------------------------------------------------------------------------------
int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug(
"Encode Handover Request to buffer, er.encoded( %d)", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
void HandoverRequest::setMessageType() {
if (!handoverRequestPdu)
handoverRequestPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
......@@ -253,6 +261,7 @@ void HandoverRequest::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverRequest::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -276,6 +285,7 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setHandoverType(long type) // 0--intra5gs
{
if (!handovertype) handovertype = new Ngap_HandoverType_t();
......@@ -290,9 +300,10 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
{
if (!cause) cause = new Cause;
if (!cause) cause = new Cause();
Ngap_HandoverRequestIEs_t* ie =
(Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t));
ie->id = Ngap_ProtocolIE_ID_id_Cause;
......@@ -307,6 +318,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setUEAggregateMaximumBitRate(
long bit_rate_downlink, long bit_rate_uplink) {
if (!ueAggregateMaximumBitRate)
......@@ -329,6 +341,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate(
Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setUESecurityCapabilities(
uint16_t m_NR_EncryptionAlgs, uint16_t m_NR_IntegrityProtectionAlgs,
uint16_t m_E_UTRA_EncryptionAlgs,
......@@ -352,6 +366,7 @@ void HandoverRequest::setUESecurityCapabilities(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setGUAMI(
PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID,
AMFPointer* m_aMFPointer) {
......@@ -370,6 +385,8 @@ void HandoverRequest::setGUAMI(
if (ret != 0) Logger::ngap().error("Encode GUAMI IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (!allowedNSSAI) allowedNSSAI = new Ngap_AllowedNSSAI_t();
......@@ -395,6 +412,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
if (!SecurityContext) SecurityContext = new Ngap_SecurityContext_t();
......@@ -414,6 +433,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setPduSessionResourceSetupList(
std::vector<PDUSessionResourceSetupRequestItem_t> list) {
if (!PDUSessionResourceSetupList)
......@@ -457,6 +477,7 @@ void HandoverRequest::setPduSessionResourceSetupList(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setSourceToTarget_TransparentContainer(
OCTET_STRING_t sourceTotarget) {
if (!SourceToTarget_TransparentContainer)
......@@ -475,6 +496,8 @@ void HandoverRequest::setSourceToTarget_TransparentContainer(
Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
if (!mobilityrestrictionlist) {
mobilityrestrictionlist = new MobilityRestrictionList();
......
......@@ -76,7 +76,7 @@ class HandoverRequest {
void setMobilityRestrictionList(PlmnId* m_plmnId);
int encode2buffer(uint8_t* buf, int buf_size);
// bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
private:
Ngap_NGAP_PDU_t* handoverRequestPdu;
......
......@@ -41,6 +41,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequestAck::HandoverRequestAck() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -53,13 +54,18 @@ HandoverRequestAck::HandoverRequestAck() {
handovertype = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequestAck::~HandoverRequestAck() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequestAck::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
//------------------------------------------------------------------------------
void HandoverRequestAck::setMessageType() {
if (!handoverRequestAckPdu)
handoverRequestAckPdu =
......@@ -87,18 +93,22 @@ void HandoverRequestAck::setMessageType() {
}
}
//------------------------------------------------------------------------------
uint32_t HandoverRequestAck::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() {
if (TargetToSource_TransparentContainer)
return *TargetToSource_TransparentContainer;
return OCTET_STRING_t();
}
//------------------------------------------------------------------------------
bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
std::vector<PDUSessionResourceAdmittedItem_t>& list) {
if (!pduSessionResourceAdmittedList) return false;
......@@ -121,6 +131,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
return true;
}
//------------------------------------------------------------------------------
bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverRequestAckPdu = ngap_msg_pdu;
......@@ -226,14 +237,17 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestAckPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestAckPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug(
"Encode Handover Request Ack to buffer, er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
/* void HandoverRequestAck::setMessageType()
{
if (!handoverRequestAckPdu) handoverRequestAckPdu =
......
......@@ -54,8 +54,8 @@ class HandoverRequestAck {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
void setMessageType(); // Initialize the PDU and populate the MessageType;
OCTET_STRING_t getTargetToSource_TransparentContainer();
......
......@@ -21,6 +21,8 @@
#include "HandoverRequiredMsg.hpp"
#include "logger.hpp"
#include "TAI.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h"
......@@ -32,12 +34,11 @@ extern "C" {
#include <iostream>
#include <vector>
#include "TAI.hpp"
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequiredMsg::HandoverRequiredMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -50,8 +51,11 @@ HandoverRequiredMsg::HandoverRequiredMsg() {
handoverRequiredPdu = nullptr;
handoverRequiredIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequiredMsg::~HandoverRequiredMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -59,6 +63,7 @@ unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverRequiredMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -66,6 +71,7 @@ uint32_t HandoverRequiredMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
if (handovertype)
return *handovertype;
......@@ -73,6 +79,7 @@ Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
return Ngap_HandoverType_t();
}
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
if (cause)
return cause->getChoiceOfCause();
......@@ -80,6 +87,7 @@ Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
return Ngap_Cause_PR();
}
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getCauseValue() {
if (cause)
return cause->getValue();
......@@ -87,16 +95,30 @@ long HandoverRequiredMsg::getCauseValue() {
return 0;
}
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
if (ptr)
ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
if (ptr && targetid) {
if (targetid->present == Ngap_TargetID_PR_targetRANNodeID) {
if (targetid->choice.targetRANNodeID->globalRANNodeID.present ==
Ngap_GlobalRANNodeID_PR_globalGNB_ID) {
ptr->decodefromGlobalgNBId(targetid->choice.targetRANNodeID
->globalRANNodeID.choice.globalGNB_ID);
return;
}
}
}
return;
}
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getTAI(TAI*& ptr) {
if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
if (ptr) {
if (targetid->present == Ngap_TargetID_PR_targetRANNodeID)
ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
}
}
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
if (SourceToTarget_TransparentContainer)
return *SourceToTarget_TransparentContainer;
......@@ -104,19 +126,21 @@ OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
return OCTET_STRING_t();
}
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::getPDUSessionResourceList(
std::vector<PDUSessionResourceItem_t>& list) {
if (!PDUSessionResourceList) return false;
PDUSessionResourceItemHORqd* m_pduSessionResourceItemHORqd;
int num = 0;
PDUSessionResourceItemHORqd* m_pduSessionResourceItemHORqd = nullptr;
int num = 0;
PDUSessionResourceList->getPDUSessionResourceListHORqd(
m_pduSessionResourceItemHORqd, num);
if (!m_pduSessionResourceItemHORqd) return false;
for (int i = 0; i < num; i++) {
PDUSessionResourceItem_t response;
PDUSessionResourceItem_t response = {};
PDUSessionID* m_pDUSessionID;
PDUSessionID* m_pDUSessionID = nullptr;
m_pduSessionResourceItemHORqd[i].getPDUSessionResourceItemHORqd(
m_pDUSessionID, response.HandoverRequiredTransfer);
m_pDUSessionID->getPDUSessionID(response.pduSessionId);
......@@ -127,6 +151,7 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
return true;
}
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
if (directforwardingPathAvailability)
return *directforwardingPathAvailability;
......@@ -134,6 +159,7 @@ long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredPdu = ngap_msg_pdu;
......@@ -295,12 +321,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size);
// cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().error("er.encoded( %d )", er.encoded);
Logger::ngap().debug(
"Encode Handover Required to buffer, er.encoded( %d)", er.encoded);
return er.encoded;
}
......
......@@ -27,32 +27,40 @@
*/
#include "InitialContextSetupFailure.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
#include "constr_TYPE.h"
#include "constraints.h"
//#include "asn_codecs.h"
//#include "constr_TYPE.h"
//#include "constraints.h"
#include "dynamic_memory_check.h"
#include "per_decoder.h"
#include "per_encoder.h"
}
#include <iostream>
using namespace std;
// using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
InitialContextSetupFailureMsg::InitialContextSetupFailureMsg() {
initialContextSetupFailurePdu = NULL;
initialContextSetupFailureIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceFailedToSetupFailureList = NULL;
initialContextSetupFailurePdu = nullptr;
initialContextSetupFailureIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceFailedToSetupFailureList = nullptr;
}
//------------------------------------------------------------------------------
InitialContextSetupFailureMsg::~InitialContextSetupFailureMsg() {}
InitialContextSetupFailureMsg::~InitialContextSetupFailureMsg() {
if (initialContextSetupFailurePdu) free(initialContextSetupFailurePdu);
if (initialContextSetupFailureIEs) free(initialContextSetupFailureIEs);
if (amfUeNgapId) delete (amfUeNgapId);
if (ranUeNgapId) delete (ranUeNgapId);
if (pduSessionResourceFailedToSetupFailureList)
delete (pduSessionResourceFailedToSetupFailureList);
}
//------------------------------------------------------------------------------
void InitialContextSetupFailureMsg::setMessageType() {
......@@ -81,9 +89,9 @@ void InitialContextSetupFailureMsg::setMessageType() {
&(initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure);
} else {
cout << "[warning] This information doesn't refer to "
"InitialContextSetupFailure Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to InitialContextSetupFailure "
"Message!");
}
}
......@@ -102,13 +110,13 @@ void InitialContextSetupFailureMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -127,13 +135,14 @@ void InitialContextSetupFailureMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -175,15 +184,15 @@ void InitialContextSetupFailureMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtFail(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtFail);
if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error"
<< endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error"
<< endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
}
//------------------------------------------------------------------------------
......@@ -192,12 +201,11 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupFailurePdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
// Decapsulation
bool InitialContextSetupFailureMsg::decodefrompdu(
Ngap_NGAP_PDU_t* ngap_msg_pdu) {
initialContextSetupFailurePdu = ngap_msg_pdu;
......@@ -216,11 +224,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
&initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure;
} else {
cout << "Check InitialContextSetupFailure message error!!!" << endl;
Logger::ngap().error("Check InitialContextSetupFailure message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < initialContextSetupFailureIEs->protocolIEs.list.count;
......@@ -236,11 +244,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -254,11 +262,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -276,21 +284,22 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListCxtFail)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail "
"IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
"error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail IE "
"error!"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
"error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......@@ -307,7 +316,7 @@ unsigned long InitialContextSetupFailureMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t InitialContextSetupFailureMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -55,7 +55,6 @@ class InitialContextSetupFailureMsg {
std::vector<PDUSessionResourceFailedToSetupItem_t> list);
int encode2buffer(uint8_t* buf, int buf_size);
// Decapsulation
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
......
This diff is collapsed.
......@@ -67,6 +67,8 @@ class InitialUEMessageMsg {
int getRRCEstablishmentCause();
int getUeContextRequest();
bool get5GS_TMSI(std::string& _5g_s_tmsi);
bool get5GS_TMSI(
std ::string& setid, std ::string& pointer, std ::string& tmsi);
private:
Ngap_NGAP_PDU_t* initialUEMessagePdu;
......
......@@ -27,6 +27,7 @@
*/
#include "NGReset.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -73,9 +74,7 @@ void NGResetMsg::setMessageType() {
NgResetMessageTypeIE.encode2pdu(ngResetPdu);
ngResetIEs = &(ngResetPdu->choice.initiatingMessage->value.choice.NGReset);
} else {
cout << "[Warning] This information doesn't refer to NGReset "
"Message!!!"
<< endl;
Logger::ngap().warn("This information doesn't refer to NGReset message!");
}
}
......@@ -116,7 +115,7 @@ int NGResetMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngResetPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngResetPdu, buf, buf_size);
printf("er.encoded(%ld)\n", er.encoded);
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -144,11 +143,11 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause(
&ngResetIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "Decoded NGAP Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} else {
cout << "Decoded NGAP Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} break;
......@@ -160,28 +159,28 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
resetType = new ResetType();
if (!resetType->decode(&ngResetIEs->protocolIEs.list.array[i]
->value.choice.ResetType)) {
cout << "Decoded NGAP ResetType IE error" << endl;
Logger::ngap().error("Decoded NGAP ResetType IE error");
return false;
}
} else {
cout << "Decoded NGAP ResetType IE error" << endl;
Logger::ngap().error("Decoded NGAP ResetType IE error");
return false;
}
} break;
default: {
cout << "Decoded NGAP message PDU error" << endl;
Logger::ngap().error("Decoded NGAP message PDU IE error");
return false;
}
}
}
} else {
cout << "Check NGReset message error!!!";
Logger::ngap().error("Check NGReset message error!");
return false;
}
} else {
cout << "Check NGReset message error!!!";
Logger::ngap().error("Check NGReset message error!");
return false;
}
return true;
......
This diff is collapsed.
This diff is collapsed.
......@@ -70,7 +70,6 @@ class NGSetupRequestMsg {
Ngap_NGAP_PDU_t* ngSetupRequestPdu;
Ngap_NGSetupRequest_t* ngSetupRequestIEs;
/***************** for decoding ****************/
GlobalRanNodeId* globalRanNodeId;
RanNodeName* ranNodeName;
SupportedTAList* supportedTAList;
......
This diff is collapsed.
......@@ -69,8 +69,6 @@ class NGSetupResponseMsg {
Ngap_NGAP_PDU_t* ngSetupResponsePdu;
Ngap_NGSetupResponse_t* ngSetupResponsIEs;
/***************** for decoding ****************/
AmfName* amfName;
ServedGUAMIList* servedGUAMIList;
RelativeAMFCapacity* relativeAmfCapacity;
......
This diff is collapsed.
This diff is collapsed.
......@@ -45,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceReleaseResponseMsg::PduSessionResourceReleaseResponseMsg() {
pduSessionResourceReleaseResponsePdu = NULL;
pduSessionResourceReleaseResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceReleasedList = NULL;
userLocationInformation = NULL;
pduSessionResourceReleaseResponsePdu = nullptr;
pduSessionResourceReleaseResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceReleasedList = nullptr;
userLocationInformation = nullptr;
}
//------------------------------------------------------------------------------
......@@ -380,7 +380,7 @@ unsigned long PduSessionResourceReleaseResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
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