update it

This commit is contained in:
Sukchan Lee 2017-08-18 23:54:44 +09:00
parent 94c8c66fe3
commit 1d32eaead8
7 changed files with 123 additions and 30 deletions

View File

@ -69,11 +69,25 @@ static int dict_dcca_entry(char * conffile)
/* Applications section */ /* Applications section */
{ {
#if 0 /* modified by acetcom */
/* DCCA */ /* DCCA */
{ {
struct dict_application_data data = { 4, "Diameter Credit Control Application" }; struct dict_application_data data = { 4, "Diameter Credit Control Application" };
CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca); CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca);
} }
#else
/* Create the vendors */
{
struct dict_vendor_data vendor_data = { 10415, "3GPP" };
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL));
}
{
struct dict_object * vendor;
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_NAME, "3GPP", &vendor, ENOENT));
struct dict_application_data app_data = { 16777238, "Gx" };
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_APPLICATION, &app_data, vendor, &dcca));
}
#endif /* end of modification */
} }
/* Result codes */ /* Result codes */

View File

@ -147,10 +147,12 @@ static int dict_dcca_3gpp_entry(char * conffile)
/* Applications section */ /* Applications section */
{ {
/* Create the vendors */ /* Create the vendors */
#if 0 /* modified by acetcom */
{ {
struct dict_vendor_data vendor_data = { 10415, "3GPP" }; struct dict_vendor_data vendor_data = { 10415, "3GPP" };
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL));
} }
#endif /* end of modification */
{ {
struct dict_vendor_data vendor_data = { 5535, "3GPP2" }; struct dict_vendor_data vendor_data = { 5535, "3GPP2" };
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL));
@ -174,12 +176,14 @@ static int dict_dcca_3gpp_entry(char * conffile)
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_APPLICATION, &app_data, vendor, NULL)); CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_APPLICATION, &app_data, vendor, NULL));
} }
#if 0 /* modified by acetcom */
{ {
struct dict_object * vendor; struct dict_object * vendor;
CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_NAME, "3GPP", &vendor, ENOENT)); CHECK_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_NAME, "3GPP", &vendor, ENOENT));
struct dict_application_data app_data = { 16777238, "Gx" }; struct dict_application_data app_data = { 16777238, "Gx" };
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_APPLICATION, &app_data, vendor, NULL)); CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_APPLICATION, &app_data, vendor, NULL));
} }
#endif /* end of modification */
} }

View File

@ -15,32 +15,36 @@ extern struct dict_object *gx_application;
extern struct dict_object *gx_cmd_ccr; extern struct dict_object *gx_cmd_ccr;
extern struct dict_object *gx_cmd_cca; extern struct dict_object *gx_cmd_cca;
extern struct dict_object *gx_cc_request_typeg; #define GX_CC_REQUEST_TYPE_INITIAL_REQUEST 1
extern struct dict_object *gx_cc_request_numberg; #define GX_CC_REQUEST_TYPE_UPDATE_REQUEST 2
extern struct dict_object *gx_network_request_supportg; #define GX_CC_REQUEST_TYPE_TERMINATION_REQUEST 3
extern struct dict_object *gx_subscription_idg; #define GX_CC_REQUEST_TYPE_EVENT_REQUEST 4
extern struct dict_object *gx_supported_featuresg; extern struct dict_object *gx_cc_request_type;
extern struct dict_object *gx_framed_ip_addressg; extern struct dict_object *gx_cc_request_number;
extern struct dict_object *gx_framed_ipv6_prefixg; extern struct dict_object *gx_network_request_support;
extern struct dict_object *gx_ip_can_typeg; extern struct dict_object *gx_subscription_id;
extern struct dict_object *gx_rat_typeg; extern struct dict_object *gx_supported_features;
extern struct dict_object *gx_qos_informationg; extern struct dict_object *gx_framed_ip_address;
extern struct dict_object *gx_3gpp_user_location_infog; extern struct dict_object *gx_framed_ipv6_prefix;
extern struct dict_object *gx_called_station_idg; extern struct dict_object *gx_ip_can_type;
extern struct dict_object *gx_default_eps_bearer_qosg; extern struct dict_object *gx_rat_type;
extern struct dict_object *gx_3gpp_ms_timezoneg; extern struct dict_object *gx_qos_information;
extern struct dict_object *gx_event_triggerg; extern struct dict_object *gx_3gpp_user_location_info;
extern struct dict_object *gx_bearer_control_modeg; extern struct dict_object *gx_called_station_id;
extern struct dict_object *gx_charging_rule_installg; extern struct dict_object *gx_default_eps_bearer_qos;
extern struct dict_object *gx_charging_rule_definitiong; extern struct dict_object *gx_3gpp_ms_timezone;
extern struct dict_object *gx_charging_rule_base_nameg; extern struct dict_object *gx_event_trigger;
extern struct dict_object *gx_charging_rule_nameg; extern struct dict_object *gx_bearer_control_mode;
extern struct dict_object *gx_flow_informationg; extern struct dict_object *gx_charging_rule_install;
extern struct dict_object *gx_flow_directiong; extern struct dict_object *gx_charging_rule_definition;
extern struct dict_object *gx_flow_descriptiong; extern struct dict_object *gx_charging_rule_base_name;
extern struct dict_object *gx_flow_statusg; extern struct dict_object *gx_charging_rule_name;
extern struct dict_object *gx_precedenceg; extern struct dict_object *gx_flow_information;
extern struct dict_object *gx_flowsg; extern struct dict_object *gx_flow_direction;
extern struct dict_object *gx_flow_description;
extern struct dict_object *gx_flow_status;
extern struct dict_object *gx_precedence;
extern struct dict_object *gx_flows;
int gx_dict_init(void); int gx_dict_init(void);

