feat: create cook branch

This commit is contained in:
zhangsz
2025-03-08 16:40:56 +08:00
parent 9a139c52c6
commit 025a455e17
70 changed files with 3603 additions and 11829 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 ); \

View File

@@ -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;
}
}

View File

@@ -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__ */

View File

@@ -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:

View File

@@ -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"

View File

@@ -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) */

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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 ) );

View File

@@ -12,7 +12,7 @@
*/
#include <stdarg.h> /* ANSI C header file */
#include <syslog.h>
//#include <sys/io.h>
#include <sys/io.h>
#include <error.h>
#include "../../debug/src/include/debug.h"
#include "./include/iptrans.h"

View File

@@ -13,7 +13,7 @@
#include <setjmp.h>
#include <unistd.h>
#include <signal.h>
//#include <stropts.h>
#include <stropts.h>
#include <time.h>
#include <syslog.h>
#include <termio.h>
@@ -23,7 +23,7 @@
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/ioctl.h>
//#include <sys/io.h>
#include <sys/io.h>
#include <sys/poll.h>
#include <sys/stat.h>
#include <sys/wait.h>

View File

@@ -6,7 +6,7 @@
#define _MTP3_HEAD_FILE
#define _up_message up_message
#define MAX_SS7_MSG_LEN 400 //272
#define MAX_SS7_MSG_LEN 300 //272
typedef struct up_message{
long dest_ip;

View File

@@ -22,7 +22,7 @@
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/ioctl.h>
//#include <sys/io.h>
#include <sys/io.h>
#include <sys/poll.h>
#include <sys/stat.h>
#include <sys/wait.h>

View File

@@ -244,8 +244,6 @@ typedef struct _mtp3_state
BYTE tprc_state;
BYTE MTP3WatchDog[MAX_LK];
BYTE link_enable_sent_flag[MAX_LK];
}_mtp3_state;
extern _mtp3_state mtp3ObjState;

View File

@@ -165,7 +165,6 @@ int mtp3lite_InitClientSocket(WORD lk)
bzero(&sin_addr,sizeof(struct sockaddr));
sin_addr.sin_family = AF_INET;
//sin_addr.sin_port = htons(mtp3lite_port);
sin_addr.sin_addr.s_addr = GetLocalIP();
mtp3lite_link[lk].cliSockfd = -1;
if (isMtp3LiteClientLink(lk) && !checkIfOveridesocket(lk))
@@ -173,7 +172,7 @@ int mtp3lite_InitClientSocket(WORD lk)
//sin_addr.sin_port = mtp3_para->mtp3lite_port; //server port,tmp
//sin_addr.sin_addr.s_addr = mtp3_para->lk[lk].remote_ip;
//bzero(&(sin_addr.sin_zero),8);
if ((socketfd = mtp3lite_Init_TCPSocket(sin_addr,1)) < 0)
if ((socketfd = mtp3lite_Init_TCPSocket(sin_addr,0)) < 0)
{
printf("MTP3LITE TCP Client Socket(%d) Init Failed!\n",mtp3_para->mtp3lite_port);
//exit(1);
@@ -268,7 +267,7 @@ int mtp3lite_TcpConnectCheck()
bzero(&cliaddr,(clilen = sizeof(struct sockaddr)));
connfdtmp = accept(mtp3lite_listen_fd,(struct sockaddr *)&cliaddr,&clilen);
if (connfdtmp <= 0)//no connect request , check client socket
if (connfdtmp <= 0)//no connect request , check client socke
{
link = cliLk++;
if (!isMtp3LiteClientLink(link))
@@ -297,11 +296,6 @@ int mtp3lite_TcpConnectCheck()
mtp3lite_CloseTcpConn(link);
return 0;
}
else
{
mtp3lite_link[link].connfd = connfdtmp;
mtp3lite_updateStatus(link, MTP2_STATE_WORKING, 0);
}
return 0;
}
else if ((link = mtp3lite_get_lk_by_ip(&cliaddr)) < 0)
@@ -315,7 +309,7 @@ int mtp3lite_TcpConnectCheck()
mtp3lite_link[link].connfd = connfdtmp;
mtp3lite_link[link].cliSockfd = connfdtmp;
mtp3lite_link[link].remote_port = cliaddr.sin_port;
mtp3_debug(MTP3DB_EVENT,"link[%d] connfd: %d, rem_port: %d\n", link, connfdtmp, ntohs(mtp3lite_link[link].remote_port));
printf("link[%d] connfd: %d, rem_port: %d\n", link, connfdtmp, ntohs(mtp3lite_link[link].remote_port));
fcntl(mtp3lite_link[link].connfd,F_SETFL,O_NONBLOCK);
if (setsockopt(mtp3lite_link[link].connfd,SOL_SOCKET,SO_KEEPALIVE, &keepAlive,sizeof(keepAlive)) != 0)
@@ -332,24 +326,6 @@ int mtp3lite_TcpConnectCheck()
return 1;
}
int send_mtp3lite_id_ack(WORD link)
{
BYTE id_ack_msg[4]={0,0x1,0xfe, 0x6};
mtp3lite_DirectSendMsg(link, 4, id_ack_msg);
mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d send Inditify ACK",link);
return 1;
}
int send_mtp3lite_ping(WORD link)
{
BYTE id_ack_msg[4]={0x00,0x01,0xfe, 0x00};
mtp3lite_DirectSendMsg(link, 4, id_ack_msg);
mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d send PING",link);
return 1;
}
int mtp3lite_DirectRecvMsg(WORD link)
{
struct sockaddr_in sin;
@@ -360,19 +336,12 @@ int mtp3lite_DirectRecvMsg(WORD link)
// if ((len1 = mtp3lite_rem_len[link])>0)
// printf("len1: %d\n", len1);
len1 = mtp3lite_rem_len[link];
if(len >= MTP3LITE_MSG_BUF_SIZE_PER_LINK)
{
mtp3_debug(MTP3DB_EVENT, "mtp3lite link[%d] buffer is full!\n", link);
return 0;
}
nbytes = recvfrom(mtp3lite_link[link].connfd, mtp3lite_msg_buf[link] + len1,
MTP3LITE_MSG_BUF_SIZE_PER_LINK - len1, 0, (struct sockaddr *) &sin, &len);
if (nbytes == 0 && errno != 11)
if (nbytes == 0)
{
mtp3_debug(MTP3DB_EVENT, "mtp3lite tcp link[%d] error : %d\n", link, errno);
printf("tcp link[%d] error : %d\n", link, errno);
mtp3lite_CloseTcpConn(link);
mtp3lite_updateStatus(link, MTP2_STATE_STOP, MTP3LITE_TCP_FAILURE);
mtp3lite_rem_len[link] = 0;
@@ -499,9 +468,8 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
else if (sub_len == 1)
{
if(buf_ptr[1+2] == 0x6)
// if(buf_ptr[1+2] == 0x6 || buf_ptr[2] == 0x06)
{ // Receive Keep Alive Message
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 200;
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 100;
mtp3lite_link[link].remote_inactive_timeouts = 0;
//mtp3lite_print_msg(buf_ptr, 3);
total_hdl_len += (sub_len + 3);
@@ -510,17 +478,13 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
continue;
}
else
{
//mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d RECV IPA Ping!",link);
//send_mtp3lite_ping(link);
return -1;
}
}
// if ((buf_ptr[1+2] > 9) || (buf_ptr[1+2] == 0))
// return -1;
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 200;
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 100;
mtp3lite_link[link].remote_inactive_timeouts = 0;
//mtp3lite_print_msg(buf_ptr, sub_len + 1);
@@ -533,7 +497,7 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
//nw = mtp3_para->ls_pro[lk_set] & 3;
nw = mtp3_para->ls_pro[lk_set].nw_id ;
up_msg_ptr->sio = 0x03 | (nw << 6);//sccp lite always itu message
up_msg_ptr->sio |= (mtp3_para->nw[nw].pc_type & 1)<<4;//detect ansi or itu sccp, ansi=1,itu=0
up_msg_ptr->sio |= (mtp3_para->nw[nw].pc_len & 1)<<4;//detect ansi or itu sccp, ansi=1,itu=0
up_msg_ptr->opc = mtp3_para->ls_pro[lk_set].ls_op_pc;
if (pc_length(up_msg_ptr->sio >> 6) == MTP3_24BIT_PC)
up_msg_ptr->dpc = mtp3_para->nw[nw].opc24;
@@ -553,6 +517,14 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
return 1;
}
int send_mtp3lite_id_ack(WORD link)
{
BYTE id_ack_msg[4]={0,0x1,0xfe, 0x6};
mtp3lite_DirectSendMsg(link, 4, id_ack_msg);
mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d send Inditify ACK",link);
return 1;
}
int get_mtp3lite_msg(WORD link)
{
@@ -704,7 +676,7 @@ int mtp3lite_chk_lk(WORD link)
}
else
{
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 200;
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 100;
}
}
}
@@ -715,14 +687,12 @@ int mtp3lite_chk_lk(WORD link)
{
mtp3lite_id_fg[link] = 1;
send_mtp3lite_id_ack(link);
//send_mtp3lite_ping(link);
}
if (--mtp3lite_link[link].local_inactive == 0)
{
// mtp3lite_DirectSendMsg(link, 3, mtp3lite_ka_msg);
// put_mtp3lite_msg(&str);
mtp3lite_link[link].local_inactive = 2000;
send_mtp3lite_id_ack(link);
}
}

