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
3971b89e
Commit
3971b89e
authored
Apr 01, 2019
by
gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operator == for struct ebi
parent
91343e3d
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
74 additions
and
64 deletions
+74
-64
src/common/3gpp_29.274.h
src/common/3gpp_29.274.h
+54
-13
src/gtpv2c/3gpp_29.274.cpp
src/gtpv2c/3gpp_29.274.cpp
+1
-30
src/gtpv2c/msg_gtpv2c.hpp
src/gtpv2c/msg_gtpv2c.hpp
+2
-2
src/pgwc/pgw_context.cpp
src/pgwc/pgw_context.cpp
+6
-6
src/pgwc/pgw_context.hpp
src/pgwc/pgw_context.hpp
+1
-1
src/pgwc/pgwc_procedure.cpp
src/pgwc/pgwc_procedure.cpp
+1
-1
src/sgwc/sgwc_eps_bearer_context.cpp
src/sgwc/sgwc_eps_bearer_context.cpp
+1
-1
src/sgwc/sgwc_eps_bearer_context.hpp
src/sgwc/sgwc_eps_bearer_context.hpp
+4
-6
src/sgwc/sgwc_procedure.cpp
src/sgwc/sgwc_procedure.cpp
+4
-4
No files found.
src/common/3gpp_29.274.h
View file @
3971b89e
...
...
@@ -559,8 +559,12 @@ typedef struct ambr_s {
typedef
struct
ebi_s
{
uint8_t
ebi
;
inline
bool
operator
==
(
const
struct
ebi_s
&
rhs
){
return
ebi
==
rhs
.
ebi
;
}
inline
bool
operator
!=
(
const
struct
ebi_s
&
rhs
){
return
!
(
ebi
==
rhs
.
ebi
);
}
ebi_s
()
:
ebi
(
EPS_BEARER_IDENTITY_UNASSIGNED
)
{}
ebi_s
(
const
uint8_t
&
e
)
:
ebi
(
e
)
{}
ebi_s
(
const
struct
ebi_s
&
e
)
:
ebi
(
e
.
ebi
)
{}
inline
bool
operator
==
(
const
struct
ebi_s
&
rhs
)
const
{
return
ebi
==
rhs
.
ebi
;
}
inline
bool
operator
!=
(
const
struct
ebi_s
&
rhs
)
const
{
return
!
(
ebi
==
rhs
.
ebi
);
}
}
ebi_t
;
//-------------------------------------
// 8.9 IP Address
...
...
@@ -706,20 +710,59 @@ static const std::vector<std::string> pdn_type_e2str = {"Error", "IPV4", "IPV6",
typedef
struct
pdn_type_s
{
uint8_t
pdn_type
;
bool
operator
==
(
const
struct
pdn_type_s
&
p
)
const
{
return
(
p
.
pdn_type
==
pdn_type
);
}
//------------------------------------------------------------------------------
bool
operator
==
(
const
pdn_type_e
&
p
)
const
{
return
(
p
==
pdn_type
);
}
//------------------------------------------------------------------------------
const
std
::
string
&
toString
()
const
{
return
pdn_type_e2str
.
at
(
pdn_type
);}
}
pdn_type_t
;
//-------------------------------------
// 8.14 PDN Address Allocation (PAA)
typedef
struct
paa_s
{
struct
paa_s
{
pdn_type_t
pdn_type
;
uint8_t
ipv6_prefix_length
;
struct
in6_addr
ipv6_address
;
struct
in_addr
ipv4_address
;
}
paa_t
;
bool
is_paa_ip_assigned
(
const
paa_t
&
paa
);
//------------------------------------------------------------------------------
bool
is_ip_assigned
()
{
switch
(
pdn_type
.
pdn_type
)
{
case
PDN_TYPE_E_IPV4
:
if
(
ipv4_address
.
s_addr
)
return
true
;
return
false
;
break
;
case
PDN_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
PDN_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
PDN_TYPE_E_NON_IP
:
default:
return
false
;
}
}
};
typedef
struct
paa_s
paa_t
;
//-------------------------------------
// 8.15 Bearer Quality of Service (Bearer QoS)
#define PRE_EMPTION_CAPABILITY_ENABLED (0x0)
...
...
@@ -739,14 +782,12 @@ typedef struct bearer_qos_s {
uint64_t
guaranted_bit_rate_for_uplink
;
uint64_t
guaranted_bit_rate_for_downlink
;
bool
is_arp_equals
(
const
struct
bearer_qos_s
&
q
)
const
{
if
((
q
.
label_qci
==
label_qci
)
&&
bool
operator
==
(
const
struct
bearer_qos_s
&
q
)
const
{
return
((
q
.
label_qci
==
label_qci
)
&&
(
q
.
pl
==
pl
)
&&
(
q
.
pvi
==
pvi
)
&&
(
q
.
pci
==
pci
))
{
return
true
;
}
return
false
;
(
q
.
pci
==
pci
));
}
//------------------------------------------------------------------------------
std
::
string
toString
()
const
...
...
src/gtpv2c/3gpp_29.274.cpp
View file @
3971b89e
...
...
@@ -848,34 +848,5 @@ gtpv2c_msg::gtpv2c_msg(const gtpv2c_echo_response& gtp_ies) : gtpv2c_msg_header(
if
(
gtp_ies
.
recovery_restart_counter
.
first
)
{
std
::
shared_ptr
<
gtpv2c_recovery_ie
>
sie
(
new
gtpv2c_recovery_ie
(
gtp_ies
.
recovery_restart_counter
.
second
));
add_ie
(
sie
);}
if
(
gtp_ies
.
sending_node_features
.
first
)
{
std
::
shared_ptr
<
gtpv2c_node_features_ie
>
sie
(
new
gtpv2c_node_features_ie
(
gtp_ies
.
sending_node_features
.
second
));
add_ie
(
sie
);}
}
//------------------------------------------------------------------------------
bool
is_paa_ip_assigned
(
const
paa_t
&
paa
)
{
switch
(
paa
.
pdn_type
.
pdn_type
)
{
case
PDN_TYPE_E_IPV4
:
if
(
paa
.
ipv4_address
.
s_addr
)
return
true
;
return
false
;
break
;
case
PDN_TYPE_E_IPV6
:
if
(
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
0
]
|
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
1
]
|
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
2
]
|
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
3
])
return
true
;
return
false
;
break
;
case
PDN_TYPE_E_IPV4V6
:
// TODO
if
(
paa
.
ipv4_address
.
s_addr
)
return
true
;
if
(
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
0
]
|
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
1
]
|
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
2
]
|
paa
.
ipv6_address
.
__in6_u
.
__u6_addr32
[
3
])
return
true
;
return
false
;
break
;
case
PDN_TYPE_E_NON_IP
:
default:
return
false
;
}
}
src/gtpv2c/msg_gtpv2c.hpp
View file @
3971b89e
...
...
@@ -922,7 +922,7 @@ public:
pdn_type
.
pdn_type
=
0
;
rat_type
.
rat_type
=
RAT_TYPE_E_UTRAN
;
selection_mode
.
selec_mode
=
SELECTION_MODE_E_MS_OR_NETWORK_PROVIDED_APN_SUBSCRIPTION_VERIFIED
;
linked_eps_bearer_id
.
ebi
=
EPS_BEARER_IDENTITY_UNASSIGNED
;
linked_eps_bearer_id
=
EPS_BEARER_IDENTITY_UNASSIGNED
;
}
gtpv2c_create_session_request
(
const
gtpv2c_create_session_request
&
i
)
:
ie_presence_mask
(
i
.
ie_presence_mask
),
...
...
@@ -2229,7 +2229,7 @@ public:
if
(
b
.
get
(
s11_u_mme_fteid
,
4
))
ie_presence_mask
|=
GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_S11_U_MME_FTEID
;
}
static
bool
predic_same_eps_bearer_id
(
const
bearer_context_to_be_modified_within_modify_bearer_request
&
b1
,
const
bearer_context_to_be_modified_within_modify_bearer_request
&
b2
)
{
return
(
b1
.
eps_bearer_id
.
ebi
==
b2
.
eps_bearer_id
.
ebi
);
return
(
b1
.
eps_bearer_id
==
b2
.
eps_bearer_id
);
}
};
...
...
src/pgwc/pgw_context.cpp
View file @
3971b89e
...
...
@@ -457,7 +457,7 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
// // TODO: remove this code if SPGW split (only for TAU/HO procedures)
// for (auto it : csreq->gtp_ies.bearer_contexts_to_be_removed) {
// pgw_eps_bearer& eps_bearer = sp->get_eps_bearer(it.eps_bearer_id);
// if (eps_bearer
.ebi.ebi == it.eps_bearer_id.ebi
) {
// if (eps_bearer
== it.eps_bearer_id
) {
// cause_t bcc_cause = {.cause_value = REQUEST_ACCEPTED, .pce = 0, .bce = 0, .cs = 0};
// bearer_context_marked_for_removal_within_create_session_response bcc = {};
// bcc.set(eps_bearer.ebi);
...
...
@@ -482,7 +482,7 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
// if (cause.cause_value == REQUEST_ACCEPTED) {
// paa.pdn_type = sp->pdn_type;
// bool paa_res = csreq->gtp_ies.get(paa);
// if ((not paa_res) || (not is_paa_ip_assigned(paa
))) {
// if ((not paa_res) || (not paa.is_ip_assigned(
))) {
// int ret = paa_dynamic::get_instance().get_free_paa (sa->apn_in_use, paa);
// if (ret == RETURNok) {
// set_paa = true;
...
...
@@ -529,7 +529,7 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
// implement different logic between the PDN types.
if
(
!
pco_ids
.
ci_ipv4_address_allocation_via_dhcpv4
)
{
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
not
paa_res
)
||
(
not
is_paa_ip_assigned
(
paa
)))
{
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
(
)))
{
int
ret
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
ret
==
RETURNok
)
{
set_paa
=
true
;
...
...
@@ -546,7 +546,7 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
case
PDN_TYPE_E_IPV6
:
{
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
not
paa_res
)
||
(
not
is_paa_ip_assigned
(
paa
)))
{
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
(
)))
{
int
ret
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
ret
==
RETURNok
)
{
set_paa
=
true
;
...
...
@@ -560,7 +560,7 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
case
PDN_TYPE_E_IPV4V6
:
{
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
not
paa_res
)
||
(
not
is_paa_ip_assigned
(
paa
)))
{
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
(
)))
{
int
ret
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
ret
==
RETURNok
)
{
set_paa
=
true
;
...
...
@@ -603,7 +603,7 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
}
else
{
// Valid PAA sent in CSR ?
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
paa_res
)
&&
(
is_paa_ip_assigned
(
paa
)))
{
if
((
paa_res
)
&&
(
paa
.
is_ip_assigned
(
)))
{
sp
->
set
(
paa
);
}
}
...
...
src/pgwc/pgw_context.hpp
View file @
3971b89e
...
...
@@ -149,7 +149,7 @@ public:
}
bool
get_eps_bearer
(
const
ebi_t
&
ebi
,
pgw_eps_bearer
&
b
)
{
for
(
auto
it
:
eps_bearers
)
{
if
(
it
.
second
.
ebi
.
ebi
==
ebi
.
ebi
)
{
if
(
it
.
second
.
ebi
==
ebi
)
{
b
=
it
.
second
;
return
true
;
}
...
...
src/pgwc/pgwc_procedure.cpp
View file @
3971b89e
...
...
@@ -731,7 +731,7 @@ void modify_bearer_procedure::handle_itti_msg (itti_sxab_session_modification_re
if
(
ppc
->
get_eps_bearer
(
far_id
,
b
))
{
for
(
std
::
vector
<
gtpv2c
::
bearer_context_to_be_modified_within_modify_bearer_request
>::
const_iterator
it_to_be_mod
=
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
.
begin
();
it_to_be_mod
!=
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
.
end
();
++
it_to_be_mod
)
{
if
(
it_to_be_mod
->
eps_bearer_id
.
ebi
==
b
.
ebi
.
ebi
)
{
if
(
it_to_be_mod
->
eps_bearer_id
==
b
.
ebi
)
{
it_to_be_mod
->
get_s5_s8_u_sgw_fteid
(
b
.
sgw_fteid_s5_s8_up
);
it_to_be_mod
->
get_s1_u_enb_fteid
(
b
.
sgw_fteid_s5_s8_up
);
pgw_eps_bearer
b2
=
b
;
...
...
src/sgwc/sgwc_eps_bearer_context.cpp
View file @
3971b89e
...
...
@@ -106,7 +106,7 @@ bool sgw_eps_bearer_context::find_pdn_connection(const std::string& apn, const p
bool
sgw_eps_bearer_context
::
find_pdn_connection
(
const
ebi_t
&
ebi
,
std
::
shared_ptr
<
sgw_pdn_connection
>
&
sp
)
{
for
(
auto
it
=
pdn_connections
.
begin
();
it
!=
pdn_connections
.
end
();
++
it
)
{
if
(
it
->
second
.
get
()
->
default_bearer
.
ebi
==
ebi
.
ebi
)
{
if
(
it
->
second
.
get
()
->
default_bearer
==
ebi
)
{
sp
=
it
->
second
;
return
true
;
}
...
...
src/sgwc/sgwc_eps_bearer_context.hpp
View file @
3971b89e
...
...
@@ -42,8 +42,7 @@ namespace sgwc {
class
sgw_eps_bearer
{
public:
sgw_eps_bearer
()
{
ebi
.
ebi
=
EPS_BEARER_IDENTITY_UNASSIGNED
;
sgw_eps_bearer
()
:
ebi
()
{
tft
=
{};
pgw_fteid_s5_s8_up
=
{};
sgw_fteid_s5_s8_up
=
{};
...
...
@@ -54,8 +53,7 @@ public:
eps_bearer_qos
=
{};
}
sgw_eps_bearer
(
const
sgw_eps_bearer
&
b
)
{
ebi
.
ebi
=
b
.
ebi
.
ebi
;
sgw_eps_bearer
(
const
sgw_eps_bearer
&
b
)
:
ebi
(
b
.
ebi
)
{
tft
=
b
.
tft
;
pgw_fteid_s5_s8_up
=
b
.
pgw_fteid_s5_s8_up
;
sgw_fteid_s5_s8_up
=
b
.
sgw_fteid_s5_s8_up
;
...
...
@@ -80,7 +78,7 @@ public:
bool
update
(
const
gtpv2c
::
bearer_context_modified_within_modify_bearer_response
&
b
)
{
ebi_t
check_ebi
=
{};
if
((
b
.
get
(
check_ebi
))
&&
(
check_ebi
.
ebi
==
ebi
.
ebi
))
{
if
((
b
.
get
(
check_ebi
))
&&
(
check_ebi
==
ebi
))
{
b
.
get_s1_u_sgw_fteid
(
sgw_fteid_s1u_s12_s4u_s11u
);
return
true
;
}
...
...
src/sgwc/sgwc_procedure.cpp
View file @
3971b89e
...
...
@@ -549,7 +549,7 @@ void modify_bearer_request_procedure::handle_itti_msg (itti_s5s8_modify_bearer_r
for
(
auto
it_modified
:
s5resp
.
gtp_ies
.
bearer_contexts_modified
.
second
)
{
for
(
std
::
vector
<
gtpv2c
::
bearer_context_to_be_modified_within_modify_bearer_request
>::
iterator
it_to_be_modified
=
px
->
bearer_contexts_to_be_modified
.
begin
()
;
it_to_be_modified
!=
px
->
bearer_contexts_to_be_modified
.
end
();
++
it_to_be_modified
)
{
if
(
it_to_be_modified
->
eps_bearer_id
.
ebi
==
it_modified
.
eps_bearer_id
.
second
.
ebi
)
{
if
(
it_to_be_modified
->
eps_bearer_id
==
it_modified
.
eps_bearer_id
.
second
)
{
#define SPGW_PLIT 0
#if !SPGW_SPLIT
it_modified
.
s1_u_sgw_fteid
.
second
.
interface_type
=
S1_U_SGW_GTP_U
;
...
...
@@ -565,7 +565,7 @@ void modify_bearer_request_procedure::handle_itti_msg (itti_s5s8_modify_bearer_r
for
(
auto
it_marked
:
s5resp
.
gtp_ies
.
bearer_contexts_marked_for_removal
.
second
)
{
for
(
std
::
vector
<
gtpv2c
::
bearer_context_to_be_removed_within_modify_bearer_request
>::
iterator
it_to_be_removed
=
px
->
bearer_contexts_to_be_removed
.
begin
()
;
it_to_be_removed
!=
px
->
bearer_contexts_to_be_removed
.
end
();
++
it_to_be_removed
)
{
if
(
it_to_be_removed
->
eps_bearer_id
.
ebi
==
it_marked
.
eps_bearer_id
.
second
.
ebi
)
{
if
(
it_to_be_removed
->
eps_bearer_id
==
it_marked
.
eps_bearer_id
.
second
)
{
bearer_contexts_marked_for_removal
.
push_back
(
it_marked
);
px
->
bearer_contexts_to_be_removed
.
erase
(
it_to_be_removed
);
break
;
...
...
@@ -586,7 +586,7 @@ void modify_bearer_request_procedure::handle_itti_msg (itti_s5s8_modify_bearer_r
for
(
auto
it_to_be_modified
:
msg
.
gtp_ies
.
bearer_contexts_to_be_modified
)
{
bool
bearer_found
=
false
;
for
(
auto
it_modified
:
bearer_contexts_modified
)
{
if
(
it_modified
.
eps_bearer_id
.
second
.
ebi
==
it_to_be_modified
.
eps_bearer_id
.
ebi
)
{
if
(
it_modified
.
eps_bearer_id
.
second
==
it_to_be_modified
.
eps_bearer_id
)
{
pdn
->
update_eps_bearer
(
it_modified
);
s11_resp
->
gtp_ies
.
add_bearer_context_modified
(
it_modified
);
bearer_found
=
true
;
...
...
@@ -612,7 +612,7 @@ void modify_bearer_request_procedure::handle_itti_msg (itti_s5s8_modify_bearer_r
for
(
auto
it_to_be_removed
:
msg
.
gtp_ies
.
bearer_contexts_to_be_removed
)
{
bool
bearer_found
=
false
;
for
(
auto
it_marked
:
bearer_contexts_marked_for_removal
)
{
if
(
it_marked
.
eps_bearer_id
.
second
.
ebi
==
it_to_be_removed
.
eps_bearer_id
.
ebi
)
{
if
(
it_marked
.
eps_bearer_id
.
second
==
it_to_be_removed
.
eps_bearer_id
)
{
pdn
->
remove_eps_bearer
(
it_marked
.
eps_bearer_id
.
second
);
s11_resp
->
gtp_ies
.
add_bearer_context_marked_for_removal
(
it_marked
);
bearer_found
=
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