feat: create cook branch
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
V 170618165451Z 00 unknown /DC=com/DC=example/CN=OCSP Signer for Test Certifying CA
|
||||
V 170618165451Z 01 unknown /DC=com/DC=example/mail=root@example.com/CN=localhost
|
||||
V 170618165451Z 00 unknown /DC=com/DC=example/CN=OCSP Signer for Test Certifying CA
|
||||
V 170618165451Z 01 unknown /DC=com/DC=example/mail=root@example.com/CN=localhost
|
||||
|
||||
@@ -28,7 +28,6 @@ static long gx_start_ts = 0;
|
||||
|
||||
static int gx_rec_ccr( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act);
|
||||
static void gx_rec_cca(void *para, struct msg **msg);
|
||||
_gy_port *gy_get_port_by_cxt_id(char *cxt_id);
|
||||
|
||||
static struct disp_hdl * ccr_cb_hdl = NULL; /* handler for ccr req cb */
|
||||
//static struct disp_hdl * cca_cb_hdl = NULL; /* handler for cca req cb */
|
||||
@@ -187,35 +186,10 @@ static void gy_port_init(_gy_port *gy_port_ptr, int index)
|
||||
return ;
|
||||
}
|
||||
|
||||
// start==================================
|
||||
static int print_duplicated_sess_id(const char *cxt_id)
|
||||
{
|
||||
int loop=0;
|
||||
FILE *fpSess=NULL;
|
||||
|
||||
fpSess = fopen("../log/dul_sess_id.txt","a");
|
||||
if(fpSess == NULL)
|
||||
return 0;
|
||||
|
||||
fprintf(fpSess,"now ts=%ld, sess: %s\r\n", ts_sec, cxt_id);
|
||||
|
||||
fclose(fpSess);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int gy_assign_port(char *cxt_id)
|
||||
{
|
||||
int i, index, retval = INVALID_GY_PORT;
|
||||
_gy_port *gy_port_ptr = NULL;
|
||||
|
||||
// check if session id already in use========start
|
||||
gy_port_ptr = gy_get_port_by_cxt_id(cxt_id);
|
||||
if (gy_port_ptr != NULL)
|
||||
{
|
||||
print_duplicated_sess_id(cxt_id);
|
||||
return retval;
|
||||
}
|
||||
|
||||
CHECK_POSIX_DO( pthread_mutex_lock(&gy_port_lock), { ASSERT(0); } );
|
||||
|
||||
@@ -270,7 +244,6 @@ int gy_release_port(unsigned short index)
|
||||
if(gy_port_ptr->used_flag)
|
||||
{
|
||||
pthread_mutex_lock(&sess_hash_mutx);
|
||||
if(g_sess_hash != NULL)
|
||||
g_hash_table_remove(g_sess_hash, gy_port_ptr->context_id);// delete hash index
|
||||
pthread_mutex_unlock(&sess_hash_mutx);
|
||||
|
||||
@@ -464,26 +437,24 @@ int free_gx_sm(struct gx_sm_t *sm)
|
||||
|
||||
int fd_get_session_id(char *src_buf, char *dst_buf, int flag)
|
||||
{
|
||||
//int len;
|
||||
char *first_off, *second_off, *third_off;
|
||||
int len;
|
||||
|
||||
//second_off = strchr(first_off+1, ';');
|
||||
//third_off = strchr(second_off+1, ';');
|
||||
//len = third_off - second_off -1;
|
||||
first_off = strchr(src_buf, ';');
|
||||
second_off = strchr(first_off+1, ';');
|
||||
third_off = strchr(second_off+1, ';');
|
||||
len = third_off - second_off -1;
|
||||
|
||||
//if(flag == 0)
|
||||
/*if(0)
|
||||
if(0)
|
||||
{
|
||||
memcpy(dst_buf, second_off+1, len);
|
||||
dst_buf[len] = '\0';
|
||||
}*/
|
||||
|
||||
}
|
||||
if(1)
|
||||
{
|
||||
char *first_off;//, *second_off, *third_off;
|
||||
first_off = strchr(src_buf, ';');
|
||||
strcpy(dst_buf, first_off+1);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -777,7 +748,7 @@ static int gx_parse_cca( struct msg ** msg)
|
||||
|
||||
if(gy_msg.request_type == RT_TERMINATE_REQUEST ||
|
||||
gy_msg.request_type == RT_EVENT_REQUEST ||
|
||||
(cca_ptr->result != 2001 && gy_msg.request_type != RT_UPDATE_REQUEST))
|
||||
cca_ptr->result != 2001)
|
||||
{
|
||||
unsigned int gy_port;
|
||||
|
||||
@@ -825,8 +796,7 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
||||
memcpy(sess_id, avphdr->avp_value->os.data, avphdr->avp_value->os.len);
|
||||
sess_id[avphdr->avp_value->os.len] = '\0';
|
||||
//sprintf(sess_id, "%s",avphdr->avp_value->os.data);
|
||||
//fd_get_session_id(sess_id, gy_ptr->cxt_id, 0);
|
||||
strcpy(gy_ptr->cxt_id, sess_id);
|
||||
fd_get_session_id(sess_id, gy_ptr->cxt_id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1016,6 +986,22 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* 3GPP-User-Location-Info */
|
||||
struct dict_object *tgpp_user_loc_info = NULL;
|
||||
SEARCH_AVP_("3GPP-User-Location-Info", 10415, &tgpp_user_loc_info);
|
||||
PARSE_GRPAVP_STR(groupedavp_sub, tgpp_user_loc_info, avp, avphdr, "Parse CCR 3GPP-User-Location-Info", avphdr->avp_value->os.data)
|
||||
if(avphdr != NULL )
|
||||
{
|
||||
if(avphdr->avp_value != NULL)
|
||||
{
|
||||
if((avphdr->avp_value->os.data != NULL) && (avphdr->avp_value->os.data[0]==0x82))// TAI and ECGI
|
||||
{
|
||||
memcpy(&gy_ptr->msg_body.ccr.cellid, &avphdr->avp_value->os.data[1], 5);// mcc, mnc and tac
|
||||
gy_ptr->msg_body.ccr.cellid[5] = 0x00;
|
||||
gy_ptr->msg_body.ccr.cellid[6] = avphdr->avp_value->os.data[12];// CellId
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1274,7 +1260,8 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
||||
PARSE_AVP_U32(ccr_msg, multiple_services_indicator, avp, avphdr, "Parse CCR Multiple-Services-Indicator", avphdr->avp_value->u32)
|
||||
|
||||
/* Multiple-Services-Credit-Control */
|
||||
//gy_ptr->msg_body.ccr.mscc_presented = 0;
|
||||
gy_ptr->msg_body.ccr.mscc_presented = 0;
|
||||
gy_ptr->msg_body.ccr.used_unit = 0;
|
||||
struct dict_object *multiple_services_credit_control = NULL;
|
||||
SEARCH_AVP_("Multiple-Services-Credit-Control", 0, &multiple_services_credit_control);
|
||||
CHECK_FCT( fd_msg_search_avp ( ccr_msg, multiple_services_credit_control, &groupedavp) );
|
||||
@@ -1285,7 +1272,7 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
||||
{
|
||||
LOG_N("fj Parse CCR Multiple-Services-Credit-Control");
|
||||
|
||||
//gy_ptr->msg_body.ccr.mscc_presented = 1;
|
||||
gy_ptr->msg_body.ccr.mscc_presented = 1;
|
||||
/* Requested-Service-Unit */
|
||||
struct dict_object *requested_service_unit = NULL;
|
||||
SEARCH_AVP_("Requested-Service-Unit", 0, &requested_service_unit);
|
||||
@@ -1455,7 +1442,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
||||
long granted_value = gy_ptr->msg_body.cca.grant_value;
|
||||
int port = gy_ptr->fd_port;
|
||||
_gy_port *gy_port = NULL;
|
||||
long valid_time_len = 900;
|
||||
//long valid_time_len = 900;
|
||||
|
||||
gy_port = gy_get_port_space(port);
|
||||
if(gy_port == NULL)
|
||||
@@ -1492,23 +1479,23 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
||||
{
|
||||
EN_AVP_U32(result_code, gy_ptr->msg_body.cca.result, ans, "fj CCA Result-Code");
|
||||
}
|
||||
/*else if (gy_ptr->msg_body.ccr.mscc_presented==0)
|
||||
else if (gy_ptr->msg_body.ccr.mscc_presented==0)
|
||||
{
|
||||
int result = gy_ptr->msg_body.cca.result;
|
||||
if (result < 2001)
|
||||
{
|
||||
result = 2001;
|
||||
}
|
||||
else if (resutl == 4012)
|
||||
{
|
||||
result = 4547;
|
||||
}
|
||||
else if (resutl != 2001)
|
||||
//else if (result == 4012)
|
||||
//{
|
||||
// result = 4547;
|
||||
//}
|
||||
else if (result != 2001)
|
||||
{
|
||||
result = 5012;
|
||||
}
|
||||
EN_AVP_U32(result_code, result, ans, "fj CCA Result-Code");
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_FCT_DO( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ), goto out );
|
||||
@@ -1527,7 +1514,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
||||
EN_AVP_U32(check_balance_result, gy_ptr->msg_body.cca.check_balance_result, ans, "fj CCA check_balance_result");
|
||||
}
|
||||
}
|
||||
else// if (gy_ptr->msg_body.ccr.mscc_presented)
|
||||
else if(gy_ptr->msg_body.ccr.mscc_presented > 0)
|
||||
/* Multiple-Services-Credit-Control */
|
||||
{
|
||||
CHECK_FCT_DO( fd_msg_avp_new ( multiple_services_credit_control, 0, &grpavp ), goto out );
|
||||
@@ -1564,7 +1551,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
||||
}
|
||||
|
||||
struct dict_object *valid_time = NULL;
|
||||
EN_GRPAVP_U32("Validity-Time", 0, valid_time, valid_time_len);
|
||||
EN_GRPAVP_U32("Validity-Time", 0, valid_time, gy_ptr->msg_body.cca.validity_time);//valid_time_len);
|
||||
|
||||
if (gy_ptr->request_type != RT_TERMINATE_REQUEST)
|
||||
{
|
||||
@@ -1607,14 +1594,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
||||
EN_GRPAVP_U32("Volume-Quota-Threshold", 10415, volume_threshold, gy_ptr->msg_body.cca.volume_threshold);
|
||||
|
||||
struct dict_object *quota_hold_time = NULL;
|
||||
EN_GRPAVP_U32("Quota-Holding-Time", 10415, quota_hold_time, gy_ptr->msg_body.cca.time_threshold + 10);
|
||||
|
||||
if(1)
|
||||
{
|
||||
struct dict_object *time_threshold = NULL;
|
||||
EN_GRPAVP_U32("Time-Quota-Threshold", 10415, time_threshold, gy_ptr->msg_body.cca.time_threshold);
|
||||
}
|
||||
|
||||
EN_GRPAVP_U32("Quota-Holding-Time", 10415, quota_hold_time, gy_ptr->msg_body.cca.time_threshold);
|
||||
}
|
||||
|
||||
CHECK_FCT_DO( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, grpavp ), goto out );
|
||||
@@ -1835,7 +1815,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
gx_stat_increase_send_ccr(msg_ptr->request_type);
|
||||
|
||||
/* Create the request from template */
|
||||
CHECK_FCT_DO( fd_msg_new( cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out1 );
|
||||
CHECK_FCT_DO( fd_msg_new( cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
|
||||
|
||||
/* set application id */
|
||||
{
|
||||
@@ -1892,32 +1872,11 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_FIRST_CHILD, avp ), goto out );
|
||||
}
|
||||
|
||||
char *pRealm = g_sh_conf_ext.pi_diamid_realm_peer, *pHost = g_sh_conf_ext.pi_diamid_peer;
|
||||
if ((msg_ptr->service_type == ST_CS_SMS) || (msg_ptr->service_type == ST_CS_VOICE))
|
||||
{
|
||||
GetRoDiamIdPeer(&pRealm, &pHost, (msg_ptr->service_type == ST_CS_SMS)?1:0);
|
||||
}
|
||||
if (pRealm == NULL || pHost == NULL)
|
||||
{
|
||||
LOG_N("fj gx_send_ccr_real, no link available, pRealm[%p], pHost[%p]", pRealm, pHost);
|
||||
return 0;
|
||||
}
|
||||
/*if ((msg_ptr->service_type == ST_CS_SMS) && (g_rosms_conf_ext.pi_diamid_realm_peer!=NULL) && (g_rosms_conf_ext.pi_diamid_peer!=NULL))
|
||||
{
|
||||
pRealm = g_rosms_conf_ext.pi_diamid_realm_peer;
|
||||
pHost = g_rosms_conf_ext.pi_diamid_peer;
|
||||
}
|
||||
else if ((msg_ptr->service_type == ST_CS_VOICE) && (g_rovoice_conf_ext.pi_diamid_realm_peer!=NULL) && (g_rovoice_conf_ext.pi_diamid_peer!=NULL))
|
||||
{
|
||||
pRealm = g_rovoice_conf_ext.pi_diamid_realm_peer;
|
||||
pHost = g_rovoice_conf_ext.pi_diamid_peer;
|
||||
}*/
|
||||
|
||||
/* Destination-Realm */
|
||||
EN_AVP_STR(dest_realm, pRealm, req, "fj CCR Destination-Realm Ok");
|
||||
EN_AVP_STR(dest_realm, g_sh_conf_ext.pi_diamid_realm_peer, req, "fj CCR Destination-Realm Ok");
|
||||
|
||||
/* Destination-Host */
|
||||
EN_AVP_STR(dest_host, pHost, req, "fj CCR Destination-Host-Ok");
|
||||
EN_AVP_STR(dest_host, g_sh_conf_ext.pi_diamid_peer, req, "fj CCR Destination-Host-Ok");
|
||||
|
||||
/* Origin-Host & Origin-Realm */
|
||||
CHECK_FCT_DO( fd_msg_add_origin ( req, 0 ), goto out );
|
||||
@@ -1928,14 +1887,12 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
/* Service-Context-ID */
|
||||
if(msg_ptr->service_type == ST_CS_SMS)
|
||||
{
|
||||
//EN_AVP_STR(service_cxt_id, "agrandtech_sms@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
||||
EN_AVP_STR(service_cxt_id, fd_g_config->service_context_sms, req, "fj CCR Service-Context-ID Ok");
|
||||
EN_AVP_STR(service_cxt_id, "agrandtech_sms@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
||||
//EN_AVP_STR(route_record, "ocsclient.seagullCTF.org", req , "fj CCR Route-Record OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
//EN_AVP_STR(service_cxt_id, "agrandtech_ro@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
||||
EN_AVP_STR(service_cxt_id, fd_g_config->service_context_voice, req, "fj CCR Service-Context-ID Ok");
|
||||
EN_AVP_STR(service_cxt_id, "agrandtech_ro@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
||||
}
|
||||
|
||||
/* CC-Request-Type */
|
||||
@@ -2092,7 +2049,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
struct dict_object *service_specific_info = NULL;
|
||||
SEARCH_AVP_("Service-Specific-Info", SH_VND_ID, &service_specific_info);
|
||||
CHECK_FCT_DO( fd_msg_avp_new ( service_specific_info, 0, &grpavp_sub2 ), goto out);
|
||||
{ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪӦ<D2AA>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
{ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪӦ<D2AA>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
EN_GRPAVP_U32_("Service-Specific-Type", SH_VND_ID, dict_obj_tmp, 6006, grpavp_sub2)
|
||||
EN_GRPAVP_STR("Service-Specific-Data", SH_VND_ID, dict_obj_tmp, msg_ptr->msg_body.ccr.cellid, grpavp_sub2)
|
||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
||||
@@ -2108,7 +2065,6 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
|
||||
EN_GRPAVP_U32_("Node-Functionality", SH_VND_ID, dict_obj_tmp, 6, grpavp_sub1)
|
||||
|
||||
|
||||
if(msg_ptr->msg_body.ccr.cellid_presented == 1)
|
||||
{
|
||||
|
||||
@@ -2116,7 +2072,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
struct dict_object *service_specific_info = NULL;
|
||||
SEARCH_AVP_("Service-Specific-Info", SH_VND_ID, &service_specific_info);
|
||||
CHECK_FCT_DO( fd_msg_avp_new ( service_specific_info, 0, &grpavp_sub2 ), goto out);
|
||||
{ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪӦ<D2AA>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
{ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪӦ<D2AA>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
EN_GRPAVP_U32_("Service-Specific-Type", SH_VND_ID, dict_obj_tmp, 6006, grpavp_sub2)
|
||||
EN_GRPAVP_STR("Service-Specific-Data", SH_VND_ID, dict_obj_tmp, msg_ptr->msg_body.ccr.cellid, grpavp_sub2)
|
||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
||||
@@ -2154,7 +2110,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
EN_GRPAVP_STR("Originating-IOI", SH_VND_ID, dict_obj_tmp, fd_g_config->cnf_diamid, grpavp_sub2)
|
||||
|
||||
// EN_GRPAVP_STR("Originating-IOI", SH_VND_ID, dict_obj_tmp, "agrandtech_ocs@3gpp.org", grpavp_sub2)
|
||||
EN_GRPAVP_STR("Terminating-IOI", SH_VND_ID, dict_obj_tmp, pHost, grpavp_sub2)
|
||||
EN_GRPAVP_STR("Terminating-IOI", SH_VND_ID, dict_obj_tmp, g_sh_conf_ext.pi_diamid_peer, grpavp_sub2)
|
||||
|
||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
||||
}
|
||||
@@ -2192,23 +2148,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
}
|
||||
}
|
||||
|
||||
if(msg_ptr->msg_body.ccr.cellid_presented == 1)
|
||||
{
|
||||
if (msg_ptr->msg_body.ccr.cellid[3] == 'F')
|
||||
{
|
||||
char mcc[8]="";
|
||||
strncpy(mcc, msg_ptr->msg_body.ccr.cellid, 3);
|
||||
sprintf(tmp_buf, "3GPP-GERAN;cgi-3gpp=%s%s", mcc, &msg_ptr->msg_body.ccr.cellid[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp_buf, "3GPP-GERAN;cgi-3gpp=%s", msg_ptr->msg_body.ccr.cellid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp_buf, "XDSL;'location-info=%s'", phostAddr );
|
||||
}
|
||||
EN_GRPAVP_STR("Access-Network-Information", SH_VND_ID, dict_obj_tmp, tmp_buf, grpavp_sub1)
|
||||
|
||||
if(msg_ptr->msg_body.ccr.role_of_node == 2)
|
||||
@@ -2623,9 +2563,6 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
||||
CHECK_FCT_DO( fd_msg_send( &req, gx_rec_cca, NULL ), goto out );
|
||||
|
||||
out:
|
||||
if(req != NULL)
|
||||
fd_msg_free(req);
|
||||
out1:
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3231,7 +3168,7 @@ int gx_send_ccr_from_client(struct gy_msg *gy_ptr)
|
||||
|
||||
gy_port_ptr->service_type = gy_ptr->request_type;
|
||||
gy_port_ptr->as_client = 1;
|
||||
fd_sess_destroy(&gy_sess[sh_port]);
|
||||
|
||||
gy_sess[sh_port] = NULL;
|
||||
}
|
||||
else
|
||||
@@ -3281,17 +3218,7 @@ int gx_release_port_for_timerout(unsigned short pid)
|
||||
|
||||
}
|
||||
|
||||
CHECK_POSIX_DO( pthread_mutex_lock(&gy_port_lock), { ASSERT(0); } );
|
||||
if(1)
|
||||
{
|
||||
gy_port_init(gy_port, pid);
|
||||
gy_space.used_ports --;
|
||||
}
|
||||
else
|
||||
{
|
||||
gy_release_port(pid);
|
||||
}
|
||||
CHECK_POSIX_DO( pthread_mutex_unlock(&gy_port_lock), { ASSERT(0); } );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -73,17 +73,15 @@ static int ta_init_peer_addr(struct peer_info* inf)
|
||||
static void peer_free_cb(struct peer_info *died_peer, void *cb_data)
|
||||
{
|
||||
LOG_N("peer_free_cb.%p %p", died_peer, cb_data);
|
||||
SH_CONF_S *ptr = (SH_CONF_S *)cb_data;
|
||||
if(NULL == died_peer && MODE_CLI == ta_conf->mode)
|
||||
{
|
||||
struct peer_info inf;
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.pi_diamid = strdup(ptr->pi_diamid_peer);//strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||
inf.pi_diamid = strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||
inf.config.pic_port = ptr->peer_port;
|
||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, ptr));//NULL));
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, NULL));
|
||||
}
|
||||
}
|
||||
static int ta_conf_init(void)
|
||||
@@ -101,74 +99,14 @@ static int ta_conf_init(void)
|
||||
ta_conf->mode = g_sh_conf_ext.mode;
|
||||
/* fj added 20170114. only diameter client connect to peer. In this case, connect to peer when started. */
|
||||
if(MODE_CLI == ta_conf->mode)
|
||||
{
|
||||
if (g_sh_conf_ext.pi_diamid_peer != NULL)
|
||||
{
|
||||
struct peer_info inf;
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.pi_diamid = strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||
inf.config.pic_port = g_sh_conf_ext.peer_port;
|
||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, &g_sh_conf_ext));
|
||||
}
|
||||
|
||||
int i=0;
|
||||
SH_CONF_S *pcfg = NULL;
|
||||
for (i=0; i<rolkset.smslknum; i++)
|
||||
{
|
||||
pcfg = &rolkset.smslk[i].cfg;
|
||||
if (pcfg->pi_diamid_peer != NULL)
|
||||
{
|
||||
struct peer_info inf;
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.pi_diamid = strdup(pcfg->pi_diamid_peer);
|
||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||
inf.config.pic_port = pcfg->peer_port;
|
||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, pcfg));
|
||||
}
|
||||
}
|
||||
for (i=0; i<rolkset.voicelknum; i++)
|
||||
{
|
||||
pcfg = &rolkset.voicelk[i].cfg;
|
||||
if (pcfg->pi_diamid_peer != NULL)
|
||||
{
|
||||
struct peer_info inf;
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.pi_diamid = strdup(pcfg->pi_diamid_peer);
|
||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||
inf.config.pic_port = pcfg->peer_port;
|
||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, pcfg));
|
||||
}
|
||||
}
|
||||
/*if (g_rosms_conf_ext.pi_diamid_peer != NULL)
|
||||
{
|
||||
struct peer_info inf;
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.pi_diamid = strdup(g_rosms_conf_ext.pi_diamid_peer);
|
||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||
inf.config.pic_port = g_rosms_conf_ext.peer_port;
|
||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, &g_rosms_conf_ext));
|
||||
}
|
||||
|
||||
if (g_rovoice_conf_ext.pi_diamid_peer != NULL)
|
||||
{
|
||||
struct peer_info inf;
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.pi_diamid = strdup(g_rovoice_conf_ext.pi_diamid_peer);
|
||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||
inf.config.pic_port = g_rovoice_conf_ext.peer_port;
|
||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, &g_rovoice_conf_ext));
|
||||
}*/
|
||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, NULL));
|
||||
}
|
||||
|
||||
ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
{ \
|
||||
SEARCH_AVP_(udr_search_name, vendor_id, &udr); \
|
||||
CHECK_FCT_DO( fd_msg_avp_new ( udr, 0, &avp ), goto out ); \
|
||||
val.os.data = (uint8_t*)(str); \
|
||||
val.os.data = (uint8_t*)strdup(str); \
|
||||
val.os.len = strlen(str); \
|
||||
CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); \
|
||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp, MSG_BRW_LAST_CHILD, avp ), goto out ); \
|
||||
@@ -129,7 +129,7 @@
|
||||
{ \
|
||||
SEARCH_AVP_(udr_search_name, vendor_id, &udr); \
|
||||
CHECK_FCT_DO( fd_msg_avp_new ( udr, 0, &avp ), goto out ); \
|
||||
val.os.data = (uint8_t*)(str); \
|
||||
val.os.data = (uint8_t*)malloc(str_len); \
|
||||
memcpy(val.os.data, str, str_len);\
|
||||
val.os.len = str_len; \
|
||||
CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); \
|
||||
|
||||
@@ -1,131 +1,7 @@
|
||||
#include "sh_conf.h"
|
||||
|
||||
Ro_LinkSet rolkset={0,0};
|
||||
|
||||
int GetRoDiamIdPeer(DiamId_t **realm, DiamId_t **host, int bSms)
|
||||
{
|
||||
struct peer_hdr*peer = NULL;
|
||||
SH_CONF_S *pcfg = NULL;
|
||||
int i;
|
||||
int ret = -1;
|
||||
int peer_state = -1;
|
||||
if (bSms)
|
||||
{
|
||||
int curlk = rolkset.cursmslk;
|
||||
for (i=0; i<rolkset.smslknum; i++)
|
||||
{
|
||||
curlk = (curlk + i +1) % rolkset.smslknum;
|
||||
pcfg = &rolkset.smslk[curlk].cfg;
|
||||
if (pcfg->pi_diamid_peer != NULL)
|
||||
{
|
||||
ret = fd_peer_getbyid(pcfg->pi_diamid_peer, strlen(pcfg->pi_diamid_peer), 0, &peer);
|
||||
if( !ret && peer )
|
||||
{
|
||||
peer_state = fd_peer_get_state(peer);
|
||||
if( STATE_OPEN == peer_state )
|
||||
{
|
||||
if (rolkset.smslk[curlk].bconn == 0)
|
||||
{
|
||||
printf("diam peer disconn to conn, host[%s]\r\n", pcfg->pi_diamid_peer);
|
||||
rolkset.smslk[curlk].bconn = 1;
|
||||
}
|
||||
*realm = pcfg->pi_diamid_realm_peer;
|
||||
*host = pcfg->pi_diamid_peer;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rolkset.smslk[curlk].bconn == 1)
|
||||
{
|
||||
printf("diam peer conn to discon, host[%s]\r\n", pcfg->pi_diamid_peer);
|
||||
rolkset.smslk[curlk].bconn = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("diam peer NA, host[%s], ret[%d], peer[%p]\r\n", pcfg->pi_diamid_peer, ret, peer);
|
||||
rolkset.smslk[curlk].bconn = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int curlk = rolkset.curvoicelk;
|
||||
for (i=0; i<rolkset.voicelknum; i++)
|
||||
{
|
||||
curlk = (curlk + i +1) % rolkset.voicelknum;
|
||||
pcfg = &rolkset.voicelk[curlk].cfg;
|
||||
if (pcfg->pi_diamid_peer != NULL)
|
||||
{
|
||||
ret = fd_peer_getbyid(pcfg->pi_diamid_peer, strlen(pcfg->pi_diamid_peer), 0, &peer);
|
||||
if( !ret && peer )
|
||||
{
|
||||
peer_state = fd_peer_get_state(peer);
|
||||
if( STATE_OPEN == peer_state )
|
||||
{
|
||||
if (rolkset.voicelk[curlk].bconn == 0)
|
||||
{
|
||||
printf("diam peer disconn to conn, host[%s]\r\n", pcfg->pi_diamid_peer);
|
||||
rolkset.voicelk[curlk].bconn = 1;
|
||||
}
|
||||
*realm = pcfg->pi_diamid_realm_peer;
|
||||
*host = pcfg->pi_diamid_peer;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rolkset.voicelk[curlk].bconn == 1)
|
||||
{
|
||||
printf("diam peer conn to discon, host[%s]\r\n", pcfg->pi_diamid_peer);
|
||||
rolkset.voicelk[curlk].bconn = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("diam peer NA, host[%s], ret[%d], peer[%p]\r\n", pcfg->pi_diamid_peer, ret, peer);
|
||||
rolkset.voicelk[curlk].bconn = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AddRoLink(SH_CONF_S *cfg, uint16_t port, int bSms)
|
||||
{
|
||||
if (bSms)
|
||||
{
|
||||
if(rolkset.smslknum >= MaxRoLinkNum)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
rolkset.smslk[rolkset.smslknum].cfg.pi_diamid_peer = strdup(cfg->pi_diamid_peer);
|
||||
rolkset.smslk[rolkset.smslknum].cfg.pi_diamid_realm_peer = strdup(cfg->pi_diamid_realm_peer);
|
||||
rolkset.smslk[rolkset.smslknum].cfg.peer_port = port;
|
||||
rolkset.smslknum++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rolkset.voicelknum >= MaxRoLinkNum)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
rolkset.voicelk[rolkset.voicelknum].cfg.pi_diamid_peer = strdup(cfg->pi_diamid_peer);
|
||||
rolkset.voicelk[rolkset.voicelknum].cfg.pi_diamid_realm_peer = strdup(cfg->pi_diamid_realm_peer);
|
||||
rolkset.voicelk[rolkset.voicelknum].cfg.peer_port = port;
|
||||
rolkset.voicelknum++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
SH_CONF_S g_sh_conf_ext;
|
||||
//SH_CONF_S g_rovoice_conf_ext;
|
||||
//SH_CONF_S g_rosms_conf_ext;
|
||||
|
||||
#define SH_PARSE_BUFFER_LEN 1024
|
||||
|
||||
@@ -143,7 +19,7 @@ static char* shParseStr_(char* buffer, char* _key, char *ret_str, int flag_from_
|
||||
if(NULL != pos_2)
|
||||
{
|
||||
memcpy(ret_str, pos_1 + 1, pos_2 - pos_1 - 1);
|
||||
ret_str[pos_2 - pos_1] = '\0';
|
||||
ret_str[pos_1 - pos_2] = '\0';
|
||||
// fprintf(stderr, "%s=%s\n", _key, ret_str);
|
||||
return ret_str;
|
||||
}
|
||||
@@ -226,10 +102,6 @@ int shParse_(struct fd_config * conf)
|
||||
return 2;
|
||||
}
|
||||
|
||||
conf->ro_voiceport = 29100;
|
||||
conf->ro_smsport = 19500;
|
||||
strcpy(conf->service_context_voice, "agrandtech_ro@3gpp.org");
|
||||
strcpy(conf->service_context_sms, "agrandtech_sms@3gpp.org");
|
||||
/* Copy process */
|
||||
while((fgets(buffer, SH_PARSE_BUFFER_LEN, fd)) != NULL)
|
||||
{
|
||||
@@ -247,18 +119,6 @@ int shParse_(struct fd_config * conf)
|
||||
|
||||
memset( ret_str, 0, strlen(ret_str) );
|
||||
}
|
||||
if( shParseStr(buffer, "ServiceCxtRoVoice", ret_str) )
|
||||
{
|
||||
strcpy(conf->service_context_voice, ret_str);
|
||||
memset( ret_str, 0, strlen(ret_str) );
|
||||
}
|
||||
if( shParseStr(buffer, "ServiceCxtRoSms", ret_str) )
|
||||
{
|
||||
strcpy(conf->service_context_sms, ret_str);
|
||||
memset( ret_str, 0, strlen(ret_str) );
|
||||
}
|
||||
shParseInt(buffer, "RoVoicePort", &conf->ro_voiceport);
|
||||
shParseInt(buffer, "RoSmsPort", &conf->ro_smsport);
|
||||
shParseInt(buffer, "Port", &conf->cnf_port);
|
||||
shParseInt(buffer, "SecPort", &conf->cnf_port_tls);
|
||||
shParseInt(buffer, "SCTPStr", &conf->cnf_sctp_str);
|
||||
@@ -329,29 +189,6 @@ int shParseExt(struct fd_config * conf)
|
||||
g_sh_conf_ext.pi_diamid_realm_peer = strdup(ret_str);
|
||||
memset( ret_str, 0, strlen(ret_str) );
|
||||
}
|
||||
g_sh_conf_ext.peer_port = fd_g_config->cnf_port;
|
||||
if( shParseFlags(buffer, "ConnectPeer", "Ro_SMS") )
|
||||
{
|
||||
//g_rosms_conf_ext.pi_diamid_peer = strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||
//g_rosms_conf_ext.pi_diamid_realm_peer = strdup(g_sh_conf_ext.pi_diamid_realm_peer);
|
||||
//g_rosms_conf_ext.peer_port = fd_g_config->ro_smsport;
|
||||
AddRoLink(&g_sh_conf_ext, fd_g_config->ro_smsport, 1);
|
||||
free(g_sh_conf_ext.pi_diamid_peer);
|
||||
g_sh_conf_ext.pi_diamid_peer = NULL;
|
||||
free(g_sh_conf_ext.pi_diamid_realm_peer);
|
||||
g_sh_conf_ext.pi_diamid_realm_peer = NULL;
|
||||
}
|
||||
if( shParseFlags(buffer, "ConnectPeer", "Ro_VOICE") )
|
||||
{
|
||||
//g_rovoice_conf_ext.pi_diamid_peer = strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||
//g_rovoice_conf_ext.pi_diamid_realm_peer = strdup(g_sh_conf_ext.pi_diamid_realm_peer);
|
||||
//g_rovoice_conf_ext.peer_port = fd_g_config->ro_voiceport;
|
||||
AddRoLink(&g_sh_conf_ext, fd_g_config->ro_voiceport, 0);
|
||||
free(g_sh_conf_ext.pi_diamid_peer);
|
||||
g_sh_conf_ext.pi_diamid_peer = NULL;
|
||||
free(g_sh_conf_ext.pi_diamid_realm_peer);
|
||||
g_sh_conf_ext.pi_diamid_realm_peer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,36 +13,12 @@ typedef struct _SH_CONF_S
|
||||
int mode;
|
||||
DiamId_t pi_diamid_peer;
|
||||
DiamId_t pi_diamid_realm_peer;
|
||||
uint16_t peer_port;
|
||||
}SH_CONF_S;
|
||||
|
||||
|
||||
extern SH_CONF_S g_sh_conf_ext;
|
||||
|
||||
// Ro link from scp to ocs===============================
|
||||
typedef struct _Ro_Link_S
|
||||
{
|
||||
int bconn;
|
||||
SH_CONF_S cfg;
|
||||
}Ro_Link_S;
|
||||
|
||||
#define MaxRoLinkNum 4
|
||||
typedef struct _Ro_LinkSet
|
||||
{
|
||||
int smslknum;
|
||||
int voicelknum;
|
||||
int cursmslk;
|
||||
int curvoicelk;
|
||||
|
||||
Ro_Link_S smslk[MaxRoLinkNum];
|
||||
Ro_Link_S voicelk[MaxRoLinkNum];
|
||||
}Ro_LinkSet;
|
||||
extern Ro_LinkSet rolkset;
|
||||
//
|
||||
|
||||
//extern SH_CONF_S g_rosms_conf_ext;
|
||||
//extern SH_CONF_S g_rovoice_conf_ext;
|
||||
|
||||
int shParse(struct fd_config * conf);
|
||||
|
||||
|
||||
#endif /* __SH_CONF_H__ */
|
||||
#endif /* __SH_CONF_H__ */
|
||||
@@ -1067,7 +1067,7 @@ int sh_dict_def_cmd_udr()
|
||||
/* User-Data-Request (UDR) Command */
|
||||
/*
|
||||
The User-Data-Request (UDR) command, indicated by the Com
|
||||
mand-Code field set to 306 and the <20>R?bit set in the
|
||||
mand-Code field set to 306 and the <20>R<EFBFBD> bit set in the
|
||||
Command Flags field, is sent by a Diameter client to a Diameter server in order to request user data.
|
||||
Message Format:
|
||||
|
||||
@@ -1151,7 +1151,7 @@ int sh_dict_def_cmd_uda()
|
||||
{
|
||||
/* User-Data-Answer (UDA) Command */
|
||||
/*
|
||||
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the <20>R?bit cleared in
|
||||
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the <20>R<EFBFBD> bit cleared in
|
||||
the Command Flags field, is sent by a server in response to the User-Data-Request command. The Experimental-Result
|
||||
AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||
Message Format:
|
||||
@@ -1209,7 +1209,7 @@ int sh_dict_def_cmd_pur()
|
||||
{
|
||||
/* Profile-Update-Request (PUR) Command */
|
||||
/*
|
||||
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the <20>R?bit set in
|
||||
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the <20>R<EFBFBD> bit set in
|
||||
the Command Flags field, is sent by a Diameter client to a Diameter server in order to update user data in the server.
|
||||
Message Format:
|
||||
|
||||
@@ -1270,7 +1270,7 @@ int sh_dict_def_cmd_pua()
|
||||
{
|
||||
/* Profile-Update-Answer (PUA) Command */
|
||||
/*
|
||||
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the <20>R?bit cleared
|
||||
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the <20>R<EFBFBD> bit cleared
|
||||
in the Command Flags field, is sent by a server in response to the Profile-Update-Request command. The Experimental-
|
||||
Result AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||
Message Format:
|
||||
@@ -4411,7 +4411,7 @@ int sh_dict_init_bak(char * conffile)
|
||||
#endif
|
||||
|
||||
|
||||
/* Error: Editor<6F>s Note: The code for DRMP AVP is to be updated when it is available within the draft-ietf-dime-drmp-02 [13]. */
|
||||
/* Error: Editor<6F>s Note: The code for DRMP AVP is to be updated when it is available within the draft-ietf-dime-drmp-02 [13]. */
|
||||
/* DRMP AVP */
|
||||
{
|
||||
struct dict_avp_data data = {
|
||||
@@ -4460,7 +4460,7 @@ int sh_dict_init_bak(char * conffile)
|
||||
{
|
||||
/*
|
||||
The User-Data-Request (UDR) command, indicated by the Com
|
||||
mand-Code field set to 306 and the <20>R?bit set in the
|
||||
mand-Code field set to 306 and the <20>R<EFBFBD> bit set in the
|
||||
Command Flags field, is sent by a Diameter client to a Diameter server in order to request user data.
|
||||
Message Format:
|
||||
|
||||
@@ -4542,7 +4542,7 @@ int sh_dict_init_bak(char * conffile)
|
||||
/* User-Data-Answer (UDA) Command */
|
||||
{
|
||||
/*
|
||||
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the <20>R?bit cleared in
|
||||
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the <20>R<EFBFBD> bit cleared in
|
||||
the Command Flags field, is sent by a server in response to the User-Data-Request command. The Experimental-Result
|
||||
AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||
Message Format:
|
||||
@@ -4598,7 +4598,7 @@ int sh_dict_init_bak(char * conffile)
|
||||
/* Profile-Update-Request (PUR) Command */
|
||||
{
|
||||
/*
|
||||
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the <20>R?bit set in
|
||||
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the <20>R<EFBFBD> bit set in
|
||||
the Command Flags field, is sent by a Diameter client to a Diameter server in order to update user data in the server.
|
||||
Message Format:
|
||||
|
||||
@@ -4657,7 +4657,7 @@ int sh_dict_init_bak(char * conffile)
|
||||
/* Profile-Update-Answer (PUA) Command */
|
||||
{
|
||||
/*
|
||||
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the <20>R?bit cleared
|
||||
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the <20>R<EFBFBD> bit cleared
|
||||
in the Command Flags field, is sent by a server in response to the Profile-Update-Request command. The Experimental-
|
||||
Result AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||
Message Format:
|
||||
|
||||
@@ -69,7 +69,7 @@ extern "C" {
|
||||
/* #undef ERRORS_ON_TODO */
|
||||
/* #undef DEBUG */
|
||||
|
||||
#define FD_PROJECT_BINARY "agtocs"
|
||||
#define FD_PROJECT_BINARY "freeDiameterd"
|
||||
//#define FD_PROJECT_NAME "freeDiameter"
|
||||
#define FD_PROJECT_NAME "AGT_OCS"
|
||||
|
||||
|
||||
@@ -127,10 +127,6 @@ struct fd_config {
|
||||
unsigned int cnf_timer_tc; /* The value in seconds of the default Tc timer */
|
||||
unsigned int cnf_timer_tw; /* The value in seconds of the default Tw timer */
|
||||
|
||||
char service_context_voice[128];
|
||||
char service_context_sms[128];
|
||||
uint16_t ro_voiceport;// yaxin
|
||||
uint16_t ro_smsport;// yaxin
|
||||
uint16_t cnf_port; /* the local port for legacy Diameter (default: 3868) in host byte order */
|
||||
uint16_t cnf_port_tls; /* the local port for Diameter/TLS (default: 5868) in host byte order */
|
||||
uint16_t cnf_port_3436; /* Open an additional server port to listen to old TLS/SCTP clients (RFC3436, freeDiameter versions < 1.2.0) */
|
||||
|
||||
@@ -69,13 +69,13 @@ typedef struct gy_ccr
|
||||
char msc_addr[NUMBER_LEN];
|
||||
char vlr_number[NUMBER_LEN];
|
||||
char imsi[NUMBER_LEN];
|
||||
char apn[GY_APN_LEN];
|
||||
char cellid[16];
|
||||
char apn[GY_APN_LEN];
|
||||
int sgsn_ip;
|
||||
int ggsn_ip;
|
||||
char request_action;
|
||||
char cellid_presented;
|
||||
//char mscc_presented;
|
||||
char mscc_presented;
|
||||
char role_of_node;
|
||||
//long balance_to_check;
|
||||
float req_service_unit;
|
||||
@@ -92,7 +92,8 @@ typedef struct gy_cca
|
||||
int check_balance_result;
|
||||
long grant_value;
|
||||
long volume_threshold;
|
||||
long time_threshold;
|
||||
int validity_time;
|
||||
int time_threshold;
|
||||
int is_final;
|
||||
}_gy_cca;
|
||||
|
||||
|
||||
@@ -470,7 +470,6 @@ int fd_conf_parse()
|
||||
|
||||
unsigned int verify;
|
||||
time_t now;
|
||||
/*
|
||||
GNUTLS_TRACE( gnutls_certificate_get_x509_cas (fd_g_config->cnf_sec_data.credentials, &CA_list, (unsigned int *) &CA_list_length) );
|
||||
GNUTLS_TRACE( gnutls_certificate_get_x509_crls (fd_g_config->cnf_sec_data.credentials, &CRL_list, (unsigned int *) &CRL_list_length) );
|
||||
CHECK_GNUTLS_DO( gnutls_x509_crt_list_verify(certs, cert_max, CA_list, CA_list_length, CRL_list, CRL_list_length, 0, &verify),
|
||||
@@ -478,7 +477,7 @@ int fd_conf_parse()
|
||||
TRACE_ERROR("Failed to verify the local certificate '%s' against local credentials. Please check your certificate is valid.", fd_g_config->cnf_sec_data.cert_file);
|
||||
return EINVAL;
|
||||
} );
|
||||
*/
|
||||
|
||||
if (verify) {
|
||||
fd_log_debug("TLS: Local certificate chain '%s' is invalid :", fd_g_config->cnf_sec_data.cert_file);
|
||||
if (verify & GNUTLS_CERT_INVALID)
|
||||
|
||||
@@ -128,8 +128,6 @@ static void core_shutdown(void)
|
||||
|
||||
static void * core_runner_thread(void * arg)
|
||||
{
|
||||
char cause[128]={"no cb"};
|
||||
|
||||
fd_log_threadname("fD Core Runner");
|
||||
|
||||
core_state_wait(CORE_RUNNING);
|
||||
@@ -146,7 +144,6 @@ static void * core_runner_thread(void * arg)
|
||||
{
|
||||
TRACE_DEBUG(NONE, "Internal error: got FDEV_TRIGGER without trigger value!");
|
||||
ASSERT(0);
|
||||
sprintf(cause,"Internal error: got FDEV_TRIGGER without trigger value!");
|
||||
goto end;
|
||||
} );
|
||||
p = data;
|
||||
@@ -157,8 +154,6 @@ static void * core_runner_thread(void * arg)
|
||||
break;
|
||||
|
||||
case FDEV_TERMINATE_INT:
|
||||
sprintf(cause,"Internal error: got FDEV_TERMINATE_INT!");
|
||||
|
||||
goto end;
|
||||
|
||||
default:
|
||||
@@ -168,18 +163,7 @@ static void * core_runner_thread(void * arg)
|
||||
|
||||
end:
|
||||
core_shutdown();
|
||||
if(1)
|
||||
{
|
||||
FILE *fp=NULL;
|
||||
|
||||
fp = fopen("fd_cause.txt","w");
|
||||
if(fp)
|
||||
{
|
||||
fprintf(fp,"%s\r\n",cause);
|
||||
fclose(fp);
|
||||
}
|
||||
exit(12);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,7 @@
|
||||
/* #define OLD_SCTP_SOCKET_API */
|
||||
|
||||
/* Automatically fallback to old API if some of the new symbols are not defined */
|
||||
//#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
|
||||
#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)) || \
|
||||
(!defined(SCTP_SEND_FAILED_EVENT)) || (!defined(SCTP_NOTIFICATIONS_STOPPED_EVENT)) )
|
||||
#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
|
||||
# define OLD_SCTP_SOCKET_API
|
||||
#endif
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ static void set_sess_transport(gnutls_session_t session, struct sctp3436_ctx *ct
|
||||
/* Reset the low water value, since we don't use sockets */
|
||||
#ifndef GNUTLS_VERSION_300
|
||||
/* starting version 2.12, this call is not needed */
|
||||
//GNUTLS_TRACE( gnutls_transport_set_lowat( session, 0 ) );
|
||||
GNUTLS_TRACE( gnutls_transport_set_lowat( session, 0 ) );
|
||||
#else /* GNUTLS_VERSION_300 */
|
||||
/* but in 3.0 we have to provide the pull_timeout callback */
|
||||
GNUTLS_TRACE( gnutls_transport_set_pull_timeout_function( session, sctp3436_pull_timeout ) );
|
||||
|
||||
Reference in New Issue
Block a user