View File

@@ -865,7 +865,6 @@ static void i_sys()
mtp3ObjState.link_l3_state[i] = UNAVAILABLE;
mtp3ObjState.link_l2_state[i] = UNAVAILABLE;
mtp3ObjState.link_l1_state[i] = UNAVAILABLE;
mtp3ObjState.link_enable_sent_flag[i] = 0;
mtp3_set_link_manager(i);
@@ -993,8 +992,6 @@ int update_ls_slc_table(int link)
{
mtp3ObjState.lk_configured[link] = PARA_CONFIGURED;
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
mtp3ObjState.link_enable_sent_flag[link] = 0;
mtp3.ls[ls].linksNum_configured++;
ls_slc[lsx16+slc] = link;
// linknum_in_ls[ls]++;
@@ -1005,8 +1002,6 @@ int update_ls_slc_table(int link)
{
mtp3ObjState.lk_configured[link] = PARA_NOT_CONFIGURED;
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
mtp3ObjState.link_enable_sent_flag[link] = 0;
mtp3_heartbeat.link_state[idiv4] = mtp3_heartbeat.link_state[idiv4] | temp;
}
}
@@ -1173,11 +1168,11 @@ void init_mtp3table()
{
update_timer(i);
}
mtp3_para->mtp3_t10 = 126; //63;/* 40 SECOND, unit=640ms,for dpc */
mtp3_para->mtp3_t18 = 40;//20;
mtp3_para->mtp3_t19 = 8;//4;
mtp3_para->mtp3_t20 = 8;//4;
mtp3_para->mtp3_t21 = 750; //375;/* 30 SECOND,unit=80ms, for linkset */
mtp3_para->mtp3_t10 = 63;/* 40 SECOND, unit=640ms,for dpc */
mtp3_para->mtp3_t18 = 20;
mtp3_para->mtp3_t19 = 4;
mtp3_para->mtp3_t20 = 4;
mtp3_para->mtp3_t21 = 375;/* 30 SECOND,unit=80ms, for linkset */
mtp3ObjInput.tprc_input = TPRC_SP_RESTART_INDICATION;
own_sp_restarting = 1;
tprc_mgmt_signalling_point_restart_indication();
@@ -1229,8 +1224,6 @@ void mtp_shm_init(WORD moduleid_systemid, DWORD local_ip, DWORD peer_ip)
mtp_local_ip = local_ip;
mtp_peer_ip = peer_ip;
//mtp3_alterip = peer_ip;
printf("mtp3 complete init\n");
}

