/*	IS41 debug function c file				*/
/*	created by daniel zhang 2004-06-18		*/
/*	last modufy by daniel zhang	2004-06-18	*/
/*	version 1.0								*/
/*	------------------------------------	*/

#include "../../../debug/src/include/debug.h"
#include "map_includes.h"
#include "is41_code.h"

static char				debug_buf[5120];
BYTE					is41DebugFull = 0;
static unsigned long	debug_mask = 0;

static char				help_info[] = "Commands provided now:\r\n\
help\r\n\
log all                         Output all debug information\r\n\
log none                        Turn off all information\r\n\
log error on/off                Show error information\r\n\
";


void is41_debug_setup()
{
#if MAP_CODE_DEBUG
	DWORD		ascout_id[20] = {1,3,6,1,4,1,1373,1,3,2,3,1,2,17,4};
	DWORD		ascin_id[20] =  {1,3,6,1,4,1,1373,1,3,2,3,1,2,17,3};
	DWORD		status_id[20] = {1,3,6,1,4,1,1373,1,3,2,3,1,2,17,1};
	DWORD		name_id[20] =   {1,3,6,1,4,1,1373,1,3,2,3,1,2,17,2};
	BYTE		debug_status = 1;

	sprintf(is41_ver, "R9V00_T1");
	debug_set_response(15, ascout_id, debug_buf, 1);
	debug_set_response(15, ascin_id, asc_in, 1);
	debug_set_response(15, status_id, &debug_status, 1);
	debug_set_response(15, name_id, is41_ver, strlen(is41_ver));
	
#endif
}

void is41_log(char *info)
{
	if(strlen(debug_buf) + strlen(info) > 2048)
	{
		is41DebugFull = 1;
		return;
	}
//	printf("send log\n");
	strncat(debug_buf, info, 2048);
	strcat(debug_buf, "\r\n");
	return;
}

void is41_debug(DWORD mask, const char *fmt, ...)
{
#if MAP_CODE_DEBUG
	va_list				ap;
	char				buf[1024];

	if((mask & debug_mask) == 0)
		return;

/*	if(debug_mask & SCCPDB_TIME)
	{
		struct timeval		tv;
		struct timezone		tz;
		struct tm 			*t;
		char				timestr[32];
		gettimeofday(&tv, &tz);
		t=localtime(&tv.tv_sec);
		sprintf(timestr, "(%d:%d:%d.%ld):",t->tm_hour,t->tm_min,t->tm_sec,tv.tv_usec);
		is41_log(timestr);
	}*/

	if(mask & IS41DB_ERR)
		strcat(debug_buf, "\33[31m");

	va_start(ap, fmt);
	vsnprintf(buf, 1024, fmt, ap);
	va_end(ap);
	strcat(buf,"\33[37m");
	is41_log(buf);
#endif
}

void is41_showbuf(DWORD mask, BYTE *buf, int len)
{
#if MAP_CODE_DEBUG
	int			i = 0, j = 0, linemax = 24;
	char		info[1024];

/*	if((debug_mask & SCCPDB_MSG) == 0  || (debug_mask & mask) == 0 || sccpDebugFull)
		return;*/
	
	if(len >= 256)
		len = 256;

	while(i * 24 < len)
	{
		if((linemax = len - 24 * i) > 24)
			linemax = 24;
		for(j = 0; j < linemax; j ++)
		{
			sprintf(info + 3 * j, "%02X ", buf[24 * i + j]);
		}
		is41_log(info);
		i ++;
	}
#endif
}


int parsecmd(char *cmdstr)
{
	if(strstr(cmdstr,"help") != NULL || strstr(cmdstr,"?")!=NULL)
		is41_log(help_info);
	else if(strstr(cmdstr, "log all") != NULL)
	{
//		sccpFilterIndex = 0;
		debug_mask = 0xFFFFFFFF;
	}
	else if(strstr(cmdstr, "log none") != NULL)
	{
//		sccpFilterIndex = 0;
		debug_mask = 0;
	}
	else if(strstr(cmdstr, "log error on") != NULL)
		debug_mask |= IS41DB_ERR;
	else if(strstr(cmdstr, "log error off") != NULL)
		debug_mask &= (~IS41DB_ERR);
	else if(strstr(cmdstr, "Test Auc") != NULL)
	{
		printf("CMD OK\n");
	}
	is41_log("Command OK.");
	return 1;
}


void is41_debug_timer()
{
#if MAP_CODE_DEBUG
	BYTE			npage, nline;

	if(strlen(asc_in) <= 1)
		return;
	debug_buf[0] = '\0';
	npage = asc_in[0] - 1;
	if(npage == 0)
	{
		parsecmd(asc_in + 1);
		asc_in[0] = '\0';
		return;
	}
	else
		nline = atoi(asc_in + 1);
	switch(npage)
	{
	case 1:		//csta
//		sccp_debug_csta(npage, nline);
		break;
	case 2:		//local subsystem
//		sccp_debug_local(npage, nline);
		break;
	case 3:		//related subsystem
//		sccp_debug_related(npage, nline);
		break;
	}
	asc_in[0] = '\0';
#endif
}


int debug_show_REGNOT_ARG(IS41_REGNOT_ARG *ptr,char *buf)
{
	u32			flag,flag1;
	struct		IS41_PAR_WIN_CAP	*ptr1;
	int			i;
	char		tempchar[512];
	
	flag = ptr->param_flag;
	buf[0] = 0;
	
	if((flag & BIT0_TRUE)>0)		//esn
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT1_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

	if((flag & BIT3_TRUE)>0)		//QualificationInformationCode
	{
		sprintf(tempchar,"QUALCODE=%02x,",ptr->qualcode);
		strcat(buf,tempchar);
	}

	if((flag & BIT4_TRUE)>0)		//SystemMyTypeCode
	{
		sprintf(tempchar,"MYTYP=%02x,",ptr->mytyp);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT5_TRUE)>0)		//Availability Type
	{
		sprintf(tempchar,"AVTYP=%02x,",ptr->avtyp);
		strcat(buf,tempchar);
	}

	if((flag & BIT6_TRUE)>0)		//BorderCellAccess
	{
		sprintf(tempchar,"BORDACC=%02x,",ptr->bordacc);
		strcat(buf,tempchar);
	}

	if((flag & BIT7_TRUE)>0)		//ControlChannelData
	{
		sprintf(tempchar,"CCDATA=%02x%02x%02x%02x,",ptr->ccdata[0],ptr->ccdata[1],ptr->ccdata[2],ptr->ccdata[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT8_TRUE)>0)		//ExtendedMSCID
	{
		sprintf(tempchar,"EXTMSCID=%02x%02x%02x%02x,",ptr->extmscid[0],ptr->extmscid[1],ptr->extmscid[2],ptr->extmscid[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT9_TRUE)>0)		//LocationAreaID
	{
		sprintf(tempchar,"LOCID=%02x%02x,",ptr->locid[0],ptr->locid[1]);
		strcat(buf,tempchar);
	}

	if((flag & BIT10_TRUE)>0)		//pcssn
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x,",ptr->pcssn[0],ptr->pcssn[1],ptr->pcssn[2],ptr->pcssn[3],ptr->pcssn[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT11_TRUE)>0)		//ReceivedSignalQuality
	{
		sprintf(tempchar,"RSIGQUAL=%02x,",ptr->rsigqual);
		strcat(buf,tempchar);
	}

	if((flag & BIT12_TRUE)>0)		//rpttyp
	{
		sprintf(tempchar,"RPTTYP=%02x,",ptr->rpttyp);
		strcat(buf,tempchar);
	}

	if((flag & BIT13_TRUE)>0)		//senderin
	{
		strcat(buf,"SENDERIN=");
		for (i=0;i<ptr->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->senderin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT14_TRUE)>0)		//SMS_DestinationAddress
	{
		strcat(buf,"SMSADDR=");
		for (i=0;i<ptr->smsaddrLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->smsaddr[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT15_TRUE)>0)		//smsmwi
		strcat(buf,"SMSMWI,");

	if((flag & BIT16_TRUE)>0)		//sysaccdata
	{
		sprintf(tempchar,"SYSACCDATA=%02x%02x%02x%02x%02x,",ptr->sysaccdata[0],ptr->sysaccdata[1],ptr->sysaccdata[2],ptr->sysaccdata[3],ptr->sysaccdata[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT17_TRUE)>0)		//sysacctype
	{
		sprintf(tempchar,"SYSACCTYPE=%02x,",ptr->sysacctype);
		strcat(buf,tempchar);
	}

	if((flag & BIT18_TRUE)>0)		//syscap
	{
		sprintf(tempchar,"SYSCAP=%02x,",ptr->syscap);
		strcat(buf,tempchar);
	}

	if((flag & BIT19_TRUE)>0)		//termtyp
	{
		sprintf(tempchar,"TERMTYP=%02x,",ptr->termtyp);
		strcat(buf,tempchar);
	}

	if((flag & BIT20_TRUE)>0)		//transcap
	{
		strcat(buf,"TRANSCAP=");
		for (i=0;i<ptr->transcapLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->transcap[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT21_TRUE)>0)		//wincap
	{
		ptr1 = &ptr->wincap;
		flag1 = ptr1->param_flag;
		if((flag1 & BIT0_TRUE)>0)		//triggercapability
		{
			strcat(buf,"WINCAP-TRIGGERCAP=");
			for (i=0;i<ptr1->triggercapLen;i++)
			{
				sprintf(tempchar,"%02x",ptr1->triggercap[i]);
				strcat(buf,tempchar);
			}
			strcat(buf,",");
		}
		if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
		{
			strcat(buf,"WINCAP-WINOPRCAP=");
			for (i=0;i<ptr1->winoprcapLen;i++)
			{
				sprintf(tempchar,"%02x",ptr1->winoprcap[i]);
				strcat(buf,tempchar);
			}
			strcat(buf,",");
		}
	}
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_profile(struct IS41_PAR_PROFILE *ptr,u8 *buf)
{
	u32			flag1;
	struct		IS41_PAR_TRIGGER_LIST	*ptr1;
	u32			flag;
	u8			i,triglistnum;
	char		tempchar[512];

	flag = ptr->param_flag;

	if((flag & BIT0_TRUE)>0)
	{
		strcat((char *)buf,"AUTHCAP=");
		for (i=0;i<ptr->authcapLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->authcap[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT1_TRUE)>0)
	{
		strcat((char *)buf,"CFI=");
		for (i=0;i<ptr->cfiLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cfi[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT2_TRUE)>0)
	{
		strcat((char *)buf,"CARDGTS=");
		for (i=0;i<ptr->cardgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cardgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT3_TRUE)>0)
	{
		strcat((char *)buf,"ACDGTS=");
		for (i=0;i<ptr->acdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->acdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT4_TRUE)>0)
	{
		strcat((char *)buf,"ABDGTS=");
		for (i=0;i<ptr->abdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->abdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat((char *)buf,"BILLDGTS=");
		for (i=0;i<ptr->billdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->billdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat((char *)buf,"GEOAUTH=");
		for (i=0;i<ptr->geoauthLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->geoauth[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT7_TRUE)>0)
	{
		strcat((char *)buf,"MWNCOUNT=");
		for (i=0;i<ptr->mwncountLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mwncount[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT8_TRUE)>0)
	{
		strcat((char *)buf,"MWNTYPE=");
		for (i=0;i<ptr->mwntypeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mwntype[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT9_TRUE)>0)
	{
		strcat((char *)buf,"MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT10_TRUE)>0)
	{
		sprintf(tempchar,"ORIGIND=%02x,",ptr->origind);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT11_TRUE)>0)
	{
		strcat((char *)buf,"ORIGTRIG=");
		for (i=0;i<ptr->origtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->origtrig[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT12_TRUE)>0)
	{
		sprintf(tempchar,"PACAIND=%02x,",ptr->pacaind);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT13_TRUE)>0)
	{
		sprintf(tempchar,"PLIND=%02x,",ptr->plind);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT14_TRUE)>0)
	{
		strcat((char *)buf,"RESDGTS=");
		for (i=0;i<ptr->resdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->resdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT15_TRUE)>0)
	{
		strcat((char *)buf,"ROUTDGTS=");
		for (i=0;i<ptr->routdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->routdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT16_TRUE)>0)
	{
		sprintf(tempchar,"SMSORGRES=%02x,",ptr->smsorgres);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT17_TRUE)>0)
	{
		sprintf(tempchar,"SMSTERMRES=%02x,",ptr->smstermres);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT18_TRUE)>0)
	{
		strcat((char *)buf,"SPINIPIN=");
		for (i=0;i<ptr->spinipinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->spinipin[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT19_TRUE)>0)
	{
		strcat((char *)buf,"SPINITRIG=");
		for (i=0;i<ptr->spinitrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->spinitrig[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT20_TRUE)>0)
	{
		sprintf(tempchar,"SMSTERMRES=%02x,",ptr->termres);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT21_TRUE)>0)
	{
		strcat((char *)buf,"TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	
	if((flag & BIT22_TRUE)>0)		//TriggerAddressList
	{
		triglistnum = ptr->triggerlistnum & MAX_IS41_TRIG_LIST_NUM_1;
		for (i = 0; i < triglistnum; i++)
		{
			ptr1 = &ptr->triggerlist[i];
			flag1 = ptr1->param_flag;

			if((flag1 & BIT0_TRUE)>0)		//destinationaddress -- choice global title
			{
				strcat((char *)buf,"TRIGADRLIST-TRIGLIST-DESTADDR=");
				for (i=0;i<ptr1->destaddrLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->destaddr[i]);
					strcat((char *)buf,tempchar);
				}
				strcat((char *)buf,",");

			}
			if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
			{
				strcat((char *)buf,"TRIGADRLIST-TRIGLIST-WINTRIGLIST=");
				for (i=0;i<ptr1->wintriglistLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->wintriglist[i]);
					strcat((char *)buf,tempchar);
				}
				strcat((char *)buf,",");
			}
		}
	}

	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_REGNOT_RSP(struct IS41_REGNOT_RSP *ptr,char *buf)
{
	u32			flag;
	int			i;
	char		tempchar[512];

	buf[0] = 0;

	flag = ptr->param_flag;

	if((flag & BIT0_TRUE)>0)		//SystemMyTypeCode
	{
		sprintf(tempchar,"MYTYP=%02x,",ptr->mytyp);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT1_TRUE)>0)		//AuthorizationDenied
	{
		sprintf(tempchar,"AUTHDEN=%02x,",ptr->authden);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//AuthorizationPeriod
	{
		sprintf(tempchar,"AUTHPER=%02x%02x,",ptr->authper[0],ptr->authper[1]);
		strcat(buf,tempchar);
	}

	if((flag & BIT3_TRUE)>0)		//ControlChannelData
	{
		sprintf(tempchar,"CCDATA=%02x%02x%02x%02x,",ptr->ccdata[0],ptr->ccdata[1],ptr->ccdata[2],ptr->ccdata[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT4_TRUE)>0)		//DeniedAuthorizationPeriod
	{
		strcat(buf,"DENAUTHPER=");
		for (i=0;i<ptr->denauthperLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->denauthper[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT5_TRUE)>0)		//Digits carrier
	{
		strcat(buf,"DIGITS CARRIER=");
		for (i=0;i<ptr->digitsCarrierLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digitsCarrier[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT6_TRUE)>0)		//Digits Destination
	{
		strcat(buf,"DIGITS DEST=");
		for (i=0;i<ptr->digitsDestLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digitsDest[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT7_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

/* Profile **macro** */
	if ((flag & BIT8_TRUE) > 0)
	{
		debug_show_profile(&ptr->profile, (u8 *)buf);
	}
/* Profile **macro** */

/*	if((flag & BIT9_TRUE)>0)		//ReceivedSignalQuality
	{
		sprintf(tempchar,"RSIGQUAL=%02x,",ptr->rsigqual);
		strcat(buf,tempchar);
	}*/

	if((flag & BIT10_TRUE)>0)		//senderin
	{
		strcat(buf,"SENDERIN=");
		for (i=0;i<ptr->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->senderin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT11_TRUE)>0)
		strcat(buf,"SMSMWI");


	if((flag & BIT12_TRUE)>0)		//sysaccdata
	{
		sprintf(tempchar,"SYSACCDATA=%02x%02x%02x%02x%02x,",ptr->sysaccdata[0],ptr->sysaccdata[1],ptr->sysaccdata[2],ptr->sysaccdata[3],ptr->sysaccdata[4]);
		strcat(buf,tempchar);
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_LOCREQ_ARG(struct IS41_LOCREQ_ARG *ptr,char *buf)
{
	int			i;
	u32			flag,flag1;
	struct		IS41_PAR_WIN_CAP	*ptr1;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)
	{
		strcat(buf,"BILLID=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",ptr->billid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT1_TRUE)>0)
	{
		strcat(buf,"DIGITS=");
		for (i=0;i<ptr->digitsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digits[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT2_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

	if((flag & BIT3_TRUE)>0)		//SystemMyTypeCode
	{
		sprintf(tempchar,"MYTYP=%02x,",ptr->mytyp);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"CPNDGTS1=");
		for (i=0;i<ptr->cpndgts1Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpndgts1[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"CPNDGTS2=");
		for (i=0;i<ptr->cpndgts2Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpndgts2[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"CPSUB=");
		for (i=0;i<ptr->cpsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT7_TRUE)>0)
	{
		strcat(buf,"MSCIN=");
		for (i=0;i<ptr->mscinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT8_TRUE)>0)
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x,",ptr->pcssn[0],ptr->pcssn[1],ptr->pcssn[2],ptr->pcssn[3],ptr->pcssn[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT9_TRUE)>0)
	{
		strcat(buf,"RNDGTS=");
		for (i=0;i<ptr->rndgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rndgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT10_TRUE)>0)
	{
		strcat(buf,"RSUB=");
		for (i=0;i<ptr->rsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT11_TRUE)>0)
	{
		sprintf(tempchar,"TAT=%02x,",ptr->tat);
		strcat(buf,tempchar);
	}

	if((flag & BIT12_TRUE)>0)
	{
		strcat(buf,"TRANSCAP=");
		for (i=0;i<ptr->transcapLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->transcap[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if((flag & BIT13_TRUE)>0)		//wincap
	{
		ptr1 = &ptr->wincap;
		flag1 = ptr1->param_flag;
		if((flag1 & BIT0_TRUE)>0)		//triggercapability
		{
			strcat(buf,"WINCAP-TRIGGERCAP=");
			for (i=0;i<ptr1->triggercapLen;i++)
			{
				sprintf(tempchar,"%02x",ptr1->triggercap[i]);
				strcat(buf,tempchar);
			}
			strcat(buf,",");
		}
		if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
		{
			strcat(buf,"WINCAP-WINOPRCAP=");
			for (i=0;i<ptr1->winoprcapLen;i++)
			{
				sprintf(tempchar,"%02x",ptr1->winoprcap[i]);
				strcat(buf,tempchar);
			}
			strcat(buf,",");
		}
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_param_isterm(struct IS41_PAR_ISTERM *ptr,u8 *buf)
{
	u32			flag;
	u8			i;
	char		tempchar[512];

	flag = ptr->param_flag;

	if((flag & BIT0_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-DESTDGTS=");
		for (i=0;i<ptr->destdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->destdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT1_TRUE)>0)		//MSCID
	{
		strcat((char *)buf,"TERMLIST-ISTERM-MSCID=");
		for (i=0;i<3;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscid[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

// optional part--->
	if((flag & BIT2_TRUE)>0)
	{
		sprintf(tempchar,"TERMLIST-ISTERM-ACCDEN=%02x,",ptr->accden);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT3_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-CARDGTS=");
		for (i=0;i<ptr->cardgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cardgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT4_TRUE)>0)		//esn
	{
		sprintf(tempchar,"TERMLIST-ISTERM-ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-LEGINFO=");
		for (i=0;i<ptr->leginfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->leginfo[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT7_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-MSCIN=");
		for (i=0;i<ptr->mscinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscin[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT8_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-ROUTDGTS=");
		for (i=0;i<ptr->routdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->routdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT9_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-ISTERM-TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_param_locterm(struct IS41_PAR_LOCTERM *ptr,u8 *buf)
{
	u32			flag;
	u8			i;
	char		tempchar[512];

	flag = ptr->param_flag;

	if((flag & BIT0_TRUE)>0)		//esn
	{
		sprintf(tempchar,"TERMLIST-LOCTERM-ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT1_TRUE)>0)		//min
	{
		sprintf(tempchar,"TERMLIST-LOCTERM-MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT2_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-TERMTRMT=");
		for (i=0;i<ptr->termtrmtLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrmt[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

// optional part--->
	if((flag & BIT3_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-ALRTCODE=");
		for (i=0;i<ptr->alrtcodeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->alrtcode[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT4_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-CARDGTS=");
		for (i=0;i<ptr->cardgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cardgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-DESTDGTS=");
		for (i=0;i<ptr->destdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->destdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-LEGINFO=");
		for (i=0;i<ptr->leginfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->leginfo[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT7_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT8_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-OTFI=");
		for (i=0;i<ptr->otfiLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->otfi[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT9_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-ROUTDGTS=");
		for (i=0;i<ptr->routdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->routdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT10_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT11_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-VMSPIN=");
		for (i=0;i<ptr->vmspinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->vmspin[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT12_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-LOCTERM-VMBOX=");
		for (i=0;i<ptr->vmboxLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->vmbox[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

	if (flag > 0)
		return 1;
	return 0;
}


int debug_show_param_pstnterm(struct IS41_PAR_PSTNTERM *ptr,u8 *buf)
{
	u32			flag;
	u8			i;
	char		tempchar[512];

	flag = ptr->param_flag;

	if((flag & BIT0_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-PSTNTERM-DESTDGTS=");
		for (i=0;i<ptr->destdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->destdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

// optional part--->
	if((flag & BIT1_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-PSTNTERM-CARDGTS=");
		for (i=0;i<ptr->cardgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cardgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

	if((flag & BIT2_TRUE)>0)		//esn
	{
		sprintf(tempchar,"TERMLIST-PSTNTERM-ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT3_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-PSTNTERM-LEGINFO=");
		for (i=0;i<ptr->leginfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->leginfo[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

	if((flag & BIT4_TRUE)>0)		//min
	{
		sprintf(tempchar,"TERMLIST-PSTNTERM-MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat((char *)buf,tempchar);
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-PSTNTERM-ROUTDGTS=");
		for (i=0;i<ptr->routdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->routdgts[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat((char *)buf,"TERMLIST-PSTNTERM-TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat((char *)buf,tempchar);
		}
		strcat((char *)buf,",");
	}

	if (flag > 0)
		return 1;
	return 0;
}


int debug_show_param_termlist(struct IS41_PAR_TERMLIST *ptr,u8 *buf)
{
	u32			flag;

	flag = ptr->param_flag;

	if ((flag & BIT0_TRUE) > 0)
	{
		debug_show_param_isterm(&ptr->isterm,buf);
	}
	
	if ((flag & BIT1_TRUE) > 0)
	{
		debug_show_param_locterm(&ptr->locterm,buf);
	}

	if ((flag & BIT2_TRUE) > 0)
	{
		debug_show_param_pstnterm(&ptr->pstnterm,buf);
	}

	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_LOCREQ_RSP(struct IS41_LOCREQ_RSP *ptr,char *buf)
{
	u32			flag,flag1;
	struct		IS41_PAR_TRIGGER_LIST	*ptr1;
	u8			i,triglistnum;
	char		tempchar[512];
	
	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//esn
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}
	if((flag & BIT1_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT3_TRUE)>0)
	{
		sprintf(tempchar,"ACCDEN=%02x,",ptr->accden);
		strcat(buf,tempchar);
	}

	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"ANNLIST=");
		for (i=0;i<ptr->annlistLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->annlist[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"CPNSTRG1=");
		for (i=0;i<ptr->cpnstrg1Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpnstrg1[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"CPNSTRG2=");
		for (i=0;i<ptr->cpnstrg2Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpnstrg2[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT7_TRUE)>0)
	{
		strcat(buf,"DIGITS CARRIER=");
		for (i=0;i<ptr->digitsCarrierLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digitsCarrier[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT8_TRUE)>0)
	{
		strcat(buf,"DIGITS DEST=");
		for (i=0;i<ptr->digitsDestLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digitsDest[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT9_TRUE)>0)
	{
		strcat(buf,"ACDGTS=");
		for (i=0;i<ptr->acdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->acdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT10_TRUE)>0)
	{
		strcat(buf,"ABDGTS=");
		for (i=0;i<ptr->abdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->abdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT11_TRUE)>0)
	{
		strcat(buf,"BILLDGTS=");
		for (i=0;i<ptr->billdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->billdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT12_TRUE)>0)
	{
		strcat(buf,"REDIND=");
		for (i=0;i<ptr->redindLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->redind[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT13_TRUE)>0)
	{
		strcat(buf,"GRPINFO=");
		for (i=0;i<ptr->grpinfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->grpinfo[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

//	if((flag & BIT11_TRUE)>0)
	//	buf_len = AddTLV(is41_sequenceTag(IS41PAR_TAT,12),1,&ptr->tat,0x80,&asn_buf);

	if((flag & BIT14_TRUE)>0)
	{
		strcat(buf,"MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT15_TRUE)>0)
	{
		strcat(buf,"NATIME=");
		for (i=0;i<ptr->natimeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->natime[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
		
	if((flag & BIT16_TRUE)>0)
	{
		strcat(buf,"OTFI=");
		for (i=0;i<ptr->otfiLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->otfi[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT17_TRUE)>0)
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x,",ptr->pcssn[0],ptr->pcssn[1],ptr->pcssn[2],ptr->pcssn[3],ptr->pcssn[4]);
		strcat(buf,tempchar);
	}
		
	if((flag & BIT18_TRUE)>0)
	{
		strcat(buf,"RNDGTS=");
		for (i=0;i<ptr->rndgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rndgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT19_TRUE)>0)
	{
		strcat(buf,"RNSTRING=");
		for (i=0;i<ptr->rnstringLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rnstring[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT20_TRUE)>0)
	{
		strcat(buf,"RSUB=");
		for (i=0;i<ptr->rsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
		
	if((flag & BIT21_TRUE)>0)
	{
		strcat(buf,"ROUTDGTS=");
		for (i=0;i<ptr->routdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->routdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if ((flag & BIT22_TRUE) > 0)
	{
		debug_show_param_termlist(&ptr->termlist, (u8 *)buf);
	}

	if((flag & BIT23_TRUE)>0)
	{
		strcat(buf,"TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT24_TRUE)>0)		//TriggerAddressList
	{
		triglistnum = ptr->triggerlistnum & MAX_IS41_TRIG_LIST_NUM_1;

		for (i = 0; i < triglistnum; i++)
		{
			ptr1 = &ptr->triggerlist[i];
			flag1 = ptr1->param_flag;

			if((flag1 & BIT0_TRUE)>0)		//destinationaddress -- choice global title
			{
				strcat(buf,"TRIGADRLIST-TRIGLIST-DESTADDR=");
				for (i=0;i<ptr1->destaddrLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->destaddr[i]);
					strcat(buf,tempchar);
				}
				strcat(buf,",");
			}
			if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
			{
				strcat(buf,"TRIGADRLIST-TRIGLIST-WINTRIGLIST=");
				for (i=0;i<ptr1->wintriglistLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->wintriglist[i]);
					strcat(buf,tempchar);
				}
				strcat(buf,",");
			}
		}
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_ROUTREQ_ARG(struct IS41_ROUTREQ_ARG *ptr,char *buf)
{
	int			i;
	u32			flag;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)
	{
		strcat(buf,"BILLID=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",ptr->billid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if((flag & BIT1_TRUE)>0)		//esn
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT3_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

	if((flag & BIT4_TRUE)>0)		//SystemMyTypeCode
	{
		sprintf(tempchar,"MYTYP=%02x,",ptr->mytyp);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"ALRTCODE=");
		for (i=0;i<ptr->alrtcodeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->alrtcode[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"CPNSTRG1=");
		for (i=0;i<ptr->cpnstrg1Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpnstrg1[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT7_TRUE)>0)
	{
		strcat(buf,"CPNSTRG2=");
		for (i=0;i<ptr->cpnstrg2Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpnstrg2[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT8_TRUE)>0)
	{
		strcat(buf,"CPSUB=");
		for (i=0;i<ptr->cpsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT9_TRUE)>0)
	{
		strcat(buf,"DESTDGTS=");
		for (i=0;i<ptr->destdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->destdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT10_TRUE)>0)
	{
		strcat(buf,"ACDGTS=");
		for (i=0;i<ptr->acdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->acdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT11_TRUE)>0)
	{
		strcat(buf,"ABDGTS=");
		for (i=0;i<ptr->abdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->abdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT12_TRUE)>0)
	{
		strcat(buf,"BILLDGTS=");
		for (i=0;i<ptr->billdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->billdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT13_TRUE)>0)
	{
		strcat(buf,"LEGINFO=");
		for (i=0;i<ptr->leginfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->leginfo[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT14_TRUE)>0)		//LocationAreaID
	{
		sprintf(tempchar,"LOCID=%02x%02x,",ptr->locid[0],ptr->locid[1]);
		strcat(buf,tempchar);
	}

	if((flag & BIT15_TRUE)>0)
	{
		strcat(buf,"MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT16_TRUE)>0)
	{
		strcat(buf,"MSCIN=");
		for (i=0;i<ptr->mscinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT17_TRUE)>0)
	{
		strcat(buf,"NATIME=");
		for (i=0;i<ptr->natimeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->natime[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT18_TRUE)>0)
	{
		strcat(buf,"OTFI=");
		for (i=0;i<ptr->otfiLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->otfi[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT19_TRUE)>0)
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x,",ptr->pcssn[0],ptr->pcssn[1],ptr->pcssn[2],ptr->pcssn[3],ptr->pcssn[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT20_TRUE)>0)
	{
		sprintf(tempchar,"PILOTBID=%02x%02x%02x%02x%02x%02x%02x,",ptr->pilotbid[0],ptr->pilotbid[1],ptr->pilotbid[2],ptr->pilotbid[3],ptr->pilotbid[4],ptr->pilotbid[5],ptr->pilotbid[6]);
		strcat(buf,tempchar);
	}

	if((flag & BIT21_TRUE)>0)
	{
		strcat(buf,"PILOT=");
		for (i=0;i<ptr->pilotLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->pilot[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT22_TRUE)>0)
	{
		strcat(buf,"RNSTRING=");
		for (i=0;i<ptr->rnstringLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rnstring[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT23_TRUE)>0)
	{
		strcat(buf,"RSUB=");
		for (i=0;i<ptr->rsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT24_TRUE)>0)		//senderin
	{
		strcat(buf,"SENDERIN=");
		for (i=0;i<ptr->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->senderin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT25_TRUE)>0)
	{
		strcat(buf,"TERMTRMT=");
		for (i=0;i<ptr->termtrmtLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrmt[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT26_TRUE)>0)
	{
		strcat(buf,"TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT27_TRUE)>0)
	{
		strcat(buf,"VMBOX=");
		for (i=0;i<ptr->vmboxLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->vmbox[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT28_TRUE)>0)
	{
		strcat(buf,"VMSPIN=");
		for (i=0;i<ptr->vmspinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->vmspin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_ROUTREQ_RSP(struct IS41_ROUTREQ_RSP *ptr,char *buf)
{
	int			i;
	u32			flag;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT1_TRUE)>0)
	{
		sprintf(tempchar,"ACCDEN=%02x,",ptr->accden);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)
	{
		strcat(buf,"BILLID=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",ptr->billid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT3_TRUE)>0)
	{
		sprintf(tempchar,"CDEN=%02x,",ptr->cden);
		strcat(buf,tempchar);
	}

	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"DIGITS=");
		for (i=0;i<ptr->digitsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digits[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"MSCIN=");
		for (i=0;i<ptr->mscinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT6_TRUE)>0)
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x,",ptr->pcssn[0],ptr->pcssn[1],ptr->pcssn[2],ptr->pcssn[3],ptr->pcssn[4]);
		strcat(buf,tempchar);
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_TRANUMREQ_ARG(struct IS41_TRANUMREQ_ARG *ptr,char *buf)
{
	int			i;
	u32			flag,flag1;
	char		tempchar[512];
	struct		IS41_PAR_WIN_CAP	*ptr1;

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//esn
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT1_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//REDIRECTION REASON
	{
		sprintf(tempchar,"REDREASON=%02x,",ptr->redreason);
		strcat(buf,tempchar);
	}

	if((flag & BIT3_TRUE)>0)		//SystemMyTypeCode
	{
		sprintf(tempchar,"MYTYP=%02x,",ptr->mytyp);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"BILLID=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",ptr->billid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"GRPINFO=");
		for (i=0;i<ptr->grpinfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->grpinfo[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"LEGINFO=");
		for (i=0;i<ptr->leginfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->leginfo[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT7_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}
	if((flag & BIT8_TRUE)>0)
	{
		strcat(buf,"MSCIN=");
		for (i=0;i<ptr->mscinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT9_TRUE)>0)
	{
		sprintf(tempchar,"PILOTBID=%02x%02x%02x%02x%02x%02x%02x,",ptr->pilotbid[0],ptr->pilotbid[1],ptr->pilotbid[2],ptr->pilotbid[3],ptr->pilotbid[4],ptr->pilotbid[5],ptr->pilotbid[6]);
		strcat(buf,tempchar);
	}
	if((flag & BIT10_TRUE)>0)
	{
		strcat(buf,"PILOT=");
		for (i=0;i<ptr->pilotLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->pilot[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT11_TRUE)>0)		//transcap
	{
		strcat(buf,"TRANSCAP=");
		for (i=0;i<ptr->transcapLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->transcap[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT12_TRUE)>0)		//wincap
	{
		ptr1 = &ptr->wincap;
		flag1 = ptr1->param_flag;

		if((flag1 & BIT0_TRUE)>0)		//triggercapability
		{
			strcat(buf,"WINCAP-TRIGGERCAP=");
			for (i=0;i<ptr1->triggercapLen;i++)
			{
				sprintf(tempchar,"%02x",ptr1->triggercap[i]);
				strcat(buf,tempchar);
			}
			strcat(buf,",");
		}
		if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
		{
			strcat(buf,"WINCAP-WINOPRCAP=");
			for (i=0;i<ptr1->winoprcapLen;i++)
			{
				sprintf(tempchar,"%02x",ptr1->winoprcap[i]);
				strcat(buf,tempchar);
			}
			strcat(buf,",");
		}
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_TRANUMREQ_RSP(struct IS41_TRANUMREQ_RSP *ptr,char *buf)
{
	int			i,triglistnum;
	u32			flag,flag1;
	char		tempchar[512];
	IS41_PAR_TRIGGER_LIST	*ptr1;

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//Digits(Destination)
	{
		strcat(buf,"DIGITS=");
		for (i=0;i<ptr->digitsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digits[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

//optional
	if((flag & BIT1_TRUE)>0)
	{
		sprintf(tempchar,"TERMLIST-ISTERM-ACCDEN=%02x,",ptr->accden);
		strcat(buf,tempchar);
	}
	if((flag & BIT2_TRUE)>0)
	{
		strcat(buf,"ACTCODE=");
		for (i=0;i<ptr->actcodeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->actcode[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT3_TRUE)>0)
	{
		strcat(buf,"ANNLIST=");
		for (i=0;i<ptr->annlistLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->annlist[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"CPNSTRG1=");
		for (i=0;i<ptr->cpnstrg1Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpnstrg1[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"CPNSTRG2=");
		for (i=0;i<ptr->cpnstrg2Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpnstrg2[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"CPSUB=");
		for (i=0;i<ptr->cpsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT7_TRUE)>0)		//Digits carrier
	{
		strcat(buf,"DIGITS CARRIER=");
		for (i=0;i<ptr->digitsCarrierLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digitsCarrier[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT8_TRUE)>0)
	{
		strcat(buf,"ACDGTS=");
		for (i=0;i<ptr->acdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->acdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT9_TRUE)>0)
	{
		strcat(buf,"ABDGTS=");
		for (i=0;i<ptr->abdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->abdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT10_TRUE)>0)
	{
		strcat(buf,"BILLDGTS=");
		for (i=0;i<ptr->billdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->billdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT11_TRUE)>0)
	{
		strcat(buf,"REDIND=");
		for (i=0;i<ptr->redindLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->redind[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT12_TRUE)>0)
	{
		strcat(buf,"DMH_SVCID=");
		for (i=0;i<ptr->dmh_svcidLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->dmh_svcid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT13_TRUE)>0)
	{
		strcat(buf,"GRPINFO=");
		for (i=0;i<ptr->grpinfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->grpinfo[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT14_TRUE)>0)
	{
		strcat(buf,"MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT15_TRUE)>0)
	{
		strcat(buf,"NATIME=");
		for (i=0;i<ptr->natimeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->natime[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT16_TRUE)>0)
	{
		sprintf(tempchar,"PLIND=%02x,",ptr->plind);
		strcat(buf,tempchar);
	}

	if((flag & BIT17_TRUE)>0)
	{
		strcat(buf,"RNDGTS=");
		for (i=0;i<ptr->rndgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rndgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT18_TRUE)>0)
	{
		strcat(buf,"RNSTRING=");
		for (i=0;i<ptr->rnstringLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rnstring[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT19_TRUE)>0)
	{
		strcat(buf,"RSUB=");
		for (i=0;i<ptr->rsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if ((flag & BIT20_TRUE) > 0)
	{
		debug_show_param_termlist(&ptr->termlist, (u8 *)buf);
	}
	if((flag & BIT21_TRUE)>0)
	{
		strcat(buf,"TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT22_TRUE)>0)		//TriggerAddressList
	{
		triglistnum = ptr->triggerlistnum & MAX_IS41_TRIG_LIST_NUM_1;

		for (i = 0; i < triglistnum; i++)
		{
			ptr1 = &ptr->triggerlist[i];
			flag1 = ptr1->param_flag;

			if((flag1 & BIT0_TRUE)>0)		//destinationaddress -- choice global title
			{
				strcat(buf,"TRIGADRLIST-TRIGLIST-DESTADDR=");
				for (i=0;i<ptr1->destaddrLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->destaddr[i]);
					strcat(buf,tempchar);
				}
				strcat(buf,",");
			}
			if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
			{
				strcat(buf,"TRIGADRLIST-TRIGLIST-WINTRIGLIST=");
				for (i=0;i<ptr1->wintriglistLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->wintriglist[i]);
					strcat(buf,tempchar);
				}
				strcat(buf,",");
			}
		}
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_SMSREQ_ARG(struct IS41_SMSREQ_ARG *ptr,char *buf)
{
	int			i;
	u32			flag;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT1_TRUE)>0)		//ElectronicSerialNumber
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//SMS_NotificationIndicator
	{
		strcat(buf,"SMSNOTIND=");
		for (i=0;i<ptr->smsnotindLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->smsnotind[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT3_TRUE)>0)		//SMS_TeleserviceIdentifier
	{
		strcat(buf,"SMSTID=");
		for (i=0;i<ptr->smstidLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->smstid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_SMSREQ_RSP(struct IS41_SMSREQ_RSP *ptr,char *buf)
{
	int			i;
	u32			flag;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//ElectronicSerialNumber
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT1_TRUE)>0)		//SMS_AccessDeniedReason
	{
		strcat(buf,"SMSACCDEN=");
		for (i=0;i<ptr->smsaccdenLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->smsaccden[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT2_TRUE)>0)		//SMS_DestinationAddress
	{
		strcat(buf,"SMSADDR=");
		for (i=0;i<ptr->smsaddrLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->smsaddr[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_MSINACT_ARG(struct IS41_MSINACT_ARG *ptr,char *buf)
{
	int			i;
	u32			flag;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//esn
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}
	if((flag & BIT1_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

// optional part--->
	if((flag & BIT2_TRUE)>0)
	{
		sprintf(tempchar,"COUNT=%02x,",ptr->count);
		strcat(buf,tempchar);
	}

	if((flag & BIT3_TRUE)>0)
	{
		sprintf(tempchar,"DEREG=%02x,",ptr->dereg);
		strcat(buf,tempchar);
	}

	if((flag & BIT4_TRUE)>0)		//LocationAreaID
	{
		sprintf(tempchar,"LOCID=%02x%02x,",ptr->locid[0],ptr->locid[1]);
		strcat(buf,tempchar);
	}

	if((flag & BIT5_TRUE)>0)		//senderin
	{
		strcat(buf,"SENDERIN=");
		for (i=0;i<ptr->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->senderin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_MSINACT_RSP(struct IS41_MSINACT_RSP *ptr,char *buf)
{
	buf[0] = 0;

	return 0;
}

int debug_show_FEATREQ_ARG(struct IS41_FEATREQ_ARG *ptr,char *buf)
{
	int			i;
	u32			flag;
	char		tempchar[512];

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//Dialed Digits
	{
		strcat(buf,"DIGITS=");
		for (i=0;i<ptr->digitsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digits[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT1_TRUE)>0)		//esn
	{
		sprintf(tempchar,"ESN=%02x%02x%02x%02x,",ptr->esn[0],ptr->esn[1],ptr->esn[2],ptr->esn[3]);
		strcat(buf,tempchar);
	}

	if((flag & BIT2_TRUE)>0)		//min
	{
		sprintf(tempchar,"MIN=%02x%02x%02x%02x%02x,",ptr->min[0],ptr->min[1],ptr->min[2],ptr->min[3],ptr->min[4]);
		strcat(buf,tempchar);
	}

//optional
	if((flag & BIT3_TRUE)>0)
	{
		strcat(buf,"BILLID=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",ptr->billid[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"CPNDGTS1=");
		for (i=0;i<ptr->cpndgts1Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpndgts1[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"CPNDGTS2=");
		for (i=0;i<ptr->cpndgts2Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpndgts2[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"CPSUB=");
		for (i=0;i<ptr->cpsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT7_TRUE)>0)
	{
		strcat(buf,"CCI=");
		for (i=0;i<ptr->cciLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cci[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT8_TRUE)>0)
	{
		strcat(buf,"MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT9_TRUE)>0)		//MSCID
	{
		sprintf(tempchar,"MSCID=%02x%02x%02x,",ptr->mscid[0],ptr->mscid[1],ptr->mscid[2]);
		strcat(buf,tempchar);
	}

	if((flag & BIT10_TRUE)>0)
	{
		strcat(buf,"MSCIN=");
		for (i=0;i<ptr->mscinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mscin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT11_TRUE)>0)
	{
		strcat(buf,"OTFI=");
		for (i=0;i<ptr->otfiLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->otfi[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT12_TRUE)>0)		//pcssn
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x,",ptr->pcssn[0],ptr->pcssn[1],ptr->pcssn[2],ptr->pcssn[3],ptr->pcssn[4]);
		strcat(buf,tempchar);
	}

	if((flag & BIT13_TRUE)>0)		//senderin
	{
		strcat(buf,"SENDERIN=");
		for (i=0;i<ptr->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->senderin[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT14_TRUE)>0)		//transcap
	{
		strcat(buf,"TRANSCAP=");
		for (i=0;i<ptr->transcapLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->transcap[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_FEATREQ_RSP(struct IS41_FEATREQ_RSP *ptr,char *buf)
{
	int			i,triglistnum;
	u32			flag,flag1;
	char		tempchar[512];
	IS41_PAR_TRIGGER_LIST	*ptr1;

	flag = ptr->param_flag;

	buf[0] = 0;

	if((flag & BIT0_TRUE)>0)		//feature result
	{
		sprintf(tempchar,"FEATRESULT=%02x,",ptr->featresult);
		strcat(buf,tempchar);
	}

//optional
	if((flag & BIT1_TRUE)>0)
	{
		sprintf(tempchar,"ACCDEN=%02x,",ptr->accden);
		strcat(buf,tempchar);
	}
	if((flag & BIT2_TRUE)>0)
	{
		strcat(buf,"ACTCODE=");
		for (i=0;i<ptr->actcodeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->actcode[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT3_TRUE)>0)
	{
		strcat(buf,"ANNLIST=");
		for (i=0;i<ptr->annlistLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->annlist[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT4_TRUE)>0)
	{
		strcat(buf,"CPNDGTS1=");
		for (i=0;i<ptr->cpndgts1Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpndgts1[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT5_TRUE)>0)
	{
		strcat(buf,"CPNDGTS2=");
		for (i=0;i<ptr->cpndgts2Len;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpndgts2[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT6_TRUE)>0)
	{
		strcat(buf,"CPSUB=");
		for (i=0;i<ptr->cpsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cpsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT7_TRUE)>0)		//Digits carrier
	{
		strcat(buf,"DIGITS CARRIER=");
		for (i=0;i<ptr->digitsCarrierLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digitsCarrier[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT8_TRUE)>0)		//ConferenceCallingIndicator
	{
		strcat(buf,"CCI=");
		for (i=0;i<ptr->cciLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->cci[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT9_TRUE)>0)		//Digits carrier
	{
		strcat(buf,"DIGITS=");
		for (i=0;i<ptr->digitsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->digits[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
/*	if((flag & BIT10_TRUE)>0)		//display text
		buf_len = AddTLV(is41_sequenceTag(IS41PAR_DISPTEXT,11),ptr->disptextLen & MAX_IS41_VARPAR_LEN_1,ptr->disptext,0x80,&asn_buf);*/
	if((flag & BIT11_TRUE)>0)
	{
		strcat(buf,"ACDGTS=");
		for (i=0;i<ptr->acdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->acdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT12_TRUE)>0)
	{
		strcat(buf,"ABDGTS=");
		for (i=0;i<ptr->abdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->abdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT13_TRUE)>0)
	{
		strcat(buf,"BILLDGTS=");
		for (i=0;i<ptr->billdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->billdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT14_TRUE)>0)
	{
		strcat(buf,"REDIND=");
		for (i=0;i<ptr->redindLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->redind[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT15_TRUE)>0)
	{
		strcat(buf,"GRPINFO=");
		for (i=0;i<ptr->grpinfoLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->grpinfo[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT16_TRUE)>0)
	{
		strcat(buf,"MDN=");
		for (i=0;i<ptr->mdnLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->mdn[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT17_TRUE)>0)
	{
		strcat(buf,"NATIME=");
		for (i=0;i<ptr->natimeLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->natime[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT18_TRUE)>0)
	{
		strcat(buf,"OTFI=");
		for (i=0;i<ptr->otfiLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->otfi[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT19_TRUE)>0)
	{
		sprintf(tempchar,"PACAIND=%02x,",ptr->pacaind);
		strcat(buf,tempchar);
	}
	if((flag & BIT20_TRUE)>0)
	{
		strcat(buf,"PILOT=");
		for (i=0;i<ptr->pilotLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->pilot[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT21_TRUE)>0)
	{
		strcat(buf,"RNDGTS=");
		for (i=0;i<ptr->rndgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rndgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT22_TRUE)>0)
	{
		strcat(buf,"RNSTRING=");
		for (i=0;i<ptr->rnstringLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rnstring[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT23_TRUE)>0)
	{
		strcat(buf,"RSUB=");
		for (i=0;i<ptr->rsubLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->rsub[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if((flag & BIT24_TRUE)>0)
	{
		sprintf(tempchar,"RESUMEPIC=%02x,",ptr->resumepic);
		strcat(buf,tempchar);
	}
	if((flag & BIT25_TRUE)>0)
	{
		strcat(buf,"ROUTDGTS=");
		for (i=0;i<ptr->routdgtsLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->routdgts[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}
	if ((flag & BIT26_TRUE) > 0)
	{
		debug_show_param_termlist(&ptr->termlist, (u8 *)buf);
	}
	if((flag & BIT27_TRUE)>0)
	{
		strcat(buf,"TERMTRIG=");
		for (i=0;i<ptr->termtrigLen;i++)
		{
			sprintf(tempchar,"%02x",ptr->termtrig[i]);
			strcat(buf,tempchar);
		}
		strcat(buf,",");
	}

	if((flag & BIT28_TRUE)>0)		//TriggerAddressList
	{
		triglistnum = ptr->triggerlistnum & MAX_IS41_TRIG_LIST_NUM_1;

		for (i = 0; i < triglistnum; i++)
		{
			ptr1 = &ptr->triggerlist[i];
			flag1 = ptr1->param_flag;

			if((flag1 & BIT0_TRUE)>0)		//destinationaddress -- choice global title
			{
				strcat(buf,"TRIGADRLIST-TRIGLIST-DESTADDR=");
				for (i=0;i<ptr1->destaddrLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->destaddr[i]);
					strcat(buf,tempchar);
				}
				strcat(buf,",");
			}
			if((flag1 & BIT1_TRUE)>0)		//winoperationscapability
			{
				strcat(buf,"TRIGADRLIST-TRIGLIST-WINTRIGLIST=");
				for (i=0;i<ptr1->wintriglistLen;i++)
				{
					sprintf(tempchar,"%02x",ptr1->wintriglist[i]);
					strcat(buf,tempchar);
				}
				strcat(buf,",");
			}
		}
	}
	
	if (flag > 0)
		return 1;
	return 0;
}

int debug_show_AUTHREQ_ARG(IS41_AUTHREQ_ARG *AUTHREQ,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;
	char	name[32];

	param_flag = AUTHREQ->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"esn=%02x%02x%02x%02x;",AUTHREQ->esn[0],AUTHREQ->esn[1],AUTHREQ->esn[2],AUTHREQ->esn[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"min=%02x%02x%02x%02x%02x;",AUTHREQ->min[0],AUTHREQ->min[1],AUTHREQ->min[2],AUTHREQ->min[3],AUTHREQ->min[4]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"mscid=%02x%02x%02x;",AUTHREQ->mscid[0],AUTHREQ->mscid[1],AUTHREQ->mscid[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		switch (AUTHREQ->sysacctype)
		{
		case ACCTYPE_REGISTRATION:
			sprintf(name,"REGISTRATION");
			break;
		case ACCTYPE_ORIGINATION:
			sprintf(name,"ORIGINATION");
			break;
		case ACCTYPE_TERMINATION:
			sprintf(name,"TERMINATION");
			break;
		case ACCTYPE_NOACCESS:
			sprintf(name,"NO ACCESS");
			break;
		case ACCTYPE_POWERDOWN:
			sprintf(name,"POWER DOWN");
			break;
		case ACCTYPE_SMS_PAGERESPONSE:
			sprintf(name,"SMS PAGE RESPONSE");
			break;
		default:
			sprintf(name,"UNSPECIFIED");
			break;
		}
		sprintf(tempchar,"SysAccType=%s(%02x);",name,AUTHREQ->sysacctype);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT4_TRUE)
	{
		sprintf(tempchar,"SysCap=%02x;",AUTHREQ->syscap);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT5_TRUE)
	{
		sprintf(tempchar,"AuthData=%02x%02x%02x;",AUTHREQ->authdata[0],AUTHREQ->authdata[1],AUTHREQ->authdata[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT6_TRUE)
	{
		sprintf(tempchar,"Authr=%02x%02x%02x;",AUTHREQ->authr[0],AUTHREQ->authr[1],AUTHREQ->authr[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT7_TRUE)
	{
		sprintf(tempchar,"COUNT=%02d;",AUTHREQ->count);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT8_TRUE)
	{
		sprintf(tempchar,"CMODES=%02x;",AUTHREQ->cmodes);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT9_TRUE)
	{
		strcat(charOpr,"digits=");
		for (i=0;i<AUTHREQ->DigitsLen;i++)
		{
			sprintf(tempchar,"%02x",AUTHREQ->digits[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT10_TRUE)
	{
		sprintf(tempchar,"PCSSN=%02x%02x%02x%02x%02x;",AUTHREQ->pcssn[0],AUTHREQ->pcssn[1],AUTHREQ->pcssn[2],AUTHREQ->pcssn[3],AUTHREQ->pcssn[4]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT11_TRUE)
	{
		sprintf(tempchar,"RAND=%02x%02x%02x%02x;",AUTHREQ->rand[0],AUTHREQ->rand[1],AUTHREQ->rand[2],AUTHREQ->rand[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT12_TRUE)
	{
		strcat(charOpr,"senderin=");
		for (i=0;i<AUTHREQ->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",AUTHREQ->senderin[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT13_TRUE)
	{
		sprintf(tempchar,"TermType=%02x;",AUTHREQ->termtyp);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_authreq_rsp(IS41_AUTHREQ_RSP *authreq,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	param_flag = authreq->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"AAV=%02x;",authreq->aav);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"AUTHU=%02x%02x%02x;",authreq->authu[0],authreq->authu[1],authreq->authu[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",authreq->count);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		sprintf(tempchar,"CDMAPLCM=%02x%02x%02x%02x%02x%02x;",
			authreq->cdmaplcm[0],authreq->cdmaplcm[1],authreq->cdmaplcm[2],authreq->cdmaplcm[3],
			authreq->cdmaplcm[4],authreq->cdmaplcm[5]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT4_TRUE)
	{
		sprintf(tempchar,"DenAcc=%02x;",authreq->denacc);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT5_TRUE)
	{
		strcat(charOpr,"RANDSSD=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",authreq->randssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT6_TRUE)
	{
		strcat(charOpr,"RANDU=");
		for (i=0;i<3;i++)
		{
			sprintf(tempchar,"%02x",authreq->randu[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT7_TRUE)
	{
		strcat(charOpr,"SSD=");
		for (i=0;i<16;i++)
		{
			sprintf(tempchar,"%02x",authreq->ssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT8_TRUE)
	{
		strcat(charOpr,"SMEKEY=");
		for (i=0;i<8;i++)
		{
			sprintf(tempchar,"%02x",authreq->smekey[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT9_TRUE)
	{
		sprintf(tempchar,"NOSSD=%02x;",authreq->nossd);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT10_TRUE)
	{
		sprintf(tempchar,"UpdCount=%02x;",authreq->updcount);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT11_TRUE)
	{
		strcat(charOpr,"VPMASK=");
		for (i=0;i<66;i++)
		{
			sprintf(tempchar,"%02x",authreq->vpmask[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_ASREPORT_ARG(IS41_ASREPORT_ARG *ASREPORT,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	param_flag = ASREPORT->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"esn=%02x%02x%02x%02x;",ASREPORT->esn[0],ASREPORT->esn[1],ASREPORT->esn[2],ASREPORT->esn[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"min=%02x%02x%02x%02x%02x;",ASREPORT->min[0],ASREPORT->min[1],ASREPORT->min[2],ASREPORT->min[3],ASREPORT->min[4]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"SysCap=%02x;",ASREPORT->syscap);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		strcat(charOpr,"countrpt=");
		for (i=0;i<ASREPORT->CntUpdRepLen;i++)
		{
			sprintf(tempchar,"%02x",ASREPORT->countrpt[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT4_TRUE)
	{
		strcat(charOpr,"senderin=");
		for (i=0;i<ASREPORT->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",ASREPORT->senderin[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag & BIT5_TRUE)
	{
		strcat(charOpr,"ssdurpt=");
		for (i=0;i<ASREPORT->SSDUpdRepLen;i++)
		{
			sprintf(tempchar,"%02x",ASREPORT->ssdurpt[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag & BIT6_TRUE)
	{
		strcat(charOpr,"uchalrpt=");
		for (i=0;i<ASREPORT->UniChaRepLen;i++)
		{
			sprintf(tempchar,"%02x",ASREPORT->uchalrpt[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_asreport_rsp(IS41_ASREPORT_RSP *asreport,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	param_flag = asreport->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"AAV=%02x;",asreport->aav);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"AUTHU=%02x%02x%02x;",asreport->authu[0],asreport->authu[1],asreport->authu[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",asreport->count);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		sprintf(tempchar,"DenAcc=%02x;",asreport->denacc);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT4_TRUE)
	{
		strcat(charOpr,"RANDSSD=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",asreport->randssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT5_TRUE)
	{
		strcat(charOpr,"RANDU=");
		for (i=0;i<3;i++)
		{
			sprintf(tempchar,"%02x",asreport->randu[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT6_TRUE)
	{
		strcat(charOpr,"SSD=");
		for (i=0;i<16;i++)
		{
			sprintf(tempchar,"%02x",asreport->ssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT7_TRUE)
	{
		sprintf(tempchar,"NOSSD=%02x;",asreport->nossd);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT8_TRUE)
	{
		sprintf(tempchar,"UpdCount=%02x;",asreport->updcount);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_BSCHALL_ARG(IS41_BSCHALL_ARG *BSCHALL,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	param_flag = BSCHALL->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"esn=%02x%02x%02x%02x;",BSCHALL->esn[0],BSCHALL->esn[1],BSCHALL->esn[2],BSCHALL->esn[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"min=%02x%02x%02x%02x%02x;",BSCHALL->min[0],BSCHALL->min[1],BSCHALL->min[2],BSCHALL->min[3],BSCHALL->min[4]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"RANDBS=%02x%02x%02x%02x;",BSCHALL->randbs[0],BSCHALL->randbs[1],BSCHALL->randbs[2],BSCHALL->randbs[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		strcat(charOpr,"SENDERIN=");
		for (i=0;i<BSCHALL->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",BSCHALL->senderin[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_bschall_rsp(IS41_BSCHALL_RSP *bschall,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;

	param_flag = bschall->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"AUTHBS=%02x%02x%02x",bschall->authbs[0],bschall->authbs[1],bschall->authbs[2]);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_AFREPORT_ARG(IS41_AFREPORT_ARG *AFREPORT,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;
	char	name[32];

	param_flag = AFREPORT->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"esn=%02x%02x%02x%02x;",AFREPORT->esn[0],AFREPORT->esn[1],AFREPORT->esn[2],AFREPORT->esn[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"min=%02x%02x%02x%02x%02x;",AFREPORT->min[0],AFREPORT->min[1],AFREPORT->min[2],AFREPORT->min[3],AFREPORT->min[4]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"rpttyp1=%02x;",AFREPORT->rpttyp1);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		switch (AFREPORT->sysacctype)
		{
		case ACCTYPE_REGISTRATION:
			sprintf(name,"REGISTRATION");
			break;
		case ACCTYPE_ORIGINATION:
			sprintf(name,"ORIGINATION");
			break;
		case ACCTYPE_TERMINATION:
			sprintf(name,"TERMINATION");
			break;
		case ACCTYPE_NOACCESS:
			sprintf(name,"NO ACCESS");
			break;
		case ACCTYPE_POWERDOWN:
			sprintf(name,"POWER DOWN");
			break;
		case ACCTYPE_SMS_PAGERESPONSE:
			sprintf(name,"SMS PAGE RESPONSE");
			break;
		default:
			sprintf(name,"UNSPECIFIED");
			break;
		}
		sprintf(tempchar,"SysAccType=%s(%02x);",name,AFREPORT->sysacctype);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT4_TRUE)
	{
		sprintf(tempchar,"SysCap=%02x;",AFREPORT->syscap);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT5_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",AFREPORT->count);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT6_TRUE)
	{
		sprintf(tempchar,"COUNTex=%02x;",AFREPORT->countex);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT7_TRUE)
	{
		strcat(charOpr,"mscid=");
		for (i=0;i<3;i++)
		{
			sprintf(tempchar,"%02x",AFREPORT->mscid[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT8_TRUE)
	{
		sprintf(tempchar,"rpttyp2=%02x;",AFREPORT->rpttyp2);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT9_TRUE)
	{
		strcat(charOpr,"senderin=");
		for (i=0;i<AFREPORT->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",AFREPORT->senderin[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag)
		return 1;
	return 0;
}

int debug_show_afreport_rsp(IS41_AFREPORT_RSP *afreport,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	param_flag = afreport->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"aav=%02x;",afreport->aav);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"AUTHU=%02x%02x%02x;",afreport->authu[0],afreport->authu[1],afreport->authu[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",afreport->count);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT3_TRUE)
	{
		sprintf(tempchar,"DENACC=%02x;",afreport->denacc);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT4_TRUE)
	{
		strcat(charOpr,"RANDSSD=");
		for (i=0;i<8;i++)
		{
			sprintf(tempchar,"%02x",afreport->randssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT5_TRUE)
	{
		sprintf(tempchar,"RANDU=%02x%02x%02x;",afreport->randu[0],afreport->randu[1],afreport->randu[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT6_TRUE)
	{
		strcat(charOpr,"SSD=");
		for (i=0;i<16;i++)
		{
			sprintf(tempchar,"%02x",afreport->ssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT7_TRUE)
	{
		sprintf(tempchar,"NOSSD=%02x;",afreport->nossd);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT8_TRUE)
	{
		sprintf(tempchar,"TERMTYP=%02x;",afreport->termtyp);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT9_TRUE)
	{
		sprintf(tempchar,"UPDCOUNT=%02x;",afreport->updcount);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

int auc_debug_show_COUNTREQ_ARG(IS41_COUNTREQ_ARG *COUNTREQ,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	sprintf(charOpr,"[AC->HLR] COUNTREQ (Invoke)\n");

	param_flag = COUNTREQ->param_flag;
	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"esn=%02x%02x%02x%02x;",COUNTREQ->esn[0],COUNTREQ->esn[1],COUNTREQ->esn[2],COUNTREQ->esn[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"min=%02x%02x%02x%02x%02x;",COUNTREQ->min[0],COUNTREQ->min[1],COUNTREQ->min[2],COUNTREQ->min[3],COUNTREQ->min[4]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT2_TRUE)
	{
		strcat(charOpr,"senderin=");
		for (i=0;i<COUNTREQ->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",COUNTREQ->senderin[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag)
		return 1;
	return 0;
}

int auc_debug_show_countreq_rsp(IS41_COUNTREQ_RSP *countreq,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;

	sprintf(charOpr,"[HLR->AC] countreq (Result)\n");

	param_flag = countreq->param_flag;

	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",countreq->count);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

int auc_debug_show_AUTHDIR_ARG(IS41_AUTHDIR_ARG *AUTHDIR,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;
	int		i;

	sprintf(charOpr,"[AC->HLR] AUTHDIR (invoke)\n");

	param_flag = AUTHDIR->param_flag;

	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"esn=%02x%02x%02x%02x;",AUTHDIR->esn[0],AUTHDIR->esn[1],AUTHDIR->esn[2],AUTHDIR->esn[3]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT1_TRUE)
	{
		sprintf(tempchar,"min=%02x%02x%02x%02x%02x;",AUTHDIR->min[0],AUTHDIR->min[1],AUTHDIR->min[2],AUTHDIR->min[3],AUTHDIR->min[4]);
		strcat(charOpr,tempchar);
	}

	if (param_flag & BIT2_TRUE)
	{
		sprintf(tempchar,"AAV=%02x;",AUTHDIR->aav);
		strcat(charOpr,tempchar);
	}

	if (param_flag & BIT3_TRUE)
	{
		sprintf(tempchar,"AUTHU=%02x%02x%02x;",AUTHDIR->authu[0],AUTHDIR->authu[1],AUTHDIR->authu[2]);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT4_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",AUTHDIR->count);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT5_TRUE)
	{
		sprintf(tempchar,"DenAcc=%02x;",AUTHDIR->denacc);
		strcat(charOpr,tempchar);
	}

	if (param_flag & BIT6_TRUE)
	{
		sprintf(tempchar,"LocID=%02x%02x;",AUTHDIR->locid[0],AUTHDIR->locid[1]);
		strcat(charOpr,tempchar);
	}

	if (param_flag & BIT7_TRUE)
	{
		strcat(charOpr,"RANDSSD=");
		for (i=0;i<7;i++)
		{
			sprintf(tempchar,"%02x",AUTHDIR->randssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT8_TRUE)
	{
		strcat(charOpr,"RANDU=");
		for (i=0;i<3;i++)
		{
			sprintf(tempchar,"%02x",AUTHDIR->randu[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}

	if (param_flag & BIT9_TRUE)
	{
		strcat(charOpr,"senderin=");
		for (i=0;i<AUTHDIR->senderinLen;i++)
		{
			sprintf(tempchar,"%02x",AUTHDIR->senderin[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	
	if (param_flag & BIT10_TRUE)
	{
		strcat(charOpr,"SSD=");
		for (i=0;i<16;i++)
		{
			sprintf(tempchar,"%02x",AUTHDIR->ssd[i]);
			strcat(charOpr,tempchar);
		}
		strcat(charOpr,";");
	}
	if (param_flag & BIT11_TRUE)
	{
		sprintf(tempchar,"NOSSD=%02x;",AUTHDIR->nossd);
		strcat(charOpr,tempchar);
	}
	if (param_flag & BIT12_TRUE)
	{
		sprintf(tempchar,"UpdCount=%02x;",AUTHDIR->updcount);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

int auc_debug_show_authdir_rsp(IS41_AUTHDIR_RSP *authdir,char *charOpr)
{
	char	tempchar[512];
	u32		param_flag;

	sprintf(charOpr,"[HLR->AC] authdir (Result)\n");

	param_flag = authdir->param_flag;

	if (param_flag & BIT0_TRUE)
	{
		sprintf(tempchar,"COUNT=%02x;",authdir->count);
		strcat(charOpr,tempchar);
	}

	if (param_flag)
		return 1;
	return 0;
}

