@ -291,14 +291,14 @@ static void encode_qos_rule_packet_filter(
}
}
ogs_pkbuf_t * gsm_build_qos_flow _modification_command (
smf_bearer_t * qos_flow , uint8_t pti ,
ogs_pkbuf_t * gsm_build_pdu_session _modification_command (
smf_sess_t * sess , uint8_t pti ,
uint8_t qos_rule_code , uint8_t qos_flow_description_code )
{
ogs_pkbuf_t * pkbuf = NULL ;
smf_sess_t * sess = NULL ;
smf_bearer_t * qos_flow = NULL ;
ogs_pfcp_pdr_t * dl_pdr = NULL ;
int num_of_param , rv ;
int num_of_param , rv , i ;
ogs_nas_5gs_message_t message ;
ogs_nas_5gs_pdu_session_modification_command_t
@ -319,11 +319,7 @@ ogs_pkbuf_t *gsm_build_qos_flow_modification_command(
& pdu_session_modification_command - > authorized_qos_flow_descriptions ;
ogs_assert ( authorized_qos_flow_descriptions ) ;
ogs_assert ( qos_flow ) ;
sess = qos_flow - > sess ;
ogs_assert ( sess ) ;
dl_pdr = qos_flow - > dl_pdr ;
ogs_assert ( dl_pdr ) ;
memset ( & message , 0 , sizeof ( message ) ) ;
message . gsm . h . extended_protocol_discriminator =
@ -334,26 +330,39 @@ ogs_pkbuf_t *gsm_build_qos_flow_modification_command(
/* QoS rule */
if ( qos_rule_code ) {
i = 0 ;
memset ( qos_rule , 0 , sizeof ( qos_rule ) ) ;
qos_rule [ 0 ] . identifier = qos_flow - > qfi ; /* Use QFI in Open5GS */
qos_rule [ 0 ] . code = qos_rule_code ;
if ( qos_rule_code ! = OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE & &
qos_rule_code ! = OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS )
encode_qos_rule_packet_filter ( & qos_rule [ 0 ] , qos_flow ) ;
if ( qos_rule_code ! = OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE & &
qos_rule_code ! = OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS & &
qos_rule_code ! = OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS ) {
ogs_assert ( dl_pdr - > precedence > 0 & & dl_pdr - > precedence < 255 ) ;
/* Use PCC Rule Precedence */
qos_rule [ 0 ] . precedence = dl_pdr - > precedence ;
qos_rule [ 0 ] . flow . segregation = 0 ;
qos_rule [ 0 ] . flow . identifier = qos_flow - > qfi ;
ogs_list_for_each_entry (
& sess - > qos_flow_to_modify_list , qos_flow , to_modify_node ) {
ogs_assert ( i < OGS_MAX_NUM_OF_BEARER ) ;
dl_pdr = qos_flow - > dl_pdr ;
ogs_assert ( dl_pdr ) ;
qos_rule [ i ] . identifier = qos_flow - > qfi ; /* Use QFI in Open5GS */
qos_rule [ i ] . code = qos_rule_code ;
if ( qos_rule_code ! = OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE & &
qos_rule_code ! = OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS )
encode_qos_rule_packet_filter ( & qos_rule [ i ] , qos_flow ) ;
if ( qos_rule_code ! = OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE & &
qos_rule_code ! = OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS & &
qos_rule_code ! = OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS ) {
ogs_assert ( dl_pdr - > precedence > 0 & & dl_pdr - > precedence < 255 ) ;
/* Use PCC Rule Precedence */
qos_rule [ i ] . precedence = dl_pdr - > precedence ;
qos_rule [ i ] . flow . segregation = 0 ;
qos_rule [ i ] . flow . identifier = qos_flow - > qfi ;
}
i + + ;
}
rv = ogs_nas_build_qos_rules ( authorized_qos_rules , qos_rule , 1 ) ;
rv = ogs_nas_build_qos_rules ( authorized_qos_rules , qos_rule , i ) ;
ogs_expect_or_return_val ( rv = = OGS_OK , NULL ) ;
ogs_expect_or_return_val ( authorized_qos_rules - > length , NULL ) ;
@ -363,69 +372,81 @@ ogs_pkbuf_t *gsm_build_qos_flow_modification_command(
/* QoS flow descriptions */
if ( qos_flow_description_code ) {
i = 0 ;
memset ( & qos_flow_description , 0 , sizeof ( qos_flow_description ) ) ;
qos_flow_description [ 0 ] . identifier = qos_flow - > qfi ;
qos_flow_description [ 0 ] . code = qos_flow_description_code ;
num_of_param = 0 ;
if ( qos_flow_description_code ! = OGS_NAS_DELETE_NEW_QOS_FLOW_DESCRIPTION ) {
qos_flow_description [ 0 ] . E_bit = 1 ;
qos_flow_description [ 0 ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI ;
qos_flow_description [ 0 ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ 0 ] . param [ num_of_param ] . qos_index ) ;
qos_flow_description [ 0 ] . param [ num_of_param ] . qos_index =
qos_flow - > qos . index ;
num_of_param + + ;
if ( qos_flow - > qos . gbr . uplink ) {
qos_flow_description [ 0 ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_UPLINK ;
qos_flow_description [ 0 ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ 0 ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ 0 ] . param [ num_of_param ] . br ,
qos_flow - > qos . gbr . uplink ) ;
num_of_param + + ;
}
if ( qos_flow - > qos . gbr . downlink ) {
qos_flow_description [ 0 ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK ;
qos_flow_description [ 0 ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ 0 ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ 0 ] . param [ num_of_param ] . br ,
qos_flow - > qos . gbr . downlink ) ;
num_of_param + + ;
}
if ( qos_flow - > qos . mbr . uplink ) {
qos_flow_description [ 0 ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK ;
qos_flow_description [ 0 ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ 0 ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ 0 ] . param [ num_of_param ] . br ,
qos_flow - > qos . mbr . uplink ) ;
num_of_param + + ;
}
if ( qos_flow - > qos . mbr . downlink ) {
qos_flow_description [ 0 ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK ;
qos_flow_description [ 0 ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ 0 ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ 0 ] . param [ num_of_param ] . br ,
qos_flow - > qos . mbr . downlink ) ;
ogs_list_for_each_entry (
& sess - > qos_flow_to_modify_list , qos_flow , to_modify_node ) {
ogs_assert ( i < OGS_MAX_NUM_OF_BEARER ) ;
qos_flow_description [ i ] . identifier = qos_flow - > qfi ;
qos_flow_description [ i ] . code = qos_flow_description_code ;
num_of_param = 0 ;
if ( qos_flow_description_code ! =
OGS_NAS_DELETE_NEW_QOS_FLOW_DESCRIPTION ) {
qos_flow_description [ i ] . E_bit = 1 ;
qos_flow_description [ i ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI ;
qos_flow_description [ i ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ i ] . param [ num_of_param ] .
qos_index ) ;
qos_flow_description [ i ] . param [ num_of_param ] . qos_index =
qos_flow - > qos . index ;
num_of_param + + ;
if ( qos_flow - > qos . gbr . uplink ) {
qos_flow_description [ i ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_UPLINK ;
qos_flow_description [ i ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ i ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ i ] . param [ num_of_param ] . br ,
qos_flow - > qos . gbr . uplink ) ;
num_of_param + + ;
}
if ( qos_flow - > qos . gbr . downlink ) {
qos_flow_description [ i ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK ;
qos_flow_description [ i ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ i ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ i ] . param [ num_of_param ] . br ,
qos_flow - > qos . gbr . downlink ) ;
num_of_param + + ;
}
if ( qos_flow - > qos . mbr . uplink ) {
qos_flow_description [ i ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK ;
qos_flow_description [ i ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ i ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ i ] . param [ num_of_param ] . br ,
qos_flow - > qos . mbr . uplink ) ;
num_of_param + + ;
}
if ( qos_flow - > qos . mbr . downlink ) {
qos_flow_description [ i ] . param [ num_of_param ] . identifier =
OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK ;
qos_flow_description [ i ] . param [ num_of_param ] . len =
sizeof ( qos_flow_description [ i ] . param [ num_of_param ] . br ) ;
ogs_nas_bitrate_from_uint64 (
& qos_flow_description [ i ] . param [ num_of_param ] . br ,
qos_flow - > qos . mbr . downlink ) ;
num_of_param + + ;
}
}
}
qos_flow_description [ 0 ] . num_of_parameter = num_of_param ;
qos_flow_description [ i ] . num_of_parameter = num_of_param ;
i + + ;
}
rv = ogs_nas_build_qos_flow_descriptions (
authorized_qos_flow_descriptions , qos_flow_description , 1 ) ;
authorized_qos_flow_descriptions , qos_flow_description , i ) ;
ogs_expect_or_return_val ( rv = = OGS_OK , NULL ) ;
ogs_expect_or_return_val (
authorized_qos_flow_descriptions - > length , NULL ) ;