View File

@@ -8,7 +8,7 @@ int mtp3_send_netcap=0;
void reset_mtp3();
long atol(const char *nptr);
//int gettimeofday(struct timeval *tv,struct timezone *tz);
int gettimeofday(struct timeval *tv,struct timezone *tz);
struct tm *localtime(const time_t *timep);
void mtp3_list_link(WORD i);
@@ -19,8 +19,8 @@ extern BOOL mtp3DebugFull;
BYTE disp_flag;
BYTE disp_page[16];
static BYTE * disp_ptr;
static BYTE disp_length;
BYTE * disp_ptr;
BYTE disp_length;
static DWORD debug_mask=0;
void mtp3_show_routine_status(BYTE nw);

View File

@@ -2112,7 +2112,6 @@ void mtp3_setlink_to_IDLE(WORD link)
otherMTP3_managed_link_unavailable(link);
mtp3ObjState.link_l2_state[link] = UNAVAILABLE;
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
mtp3ObjState.link_enable_sent_flag[link] = 0;
}
}
@@ -3199,6 +3198,7 @@ void trap_mtp2 (BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_addr
}
}
int mtp3_clear_all_peer_link_status();
void mtp3_dealtrap(BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_addr *addr)
{
DWORD mtp2_oid[20] = MTP2_HB_OID;
@@ -3218,7 +3218,6 @@ void mtp3_dealtrap(BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_a
if ((mtp3_para->MTP3SerialNum==0) ||//support old version, do not have serial number
(Bcd2Ull(&msg_ptr[39],MTP3_SERNUM_LEN)==mtp3_para->MTP3SerialNum) )
{
if(peer_hb_timer>0)
{
if(++peer_hb_timer>4)
@@ -3255,7 +3254,6 @@ int mtp3_clear_all_peer_link_status()
if(mtp3ObjState.link_l3_state[link] == AVAILABLE)
{
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
mtp3ObjState.link_enable_sent_flag[link] = 0;
}
}
}
@@ -4530,8 +4528,5 @@ void mtp3_snmp_registration(void)
register_snmp_table(&mtp3_register);
}
int mtp3_get_net_pclen(int netid)
{
return mtp3_para->nw[netid%4].pc_len;
}
/*@end@*/

View File

@@ -30,7 +30,7 @@ extern mtp3_routing_result routingResult;
extern void mtp3_debug(int n,const char *fmt,...);
extern BYTE mtp3_check_dpc_equal_to_opc(BYTE nw, ulong dpc);
static int detail_debug_flag=0;
static int detail_debug_flag=1;
static int rc_timer=190;
extern DWORD mtp_local_ip, mtp_peer_ip;
@@ -472,46 +472,15 @@ int priority_own_link(WORD lsno,WORD sls)
return -1;
ls = &mtp3.ls[lsno];
if(detail_debug_flag)
{
if(1)
{
char buf[256];
char strbuf[1024];
mtp3_debug(MTP3DB_EVENT, "%s, linkset=%d, sls=%d, linkconfigred=%d ",
__FUNCTION__,
lsno,
sls,
mtp3.ls[lsno].linksNum_configured);
memset(strbuf, 0x00, 16);
for(i=0;i<2; i++)
{
link = ls_sls[(lsno<<4)+i];
sprintf(buf, "ls_sls[%02d]=%d, ip=%08x, state=%d",
i,
ls_sls[(lsno<<4)+i],
mtp3_para->lk[link].e1_to_mtp3,
mtp3ObjState.link_l3_state[link]);
strcat(strbuf, buf);
}
mtp3_debug(MTP3DB_EVENT, "%s, %s ",
__FUNCTION__,
strbuf);
}
}
for (i=0;i<16;i++)
// for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
{
link = ls_sls[(lsno<<4)+i];
if (mtp3_para->lk[link].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[link] == AVAILABLE)
return link;
}
for (i=0;i<16;i++)
// for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
{
link = ls_sls[(lsno<<4)+i];
@@ -607,11 +576,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
ls_info = &mtp3.ls[ls];
/* added for override link status -- start */
/*
if(m2ua_get_traffic_mode_type()==0)
{
if(ls_info->send_asp_ac_link_id>0 && ls_info->send_asp_ac_link_id != 0xffff)
{
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,
"[SCCP] M3UA ==> M2UA < %s > DPC=%d, Link=%d (asc link=%d)",__FUNCTION__, dpc, outlink,
ls_info->send_asp_ac_link_id);
return ls_info->send_asp_ac_link_id;
}
@@ -619,11 +591,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
{
int link_no = get_asp_ac_link(ls,sls);
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,
"[SCCP] M3UA ==> M2UA < %s > DPC=%d, Link=%d (asc link=%d)",__FUNCTION__, dpc, link_no,
ls_info->send_asp_ac_link_id);
return link_no;
}
}
*/
/* added for override link status -- end*/
if (mtp3_para->lk[outlink].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[outlink] == AVAILABLE)
@@ -639,11 +614,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
ls_info = &mtp3.ls[ls];
/* added for override link status -- start */
/*
if(m2ua_get_traffic_mode_type()==0)
{
if(ls_info->send_asp_ac_link_id>0 && ls_info->send_asp_ac_link_id != 0xffff)
{
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,
"[SCCP] M3UA ==> M2UA < %s > DPC=%d(ALS), Link=%d (asc link=%d)",__FUNCTION__, dpc, outlink,
ls_info->send_asp_ac_link_id);
return ls_info->send_asp_ac_link_id;
}
@@ -651,11 +629,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
{
int link_no = get_asp_ac_link(ls,sls);
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,
"[SCCP] M3UA ==> M2UA < %s > DPC=%d(ALS), Link=%d (asc link=%d)",__FUNCTION__, dpc, link_no,
ls_info->send_asp_ac_link_id);
return link_no;
}
}
*/
/* added for override link status -- end*/
if (mtp3_para->lk[outlink].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[outlink] == AVAILABLE)
@@ -3035,7 +3016,7 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
if( ls_disable == 0)
continue;
// sp->m3ua_rc_status[spplace] = rc_status;
sp->m3ua_rc_status[spplace] = rc_status;
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
__FUNCTION__,
@@ -3043,19 +3024,15 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
chl,
spplace, sp->routine[spplace]);
mark_normal_linkset_unavailable(&sp->routine[spplace]);
if ( ((sp->routine[spplace] >> 2) & 3) == 0 )/*alternative route available */
sp->routine[spplace] = (sp->routine[spplace] & 0x3f) + 0x40;/* current route change from normal linkset to alternative linkset */
else/* sp not accessible */
{
sp_unaccessable((BYTE *)&sp->routine[spplace]);
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
sp->m3ua_rc_status[spplace] = rc_status;
}
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
{
if(1)
if(mtp_peer_ip != 0)
{
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
@@ -3089,27 +3066,21 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
continue;
//sp->m3ua_rc_status[spplace] = rc_status;
sp->m3ua_rc_status[spplace] = rc_status;
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA ALS update route info, link=%d, sppace=%d, sp->routine=%d, rc_status=%d",
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA ALS update route info, link=%d, sppace=%d, sp->routine=%d",
__FUNCTION__,
__LINE__,
chl,
spplace, sp->routine[spplace],
sp->m3ua_rc_status[spplace]);
mark_alternative_linkset_unavailable(&sp->routine[spplace]);
spplace, sp->routine[spplace]);
if ( (sp->routine[spplace] & 3) != 0 )/* normal route unavailable */
{
sp_unaccessable((BYTE *)&sp->routine[spplace]);
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
sp->m3ua_rc_status[spplace] = rc_status;
}
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
{
if(1)
if(mtp_peer_ip != 0)
{
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
@@ -3202,7 +3173,6 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
}
if(1)
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp_peer_ip != 0)
{
send_route_to_other_plat(dpc,
@@ -3222,8 +3192,6 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
__LINE__,
chl,
spplace, sp->routine[spplace]);
rc_timer = 100; //make sure 1 second later to send ASP_AC
}
sp = &mtp3.nw[nw];
@@ -3234,37 +3202,29 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
// continue;
sp->m3ua_rc_status[spplace] = rc_status;
routine = (BYTE*)&sp->routine[spplace];
if(detail_debug_flag)
if(0)
mtp3_debug(MTP3DB_EVENT," <%s:%d> S5 ALS,M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
__FUNCTION__, __LINE__,
chl,
spplace, *routine);
spplace, sp->routine[spplace]);
mark_alternative_linkset_available(&mtp3.nw[nw].routine[spplace]); //17-11-07
routine = (BYTE *)&mtp3.nw[nw].routine[spplace];
if ( (*routine) >> 6 == 2 )// no route
if ( (*routine) >> 6 == 2 )/* no route */
{
(*routine) = ((*routine) & 0x3f) + 0x40;// current route is alternative linkset
(*routine) = ((*routine) & 0x3f) + 0x40;/* current route is alternative linkset */
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
}
{
mark_alternative_linkset_available(&mtp3.nw[nw].routine[spplace]);
routine = (BYTE *)&mtp3.nw[nw].routine[spplace];
/*
if (Nlinkset_status(*routine) == LS_AVAILABLE)
(*routine) = ((*routine) & 0x3f); // current route is normal linkset
else if (Alinkset_status(*routine) == LS_AVAILABLE)
(*routine) = ((*routine) & 0x3f) + 0x40;
else
(*routine) = ((*routine) & 0x3f) + 0x80;
}
*/
if(0)
{
mark_alternative_linkset_available(&mtp3.nw[nw].routine[spplace]);
routine = (BYTE *)&mtp3.nw[nw].routine[spplace];
}
if(1)
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp_peer_ip != 0)
{
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
@@ -3274,15 +3234,17 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
chl,
opc);
}
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp3_para->lk[chl].e1_to_alterMTP3 !=0)
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc, nw, sp->routine[spplace], mtp3_para->lk[chl].e1_to_alterMTP3, chl, opc);
}
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT," <%s:%d> S5 ALS,M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
__FUNCTION__, __LINE__,
chl,
spplace, sp->routine[spplace]);
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp3_para->lk[chl].e1_to_alterMTP3 !=0)
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc, nw, sp->routine[spplace], mtp3_para->lk[chl].e1_to_alterMTP3, chl, opc);
}
}
// if ((mtp3.nw[nw].routine[dpc_index] & 0x0f) == 0x0a)// all road unavailable
// mark_dstSP_inaccessible(&mtp3.nw[nw].routine[dpc_index]);
@@ -3400,7 +3362,6 @@ int m3ua_ssnm_update_route(xua_ssnm_cmd *p_ssnm)
else
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
if(1)
if(mtp3ObjState.lk_mtp3[link] == mtp3_localip && mtp_peer_ip != 0)
{
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
@@ -3425,12 +3386,10 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
ls_info *ls;
int set_unaccessable = 0 ;
/*
if ((mtp3ObjState.lk_configured[chl] == PARA_NOT_CONFIGURED) ||
(mtp3ObjState.lk_mtp3[chl] != mtp3_localip))
return 0;
*/
rc_timer = 195+(mtp2_systemid%2)*5;
if (mtp3ObjState.lk_configured[chl] == PARA_NOT_CONFIGURED)
@@ -3459,7 +3418,7 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
if (new_l2_state != mtp3ObjState.link_l2_state[chl])
{
if(detail_debug_flag)
// if(detail_debug_flag)
{
mtp3_debug(MTP3DB_ERROR,"m3ua_updateStatus, link=%d, l2_state=%d, command=%d, rc=%d, rc_status=%d",
chl, new_l2_state, command, rc, rc_status);
@@ -3517,36 +3476,11 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
m3ua_upd_route_status(chl, rc, 5, 1);
mtp3.ls[ls_t].links_available ++;
ls->links_available_t = scan_ls_link_available(ls_t);
if(ls->links_available_t == 1)
{
if (mtp3ObjState.lk_mtp3[chl] != mtp3_localip)
ls->send_asp_ac_link_id = chl;
}
if(0)
{
if(ls->links_available_t== 1)
{
if(ls->send_asp_ac_link_id == 0x00 || ls->send_asp_ac_link_id == 0xffff )
{//for override mode
ls->send_asp_ac_link_id = chl;
m3ua_set_link_rc_to_m2ua(chl);
send_command_to_m3ua(chl, 1,M3UA_RC_CMD , rc, 0);
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,"<%s:%d> M3UA send RC_CMD, link=%d",
__FUNCTION__, __LINE__,
chl);
}
}
}
//mtp3ObjState.lk_mtp3[chl] = mtp3_localip;
mtp3ObjState.lk_mtp3[chl] = mtp3_localip;
}
else if (mtp3ObjState.link_l2_state[chl] == MTP2_STATE_WORKING)
{
@@ -3579,7 +3513,6 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
if(ls->send_asp_ac_link_id == chl)
ls->send_asp_ac_link_id = 0xFFFF;
ls->links_nls_asp_ac_send_flag[chl] = 0;
ls->links_available_t = scan_ls_link_available(ls_t);
@@ -3668,9 +3601,8 @@ int GetM3uaMsg(ulong port)
chl = lm_lk_ptr->link;//???
new_l2_state = lm_lk_ptr->opercode;
if(new_l2_state)
m3ua_updateStatus(chl, new_l2_state, 0, 0 ,0);
mtp3_debug(MTP3DB_PRIMITIVE_MSG,"get M3UA link[%d], state=%d, heartbeat from %lx", chl, new_l2_state, msgSourceIP);
mtp3_debug(MTP3DB_PRIMITIVE_MSG,"get M3UA link heartbeat from %lx",msgSourceIP);
mtp3_showbuf(MTP3DB_PRIMITIVE_MSG,(BYTE *)mtp3_m3ua_msg,ntohs(lm_lk_ptr->len)+4);
return 0;
@@ -3787,22 +3719,9 @@ int GetM3uaMsg(ulong port)
int send_command_to_m3ua(WORD link, BYTE command, BYTE xua_msg_class, DWORD rc, DWORD aff_pc)
{
char charCmd[32];
static int rc_cmd_counter=0, total_cmd_counter=0;
if(0)
{
if(rc_cmd_counter < 5 && total_cmd_counter++ < 100)
{
char buf[128];
sprintf(buf, "link=%d, cmd=%d, xmc=%d", link, command, xua_msg_class);
pub_print_traceback(buf);
}
}
if(xua_msg_class == M3UA_RC_CMD)
{
rc_cmd_counter ++;
mtp3_iprt.io_msg.msgLength = 5+1+4+1;
mtp3_iprt.io_msg.msgContent[0] = xua_msg_class;
mtp3_iprt.io_msg.msgContent[2] = link>>8;
@@ -3811,9 +3730,6 @@ int send_command_to_m3ua(WORD link, BYTE command, BYTE xua_msg_class, DWORD rc,
mtp3_iprt.io_msg.msgContent[4] = 7;
mtp3_iprt.io_msg.msgContent[9] = command;
memcpy(&mtp3_iprt.io_msg.msgContent[5], &rc, 4);
sprintf(charCmd,"M3UA_ASP_Active");
}else if(xua_msg_class == M3UA_MGMT_CMD)
{
mtp3_iprt.io_msg.msgLength = 5+1+1;
@@ -3871,33 +3787,8 @@ void deactive_m3ua_lk(WORD link)
}
}
void m3ua_set_link_rc_to_m2ua(int linkno)
{
int i;
WORD lsno, spplace;
BYTE nw;
DWORD rc;
network *sp;
ls_info *ls;
lsno = mtp3_para->lk[linkno].e1_to_linkset;
if (lsno >= MAX_LS)
return;
ls = &mtp3.ls[lsno];
nw = mtp3_para->ls_pro[lsno].nw_id;
sp = &mtp3.nw[nw];
for ( i=0; i<(ls->influ_dstnum_asNLS % MAX_LS_DPC_ADD1); i++ )
{
spplace = ls->influ_dstplace_intable_asNLS[i];
rc = mtp3_para->nw[nw].routing[spplace].rc;
m2ua_set_sg_rc(linkno, rc);
}
}
void check_m3ua_link_status(int force_flag)
extern int m2ua_set_sg_rc(int linkno, int rc);
void check_m3ua_link_status()
{
int link,i;
WORD lsno, spplace;
@@ -3906,16 +3797,15 @@ void check_m3ua_link_status(int force_flag)
network *sp;
ls_info *ls;
static int link_timer=0;
int check_timer = ( mtp2_systemid * 30 + 400);
int check_timer = ( mtp2_systemid * 30 + 200);
int send_asp_ac_flag = 0;
if(rc_timer >= check_timer || force_flag)//2s
if(rc_timer >= check_timer)//2s
{
rc_timer = 0;
for(link=0;link<MAX_LK; link++)
{
// if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1)&&(check_if_local_ip(mtp3ObjState.lk_mtp3[link] )) ) //mtp3_localip))
if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1)&&(mtp3ObjState.lk_mtp3[link] == mtp3_localip))
{
if(mtp3ObjState.link_l3_state[link] == AVAILABLE)
@@ -3972,38 +3862,11 @@ void check_m3ua_link_status(int force_flag)
}
if(send_asp_ac_flag == 0)
{
//ls->send_asp_ac_link_id = link; //
if(0)
{
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,"<%s:%d> M3UA send RC_CMD, link=%d, total links=%d, sppace=%d, sp->routine=%d, act link=%d",
__FUNCTION__, __LINE__,
link,
ls->links_available_t,
spplace,
sp->routine[spplace],
ls->send_asp_ac_link_id);
}
}
else
{
if(ls->links_nls_asp_ac_send_flag[link] == 1)
send_asp_ac_flag = 0;
ls->send_asp_ac_link_id = link; //
}
}
else
{
if(0)
mtp3_debug(MTP3DB_EVENT,"<%s:%d> link=%d, sppace=%d, sp->routine=%d, rc_status=%d, lk_asp_ac=%d",
__FUNCTION__, __LINE__,
link,
spplace,
sp->routine[spplace],
sp->m3ua_rc_status[spplace],
ls->links_nls_asp_ac_send_flag[link]);
if(sp->m3ua_rc_status[spplace]!=5 || ls->links_nls_asp_ac_send_flag[link] == 0 )
{
@@ -4118,13 +3981,8 @@ void check_m3ua_link_status(int force_flag)
{
if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1) &&(mtp3ObjState.lk_mtp3[link] == mtp3_localip))
{
if(mtp3ObjState.link_l3_state[link] == UNAVAILABLE || mtp3ObjState.link_enable_sent_flag[link] == 0)
{
mtp3ObjState.link_enable_sent_flag[link] = 1;
if(mtp3ObjState.link_l3_state[link] == UNAVAILABLE)
send_command_to_m3ua(link, MTP3_M3UA_ENABLE,M3UA_MGMT_CMD,0, 0);
rc_timer = 100;
}
}
/* if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && mtp3ObjInput.lsac_input_from_mgmt[link] == LSAC_MGMT_DEACTIVATE_LINK)
{
@@ -4144,7 +4002,7 @@ void check_m3ua_link_status(int force_flag)
void m3ua_timer()
{
check_m3ua_link_status(0);
check_m3ua_link_status();
}
void send_mtp_msg(int outlink, BYTE *msgptr)
@@ -4264,9 +4122,7 @@ void send_mtp_msg(int outlink, BYTE *msgptr)
/* debug show message */
if(pclen == MTP3_24BIT_PC)
{
// memmove(m3ua_ptr->msg.m3ua.content, msgptr+11+1, len-8-1);
memmove(m3ua_ptr->msg.m3ua.content, msgptr+11+1, len-6-1);
memmove(m3ua_ptr->msg.m3ua.content, msgptr+11+1, len-8-1);
dpc = 0;
opc = 0;
sls = msgptr[11];
@@ -4277,9 +4133,7 @@ void send_mtp_msg(int outlink, BYTE *msgptr)
m3ua_ptr->msg_class = M3UA_MAUP_MSG;
m3ua_ptr->msg.m3ua.ni = nw;
m3ua_ptr->msg.m3ua.si = msgptr[4] & 0x0f;
// m3ua_ptr->msg.m3ua.len = ntohs(len - 8 - 1 - 4); //m3ua_ptr->msg.m3ua.len = ntohs(len - 8-1); //modify by Jink on 2012-11-01
m3ua_ptr->msg.m3ua.len = ntohs(len - 6 - 1 - 4); //m3ua_ptr->msg.m3ua.len = ntohs(len - 8-1); //modify by Jink on 2012-11-01
m3ua_ptr->msg.m3ua.len = ntohs(len - 8 - 1 - 4); //m3ua_ptr->msg.m3ua.len = ntohs(len - 8-1); //modify by Jink on 2012-11-01
m3ua_ptr->msg.m3ua.mp = 0;
m3ua_ptr->msg.m3ua.sls = sls;
m3ua_ptr->msg.m3ua.rc = get_m3ua_rc_by_dpc(nw, m3ua_ptr->msg.m3ua.dpc, m3ua_ptr->msg.m3ua.opc);
@@ -4419,7 +4273,6 @@ int update_route_by_other_plat(u32 dpc,BYTE nw, BYTE routine, WORD chl, u32 opc)
lsno = mtp3_para->lk[chl].e1_to_linkset;
ull opc_dpc=0;
return 0;
if (lsno >= MAX_LS)
return 0;
@@ -4438,24 +4291,14 @@ int update_route_by_other_plat(u32 dpc,BYTE nw, BYTE routine, WORD chl, u32 opc)
i = sort_rec->index[index];
else
return 0;
sp->routine[i] = routine;
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT," <%s:%d> link=%d, linkset=%d, dpc=%d, sp->routine .local=%d,peer=%d",
mtp3_debug(MTP3DB_EVENT," <%s:%d> link=%d, linkset=%d, dpc=%d, sp->routine=%d",
__FUNCTION__, __LINE__,
chl,
lsno,
dpc,
sp->routine[i],
routine);
if(0)
if(sp->routine[i] != routine)
{
outroute = (sp->routine[i] >> 6) & 3;
if(outroute != 2)
return 0;
}
sp->routine[i] = routine;
outroute = (routine >> 6) & 3;
if ( outroute == 2 )/* no outbound route */
@@ -5010,15 +4853,12 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
spplace = ls->influ_dstplace_intable_asNLS[i];
routine = (BYTE*)&sp->routine[spplace];
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
mtp3_debug(MTP3DB_EVENT,"\33[32m%s: Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, chl, lsno,
*routine);
mark_normal_linkset_available(routine); //117-11-07
if (Nlinkset_status(*routine) == LS_AVAILABLE)
{
*routine = ((*routine) & 0x3f);/* current route is normal linkset */
if(1)
if(ls->links_nls_asp_ac_send_flag[spplace] == 0)
{
ls->links_nls_asp_ac_send_flag[spplace] = 1;
@@ -5028,7 +4868,6 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
else if (Alinkset_status(*routine) == LS_AVAILABLE)
{
(*routine) = ((*routine) & 0x3f) + 0x40;
if(1)
if(ls->links_als_asp_ac_send_flag[spplace] == 0)
{
ls->links_als_asp_ac_send_flag[spplace] = 1;
@@ -5037,29 +4876,18 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
}
else
{
//mark_normal_linkset_available(routine);
mark_normal_linkset_available(routine);
(*routine) = ((*routine) & 0x3f) + 0x80;
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
}
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
*routine);
}
for ( i=0; i<(ls->influ_dstnum_asALS % MAX_LS_DPC_ADD1); i++ )
{
spplace = ls->influ_dstplace_intable_asALS[i];
routine = (BYTE*)&sp->routine[spplace];
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , ssplace=%d, routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
spplace, *routine);
mark_alternative_linkset_available(routine); //17-11-07
if ( (*routine) >> 6 == 2 )/* no route */
{
(*routine) = ((*routine) & 0x3f) + 0x40;/* current route is alternative linkset */
@@ -5073,36 +4901,23 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
else
(*routine) = ((*routine) & 0x3f) + 0x80;
if(1)
if(ls->links_als_asp_ac_send_flag[spplace] == 0)
{
ls->links_als_asp_ac_send_flag[spplace] = 1;
ls->send_asp_ac_link_id = chl;
}
if(detail_debug_flag)
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
*routine);
}
//if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip) for dual alarm issue
mtp3_send_alarm(lsno+MTP3_LINKSET_COMPONENT,0);
set_heartbeat(ALARM_LS_AVAILABLE,lsno);
mtp3_para->ls_pro[lsno].ls_state = 1;//ALARM_LS_AVAILABLE;
}
if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
mtp3_send_alarm(MTP3_LINK_COMPONENT+chl,0);
ls->links_available_t = scan_ls_link_available(lsno);
if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
mtp3_send_alarm(MTP3_LINK_COMPONENT+chl,0);
else
{
if(ls->links_available_t >= 1)
{
if(ls->send_asp_ac_link_id == 0 || ls->send_asp_ac_link_id == 0xffff)
ls->send_asp_ac_link_id = chl;
}
}
if ( ls->links_available_t > 0 )
{
@@ -5115,15 +4930,12 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
mtp3_debug(MTP3DB_EVENT,"\33[32m%s: Link %d L3 in service,Linkset %d in service\33[0m",__FUNCTION__, chl,lsno);
}
/*
if(link_already_available != AVAILABLE)
ls->links_available_t++;
else
mtp3_debug(MTP3DB_ERROR,"update routing table fail, links=%d have already available", chl);
*/
current_measure->lk_measure1[chl][1]++;/* local changeback */
// printf("\r\n tcbc %d update routine cmp link_available = %d \n\r",chl, ls->links_available_t);
}
@@ -5156,11 +4968,7 @@ void hmrt_tcoc_update_routing_tables(WORD chl)
if (link_inhibited[chl] == TRUE)
mtp3ObjState.link_l3_state[chl] = INHIBITED;
else
{
mtp3ObjState.link_l3_state[chl] = UNAVAILABLE;
mtp3ObjState.link_enable_sent_flag[chl] = 0;
}
set_heartbeat(ALARM_LINK_UNAVAILABLE,chl);
@@ -5213,9 +5021,8 @@ void hmrt_tcoc_update_routing_tables(WORD chl)
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
sp->m3ua_rc_status[spplace] = 0;
}
if(detail_debug_flag)
mtp3_debug(MTP3DB_ERROR,"%s:%d, Link=%d, changeover DPC=%d, rc_status=%d", __FUNCTION__, __LINE__,
chl, mtp3_para->nw[nw].routing[spplace].dpc, sp->m3ua_rc_status[spplace]);
mtp3_debug(MTP3DB_ERROR,"%s, Link=%d, changeover DPC=%d", __FUNCTION__, chl,
mtp3_para->nw[nw].routing[spplace].dpc);
}
@@ -5228,10 +5035,6 @@ void hmrt_tcoc_update_routing_tables(WORD chl)
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
sp->m3ua_rc_status[spplace] = 0;
}
if(detail_debug_flag)
mtp3_debug(MTP3DB_ERROR,"%s:%d, Link=%d, changeover DPC=%d, rc_status=%d", __FUNCTION__, __LINE__,
chl, mtp3_para->nw[nw].routing[spplace].dpc, sp->m3ua_rc_status[spplace]);
}
//memset(&ls_sls[lsx16],MAX_LK,16);

