Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AMF
Commits
71fea8b2
Commit
71fea8b2
authored
Jul 19, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add uint_generator/update cmake
parent
3b7c9f53
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
2 deletions
+134
-2
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+9
-1
src/oai-amf/CMakeLists.txt
src/oai-amf/CMakeLists.txt
+1
-1
src/utils/uint_generator.hpp
src/utils/uint_generator.hpp
+124
-0
No files found.
src/amf-app/amf_app.cpp
View file @
71fea8b2
...
@@ -62,7 +62,15 @@ void amf_app_task(void*);
...
@@ -62,7 +62,15 @@ void amf_app_task(void*);
uint32_t
golbal_tmsi
=
1
;
uint32_t
golbal_tmsi
=
1
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
amf_app
::
amf_app
(
const
amf_config
&
amf_cfg
)
{
amf_app
::
amf_app
(
const
amf_config
&
amf_cfg
)
:
m_amf_ue_ngap_id2ue_ctx
(),
m_ue_ctx_key
(),
m_supi2ue_ctx
(),
m_curl_handle_responses
()
{
amf_ue_ngap_id2ue_ctx
=
{};
ue_ctx_key
=
{};
supi2ue_ctx
=
{};
curl_handle_responses
=
{};
Logger
::
amf_app
().
startup
(
"Creating AMF application functionality layer"
);
Logger
::
amf_app
().
startup
(
"Creating AMF application functionality layer"
);
if
(
itti_inst
->
create_task
(
TASK_AMF_APP
,
amf_app_task
,
nullptr
))
{
if
(
itti_inst
->
create_task
(
TASK_AMF_APP
,
amf_app_task
,
nullptr
))
{
Logger
::
amf_app
().
error
(
"Cannot create task TASK_AMF_APP"
);
Logger
::
amf_app
().
error
(
"Cannot create task TASK_AMF_APP"
);
...
...
src/oai-amf/CMakeLists.txt
View file @
71fea8b2
...
@@ -354,4 +354,4 @@ IF(STATIC_LINKING)
...
@@ -354,4 +354,4 @@ IF(STATIC_LINKING)
ENDIF
(
STATIC_LINKING
)
ENDIF
(
STATIC_LINKING
)
target_link_libraries
(
amf
${
ASAN
}
target_link_libraries
(
amf
${
ASAN
}
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread
${
NETTLE_LIBRARIES
}
${
MySQL_LIBRARY
}
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
boost_system ssl crypt cpprest gmp pistache curl
)
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread
${
NETTLE_LIBRARIES
}
${
MySQL_LIBRARY
}
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
boost_system
boost_thread boost_chrono
ssl crypt cpprest gmp pistache curl
)
src/utils/uint_generator.hpp
0 → 100644
View file @
71fea8b2
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file uint_uid_generator.hpp
\author Lionel GAUTHIER
\date 2019
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_UINT_GENERATOR_HPP_SEEN
#define FILE_UINT_GENERATOR_HPP_SEEN
#include <mutex>
#include <set>
namespace
util
{
template
<
class
UINT
>
class
uint_generator
{
private:
UINT
uid_generator
;
std
::
mutex
m_uid_generator
;
std
::
set
<
UINT
>
uid_generated
;
std
::
mutex
m_uid_generated
;
public:
uint_generator
()
:
m_uid_generator
(),
m_uid_generated
()
{
uid_generator
=
0
;
uid_generated
=
{};
};
uint_generator
(
uint_generator
const
&
)
=
delete
;
void
operator
=
(
uint_generator
const
&
)
=
delete
;
UINT
get_uid
()
{
std
::
unique_lock
<
std
::
mutex
>
lr
(
m_uid_generator
);
UINT
uid
=
++
uid_generator
;
while
(
true
)
{
// may happen race conditions here
std
::
unique_lock
<
std
::
mutex
>
ld
(
m_uid_generated
);
if
(
uid_generated
.
count
(
uid
)
==
0
)
{
uid_generated
.
insert
(
uid
);
ld
.
unlock
();
lr
.
unlock
();
return
uid
;
}
uid
=
++
uid_generator
;
}
}
void
free_uid
(
UINT
uid
)
{
std
::
unique_lock
<
std
::
mutex
>
l
(
m_uid_generated
);
uid_generated
.
erase
(
uid
);
l
.
unlock
();
}
};
template
<
class
UINT
>
class
uint_uid_generator
{
private:
UINT
uid_generator
;
std
::
mutex
m_uid_generator
;
std
::
set
<
UINT
>
uid_generated
;
std
::
mutex
m_uid_generated
;
uint_uid_generator
()
:
m_uid_generator
(),
m_uid_generated
()
{
uid_generator
=
0
;
uid_generated
=
{};
};
public:
static
uint_uid_generator
&
get_instance
()
{
static
uint_uid_generator
instance
;
return
instance
;
}
uint_uid_generator
(
uint_uid_generator
const
&
)
=
delete
;
void
operator
=
(
uint_uid_generator
const
&
)
=
delete
;
UINT
get_uid
()
{
std
::
unique_lock
<
std
::
mutex
>
lr
(
m_uid_generator
);
UINT
uid
=
++
uid_generator
;
while
(
true
)
{
// may happen race conditions here
std
::
unique_lock
<
std
::
mutex
>
ld
(
m_uid_generated
);
if
(
uid_generated
.
count
(
uid
)
==
0
)
{
uid_generated
.
insert
(
uid
);
lr
.
unlock
();
ld
.
unlock
();
return
uid
;
}
uid
=
++
uid_generator
;
}
}
void
free_uid
(
UINT
uid
)
{
std
::
unique_lock
<
std
::
mutex
>
l
(
m_uid_generated
);
uid_generated
.
erase
(
uid
);
l
.
unlock
();
}
};
}
// namespace util
#endif // FILE_UINT_GENERATOR_HPP_SEEN
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment