PCRF freeDiameter module disunite to Gx module and Rx module

This commit is contained in:
Sukchan Lee 2018-01-08 18:34:51 +09:00
parent e95dcf192d
commit 779d5e88d0
12 changed files with 588 additions and 492 deletions

View File

@ -25,6 +25,8 @@ hss_context_t* hss_self()
status_t hss_context_init(void)
{
status_t rv;
d_assert(context_initialized == 0, return CORE_ERROR,
"HSS context already has been context_initialized");
@ -35,11 +37,8 @@ status_t hss_context_init(void)
memset(&self, 0, sizeof(hss_context_t));
self.fd_config = &g_fd_conf;
if (mutex_create(&self.db_lock, MUTEX_DEFAULT) != CORE_OK)
{
d_error("Mutex creation failed");
return CORE_ERROR;
}
rv = mutex_create(&self.db_lock, MUTEX_DEFAULT);
d_assert(rv == CORE_OK, return CORE_ERROR,);
context_initialized = 1;

View File

@ -123,7 +123,7 @@ typedef struct _mme_context_t {
} mme_context_t;
typedef struct _mme_enb_t {
lnode_t node; /* A node of list_t */
lnode_t node; /* FIXME : remove it */
index_t index; /* An index of this node */
fsm_t sm; /* A state machine */
@ -167,7 +167,7 @@ struct _enb_ue_t {
};
struct _mme_ue_t {
lnode_t node; /* A node of list_t */
lnode_t node; /* FIXME : remove it */
index_t index; /* An index of this node */
fsm_t sm; /* A state machine */

View File

@ -4,7 +4,7 @@ noinst_LTLIBRARIES = libpcrf.la
libpcrf_la_SOURCES = \
pcrf_context.h pcrf_fd_path.h \
pcrf_init.c pcrf_context.c pcrf_fd_path.c \
pcrf_init.c pcrf_context.c pcrf_fd_path.c pcrf_gx_path.c pcrf_rx_path.c \
$(NULL)
libpcrf_la_DEPENDENCIES = \

View File

@ -25,6 +25,7 @@ pcrf_context_t* pcrf_self()
status_t pcrf_context_init(void)
{
status_t rv;
d_assert(context_initialized == 0, return CORE_ERROR,
"PCRF context already has been context_initialized");
@ -35,11 +36,14 @@ status_t pcrf_context_init(void)
memset(&self, 0, sizeof(pcrf_context_t));
self.fd_config = &g_fd_conf;
if (mutex_create(&self.db_lock, MUTEX_DEFAULT) != CORE_OK)
{
d_error("Mutex creation failed");
return CORE_ERROR;
}
rv = mutex_create(&self.db_lock, MUTEX_DEFAULT);
d_assert(rv == CORE_OK, return CORE_ERROR, );
rv = mutex_create(&self.hash_lock, MUTEX_DEFAULT);
d_assert(rv == CORE_OK, return CORE_ERROR, );
self.ipv4_hash = hash_make();
self.ipv6_hash = hash_make();
context_initialized = 1;
@ -51,6 +55,13 @@ status_t pcrf_context_final(void)
d_assert(context_initialized == 1, return CORE_ERROR,
"PCRF context already has been finalized");
d_assert(self.ipv4_hash,, );
hash_destroy(self.ipv4_hash);
d_assert(self.ipv6_hash,, );
hash_destroy(self.ipv6_hash);
mutex_delete(self.hash_lock);
mutex_delete(self.db_lock);
context_initialized = 0;
@ -320,6 +331,10 @@ status_t pcrf_context_setup_trace_module()
extern int _pcrf_fd_path;
d_trace_level(&_pcrf_fd_path, diameter);
extern int _pcrf_gx_path;
d_trace_level(&_pcrf_gx_path, diameter);
extern int _pcrf_rx_path;
d_trace_level(&_pcrf_rx_path, diameter);
extern int _fd_init;
d_trace_level(&_fd_init, diameter);
extern int _fd_logger;

View File

@ -3,6 +3,7 @@
#include "core_errno.h"
#include "core_mutex.h"
#include "core_hash.h"
#include "3gpp_types.h"
#include "fd/gx/gx_message.h"
@ -18,6 +19,10 @@ typedef struct _pcrf_context_t {
void *subscriberCollection;
mutex_id db_lock;
hash_t *ipv4_hash; /* hash table for Gx Frame-IP-Address */
hash_t *ipv6_hash; /* hash table for Gx Frame-IPv6s-Prefix */
mutex_id hash_lock;
} pcrf_context_t;
CORE_DECLARE(status_t) pcrf_context_init(void);

View File

@ -1,498 +1,27 @@
#define TRACE_MODULE _pcrf_fd_path
#include "core_debug.h"
#include "core_pkbuf.h"
#include "core_lib.h"
#include "fd/fd_lib.h"
#include "fd/gx/gx_dict.h"
#include "fd/gx/gx_message.h"
#include "fd/rx/rx_dict.h"
#include "fd/rx/rx_message.h"
#include "pcrf_context.h"
/************************************************************************
* GX handler ( PCRF - PGW)
*/
static struct disp_hdl *hdl_gx_fb = NULL;
static struct disp_hdl *hdl_gx_ccr = NULL;
static int pcrf_gx_fb_cb(struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
/* This CB should never be called */
d_warn("Unexpected message received!");
return ENOTSUP;
}
static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
struct msg *ans, *qry;
struct avp *avpch1, *avpch2, *avpch3, *avpch4;
struct avp_hdr *hdr;
union avp_value val;
status_t rv;
gx_cca_message_t cca_message;
c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1];
c_int8_t apn[MAX_APN_LEN+1];
int i, j;
c_uint32_t cc_request_type = 0;
c_uint32_t result_code = GX_DIAMETER_ERROR_USER_UNKNOWN;
d_assert(msg, return EINVAL,);
/* Initialize Message */
memset(&cca_message, 0, sizeof(gx_cca_message_t));
/* Create answer header */
qry = *msg;
CHECK_FCT( fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0) );
ans = *msg;
/* Get CC-Request-Type */
CHECK_FCT( fd_msg_search_avp(qry, gx_cc_request_type, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
cc_request_type = hdr->avp_value->i32;
/* Set the Auth-Application-Id AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_auth_application_id, 0, &avp), goto out );
val.i32 = GX_APPLICATION_ID;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set CC-Request-Type, CC-Request-Number */
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_type, 0, &avp), goto out );
val.i32 = cc_request_type;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_number, 0, &avp), goto out );
val.i32 = 1;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Get IMSI + APN */
CHECK_FCT( fd_msg_search_avp(qry, gx_subscription_id, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
CHECK_FCT( fd_avp_search_avp(avp, gx_subscription_id_type, &avpch1) );
CHECK_FCT( fd_msg_avp_hdr(avpch1, &hdr) );
if (hdr->avp_value->i32 != GX_SUBSCRIPTION_ID_TYPE_END_USER_IMSI)
{
d_error("Not implemented Subscription-Id-Type(%d)",
hdr->avp_value->i32);
goto out;
}
CHECK_FCT( fd_avp_search_avp(avp, gx_subscription_id_data, &avpch1) );
CHECK_FCT( fd_msg_avp_hdr(avpch1, &hdr) );
core_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data,
c_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
CHECK_FCT( fd_msg_search_avp(qry, gx_called_station_id, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
core_cpystrn(apn, (char*)hdr->avp_value->os.data,
c_min(hdr->avp_value->os.len, MAX_APN_LEN)+1);
rv = pcrf_db_pdn_data(imsi_bcd, apn, &cca_message);
if (rv != CORE_OK)
{
d_error("Cannot get data for IMSI(%s)+APN(%s)'\n", imsi_bcd, apn);
goto out;
}
if (cc_request_type != GX_CC_REQUEST_TYPE_TERMINATION_REQUEST)
{
/* Set Charging-Rule-Install */
if (cca_message.num_of_pcc_rule)
CHECK_FCT( fd_msg_avp_new(gx_charging_rule_install, 0, &avp) );
for (i = 0; i < cca_message.num_of_pcc_rule; i++)
{
pcc_rule_t *pcc_rule = &cca_message.pcc_rule[i];
CHECK_FCT( fd_msg_avp_new(gx_charging_rule_definition, 0,
&avpch1) );
CHECK_FCT( fd_msg_avp_new(gx_charging_rule_name, 0, &avpch2) );
/* Charing-Rule-Name is automatically configured by order */
sprintf(pcc_rule->name, "%s%d", apn, i+1);
val.os.data = (c_uint8_t *)pcc_rule->name;
val.os.len = strlen(pcc_rule->name);
CHECK_FCT( fd_msg_avp_setvalue(avpch2, &val) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
for (j = 0; j < pcc_rule->num_of_flow; j++)
{
flow_t *flow = &pcc_rule->flow[j];
CHECK_FCT( fd_msg_avp_new(gx_flow_information, 0, &avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_flow_direction, 0, &avpch3) );
val.i32 = flow->direction;
CHECK_FCT( fd_msg_avp_setvalue(avpch3, &val) );
CHECK_FCT( fd_msg_avp_add(avpch2, MSG_BRW_LAST_CHILD, avpch3) );
CHECK_FCT( fd_msg_avp_new(gx_flow_description, 0, &avpch3) );
val.os.data = (c_uint8_t *)flow->description;
val.os.len = strlen(flow->description);
CHECK_FCT( fd_msg_avp_setvalue(avpch3, &val) );
CHECK_FCT( fd_msg_avp_add(avpch2, MSG_BRW_LAST_CHILD, avpch3) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
}
CHECK_FCT( fd_msg_avp_new(gx_flow_status, 0, &avpch2) );
val.i32 = GX_FLOW_STATUS_ENABLED;
CHECK_FCT( fd_msg_avp_setvalue(avpch2, &val) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_qos_information, 0, &avpch2) )
CHECK_FCT( fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch3) );
val.u32 = pcc_rule->qos.qci;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT( fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
CHECK_FCT( fd_msg_avp_new(gx_allocation_retention_priority, 0,
&avpch3) );
CHECK_FCT( fd_msg_avp_new(gx_priority_level, 0, &avpch4) );
val.u32 = pcc_rule->qos.arp.priority_level;
CHECK_FCT( fd_msg_avp_setvalue (avpch4, &val) );
CHECK_FCT( fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch4) );
val.u32 = pcc_rule->qos.arp.pre_emption_capability;
CHECK_FCT( fd_msg_avp_setvalue (avpch4, &val) );
CHECK_FCT( fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_vulnerability, 0,
&avpch4) );
val.u32 = pcc_rule->qos.arp.pre_emption_vulnerability;
CHECK_FCT( fd_msg_avp_setvalue (avpch4, &val) );
CHECK_FCT( fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4) );
CHECK_FCT( fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
if (pcc_rule->qos.mbr.uplink)
{
CHECK_FCT(
fd_msg_avp_new(gx_max_requested_bandwidth_ul, 0, &avpch3) );
val.u32 = pcc_rule->qos.mbr.uplink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
if (pcc_rule->qos.mbr.downlink)
{
CHECK_FCT(
fd_msg_avp_new(gx_max_requested_bandwidth_dl, 0, &avpch3) );
val.u32 = pcc_rule->qos.mbr.downlink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
if (pcc_rule->qos.gbr.uplink)
{
CHECK_FCT(
fd_msg_avp_new(gx_guaranteed_bitrate_ul, 0, &avpch3) );
val.u32 = pcc_rule->qos.gbr.uplink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
if (pcc_rule->qos.gbr.downlink)
{
CHECK_FCT(
fd_msg_avp_new(gx_guaranteed_bitrate_dl, 0, &avpch3) );
val.u32 = pcc_rule->qos.gbr.downlink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_precedence, 0, &avpch2) )
val.u32 = i + 1; /* Precendence is automatically configured by order */
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch1) );
}
if (cca_message.num_of_pcc_rule)
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
/* Set QoS-Information */
if (cca_message.pdn.ambr.downlink || cca_message.pdn.ambr.uplink)
{
CHECK_FCT( fd_msg_avp_new(gx_qos_information, 0, &avp) );
if (cca_message.pdn.ambr.uplink)
{
CHECK_FCT(
fd_msg_avp_new(gx_apn_aggregate_max_bitrate_ul, 0, &avpch1) );
val.u32 = cca_message.pdn.ambr.uplink;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
}
if (cca_message.pdn.ambr.downlink)
{
CHECK_FCT( fd_msg_avp_new(gx_apn_aggregate_max_bitrate_dl, 0,
&avpch1) );
val.u32 = cca_message.pdn.ambr.downlink;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
}
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
}
/* Set Default-EPS-Bearer-QoS */
CHECK_FCT( fd_msg_avp_new(gx_default_eps_bearer_qos, 0, &avp) );
CHECK_FCT( fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch1) );
val.u32 = cca_message.pdn.qos.qci;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT(
fd_msg_avp_new(gx_allocation_retention_priority, 0, &avpch1) );
CHECK_FCT( fd_msg_avp_new(gx_priority_level, 0, &avpch2) );
val.u32 = cca_message.pdn.qos.arp.priority_level;
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch2) );
val.u32 = cca_message.pdn.qos.arp.pre_emption_capability;
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_vulnerability, 0, &avpch2) );
val.u32 = cca_message.pdn.qos.arp.pre_emption_vulnerability;
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
/* Set Supported Features */
CHECK_FCT( fd_msg_avp_new(gx_supported_features, 0, &avp) );
CHECK_FCT( fd_msg_avp_new(gx_feature_list_id, 0, &avpch1) );
val.i32 = 1;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT( fd_msg_avp_new(gx_feature_list, 0, &avpch1) );
val.u32 = 0x0000000b;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
}
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
CHECK_FCT( fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1) );
/* Send the answer */
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
/* Add this value to the stats */
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
fd_logger_self()->stats.nb_echoed++;
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
gx_cca_message_free(&cca_message);
return 0;
out:
if (result_code == GX_DIAMETER_ERROR_USER_UNKNOWN)
{
CHECK_FCT( fd_msg_rescode_set(ans,
"DIAMETER_ERROR_USER_UNKNOWN", NULL, NULL, 1) );
}
else
{
CHECK_FCT( fd_message_experimental_rescode_set(ans, result_code) );
}
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
gx_cca_message_free(&cca_message);
return 0;
}
/************************************************************************
* RX handler ( PCRF - PGW)
*/
static struct disp_hdl *hdl_rx_fb = NULL;
static struct disp_hdl *hdl_rx_aar = NULL;
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 */
d_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)
{
struct msg *ans;
#if 0
struct msg *ans, *qry;
struct avp *avpch1, *avpch2, *avpch3, *avpch4;
struct avp_hdr *hdr;
#endif
union avp_value val;
#if 0
status_t rv;
gx_cca_message_t cca_message;
c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1];
c_int8_t apn[MAX_APN_LEN+1];
int i, j;
c_uint32_t cc_request_type = 0;
c_uint32_t result_code = RX_DIAMETER_ERROR_USER_UNKNOWN;
#endif
d_assert(msg, return EINVAL,);
#if 0
/* Initialize Message */
memset(&cca_message, 0, sizeof(gx_cca_message_t));
#endif
/* Create answer header */
#if 0
qry = *msg;
#endif
CHECK_FCT( fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0) );
ans = *msg;
/* Set the Auth-Application-Id AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_auth_application_id, 0, &avp), goto out );
val.i32 = RX_APPLICATION_ID;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set the Auth-Request-Type AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_auth_request_type, 0, &avp), goto out );
val.i32 = 1;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
CHECK_FCT( fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1) );
/* Send the answer */
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
/* Add this value to the stats */
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
fd_logger_self()->stats.nb_echoed++;
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
#if 0
gx_cca_message_free(&cca_message);
#endif
return 0;
out:
#if 0
if (result_code == RX_DIAMETER_ERROR_USER_UNKNOWN)
{
CHECK_FCT( fd_msg_rescode_set(ans,
"DIAMETER_ERROR_USER_UNKNOWN", NULL, NULL, 1) );
}
else
{
CHECK_FCT( fd_message_experimental_rescode_set(ans, result_code) );
}
#endif
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
#if 0
gx_cca_message_free(&cca_message);
#endif
return 0;
}
#include "pcrf_fd_path.h"
int pcrf_fd_init(void)
{
struct disp_when data;
CHECK_FCT( fd_init(FD_MODE_CLIENT|FD_MODE_SERVER,
pcrf_self()->fd_conf_path, pcrf_self()->fd_config) );
/* GX Interface */
CHECK_FCT( gx_dict_init() );
memset(&data, 0, sizeof(data));
data.app = gx_application;
CHECK_FCT( fd_disp_register(pcrf_gx_fb_cb, DISP_HOW_APPID, &data, NULL,
&hdl_gx_fb) );
data.command = gx_cmd_ccr;
CHECK_FCT( fd_disp_register(pcrf_gx_ccr_cb, DISP_HOW_CC, &data, NULL,
&hdl_gx_ccr) );
CHECK_FCT( fd_disp_app_support(gx_application, fd_vendor, 1, 0) );
/* RX Interface */
CHECK_FCT( rx_dict_init() );
memset(&data, 0, sizeof(data));
data.app = rx_application;
CHECK_FCT( fd_disp_register(pcrf_rx_fb_cb, DISP_HOW_APPID, &data, NULL,
&hdl_rx_fb) );
data.command = rx_cmd_aar;
CHECK_FCT( fd_disp_register(pcrf_rx_aar_cb, DISP_HOW_CC, &data, NULL,
&hdl_rx_aar) );
CHECK_FCT( fd_disp_app_support(rx_application, fd_vendor, 1, 0) );
CHECK_FCT( pcrf_gx_init() );
CHECK_FCT( pcrf_rx_init() );
return 0;
}
void pcrf_fd_final(void)
{
if (hdl_gx_fb) {
(void) fd_disp_unregister(&hdl_gx_fb, NULL);
}
if (hdl_gx_ccr) {
(void) fd_disp_unregister(&hdl_gx_ccr, NULL);
}
if (hdl_rx_fb) {
(void) fd_disp_unregister(&hdl_rx_fb, NULL);
}
if (hdl_rx_aar) {
(void) fd_disp_unregister(&hdl_rx_aar, NULL);
}
pcrf_gx_final();
pcrf_rx_final();
fd_final();
}

View File

@ -10,6 +10,11 @@ extern "C" {
CORE_DECLARE(int) pcrf_fd_init(void);
CORE_DECLARE(void) pcrf_fd_final(void);
CORE_DECLARE(int) pcrf_gx_init(void);
CORE_DECLARE(void) pcrf_gx_final(void);
CORE_DECLARE(int) pcrf_rx_init(void);
CORE_DECLARE(void) pcrf_rx_final(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */

393
src/pcrf/pcrf_gx_path.c Normal file
View File

@ -0,0 +1,393 @@
#define TRACE_MODULE _pcrf_gx_path
#include "core_lib.h"
#include "core_debug.h"
#include "fd/fd_lib.h"
#include "fd/gx/gx_dict.h"
#include "fd/gx/gx_message.h"
#include "pcrf_context.h"
static struct session_handler *pcrf_gx_reg = NULL;
static struct disp_hdl *hdl_gx_fb = NULL;
static struct disp_hdl *hdl_gx_ccr = NULL;
void pcrf_gx_sess_cleanup(
struct sess_state *sess_data, os0_t sid, void *opaque)
{
// pool_free_node(&pgw_gx_sess_pool, sess_data);
}
static int pcrf_gx_fb_cb(struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
/* This CB should never be called */
d_warn("Unexpected message received!");
return ENOTSUP;
}
static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
struct msg *ans, *qry;
struct avp *avpch1, *avpch2, *avpch3, *avpch4;
struct avp_hdr *hdr;
union avp_value val;
#if 0
struct sess_state *sess_data = NULL;
#endif
status_t rv;
gx_cca_message_t cca_message;
c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1];
c_int8_t apn[MAX_APN_LEN+1];
int i, j;
c_uint32_t cc_request_type = 0;
c_uint32_t cc_request_number = 0;
c_uint32_t result_code = GX_DIAMETER_ERROR_USER_UNKNOWN;
d_assert(msg, return EINVAL,);
#if 0
d_assert( fd_sess_state_retrieve(pcrf_gx_reg, sess, &sess_data) == 0,
return EINVAL,);
if (!sess_data)
{
pool_alloc_node(&pgw_gx_sess_pool, &sess_data);
d_assert(sess_data, return EINVAL,);
memset(sess_data, 0, sizeof *sess_data);
}
#endif
/* Initialize Message */
memset(&cca_message, 0, sizeof(gx_cca_message_t));
/* Create answer header */
qry = *msg;
CHECK_FCT( fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0) );
ans = *msg;
/* Get CC-Request-Type */
CHECK_FCT( fd_msg_search_avp(qry, gx_cc_request_type, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
cc_request_type = hdr->avp_value->i32;
/* Get CC-Request-Number */
CHECK_FCT( fd_msg_search_avp(qry, gx_cc_request_number, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
cc_request_number = hdr->avp_value->i32;
/* Set the Auth-Application-Id AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_auth_application_id, 0, &avp), goto out );
val.i32 = GX_APPLICATION_ID;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set CC-Request-Type */
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_type, 0, &avp), goto out );
val.i32 = cc_request_type;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set CC-Request-Number */
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_number, 0, &avp), goto out );
val.i32 = cc_request_number;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Get IMSI + APN */
CHECK_FCT( fd_msg_search_avp(qry, gx_subscription_id, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
CHECK_FCT( fd_avp_search_avp(avp, gx_subscription_id_type, &avpch1) );
CHECK_FCT( fd_msg_avp_hdr(avpch1, &hdr) );
if (hdr->avp_value->i32 != GX_SUBSCRIPTION_ID_TYPE_END_USER_IMSI)
{
d_error("Not implemented Subscription-Id-Type(%d)",
hdr->avp_value->i32);
goto out;
}
CHECK_FCT( fd_avp_search_avp(avp, gx_subscription_id_data, &avpch1) );
CHECK_FCT( fd_msg_avp_hdr(avpch1, &hdr) );
core_cpystrn(imsi_bcd, (char*)hdr->avp_value->os.data,
c_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
CHECK_FCT( fd_msg_search_avp(qry, gx_called_station_id, &avp) );
CHECK_FCT( fd_msg_avp_hdr(avp, &hdr) );
core_cpystrn(apn, (char*)hdr->avp_value->os.data,
c_min(hdr->avp_value->os.len, MAX_APN_LEN)+1);
rv = pcrf_db_pdn_data(imsi_bcd, apn, &cca_message);
if (rv != CORE_OK)
{
d_error("Cannot get data for IMSI(%s)+APN(%s)'\n", imsi_bcd, apn);
goto out;
}
if (cc_request_type != GX_CC_REQUEST_TYPE_TERMINATION_REQUEST)
{
/* Set Charging-Rule-Install */
if (cca_message.num_of_pcc_rule)
CHECK_FCT( fd_msg_avp_new(gx_charging_rule_install, 0, &avp) );
for (i = 0; i < cca_message.num_of_pcc_rule; i++)
{
pcc_rule_t *pcc_rule = &cca_message.pcc_rule[i];
CHECK_FCT( fd_msg_avp_new(gx_charging_rule_definition, 0,
&avpch1) );
CHECK_FCT( fd_msg_avp_new(gx_charging_rule_name, 0, &avpch2) );
/* Charing-Rule-Name is automatically configured by order */
sprintf(pcc_rule->name, "%s%d", apn, i+1);
val.os.data = (c_uint8_t *)pcc_rule->name;
val.os.len = strlen(pcc_rule->name);
CHECK_FCT( fd_msg_avp_setvalue(avpch2, &val) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
for (j = 0; j < pcc_rule->num_of_flow; j++)
{
flow_t *flow = &pcc_rule->flow[j];
CHECK_FCT( fd_msg_avp_new(gx_flow_information, 0, &avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_flow_direction, 0, &avpch3) );
val.i32 = flow->direction;
CHECK_FCT( fd_msg_avp_setvalue(avpch3, &val) );
CHECK_FCT( fd_msg_avp_add(avpch2, MSG_BRW_LAST_CHILD, avpch3) );
CHECK_FCT( fd_msg_avp_new(gx_flow_description, 0, &avpch3) );
val.os.data = (c_uint8_t *)flow->description;
val.os.len = strlen(flow->description);
CHECK_FCT( fd_msg_avp_setvalue(avpch3, &val) );
CHECK_FCT( fd_msg_avp_add(avpch2, MSG_BRW_LAST_CHILD, avpch3) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
}
CHECK_FCT( fd_msg_avp_new(gx_flow_status, 0, &avpch2) );
val.i32 = GX_FLOW_STATUS_ENABLED;
CHECK_FCT( fd_msg_avp_setvalue(avpch2, &val) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_qos_information, 0, &avpch2) )
CHECK_FCT( fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch3) );
val.u32 = pcc_rule->qos.qci;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT( fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
CHECK_FCT( fd_msg_avp_new(gx_allocation_retention_priority, 0,
&avpch3) );
CHECK_FCT( fd_msg_avp_new(gx_priority_level, 0, &avpch4) );
val.u32 = pcc_rule->qos.arp.priority_level;
CHECK_FCT( fd_msg_avp_setvalue (avpch4, &val) );
CHECK_FCT( fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch4) );
val.u32 = pcc_rule->qos.arp.pre_emption_capability;
CHECK_FCT( fd_msg_avp_setvalue (avpch4, &val) );
CHECK_FCT( fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_vulnerability, 0,
&avpch4) );
val.u32 = pcc_rule->qos.arp.pre_emption_vulnerability;
CHECK_FCT( fd_msg_avp_setvalue (avpch4, &val) );
CHECK_FCT( fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4) );
CHECK_FCT( fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
if (pcc_rule->qos.mbr.uplink)
{
CHECK_FCT(
fd_msg_avp_new(gx_max_requested_bandwidth_ul, 0, &avpch3) );
val.u32 = pcc_rule->qos.mbr.uplink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
if (pcc_rule->qos.mbr.downlink)
{
CHECK_FCT(
fd_msg_avp_new(gx_max_requested_bandwidth_dl, 0, &avpch3) );
val.u32 = pcc_rule->qos.mbr.downlink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
if (pcc_rule->qos.gbr.uplink)
{
CHECK_FCT(
fd_msg_avp_new(gx_guaranteed_bitrate_ul, 0, &avpch3) );
val.u32 = pcc_rule->qos.gbr.uplink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
if (pcc_rule->qos.gbr.downlink)
{
CHECK_FCT(
fd_msg_avp_new(gx_guaranteed_bitrate_dl, 0, &avpch3) );
val.u32 = pcc_rule->qos.gbr.downlink;
CHECK_FCT( fd_msg_avp_setvalue (avpch3, &val) );
CHECK_FCT(
fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3) );
}
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_precedence, 0, &avpch2) )
val.u32 = i + 1; /* Precendence is automatically configured by order */
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add(avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch1) );
}
if (cca_message.num_of_pcc_rule)
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
/* Set QoS-Information */
if (cca_message.pdn.ambr.downlink || cca_message.pdn.ambr.uplink)
{
CHECK_FCT( fd_msg_avp_new(gx_qos_information, 0, &avp) );
if (cca_message.pdn.ambr.uplink)
{
CHECK_FCT(
fd_msg_avp_new(gx_apn_aggregate_max_bitrate_ul, 0, &avpch1) );
val.u32 = cca_message.pdn.ambr.uplink;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
}
if (cca_message.pdn.ambr.downlink)
{
CHECK_FCT( fd_msg_avp_new(gx_apn_aggregate_max_bitrate_dl, 0,
&avpch1) );
val.u32 = cca_message.pdn.ambr.downlink;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
}
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
}
/* Set Default-EPS-Bearer-QoS */
CHECK_FCT( fd_msg_avp_new(gx_default_eps_bearer_qos, 0, &avp) );
CHECK_FCT( fd_msg_avp_new(gx_qos_class_identifier, 0, &avpch1) );
val.u32 = cca_message.pdn.qos.qci;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT(
fd_msg_avp_new(gx_allocation_retention_priority, 0, &avpch1) );
CHECK_FCT( fd_msg_avp_new(gx_priority_level, 0, &avpch2) );
val.u32 = cca_message.pdn.qos.arp.priority_level;
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_capability, 0, &avpch2) );
val.u32 = cca_message.pdn.qos.arp.pre_emption_capability;
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_new(gx_pre_emption_vulnerability, 0, &avpch2) );
val.u32 = cca_message.pdn.qos.arp.pre_emption_vulnerability;
CHECK_FCT( fd_msg_avp_setvalue (avpch2, &val) );
CHECK_FCT( fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
/* Set Supported Features */
CHECK_FCT( fd_msg_avp_new(gx_supported_features, 0, &avp) );
CHECK_FCT( fd_msg_avp_new(gx_feature_list_id, 0, &avpch1) );
val.i32 = 1;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT( fd_msg_avp_new(gx_feature_list, 0, &avpch1) );
val.u32 = 0x0000000b;
CHECK_FCT( fd_msg_avp_setvalue (avpch1, &val) );
CHECK_FCT( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1) );
CHECK_FCT( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp) );
}
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
CHECK_FCT( fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1) );
/* Send the answer */
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
/* Add this value to the stats */
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
fd_logger_self()->stats.nb_echoed++;
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
gx_cca_message_free(&cca_message);
return 0;
out:
if (result_code == GX_DIAMETER_ERROR_USER_UNKNOWN)
{
CHECK_FCT( fd_msg_rescode_set(ans,
"DIAMETER_ERROR_USER_UNKNOWN", NULL, NULL, 1) );
}
else
{
CHECK_FCT( fd_message_experimental_rescode_set(ans, result_code) );
}
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
gx_cca_message_free(&cca_message);
return 0;
}
int pcrf_gx_init(void)
{
struct disp_when data;
/* GX Interface */
CHECK_FCT( gx_dict_init() );
CHECK_FCT( fd_sess_handler_create(&pcrf_gx_reg, pcrf_gx_sess_cleanup,
NULL, NULL) );
memset(&data, 0, sizeof(data));
data.app = gx_application;
CHECK_FCT( fd_disp_register(pcrf_gx_fb_cb, DISP_HOW_APPID, &data, NULL,
&hdl_gx_fb) );
data.command = gx_cmd_ccr;
CHECK_FCT( fd_disp_register(pcrf_gx_ccr_cb, DISP_HOW_CC, &data, NULL,
&hdl_gx_ccr) );
CHECK_FCT( fd_disp_app_support(gx_application, fd_vendor, 1, 0) );
return 0;
}
void pcrf_gx_final(void)
{
CHECK_FCT_DO( fd_sess_handler_destroy(&pcrf_gx_reg, NULL), );
if (hdl_gx_fb)
(void) fd_disp_unregister(&hdl_gx_fb, NULL);
if (hdl_gx_ccr)
(void) fd_disp_unregister(&hdl_gx_ccr, NULL);
}

