add AA Request/Answer Sample code

This commit is contained in:
Sukchan Lee 2018-01-04 12:57:00 +09:00
parent 560204ab46
commit 1a3f5cf86e
8 changed files with 436 additions and 58 deletions

View File

@ -83,69 +83,53 @@ status_t pkbuf_final(void)
void pkbuf_show(void)
{
if (pool_size(&pkbuf_pool) != pool_avail(&pkbuf_pool))
if (pool_used(&pkbuf_pool))
d_error("%d not freed in pkbuf_pool[%d]",
pool_size(&pkbuf_pool) - pool_avail(&pkbuf_pool),
pool_size(&pkbuf_pool));
pool_used(&pkbuf_pool), pool_size(&pkbuf_pool));
d_trace(3, "%d not freed in pkbuf_pool[%d]\n",
pool_size(&pkbuf_pool) - pool_avail(&pkbuf_pool),
pool_size(&pkbuf_pool));
pool_used(&pkbuf_pool), pool_size(&pkbuf_pool));
if (pool_size(&clbuf_pool) != pool_avail(&clbuf_pool))
if (pool_used(&clbuf_pool))
d_error("%d not freed in clbuf_pool[%d]",
pool_size(&clbuf_pool) - pool_avail(&clbuf_pool),
pool_size(&clbuf_pool));
pool_used(&clbuf_pool), pool_size(&clbuf_pool));
d_trace(3, "%d not freed in clbuf_pool[%d]\n",
pool_size(&clbuf_pool) - pool_avail(&clbuf_pool),
pool_size(&clbuf_pool));
pool_used(&clbuf_pool), pool_size(&clbuf_pool));
if (pool_size(&cluster_128_pool) != pool_avail(&cluster_128_pool))
if (pool_used(&cluster_128_pool))
d_error("%d not freed in cluster128_pool[%d]",
pool_size(&cluster_128_pool) - pool_avail(&cluster_128_pool),
pool_size(&cluster_128_pool));
pool_used(&cluster_128_pool), pool_size(&cluster_128_pool));
d_trace(3, "%d not freed in cluster128_pool[%d]\n",
pool_size(&cluster_128_pool) - pool_avail(&cluster_128_pool),
pool_size(&cluster_128_pool));
pool_used(&cluster_128_pool), pool_size(&cluster_128_pool));
if (pool_size(&cluster_256_pool) != pool_avail(&cluster_256_pool))
if (pool_used(&cluster_256_pool))
d_error("%d not freed in cluster256_pool[%d]",
pool_size(&cluster_256_pool) - pool_avail(&cluster_256_pool),
pool_size(&cluster_256_pool));
pool_used(&cluster_256_pool), pool_size(&cluster_256_pool));
d_trace(3, "%d not freed in cluster256_pool[%d]\n",
pool_size(&cluster_256_pool) - pool_avail(&cluster_256_pool),
pool_size(&cluster_256_pool));
pool_used(&cluster_256_pool), pool_size(&cluster_256_pool));
if (pool_size(&cluster_512_pool) != pool_avail(&cluster_512_pool))
if (pool_used(&cluster_512_pool))
d_error("%d not freed in cluster512_pool[%d]",
pool_size(&cluster_512_pool) - pool_avail(&cluster_512_pool),
pool_size(&cluster_512_pool));
pool_used(&cluster_512_pool), pool_size(&cluster_512_pool));
d_trace(3, "%d not freed in cluster512_pool[%d]\n",
pool_size(&cluster_512_pool) - pool_avail(&cluster_512_pool),
pool_size(&cluster_512_pool));
if (pool_size(&cluster_1024_pool) != pool_avail(&cluster_1024_pool))
pool_used(&cluster_512_pool), pool_size(&cluster_512_pool));
if (pool_used(&cluster_1024_pool))
d_error("%d not freed in cluster1024_pool[%d]",
pool_size(&cluster_1024_pool) - pool_avail(&cluster_1024_pool),
pool_size(&cluster_1024_pool));
pool_used(&cluster_1024_pool), pool_size(&cluster_1024_pool));
d_trace(3, "%d not freed in cluster1024_pool[%d]\n",
pool_size(&cluster_1024_pool) - pool_avail(&cluster_1024_pool),
pool_size(&cluster_1024_pool));
pool_used(&cluster_1024_pool), pool_size(&cluster_1024_pool));
if (pool_size(&cluster_2048_pool) != pool_avail(&cluster_2048_pool))
if (pool_used(&cluster_2048_pool))
d_error("%d not freed in cluster2048_pool[%d]",
pool_size(&cluster_2048_pool) - pool_avail(&cluster_2048_pool),
pool_size(&cluster_2048_pool));
pool_used(&cluster_2048_pool), pool_size(&cluster_2048_pool));
d_trace(3, "%d not freed in cluster2048_pool[%d]\n",
pool_size(&cluster_2048_pool) - pool_avail(&cluster_2048_pool),
pool_size(&cluster_2048_pool));
pool_used(&cluster_2048_pool), pool_size(&cluster_2048_pool));
if (pool_size(&cluster_8192_pool) != pool_avail(&cluster_8192_pool))
if (pool_used(&cluster_8192_pool))
d_error("%d not freed in cluster8192_pool[%d]",
pool_size(&cluster_8192_pool) - pool_avail(&cluster_8192_pool),
pool_size(&cluster_8192_pool));
pool_used(&cluster_8192_pool), pool_size(&cluster_8192_pool));
d_trace(3, "%d not freed in cluster8192_pool[%d]\n",
pool_size(&cluster_8192_pool) - pool_avail(&cluster_8192_pool),
pool_size(&cluster_8192_pool));
pool_used(&cluster_8192_pool), pool_size(&cluster_8192_pool));
}
static clbuf_t* clbuf_alloc(c_uint16_t length);

