Skip to content

Commit

Permalink
[SMF] Gy: Split PS-Information AVP creation into its own function
Browse files Browse the repository at this point in the history
Makes the already long function easier to follow, since there's one
level less of encapsulation inside it.
  • Loading branch information
pespin authored and acetcom committed Mar 20, 2024
1 parent ca5a29d commit 6420e80
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/smf/gy-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,31 +335,27 @@ 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);
}

/* TS 32.299 7.2.192 Service-Information AVP for CCR */
static void fill_service_information_ccr(smf_sess_t *sess,
uint32_t cc_request_type, struct msg *req)
/* TS 32.299 7.2.158 PS-Information AVP for CCR */
static void fill_ps_information(smf_sess_t *sess, uint32_t cc_request_type,
struct avp *avp)
{

int ret;
union avp_value val;
struct avp *avp;
struct avp *avpch1, *avpch2, *avpch3;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
char buf[OGS_PLMNIDSTRLEN];
char digit;

/* Service-Information, TS 32.299 sec 7.2.192 */
ret = fd_msg_avp_new(ogs_diam_gy_service_information, 0, &avp);

/* PS-Information, TS 32.299 sec 7.2.158 */
ret = fd_msg_avp_new(ogs_diam_gy_ps_information, 0, &avpch1);
ogs_assert(ret == 0);

/* 3GPP-Charging-Id, 3GPP TS 29.061 16.4.7.2 2 */
ret = fd_msg_avp_new(ogs_diam_gy_3gpp_charging_id, 0, &avpch2);
Expand Down Expand Up @@ -585,9 +581,25 @@ static void fill_service_information_ccr(smf_sess_t *sess,
ogs_assert(ret == 0);
}

/* PS-Information AVP add to req: */
/* PS-Information AVP add to parent AVP (Service-Information): */
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
ogs_assert(ret == 0);
}

/* TS 32.299 7.2.192 Service-Information AVP for CCR */
static void fill_service_information_ccr(smf_sess_t *sess,
uint32_t cc_request_type, struct msg *req)
{

int ret;
struct avp *avp;

/* Service-Information, TS 32.299 sec 7.2.192 */
ret = fd_msg_avp_new(ogs_diam_gy_service_information, 0, &avp);
ogs_assert(ret == 0);

/* PS-Information, TS 32.299 sec 7.2.158 */
fill_ps_information(sess, cc_request_type, avp);

/* Service-Information AVP add to req: */
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
Expand Down

0 comments on commit 6420e80

Please sign in to comment.