149
src/pcrf/pcrf_rx_path.c Normal file
View File

@ -0,0 +1,149 @@
#define TRACE_MODULE _pcrf_rx_path
#include "core_debug.h"
#include "fd/fd_lib.h"
#include "fd/rx/rx_dict.h"
#include "fd/rx/rx_message.h"
#include "pcrf_context.h"
static struct session_handler *pcrf_rx_reg = NULL;
static struct disp_hdl *hdl_rx_fb = NULL;
static struct disp_hdl *hdl_rx_aar = NULL;
void pcrf_rx_sess_cleanup(
struct sess_state *sess_data, os0_t sid, void *opaque)
{
// pool_free_node(&pgw_gx_sess_pool, sess_data);
}
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 */
d_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)
{
struct msg *ans;
#if 0
struct msg *ans, *qry;
struct avp *avpch1, *avpch2, *avpch3, *avpch4;
struct avp_hdr *hdr;
#endif
union avp_value val;
#if 0
status_t rv;
gx_cca_message_t cca_message;
c_int8_t imsi_bcd[MAX_IMSI_BCD_LEN+1];
c_int8_t apn[MAX_APN_LEN+1];
int i, j;
c_uint32_t cc_request_type = 0;
c_uint32_t result_code = RX_DIAMETER_ERROR_USER_UNKNOWN;
#endif
d_assert(msg, return EINVAL,);
#if 0
/* Initialize Message */
memset(&cca_message, 0, sizeof(gx_cca_message_t));
#endif
/* Create answer header */
#if 0
qry = *msg;
#endif
CHECK_FCT( fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0) );
ans = *msg;
/* Set the Auth-Application-Id AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_auth_application_id, 0, &avp), goto out );
val.i32 = RX_APPLICATION_ID;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set the Auth-Request-Type AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_auth_request_type, 0, &avp), goto out );
val.i32 = 1;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
CHECK_FCT( fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1) );
/* Send the answer */
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
/* Add this value to the stats */
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
fd_logger_self()->stats.nb_echoed++;
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
#if 0
gx_cca_message_free(&cca_message);
#endif
return 0;
out:
#if 0
if (result_code == RX_DIAMETER_ERROR_USER_UNKNOWN)
{
CHECK_FCT( fd_msg_rescode_set(ans,
"DIAMETER_ERROR_USER_UNKNOWN", NULL, NULL, 1) );
}
else
{
CHECK_FCT( fd_message_experimental_rescode_set(ans, result_code) );
}
#endif
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
#if 0
gx_cca_message_free(&cca_message);
#endif
return 0;
}
int pcrf_rx_init(void)
{
struct disp_when data;
/* RX Interface */
CHECK_FCT( rx_dict_init() );
CHECK_FCT( fd_sess_handler_create(&pcrf_rx_reg, pcrf_rx_sess_cleanup,
NULL, NULL) );
memset(&data, 0, sizeof(data));
data.app = rx_application;
CHECK_FCT( fd_disp_register(pcrf_rx_fb_cb, DISP_HOW_APPID, &data, NULL,
&hdl_rx_fb) );
data.command = rx_cmd_aar;
CHECK_FCT( fd_disp_register(pcrf_rx_aar_cb, DISP_HOW_CC, &data, NULL,
&hdl_rx_aar) );
CHECK_FCT( fd_disp_app_support(rx_application, fd_vendor, 1, 0) );
return 0;
}
void pcrf_rx_final(void)
{
CHECK_FCT_DO( fd_sess_handler_destroy(&pcrf_rx_reg, NULL), );
if (hdl_rx_fb)
(void) fd_disp_unregister(&hdl_rx_fb, NULL);
if (hdl_rx_aar)
(void) fd_disp_unregister(&hdl_rx_aar, NULL);
}