View File

@ -14,6 +14,7 @@ struct dict_object *fd_destination_realm = NULL;
struct dict_object *fd_user_name = NULL;
struct dict_object *fd_auth_session_state = NULL;
struct dict_object *fd_auth_application_id = NULL;
struct dict_object *fd_auth_request_type = NULL;
struct dict_object *fd_result_code = NULL;
struct dict_object *fd_experimental_result = NULL;
struct dict_object *fd_experimental_result_code = NULL;
@ -38,6 +39,7 @@ int fd_message_init()
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "User-Name", &fd_user_name);
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "Auth-Session-State", &fd_auth_session_state);
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "Auth-Application-Id", &fd_auth_application_id);
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "Auth-Request-Type", &fd_auth_request_type);
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "Result-Code", &fd_result_code);
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "Experimental-Result", &fd_experimental_result);
CHECK_dict_search( DICT_AVP, AVP_BY_NAME, "Experimental-Result-Code", &fd_experimental_result_code);

View File

@ -17,6 +17,7 @@ extern struct dict_object *fd_destination_realm;
extern struct dict_object *fd_user_name;
extern struct dict_object *fd_auth_session_state;
extern struct dict_object *fd_auth_application_id;
extern struct dict_object *fd_auth_request_type;
extern struct dict_object *fd_result_code;
extern struct dict_object *fd_experimental_result;
extern struct dict_object *fd_experimental_result_code;

View File

@ -21,6 +21,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include \
-I$(top_srcdir)/lib/3gpp \
-I$(top_srcdir)/lib/fd/gx \
-I$(top_srcdir)/lib/fd/rx \
-I$(top_srcdir)/lib/fd \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \
-I$(top_srcdir)/src/app \

View File

@ -7,15 +7,17 @@
#include "fd_lib.h"
#include "gx_dict.h"
#include "gx_message.h"
#include "rx_dict.h"
#include "rx_message.h"
#include "pcrf_context.h"
/* handler for fallback cb */
/************************************************************************
* GX handler ( PCRF - PGW)
*/
static struct disp_hdl *hdl_gx_fb = NULL;
/* handler for Credit-Control-Request cb */
static struct disp_hdl *hdl_gx_ccr = NULL;
/* Default callback for the application. */
static int pcrf_gx_fb_cb(struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
@ -25,7 +27,6 @@ static int pcrf_gx_fb_cb(struct msg **msg, struct avp *avp,
return ENOTSUP;
}
/* Callback for incoming Credit-Control-Request messages */
static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp,
struct session *sess, void *opaque, enum disp_action *act)
{
@ -335,30 +336,142 @@ out:
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, *qry;
#if 0
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 */
qry = *msg;
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_fd_init(void)
{
struct disp_when data;
CHECK_FCT( fd_init(FD_MODE_SERVER, pcrf_self()->fd_conf_path) );
CHECK_FCT(
fd_init(FD_MODE_CLIENT|FD_MODE_SERVER, pcrf_self()->fd_conf_path) );
/* Install objects definitions for this application */
/* GX Interface */
CHECK_FCT( gx_dict_init() );
memset(&data, 0, sizeof(data));
data.app = gx_application;
/* fallback CB if command != unexpected message received */
CHECK_FCT( fd_disp_register(pcrf_gx_fb_cb, DISP_HOW_APPID, &data, NULL,
&hdl_gx_fb) );
/* specific handler for Credit-Control-Request */
data.command = gx_cmd_ccr;
CHECK_FCT( fd_disp_register(pcrf_gx_ccr_cb, DISP_HOW_CC, &data, NULL,
&hdl_gx_ccr) );
/* Advertise the support for the application in the peer */
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) );
return 0;
}
@ -371,5 +484,12 @@ void pcrf_fd_final(void)
(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);
}
fd_final();
}

