86 lines
3.7 KiB
C
86 lines
3.7 KiB
C
#include "rest_proxy_print.h"
|
|
#include "rest_proxy.h"
|
|
#include "log.h"
|
|
|
|
|
|
|
|
|
|
void rest_proxy_print_stat()
|
|
{
|
|
LOG_D("query: pps->restproxy->rest[%d, %d] response: pps<-restproxy<-rest[%d, %d]\n",
|
|
g_rest_proxy_env.query_req_num, g_rest_proxy_env.query_rest_req_num,
|
|
g_rest_proxy_env.query_res_num, g_rest_proxy_env.query_rest_res_num);
|
|
LOG_D(" get-subscribid: restproxy->rest[%d]\n", g_rest_proxy_env.query_rest_subscrib_req_num);
|
|
LOG_D(" restproxy<-rest[%d]\n", g_rest_proxy_env.query_rest_subscrib_res_num);
|
|
|
|
LOG_D("topup: pps->restproxy->rest[%d, %d] response: pps<-restproxy<-rest[%d, %d]\n",
|
|
g_rest_proxy_env.topup_req_num, g_rest_proxy_env.topup_rest_req_num,
|
|
g_rest_proxy_env.topup_res_num, g_rest_proxy_env.topup_rest_res_num);
|
|
LOG_D(" get-subscribid: restproxy->rest[%d]\n", g_rest_proxy_env.topup_rest_subscrib_req_num);
|
|
LOG_D(" restproxy<-rest[%d]\n", g_rest_proxy_env.topup_rest_subscrib_res_num);
|
|
|
|
LOG_D("trans: pps->restproxy->rest[%d, %d] response: pps<-restproxy<-rest[%d, %d]\n",
|
|
g_rest_proxy_env.trans_req_num, g_rest_proxy_env.trans_rest_req_num,
|
|
g_rest_proxy_env.trans_res_num, g_rest_proxy_env.trans_rest_res_num);
|
|
LOG_D(" get-subscribid_out: restproxy->rest[%d]\n", g_rest_proxy_env.trans_rest_subscrib_req_num_out);
|
|
LOG_D(" restproxy<-rest[%d]\n", g_rest_proxy_env.trans_rest_subscrib_res_num_out);
|
|
LOG_D(" get-subscribid_in: restproxy->rest[%d]\n", g_rest_proxy_env.trans_rest_subscrib_req_num_in);
|
|
LOG_D(" restproxy<-rest[%d]\n", g_rest_proxy_env.trans_rest_subscrib_res_num_in);
|
|
}
|
|
void rest_proxy_print_msg(const struct rest_msg_s* msg, int b_is_request, const char* tip)
|
|
{
|
|
return ;
|
|
switch(msg->msg_type)
|
|
{
|
|
case REST_QUERY:
|
|
if(b_is_request)
|
|
{
|
|
LOG_D("%s MsgType:%d SrcDstRef[%d, %d] MSISDN:%s\n",
|
|
tip, msg->msg_type, msg->header.src_ref, msg->header.dst_ref,
|
|
msg->msg.query.msisdn);
|
|
}
|
|
else
|
|
{
|
|
LOG_D("%s msgType:%d SrcDstRef[%d, %d] Res:%d ErrCode:%d Balance:%u MOMTExpiry[%u, %u].\n",
|
|
tip, msg->msg_type, msg->header.src_ref, msg->header.dst_ref,
|
|
msg->msg.query_res.result, msg->msg.query_res.error_code, msg->msg.query_res.balance,
|
|
msg->msg.query_res.mo_expiry, msg->msg.query_res.mt_expiry);
|
|
}
|
|
break;
|
|
case REST_TOPUP:
|
|
if(b_is_request)
|
|
{
|
|
LOG_D("%s MsgType:%d SrcDstRef[%d, %d] MSISDN:%s PIN:%s\n",
|
|
tip, msg->msg_type, msg->header.src_ref, msg->header.dst_ref,
|
|
msg->msg.topup.msisdn, msg->msg.topup.password);
|
|
}
|
|
else
|
|
{
|
|
LOG_D("%s msgType:%d SrcDstRef[%d, %d] Res:%d ErrCode:%d Balance:%u MOMTExpiry[%u, %u].\n",
|
|
tip, msg->msg_type, msg->header.src_ref, msg->header.dst_ref,
|
|
msg->msg.topup_res.result, msg->msg.topup_res.error_code, msg->msg.topup_res.balance,
|
|
msg->msg.topup_res.mo_expiry, msg->msg.topup_res.mt_expiry);
|
|
}
|
|
break;
|
|
case REST_TRANSFER:
|
|
if(b_is_request)
|
|
{
|
|
LOG_D("%s MsgType:%d SrcDstRef[%d, %d] MSISDN_OUT:%s MSISDN_IN:%s Money:%d\n",
|
|
tip, msg->msg_type, msg->header.src_ref, msg->header.dst_ref,
|
|
msg->msg.transfer.transferOutMsisdn, msg->msg.transfer.transferInMsisdn, msg->msg.transfer.amount);
|
|
}
|
|
else
|
|
{
|
|
LOG_D("%s msgType:%d SrcDstRef[%d, %d] Res:%d ErrCode:%d balance:%d\n",
|
|
tip, msg->msg_type, msg->header.src_ref, msg->header.dst_ref,
|
|
msg->msg.transfer_res.result, msg->msg.transfer_res.error_code, msg->msg.transfer_res.balance);
|
|
}
|
|
break;
|
|
default:
|
|
/* print err msg. Or else? */
|
|
LOG_D("%s err. msgType:%d\n", __FUNCTION__, msg->msg_type);
|
|
break;
|
|
}
|
|
}
|
|
|