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