View File

@ -76,7 +76,7 @@ status_t pgw_context_final()
hash_destroy(self.sess_hash);
if (index_used(&pgw_sess_pool))
d_warn("%d not freed in pgw_sess_pool[%d] in PGW-Context",
d_error("%d not freed in pgw_sess_pool[%d] in PGW-Context",
index_used(&pgw_sess_pool), index_size(&pgw_sess_pool));
d_trace(3, "%d not freed in pgw_sess_pool[%d] in PGW-Context\n",
index_used(&pgw_sess_pool), index_size(&pgw_sess_pool));

View File

@ -1,5 +1,7 @@
#define TRACE_MODULE _pgw_fd_path
#define VOLTE_TEST 0
#include "core_debug.h"
#include "core_pool.h"
#include "core_lib.h"
@ -9,6 +11,9 @@
#include "fd_lib.h"
#include "gx_dict.h"
#include "gx_message.h"
#if VOLTE_TEST
#include "../rx/rx_dict.h"
#endif
#include "pgw_event.h"
#include "pgw_fd_path.h"
@ -16,6 +21,9 @@
#define MAX_NUM_SESSION_STATE 32
static struct session_handler *pgw_gx_reg = NULL;
#if VOLTE_TEST
static struct session_handler *pgw_rx_reg = NULL;
#endif
struct sess_state {
gtp_xact_t *xact;
@ -764,7 +772,8 @@ int pgw_fd_init(void)
{
pool_init(&pgw_gx_sess_pool, MAX_NUM_SESSION_STATE);
CHECK_FCT( fd_init(FD_MODE_CLIENT, pgw_self()->fd_conf_path) );
CHECK_FCT(
fd_init(FD_MODE_CLIENT|FD_MODE_SERVER, pgw_self()->fd_conf_path) );
/* Install objects definitions for this application */
CHECK_FCT( gx_dict_init() );
@ -773,6 +782,15 @@ int pgw_fd_init(void)
/* Advertise the support for the application in the peer */
CHECK_FCT( fd_disp_app_support(gx_application, fd_vendor, 1, 0) );
#if VOLTE_TEST
CHECK_FCT( rx_dict_init() );
CHECK_FCT( fd_sess_handler_create(&pgw_rx_reg, (void *)free, NULL, NULL) );
/* Advertise the support for the application in the peer */
CHECK_FCT( fd_disp_app_support(rx_application, fd_vendor, 1, 0) );
#endif
return 0;
}
@ -781,16 +799,262 @@ void pgw_fd_final(void)
{
CHECK_FCT_DO( fd_sess_handler_destroy(&pgw_gx_reg, NULL), );
#if VOLTE_TEST
CHECK_FCT_DO( fd_sess_handler_destroy(&pgw_rx_reg, NULL), );
#endif
fd_final();
if (pool_size(&pgw_gx_sess_pool) != pool_avail(&pgw_gx_sess_pool))
if (pool_used(&pgw_gx_sess_pool))
d_error("%d not freed in pgw_gx_sess_pool[%d] of S6A-SM",
pool_size(&pgw_gx_sess_pool) - pool_avail(&pgw_gx_sess_pool),
pool_size(&pgw_gx_sess_pool));
pool_used(&pgw_gx_sess_pool), pool_size(&pgw_gx_sess_pool));
d_trace(3, "%d not freed in pgw_gx_sess_pool[%d] of S6A-SM\n",
pool_size(&pgw_gx_sess_pool) - pool_avail(&pgw_gx_sess_pool),
pool_size(&pgw_gx_sess_pool));
pool_used(&pgw_gx_sess_pool), pool_size(&pgw_gx_sess_pool));
pool_final(&pgw_gx_sess_pool);
}
#if VOLTE_TEST
static void pgw_rx_aaa_cb(void *data, struct msg **msg);
void pgw_rx_send_aar()
{
struct msg *req = NULL;
struct avp *avp;
#if 0
struct avp *avpch1, *avpch2;
#else
struct avp *avpch1;
#endif
union avp_value val;
struct sess_state *mi = NULL, *svg;
struct session *session = NULL;
c_uint32_t addr = 0x0100007f;
/* Create the random value to store with the session */
pool_alloc_node(&pgw_gx_sess_pool, &mi);
d_assert(mi, return, "malloc failed: %s", strerror(errno));
/* Create the request */
CHECK_FCT_DO( fd_msg_new(rx_cmd_aar, MSGFL_ALLOC_ETEID, &req), goto out );
{
struct msg_hdr * h;
CHECK_FCT_DO( fd_msg_hdr( req, &h ), goto out );
h->msg_appl = RX_APPLICATION_ID;
}
/* Create a new session */
#define RX_APP_SID_OPT "app_rx"
CHECK_FCT_DO( fd_msg_new_session(req, (os0_t)RX_APP_SID_OPT,
CONSTSTRLEN(RX_APP_SID_OPT)), goto out );
CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, req, &session, NULL),
goto out );
/* Set Origin-Host & Origin-Realm */
CHECK_FCT_DO( fd_msg_add_origin(req, 0), goto out );
/* Set the Destination-Realm AVP */
CHECK_FCT_DO( fd_msg_avp_new(fd_destination_realm, 0, &avp), goto out );
val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm);
val.os.len = strlen(fd_g_config->cnf_diamrlm);
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 );
/* 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(req, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set Subscription-Id */
CHECK_FCT_DO( fd_msg_avp_new(rx_subscription_id, 0, &avp),
goto out );
CHECK_FCT_DO( fd_msg_avp_new(rx_subscription_id_type, 0, &avpch1),
goto out );
val.i32 = GX_SUBSCRIPTION_ID_TYPE_END_USER_IMSI;
CHECK_FCT_DO( fd_msg_avp_setvalue (avpch1, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1), goto out );
#define RX_APP_IMSI_BCD "0123456789012345"
CHECK_FCT_DO( fd_msg_avp_new(rx_subscription_id_data, 0, &avpch1),
goto out );
val.os.data = (c_uint8_t *)RX_APP_IMSI_BCD;
val.os.len = strlen(RX_APP_IMSI_BCD);
CHECK_FCT_DO( fd_msg_avp_setvalue (avpch1, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1), goto out );
CHECK_FCT_DO( fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out );
/* Set Framed-IP-Address */
CHECK_FCT_DO( fd_msg_avp_new(rx_framed_ip_address, 0, &avp),
goto out );
val.os.data = (c_uint8_t*)&addr;
val.os.len = 4;
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 );
/* Keep a pointer to the session data for debug purpose,
* in real life we would not need it */
svg = mi;
/* Store this value in the session */
CHECK_FCT_DO( fd_sess_state_store(pgw_rx_reg, session, &mi), goto out );
/* Send the request */
CHECK_FCT_DO( fd_msg_send(&req, pgw_rx_aaa_cb, svg), goto out );
/* Increment the counter */
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
fd_logger_self()->stats.nb_sent++;
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
out:
pool_free_node(&pgw_gx_sess_pool, mi);
return;
}
static void pgw_rx_aaa_cb(void *data, struct msg **msg)
{
struct sess_state *mi = NULL;
struct timespec ts;
struct session *session;
#if 0
struct avp *avp, *avpch1, *avpch2, *avpch3, *avpch4;
#else
struct avp *avp, *avpch1;
#endif
struct avp_hdr *hdr;
unsigned long dur;
int error = 0;
int new;
c_int32_t result_code;
CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), return );
/* Search the session, retrieve its data */
CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new),
return );
d_assert(new == 0, return, );
CHECK_FCT_DO( fd_sess_state_retrieve(pgw_rx_reg, session, &mi), return );
d_assert(mi && (void *)mi == data, return, );
/* Value of Result Code */
CHECK_FCT_DO( fd_msg_search_avp(*msg, fd_result_code, &avp), return );
if (avp)
{
CHECK_FCT_DO( fd_msg_avp_hdr(avp, &hdr), return);
result_code = hdr->avp_value->i32;
d_trace(3, "Result Code: %d\n", hdr->avp_value->i32);
}
else
{
CHECK_FCT_DO( fd_msg_search_avp(*msg,
fd_experimental_result, &avp), return );
if (avp)
{
CHECK_FCT_DO( fd_avp_search_avp(avp,
fd_experimental_result_code, &avpch1), return );
if (avpch1)
{
CHECK_FCT_DO( fd_msg_avp_hdr(avpch1, &hdr), return);
result_code = hdr->avp_value->i32;
d_trace(3, "Experimental Result Code: %d\n",
result_code);
}
}
else
{
d_error("no Result-Code");
error++;
}
}
/* Value of Origin-Host */
CHECK_FCT_DO( fd_msg_search_avp(*msg, fd_origin_host, &avp), return );
if (avp)
{
CHECK_FCT_DO( fd_msg_avp_hdr(avp, &hdr), return );
d_trace(3, "From '%.*s' ",
(int)hdr->avp_value->os.len, hdr->avp_value->os.data);
}
else
{
d_error("no_Origin-Host ");
error++;
}
/* Value of Origin-Realm */
CHECK_FCT_DO( fd_msg_search_avp(*msg, fd_origin_realm, &avp), return );
if (avp)
{
CHECK_FCT_DO( fd_msg_avp_hdr(avp, &hdr), return );
d_trace(3, "('%.*s') ",
(int)hdr->avp_value->os.len, hdr->avp_value->os.data);
}
else
{
d_error("no_Origin-Realm ");
error++;
}
if (result_code != ER_DIAMETER_SUCCESS)
{
d_warn("ERROR DIAMETER Result Code(%d)", result_code);
error++;
goto out;
}
out:
/* Free the message */
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
dur = ((ts.tv_sec - mi->ts.tv_sec) * 1000000) +
((ts.tv_nsec - mi->ts.tv_nsec) / 1000);
if (fd_logger_self()->stats.nb_recv)
{
/* Ponderate in the avg */
fd_logger_self()->stats.avg = (fd_logger_self()->stats.avg *
fd_logger_self()->stats.nb_recv + dur) /
(fd_logger_self()->stats.nb_recv + 1);
/* Min, max */
if (dur < fd_logger_self()->stats.shortest)
fd_logger_self()->stats.shortest = dur;
if (dur > fd_logger_self()->stats.longest)
fd_logger_self()->stats.longest = dur;
}
else
{
fd_logger_self()->stats.shortest = dur;
fd_logger_self()->stats.longest = dur;
fd_logger_self()->stats.avg = dur;
}
if (error)
fd_logger_self()->stats.nb_errs++;
else
fd_logger_self()->stats.nb_recv++;
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
/* Display how long it took */
if (ts.tv_nsec > mi->ts.tv_nsec)
d_trace(3, "in %d.%06ld sec\n",
(int)(ts.tv_sec - mi->ts.tv_sec),
(long)(ts.tv_nsec - mi->ts.tv_nsec) / 1000);
else
d_trace(3, "in %d.%06ld sec\n",
(int)(ts.tv_sec + 1 - mi->ts.tv_sec),
(long)(1000000000 + ts.tv_nsec - mi->ts.tv_nsec) / 1000);
CHECK_FCT_DO( fd_msg_free(*msg), return );
*msg = NULL;
pool_free_node(&pgw_gx_sess_pool, mi);
return;
}
#endif

View File

@ -334,6 +334,12 @@ static status_t pgw_gtp_handle_slaac(pgw_sess_t *sess, pkbuf_t *recvbuf)
{
rv = pgw_gtp_send_router_advertisement(sess);
d_assert(rv == CORE_OK,,"send router advertisement failed");
#define VOLTE_TEST 0
#if VOLTE_TEST
extern void pgw_rx_send_aar();
pgw_rx_send_aar();
#endif
}
return PGW_GTP_HANDLED;
}