Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF-Simple
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
CommunityXG
OpenXG-SMF-Simple
Commits
b3bef24d
Commit
b3bef24d
authored
Nov 23, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup/replace pdn_type by pdu_session-type
parent
853160e1
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
149 additions
and
611 deletions
+149
-611
src/common/3gpp_23.003.h
src/common/3gpp_23.003.h
+0
-1
src/common/3gpp_24.501.h
src/common/3gpp_24.501.h
+39
-0
src/common/3gpp_29.244.h
src/common/3gpp_29.244.h
+4
-4
src/common/3gpp_29.274.h
src/common/3gpp_29.274.h
+3
-370
src/common/3gpp_29.281.h
src/common/3gpp_29.281.h
+0
-136
src/common/utils/3gpp_conversions.cpp
src/common/utils/3gpp_conversions.cpp
+15
-11
src/common/utils/3gpp_conversions.hpp
src/common/utils/3gpp_conversions.hpp
+2
-1
src/pfcp/msg_pfcp.hpp
src/pfcp/msg_pfcp.hpp
+9
-5
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+22
-32
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+2
-4
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+40
-34
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+4
-4
src/smf_app/smf_paa_dynamic.hpp
src/smf_app/smf_paa_dynamic.hpp
+9
-9
No files found.
src/common/3gpp_23.003.h
View file @
b3bef24d
...
...
@@ -28,7 +28,6 @@
#ifndef FILE_3GPP_23_003_SEEN
#define FILE_3GPP_23_003_SEEN
//#include "3gpp_29.274.h"
#include <stdint.h>
typedef
struct
plmn_s
{
...
...
src/common/3gpp_24.501.h
View file @
b3bef24d
...
...
@@ -332,7 +332,46 @@ typedef struct pdu_session_type_s {
}
}
pdu_session_type_t
;
//-------------------------------------
// 8.14 PDU Session (UE IP) Address Allocation (PAA)
struct
paa_s
{
pdu_session_type_t
pdu_session_type
;
uint8_t
ipv6_prefix_length
;
struct
in6_addr
ipv6_address
;
struct
in_addr
ipv4_address
;
//------------------------------------------------------------------------------
bool
is_ip_assigned
()
{
switch
(
pdu_session_type
.
pdu_session_type
)
{
case
PDU_SESSION_TYPE_E_IPV4
:
if
(
ipv4_address
.
s_addr
)
return
true
;
return
false
;
break
;
case
PDU_SESSION_TYPE_E_IPV6
:
if
(
ipv6_address
.
s6_addr32
[
0
]
|
ipv6_address
.
s6_addr32
[
1
]
|
ipv6_address
.
s6_addr32
[
2
]
|
ipv6_address
.
s6_addr32
[
3
])
return
true
;
return
false
;
break
;
case
PDU_SESSION_TYPE_E_IPV4V6
:
// TODO
if
(
ipv4_address
.
s_addr
)
return
true
;
if
(
ipv6_address
.
s6_addr32
[
0
]
|
ipv6_address
.
s6_addr32
[
1
]
|
ipv6_address
.
s6_addr32
[
2
]
|
ipv6_address
.
s6_addr32
[
3
])
return
true
;
return
false
;
break
;
case
PDU_SESSION_TYPE_E_UNSTRUCTURED
:
case
PDU_SESSION_TYPE_E_ETHERNET
:
case
PDU_SESSION_TYPE_E_RESERVED
:
default:
return
false
;
}
}
};
typedef
struct
paa_s
paa_t
;
#endif
#endif
src/common/3gpp_29.244.h
View file @
b3bef24d
...
...
@@ -1357,7 +1357,7 @@ typedef struct graceful_release_period_s {
//-------------------------------------
// 8.2.79 PDN Type
enum
pdn_type_value_e
{
enum
pd
u_sessio
n_type_value_e
{
/* Request / Initial message */
IPV4
=
1
,
IPV6
=
2
,
...
...
@@ -1366,10 +1366,10 @@ enum pdn_type_value_e {
ETHERNET
=
5
};
typedef
struct
pdn_type_s
{
typedef
struct
pd
u_sessio
n_type_s
{
uint8_t
spare
:
5
;
uint8_t
pdn_type
:
3
;
}
pdn_type_t
;
uint8_t
pd
u_sessio
n_type
:
3
;
}
pd
u_sessio
n_type_t
;
//-------------------------------------
// 8.2.80 Failed Rule ID
...
...
src/common/3gpp_29.274.h
View file @
b3bef24d
This diff is collapsed.
Click to expand it.
src/common/3gpp_29.281.h
View file @
b3bef24d
...
...
@@ -38,142 +38,6 @@
#include <string>
#include <vector>
namespace
gtpv1u
{
struct
gtpu_exception
:
public
std
::
exception
{
gtpu_exception
()
throw
()
{
cause
=
0
;
phrase
.
assign
(
"GTPV1-U Exception unknown cause"
);
}
gtpu_exception
(
int
acause
)
throw
()
{
cause
=
acause
;
phrase
=
fmt
::
format
(
"GTPV1-U Exception cause {}"
,
cause
);
}
const
char
*
what
()
const
throw
()
{
return
phrase
.
c_str
();
}
public:
int
cause
;
std
::
string
phrase
;
};
struct
gtpu_msg_bad_length_exception
:
public
gtpu_exception
{
public:
gtpu_msg_bad_length_exception
(
const
uint8_t
msg_type
,
const
uint16_t
msg_size
)
throw
()
{
phrase
=
fmt
::
format
(
"GTPV1-U msg {} Bad Length {} Exception"
,
msg_type
,
msg_size
);
}
gtpu_msg_bad_length_exception
(
std
::
string
&
aphrase
)
throw
()
{
phrase
=
aphrase
;
}
virtual
~
gtpu_msg_bad_length_exception
()
throw
()
{
}
};
struct
gtpu_msg_unimplemented_ie_exception
:
public
gtpu_exception
{
public:
gtpu_msg_unimplemented_ie_exception
(
const
uint8_t
msg_type
,
const
uint8_t
ie_type
,
const
uint8_t
instance
=
0
)
throw
()
{
phrase
=
fmt
::
format
(
"GTPV1-U msg {} Unimplemented {} IE Instance {} Exception"
,
msg_type
,
ie_type
,
instance
);
}
gtpu_msg_unimplemented_ie_exception
(
std
::
string
&
aphrase
)
throw
()
{
phrase
=
aphrase
;
}
virtual
~
gtpu_msg_unimplemented_ie_exception
()
throw
()
{
}
};
struct
gtpu_msg_illegal_ie_exception
:
public
gtpu_exception
{
public:
gtpu_msg_illegal_ie_exception
(
const
uint8_t
msg_type
,
const
uint8_t
ie_type
)
throw
()
{
phrase
=
fmt
::
format
(
"GTPV1-U msg {} Illegal {} Exception"
,
msg_type
,
ie_type
);
}
gtpu_msg_illegal_ie_exception
(
std
::
string
&
aphrase
)
throw
()
{
phrase
=
aphrase
;
}
virtual
~
gtpu_msg_illegal_ie_exception
()
throw
()
{
}
};
struct
gtpu_ie_exception
:
public
gtpu_exception
{
public:
gtpu_ie_exception
(
uint8_t
ie_type
)
throw
()
{
phrase
=
fmt
::
format
(
"GTPV1-U IE {} Exception"
,
ie_type
);
}
gtpu_ie_exception
(
std
::
string
&
aphrase
)
throw
()
{
phrase
=
aphrase
;
}
virtual
~
gtpu_ie_exception
()
throw
()
{
}
};
struct
gtpu_ie_unimplemented_exception
:
public
gtpu_ie_exception
{
public:
gtpu_ie_unimplemented_exception
(
uint8_t
ie_type
)
throw
()
:
gtpu_ie_exception
(
ie_type
)
{
phrase
=
fmt
::
format
(
"GTPV1-U IE {} Unimplemented Exception"
,
ie_type
);
}
virtual
~
gtpu_ie_unimplemented_exception
()
throw
()
{
}
};
struct
gtpu_tlv_exception
:
public
gtpu_ie_exception
{
public:
gtpu_tlv_exception
(
uint8_t
ie_type
)
throw
()
:
gtpu_ie_exception
(
ie_type
)
{
phrase
=
fmt
::
format
(
"GTPV1-U IE TLV {} Exception"
,
ie_type
);
}
virtual
~
gtpu_tlv_exception
()
throw
()
{
}
};
struct
gtpu_tlv_bad_length_exception
:
public
gtpu_tlv_exception
{
public:
gtpu_tlv_bad_length_exception
(
uint8_t
ie_type
,
uint16_t
ie_length
)
throw
()
:
gtpu_tlv_exception
(
ie_type
)
{
phrase
=
fmt
::
format
(
"GTPV1-U IE TLV {} Bad Length {} Exception"
,
ie_type
);
}
virtual
~
gtpu_tlv_bad_length_exception
()
throw
()
{
}
};
struct
gtpu_ie_value_exception
:
public
gtpu_ie_exception
{
public:
gtpu_ie_value_exception
(
uint8_t
ie_type
,
const
char
*
field
)
throw
()
:
gtpu_ie_exception
(
ie_type
)
{
phrase
=
fmt
::
format
(
"GTPV1-U IE {} Bad Value of {} Exception"
,
ie_type
,
field
);
}
virtual
~
gtpu_ie_value_exception
()
throw
()
{
}
};
#define GTPU_IE_RECOVERY 14
#define GTPU_IE_TUNNEL_ENDPOINT_IDENTIFIER_DATA_I 16
#define GTPU_IE_GTP_U_PEER_ADDRESS 133
#define GTPU_IE_EXTENSION_HEADER_TYPE_LIST 141
#define GTPU_IE_PRIVATE_EXTENSION 255
#define GTPU_ECHO_REQUEST (1)
#define GTPU_ECHO_RESPONSE (2)
#define GTPU_ERROR_INDICATION (26)
#define GTPU_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION (31)
#define GTPU_END_MARKER (254)
#define GTPU_G_PDU (255)
}
// namespace
// 8.2 Recovery
// 8.3 Tunnel Endpoint Identifier Data I
...
...
src/common/utils/3gpp_conversions.cpp
View file @
b3bef24d
...
...
@@ -36,46 +36,50 @@
//------------------------------------------------------------------------------
void
xgpp_conv
::
paa_to_pfcp_ue_ip_address
(
const
paa_t
&
paa
,
pfcp
::
ue_ip_address_t
&
ue_ip_address
)
{
switch
(
paa
.
pd
n_type
.
pd
n_type
)
{
case
PDN_TYPE_E_IPV4
:
switch
(
paa
.
pd
u_session_type
.
pdu_sessio
n_type
)
{
case
PD
U_SESSIO
N_TYPE_E_IPV4
:
ue_ip_address
.
v4
=
1
;
ue_ip_address
.
ipv4_address
=
paa
.
ipv4_address
;
break
;
case
PDN_TYPE_E_IPV6
:
case
PD
U_SESSIO
N_TYPE_E_IPV6
:
ue_ip_address
.
v6
=
1
;
ue_ip_address
.
ipv6_address
=
paa
.
ipv6_address
;
break
;
case
PDN_TYPE_E_IPV4V6
:
case
PD
U_SESSIO
N_TYPE_E_IPV4V6
:
ue_ip_address
.
v4
=
1
;
ue_ip_address
.
v6
=
1
;
ue_ip_address
.
ipv4_address
=
paa
.
ipv4_address
;
ue_ip_address
.
ipv6_address
=
paa
.
ipv6_address
;
break
;
case
PDN_TYPE_E_NON_IP
:
case
PDU_SESSION_TYPE_E_UNSTRUCTURED
:
case
PDU_SESSION_TYPE_E_ETHERNET
:
case
PDU_SESSION_TYPE_E_RESERVED
:
default:
;
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
pdn_ip_to_pfcp_ue_ip_address
(
const
pd
n_type_t
&
pd
n_type
,
const
struct
in_addr
&
ipv4_address
,
const
pd
u_session_type_t
&
pdu_sessio
n_type
,
const
struct
in_addr
&
ipv4_address
,
const
struct
in6_addr
ipv6_address
,
pfcp
::
ue_ip_address_t
&
ue_ip_address
)
{
switch
(
pd
n_type
.
pd
n_type
)
{
case
PDN_TYPE_E_IPV4
:
switch
(
pd
u_session_type
.
pdu_sessio
n_type
)
{
case
PD
U_SESSIO
N_TYPE_E_IPV4
:
ue_ip_address
.
v4
=
1
;
ue_ip_address
.
ipv4_address
=
ipv4_address
;
break
;
case
PDN_TYPE_E_IPV6
:
case
PD
U_SESSIO
N_TYPE_E_IPV6
:
ue_ip_address
.
v6
=
1
;
ue_ip_address
.
ipv6_address
=
ipv6_address
;
break
;
case
PDN_TYPE_E_IPV4V6
:
case
PD
U_SESSIO
N_TYPE_E_IPV4V6
:
ue_ip_address
.
v4
=
1
;
ue_ip_address
.
v6
=
1
;
ue_ip_address
.
ipv4_address
=
ipv4_address
;
ue_ip_address
.
ipv6_address
=
ipv6_address
;
break
;
case
PDN_TYPE_E_NON_IP
:
case
PDU_SESSION_TYPE_E_UNSTRUCTURED
:
case
PDU_SESSION_TYPE_E_ETHERNET
:
case
PDU_SESSION_TYPE_E_RESERVED
:
default:
;
}
...
...
src/common/utils/3gpp_conversions.hpp
View file @
b3bef24d
...
...
@@ -31,13 +31,14 @@
#include "3gpp_29.274.h"
#include "3gpp_29.244.h"
#include "3gpp_29.281.h"
#include "3gpp_24.501.h"
#include "endpoint.hpp"
namespace
xgpp_conv
{
void
paa_to_pfcp_ue_ip_address
(
const
paa_t
&
paa
,
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
void
pdn_ip_to_pfcp_ue_ip_address
(
const
pd
n_type_t
&
pd
n_type
,
void
pdn_ip_to_pfcp_ue_ip_address
(
const
pd
u_session_type_t
&
pdu_sessio
n_type
,
const
struct
in_addr
&
ipv4_address
,
const
struct
in6_addr
ipv6_address
,
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
...
...
src/pfcp/msg_pfcp.hpp
View file @
b3bef24d
...
...
@@ -430,8 +430,11 @@ namespace pfcp {
virtual
bool
get
(
pfcp
::
graceful_release_period_t
&
v
)
const
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_GRACEFUL_RELEASE_PERIOD
,
__FILE__
,
__LINE__
);}
virtual
void
set
(
const
pfcp
::
graceful_release_period_t
&
v
)
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_GRACEFUL_RELEASE_PERIOD
,
__FILE__
,
__LINE__
);}
// PFCP_IE_PDN_TYPE
virtual
bool
get
(
pfcp
::
pdn_type_t
&
v
)
const
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_PDN_TYPE
,
__FILE__
,
__LINE__
);}
virtual
void
set
(
const
pfcp
::
pdn_type_t
&
v
)
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_PDN_TYPE
,
__FILE__
,
__LINE__
);}
//virtual bool get(pfcp::pdn_type_t& v) const {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
//virtual void set(const pfcp::pdn_type_t& v) {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
virtual
bool
get
(
pfcp
::
pdu_session_type_t
&
v
)
const
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_PDN_TYPE
,
__FILE__
,
__LINE__
);}
virtual
void
set
(
const
pfcp
::
pdu_session_type_t
&
v
)
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_PDN_TYPE
,
__FILE__
,
__LINE__
);}
// PFCP_IE_FAILED_RULE_ID
virtual
bool
get
(
pfcp
::
failed_rule_id_t
&
v
)
const
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_FAILED_RULE_ID
,
__FILE__
,
__LINE__
);}
virtual
void
set
(
const
pfcp
::
failed_rule_id_t
&
v
)
{
throw
pfcp_msg_illegal_ie_exception
(
0
,
PFCP_IE_FAILED_RULE_ID
,
__FILE__
,
__LINE__
);}
...
...
@@ -2886,7 +2889,8 @@ public:
std
::
vector
<
pfcp
::
create_qer
>
create_qers
;
std
::
pair
<
bool
,
pfcp
::
create_bar
>
create_bar
;
std
::
pair
<
bool
,
pfcp
::
create_traffic_endpoint
>
create_traffic_endpoint
;
std
::
pair
<
bool
,
pfcp
::
pdn_type_t
>
pdn_type
;
//std::pair<bool, pfcp::pdn_type_t> pdn_type;
std
::
pair
<
bool
,
pfcp
::
pdu_session_type_t
>
pdu_session_type
;
std
::
pair
<
bool
,
fq_csid_t
>
sgw_c_fq_csid
;
std
::
pair
<
bool
,
fq_csid_t
>
mme_fq_csid
;
std
::
pair
<
bool
,
fq_csid_t
>
pgw_c_fq_csid
;
...
...
@@ -2905,7 +2909,7 @@ public:
create_qers
(),
create_bar
(),
create_traffic_endpoint
(),
pdn_type
(),
pd
u_sessio
n_type
(),
sgw_c_fq_csid
(),
mme_fq_csid
(),
pgw_c_fq_csid
(),
...
...
@@ -2924,7 +2928,7 @@ public:
create_qers
=
i
.
create_qers
;
create_bar
=
i
.
create_bar
;
create_traffic_endpoint
=
i
.
create_traffic_endpoint
;
pd
n_type
=
i
.
pd
n_type
;
pd
u_session_type
=
i
.
pdu_sessio
n_type
;
sgw_c_fq_csid
=
i
.
sgw_c_fq_csid
;
mme_fq_csid
=
i
.
mme_fq_csid
;
pgw_c_fq_csid
=
i
.
pgw_c_fq_csid
;
...
...
src/smf_app/smf_config.cpp
View file @
b3bef24d
...
...
@@ -409,20 +409,24 @@ int smf_config::load(const string &config_file) {
dnn_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DNN_NI
,
astring
);
dnn
[
dnn_idx
].
dnn
=
astring
;
dnn
[
dnn_idx
].
dnn_label
=
EPC
::
Utility
::
dnn_label
(
astring
);
dnn_cfg
.
lookupValue
(
SMF_CONFIG_STRING_PDN_TYPE
,
astring
);
dnn_cfg
.
lookupValue
(
SMF_CONFIG_STRING_PD
U_SESSIO
N_TYPE
,
astring
);
if
(
boost
::
iequals
(
astring
,
"IPv4"
))
{
dnn
[
dnn_idx
].
pd
n_type
.
pdn_type
=
PD
N_TYPE_E_IPV4
;
dnn
[
dnn_idx
].
pd
u_session_type
.
pdu_session_type
=
PDU_SESSIO
N_TYPE_E_IPV4
;
}
else
if
(
boost
::
iequals
(
astring
,
"IPv6"
)
==
0
)
{
dnn
[
dnn_idx
].
pd
n_type
.
pdn_type
=
PD
N_TYPE_E_IPV6
;
dnn
[
dnn_idx
].
pd
u_session_type
.
pdu_session_type
=
PDU_SESSIO
N_TYPE_E_IPV6
;
}
else
if
(
boost
::
iequals
(
astring
,
"IPv4IPv6"
)
==
0
)
{
dnn
[
dnn_idx
].
pdn_type
.
pdn_type
=
PDN_TYPE_E_IPV4V6
;
}
else
if
(
boost
::
iequals
(
astring
,
"Non-IP"
)
==
0
)
{
dnn
[
dnn_idx
].
pdn_type
.
pdn_type
=
PDN_TYPE_E_NON_IP
;
dnn
[
dnn_idx
].
pdu_session_type
.
pdu_session_type
=
PDU_SESSION_TYPE_E_IPV4V6
;
}
else
if
(
boost
::
iequals
(
astring
,
"Unstructured"
)
==
0
)
{
dnn
[
dnn_idx
].
pdu_session_type
.
pdu_session_type
=
PDU_SESSION_TYPE_E_UNSTRUCTURED
;
}
else
if
(
boost
::
iequals
(
astring
,
"Ethernet"
)
==
0
)
{
dnn
[
dnn_idx
].
pdu_session_type
.
pdu_session_type
=
PDU_SESSION_TYPE_E_ETHERNET
;
}
else
if
(
boost
::
iequals
(
astring
,
"Reserved"
)
==
0
)
{
dnn
[
dnn_idx
].
pdu_session_type
.
pdu_session_type
=
PDU_SESSION_TYPE_E_RESERVED
;
}
else
{
Logger
::
smf_app
().
error
(
" "
SMF_CONFIG_STRING_PDN_TYPE
" in %d'th DNN :%s"
,
i
+
1
,
" "
SMF_CONFIG_STRING_PD
U_SESSIO
N_TYPE
" in %d'th DNN :%s"
,
i
+
1
,
astring
.
c_str
());
throw
(
"Error PDN_TYPE in config file"
);
throw
(
"Error PD
U_SESSIO
N_TYPE in config file"
);
}
dnn_cfg
.
lookupValue
(
SMF_CONFIG_STRING_IPV4_POOL
,
dnn
[
dnn_idx
].
pool_id_iv4
);
...
...
@@ -430,16 +434,16 @@ int smf_config::load(const string &config_file) {
dnn
[
dnn_idx
].
pool_id_iv6
);
if
((
0
<=
dnn
[
dnn_idx
].
pool_id_iv4
)
&&
(
dnn
[
dnn_idx
].
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV6
))
{
&&
(
dnn
[
dnn_idx
].
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV6
))
{
Logger
::
smf_app
().
error
(
"PDN_TYPE versus pool identifier %d 'th DNN in config file"
,
i
+
1
);
throw
(
"PDN_TYPE versus pool identifier DNN"
);
"PD
U_SESSIO
N_TYPE versus pool identifier %d 'th DNN in config file"
,
i
+
1
);
throw
(
"PD
U_SESSIO
N_TYPE versus pool identifier DNN"
);
}
if
((
0
<=
dnn
[
dnn_idx
].
pool_id_iv6
)
&&
(
dnn
[
dnn_idx
].
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV4
))
{
&&
(
dnn
[
dnn_idx
].
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV4
))
{
Logger
::
smf_app
().
error
(
"PDN_TYPE versus pool identifier %d 'th DNN in config file"
,
i
+
1
);
throw
(
"PDN_TYPE versus pool identifier DNN"
);
"PD
U_SESSIO
N_TYPE versus pool identifier %d 'th DNN in config file"
,
i
+
1
);
throw
(
"PD
U_SESSIO
N_TYPE versus pool identifier DNN"
);
}
if
(((
0
<=
dnn
[
dnn_idx
].
pool_id_iv4
)
||
(
0
<=
dnn
[
dnn_idx
].
pool_id_iv6
))
...
...
@@ -756,8 +760,8 @@ void smf_config::display() {
Logger
::
smf_app
().
info
(
" DNN %d:"
,
i
);
Logger
::
smf_app
().
info
(
" "
SMF_CONFIG_STRING_DNN_NI
": %s"
,
dnn
[
i
].
dnn
.
c_str
());
Logger
::
smf_app
().
info
(
" "
SMF_CONFIG_STRING_PDN_TYPE
": %s"
,
dnn
[
i
].
pdn_type
.
toString
().
c_str
());
Logger
::
smf_app
().
info
(
" "
SMF_CONFIG_STRING_PD
U_SESSIO
N_TYPE
": %s"
,
dnn
[
i
].
pd
u_sessio
n_type
.
toString
().
c_str
());
if
(
dnn
[
i
].
pool_id_iv4
>=
0
)
{
std
::
string
range_low
(
inet_ntoa
(
ue_pool_range_low
[
dnn
[
i
].
pool_id_iv4
]));
std
::
string
range_high
(
inet_ntoa
(
ue_pool_range_high
[
dnn
[
i
].
pool_id_iv4
]));
...
...
@@ -830,20 +834,6 @@ void smf_config::display() {
}
//------------------------------------------------------------------------------
bool
smf_config
::
is_dotted_dnn_handled
(
const
string
&
dnn
,
const
pdn_type_t
&
pdn_type
)
{
for
(
int
i
=
0
;
i
<
smf_cfg
.
num_dnn
;
i
++
)
{
if
(
0
==
dnn
.
compare
(
smf_cfg
.
dnn
[
i
].
dnn_label
))
{
// TODO refine
if
(
pdn_type
.
pdn_type
==
smf_cfg
.
dnn
[
i
].
pdn_type
.
pdn_type
)
{
return
true
;
}
}
}
return
false
;
}
//------------------------------------------------------------------------------
int
smf_config
::
get_pfcp_node_id
(
pfcp
::
node_id_t
&
node_id
)
{
node_id
=
{
};
...
...
@@ -895,9 +885,9 @@ bool smf_config::is_dotted_dnn_handled(
Logger
::
smf_app
().
debug
(
"DNN matched!"
);
Logger
::
smf_app
().
debug
(
"PDU Session Type %d, PDN Type %d"
,
pdn_session_type
.
pdu_session_type
,
smf_cfg
.
dnn
[
i
].
pd
n_type
.
pd
n_type
);
smf_cfg
.
dnn
[
i
].
pd
u_session_type
.
pdu_sessio
n_type
);
if
(
pdn_session_type
.
pdu_session_type
==
smf_cfg
.
dnn
[
i
].
pd
n_type
.
pd
n_type
)
{
==
smf_cfg
.
dnn
[
i
].
pd
u_session_type
.
pdu_sessio
n_type
)
{
return
true
;
}
}
...
...
src/smf_app/smf_config.hpp
View file @
b3bef24d
...
...
@@ -80,7 +80,7 @@
#define SMF_CONFIG_STRING_DNN_LIST "DNN_LIST"
#define SMF_CONFIG_STRING_DNN_NI "DNN_NI"
#define SMF_CONFIG_STRING_PD
N_TYPE
"PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_PD
U_SESSION_TYPE
"PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_IPV4_POOL "IPV4_POOL"
#define SMF_CONFIG_STRING_IPV6_POOL "IPV6_POOL"
...
...
@@ -178,7 +178,7 @@ class smf_config {
std
::
string
dnn_label
;
int
pool_id_iv4
;
int
pool_id_iv6
;
pd
n_type_t
pd
n_type
;
pd
u_session_type_t
pdu_sessio
n_type
;
}
dnn
[
SMF_NUM_DNN_MAX
];
int
num_ue_pool
;
...
...
@@ -298,8 +298,6 @@ class smf_config {
int
load
(
const
std
::
string
&
config_file
);
int
finalize
();
void
display
();
bool
is_dotted_dnn_handled
(
const
std
::
string
&
dnn
,
const
pdn_type_t
&
pdn_type
);
int
get_pfcp_node_id
(
pfcp
::
node_id_t
&
node_id
);
int
get_pfcp_fseid
(
pfcp
::
fseid_t
&
fseid
);
bool
is_dotted_dnn_handled
(
const
std
::
string
&
dnn
,
...
...
src/smf_app/smf_context.cpp
View file @
b3bef24d
...
...
@@ -106,66 +106,70 @@ void smf_qos_flow::deallocate_ressources() {
//------------------------------------------------------------------------------
void
smf_pdu_session
::
set
(
const
paa_t
&
paa
)
{
switch
(
paa
.
pd
n_type
.
pd
n_type
)
{
case
PDN_TYPE_E_IPV4
:
switch
(
paa
.
pd
u_session_type
.
pdu_sessio
n_type
)
{
case
PD
U_SESSIO
N_TYPE_E_IPV4
:
ipv4
=
true
;
ipv6
=
false
;
ipv4_address
=
paa
.
ipv4_address
;
pd
n_type
.
pdn_type
=
paa
.
pdn_type
.
pd
n_type
;
pd
u_session_type
.
pdu_session_type
=
paa
.
pdu_session_type
.
pdu_sessio
n_type
;
break
;
case
PDN_TYPE_E_IPV6
:
case
PD
U_SESSIO
N_TYPE_E_IPV6
:
ipv4
=
false
;
ipv6
=
true
;
ipv6_address
=
paa
.
ipv6_address
;
pd
n_type
.
pdn_type
=
paa
.
pdn_type
.
pd
n_type
;
pd
u_session_type
.
pdu_session_type
=
paa
.
pdu_session_type
.
pdu_sessio
n_type
;
break
;
case
PDN_TYPE_E_IPV4V6
:
case
PD
U_SESSIO
N_TYPE_E_IPV4V6
:
ipv4
=
true
;
ipv6
=
true
;
ipv4_address
=
paa
.
ipv4_address
;
ipv6_address
=
paa
.
ipv6_address
;
pd
n_type
.
pdn_type
=
paa
.
pdn_type
.
pd
n_type
;
pd
u_session_type
.
pdu_session_type
=
paa
.
pdu_session_type
.
pdu_sessio
n_type
;
break
;
case
PDN_TYPE_E_NON_IP
:
case
PDU_SESSION_TYPE_E_UNSTRUCTURED
:
case
PDU_SESSION_TYPE_E_ETHERNET
:
case
PDU_SESSION_TYPE_E_RESERVED
:
ipv4
=
false
;
ipv6
=
false
;
pd
n_type
.
pdn_type
=
paa
.
pdn_type
.
pd
n_type
;
pd
u_session_type
.
pdu_session_type
=
paa
.
pdu_session_type
.
pdu_sessio
n_type
;
break
;
default:
Logger
::
smf_app
().
error
(
"smf_pdu_session::set(paa_t) Unknown PDN type %d"
,
paa
.
pd
n_type
.
pd
n_type
);
paa
.
pd
u_session_type
.
pdu_sessio
n_type
);
}
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
get_paa
(
paa_t
&
paa
)
{
switch
(
pd
n_type
.
pd
n_type
)
{
case
PDN_TYPE_E_IPV4
:
switch
(
pd
u_session_type
.
pdu_sessio
n_type
)
{
case
PD
U_SESSIO
N_TYPE_E_IPV4
:
ipv4
=
true
;
ipv6
=
false
;
paa
.
ipv4_address
=
ipv4_address
;
break
;
case
PDN_TYPE_E_IPV6
:
case
PD
U_SESSIO
N_TYPE_E_IPV6
:
ipv4
=
false
;
ipv6
=
true
;
paa
.
ipv6_address
=
ipv6_address
;
break
;
case
PDN_TYPE_E_IPV4V6
:
case
PD
U_SESSIO
N_TYPE_E_IPV4V6
:
ipv4
=
true
;
ipv6
=
true
;
paa
.
ipv4_address
=
ipv4_address
;
paa
.
ipv6_address
=
ipv6_address
;
break
;
case
PDN_TYPE_E_NON_IP
:
case
PDU_SESSION_TYPE_E_UNSTRUCTURED
:
case
PDU_SESSION_TYPE_E_ETHERNET
:
case
PDU_SESSION_TYPE_E_RESERVED
:
ipv4
=
false
;
ipv6
=
false
;
break
;
default:
Logger
::
smf_app
().
error
(
"smf_pdu_session::get_paa (paa_t) Unknown PDN type %d"
,
pd
n_type
.
pd
n_type
);
pd
u_session_type
.
pdu_sessio
n_type
);
}
paa
.
pd
n_type
.
pdn_type
=
pdn_type
.
pd
n_type
;
paa
.
pd
u_session_type
.
pdu_session_type
=
pdu_session_type
.
pdu_sessio
n_type
;
}
//------------------------------------------------------------------------------
...
...
@@ -361,7 +365,7 @@ std::string smf_pdu_session::toString() const {
smf_qos_flow
flow
=
{
};
s
.
append
(
"PDN CONNECTION:
\n
"
);
s
.
append
(
"
\t
PDN type:
\t\t\t
"
).
append
(
pdn_type
.
toString
()).
append
(
"
\n
"
);
s
.
append
(
"
\t
PDN type:
\t\t\t
"
).
append
(
pd
u_sessio
n_type
.
toString
()).
append
(
"
\n
"
);
if
(
ipv4
)
s
.
append
(
"
\t
PAA IPv4:
\t\t\t
"
).
append
(
conv
::
toString
(
ipv4_address
)).
append
(
"
\n
"
);
...
...
@@ -420,8 +424,8 @@ upCnx_state_e smf_pdu_session::get_upCnx_state() const {
}
//------------------------------------------------------------------------------
pd
n_type_t
smf_pdu_session
::
get_pd
n_type
()
const
{
return
pdn_type
;
pd
u_session_type_t
smf_pdu_session
::
get_pdu_sessio
n_type
()
const
{
return
pd
u_sessio
n_type
;
}
//------------------------------------------------------------------------------
...
...
@@ -737,7 +741,7 @@ void smf_context::handle_itti_msg(
session_report_msg
.
set_snssai
(
sd
.
get
()
->
nssai
);
//s-nssai
session_report_msg
.
set_dnn
(
sd
.
get
()
->
dnn_in_use
);
//dnn
session_report_msg
.
set_pdu_session_type
(
sp
.
get
()
->
get_pd
n_type
().
pd
n_type
);
//pdu session type
sp
.
get
()
->
get_pd
u_session_type
().
pdu_sessio
n_type
);
//pdu session type
//get supi and put into URL
std
::
string
supi_prefix
=
{
};
get_supi_prefix
(
supi_prefix
);
...
...
@@ -1255,7 +1259,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if
(
nullptr
==
sp
.
get
())
{
Logger
::
smf_app
().
debug
(
"Create a new PDU session"
);
sp
=
std
::
shared_ptr
<
smf_pdu_session
>
(
new
smf_pdu_session
());
sp
.
get
()
->
pd
n_type
.
pd
n_type
=
smreq
->
req
.
get_pdu_session_type
();
sp
.
get
()
->
pd
u_session_type
.
pdu_sessio
n_type
=
smreq
->
req
.
get_pdu_session_type
();
sp
.
get
()
->
pdu_session_id
=
pdu_session_id
;
sp
.
get
()
->
amf_id
=
smreq
->
req
.
get_serving_nf_id
();
//amf id
sd
->
insert_pdu_session
(
sp
);
...
...
@@ -1294,8 +1298,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
//Step 7. Address allocation based on PDN type
Logger
::
smf_app
().
debug
(
"UE Address Allocation"
);
switch
(
sp
->
pd
n_type
.
pd
n_type
)
{
case
PDN_TYPE_E_IPV4
:
{
switch
(
sp
->
pd
u_session_type
.
pdu_sessio
n_type
)
{
case
PD
U_SESSIO
N_TYPE_E_IPV4
:
{
if
(
!
pco_ids
.
ci_ipv4_address_allocation_via_dhcpv4
)
{
//use SM NAS signalling
//static or dynamic address allocation
bool
paa_res
=
false
;
//how to define static or dynamic
...
...
@@ -1308,7 +1312,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if
(
nullptr
!=
ss
.
get
())
{
ss
.
get
()
->
find_dnn_configuration
(
sd
->
dnn_in_use
,
sdc
);
if
(
nullptr
!=
sdc
.
get
())
{
paa
.
pd
n_type
.
pd
n_type
=
sdc
.
get
()
->
pdu_session_types
paa
.
pd
u_session_type
.
pdu_sessio
n_type
=
sdc
.
get
()
->
pdu_session_types
.
default_session_type
.
pdu_session_type
;
//TODO: static ip address
}
...
...
@@ -1337,18 +1341,18 @@ void smf_context::handle_pdu_session_create_sm_context_request(
}
break
;
case
PDN_TYPE_E_IPV6
:
{
case
PD
U_SESSIO
N_TYPE_E_IPV6
:
{
//TODO:
}
break
;
case
PDN_TYPE_E_IPV4V6
:
{
case
PD
U_SESSIO
N_TYPE_E_IPV4V6
:
{
//TODO:
}
break
;
default:
Logger
::
smf_app
().
error
(
"Unknown PDN type %d"
,
sp
->
pd
n_type
.
pd
n_type
);
Logger
::
smf_app
().
error
(
"Unknown PDN type %d"
,
sp
->
pd
u_session_type
.
pdu_sessio
n_type
);
problem_details
.
setCause
(
pdu_session_application_error_e2str
[
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_DENIED
]);
smContextCreateError
.
setError
(
problem_details
);
...
...
@@ -1458,15 +1462,17 @@ void smf_context::handle_pdu_session_create_sm_context_request(
paa_t
free_paa
=
{
};
free_paa
=
sm_context_resp
->
res
.
get_paa
();
if
(
free_paa
.
is_ip_assigned
())
{
switch
(
sp
->
pd
n_type
.
pd
n_type
)
{
case
PDN_TYPE_E_IPV4
:
case
PDN_TYPE_E_IPV4V6
:
switch
(
sp
->
pd
u_session_type
.
pdu_sessio
n_type
)
{
case
PD
U_SESSIO
N_TYPE_E_IPV4
:
case
PD
U_SESSIO
N_TYPE_E_IPV4V6
:
paa_dynamic
::
get_instance
().
release_paa
(
sd
->
dnn_in_use
,
free_paa
.
ipv4_address
);
break
;
case
PDN_TYPE_E_IPV6
:
case
PDN_TYPE_E_NON_IP
:
case
PDU_SESSION_TYPE_E_IPV6
:
case
PDU_SESSION_TYPE_E_UNSTRUCTURED
:
case
PDU_SESSION_TYPE_E_ETHERNET
:
case
PDU_SESSION_TYPE_E_RESERVED
:
default:
;
}
...
...
@@ -1583,7 +1589,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
n11_sm_context_resp
->
res
.
set_snssai
(
sm_context_req_msg
.
get_snssai
());
n11_sm_context_resp
->
res
.
set_dnn
(
sm_context_req_msg
.
get_dnn
());
n11_sm_context_resp
->
res
.
set_pdu_session_type
(
sp
.
get
()
->
get_pd
n_type
().
pd
n_type
);
sp
.
get
()
->
get_pd
u_session_type
().
pdu_sessio
n_type
);
//Step 2.1. Decode N1 (if content is available)
if
(
sm_context_req_msg
.
n1_sm_msg_is_set
())
{
...
...
src/smf_app/smf_context.hpp
View file @
b3bef24d
...
...
@@ -130,7 +130,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
ipv6
=
false
;
ipv4_address
.
s_addr
=
INADDR_ANY
;
ipv6_address
=
in6addr_any
;
pdn_type
=
{
};
pd
u_sessio
n_type
=
{
};
seid
=
0
;
up_fseid
=
{
};
qos_flows
.
clear
();
...
...
@@ -392,15 +392,15 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
/*
* Get PDN Type of this PDU session
* @param void
* @return pdn_type_t: PDN Type
* @return pd
u_sessio
n_type_t: PDN Type
*/
pd
n_type_t
get_pd
n_type
()
const
;
pd
u_session_type_t
get_pdu_sessio
n_type
()
const
;
bool
ipv4
;
// IP Address(es): IPv4 address and/or IPv6 prefix
bool
ipv6
;
// IP Address(es): IPv4 address and/or IPv6 prefix
struct
in_addr
ipv4_address
;
// IP Address(es): IPv4 address and/or IPv6 prefix
struct
in6_addr
ipv6_address
;
// IP Address(es): IPv4 address and/or IPv6 prefix
pd
n_type_t
pd
n_type
;
// IPv4, IPv6, IPv4v6 or Non-IP
pd
u_session_type_t
pdu_sessio
n_type
;
// IPv4, IPv6, IPv4v6 or Non-IP
bool
released
;
//(release access bearers request)
...
...
src/smf_app/smf_paa_dynamic.hpp
View file @
b3bef24d
...
...
@@ -240,17 +240,17 @@ class paa_dynamic {
bool
get_free_paa
(
const
std
::
string
&
dnn_label
,
paa_t
&
paa
)
{
if
(
dnns
.
count
(
dnn_label
))
{
dnn_dynamic_pools
&
dnn_pool
=
dnns
[
dnn_label
];
if
(
paa
.
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV4
)
{
if
(
paa
.
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV4
)
{
for
(
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
dnn_pool
.
ipv4_pool_ids
.
begin
();
it4
!=
dnn_pool
.
ipv4_pool_ids
.
end
();
++
it4
)
{
if
(
ipv4_pools
[
*
it4
].
alloc_address
(
paa
.
ipv4_address
))
{
return
true
;
}
}
Logger
::
smf_app
().
warn
(
"Could not get PAA PDN_TYPE_E_IPV4 for DNN %s"
,
Logger
::
smf_app
().
warn
(
"Could not get PAA PD
U_SESSIO
N_TYPE_E_IPV4 for DNN %s"
,
dnn_label
.
c_str
());
return
false
;
}
else
if
(
paa
.
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV4V6
)
{
}
else
if
(
paa
.
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV4V6
)
{
bool
success
=
false
;
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
{
};
for
(
it4
=
dnn_pool
.
ipv4_pool_ids
.
begin
();
...
...
@@ -269,17 +269,17 @@ class paa_dynamic {
}
ipv4_pools
[
*
it4
].
free_address
(
paa
.
ipv4_address
);
}
Logger
::
smf_app
().
warn
(
"Could not get PAA PDN_TYPE_E_IPV4V6 for DNN %s"
,
Logger
::
smf_app
().
warn
(
"Could not get PAA PD
U_SESSIO
N_TYPE_E_IPV4V6 for DNN %s"
,
dnn_label
.
c_str
());
return
false
;
}
else
if
(
paa
.
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV6
)
{
}
else
if
(
paa
.
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV6
)
{
for
(
std
::
vector
<
uint32_t
>::
const_iterator
it6
=
dnn_pool
.
ipv6_pool_ids
.
begin
();
it6
!=
dnn_pool
.
ipv6_pool_ids
.
end
();
++
it6
)
{
if
(
ipv6_pools
[
*
it6
].
alloc_address
(
paa
.
ipv6_address
))
{
return
true
;
}
}
Logger
::
smf_app
().
warn
(
"Could not get PAA PDN_TYPE_E_IPV6 for DNN %s"
,
Logger
::
smf_app
().
warn
(
"Could not get PAA PD
U_SESSIO
N_TYPE_E_IPV6 for DNN %s"
,
dnn_label
.
c_str
());
return
false
;
}
...
...
@@ -291,7 +291,7 @@ class paa_dynamic {
bool
release_paa
(
const
std
::
string
&
dnn_label
,
const
paa_t
&
paa
)
{
if
(
dnns
.
count
(
dnn_label
))
{
dnn_dynamic_pools
&
dnn_pool
=
dnns
[
dnn_label
];
if
(
paa
.
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV4
)
{
if
(
paa
.
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV4
)
{
for
(
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
dnn_pool
.
ipv4_pool_ids
.
begin
();
it4
!=
dnn_pool
.
ipv4_pool_ids
.
end
();
++
it4
)
{
if
(
ipv4_pools
[
*
it4
].
free_address
(
paa
.
ipv4_address
))
{
...
...
@@ -299,7 +299,7 @@ class paa_dynamic {
}
}
return
false
;
}
else
if
(
paa
.
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV4V6
)
{
}
else
if
(
paa
.
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV4V6
)
{
bool
success
=
false
;
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
{
};
for
(
it4
=
dnn_pool
.
ipv4_pool_ids
.
begin
();
...
...
@@ -309,7 +309,7 @@ class paa_dynamic {
}
}
return
false
;
}
else
if
(
paa
.
pd
n_type
.
pdn_type
==
PD
N_TYPE_E_IPV6
)
{
}
else
if
(
paa
.
pd
u_session_type
.
pdu_session_type
==
PDU_SESSIO
N_TYPE_E_IPV6
)
{
return
true
;
}
}
...
...
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