View File

@ -104,7 +104,7 @@ typedef struct _pgw_subnet_t {
} pgw_subnet_t;
typedef struct _pgw_sess_t {
lnode_t node; /**< A node of list_t */
lnode_t node; /* FIXME : remove it */
index_t index; /**< An index of this node */
c_uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is derived from INDEX */

View File

@ -195,7 +195,7 @@ void pgw_gx_send_ccr(gtp_xact_t *xact, pgw_sess_t *sess,
goto out );
}
/* Set Framed-IP-Address-Prefix */
/* Set Framed-IPv6-Prefix */
if (sess->ipv6)
{
CHECK_FCT_DO( fd_msg_avp_new(gx_framed_ipv6_prefix, 0, &avp),
@ -825,6 +825,7 @@ int pgw_fd_init(void)
/* Install objects definitions for this application */
CHECK_FCT( gx_dict_init() );
/* Create handler for sessions */
CHECK_FCT( fd_sess_handler_create(&pgw_gx_reg, pgw_gx_sess_cleanup,
NULL, NULL) );

View File

@ -45,7 +45,7 @@ typedef struct _sgw_context_t {
} sgw_context_t;
typedef struct _sgw_ue_t {
lnode_t node; /* A node of list_t */
lnode_t node; /* FIXME : remove it */
index_t index; /* An index of this node */
c_uint32_t sgw_s11_teid; /* SGW-S11-TEID is derived from INDEX */