View File

@@ -30,7 +30,7 @@
#include <arpa/inet.h>
#include <sys/param.h>
#include <sys/ioctl.h>
//#include <sys/io.h>
#include <sys/io.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/sem.h>

View File

@@ -29,8 +29,7 @@ static int GetSysCreatedTime()
unsigned char created_time_des[128] = {0}, TmpStr[64]= {0};
memset(created_time, 0, 64);
//sprintf(buf,"tune2fs -l /dev/sda1 | grep create >../log/created_time.txt");
sprintf(buf,"ls -lact --full-time /etc | tail -1 | awk '{print $6,$7}' >../log/created_time.txt");
sprintf(buf,"tune2fs -l /dev/sda1 | grep create >../log/created_time.txt");
system(buf);
fpConf = fopen("../log/created_time.txt","r");
if(fpConf != NULL)

View File

@@ -11,7 +11,7 @@
#include <sys/shm.h>
#include <arpa/inet.h>
#include <sys/socket.h>
//#include <sys/io.h>
#include <sys/io.h>
#include <netdb.h>
#include "scoc_if.h"
#include "../../../public/src/include/includes.h"
@@ -440,43 +440,43 @@ static const StringVal sp_co_instanceside_str[] =
static const StringVal co_reason_str[] = {
//reason : originated network serice provider
{REA_PDISC_ACNN,
"disconnection <20>Cabnormal condition(non-transient nature)" },
{REA_PDISC_ACTN, "disconnection <20>Cabnormal condition of transient nature"},
{REA_PDISC_IS, "disconnection <20>Cinvalid state1" },
{REA_PDISC_RIP, "disconnection <20>Crelease in progress1" },
{REA_PCREF_DAU, "CREF2 <20>Cdestination address unknown " },
"disconnection <20>Cabnormal condition(non-transient nature)" },
{REA_PDISC_ACTN, "disconnection <20>Cabnormal condition of transient nature"},
{REA_PDISC_IS, "disconnection <20>Cinvalid state1" },
{REA_PDISC_RIP, "disconnection <20>Crelease in progress1" },
{REA_PCREF_DAU, "CREF2 <20>Cdestination address unknown " },
{REA_PCREF_DINC,
"CREF2 <20>Cdestination inaccessible/non-transient condition" },
{REA_PCREF_DITCs, "CREF2 <20>Cdestination inaccessible/transient condition" },
{REA_PCREF_QNANC, "CREF2 <20>CQOS not available/non-transient condition" },
{REA_PCREF_QNATC, "CREF2 <20>CQOS not available/transient condition" },
{REA_PCREF_RUNC, "CREF2 <20>Creason unspecified/non-transient condition" },
{REA_PCREF_RUTC, "CREF2 <20>Creason unspecified/transient condition" },
{REA_PCREF_LE, "CREF2 <20>Clocal error1" },
{REA_PCREF_IS, "CREF2 <20>Cinvalid state1" },
{REA_PCREF_NT, "CREF2 <20>Cno translation1" },
{REA_PCREF_IRP, "CREF2 <20>Cin restart phase1" },
{REA_PCREF_HCV, "CREF2 <20>Chop counter violation" },
"CREF2 <20>Cdestination inaccessible/non-transient condition" },
{REA_PCREF_DITCs, "CREF2 <20>Cdestination inaccessible/transient condition" },
{REA_PCREF_QNANC, "CREF2 <20>CQOS not available/non-transient condition" },
{REA_PCREF_QNATC, "CREF2 <20>CQOS not available/transient condition" },
{REA_PCREF_RUNC, "CREF2 <20>Creason unspecified/non-transient condition" },
{REA_PCREF_RUTC, "CREF2 <20>Creason unspecified/transient condition" },
{REA_PCREF_LE, "CREF2 <20>Clocal error1" },
{REA_PCREF_IS, "CREF2 <20>Cinvalid state1" },
{REA_PCREF_NT, "CREF2 <20>Cno translation1" },
{REA_PCREF_IRP, "CREF2 <20>Cin restart phase1" },
{REA_PCREF_HCV, "CREF2 <20>Chop counter violation" },
//reason : originated network serice user
{REA_UDISC_NC, "disconnection <20>Cnormal condition" },
{REA_UDISC_ABC, "disconnection <20>Cabnormal condition" },
{REA_UDISC_EUC, "disconnection <20>Cend user congestion" },
{REA_UDISC_EUF, "disconnection <20>Cend user failure" },
{REA_UDISC_SUO, "disconnection <20>CSCCP user originated" },
{REA_UDISC_ACC, "disconnection <20>Caccess congestion" },
{REA_UDISC_AF, "disconnection <20>Caccess failure" },
{REA_UDISC_SC, "disconnection <20>Csubsystem congestion" },
{REA_UCREF_NTC, "CREF2<EFBFBD>Cnon-transient condition" },
{REA_UCREF_TC, "CREF2<EFBFBD>Ctransient condition" },
{REA_UCREF_IIIN, "CREF2<EFBFBD>Cincompatible information in NSDUs" },
{REA_UCREF_EUO, "CREF2<EFBFBD>Cend user originated" },
{REA_UCREF_EUC, "CREF2<EFBFBD>Cend user congestion" },
{REA_UCREF_EUF, "CREF2<EFBFBD>Cend user failure" },
{REA_UCREF_SUO, "CREF2 <20>CSCCP user originated" },
{REA_UCREF_ACC, "CREF2 <20>Caccess congestion" },
{REA_UCREF_AF, "CREF2 <20>Caccess failure" },
{REA_UCREF_SC, "CREF2 <20>Csubsystem congestion" },
{REA_UDISC_NC, "disconnection <20>Cnormal condition" },
{REA_UDISC_ABC, "disconnection <20>Cabnormal condition" },
{REA_UDISC_EUC, "disconnection <20>Cend user congestion" },
{REA_UDISC_EUF, "disconnection <20>Cend user failure" },
{REA_UDISC_SUO, "disconnection <20>CSCCP user originated" },
{REA_UDISC_ACC, "disconnection <20>Caccess congestion" },
{REA_UDISC_AF, "disconnection <20>Caccess failure" },
{REA_UDISC_SC, "disconnection <20>Csubsystem congestion" },
{REA_UCREF_NTC, "CREF2<EFBFBD>Cnon-transient condition" },
{REA_UCREF_TC, "CREF2<EFBFBD>Ctransient condition" },
{REA_UCREF_IIIN, "CREF2<EFBFBD>Cincompatible information in NSDUs" },
{REA_UCREF_EUO, "CREF2<EFBFBD>Cend user originated" },
{REA_UCREF_EUC, "CREF2<EFBFBD>Cend user congestion" },
{REA_UCREF_EUF, "CREF2<EFBFBD>Cend user failure" },
{REA_UCREF_SUO, "CREF2 <20>CSCCP user originated" },
{REA_UCREF_ACC, "CREF2 <20>Caccess congestion" },
{REA_UCREF_AF, "CREF2 <20>Caccess failure" },
{REA_UCREF_SC, "CREF2 <20>Csubsystem congestion" },
//Notice service reason : N-inform values
{REA_NINFO_FAIL, "work service provider failure" },

View File

@@ -132,7 +132,7 @@ int get_raminfo(hb_sysinfo *info)
unsigned char rb,prb;
int field_id=0;
int field_id2=0;
char field_value[256][256];
char field_value[128][64];
FILE *mem_fp=NULL;
if((mem_fp=fopen("/proc/meminfo","r"))==NULL)