View File

@ -26,6 +26,64 @@ static int pcrf_fb_cb(struct msg **msg, struct avp *avp,
static int pcrf_ccr_cb( struct msg **msg, struct avp *avp, static int pcrf_ccr_cb( struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act) struct session *sess, void *opaque, enum disp_action *act)
{ {
struct msg *ans, *qry;
#if 0
struct avp_hdr *hdr;
#endif
union avp_value val;
c_uint32_t result_code = 0;
d_assert(msg, return EINVAL,);
printf("pcrf received message\n");
/* Create answer header */
qry = *msg;
CHECK_FCT( fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0) );
ans = *msg;
/* Set the Origin-Host, Origin-Realm, andResult-Code AVPs */
CHECK_FCT( fd_msg_rescode_set(ans, "DIAMETER_SUCCESS", NULL, NULL, 1) );
/* 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 CCR AVP */
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_type, 0, &avp), goto out );
val.i32 = GX_CC_REQUEST_TYPE_INITIAL_REQUEST;
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 = 0;
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 );
/* 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), );
return 0;
out:
CHECK_FCT( fd_message_experimental_rescode_set(ans, result_code) );
/* 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 );
CHECK_FCT( fd_msg_send(msg, NULL, NULL) );
return 0; return 0;
} }

View File

@ -65,6 +65,17 @@ void pgw_gx_send_ccr(pgw_sess_t *sess)
val.i32 = GX_APPLICATION_ID; val.i32 = GX_APPLICATION_ID;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out ); CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out ); CHECK_FCT_DO( fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set CCR AVP */
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_type, 0, &avp), goto out );
val.i32 = GX_CC_REQUEST_TYPE_INITIAL_REQUEST;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out );
CHECK_FCT_DO( fd_msg_avp_new(gx_cc_request_number, 0, &avp), goto out );
val.i32 = 0;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out );
CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out ); CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );

View File

@ -12,10 +12,7 @@ extern "C" {
CORE_DECLARE(int) pgw_gx_init(void); CORE_DECLARE(int) pgw_gx_init(void);
CORE_DECLARE(void) pgw_gx_final(void); CORE_DECLARE(void) pgw_gx_final(void);
/* PGW Sends Credit Control Request to PCRF */ CORE_DECLARE(void) pgw_gx_send_ccr(pgw_sess_t *sess);
#if 0
CORE_DECLARE(void) pgw_gx_send_ccr(mme_ue_t *mme_ue);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -8,6 +8,7 @@
#include "pgw_context.h" #include "pgw_context.h"
#include "pgw_gtp_path.h" #include "pgw_gtp_path.h"
#include "pgw_s5c_handler.h" #include "pgw_s5c_handler.h"
#include "pgw_gx_handler.h"
c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco) c_int16_t pgw_pco_build(c_uint8_t *pco_buf, tlv_pco_t *tlv_pco)
{ {
@ -226,6 +227,10 @@ void pgw_handle_create_session_request(
rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.len = rsp->bearer_contexts_created.s5_s8_u_sgw_f_teid.len =
GTP_F_TEID_IPV4_LEN; GTP_F_TEID_IPV4_LEN;
#if 0
pgw_gx_send_ccr(sess);
#endif
rv = gtp_build_msg(&pkbuf, type, &gtp_message); rv = gtp_build_msg(&pkbuf, type, &gtp_message);
d_assert(rv == CORE_OK, pgw_sess_remove(sess); return, "gtp build failed"); d_assert(rv == CORE_OK, pgw_sess_remove(sess); return, "gtp build failed");