open5gs/src/pcrf/pcrf-rx-path.c

893 lines
31 KiB
C
Raw Normal View History

2019-06-11 14:16:54 +00:00
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2019-06-11 13:10:47 +00:00
#include "pcrf-context.h"
#include "pcrf-fd-path.h"
struct sess_state {
2018-01-17 12:22:30 +00:00
os0_t rx_sid; /* Rx Session-Id */
os0_t gx_sid; /* Gx Session-Id */
os0_t peer_host; /* Peer Host */
2018-01-18 16:32:01 +00:00
#define SESSION_ABORTED 1
int state;
2018-01-17 12:22:30 +00:00
int abort_cause;
2018-01-18 16:32:01 +00:00
int termination_cause;
2018-01-17 12:22:30 +00:00
struct timespec ts; /* Time of sending the message */
};
static OGS_POOL(sess_state_pool, struct sess_state);
static ogs_thread_mutex_t sess_state_mutex;
static struct session_handler *pcrf_rx_reg = NULL;
static struct disp_hdl *hdl_rx_fb = NULL;
static struct disp_hdl *hdl_rx_aar = NULL;
2018-01-15 08:25:14 +00:00
static struct disp_hdl *hdl_rx_str = NULL;
2018-01-17 12:22:30 +00:00
static void pcrf_rx_asa_cb(void *data, struct msg **msg);
static __inline__ struct sess_state *new_state(os0_t sid)
{
struct sess_state *new = NULL;
ogs_thread_mutex_lock(&sess_state_mutex);
ogs_pool_alloc(&sess_state_pool, &new);
2021-06-06 13:35:46 +00:00
ogs_expect_or_return_val(new, NULL);
memset(new, 0, sizeof(*new));
ogs_thread_mutex_unlock(&sess_state_mutex);
2019-04-27 14:54:30 +00:00
new->rx_sid = (os0_t)ogs_strdup((char *)sid);
2021-06-06 13:35:46 +00:00
ogs_expect_or_return_val(new->rx_sid, NULL);
return new;
}
2018-01-15 08:25:14 +00:00
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
{
2019-04-27 14:54:30 +00:00
ogs_assert(sess_data);
2018-01-09 13:53:09 +00:00
if (sess_data->rx_sid)
2019-04-27 14:54:30 +00:00
ogs_free((char *)sess_data->rx_sid);
2018-01-09 13:53:09 +00:00
if (sess_data->gx_sid)
2019-04-27 14:54:30 +00:00
ogs_free((char *)sess_data->gx_sid);
2018-01-17 12:22:30 +00:00
if (sess_data->peer_host)
2019-04-27 14:54:30 +00:00
ogs_free(sess_data->peer_host);
2018-01-17 12:22:30 +00:00
ogs_thread_mutex_lock(&sess_state_mutex);
ogs_pool_free(&sess_state_pool, sess_data);
ogs_thread_mutex_unlock(&sess_state_mutex);
}
static int pcrf_rx_fb_cb(struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
/* This CB should never be called */
2019-04-27 14:54:30 +00:00
ogs_warn("Unexpected message received!");
return ENOTSUP;
}
static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
2019-04-27 14:54:30 +00:00
int rv;
2018-01-10 03:45:58 +00:00
int ret;
int len;
char *from_str, *to_str, *rx_flow, *to_port, *to_ip, *from_ip, *from_port;
2018-01-09 13:53:09 +00:00
struct msg *ans, *qry;
2018-01-10 14:41:56 +00:00
struct avp *avpch1, *avpch2, *avpch3;
struct avp_hdr *hdr;
union avp_value val;
2018-01-15 08:25:14 +00:00
struct sess_state *sess_data = NULL;
2018-01-10 03:45:58 +00:00
size_t sidlen;
2019-09-13 12:07:47 +00:00
ogs_diam_rx_message_t rx_message;
ogs_media_component_t *media_component = NULL;
ogs_media_sub_component_t *sub = NULL;
ogs_flow_t *flow = NULL;
2018-01-10 14:41:56 +00:00
2019-04-27 14:54:30 +00:00
char buf[OGS_ADDRSTRLEN];
2018-01-09 13:53:09 +00:00
os0_t gx_sid = NULL;
2019-09-13 12:07:47 +00:00
uint32_t result_code = OGS_DIAM_RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE;
2019-04-27 14:54:30 +00:00
ogs_debug("[PCRF] AA-Request");
2019-04-27 14:54:30 +00:00
ogs_assert(msg);
ogs_assert(sess);
2018-01-10 03:45:58 +00:00
ret = fd_sess_state_retrieve(pcrf_rx_reg, sess, &sess_data);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (!sess_data) {
2018-01-17 04:49:08 +00:00
os0_t sid = NULL;
ret = fd_sess_getsid(sess, &sid, &sidlen);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 04:49:08 +00:00
sess_data = new_state(sid);
2019-04-27 14:54:30 +00:00
ogs_assert(sess_data);
}
/* Initialize Message */
2019-09-13 12:07:47 +00:00
memset(&rx_message, 0, sizeof(ogs_diam_rx_message_t));
rx_message.cmd_code = OGS_DIAM_RX_CMD_CODE_AA;
/* Create answer header */
qry = *msg;
2018-01-10 03:45:58 +00:00
ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ans = *msg;
/* Set the Auth-Application-Id AVP */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_auth_application_id, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
val.i32 = OGS_DIAM_RX_APPLICATION_ID;
2018-01-10 03:45:58 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 03:45:58 +00:00
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
/* Set the Auth-Request-Type AVP */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_auth_request_type, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2021-06-21 13:36:38 +00:00
val.i32 = OGS_DIAM_AUTH_REQUEST_TYPE_AUTHENTICATE_ONLY;
2018-01-10 03:45:58 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 03:45:58 +00:00
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-09 13:53:09 +00:00
/* Get Framed-IP-Address */
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(qry, ogs_diam_rx_framed_ip_address, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2018-01-10 03:45:58 +00:00
ret = fd_msg_avp_hdr(avp, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-09 13:53:09 +00:00
gx_sid = (os0_t)pcrf_sess_find_by_ipv4(hdr->avp_value->os.data);
2019-06-11 14:16:54 +00:00
if (!gx_sid) {
2019-04-27 14:54:30 +00:00
ogs_warn("Cannot find Gx Sesson for IPv4:%s",
2020-06-17 05:22:28 +00:00
OGS_INET_NTOP(hdr->avp_value->os.data, buf));
2018-01-09 13:53:09 +00:00
}
}
2019-06-11 14:16:54 +00:00
if (!gx_sid) {
2018-01-09 13:53:09 +00:00
/* Get Framed-IPv6-Prefix */
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(qry, ogs_diam_rx_framed_ipv6_prefix, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2019-09-13 12:07:47 +00:00
ogs_paa_t *paa = NULL;
2018-01-09 13:53:09 +00:00
2018-01-10 03:45:58 +00:00
ret = fd_msg_avp_hdr(avp, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
paa = (ogs_paa_t *)hdr->avp_value->os.data;
2019-04-27 14:54:30 +00:00
ogs_assert(paa);
2019-09-13 12:07:47 +00:00
ogs_assert(paa->len == OGS_IPV6_LEN * 8 /* 128bit */);
2018-01-09 13:53:09 +00:00
gx_sid = (os0_t)pcrf_sess_find_by_ipv6(paa->addr6);
2019-06-11 14:16:54 +00:00
if (!gx_sid) {
2019-04-27 14:54:30 +00:00
ogs_warn("Cannot find Gx Sesson for IPv6:%s",
2020-06-17 05:22:28 +00:00
OGS_INET6_NTOP(hdr->avp_value->os.data, buf));
2018-01-09 13:53:09 +00:00
}
}
}
2019-06-11 14:16:54 +00:00
if (!gx_sid) {
2019-04-27 14:54:30 +00:00
ogs_error("No Gx Session");
2018-01-10 03:45:58 +00:00
goto out;
}
2018-01-09 13:53:09 +00:00
2018-01-10 14:41:56 +00:00
ret = fd_msg_browse(qry, MSG_BRW_FIRST_CHILD, &avpch1, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
while (avpch1) {
2018-01-10 14:41:56 +00:00
ret = fd_msg_avp_hdr(avpch1, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
switch(hdr->avp_code) {
case AC_SESSION_ID:
case AC_ORIGIN_HOST:
if (sess_data->peer_host)
ogs_free(sess_data->peer_host);
sess_data->peer_host =
(os0_t)ogs_strdup((char *)hdr->avp_value->os.data);
ogs_assert(sess_data->peer_host);
break;
case AC_ORIGIN_REALM:
case AC_DESTINATION_REALM:
case AC_ROUTE_RECORD:
case AC_PROXY_INFO:
case AC_AUTH_APPLICATION_ID:
2019-09-13 12:07:47 +00:00
case OGS_DIAM_AVP_CODE_FRAME_IP_ADDRESS:
case OGS_DIAM_AVP_CODE_FRAME_IPV6_PREFIX:
case OGS_DIAM_RX_AVP_CODE_SUBSCRIPTION_ID:
2019-06-11 14:16:54 +00:00
break;
/* Gwt Specific-Action */
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_SPECIFIC_ACTION:
2019-06-11 14:16:54 +00:00
break;
/* Gwt Media-Component-Description */
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MEDIA_COMPONENT_DESCRIPTION:
media_component = &rx_message.ims_data.
media_component[rx_message.ims_data.num_of_media_component];
2019-06-11 14:16:54 +00:00
ret = fd_msg_browse(avpch1, MSG_BRW_FIRST_CHILD, &avpch2, NULL);
ogs_assert(ret == 0);
while (avpch2) {
ret = fd_msg_avp_hdr(avpch2, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
switch (hdr->avp_code) {
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MEDIA_COMPONENT_NUMBER:
2019-06-11 14:16:54 +00:00
media_component->media_component_number =
hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MEDIA_TYPE:
2019-06-11 14:16:54 +00:00
media_component->media_type = hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MAX_REQUESTED_BANDWIDTH_DL:
2019-06-11 14:16:54 +00:00
media_component->max_requested_bandwidth_dl =
hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MAX_REQUESTED_BANDWIDTH_UL:
2019-06-11 14:16:54 +00:00
media_component->max_requested_bandwidth_ul =
hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_RR_BANDWIDTH:
2019-06-11 14:16:54 +00:00
media_component->rr_bandwidth = hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_RS_BANDWIDTH:
2019-06-11 14:16:54 +00:00
media_component->rs_bandwidth = hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MIN_REQUESTED_BANDWIDTH_DL:
2019-06-11 14:16:54 +00:00
media_component->min_requested_bandwidth_dl =
hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MIN_REQUESTED_BANDWIDTH_UL:
2019-06-11 14:16:54 +00:00
media_component->min_requested_bandwidth_ul =
hdr->avp_value->i32;
break;
case OGS_DIAM_RX_AVP_CODE_FLOW_STATUS:
media_component->flow_status = hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_MEDIA_SUB_COMPONENT:
sub = &media_component->sub[media_component->num_of_sub];
2019-06-11 14:16:54 +00:00
ret = fd_msg_browse(avpch2, MSG_BRW_FIRST_CHILD,
&avpch3, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
while (avpch3) {
ret = fd_msg_avp_hdr(avpch3, &hdr);
ogs_assert(ret == 0);
switch (hdr->avp_code) {
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_FLOW_NUMBER:
2019-06-11 14:16:54 +00:00
sub->flow_number =
hdr->avp_value->i32;
2018-01-10 14:41:56 +00:00
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_FLOW_USAGE:
2019-06-11 14:16:54 +00:00
sub->flow_usage =
hdr->avp_value->i32;
break;
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_AVP_CODE_FLOW_DESCRIPTION:
flow = &sub->flow[sub->num_of_flow];
2019-06-11 14:16:54 +00:00
/* IE (IPV4-local-addr field ) is not supported on
* the LTE pre release-11 UEs. In order for the call
* to work the local address in packet filter must
* be replaced by 'any local port'.
*/
if (ogs_app()->
parameter.no_ipv4v6_local_addr_in_packet_filter
== true) {
rx_flow = NULL;
rx_flow = (char*)hdr->avp_value->os.data;
len = hdr->avp_value->os.len;
from_str = NULL;
to_str = NULL;
to_ip = NULL;
to_port = NULL;
from_ip = NULL;
from_port = NULL;
from_str = strstr(rx_flow, "from");
ogs_assert(from_str);
to_str = strstr(rx_flow, "to");
ogs_assert(to_str);
if (!strncmp(rx_flow,
"permit out", strlen("permit out"))) {
to_ip = strstr(to_str, " ");
if (to_ip != NULL) {
// Exclude the starting whitespace
to_ip += 1;
to_port = strstr(to_ip, " ");
// Test for no port
if (to_port != NULL) {
flow->description = ogs_malloc(len
2021-06-06 13:35:46 +00:00
- strlen(to_str) +
strlen("to any")
+ strlen(to_port) + 1);
2021-06-06 13:35:46 +00:00
ogs_assert(flow->description);
} else {
flow->description = ogs_malloc(len
2021-06-06 13:35:46 +00:00
- strlen(to_str) +
strlen("to any") + 1);
ogs_assert(flow->description);
}
}
strncat(flow->description,
rx_flow,
len - strlen(to_str));
strcat(flow->description, "to any");
if (to_port != NULL) {
strncat(flow->description,
to_port, strlen(to_port));
}
} else if (!strncmp(rx_flow,
"permit in", strlen("permit in"))) {
from_ip = strstr(from_str, " ");
if (from_ip != NULL) {
2021-06-06 13:35:46 +00:00
/* Exclude the starting whitespace */
from_ip += 1;
from_port = strstr(from_ip, " ");
2021-06-06 13:35:46 +00:00
/* Test for no port +
* whether from_port is at "to"
* without any from port */
if (from_port != NULL &&
strncmp(from_port, " to", 3)) {
flow->description = ogs_malloc(
2021-06-06 13:35:46 +00:00
len - strlen(from_str) +
strlen(to_str)
+ strlen("from any") + 1
2021-06-06 13:35:46 +00:00
+ (strlen(from_port) -
strlen(to_str)));
ogs_assert(flow->description);
} else {
flow->description = ogs_malloc(
2021-06-06 13:35:46 +00:00
len - strlen(from_str) +
strlen(to_str)
+ strlen("from any ") + 1);
2021-06-06 13:35:46 +00:00
ogs_assert(flow->description);
}
}
strncat(flow->description,
rx_flow,
len - strlen(from_str));
if (from_port != NULL &&
strncmp(from_port, " to", 3)) {
strcat(flow->description, "from any");
strncat(flow->description,
from_port,
strlen(from_port) - strlen(to_str));
} else {
strcat(flow->description, "from any ");
}
strncat(flow->description,
to_str,
strlen(to_str));
}
} else {
flow->description = ogs_malloc(
2019-06-11 14:16:54 +00:00
hdr->avp_value->os.len+1);
2021-06-06 13:35:46 +00:00
ogs_assert(flow->description);
ogs_cpystrn(
flow->description,
(char*)hdr->avp_value->os.data,
hdr->avp_value->os.len+1);
}
2019-06-11 14:16:54 +00:00
sub->num_of_flow++;
2018-01-10 14:41:56 +00:00
break;
default:
2019-06-11 14:16:54 +00:00
ogs_error("Not supported(%d)",
hdr->avp_code);
2018-01-10 14:41:56 +00:00
break;
}
2019-06-11 14:16:54 +00:00
fd_msg_browse(avpch3, MSG_BRW_NEXT, &avpch3, NULL);
2018-01-10 14:41:56 +00:00
}
2019-06-11 14:16:54 +00:00
media_component->num_of_sub++;
break;
default:
ogs_warn("Not supported(%d)", hdr->avp_code);
break;
2018-01-10 14:41:56 +00:00
}
2019-06-11 14:16:54 +00:00
fd_msg_browse(avpch2, MSG_BRW_NEXT, &avpch2, NULL);
2018-01-10 14:41:56 +00:00
}
2019-06-11 14:16:54 +00:00
rx_message.ims_data.num_of_media_component++;
2019-06-11 14:16:54 +00:00
break;
default:
ogs_warn("Not supported(%d)", hdr->avp_code);
break;
2018-01-10 14:41:56 +00:00
}
fd_msg_browse(avpch1, MSG_BRW_NEXT, &avpch1, NULL);
}
2018-01-14 04:51:35 +00:00
/* Send Re-Auth Request */
2018-01-17 04:49:08 +00:00
rv = pcrf_gx_send_rar(gx_sid, sess_data->rx_sid, &rx_message);
2019-06-11 14:16:54 +00:00
if (rv != OGS_OK) {
2018-01-14 04:51:35 +00:00
result_code = rx_message.result_code;
2019-06-11 14:16:54 +00:00
if (result_code != ER_DIAMETER_SUCCESS) {
2019-04-27 14:54:30 +00:00
ogs_error("pcrf_gx_send_rar() failed");
goto out;
}
2018-01-14 04:51:35 +00:00
}
2018-01-09 13:53:09 +00:00
/* Store Gx Session-Id in this session */
2018-01-15 08:25:14 +00:00
if (!sess_data->gx_sid)
2019-04-27 14:54:30 +00:00
sess_data->gx_sid = (os0_t)ogs_strdup((char *)gx_sid);
ogs_assert(sess_data->gx_sid);
2018-01-09 13:53:09 +00:00
2018-01-10 14:41:56 +00:00
/* Set IP-Can-Type */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_rx_ip_can_type, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
val.i32 = OGS_DIAM_RX_IP_CAN_TYPE_3GPP_EPS;
2018-01-10 14:41:56 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 14:41:56 +00:00
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 14:41:56 +00:00
/* Set RAT-Type */
2021-06-21 13:36:38 +00:00
ret = fd_msg_avp_new(ogs_diam_rat_type, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2021-06-21 13:36:38 +00:00
val.i32 = OGS_DIAM_RAT_TYPE_EUTRAN;
2018-01-10 14:41:56 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 14:41:56 +00:00
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 14:41:56 +00:00
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
ret = fd_msg_rescode_set(ans, (char *)"DIAMETER_SUCCESS", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
/* Store this value in the session */
2018-01-10 03:45:58 +00:00
ret = fd_sess_state_store(pcrf_rx_reg, sess, &sess_data);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_assert(sess_data == NULL);
/* Send the answer */
2018-01-10 03:45:58 +00:00
ret = fd_msg_send(msg, NULL, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-04-27 14:54:30 +00:00
ogs_debug("[PCRF] AA-Answer");
2018-01-22 15:00:57 +00:00
/* Add this value to the stats */
2019-09-13 12:07:47 +00:00
ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0);
ogs_diam_logger_self()->stats.nb_echoed++;
ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0);
ogs_ims_data_free(&rx_message.ims_data);
2018-01-10 07:06:19 +00:00
return 0;
out:
2019-09-13 12:07:47 +00:00
if (result_code == OGS_DIAM_AVP_UNSUPPORTED) {
2018-01-10 03:45:58 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_AVP_UNSUPPORTED", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
} else if (result_code == OGS_DIAM_UNKNOWN_SESSION_ID) {
2018-01-10 07:06:19 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_UNKNOWN_SESSION_ID", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
} else if (result_code == OGS_DIAM_MISSING_AVP) {
2018-01-10 07:06:19 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_MISSING_AVP", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
} else {
2019-09-13 12:07:47 +00:00
ret = ogs_diam_message_experimental_rescode_set(ans, result_code);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
}
2018-01-10 07:06:19 +00:00
2018-01-15 08:25:14 +00:00
ret = fd_msg_send(msg, NULL, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
state_cleanup(sess_data, NULL, NULL);
ogs_ims_data_free(&rx_message.ims_data);
2018-01-15 08:25:14 +00:00
return 0;
}
2019-04-27 14:54:30 +00:00
int pcrf_rx_send_asr(uint8_t *rx_sid, uint32_t abort_cause)
2018-01-17 12:22:30 +00:00
{
int ret;
struct msg *req = NULL;
struct avp *avp;
union avp_value val;
struct sess_state *sess_data = NULL, *svg;
struct session *session = NULL;
int new;
size_t sidlen;
2019-04-27 14:54:30 +00:00
ogs_assert(rx_sid);
2018-01-17 12:22:30 +00:00
2019-04-27 14:54:30 +00:00
ogs_debug("[PCRF] Abort-Session-Request");
2018-01-17 12:22:30 +00:00
/* Create the request */
2019-09-13 12:07:47 +00:00
ret = fd_msg_new(ogs_diam_rx_cmd_asr, MSGFL_ALLOC_ETEID, &req);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
{
struct msg_hdr * h;
ret = fd_msg_hdr( req, &h );
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
h->msg_appl = OGS_DIAM_RX_APPLICATION_ID;
2018-01-17 12:22:30 +00:00
}
/* Retrieve session by Session-Id */
sidlen = strlen((char *)rx_sid);
ret = fd_sess_fromsid_msg((os0_t)(rx_sid), sidlen, &session, &new);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_assert(new == 0);
2018-01-17 12:22:30 +00:00
/* Add Session-Id to the message */
2019-09-13 12:07:47 +00:00
ret = ogs_diam_message_session_id_set(req, (os0_t)(rx_sid), sidlen);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
/* Save the session associated with the message */
ret = fd_msg_sess_set(req, session);
/* Retrieve session state in this session */
ret = fd_sess_state_retrieve(pcrf_rx_reg, session, &sess_data);
2019-04-27 14:54:30 +00:00
ogs_assert(sess_data);
2018-01-17 12:22:30 +00:00
2018-01-18 16:32:01 +00:00
/* Update State */
sess_data->state = SESSION_ABORTED;
2018-01-17 12:22:30 +00:00
sess_data->abort_cause = abort_cause;
/* Set Origin-Host & Origin-Realm */
ret = fd_msg_add_origin(req, 0);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2021-04-05 08:09:39 +00:00
/* Set the Destination-Host AVP */
ret = fd_msg_avp_new(ogs_diam_destination_host, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2021-04-05 08:09:39 +00:00
val.os.data = sess_data->peer_host;
val.os.len = strlen((char *)sess_data->peer_host);
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
2021-04-05 08:09:39 +00:00
/* Set the Destination-Realm AVP */
ret = fd_msg_avp_new(ogs_diam_destination_realm, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2021-04-05 08:09:39 +00:00
val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm);
val.os.len = strlen(fd_g_config->cnf_diamrlm);
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
/* Set the Auth-Application-Id AVP */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_auth_application_id, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
val.i32 = OGS_DIAM_RX_APPLICATION_ID;
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
/* Set the Abort-Cause AVP */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_rx_abort_cause, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
val.i32 = sess_data->abort_cause;
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
/* Keep a pointer to the session data for debug purpose,
* in real life we would not need it */
svg = sess_data;
/* Store this value in the session */
ret = fd_sess_state_store(pcrf_rx_reg, session, &sess_data);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_assert(sess_data == NULL);
2018-01-17 12:22:30 +00:00
/* Send the request */
ret = fd_msg_send(&req, pcrf_rx_asa_cb, svg);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
/* Increment the counter */
2019-09-13 12:07:47 +00:00
ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0);
ogs_diam_logger_self()->stats.nb_sent++;
ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0);
2018-01-17 12:22:30 +00:00
2019-04-27 14:54:30 +00:00
return OGS_OK;
2018-01-17 12:22:30 +00:00
}
static void pcrf_rx_asa_cb(void *data, struct msg **msg)
{
int ret;
struct session *session;
struct avp *avp, *avpch1;
struct avp_hdr *hdr;
int new;
2019-04-27 14:54:30 +00:00
int result_code = 0;
2018-01-17 12:22:30 +00:00
2019-04-27 14:54:30 +00:00
ogs_debug("[PCRF] Abort-Session-Answer");
2018-01-17 12:22:30 +00:00
/* Search the session, retrieve its data */
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_assert(new == 0);
2018-01-17 12:22:30 +00:00
/* Value of Result Code */
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(*msg, ogs_diam_result_code, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_hdr(avp, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
result_code = hdr->avp_value->i32;
2019-04-27 14:54:30 +00:00
ogs_debug(" Result Code: %d", hdr->avp_value->i32);
2019-06-11 14:16:54 +00:00
} else {
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(*msg, ogs_diam_experimental_result, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2019-09-13 12:07:47 +00:00
ret = fd_avp_search_avp(avp, ogs_diam_experimental_result_code, &avpch1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avpch1) {
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_hdr(avpch1, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
result_code = hdr->avp_value->i32;
2019-04-27 14:54:30 +00:00
ogs_debug(" Experimental Result Code: %d",
2018-01-17 12:22:30 +00:00
result_code);
}
2019-06-11 14:16:54 +00:00
} else {
2019-04-27 14:54:30 +00:00
ogs_error("no Result-Code");
2018-01-17 12:22:30 +00:00
}
}
/* Value of Origin-Host */
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(*msg, ogs_diam_origin_host, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_hdr(avp, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_debug(" From '%.*s'",
2018-01-17 12:22:30 +00:00
(int)hdr->avp_value->os.len, hdr->avp_value->os.data);
2019-06-11 14:16:54 +00:00
} else {
2019-04-27 14:54:30 +00:00
ogs_error("no_Origin-Host ");
2018-01-17 12:22:30 +00:00
}
/* Value of Origin-Realm */
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(*msg, ogs_diam_origin_realm, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2018-01-17 12:22:30 +00:00
ret = fd_msg_avp_hdr(avp, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_debug(" ('%.*s')",
2018-01-17 12:22:30 +00:00
(int)hdr->avp_value->os.len, hdr->avp_value->os.data);
2019-06-11 14:16:54 +00:00
} else {
2019-04-27 14:54:30 +00:00
ogs_error("no_Origin-Realm ");
2018-01-17 12:22:30 +00:00
}
2019-06-11 14:16:54 +00:00
if (result_code != ER_DIAMETER_SUCCESS) {
2019-04-27 14:54:30 +00:00
ogs_error("ERROR DIAMETER Result Code(%d)", result_code);
2018-01-17 12:22:30 +00:00
}
ret = fd_msg_free(*msg);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
*msg = NULL;
return;
}
2018-01-15 08:25:14 +00:00
static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
2019-04-27 14:54:30 +00:00
int rv;
2018-01-15 08:25:14 +00:00
int ret;
struct msg *ans, *qry;
struct avp_hdr *hdr;
union avp_value val;
struct sess_state *sess_data = NULL;
2019-09-13 12:07:47 +00:00
ogs_diam_rx_message_t rx_message;
2018-01-15 08:25:14 +00:00
2019-09-13 12:07:47 +00:00
uint32_t result_code = OGS_DIAM_RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE;
2019-04-27 14:54:30 +00:00
ogs_debug("[PCRF] Session-Termination-Request");
2018-01-15 08:25:14 +00:00
2019-04-27 14:54:30 +00:00
ogs_assert(msg);
ogs_assert(sess);
2018-01-15 08:25:14 +00:00
ret = fd_sess_state_retrieve(pcrf_rx_reg, sess, &sess_data);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_assert(sess_data);
ogs_assert(sess_data->rx_sid);
ogs_assert(sess_data->gx_sid);
2018-01-15 08:25:14 +00:00
/* Initialize Message */
2019-09-13 12:07:47 +00:00
memset(&rx_message, 0, sizeof(ogs_diam_rx_message_t));
rx_message.cmd_code = OGS_DIAM_RX_CMD_CODE_SESSION_TERMINATION;
2018-01-15 08:25:14 +00:00
/* Create answer header */
qry = *msg;
ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
ans = *msg;
/* Set the Auth-Application-Id AVP */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_auth_application_id, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
val.i32 = OGS_DIAM_RX_APPLICATION_ID;
2018-01-15 08:25:14 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
/* Set the Auth-Request-Type AVP */
2019-09-13 12:07:47 +00:00
ret = fd_msg_avp_new(ogs_diam_auth_request_type, 0, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2021-06-21 13:36:38 +00:00
val.i32 = OGS_DIAM_AUTH_REQUEST_TYPE_AUTHENTICATE_ONLY;
2018-01-15 08:25:14 +00:00
ret = fd_msg_avp_setvalue(avp, &val);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
/* Get Termination-Cause */
2019-09-13 12:07:47 +00:00
ret = fd_msg_search_avp(qry, ogs_diam_rx_termination_cause, &avp);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
if (avp) {
2018-01-15 08:25:14 +00:00
ret = fd_msg_avp_hdr(avp, &hdr);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-18 16:32:01 +00:00
sess_data->termination_cause = hdr->avp_value->i32;
2019-06-11 14:16:54 +00:00
switch (sess_data->termination_cause) {
2019-09-13 12:07:47 +00:00
case OGS_DIAM_RX_TERMINATION_CAUSE_DIAMETER_LOGOUT:
2019-06-11 14:16:54 +00:00
break;
default:
ogs_error("Termination-Cause Error : [%d]",
sess_data->termination_cause);
break;
2018-01-15 08:25:14 +00:00
}
2019-06-11 14:16:54 +00:00
} else {
2019-04-27 14:54:30 +00:00
ogs_error("no_Termination-Cause");
2018-01-15 08:25:14 +00:00
}
2019-06-11 14:16:54 +00:00
if (sess_data->state != SESSION_ABORTED) {
2018-01-17 12:22:30 +00:00
/* Send Re-Auth Request if Abort-Session-Request is not initaited */
rv = pcrf_gx_send_rar(
sess_data->gx_sid, sess_data->rx_sid, &rx_message);
2019-06-11 14:16:54 +00:00
if (rv != OGS_OK) {
2018-01-17 12:22:30 +00:00
result_code = rx_message.result_code;
if (result_code != ER_DIAMETER_SUCCESS) {
ogs_error("pcrf_gx_send_rar() failed");
goto out;
}
2018-01-17 12:22:30 +00:00
}
2018-01-15 08:25:14 +00:00
}
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
ret = fd_msg_rescode_set(ans, (char *)"DIAMETER_SUCCESS", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
/* Send the answer */
2018-01-10 03:45:58 +00:00
ret = fd_msg_send(msg, NULL, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-04-27 14:54:30 +00:00
ogs_debug("[PCRF] Session-Termination-Answer");
2018-01-22 15:00:57 +00:00
2018-01-15 08:25:14 +00:00
/* Add this value to the stats */
2019-09-13 12:07:47 +00:00
ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0);
ogs_diam_logger_self()->stats.nb_echoed++;
ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0);
2018-01-15 08:25:14 +00:00
state_cleanup(sess_data, NULL, NULL);
ogs_ims_data_free(&rx_message.ims_data);
2018-01-15 08:25:14 +00:00
return 0;
2018-01-16 07:11:30 +00:00
out:
2019-09-13 12:07:47 +00:00
if (result_code == OGS_DIAM_AVP_UNSUPPORTED) {
2018-01-15 08:25:14 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_AVP_UNSUPPORTED", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
} else if (result_code == OGS_DIAM_UNKNOWN_SESSION_ID) {
2018-01-15 08:25:14 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_UNKNOWN_SESSION_ID", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-09-13 12:07:47 +00:00
} else if (result_code == OGS_DIAM_MISSING_AVP) {
2018-01-15 08:25:14 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_MISSING_AVP", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-06-11 14:16:54 +00:00
} else {
2018-01-15 08:25:14 +00:00
ret = fd_msg_rescode_set(ans,
(char *)"DIAMETER_MISSING_AVP", NULL, NULL, 1);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
}
ret = fd_msg_send(msg, NULL, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
ogs_debug("[PCRF] Session-Termination-Answer");
2018-01-15 08:25:14 +00:00
state_cleanup(sess_data, NULL, NULL);
ogs_ims_data_free(&rx_message.ims_data);
return 0;
}
2019-04-27 14:54:30 +00:00
int pcrf_rx_init(void)
{
2018-01-10 03:45:58 +00:00
int ret;
struct disp_when data;
ogs_thread_mutex_init(&sess_state_mutex);
ogs_pool_init(&sess_state_pool, ogs_app()->pool.sess);
/* Install objects definitions for this application */
2019-11-02 06:52:48 +00:00
ret = ogs_diam_rx_init();
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
/* Create handler for sessions */
2018-01-10 03:45:58 +00:00
ret = fd_sess_handler_create(&pcrf_rx_reg, state_cleanup, NULL, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-17 12:22:30 +00:00
/* Fallback CB if command != unexpected message received */
memset(&data, 0, sizeof(data));
2019-09-13 12:07:47 +00:00
data.app = ogs_diam_rx_application;
2018-01-10 03:45:58 +00:00
ret = fd_disp_register(pcrf_rx_fb_cb, DISP_HOW_APPID, &data, NULL,
&hdl_rx_fb);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
/* Specific handler for AA-Request */
2019-09-13 12:07:47 +00:00
data.command = ogs_diam_rx_cmd_aar;
2018-01-10 03:45:58 +00:00
ret = fd_disp_register(pcrf_rx_aar_cb, DISP_HOW_CC, &data, NULL,
&hdl_rx_aar);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
/* Specific handler for STR-Request */
2019-09-13 12:07:47 +00:00
data.command = ogs_diam_rx_cmd_str;
2018-01-15 08:25:14 +00:00
ret = fd_disp_register(pcrf_rx_str_cb, DISP_HOW_CC, &data, NULL,
&hdl_rx_str);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-15 08:25:14 +00:00
/* Advertise the support for the application in the peer */
2019-09-13 12:07:47 +00:00
ret = fd_disp_app_support(ogs_diam_rx_application, ogs_diam_vendor, 1, 0);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2019-04-27 14:54:30 +00:00
return OGS_OK;
}
void pcrf_rx_final(void)
{
2018-01-10 03:45:58 +00:00
int ret;
ret = fd_sess_handler_destroy(&pcrf_rx_reg, NULL);
2019-04-27 14:54:30 +00:00
ogs_assert(ret == 0);
2018-01-10 03:45:58 +00:00
if (hdl_rx_fb)
(void) fd_disp_unregister(&hdl_rx_fb, NULL);
if (hdl_rx_aar)
(void) fd_disp_unregister(&hdl_rx_aar, NULL);
2018-01-15 08:25:14 +00:00
if (hdl_rx_str)
(void) fd_disp_unregister(&hdl_rx_str, NULL);
ogs_pool_final(&sess_state_pool);
ogs_thread_mutex_destroy(&sess_state_mutex);
}