forked from acouzens/open5gs
Merge branch 'aseaudi-sigscale-ocs'
This commit is contained in:
commit
125740727e
|
@ -40,6 +40,7 @@ extern "C" {
|
|||
#define OGS_DIAM_AUTHORIZATION_REJECTED 5003
|
||||
#define OGS_DIAM_MISSING_AVP 5004
|
||||
#define OGS_DIAM_INVALID_AVP_VALUE 5005
|
||||
#define OGS_DIAM_USER_UNKNOWN 5030
|
||||
|
||||
extern struct dict_object *ogs_diam_session_id;
|
||||
extern struct dict_object *ogs_diam_termination_cause;
|
||||
|
|
|
@ -160,7 +160,6 @@ void smf_gy_handle_cca_update_request(
|
|||
ogs_pfcp_measurement_method_t prev_meas_method;
|
||||
ogs_pfcp_reporting_triggers_t prev_rep_triggers;
|
||||
ogs_pfcp_quota_validity_time_t prev_quota_validity_time;
|
||||
ogs_pfcp_volume_quota_t prev_vol_quota;
|
||||
ogs_pfcp_time_quota_t prev_time_quota;
|
||||
ogs_pfcp_volume_threshold_t prev_vol_threshold;
|
||||
ogs_pfcp_time_threshold_t prev_time_threshold;
|
||||
|
@ -190,17 +189,19 @@ void smf_gy_handle_cca_update_request(
|
|||
prev_meas_method = urr->meas_method;
|
||||
prev_rep_triggers = urr->rep_triggers;
|
||||
prev_quota_validity_time = urr->quota_validity_time;
|
||||
prev_vol_quota = urr->vol_quota;
|
||||
prev_time_quota = urr->time_quota;
|
||||
prev_vol_threshold = urr->vol_threshold;
|
||||
prev_time_threshold = urr->time_threshold;
|
||||
|
||||
urr_update_time(sess, urr, gy_message);
|
||||
urr_update_volume(sess, urr, gy_message);
|
||||
/* Associate accounting URR each direction PDR: */
|
||||
ogs_pfcp_pdr_associate_urr(bearer->ul_pdr, urr);
|
||||
ogs_pfcp_pdr_associate_urr(bearer->dl_pdr, urr);
|
||||
|
||||
if (urr->meas_method != prev_meas_method)
|
||||
modify_flags |= OGS_PFCP_MODIFY_URR_MEAS_METHOD;
|
||||
|
||||
if (urr->rep_triggers.quota_validity_time != prev_rep_triggers.quota_validity_time ||
|
||||
urr->rep_triggers.time_quota != prev_rep_triggers.time_quota ||
|
||||
urr->rep_triggers.volume_quota != prev_rep_triggers.volume_quota ||
|
||||
|
@ -214,8 +215,7 @@ void smf_gy_handle_cca_update_request(
|
|||
if (urr->time_quota != prev_time_quota)
|
||||
modify_flags |= OGS_PFCP_MODIFY_URR_TIME_QUOTA;
|
||||
|
||||
if (urr->vol_quota.tovol != prev_vol_quota.tovol ||
|
||||
urr->vol_quota.total_volume != prev_vol_quota.total_volume)
|
||||
if (urr->vol_quota.tovol || urr->vol_quota.total_volume)
|
||||
modify_flags |= OGS_PFCP_MODIFY_URR_VOLUME_QUOTA;
|
||||
|
||||
if (urr->time_threshold != prev_time_threshold)
|
||||
|
|
|
@ -110,7 +110,16 @@ static void fill_multiple_services_credit_control_ccr(smf_sess_t *sess,
|
|||
|
||||
/* CC-Time, RFC4006 8.21 */
|
||||
/* CC-Money, RFC4006 8.22. Not used in 3GPP. */
|
||||
|
||||
/* CC-Total-Octets, RFC4006 8.23 */
|
||||
ret = fd_msg_avp_new(ogs_diam_gy_cc_total_octets, 0, &avpch2);
|
||||
ogs_assert(ret == 0);
|
||||
val.u64 = 1000000;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
ogs_assert(ret == 0);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
ogs_assert(ret == 0);
|
||||
|
||||
/* CC-Input-Octets, RFC4006 8.24 */
|
||||
/* CC-Output-Octets, RFC4006 8.25 */
|
||||
/* CC-Service-Specific-Units, RFC4006 8.26 */
|
||||
|
@ -119,6 +128,8 @@ static void fill_multiple_services_credit_control_ccr(smf_sess_t *sess,
|
|||
ogs_assert(ret == 0);
|
||||
}
|
||||
|
||||
if (cc_request_type != OGS_DIAM_GY_CC_REQUEST_TYPE_INITIAL_REQUEST) {
|
||||
|
||||
/* Used-Service-Unit, RFC4006 8.18 */
|
||||
ret = fd_msg_avp_new(ogs_diam_gy_used_service_unit, 0, &avpch1);
|
||||
ogs_assert(ret == 0);
|
||||
|
@ -182,6 +193,7 @@ static void fill_multiple_services_credit_control_ccr(smf_sess_t *sess,
|
|||
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
ogs_assert(ret == 0);
|
||||
//bypass USU if we are in CCR INITIAL
|
||||
|
||||
/* Service-Identifier, RFC4006 8.28. Not used in Gy. */
|
||||
/* Rating-Group */
|
||||
|
@ -296,7 +308,7 @@ static void fill_multiple_services_credit_control_ccr(smf_sess_t *sess,
|
|||
ogs_assert(ret == 0);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
ogs_assert(ret == 0);
|
||||
|
||||
}
|
||||
/* Multiple Services AVP add to req: */
|
||||
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
|
||||
ogs_assert(ret == 0);
|
||||
|
@ -306,6 +318,7 @@ static void fill_multiple_services_credit_control_ccr(smf_sess_t *sess,
|
|||
static void fill_service_information_ccr(smf_sess_t *sess,
|
||||
uint32_t cc_request_type, struct msg *req)
|
||||
{
|
||||
|
||||
int ret;
|
||||
union avp_value val;
|
||||
struct avp *avp;
|
||||
|
@ -558,6 +571,7 @@ static void fill_service_information_ccr(smf_sess_t *sess,
|
|||
void smf_gy_send_ccr(smf_sess_t *sess, void *xact,
|
||||
uint32_t cc_request_type)
|
||||
{
|
||||
|
||||
int ret;
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
|
||||
|
@ -599,7 +613,6 @@ void smf_gy_send_ccr(smf_sess_t *sess, void *xact,
|
|||
ogs_assert(new == 0);
|
||||
|
||||
ogs_debug(" Found Gy Session-Id: [%s]", sess->gy_sid);
|
||||
|
||||
/* Add Session-Id to the message */
|
||||
ret = ogs_diam_message_session_id_set(req, (os0_t)sess->gy_sid, sidlen);
|
||||
ogs_assert(ret == 0);
|
||||
|
@ -630,12 +643,10 @@ void smf_gy_send_ccr(smf_sess_t *sess, void *xact,
|
|||
ogs_assert(sess_data);
|
||||
|
||||
ogs_debug(" Allocate new Gy session: [%s]", sess_data->gy_sid);
|
||||
|
||||
/* Save Session-Id to SMF Session Context */
|
||||
sess->gy_sid = (char *)sess_data->gy_sid;
|
||||
} else
|
||||
ogs_debug(" Retrieve Gy session: [%s]", sess_data->gy_sid);
|
||||
|
||||
/*
|
||||
* 8.2. CC-Request-Number AVP
|
||||
*
|
||||
|
@ -670,6 +681,7 @@ void smf_gy_send_ccr(smf_sess_t *sess, void *xact,
|
|||
sess_data->xact_data[req_slot].cc_req_no = sess_data->cc_request_number;
|
||||
sess_data->xact_data[req_slot].ptr = xact;
|
||||
|
||||
|
||||
/* Origin-Host & Origin-Realm */
|
||||
ret = fd_msg_add_origin(req, 0);
|
||||
ogs_assert(ret == 0);
|
||||
|
@ -720,6 +732,8 @@ void smf_gy_send_ccr(smf_sess_t *sess, void *xact,
|
|||
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
|
||||
ogs_assert(ret == 0);
|
||||
|
||||
|
||||
|
||||
/* Set the Destination-Host AVP */
|
||||
if (sess_data->peer_host) {
|
||||
ret = fd_msg_avp_new(ogs_diam_destination_host, 0, &avp);
|
||||
|
@ -881,6 +895,7 @@ void smf_gy_send_ccr(smf_sess_t *sess, void *xact,
|
|||
ret = fd_msg_send(&req, smf_gy_cca_cb, svg);
|
||||
ogs_assert(ret == 0);
|
||||
|
||||
|
||||
/* Increment the counter */
|
||||
ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0);
|
||||
ogs_diam_logger_self()->stats.nb_sent++;
|
||||
|
|
Loading…
Reference in New Issue