Commit a71f4de3 authored by Fang-WANG's avatar Fang-WANG

from opensource5g_1

parents 2b72ad41 56fc542d
...@@ -321,20 +321,20 @@ check_install_amf_deps(){ ...@@ -321,20 +321,20 @@ check_install_amf_deps(){
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
# Use fmt lib included in spdlog # Use fmt lib included in spdlog
#install_fmt $1 install_fmt $1
#ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
#install_spdlog_from_git $1 $2 install_spdlog_from_git $1 $2
#ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
#install_fb_folly_from_source $1 $2 install_fb_folly_from_source $1 $2
#ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
install_pistache_from_git $1 $2 install_pistache_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
#install_nlohmann_from_git $1 $2 install_nlohmann_from_git $1 $2
#ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO ldconfig $SUDO ldconfig
return 0 return 0
......
...@@ -90,60 +90,90 @@ class HtmlReport(): ...@@ -90,60 +90,90 @@ class HtmlReport():
self.file.write(' <br>\n') self.file.write(' <br>\n')
# Build Info Summary # Build Info Summary
self.file.write(' <table class="table-bordered" width = "80%" align = "center" border = "1">\n') buildSummary = ''
self.file.write(' <tr>\n') buildSummary += ' <table class="table-bordered" width = "80%" align = "center" border = "1">\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time</td>\n') buildSummary += ' <tr>\n'
buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time</td>\n'
#date_formatted = re.sub('\..*', '', self.created) #date_formatted = re.sub('\..*', '', self.created)
self.file.write(' <td>' + self.job_start_time + '</td>\n') buildSummary += ' <td>' + self.job_start_time + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Build Trigger</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Build Trigger</td>\n'
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <td>Pull Request</td>\n') buildSummary += ' <td>Pull Request</td>\n'
else: else:
self.file.write(' <td>Push Event</td>\n') buildSummary += ' <td>Push Event</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository</td>\n'
self.file.write(' <td><a href="' + self.git_url + '">' + self.git_url + '</a></td>\n') buildSummary += ' <td><a href="' + self.git_url + '">' + self.git_url + '</a></td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n'
self.file.write(' <td>' + self.git_src_branch + '</td>\n') buildSummary += ' <td>' + self.git_src_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID</td>\n'
self.file.write(' <td>' + self.git_src_commit + '</td>\n') buildSummary += ' <td>' + self.git_src_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if (self.git_src_commit_msg is not None): if (self.git_src_commit_msg is not None):
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Source Commit Message</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Source Commit Message</td>\n'
self.file.write(' <td>' + self.git_src_commit_msg + '</td>\n') buildSummary += ' <td>' + self.git_src_commit_msg + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch</td>\n'
self.file.write(' <td>' + self.git_target_branch + '</td>\n') buildSummary += ' <td>' + self.git_target_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Target Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Target Commit ID</td>\n'
self.file.write(' <td>' + self.git_target_commit + '</td>\n') buildSummary += ' <td>' + self.git_target_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
else: else:
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tree-deciduous"></span> Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tree-deciduous"></span> Branch</td>\n'
self.file.write(' <td>' + self.git_src_branch + '</td>\n') buildSummary += ' <td>' + self.git_src_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID</td>\n'
self.file.write(' <td>' + self.git_src_commit + '</td>\n') buildSummary += ' <td>' + self.git_src_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if (self.git_src_commit_msg is not None): if (self.git_src_commit_msg is not None):
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Commit Message</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Commit Message</td>\n'
self.file.write(' <td>' + self.git_src_commit_msg + '</td>\n') buildSummary += ' <td>' + self.git_src_commit_msg + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' </table>\n') buildSummary += ' </table>\n'
self.file.write(' <br>\n') buildSummary += ' <br>\n'
self.file.write(buildSummary)
cwd = os.getcwd()
if os.path.isfile(cwd + '/ds_tester_results_oai_cn5g.html'):
newEpcReport = open(cwd + '/ds_tester_results_oai_cn5g_new.html', 'w')
buildSummaryDone = True
with open(cwd + '/ds_tester_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport:
result = re.search('DS Tester Summary', line)
if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary)
buildSummaryDone = False
newEpcReport.write(line)
originalEpcReport.close()
newEpcReport.close()
os.rename(cwd + '/ds_tester_results_oai_cn5g_new.html', cwd + '/ds_tester_results_oai_cn5g.html')
if os.path.isfile(cwd + '/deploy_results_oai_cn5g.html'):
newEpcReport = open(cwd + '/deploy_results_oai_cn5g_new.html', 'w')
buildSummaryDone = True
with open(cwd + '/deploy_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport:
result = re.search('Deployment Summary', line)
if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary)
buildSummaryDone = False
newEpcReport.write(line)
originalEpcReport.close()
newEpcReport.close()
os.rename(cwd + '/deploy_results_oai_cn5g_new.html', cwd + '/deploy_results_oai_cn5g.html')
def generateFooter(self): def generateFooter(self):
self.file.write(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n') self.file.write(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n')
......
## amf configuration file ################################################################################
# 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
################################################################################
AMF = AMF =
{ {
INSTANCE_ID = 10; INSTANCE_ID = @INSTANCE@; # 0 is the default
PID_DIRECTORY = "/var/run"; PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
######################################################################## NG SETUP RESPONSE IEs ############################################################
AMF_NAME = "bupt-amf"; AMF_NAME = "OAI-AMF";
GUAMI:{MCC = "110"; MNC = "11"; RegionID = "128"; AMFSetID = "4"; AMFPointer = "1"}
RELATIVE_CAPACITY = 30;
# Display statistics about whole system (in seconds)
STATISTICS_TIMER_INTERVAL = 20; # YOUR CONFIG HERE
CORE_CONFIGURATION:
{
EMERGENCY_SUPPORT = "false";
};
GUAMI:
{
MCC = "@MCC@"; MNC = "@MNC@"; RegionID = "@REGION_ID@"; AMFSetID = "@AMF_SET_ID@"; AMFPointer = "1" # YOUR GUAMI CONFIG HERE
}
SERVED_GUAMI_LIST = ( SERVED_GUAMI_LIST = (
{MCC = "110"; MNC = "11"; RegionID = "10"; AMFSetID = "1"; AMFPointer = "0"}, #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer> {MCC = "@SERVED_GUAMI_MCC_0@"; MNC = "@SERVED_GUAMI_MNC_0@"; RegionID = "@SERVED_GUAMI_REGION_ID_0@"; AMFSetID = "@SERVED_GUAMI_AMF_SET_ID_0@"; AMFPointer = "0"}, #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
{MCC = "110"; MNC = "11"; RegionID = "10"; AMFSetID = "1"; AMFPointer = "1"} #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer> {MCC = "@SERVED_GUAMI_MCC_1@"; MNC = "@SERVED_GUAMI_MNC_1@"; RegionID = "@SERVED_GUAMI_REGION_ID_1@"; AMFSetID = "@SERVED_GUAMI_AMF_SET_ID_1@"; AMFPointer = "1"} #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
); );
RELATIVE_CAPACITY = 30;
PLMN_SUPPORT_LIST = ( PLMN_SUPPORT_LIST = (
{MCC = "110"; MNC = "11"; TAC = 100; {
SLICE_SUPPORT_LIST = ( MCC = "@PLMN_SUPPORT_MCC@"; MNC = "@PLMN_SUPPORT_MNC@"; TAC = @PLMN_SUPPORT_TAC@; # YOUR PLMN CONFIG HERE
{SST = "1"; SD = "none"}, SLICE_SUPPORT_LIST = (
{SST = "1"; SD = "12"} {SST = "@SST_0@"; SD = "@SD_0@"}, # YOUR NSSAI CONFIG HERE
{SST = "@SST_1@"; SD = "@SD_1@"} # YOUR NSSAI CONFIG HERE
) )
} }
); );
##################################################################### clause 9.2.6.2, 3gpp ts38.413 ####################################################
STATISTICS_TIMER_INTERVAL = 20; #second INTERFACES:
INTERFACES:{ {
NGAP_AMF:{ # AMF binded interface for N1/N2 interface (NGAP)
INTERFACE_NAME = "ens32"; NGAP_AMF:
{
INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_NGAP@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read"; IPV4_ADDRESS = "read";
PORT = 38412; PORT = 38412; # YOUR NETWORK CONFIG HERE
PPID = 60; PPID = 60; # YOUR NETWORK CONFIG HERE
}; };
<<<<<<< HEAD
# AMF binded interface for Nausf interface # AMF binded interface for Nausf interface
NAUSF: NAUSF:
{ {
...@@ -37,29 +75,43 @@ AMF = ...@@ -37,29 +75,43 @@ AMF =
}; };
N11:{ N11:{
=======
# AMF binded interface for N11
N11:
{
INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_N11@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 80; # YOUR NETWORK CONFIG HERE
>>>>>>> prepare_merge_handover
SMF_INSTANCES_POOL = ( SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = 1; IPV4_ADDRESS = "192.168.199.203"; PORT = "8889"; VERSION = "v2"; SELECTED = "true"}, {SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = 2; IPV4_ADDRESS = "10.103.238.21"; PORT = "8181"; VERSION = "v1"; SELECTED = "false"} {SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_1@"; SELECTED = "false"} # YOUR SMF CONFIG HERE
); );
}; };
}; };
CORE_CONFIGURATION:{
EMERGENCY_SUPPORT = "false";
}; AUTHENTICATION:
AUTHENTICATION:{ {
MYSQL_server = "127.0.0.1"; ## MySQL mandatory options
MYSQL_user = "bupt"; # Database server login MYSQL_server = "@MYSQL_SERVER@"; # MySQL Server address
MYSQL_pass = "linux"; # Database server password MYSQL_user = "@MYSQL_USER@"; # Database server login
MYSQL_db = "OAI_DB"; MYSQL_pass = "@MYSQL_PASS@"; # Database server password
OPERATOR_key = "1006020f0a478bf6b699f15c062e42b3"; # op MYSQL_db = "@MYSQL_DB@"; # Your database name
## OP
OPERATOR_key = "@OPERATOR_KEY@"; # OP key matching your database
RANDOM = "true"; RANDOM = "true";
}; };
NAS:{
#ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST = [ "NIA2" , "NIA1" , "NIA0" ]; NAS:
ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST = [ "NIA1" , "NIA1" , "NIA1" ]; {
ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST = [ "NIA0" , "NIA1" , "NIA2" ];
ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST = [ "NEA0" , "NEA1" , "NEA2" ]; ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST = [ "NEA0" , "NEA1" , "NEA2" ];
#ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST = [ "NEA1" , "NEA1" , "NEA1" ];
}; };
}; };
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
AMF = AMF =
{ {
INSTANCE_ID = 1; # 0 is the default INSTANCE_ID = 10; # 0 is the default
PID_DIRECTORY = "/var/run"; # /var/run is the default PID_DIRECTORY = "/var/run"; # /var/run is the default
AMF_NAME = "OAI-AMF"; AMF_NAME = "OAI-AMF";
...@@ -74,7 +74,7 @@ AMF = ...@@ -74,7 +74,7 @@ AMF =
PORT = 8282; # YOUR NETWORK CONFIG HERE PORT = 8282; # YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL = ( SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = 1; IPV4_ADDRESS = "192.168.199.203"; PORT = "8889"; VERSION = "v1"; SELECTED = "true"}, # YOUR SMF CONFIG HERE {SMF_INSTANCE_ID = 1; IPV4_ADDRESS = "192.168.199.203"; PORT = "8889"; VERSION = "v2"; SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = 2; IPV4_ADDRESS = "192.168.122.2"; PORT = "80"; VERSION = "v1"; SELECTED = "false"} # YOUR SMF CONFIG HERE {SMF_INSTANCE_ID = 2; IPV4_ADDRESS = "192.168.122.2"; PORT = "80"; VERSION = "v1"; SELECTED = "false"} # YOUR SMF CONFIG HERE
); );
}; };
......
#
# Copyright (c) 2015, EURECOM (www.eurecom.fr)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
#
# see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for explanation
# of style options
BasedOnStyle: Google
Language: Cpp
IndentWidth: 2
ColumnLimit: 80
IncludeBlocks: Preserve
SortIncludes: false
# alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
DerivePointerAlignment: false
PointerAlignment: Left
# function style
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterReturnType: None
IndentWrappedFunctionNames: false
# template style
AlwaysBreakTemplateDeclarations: Yes
# preprocessor style
IndentPPDirectives: None
# block style
AllowShortBlocksOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
# break style
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakStringLiterals: true
CompactNamespaces: false
ContinuationIndentWidth: 4
MaxEmptyLinesToKeep: 1
ReflowComments: true
# spacing style
UseTab: Never
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
# class style
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
# case statements
IndentCaseLabels: true
# cpp
Cpp11BracedListStyle: true
FixNamespaceComments: true
NamespaceIndentation: None
SortUsingDeclarations: true
# todo
# AlwaysBreakBeforeMultilineStrings: bool
# PenaltyBreakAssignment (unsigned)
# PenaltyBreakBeforeFirstCallParameter (unsigned)
# PenaltyBreakComment (unsigned)
# PenaltyBreakFirstLessLess (unsigned)
# PenaltyBreakString (unsigned)
# PenaltyBreakTemplateDeclaration (unsigned)
# PenaltyExcessCharacter (unsigned)
# PenaltyReturnTypeOnItsOwnLine (unsigned)
This diff is collapsed.
...@@ -30,18 +30,14 @@ ...@@ -30,18 +30,14 @@
#define _AMF_APP_H_ #define _AMF_APP_H_
#include <map> #include <map>
#include <set>
#include <shared_mutex> #include <shared_mutex>
#include <string> #include <string>
#include <thread>
#include <sstream>
#include "amf_config.hpp" #include "amf_config.hpp"
#include "amf_module_from_config.hpp" #include "amf_module_from_config.hpp"
#include "itti_msg_amf_app.hpp" #include "itti_msg_amf_app.hpp"
#include "ue_context.hpp" #include "ue_context.hpp"
using namespace config; using namespace config;
using namespace std;
static uint32_t amf_app_ue_ngap_id_generator = 1; static uint32_t amf_app_ue_ngap_id_generator = 1;
...@@ -66,16 +62,21 @@ class amf_app { ...@@ -66,16 +62,21 @@ class amf_app {
mutable std::shared_mutex m_ue_ctx_key; mutable std::shared_mutex m_ue_ctx_key;
bool is_amf_ue_id_2_ue_context(const long &amf_ue_ngap_id) const; bool is_amf_ue_id_2_ue_context(const long &amf_ue_ngap_id) const;
std::shared_ptr<ue_context> amf_ue_id_2_ue_context(const long &amf_ue_ngap_id) const; std::shared_ptr<ue_context> amf_ue_id_2_ue_context(
void set_amf_ue_ngap_id_2_ue_context(const long &amf_ue_ngap_id, std::shared_ptr<ue_context> uc); const long &amf_ue_ngap_id) const;
void set_amf_ue_ngap_id_2_ue_context(const long &amf_ue_ngap_id,
std::shared_ptr<ue_context> uc);
bool is_ran_amf_id_2_ue_context(const std::string &ue_context_key) const; bool is_ran_amf_id_2_ue_context(const std::string &ue_context_key) const;
std::shared_ptr<ue_context> ran_amf_id_2_ue_context(const std::string &ue_context_key) const; std::shared_ptr<ue_context> ran_amf_id_2_ue_context(
void set_ran_amf_id_2_ue_context(const std::string &ue_context_key, std::shared_ptr<ue_context> uc); const std::string &ue_context_key) const;
void set_ran_amf_id_2_ue_context(const std::string &ue_context_key,
std::shared_ptr<ue_context> uc);
// SMF Client response handlers // SMF Client response handlers
void handle_post_sm_context_response_error_400(); void handle_post_sm_context_response_error_400();
//others //others
bool generate_5g_guti(uint32_t ranid, long amfid, std::string &mcc, std::string &mnc, uint32_t &tmsi); bool generate_5g_guti(uint32_t ranid, long amfid, std::string &mcc,
std::string &mnc, uint32_t &tmsi);
}; };
} }
......
This diff is collapsed.
...@@ -35,15 +35,10 @@ ...@@ -35,15 +35,10 @@
#include <libconfig.h++> #include <libconfig.h++>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <mutex>
#include <vector> #include <vector>
#include <string> #include <string>
#include "thread_sched.hpp" #include "thread_sched.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#define AMF_CONFIG_STRING_AMF_CONFIG "AMF" #define AMF_CONFIG_STRING_AMF_CONFIG "AMF"
#define AMF_CONFIG_STRING_PID_DIRECTORY "PID_DIRECTORY" #define AMF_CONFIG_STRING_PID_DIRECTORY "PID_DIRECTORY"
#define AMF_CONFIG_STRING_INSTANCE_ID "INSTANCE_ID" #define AMF_CONFIG_STRING_INSTANCE_ID "INSTANCE_ID"
...@@ -166,7 +161,9 @@ class amf_config { ...@@ -166,7 +161,9 @@ class amf_config {
~amf_config(); ~amf_config();
int load(const std::string &config_file); int load(const std::string &config_file);
int load_interface(const Setting &if_cfg, interface_cfg_t &cfg); int load_interface(const Setting &if_cfg, interface_cfg_t &cfg);
int load_thread_sched_params(const libconfig::Setting &thread_sched_params_cfg, util::thread_sched_params &cfg); int load_thread_sched_params(
const libconfig::Setting &thread_sched_params_cfg,
util::thread_sched_params &cfg);
void display(); void display();
unsigned int instance; unsigned int instance;
std::string pid_dir; std::string pid_dir;
......
...@@ -37,15 +37,18 @@ namespace config { ...@@ -37,15 +37,18 @@ namespace config {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int amf_modules::load(const std::string &config_file) { int amf_modules::load(const std::string &config_file) {
Logger::amf_app().debug("\nLoad AMF module configuration file (%s)", config_file.c_str()); Logger::amf_app().debug("\nLoad AMF module configuration file (%s)",
config_file.c_str());
Config cfg; Config cfg;
try { try {
cfg.readFile(config_file.c_str()); cfg.readFile(config_file.c_str());
} catch (const FileIOException &fioex) { } catch (const FileIOException &fioex) {
Logger::amf_app().error("I/O error while reading file %s - %s", config_file.c_str(), fioex.what()); Logger::amf_app().error("I/O error while reading file %s - %s",
config_file.c_str(), fioex.what());
throw; throw;
} catch (const ParseException &pex) { } catch (const ParseException &pex) {
Logger::amf_app().error("Parse error at %s:%d - %s", pex.getFile(), pex.getLine(), pex.getError()); Logger::amf_app().error("Parse error at %s:%d - %s", pex.getFile(),
pex.getLine(), pex.getError());
throw; throw;
} }
const Setting &root = cfg.getRoot(); const Setting &root = cfg.getRoot();
...@@ -62,9 +65,13 @@ int amf_modules::load(const std::string &config_file) { ...@@ -62,9 +65,13 @@ int amf_modules::load(const std::string &config_file) {
const Setting &item = msg[i]; const Setting &item = msg[i];
std::string typeOfMessage; std::string typeOfMessage;
int procedure_code; int procedure_code;
item.lookupValue(MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_NAME, msgName); item.lookupValue(MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_NAME,
item.lookupValue(MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_PROCEDURECODE, procedure_code); msgName);
item.lookupValue(MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_TYPEOFMSG, typeOfMessage); item.lookupValue(
MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_PROCEDURECODE,
procedure_code);
item.lookupValue(MODULES_CONFIG_STRING_AMF_MODULES_NGAP_MESSAGE_TYPEOFMSG,
typeOfMessage);
procedureCode = (Ngap_ProcedureCode_t) procedure_code; procedureCode = (Ngap_ProcedureCode_t) procedure_code;
if (!(typeOfMessage.compare("initialMessage"))) { if (!(typeOfMessage.compare("initialMessage"))) {
typeOfMsg = Ngap_NGAP_PDU_PR_initiatingMessage; typeOfMsg = Ngap_NGAP_PDU_PR_initiatingMessage;
...@@ -82,7 +89,8 @@ int amf_modules::load(const std::string &config_file) { ...@@ -82,7 +89,8 @@ int amf_modules::load(const std::string &config_file) {
void amf_modules::display() { void amf_modules::display() {
Logger::config().info("======= AMF Registered Modules ======="); Logger::config().info("======= AMF Registered Modules =======");
Logger::config().info("NGAP Message Modules:"); Logger::config().info("NGAP Message Modules:");
Logger::config().info("- %s(Procedure code %d, Type of Msg %d)\n", msgName.c_str(), procedureCode, typeOfMsg); Logger::config().info("- %s(Procedure code %d, Type of Msg %d)\n",
msgName.c_str(), procedureCode, typeOfMsg);
} }
} }
...@@ -29,14 +29,7 @@ ...@@ -29,14 +29,7 @@
#ifndef _AMF_MODULE_FROM_CONFIG_H_ #ifndef _AMF_MODULE_FROM_CONFIG_H_
#define _AMF_MODULE_FROM_CONFIG_H_ #define _AMF_MODULE_FROM_CONFIG_H_
#include <arpa/inet.h>
#include <libconfig.h++> #include <libconfig.h++>
#include <netinet/in.h>
#include <sys/socket.h>
#include <mutex>
#include <vector>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \file amf_n11.hpp /*! \file amf_n11.hpp
\brief \brief
\author Keliang DU, BUPT \author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020 \date 2020
\email: contact@openairinterface.org \email: contact@openairinterface.org
*/ */
...@@ -44,23 +44,35 @@ class amf_n11 { ...@@ -44,23 +44,35 @@ class amf_n11 {
~amf_n11(); ~amf_n11();
void handle_itti_message(itti_smf_services_consumer&); void handle_itti_message(itti_smf_services_consumer&);
void handle_pdu_session_initial_request(std::string supi, std::shared_ptr<pdu_session_context> psc, std::string smf_addr, bstring sm_msg, std::string dnn); void handle_pdu_session_initial_request(
void handle_itti_message(itti_pdu_session_resource_setup_response &itti_msg); std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, bstring sm_msg, std::string dnn);
void handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_msg); void handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_msg);
void handle_itti_message(itti_nsmf_pdusession_release_sm_context &itti_msg); void handle_itti_message(itti_nsmf_pdusession_release_sm_context &itti_msg);
void handle_itti_message(itti_pdu_session_resource_setup_response &itti_msg);
void send_pdu_session_update_sm_context_request(
std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, bstring sm_msg, std::string dnn);
std::map<std::string, std::shared_ptr<pdu_session_context>> supi2pdu; // amf ue ngap id std::map<std::string, std::shared_ptr<pdu_session_context>> supi2pdu; // amf ue ngap id
mutable std::shared_mutex m_supi2pdu; mutable std::shared_mutex m_supi2pdu;
bool is_supi_to_pdu_ctx(const std::string &supi) const; bool is_supi_to_pdu_ctx(const std::string &supi) const;
std::shared_ptr<pdu_session_context> supi_to_pdu_ctx(const std::string &supi) const; std::shared_ptr<pdu_session_context> supi_to_pdu_ctx(
void set_supi_to_pdu_ctx(const std::string &supi, std::shared_ptr<pdu_session_context> psc); const std::string &supi) const;
void set_supi_to_pdu_ctx(const std::string &supi,
std::shared_ptr<pdu_session_context> psc);
std::map<uint8_t, std::string> pduid2supi; std::map<uint8_t, std::string> pduid2supi;
bool smf_selection_from_configuration(std::string &smf_addr); bool smf_selection_from_configuration(std::string &smf_addr);
bool smf_selection_from_context(std::string &smf_addr); bool smf_selection_from_context(std::string &smf_addr);
void handle_post_sm_context_response_error_400(); void handle_post_sm_context_response_error_400();
void handle_post_sm_context_response_error(long code, std::string cause, bstring n1sm, std::string supi, uint8_t pdu_session_id); void handle_post_sm_context_response_error(long code, std::string cause,
bstring n1sm, std::string supi,
uint8_t pdu_session_id);
void curl_http_client(std::string remoteUri, std::string jsonData, std::string n1SmMsg, std::string n2SmMsg, std::string supi, uint8_t pdu_session_id); void curl_http_client(std::string remoteUri, std::string jsonData,
std::string n1SmMsg, std::string n2SmMsg,
std::string supi, uint8_t pdu_session_id);
}; };
} }
......
This diff is collapsed.
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \file amf_n2.hpp /*! \file amf_n2.hpp
\brief \brief
\author Keliang DU, BUPT \author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020 \date 2020
\email: contact@openairinterface.org \email: contact@openairinterface.org
*/ */
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
#include "amf.hpp" #include "amf.hpp"
namespace amf_application{ namespace amf_application {
class amf_n2 : public ngap::ngap_app{ class amf_n2 : public ngap::ngap_app {
public: public:
amf_n2(const std::string &address, const uint16_t port_num); amf_n2(const std::string &address, const uint16_t port_num);
~amf_n2(); ~amf_n2();
...@@ -60,17 +60,23 @@ class amf_n2 : public ngap::ngap_app{ ...@@ -60,17 +60,23 @@ class amf_n2 : public ngap::ngap_app{
void handle_itti_message(itti_handover_request_Ack &itti_msg); void handle_itti_message(itti_handover_request_Ack &itti_msg);
void handle_itti_message(itti_handover_notify &itti_msg); void handle_itti_message(itti_handover_notify &itti_msg);
void handle_itti_message(itti_uplinkranstatsutransfer &itti_msg); void handle_itti_message(itti_uplinkranstatsutransfer &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> list); std::vector<SupportedItem_t> get_common_plmn(
public: std::vector<SupportedItem_t> list);
std::map<uint32_t, std::shared_ptr<ue_ngap_context>> ranid2uecontext;// ran ue ngap id std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context(
const uint32_t &ran_ue_ngap_id) const;
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t &ran_ue_ngap_id) const;
void set_ran_ue_ngap_id_2_ue_ngap_context(
const uint32_t &ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
private:
std::map<uint32_t, std::shared_ptr<ue_ngap_context>> ranid2uecontext; // ran ue ngap id
mutable std::shared_mutex m_ranid2uecontext; mutable std::shared_mutex m_ranid2uecontext;
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t & ran_ue_ngap_id) const; };
std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context(const uint32_t & ran_ue_ngap_id) const;
void set_ran_ue_ngap_id_2_ue_ngap_context(const uint32_t & ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
};
} }
......
...@@ -21,15 +21,13 @@ ...@@ -21,15 +21,13 @@
/*! \file amf_statistics.cpp /*! \file amf_statistics.cpp
\brief \brief
\author Keliang DU, BUPT \author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020 \date 2020
\email: contact@openairinterface.org \email: contact@openairinterface.org
*/ */
#include "amf_statistics.hpp" #include "amf_statistics.hpp"
#include <iostream>
#include "logger.hpp" #include "logger.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -40,31 +38,47 @@ void statistics::display() { ...@@ -40,31 +38,47 @@ void statistics::display() {
//Logger::amf_app().info("--------------------------------------------------"); //Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("| %d | %d | %d |",gNB_connected,UE_connected,UE_registred); //Logger::amf_app().info("| %d | %d | %d |",gNB_connected,UE_connected,UE_registred);
//Logger::amf_app().info("--------------------------------------------------"); //Logger::amf_app().info("--------------------------------------------------");
Logger::amf_app().info("|----------------------------------------------------------------------------------------------------------------|"); Logger::amf_app().info(
Logger::amf_app().info("|----------------------------------------------------gNBs' information-------------------------------------------|"); "|----------------------------------------------------------------------------------------------------------------|");
Logger::amf_app().info("| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC) |"); Logger::amf_app().info(
Logger::amf_app().info("| - | - | - | - | - |"); "|----------------------------------------------------gNBs' information-------------------------------------------|");
//if (gnbs.size() ==0 ) { Logger::amf_app().info(
// Logger::amf_app().info("| - | - | - | - | - |"); "| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC) |");
//} if (gnbs.size() == 0) {
Logger::amf_app().info(
"| - | - | - | - | - |");
}
//TODO: Show the list of common PLMNs //TODO: Show the list of common PLMNs
for (int i = 0; i < gnbs.size(); i++) { for (int i = 0; i < gnbs.size(); i++) {
Logger::amf_app().info("| %d | Connected | 0x%x | %s | %s, %d | ", i + 1, gnbs[i].gnb_id, gnbs[i].gnb_name.c_str(), (gnbs[i].mcc + gnbs[i].mnc).c_str(), gnbs[i].tac); Logger::amf_app().info(
} "| %d | Connected | 0x%x | %s | %s, %d | ",
Logger::amf_app().info("|----------------------------------------------------------------------------------------------------------------|"); i + 1, gnbs[i].gnb_id, gnbs[i].gnb_name.c_str(),
(gnbs[i].mcc + gnbs[i].mnc).c_str(), gnbs[i].tac);
}
Logger::amf_app().info(
"|----------------------------------------------------------------------------------------------------------------|");
Logger::amf_app().info(""); Logger::amf_app().info("");
Logger::amf_app().info("|----------------------------------------------------------------------------------------------------------------|"); Logger::amf_app().info(
Logger::amf_app().info("|----------------------------------------------------UEs' information--------------------------------------------|"); "|----------------------------------------------------------------------------------------------------------------|");
Logger::amf_app().info("| Index | Connection state | Registration state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID |"); Logger::amf_app().info(
for (int i = 0; i < ues.size(); i++) { "|----------------------------------------------------UEs' information--------------------------------------------|");
Logger::amf_app().info("| %d | %s | %s | %s | %s | %d | %d | ", i + 1, ues[i].connStatus.c_str(), ues[i].registerStatus.c_str(), ues[i].imsi.c_str(), ues[i].guti.c_str(), ues[i].ranid, ues[i].amfid); Logger::amf_app().info(
//Logger::amf_app().info("Current ran_ue_ngap_id[%d]; Current amf_ue_ngap_id[%d]", ues[i].ranid, ues[i].amfid); "| Index | 5GMM state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID | PLMN |Cell ID|");
Logger::amf_app().info("Location [NrCgi][PLMN(%s), cellID(%d)]", (ues[i].mcc + ues[i].mnc).c_str(), ues[i].cellId);
Logger::amf_app().info(""); int i = 0;
for (auto const &ue : ue_infos) {
Logger::amf_app().info("|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|", i + 1,
ue.second.registerStatus.c_str(),
ue.second.imsi.c_str(), ue.second.guti.c_str(),
ue.second.ranid, ue.second.amfid,
(ue.second.mcc + ue.second.mnc).c_str(),
ue.second.cellId);
i++;
} }
Logger::amf_app().info("|----------------------------------------------------------------------------------------------------------------|"); Logger::amf_app().info(
"|----------------------------------------------------------------------------------------------------------------|");
Logger::amf_app().info(""); Logger::amf_app().info("");
} }
...@@ -75,6 +89,40 @@ statistics::statistics() { ...@@ -75,6 +89,40 @@ statistics::statistics() {
UE_registred = 0; UE_registred = 0;
} }
//------------------------------------------------------------------------------
void statistics::update_ue_info(const ue_info_t &ue_info) {
if (!(ue_info.imsi.size() > 0)) {
Logger::amf_app().warn("Update UE Info with invalid IMSI");
}
if (ue_infos.count(ue_info.imsi) > 0) {
ue_infos.erase(ue_info.imsi);
ue_infos.insert(std::pair<std::string, ue_info_t>(ue_info.imsi, ue_info));
Logger::amf_app().debug("Update UE Info (IMSI %s) success",
ue_info.imsi.c_str());
} else {
ue_infos.insert(std::pair<std::string, ue_info_t>(ue_info.imsi, ue_info));
Logger::amf_app().debug("Add UE Info (IMSI %s) success",
ue_info.imsi.c_str());
}
}
//------------------------------------------------------------------------------
void statistics::update_5gmm_state(const std::string &imsi,
const std::string &state) {
if (ue_infos.count(imsi) > 0) {
ue_info_t ue_info = ue_infos.at(imsi);
ue_info.registerStatus = state;
ue_infos.erase(ue_info.imsi);
ue_infos.insert(std::pair<std::string, ue_info_t>(imsi, ue_info));
Logger::amf_app().debug("Update UE State (IMSI %s, State %s) success",
imsi.c_str(), state.c_str());
} else {
Logger::amf_app().warn("Update UE State (IMSI %s), UE does not exist!",
imsi.c_str());
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
statistics::~statistics() { statistics::~statistics() {
} }
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
#ifndef _STATISTICS_H_ #ifndef _STATISTICS_H_
#define _STATISTICS_H_ #define _STATISTICS_H_
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <vector> #include <vector>
#include <string> #include <string>
...@@ -49,7 +46,7 @@ typedef struct { ...@@ -49,7 +46,7 @@ typedef struct {
//long nrCellId; //long nrCellId;
} gnb_infos; } gnb_infos;
typedef struct { typedef struct ue_info_s {
std::string connStatus; std::string connStatus;
std::string registerStatus; std::string registerStatus;
uint32_t ranid; uint32_t ranid;
...@@ -59,20 +56,22 @@ typedef struct { ...@@ -59,20 +56,22 @@ typedef struct {
std::string mcc; std::string mcc;
std::string mnc; std::string mnc;
uint32_t cellId; uint32_t cellId;
} ue_infos; } ue_info_t;
class statistics { class statistics {
public: public:
void display(); void display();
statistics(); statistics();
~statistics(); ~statistics();
void update_ue_info(const ue_info_t &ue_info);
void update_5gmm_state(const std::string &imsi, const std::string &state);
public: public:
uint32_t gNB_connected; uint32_t gNB_connected;
uint32_t UE_connected; uint32_t UE_connected;
uint32_t UE_registred; uint32_t UE_registred;
//uint32_t system_pdu_sessions; //uint32_t system_pdu_sessions;
std::vector<gnb_infos> gnbs; std::vector<gnb_infos> gnbs;
std::vector<ue_infos> ues; std::map<std::string, ue_info_t> ue_infos;
}; };
......
...@@ -45,11 +45,13 @@ bool amf_n1::get_mysql_auth_info(std::string imsi, mysql_auth_info_t &resp) { / ...@@ -45,11 +45,13 @@ bool amf_n1::get_mysql_auth_info(std::string imsi, mysql_auth_info_t &resp) { /
Logger::amf_n1().error("Cannot connect to MySQL DB"); Logger::amf_n1().error("Cannot connect to MySQL DB");
return false; return false;
} }
query = "SELECT `key`,`sqn`,`rand`,`OPc` FROM `users` WHERE `users`.`imsi`='" + imsi + "' "; query = "SELECT `key`,`sqn`,`rand`,`OPc` FROM `users` WHERE `users`.`imsi`='"
+ imsi + "' ";
pthread_mutex_lock(&db_desc->db_cs_mutex); pthread_mutex_lock(&db_desc->db_cs_mutex);
if (mysql_query(db_desc->db_conn, query.c_str())) { if (mysql_query(db_desc->db_conn, query.c_str())) {
pthread_mutex_unlock(&db_desc->db_cs_mutex); pthread_mutex_unlock(&db_desc->db_cs_mutex);
Logger::amf_n1().error("Query execution failed: %s\n", mysql_error(db_desc->db_conn)); Logger::amf_n1().error("Query execution failed: %s\n",
mysql_error(db_desc->db_conn));
return false; return false;
} }
res = mysql_store_result(db_desc->db_conn); res = mysql_store_result(db_desc->db_conn);
...@@ -84,7 +86,8 @@ bool amf_n1::connect_to_mysql() { ...@@ -84,7 +86,8 @@ bool amf_n1::connect_to_mysql() {
const int mysql_reconnect_val = 1; const int mysql_reconnect_val = 1;
db_desc = (database_t*) calloc(1, sizeof(database_t)); db_desc = (database_t*) calloc(1, sizeof(database_t));
if (!db_desc) { if (!db_desc) {
Logger::amf_n1().error("An error occurs when allocating memory for DB_DESC"); Logger::amf_n1().error(
"An error occurs when allocating memory for DB_DESC");
return false; return false;
} }
pthread_mutex_init(&db_desc->db_cs_mutex, NULL); pthread_mutex_init(&db_desc->db_cs_mutex, NULL);
...@@ -94,8 +97,11 @@ bool amf_n1::connect_to_mysql() { ...@@ -94,8 +97,11 @@ bool amf_n1::connect_to_mysql() {
db_desc->database = amf_cfg.auth_para.mysql_db; db_desc->database = amf_cfg.auth_para.mysql_db;
db_desc->db_conn = mysql_init(NULL); db_desc->db_conn = mysql_init(NULL);
mysql_options(db_desc->db_conn, MYSQL_OPT_RECONNECT, &mysql_reconnect_val); mysql_options(db_desc->db_conn, MYSQL_OPT_RECONNECT, &mysql_reconnect_val);
if (!mysql_real_connect(db_desc->db_conn, db_desc->server.c_str(), db_desc->user.c_str(), db_desc->password.c_str(), db_desc->database.c_str(), 0, NULL, 0)) { if (!mysql_real_connect(db_desc->db_conn, db_desc->server.c_str(),
Logger::amf_n1().error("An error occurred while connecting to db: %s", mysql_error(db_desc->db_conn)); db_desc->user.c_str(), db_desc->password.c_str(),
db_desc->database.c_str(), 0, NULL, 0)) {
Logger::amf_n1().error("An error occurred while connecting to db: %s",
mysql_error(db_desc->db_conn));
mysql_thread_end(); mysql_thread_end();
return false; return false;
} }
...@@ -104,7 +110,8 @@ bool amf_n1::connect_to_mysql() { ...@@ -104,7 +110,8 @@ bool amf_n1::connect_to_mysql() {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::mysql_push_rand_sqn(std::string imsi, uint8_t *rand_p, uint8_t *sqn) { void amf_n1::mysql_push_rand_sqn(std::string imsi, uint8_t *rand_p,
uint8_t *sqn) {
int status = 0; int status = 0;
MYSQL_RES *res; MYSQL_RES *res;
char query[1000]; char query[1000];
...@@ -118,18 +125,21 @@ void amf_n1::mysql_push_rand_sqn(std::string imsi, uint8_t *rand_p, uint8_t *sqn ...@@ -118,18 +125,21 @@ void amf_n1::mysql_push_rand_sqn(std::string imsi, uint8_t *rand_p, uint8_t *sqn
Logger::amf_n1().error("Need sqn and rand"); Logger::amf_n1().error("Need sqn and rand");
return; return;
} }
sqn_decimal = ((uint64_t) sqn[0] << 40) | ((uint64_t) sqn[1] << 32) | ((uint64_t) sqn[2] << 24) | (sqn[3] << 16) | (sqn[4] << 8) | sqn[5]; sqn_decimal = ((uint64_t) sqn[0] << 40) | ((uint64_t) sqn[1] << 32)
| ((uint64_t) sqn[2] << 24) | (sqn[3] << 16) | (sqn[4] << 8) | sqn[5];
query_length = sprintf(query, "UPDATE `users` SET `rand`=UNHEX('"); query_length = sprintf(query, "UPDATE `users` SET `rand`=UNHEX('");
for (int i = 0; i < RAND_LENGTH; i++) { for (int i = 0; i < RAND_LENGTH; i++) {
query_length += sprintf(&query[query_length], "%02x", rand_p[i]); query_length += sprintf(&query[query_length], "%02x", rand_p[i]);
} }
query_length += sprintf (&query[query_length], "'),`sqn`=%" PRIu64, sqn_decimal); query_length += sprintf (&query[query_length], "'),`sqn`=%" PRIu64, sqn_decimal);
query_length += sprintf(&query[query_length], " WHERE `users`.`imsi`='%s'", imsi.c_str()); query_length += sprintf(&query[query_length], " WHERE `users`.`imsi`='%s'",
imsi.c_str());
pthread_mutex_lock(&db_desc->db_cs_mutex); pthread_mutex_lock(&db_desc->db_cs_mutex);
if (mysql_query(db_desc->db_conn, query)) { if (mysql_query(db_desc->db_conn, query)) {
pthread_mutex_unlock(&db_desc->db_cs_mutex); pthread_mutex_unlock(&db_desc->db_cs_mutex);
Logger::amf_n1().error("Query execution failed: %s", mysql_error(db_desc->db_conn)); Logger::amf_n1().error("Query execution failed: %s",
mysql_error(db_desc->db_conn));
return; return;
} }
do { do {
...@@ -138,7 +148,8 @@ void amf_n1::mysql_push_rand_sqn(std::string imsi, uint8_t *rand_p, uint8_t *sqn ...@@ -138,7 +148,8 @@ void amf_n1::mysql_push_rand_sqn(std::string imsi, uint8_t *rand_p, uint8_t *sqn
mysql_free_result(res); mysql_free_result(res);
} else { } else {
if (mysql_field_count(db_desc->db_conn) == 0) { if (mysql_field_count(db_desc->db_conn) == 0) {
Logger::amf_n1().error("[MySQL] %lld rows affected", mysql_affected_rows(db_desc->db_conn)); Logger::amf_n1().error("[MySQL] %lld rows affected",
mysql_affected_rows(db_desc->db_conn));
} else { /* some error occurred */ } else { /* some error occurred */
Logger::amf_n1().error("Could not retrieve result set"); Logger::amf_n1().error("Could not retrieve result set");
break; break;
...@@ -160,13 +171,16 @@ void amf_n1::mysql_increment_sqn(std::string imsi) { ...@@ -160,13 +171,16 @@ void amf_n1::mysql_increment_sqn(std::string imsi) {
Logger::amf_n1().error("Cannot connect to MySQL DB"); Logger::amf_n1().error("Cannot connect to MySQL DB");
return; return;
} }
sprintf(query, "UPDATE `users` SET `sqn` = `sqn` + 32 WHERE `users`.`imsi`='%s'", imsi.c_str()); sprintf(query,
"UPDATE `users` SET `sqn` = `sqn` + 32 WHERE `users`.`imsi`='%s'",
imsi.c_str());
pthread_mutex_lock(&db_desc->db_cs_mutex); pthread_mutex_lock(&db_desc->db_cs_mutex);
if (mysql_query(db_desc->db_conn, query)) { if (mysql_query(db_desc->db_conn, query)) {
pthread_mutex_unlock(&db_desc->db_cs_mutex); pthread_mutex_unlock(&db_desc->db_cs_mutex);
Logger::amf_n1().error("Query execution failed: %s", mysql_error(db_desc->db_conn)); Logger::amf_n1().error("Query execution failed: %s",
mysql_error(db_desc->db_conn));
return; return;
} }
do { do {
...@@ -175,7 +189,8 @@ void amf_n1::mysql_increment_sqn(std::string imsi) { ...@@ -175,7 +189,8 @@ void amf_n1::mysql_increment_sqn(std::string imsi) {
mysql_free_result(res); mysql_free_result(res);
} else { } else {
if (mysql_field_count(db_desc->db_conn) == 0) { if (mysql_field_count(db_desc->db_conn) == 0) {
Logger::amf_n1().error("[MySQL] %lld rows affected", mysql_affected_rows(db_desc->db_conn)); Logger::amf_n1().error("[MySQL] %lld rows affected",
mysql_affected_rows(db_desc->db_conn));
} else { } else {
Logger::amf_n1().error("Could not retrieve result set"); Logger::amf_n1().error("Could not retrieve result set");
break; break;
......
...@@ -29,10 +29,8 @@ ...@@ -29,10 +29,8 @@
#ifndef _MYSQL_DB_HANDLERS_H_ #ifndef _MYSQL_DB_HANDLERS_H_
#define _MYSQL_DB_HANDLERS_H_ #define _MYSQL_DB_HANDLERS_H_
#include <stdint.h>
#include <pthread.h> #include <pthread.h>
#include <mysql/mysql.h> #include <mysql/mysql.h>
#include <netinet/in.h>
#include <string> #include <string>
#define KEY_LENGTH (16) #define KEY_LENGTH (16)
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_29_502_SMF_SEEN
#define FILE_3GPP_29_502_SMF_SEEN
enum pdu_session_application_error_e {
PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR = 1,
PDU_SESSION_APPLICATION_ERROR_SNSSAI_DENIED = 2,
PDU_SESSION_APPLICATION_ERROR_DNN_DENIED = 3,
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_DENIED = 4,
PDU_SESSION_APPLICATION_ERROR_SSC_DENIED = 5,
PDU_SESSION_APPLICATION_ERROR_SUBSCRIPTION_DENIED = 6,
PDU_SESSION_APPLICATION_ERROR_DNN_NOT_SUPPORTED = 7,
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_NOT_SUPPORTED = 8,
PDU_SESSION_APPLICATION_ERROR_SSC_NOT_SUPPORTED = 9,
PDU_SESSION_APPLICATION_ERROR_HOME_ROUTED_ROAMING_REQUIRED = 10,
PDU_SESSION_APPLICATION_ERROR_OUT_OF_LADN_SERVICE_AREA = 11,
PDU_SESSION_APPLICATION_ERROR_N2_SM_ERROR = 12,
PDU_SESSION_APPLICATION_ERROR_PRIORITIZED_SERVICES_ONLY = 13,
PDU_SESSION_APPLICATION_ERROR_PDU_SESSION_ANCHOR_CHANGE = 14,
PDU_SESSION_APPLICATION_ERROR_TARGET_MME_CAPABILITY = 15,
PDU_SESSION_APPLICATION_ERROR_NO_EPS_5GS_CONTINUITY = 16,
PDU_SESSION_APPLICATION_ERROR_UNABLE_TO_PAGE_UE = 17,
PDU_SESSION_APPLICATION_ERROR_UE_NOT_RESPONDING = 18,
PDU_SESSION_APPLICATION_ERROR_REJECTED_BY_UE = 19,
PDU_SESSION_APPLICATION_ERROR_REJECTED_DUE_VPLMN_POLICY = 20,
PDU_SESSION_APPLICATION_ERROR_HO_TAU_IN_PROGRESS = 21,
PDU_SESSION_APPLICATION_ERROR_INTEGRITY_PROTECTED_MDR_NOT_ACCEPTABLE = 22,
PDU_SESSION_APPLICATION_ERROR_EBI_EXHAUSTED = 23,
PDU_SESSION_APPLICATION_ERROR_EBI_REJECTED_LOCAL_POLICY = 24,
PDU_SESSION_APPLICATION_ERROR_EBI_REJECTED_NO_N26 = 25,
PDU_SESSION_APPLICATION_ERROR_DEFAULT_EPS_BEARER_INACTIVE = 26,
PDU_SESSION_APPLICATION_ERROR_HANDOVER_RESOURCE_ALLOCATION_FAILURE = 27,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND = 28,
PDU_SESSION_APPLICATION_ERROR_INSUFFICIENT_RESOURCES_SLICE = 29,
PDU_SESSION_APPLICATION_ERROR_INSUFFICIENT_RESOURCES_SLICE_DNN = 30,
PDU_SESSION_APPLICATION_ERROR_DNN_CONGESTION = 31,
PDU_SESSION_APPLICATION_ERROR_S_NSSAI_CONGESTION = 32,
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING = 33,
PDU_SESSION_APPLICATION_ERROR_NETWORK_FAILURE = 34
};
static const std::vector<std::string> pdu_session_application_error_e2str = {
"UNKNOWN ERROR", "N1_SM_ERROR", "SNSSAI_DENIED", "DNN_DENIED",
"PDUTYPE_DENIED", "SSC_DENIED", "SUBSCRIPTION_DENIED", "DNN_NOT_SUPPORTED",
"PDUTYPE_NOT_SUPPORTED", "SSC_NOT_SUPPORTED",
"HOME_ROUTED_ROAMING_REQUIRED", "OUT_OF_LADN_SERVICE_AREA", "N2_SM_ERROR",
"PRIORITIZED_SERVICES_ONLY", "PDU_SESSION_ANCHOR_CHANGE",
"TARGET_MME_CAPABILITY", "NO_EPS_5GS_CONTINUITY", "UNABLE_TO_PAGE_UE",
"UE_NOT_RESPONDING", "REJECTED_BY_UE", "REJECTED_DUE_VPLMN_POLICY",
"HO_TAU_IN_PROGRESS", "INTEGRITY_PROTECTED_MDR_NOT_ACCEPTABLE",
"EBI_EXHAUSTED", "EBI_REJECTED_LOCAL_POLICY", "EBI_REJECTED_NO_N26",
"DEFAULT_EPS_BEARER_INACTIVE", "HANDOVER_RESOURCE_ALLOCATION_FAILURE",
"CONTEXT_NOT_FOUND", "INSUFFICIENT_RESOURCES_SLICE",
"INSUFFICIENT_RESOURCES_SLICE_DNN", "DNN_CONGESTION", "S_NSSAI_CONGESTION",
"PEER_NOT_RESPONDING", "NETWORK_FAILURE" };
//6.1.6.3.12 Enumeration: N2SmInfoType @3GPP TS 29.502 V16.0.0
enum n2_sm_info_type_e {
PDU_RES_SETUP_REQ = 1, //PDU Session Resource Setup Request Transfer
PDU_RES_SETUP_RSP = 2, //PDU Session Resource Setup Response Transfer
PDU_RES_SETUP_FAIL = 3, //PDU Session Resource Setup Unsuccessful Transfer
PDU_RES_REL_CMD = 4, //PDU Session Resource Release Command Transfer
PDU_RES_REL_RSP = 5, //PDU Session Resource Release Response Transfer
PDU_RES_MOD_REQ = 6, //PDU Session Resource Modify Request Transfer
PDU_RES_MOD_RSP = 7, //PDU Session Resource Modify Response Transfer
PDU_RES_MOD_FAIL = 8, //PDU Session Resource Modify Unsuccessful Transfer
PDU_RES_NTY = 9, //PDU Session Resource Notify Transfer
PDU_RES_NTY_REL = 10, //PDU Session Resource Notify Released Transfer
PDU_RES_MOD_IND = 11, //PDU Session Resource Modify Indication Transfer
PDU_RES_MOD_CFM = 12, //PDU Session Resource Modify Confirm Transfer
PATH_SWITCH_REQ = 13, //Path Switch Request Transfer
PATH_SWITCH_SETUP_FAIL = 14, //Path Switch Request Setup Failed Transfer
PATH_SWITCH_REQ_ACK = 15, //Path Switch Request Acknowledge Transfer
PATH_SWITCH_REQ_FAIL = 16, //Path Switch Request Unsuccessful Transfer
HANDOVER_REQUIRED = 17, //Handover Required Transfer
HANDOVER_CMD = 18, //Handover Command Transfer
HANDOVER_PREP_FAIL = 19, //Handover Preparation Unsuccessful Transfer
HANDOVER_REQ_ACK = 20, //Handover Request Acknowledge Transfer
HANDOVER_RES_ALLOC_FAIL = 21, //Handover Resource Allocation Unsuccessful Transfer
SECONDARY_RAT_USAGE = 22 //Secondary RAT Data Usage Report Transfer
};
static const std::vector<std::string> n2_sm_info_type_e2str = { "UNKNOWN_TYPE",
"PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL",
"PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP",
"PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND",
"PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL",
"PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED",
"HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK",
"HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" };
#endif
...@@ -34,7 +34,6 @@ typedef struct { ...@@ -34,7 +34,6 @@ typedef struct {
uint32_t tac; uint32_t tac;
} plmn_t; } plmn_t;
typedef struct s_nssai // section 28.4, TS23.003 typedef struct s_nssai // section 28.4, TS23.003
{ {
uint8_t sST; uint8_t sST;
...@@ -65,9 +64,9 @@ typedef struct s_nssai // section 28.4, TS23.003 ...@@ -65,9 +64,9 @@ typedef struct s_nssai // section 28.4, TS23.003
} snssai_t; } snssai_t;
//SMF + AMF + 3GPP TS 29.571 (Common data) //SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e { enum class http_response_codes_e {
HTTP_RESPONSE_CODE_0 = 0,
HTTP_RESPONSE_CODE_200_OK = 200, HTTP_RESPONSE_CODE_200_OK = 200,
HTTP_RESPONSE_CODE_201_CREATED = 201, HTTP_RESPONSE_CODE_201_CREATED = 201,
HTTP_RESPONSE_CODE_202_ACCEPTED = 202, HTTP_RESPONSE_CODE_202_ACCEPTED = 202,
...@@ -91,16 +90,16 @@ enum class http_response_codes_e { ...@@ -91,16 +90,16 @@ enum class http_response_codes_e {
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501, HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503, HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504 HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504
}; };
//for CURL //for CURL
#define SMF_CURL_TIMEOUT_MS 100L #define SMF_CURL_TIMEOUT_MS 100L
#define SMF_NUMBER_RETRIES 3 #define SMF_NUMBER_RETRIES 3
constexpr auto CURL_MIME_BOUNDARY = "----Boundary"; constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define BUFFER_SIZE_1024 1024
#define BUFFER_SIZE_512 512
#define BUFFER_SIZE_256 256
#endif #endif
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
#include <string> #include <string>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void print_buffer(const std::string app, const std::string commit, uint8_t *buf, int len) { void print_buffer(const std::string app, const std::string commit, uint8_t *buf,
int len) {
if (!app.compare("amf_app")) if (!app.compare("amf_app"))
Logger::amf_app().debug(commit.c_str()); Logger::amf_app().debug(commit.c_str());
if (!app.compare("amf_n1")) if (!app.compare("amf_n1"))
......
...@@ -34,12 +34,24 @@ ...@@ -34,12 +34,24 @@
#include <inttypes.h> #include <inttypes.h>
#include <arpa/inet.h> #include <arpa/inet.h>
static const char hex_to_ascii_table[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', }; static const char hex_to_ascii_table[16] = { '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', };
static const signed char ascii_to_hex_table[0x100] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, static const signed char ascii_to_hex_table[0x100] = { -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1,
10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1 };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void conv::hexa_to_ascii(uint8_t *from, char *to, size_t length) { void conv::hexa_to_ascii(uint8_t *from, char *to, size_t length) {
...@@ -89,7 +101,8 @@ int conv::ascii_to_hex(uint8_t *dst, const char *h) { ...@@ -89,7 +101,8 @@ int conv::ascii_to_hex(uint8_t *dst, const char *h) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::string conv::mccToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3) { std::string conv::mccToString(const uint8_t digit1, const uint8_t digit2,
const uint8_t digit3) {
std::string s = { }; std::string s = { };
uint16_t mcc16 = digit1 * 100 + digit2 * 10 + digit3; uint16_t mcc16 = digit1 * 100 + digit2 * 10 + digit3;
//s.append(std::to_string(digit1)).append(std::to_string(digit2)).append(std::to_string(digit3)); //s.append(std::to_string(digit1)).append(std::to_string(digit2)).append(std::to_string(digit3));
...@@ -98,7 +111,8 @@ std::string conv::mccToString(const uint8_t digit1, const uint8_t digit2, const ...@@ -98,7 +111,8 @@ std::string conv::mccToString(const uint8_t digit1, const uint8_t digit2, const
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::string conv::mncToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3) { std::string conv::mncToString(const uint8_t digit1, const uint8_t digit2,
const uint8_t digit3) {
std::string s = { }; std::string s = { };
uint16_t mcc16 = 0; uint16_t mcc16 = 0;
...@@ -123,7 +137,8 @@ struct in_addr conv::fromString(const std::string addr4) { ...@@ -123,7 +137,8 @@ struct in_addr conv::fromString(const std::string addr4) {
std::string conv::toString(const struct in_addr &inaddr) { std::string conv::toString(const struct in_addr &inaddr) {
std::string s = { }; std::string s = { };
char str[INET6_ADDRSTRLEN] = { }; char str[INET6_ADDRSTRLEN] = { };
if (inet_ntop(AF_INET, (const void*) &inaddr, str, INET6_ADDRSTRLEN) == NULL) { if (inet_ntop(AF_INET, (const void*) &inaddr, str, INET6_ADDRSTRLEN)
== NULL) {
s.append("Error in_addr"); s.append("Error in_addr");
} else { } else {
s.append(str); s.append(str);
...@@ -135,7 +150,8 @@ std::string conv::toString(const struct in_addr &inaddr) { ...@@ -135,7 +150,8 @@ std::string conv::toString(const struct in_addr &inaddr) {
std::string conv::toString(const struct in6_addr &in6addr) { std::string conv::toString(const struct in6_addr &in6addr) {
std::string s = { }; std::string s = { };
char str[INET6_ADDRSTRLEN] = { }; char str[INET6_ADDRSTRLEN] = { };
if (inet_ntop(AF_INET6, (const void*) &in6addr, str, INET6_ADDRSTRLEN) == nullptr) { if (inet_ntop(AF_INET6, (const void*) &in6addr, str, INET6_ADDRSTRLEN)
== nullptr) {
s.append("Error in6_addr"); s.append("Error in6_addr");
} else { } else {
s.append(str); s.append(str);
......
...@@ -50,7 +50,9 @@ class conv { ...@@ -50,7 +50,9 @@ class conv {
static struct in_addr fromString(const std::string addr4); static struct in_addr fromString(const std::string addr4);
static std::string toString(const struct in_addr &inaddr); static std::string toString(const struct in_addr &inaddr);
static std::string toString(const struct in6_addr &in6addr); static std::string toString(const struct in6_addr &in6addr);
static std::string mccToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3); static std::string mccToString(const uint8_t digit1, const uint8_t digit2,
static std::string mncToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3); const uint8_t digit3);
static std::string mncToString(const uint8_t digit1, const uint8_t digit2,
const uint8_t digit3);
}; };
#endif /* FILE_CONVERSIONS_HPP_SEEN */ #endif /* FILE_CONVERSIONS_HPP_SEEN */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#define _UE_CONTEXT_H_ #define _UE_CONTEXT_H_
#include <stdint.h> #include <stdint.h>
#include <map>
#include <shared_mutex>
#include "NgapIEsStruct.hpp" #include "NgapIEsStruct.hpp"
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <stdint.h> #include <stdint.h>
#include <map> #include <map>
#include <shared_mutex>
#include "gNB_context.hpp" #include "gNB_context.hpp"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment