
#include	"../include/param.h"
#include "../../../../plat/snmp/src/include/snmp.h"
#include "../../../../plat/snmp/src/include/macro.h"
#include "../include/function.h"

typedef u32 index_t;

extern 	int pps_set_nas(BYTE id,RADIUS_NAS_INFORMATION *nasInfo);
extern 	int pps_del_nas(BYTE id);

static void initCosTable(COSTable	*cosItem);

PPSParamStruct	ppsParam;

u8 PPS_GET_INTEGER(u_long integer,BYTE *pdata,u8 *vartype)
{ 	
	*((int *)pdata) = htonl(integer); 
	*vartype = INTEGER; 
	return 4; 	
}


u_long PPS_SET_INTEGER(BYTE *pdata,BYTE dataLen)
{
	int i;
	u_long	integer;
	
	do { 
		if(dataLen > 4) 
			return -1; 
		for(i = 0, integer = 0; i < dataLen; i++) 
		{ 
			integer = integer << 8; 
			integer += pdata[i]; 
		} 
	} while(0);
	return integer;
}

static int isIndexValid(ppsTableType tableType,int index)
{	
	switch(tableType)
	{
		case 	PromptResolutionTable:
				if(index < 0 || index >= MaxPromptResolutionItem)
					return FALSE;										
		break;
		case	MnpPrefixTable:	
				if(index < 0 || index >= MaxMnpPrefixItem)
					return FALSE;									
		break;
		case	SmsSentenceTable:	
				if(index < 0 || index >= MaxSmsSentenceItem*2)
					return FALSE;								
		break;					
		case	ThirdPartyInfoTable:	
				if(index < 0 || index >= MaxThirdPartyInfoItem)
					return FALSE;								
		break;
		case	BasicTariffZoneTable:
				if(index < 0 || index >= MaxBasicTariffZoneItem)
					return FALSE;										
		break;
		case	IvrSourceTable:		
				if(index < 0 || index >= MaxIvrSourceItem)
					return FALSE;											
		break;
		case	SrfNumberTable:		
				if(index < 0 || index >= MaxSrfNumberItem)
					return FALSE;									
		break;
		case	ServiceNumberTable:	
				if(index < 0 || index >= MaxServiceNumberItem)
					return FALSE;									
		break;
		case	ServiceKeyTable:	
				if(index < 0 || index >= MaxServiceKeyItem)
					return FALSE;								
		break;
		case	VmsUserSegmentTable:
				if(index < 0 || index >= MaxVmsUserSegmentItem)
					return FALSE;											
		break;
		case	RadiusGsnTable:
				if(index < 0 || index >= MaxRadiusGsnItem)
					return FALSE;
		break;
		case	RadiusSgsnTable:
				if(index < 0 || index >= MaxRadiusSgsnItem)
					return FALSE;
		break;
		case	BundlePlanTable:
				if(index <= 0 || index >= MAX_BUNDLE_PLANS)
					return FALSE;
		break;
		case	CosTable:
				if(index < 0 || index >= MaxCosTableItem)
					return FALSE;									
		break;
		case	TariffTable:	
				if(index < 0 || index >= MaxTariffTableItem)
					return FALSE;							
		break;
		case	ServiceControlTable:		
				if(index < 0 || index >= MaxServiceControlTableItem)
					return FALSE;						
		break;
		case	AccountValidityTable:		
				if(index < 0 || index >= MaxAccountValidityTableItem)
					return FALSE;						
		break;
		case	SmsNotificationInquiryTable:		
				if(index < 0 || index >= MaxSmsNotificationInquiryTableItem)
					return FALSE;						
		break;
		case	RechargeCardValidityTable:			
				if(index < 0 || index >= MaxRechargeCardType)
					return FALSE;					
		break;
		case	RechargePromotionTable:			
				if(index < 0 || index >= MaxRechargeCardType)
					return FALSE;					
		break;
		case	CapPlanTable:				
				if(index < 0 || index >= MaxcapPlanTableItem)
					return FALSE;				
		break;
		case	PoolAccountTable:				
				if(index < 0 || index >= MaxPoolAccountTableItem)
					return FALSE;				
		break;
		case	CosGprsTable:
				if(index < 0 || index >= MaxGprsTableItem)
					return FALSE;
		break;
		case      FriendFamilyTable:
				if(index<0 || index>=MaxServiceControlTableItem)
					return FALSE;
		break;			
		case	UssdServiceNumberTable:	
				if(index < 0 || index >= MaxServiceNumberItem)
					return FALSE;									
		break;
		case	UssdServiceKeyTable:	
				if(index < 0 || index > 10)
					return FALSE;								
		break;
		default:
				return FALSE;	
		break;
	}	
	return TRUE;	
}

int pps_getnext_Index(ppsTableType tableType,index_t *id)
{
	u32 				i;
	PpsTable			*ppsTablePoint;
	
	ppsTablePoint = &ppsParam.ppsTables;
	switch(tableType)
	{
		case 	PromptResolutionTable:
				for(i = *id; i < MaxPromptResolutionItem; i++)
				{	
					if(ppsTablePoint->promptResolution[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}				
		break;
		case	MnpPrefixTable:				
				for(i = *id; i < MaxMnpPrefixItem; i++)
				{	
					if(ppsTablePoint->mnpPrefix[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}		
		break;
		case	SmsSentenceTable:				
				for(i = *id; i < MaxSmsSentenceItem; i++)
				{	
					if( ppsTablePoint->smsSentence[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}		
		break;		
		case	ThirdPartyInfoTable:				
				for(i = *id; i < MaxThirdPartyInfoItem; i++)
				{	
					if(ppsTablePoint->thirdPartyInfo[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	BasicTariffZoneTable:				
				for(i = *id; i < MaxBasicTariffZoneItem; i++)
				{	
					if(ppsTablePoint->basicTariffZone[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	IvrSourceTable:				
				for(i = *id; i < MaxIvrSourceItem; i++)
				{	
					if(ppsTablePoint->ivrSource[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	SrfNumberTable:				
				for(i = *id; i < MaxSrfNumberItem; i++)
				{	
					if(ppsTablePoint->srfNumber[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	ServiceNumberTable:			
				for(i = *id; i < MaxServiceNumberItem; i++)
				{	
					if(ppsTablePoint->serviceNumber[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	ServiceKeyTable:				
				for(i = *id; i < MaxServiceKeyItem; i++)
				{	
					if(ppsTablePoint->serviceKey[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	VmsUserSegmentTable:
				for(i = *id; i < MaxVmsUserSegmentItem; i++)
				{	
					if(ppsTablePoint->vmsUserSegment[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}					
		break;
		case	RadiusGsnTable:
				for(i = *id; i < MaxRadiusGsnItem; i++)
				{	
					if(ppsTablePoint->gsn[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}		
		break;
		case	RadiusSgsnTable:
				for(i = *id; i < MaxRadiusSgsnItem; i++)
				{	
					if(ppsTablePoint->sgsn[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}		
		break;
		case	BundlePlanTable:
				for(i = *id; i < MAX_BUNDLE_PLANS; i++)
				{	
					if(ppsTablePoint->bundlePlans[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}		
		break;

		case	CosTable:
				for(i = *id; i < MaxCosTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}
		break;
		case	TariffTable:
				for(i = *(id+1); i < MaxTariffTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].tariff[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}		
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}					
		break;
		case	ServiceControlTable:
				for(i = *(id+1); i < MaxServiceControlTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].serviceControl[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	AccountValidityTable:
				for(i = *(id+1); i < MaxAccountValidityTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].accountValidity[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	SmsNotificationInquiryTable:
				for(i = *(id+1); i < MaxSmsNotificationInquiryTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].smsNotificationInquiry[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	RechargeCardValidityTable:
				for(i = *(id+1); i < MaxRechargeCardType; i++)
				{	
					if(ppsTablePoint->cosTable[*id].rechargeCardValidity[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	RechargePromotionTable:
				for(i = *(id+1); i < MaxRechargeCardType; i++)
				{	
					if(ppsTablePoint->cosTable[*id].rechargePromotion[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	CapPlanTable:
				for(i = *(id+1); i < MaxcapPlanTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].capPlan[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	PoolAccountTable:
				for(i = *(id+1); i < MaxPoolAccountTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].poolAccount[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	CosGprsTable:
				for(i = *(id+1); i < MaxGprsTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].gprs[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		case	UssdServiceNumberTable:			
				for(i = *id; i < MaxServiceNumberItem; i++)
				{	
					if(ppsTablePoint->serviceNumber[i].existFlag == TRUE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	UssdServiceKeyTable:				
				for(i = *(id+1); i < 10; i++)
				{	
					if(ppsTablePoint->serviceKey[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}	
		break;
		case   FriendFamilyTable:
			for(i = *(id+1); i < MaxFriendFamilyTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].friendFamilyControl[i].existFlag == TRUE)
					{
						*(id+1) = i;
						return 1;
					}
				}
				for(i = *id+1; i < MaxCosTableItem; i++)
				{	/*	next cos item	*/
					if(ppsTablePoint->cosTable[i].existFlag == TRUE)
					{
						*id = i;
						*(id+1) = 0;
						return 1;
					}
				}	
		break;
		default:
				*id = 0;
				return 0;	
		break;
	}	
		
	*id = 0;
	return 0;	
}
	
int pps_getIdle_Index(ppsTableType tableType,index_t *id)
{
	u32 				i;
	PpsTable			*ppsTablePoint;
	
	ppsTablePoint = &ppsParam.ppsTables;
	switch(tableType)
	{
		case 	PromptResolutionTable:
				for(i = *id; i < MaxPromptResolutionItem; i++)
				{	
					if(ppsTablePoint->promptResolution[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}				
		break;
		case	MnpPrefixTable:				
				for(i = *id; i < MaxMnpPrefixItem; i++)
				{	
					if(ppsTablePoint->mnpPrefix[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}		
		break;
		case	SmsSentenceTable:				
				for(i = *id; i < MaxSmsSentenceItem; i++)
				{	
					if( ppsTablePoint->smsSentence[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}		
		break;		
		case	ThirdPartyInfoTable:				
				for(i = *id; i < MaxThirdPartyInfoItem; i++)
				{	
					if(ppsTablePoint->thirdPartyInfo[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	BasicTariffZoneTable:				
				for(i = *id; i < MaxBasicTariffZoneItem; i++)
				{	
					if(ppsTablePoint->basicTariffZone[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	IvrSourceTable:				
				for(i = *id; i < MaxIvrSourceItem; i++)
				{	
					if(ppsTablePoint->ivrSource[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	SrfNumberTable:				
				for(i = *id; i < MaxSrfNumberItem; i++)
				{	
					if(ppsTablePoint->srfNumber[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	ServiceNumberTable:			
				for(i = *id; i < MaxServiceNumberItem; i++)
				{	
					if(ppsTablePoint->serviceNumber[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	ServiceKeyTable:				
				for(i = *id; i < MaxServiceKeyItem; i++)
				{	
					if(ppsTablePoint->serviceKey[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	VmsUserSegmentTable:
				for(i = *id; i < MaxVmsUserSegmentItem; i++)
				{	
					if(ppsTablePoint->vmsUserSegment[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}					
		break;
		case	RadiusGsnTable:
				for(i = *id; i < MaxRadiusGsnItem; i++)
				{	
					if(ppsTablePoint->gsn[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	RadiusSgsnTable:
				for(i = *id; i < MaxRadiusSgsnItem; i++)
				{	
					if(ppsTablePoint->sgsn[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	BundlePlanTable:
				for(i = *id; i < MAX_BUNDLE_PLANS; i++)
				{	
					if(ppsTablePoint->bundlePlans[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}	
		break;
		case	CosTable:
				for(i = *id; i < MaxCosTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[i].existFlag == FALSE)
					{
						*id = i;
						return 1;
					}
				}
		break;
		case	TariffTable:
				for(i = *(id+1); i < MaxTariffTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].tariff[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	ServiceControlTable:
				for(i = *(id+1); i < MaxServiceControlTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].serviceControl[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	AccountValidityTable:
				for(i = *(id+1); i < MaxAccountValidityTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].accountValidity[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	SmsNotificationInquiryTable:
				for(i = *(id+1); i < MaxSmsNotificationInquiryTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].smsNotificationInquiry[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	RechargeCardValidityTable:
				for(i = *(id+1); i < MaxRechargeCardType; i++)
				{	
					if(ppsTablePoint->cosTable[*id].rechargeCardValidity[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	RechargePromotionTable:
				for(i = *(id+1); i < MaxRechargeCardType; i++)
				{	
					if(ppsTablePoint->cosTable[*id].rechargePromotion[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	CapPlanTable:
				for(i = *(id+1); i < MaxcapPlanTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].capPlan[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	PoolAccountTable:
				for(i = *(id+1); i < MaxPoolAccountTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].poolAccount[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case	CosGprsTable:
				for(i = *(id+1); i < MaxGprsTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].gprs[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		case   FriendFamilyTable:
				for(i = *(id+1); i < MaxFriendFamilyTableItem; i++)
				{	
					if(ppsTablePoint->cosTable[*id].friendFamilyControl[i].existFlag == FALSE)
					{
						*(id+1) = i;
						return 1;
					}
				}
		break;
		default:
				*id = 0;
				return 0;	
		break;
	}
	
	*id = 0;
	return 0;
}

int isIndexBusy(ppsTableType tableType,index_t *id)
{	
	PpsTable			*ppsTablePoint;
	u32					index,subIndex;
	
	index = *id;
	subIndex = *(id+1);
	ppsTablePoint = &ppsParam.ppsTables;
	switch(tableType)
	{
		case 	PromptResolutionTable:
				if(index >= MaxPromptResolutionItem)
					return TRUE;
				return ppsTablePoint->promptResolution[index].existFlag;							
		break;
		case	MnpPrefixTable:	
				if(index >= MaxMnpPrefixItem)
					return TRUE;			
				return ppsTablePoint->mnpPrefix[index].existFlag;						
		break;
		case	SmsSentenceTable:	
				if(index >= MaxSmsSentenceItem*2)
					return TRUE;			
				return ppsTablePoint->smsSentence[index].existFlag;						
		break;		
		case	ThirdPartyInfoTable:	
				if(index >= MaxThirdPartyInfoItem)
					return TRUE;			
				return ppsTablePoint->thirdPartyInfo[index].existFlag;				
		break;
		case	BasicTariffZoneTable:		
				if(index >= MaxBasicTariffZoneItem)
					return TRUE;		
				return ppsTablePoint->basicTariffZone[index].existFlag;					
		break;
		case	IvrSourceTable:				
				if(index >= MaxIvrSourceItem)
					return TRUE;
				return ppsTablePoint->ivrSource[index].existFlag;					
		break;
		case	SrfNumberTable:			
				if(index >= MaxSrfNumberItem)
					return TRUE;	
				return ppsTablePoint->srfNumber[index].existFlag;					
		break;
		case	ServiceNumberTable:	
				if(index >= MaxServiceNumberItem)
					return TRUE;						
				return ppsTablePoint->serviceNumber[index].existFlag;					
		break;
		case	ServiceKeyTable:	
				if(index >= MaxServiceKeyItem)
					return TRUE;			
				return ppsTablePoint->serviceKey[index].existFlag;					
		break;
		case	VmsUserSegmentTable:
				if(index >= MaxVmsUserSegmentItem)
					return TRUE;
				return ppsTablePoint->vmsUserSegment[index].existFlag;								
		break;
		case	RadiusGsnTable:
				if(index >= MaxRadiusGsnItem)
					return TRUE;
				return ppsTablePoint->gsn[index].existFlag;	
		break;
		case	RadiusSgsnTable:
				if(index >= MaxRadiusSgsnItem)
					return TRUE;
				return ppsTablePoint->sgsn[index].existFlag;	
		break;
		case	BundlePlanTable:
				if(index >= MAX_BUNDLE_PLANS)
					return TRUE;
				return ppsTablePoint->bundlePlans[index].existFlag;	
		break;
		case	CosTable:
				if(index >= MaxCosTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].existFlag;					
		break;
		case	TariffTable:				
				if(subIndex >= MaxTariffTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].tariff[subIndex].existFlag;
		break;
		case	ServiceControlTable:				
				if(subIndex >= MaxServiceControlTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].serviceControl[subIndex].existFlag;
		break;
		case	AccountValidityTable:				
				if(subIndex >= MaxAccountValidityTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].accountValidity[subIndex].existFlag;
		break;
		case	SmsNotificationInquiryTable:				
				if(subIndex >= MaxSmsNotificationInquiryTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].smsNotificationInquiry[subIndex].existFlag;
		break;
		case	RechargeCardValidityTable:				
				if(subIndex >= MaxRechargeCardType)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].rechargeCardValidity[subIndex].existFlag;
		break;
		case	RechargePromotionTable:				
				if(subIndex >= MaxRechargeCardType)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].rechargePromotion[subIndex].existFlag;
		break;
		case	CapPlanTable:				
				if(subIndex >= MaxcapPlanTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].capPlan[subIndex].existFlag;
		break;
		case	PoolAccountTable:				
				if(subIndex >= MaxPoolAccountTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].poolAccount[subIndex].existFlag;
		break;
		case	CosGprsTable:
				if(subIndex >= MaxGprsTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].gprs[subIndex].existFlag;
		break;
		case	FriendFamilyTable:				
				if(subIndex >= MaxFriendFamilyTableItem)
					return 	TRUE;
				return 	ppsTablePoint->cosTable[index].friendFamilyControl[subIndex].existFlag;
		break;
		case	UssdServiceNumberTable:	
				if(index >= MaxServiceNumberItem)
					return TRUE;						
				return ppsTablePoint->ussdServiceNumber[index].existFlag;					
		break;
		case	UssdServiceKeyTable:	
				if(index >= 10)
					return FALSE;			
				return ppsTablePoint->ussdServiceKey[index].existFlag;					
		break;
		default:
				return TRUE;	
		break;
	}	
	return TRUE;
}

/***********************************************************************/
/************************	prompt resolution	************************/
int pps_getnext_promptResolution(index_t *id)
{	
	return pps_getnext_Index(PromptResolutionTable,id);	
}

int pps_getIdle_promptResolution(index_t *id)
{	
	return pps_getIdle_Index(PromptResolutionTable,id);		
}

int isPromptResolutionIndexBusy(index_t *index)
{
	return isIndexBusy(PromptResolutionTable,index);
}

int pps_get_promptResolution(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	PromptResolution		*promptResolutionItem;
	
	index = instance[0];
	if(isIndexValid(PromptResolutionTable,index) == FALSE)
		return -1;
	if(isIndexBusy(PromptResolutionTable,(index_t *)&index) == FALSE)
		return -1;	
	promptResolutionItem = &ppsParam.ppsTables.promptResolution[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			promptResolutionItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)promptResolutionItem->title);
			memcpy(pdata,promptResolutionItem->title,datalen);
			break;
		case 3:
			*vartype = INTEGER;
			pdata[0] = promptResolutionItem->currencyResolution;
			datalen = 1;
		break;
		case 4:
			*vartype = INTEGER;
			pdata[0] = promptResolutionItem->dataFormat;
			datalen = 1;
		break;
		case 5:
			*vartype = INTEGER;
			pdata[0] = promptResolutionItem->currencySymbolPosition;
			datalen = 1;
		break;		
		case 6:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

extern void ppsSetParameterAutoSaveFlag();
int pps_set_promptResolution(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	PromptResolution		*promptResolutionItem;
	int						index;
			
	index = instance[0];
	if(isIndexValid(PromptResolutionTable,index) == FALSE)
		return -1;	
	promptResolutionItem = &ppsParam.ppsTables.promptResolution[index];	
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isPromptResolutionIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				promptResolutionItem = &ppsParam.ppsTables.promptResolution[index];	
				promptResolutionItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(promptResolutionItem->title,pdata,datalen);
			promptResolutionItem->title[datalen] = 0;
			break;
		case 3:
			promptResolutionItem->currencyResolution = pdata[0];			
		break;			
		case 4:
			promptResolutionItem->dataFormat = pdata[0];
		break;
		case 5:
		 	promptResolutionItem->currencySymbolPosition = pdata[0];
		break;	
		case 6:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(promptResolutionItem,0,sizeof(PromptResolution));			
				promptResolutionItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	prompt resolution	************************/
/***********************************************************************/


/***********************************************************************/
/************************	MnpPrefix	Table 	************************/
int pps_getnext_mnpPrefix(index_t *id)
{	
	return pps_getnext_Index(MnpPrefixTable,id);	
}

int pps_getIdle_mnpPrefix(index_t *id)
{	
	return pps_getIdle_Index(MnpPrefixTable,id);		
}

int isMnpPrefixIndexBusy(index_t *index)
{
	return isIndexBusy(MnpPrefixTable,index);
}

int pps_get_mnpPrefix(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	MnpPrefix				*mnpPrefixItem;
	
	index = instance[0];	
	if(isIndexValid(MnpPrefixTable,index) == FALSE)
		return -1;
	if(isIndexBusy(MnpPrefixTable,(index_t *)&index) == FALSE)
		return -1;
	mnpPrefixItem = &ppsParam.ppsTables.mnpPrefix[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			mnpPrefixItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)mnpPrefixItem->title);
			memcpy(pdata,mnpPrefixItem->title,datalen);
			break;
		case 3:
			datalen = strlen((char *)mnpPrefixItem->prefix);
			memcpy(pdata,mnpPrefixItem->prefix,datalen);
		break;			
		case 4:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_mnpPrefix(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	MnpPrefix				*mnpPrefixItem;
	int						index;
			
	index = instance[0];	
	if(isIndexValid(MnpPrefixTable,index) == FALSE)
		return -1;	
	mnpPrefixItem = &ppsParam.ppsTables.mnpPrefix[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isMnpPrefixIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				mnpPrefixItem = &ppsParam.ppsTables.mnpPrefix[index];
				mnpPrefixItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(mnpPrefixItem->title,pdata,datalen);
			mnpPrefixItem->title[datalen] = 0;
			break;
		case 3:
			memcpy(mnpPrefixItem->prefix,pdata,datalen);
			mnpPrefixItem->prefix[datalen] = 0;
		break;					
		case 4:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(mnpPrefixItem,0,sizeof(MnpPrefix));			
				mnpPrefixItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	MnpPrefix	Table 	************************/
/***********************************************************************/

	
/***********************************************************************/
/************************	SmsSentence	Table 	************************/
static void initPrep()
{
	SmsSentence 			*smsSentenceItem;

	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_AT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"At",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"at",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_TO];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"To",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"to",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FROM];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"From",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"from",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_ON];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"On",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"on",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
}

static void initCMB()
{
	SmsSentence 			*smsSentenceItem;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CMB_PROMPT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Call Me Back Prompt",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Please enter the destination number following this format:number",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CMB_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Call Me Back Notify",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english," ask for your call ",MAX_SMS_LEN);		
       smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CMB_REACH_MAX_LIMIT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Call Me Back Limited",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your call me back request reaches the max allowed times",MAX_SMS_LEN);	
       smsSentenceItem->existFlag = TRUE;
       
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CMB_AD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Call Me Back Advertisement",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);	
	memcpy(smsSentenceItem->english,"Welcome to use Call Me Back",MAX_SMS_LEN);
	smsSentenceItem->existFlag = TRUE;

}

static void initFreeService()
{
	SmsSentence				*smsSentenceItem;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_ACTIVE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Active",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"activate",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_DEACTIVE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Deactive",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"deactivate",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_ENQUIRY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Inquiry",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"enquire",MAX_SMS_LEN);			
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_ACTIVED_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Active Notify",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have activated free SMS",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_DEACTIVED_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Deactive Notify",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have deactivated free SMS",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_ACTIVE_ALREADY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Active State",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your free SMS service is active",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_DEACTIVE_ALREADY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Deactive State",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your free SMS service is inactive",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;


	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_DEACTIVED_EXPIRED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free Service Expired",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your free SMS service is expired,and deactived by system",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SERVICE_VALID_DAYS_LEFT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Valid Days",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english," valid days left:",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;
	
}

static void initTransfer()
{	
	SmsSentence 			*smsSentenceItem;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_TRANSFERED_OUT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Transferd Out",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have transfered out ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_WILL_TRANSFER_OUT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Transfering Out",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You will transfer out ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_TRANSFERED_IN];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Transfered In",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have received ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_SERVICE_NOT_APPLIED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Service Not Applied",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Service is not applied",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_TRANSFER_PROMPT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Transfer Out Prompt",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Please enter follow this format:destination number#amount",MAX_SMS_LEN);	
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FORMAT_ERROR];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Format Error",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Format error",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_INVALID_NUMBER];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Invalid Number",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Invalid number",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_INSUFFICIENT_FEE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Insufficient Fee",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Insufficient fee",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_EXPIRED_ACCOUNT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Expired Account",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your account is expired,please recharge",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_YES_OR_NO];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"SMS_YES_OR_NO",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Press 1 to confirm\nPress 2 to enter again\nPress 0 to cancel\n",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_TRANSFER_SUCCESS];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Transfer Success",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Transfer successfully",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;	
	
}

static void initPoolAccount()
{
	SmsSentence				*smsSentenceItem;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_POOL_CHILD_LOW_FEE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Pool Account",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Child balance is too low,please recharge it on time",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_POOL_ADDED_CHILD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Pool Account",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have added a child number:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_POOL_DELED_CHILD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Pool Account",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have deleted a child number:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_POOL_BEEN_ADDED_CHILD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Pool Account",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have been added as a child number by:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_POOL_BEEN_DELED_CHILD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Pool Account",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your child role have been deleted by:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
}	

static void initUSSD()
{
	SmsSentence				*smsSentenceItem;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_NOT_REGISTER_PREPAID_USER];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Not Prepaid User",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Not registered as Prepaid Customer",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_USSD_MENU];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD MENU",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"1 Inquiry\n2 Recharge\n3 Transfer\n4 callMeBack\n5 TellMeNo \n6 FF Serivce\n0 Exit",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_USSD_ERROR_INPUT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD Error Input",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
//	memcpy(smsSentenceItem->english,"Error input, please select\n1 Inquiry\n2 Recharge\n3 Transfer\n4 callMeBack\n5 TellMeNo \n6 FF Serivce\n0 Exit",MAX_SMS_LEN);		
	memcpy(smsSentenceItem->english,"Invalid input, please select\n1 Inquiry\n2 Recharge\n3 Transfer\n4 TellMeNo \n0 Exit",MAX_SMS_LEN);		

	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_INPUT_PIN];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD Recharge,input PIN",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Please enter validation code",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_INPUT_PIN_AGAIN];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD Recharge,input PIN again",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Error validation code,please check and enter validation code again",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_LOW_BALANCE_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD Low Balance Notify",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your account balance is too low, please top up in time",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_USSD_COMPLETED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD Operation Complete",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your USSD action is completed",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
}


static void initGPRS()
{
	SmsSentence 			*smsSentenceItem;	

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_GPRS_VOLUME_THIS_MONTH];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"GPRS Volume This Month",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"GPRS volume of this month is:",MAX_SMS_LEN); 	
	smsSentenceItem->existFlag = TRUE;

	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_GPRS_VOLUME_CONSUMED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"GPRS Volume",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your consumed GPRS volume is:",MAX_SMS_LEN); 	
	smsSentenceItem->existFlag = TRUE;
	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_GPRS_DURATION];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"GPRS Duration",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Duration is:",MAX_SMS_LEN); 	
	smsSentenceItem->existFlag = TRUE;
	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_GPRS_CHARGED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"GPRS Charged",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Charged:",MAX_SMS_LEN); 	
	smsSentenceItem->existFlag = TRUE;

	
}



static void initSmsSentence()
{
	SmsSentence				*smsSentenceItem;

	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_ACCOUNT_BALANCE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Account Balance",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Account balance is ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
		
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_ACCOUNT_PROMOTION];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Account Promotion",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Account promotion is ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_EXPIRED_ON];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Expiring On",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Expiring on:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_ON];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Recharge On",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Please recharge your account in time",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_LAST_CALL_ON];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Last Call On",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Last Call sent on:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_LAST_RECEIVE_ON];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Last Receive On",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Last Call received on:",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CLEAR_FEE_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Clear Balance Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your account balance is cleared because the expiry date is reached",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;	

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_GPRS_RECHARGE_SUCCESS];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Recharge succeed",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Recharge succeed",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_OVERDRAFT_NOTIFICATION];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Overdraft SMS Notification ",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have applied over-draft,amount is: ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_PROMOTION_NEWS];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Promotion News ",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Promotion News: recharge $$value, will get $$value bonus within $value days.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FREE_SMS_NOTIFICATION];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Free SMS Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"For free SMS serive, Please send 1 to activate, 2 to deactive, 3 to inquery.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

       smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_FAILED_NO_CARD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"SMS recharge failed-no card",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Wrong recharge card password, please check and try again",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_FAILED_CARD_USED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"SMS recharge failed-card used",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"This card is used",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_FAILED_CARD_EXPIRED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"SMS recharge failed-expired",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"This card is expired",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RECHARGE_FAILED_SYS_FAILURE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"SMS recharge failed-sys failure",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"System failure, please try again.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_ACTIVATION_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Acitvation Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Welcome to use XXX mobile system, your name is ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

      smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CAPSMS_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"CAP Plan 0 Notification ",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You are about to change the CAP plan with more preferential tariff",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CAPSMS_1_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"CAP Plan 1 Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You will be charged with tariff 1 ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CAPSMS_2_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"CAP Plan 2 Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You will be charged with tariff 2 ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_CAPGRPS_NOTIFY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"GPRS CAP Plan Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your GPRS service will be charged with new tariff ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_TELL_ME_NUMBER];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Tell Me Number Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your phone number is",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_RENT_CHARGE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Rent Charge Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You were charged for $value, amount USD$$value.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_REG];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F Register Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"F&F activation fee USD$$value, monthly rent  USD$$value, $value free minutes, $value free SMS.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_REG_FAILED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F Register failed Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your registration of F&Family service failed for low balance.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_SERVICE_SUSPEND];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F suspended Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your F&F service plan is suspended for low balance.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_PLAN_EXHAUST];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F plan  exhaust Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your F&F service plan free minutes or free SMS threshold is reached.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_QUERY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F query result",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"$value F&F numbers, $value  free minutes, $value free SMS.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_SERIVCE_REACTIVATE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F reactivate Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have reactivated F&F service. ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

      smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_REMOVE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F remove Notification",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your F&F service has been removed. ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_QUERY_NOT_REGISTERED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F query not register",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have not registered F&F service.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_QUERY_NOT_PLAN];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F query not plan user",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"$value F&F numbers, $value. $value ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;


	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_QUERY_SUSPENDT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F query state suspended",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your F&F service is suspended, please topup your account.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;


	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_QUERY_SUSPEND_REAC];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"F&F query to reactive",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your F&F service is suspended, please press 1 to reactivate the service. ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_FRIEND_FAMILY_QUERY_NO_LIMIT];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"No limitation",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"no limit",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;


	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"%s%d, charge %d with data %s, voice %d (Min), SMS %d, Validity %d",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_SUBSCRIBE_CMD];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans Command",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"BS",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_SUBSCRIBE_PLEASE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans Command Title",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Please send, ",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_SUBSCRIBE_OK];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans OK",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Subscribe ok,",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;
	
	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_SUBSCRIBE_NOK];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans NOK",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Subscribe bundle plan failed for insufficient balance",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_QUERY];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans Query",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"you have: Data %dMB, voice %dMin,  SMS %d, Expiries on %s",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_DATA_WARN];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Data Warn",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have %dMB data left in bundle plan. When plan expires regular data rate applies.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_DATA_USEDUP];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Data Used Up",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your plan data has been used up, regular data rate applies. Text to 555 to check available plans.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_DATA];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"%s%d, charge %d with data %s, Validity %d (Days)",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_QUERY_DATA];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Plans Query",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Remaining data quota is %dMB, expiring on %s. When plan expires regular prepaid data rate applies.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_USSD_MENU1];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"USSD Menu1",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"	1 Inquiry\n2 Recharge\n3 Transfer\n4 callMeBack\n5 TellMeNo \n6 FF Serivce\n0 Exit",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;		


	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_USSD_SUB_CHOICE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle USSD Plans",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"%d %s-%d days for $%d, voice %d Min, SMS %d",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_USSD_DATA];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle USSD Data Plans",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"*555*%d# %s-%d days for $%d",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_NO_REFUND];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle No Refund",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"No Refund",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_USSD_MENU];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "Data Plan USSD Menu");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	sprintf((char *)smsSentenceItem->english,"%s", "1 Check Plan Status\n2 Subscribe Data Plan\n0 Exit");		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_NOT_APPLIED];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "No Bundle Plan");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	sprintf((char *)smsSentenceItem->english,"%s", "You have no plan activated.");		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_USSD_SUB_DATA_CHOICE];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "Bundle Plan Data Choice");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);//
	//sprintf(smsSentenceItem->english,"%s" , "%d %s - %d day(s) for $%d, voice %d Min, SMS %d");
	sprintf((char *)smsSentenceItem->english,"%s" , "%d %s-%d days for $%d");
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_USSD_SUB_MENU];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "Bundle USSD Plan");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	sprintf((char *)smsSentenceItem->english,"%s" , "*555*%d# %s-%d days for $%d, voice %d Min, SMS %d");
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_DATA_WARN_HAS_V];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Data Warn",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"You have %d MB data, %d Min voice, %d SMS left in plan. When plan expires regular rate applies.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_VOICE_USEDUP];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Voice Used Up",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your plan voice has been used up, regular rate applies. Text to 555 to check available plans.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_SMS_USEDUP];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	memcpy(smsSentenceItem->title,"Bundle Sms Used Up",PpsMaxTitleLen);
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	memcpy(smsSentenceItem->english,"Your plan sms has been used up, regular sms rate applies. Text to 555 to check available plans.",MAX_SMS_LEN);		
	smsSentenceItem->existFlag = TRUE;


	smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_USSD_MENU1];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "Bundle Plan USSD Menu");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	sprintf((char *)smsSentenceItem->english,"%s", "1 Check Plan Status\n2 Subscribe Bundle Plan\n0 Exit");		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[SMS_LAST_CALL_INFO-SMS_MAX_ITEM-1];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "Call Event Notification");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	sprintf((char *)smsSentenceItem->english,"%s", "Last Call Cost: AUD $C. Call Duration: $Ds. Your current balance is AUD $B expiring on $E.");		
	smsSentenceItem->existFlag = TRUE;

	smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[SMS_LAST_SMS_INFO-SMS_MAX_ITEM-1];	
	memset(smsSentenceItem->title,0,PpsMaxTitleLen);
	sprintf((char *)smsSentenceItem->title,"%s", "SMS Event Notification");
	memset(smsSentenceItem->english,0,MAX_SMS_LEN);
	sprintf((char *)smsSentenceItem->english,"%s", "Last SMS Cost: AUD $C. Your current balance is AUD $B expiring on $E.");		
	smsSentenceItem->existFlag = TRUE;

	
	initPrep();
	initCMB();
	initFreeService();
	initTransfer();
	initPoolAccount();
	initUSSD();
	initGPRS();
}

static void strReplace(u8 *string,u8 len,u8 oldData,u8 newData)
{
	int i;

	for(i = 0;i < len;i++)
	{
		if(string[i] ==  oldData)
			string[i] = newData;
	}
}

void initSMSTable()
{
	memset(&ppsParam.ppsTables.smsSentence,0,sizeof(SmsSentence)*(MaxSmsSentenceItem+MaxSmsSentenceReservedItem));
	initSmsSentence();
}

u_char *getSmsSentenceNative(u8 languageType,SMS_SENTENCE	org_id)
{
	LANGUAGE_INFO			*languageInfo;
	int id = org_id;
	
	if(org_id>SMS_MAX_ITEM)
	{
		id = org_id-(SMS_MAX_ITEM+1);
		languageInfo = &ppsParam.ppsTables.smsExtSentence[id].language[languageType%MAX_LANGUAGE_TYPES];	
	}
	else
		languageInfo = &ppsParam.ppsTables.smsSentence[id].language[languageType%MAX_LANGUAGE_TYPES];	
		
	switch(id)
	{
		//case SMS_CMB_AD:
			
		//break;
		default:
			if(languageInfo->language[MAX_SMS_LEN] == 0)
			{		      
				if(org_id>SMS_MAX_ITEM)
				{
					ppsParam.ppsTables.smsExtSentence[id].english[MAX_SMS_LEN] = strlen((char *)ppsParam.ppsTables.smsExtSentence[id].english);
					return ppsParam.ppsTables.smsExtSentence[id].english;				
				}
				else
				{
					ppsParam.ppsTables.smsSentence[id].english[MAX_SMS_LEN] = strlen((char *)ppsParam.ppsTables.smsSentence[id].english);
					return ppsParam.ppsTables.smsSentence[id].english;
				}
			}
	 		if(strcasecmp((char *)languageInfo->language,"null") == 0)
			    return ((u_char *)"");
		break;
	}
	return languageInfo->language;
}

int pps_getnext_smsSentence(index_t *id)
{	
	return pps_getnext_Index(SmsSentenceTable,id);	
}

int pps_getIdle_smsSentence(index_t *id)
{	
	return pps_getIdle_Index(SmsSentenceTable,id);		
}

int isSmsSentenceIndexBusy(index_t *index)
{
	return isIndexBusy(SmsSentenceTable,index);
}

int pps_get_smsSentence(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	SmsSentence				*smsSentenceItem;
	
	index = instance[0];	
	if(isIndexValid(SmsSentenceTable,index) == FALSE)
		return -1;
	if(isIndexBusy(SmsSentenceTable,(index_t *)&index) == FALSE)
		return -1;
	if(index>SMS_MAX_ITEM)
	{
		index -= (SMS_MAX_ITEM+1);
		smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[index];
	}
	else
		smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
		break;
		case 2:
			smsSentenceItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)smsSentenceItem->title);
			memcpy(pdata,smsSentenceItem->title,datalen);
		break;
		case 3:
			datalen = strlen((char *)smsSentenceItem->english);		
			memcpy(pdata,smsSentenceItem->english,datalen);
		break;			
		case 4:
			datalen = smsSentenceItem->language[0].language[MAX_SMS_LEN]%MAX_SMS_LEN;
			memcpy(pdata,smsSentenceItem->language[0].language,datalen);
		break;					
		case 5:
			datalen = smsSentenceItem->language[1].language[MAX_SMS_LEN]%MAX_SMS_LEN;
			memcpy(pdata,smsSentenceItem->language[1].language,datalen);
		break;					
		case 6:
			datalen = smsSentenceItem->language[2].language[MAX_SMS_LEN]%MAX_SMS_LEN;
			memcpy(pdata,smsSentenceItem->language[2].language,datalen);
		break;					
		case 7:
			datalen = smsSentenceItem->language[3].language[MAX_SMS_LEN]%MAX_SMS_LEN;
			memcpy(pdata,smsSentenceItem->language[3].language,datalen);
		break;					
		case 8:
			datalen = smsSentenceItem->language[4].language[MAX_SMS_LEN]%MAX_SMS_LEN;
			memcpy(pdata,smsSentenceItem->language[4].language,datalen);
		break;	
		case 9:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	if(column >= 2)
	{
		strReplace(pdata,datalen,'\n','|');
	}
	return datalen;
}

int pps_set_smsSentence(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	SmsSentence				*smsSentenceItem;
	int						index;
			
	index = instance[0];	
	if(isIndexValid(SmsSentenceTable,index) == FALSE)
		return -1;
	if(column >= 2)
	{
		strReplace(pdata,datalen,'|','\n');
	}
	if(index>SMS_MAX_ITEM)
	{
		index -= (SMS_MAX_ITEM+1);
		smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[index];
	}
	else
		smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isSmsSentenceIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
				smsSentenceItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			datalen %= PpsMaxTitleLen;
			memset(smsSentenceItem->title,0,PpsMaxTitleLen);
			memcpy(smsSentenceItem->title,pdata,datalen);
			smsSentenceItem->title[datalen] = 0;
		break;
		case 3:			
			datalen %= MAX_SMS_LEN;
			memset(smsSentenceItem->english,0,MAX_SMS_LEN);
			memcpy(smsSentenceItem->english,pdata,datalen);
			smsSentenceItem->english[datalen] = 0;
			smsSentenceItem->english[MAX_SMS_LEN] = datalen;
		break;		
		case 4:		
			datalen %= MAX_SMS_LEN;
			memset(smsSentenceItem->language[0].language,0,MAX_SMS_LEN);
			memcpy(smsSentenceItem->language[0].language,pdata,datalen);
			smsSentenceItem->language[0].language[MAX_SMS_LEN] = datalen;	
		break;				
		case 5:			
			datalen %= MAX_SMS_LEN;
			memset(smsSentenceItem->language[1].language,0,MAX_SMS_LEN);
			memcpy(smsSentenceItem->language[1].language,pdata,datalen);
			smsSentenceItem->language[1].language[MAX_SMS_LEN] = datalen;	
		break;			
		case 6:			
			datalen %= MAX_SMS_LEN;
			memset(smsSentenceItem->language[2].language,0,MAX_SMS_LEN);
			memcpy(smsSentenceItem->language[2].language,pdata,datalen);
			smsSentenceItem->language[2].language[MAX_SMS_LEN] = datalen;
		break;
		case 7:			
			datalen %= MAX_SMS_LEN;
			memset(smsSentenceItem->language[3].language,0,MAX_SMS_LEN);
			memcpy(smsSentenceItem->language[3].language,pdata,datalen);
			smsSentenceItem->language[3].language[MAX_SMS_LEN] = datalen;	
		break;		
		case 8:			
			datalen %= MAX_SMS_LEN;
			memset(smsSentenceItem->language[4].language,0,MAX_SMS_LEN);
			memcpy(smsSentenceItem->language[4].language,pdata,datalen);
			smsSentenceItem->language[4].language[MAX_SMS_LEN] = datalen;	
		break;	
		case 9:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				return -1;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	SmsSentence	Table 	************************/
/***********************************************************************/




/***********************************************************************/
/************************	ThirdPartyInfo	Table 	********************/
int pps_getnext_thirdPartyInfo(index_t *id)
{	
	return pps_getnext_Index(ThirdPartyInfoTable,id);	
}

int pps_getIdle_thirdPartyInfo(index_t *id)
{	
	return pps_getIdle_Index(ThirdPartyInfoTable,id);		
}

int isThirdPartyInfoIndexBusy(index_t *index)
{
	return isIndexBusy(ThirdPartyInfoTable,index);
}

int pps_get_thirdPartyInfo(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	ThirdPartyInfo			*thirdPartyInfoItem;
	
	index = instance[0];	
	if(isIndexValid(ThirdPartyInfoTable,index) == FALSE)
		return -1;
	if(isIndexBusy(ThirdPartyInfoTable,(index_t *)&index) == FALSE)
		return -1;
	thirdPartyInfoItem = &ppsParam.ppsTables.thirdPartyInfo[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			thirdPartyInfoItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)thirdPartyInfoItem->title);
			memcpy(pdata,thirdPartyInfoItem->title,datalen);
			break;
		case 3:
			datalen = strlen((char *)thirdPartyInfoItem->serviceID);
			memcpy(pdata,thirdPartyInfoItem->serviceID,datalen);
		break;			
		case 4:
			datalen = strlen((char *)thirdPartyInfoItem->servicePassword);
			memcpy(pdata,thirdPartyInfoItem->servicePassword,datalen);
		break;
		case 5:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_thirdPartyInfo(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	ThirdPartyInfo			*thirdPartyInfoItem;
	int						index;
			
	index = instance[0];
	if(isIndexValid(ThirdPartyInfoTable,index) == FALSE)
		return -1;
	thirdPartyInfoItem = &ppsParam.ppsTables.thirdPartyInfo[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isThirdPartyInfoIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				thirdPartyInfoItem = &ppsParam.ppsTables.thirdPartyInfo[index];
				thirdPartyInfoItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(thirdPartyInfoItem->title,pdata,datalen);
			thirdPartyInfoItem->title[datalen] = 0;
			break;
		case 3:
			memcpy(thirdPartyInfoItem->serviceID,pdata,datalen);
			thirdPartyInfoItem->serviceID[datalen] = 0;
		break;			
		case 4:
			memcpy(thirdPartyInfoItem->servicePassword,pdata,datalen);
			thirdPartyInfoItem->servicePassword[datalen] = 0;
		break;				
		case 5:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(thirdPartyInfoItem,0,sizeof(ThirdPartyInfo));			
				thirdPartyInfoItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	ThirdPartyInfo	Table 	************************/
/***********************************************************************/


/***********************************************************************/
/************************	BasicTariffZone	Table 	************************/
int pps_getnext_basicTariffZone(index_t *id)
{	
	return pps_getnext_Index(BasicTariffZoneTable,id);	
}

int pps_getIdle_basicTariffZone(index_t *id)
{	
	return pps_getIdle_Index(BasicTariffZoneTable,id);		
}

int isBasicTariffZoneIndexBusy(index_t *index)
{
	return isIndexBusy(BasicTariffZoneTable,index);
}

int pps_get_basicTariffZone(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 0,index;
	BasicTariffZone				*basicTariffZoneItem;
	
	index = instance[0];	
	if(isIndexValid(BasicTariffZoneTable,index) == FALSE)
		return -1;
	if(isIndexBusy(BasicTariffZoneTable,(index_t *)&index) == FALSE)
		return -1;
	basicTariffZoneItem = &ppsParam.ppsTables.basicTariffZone[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			basicTariffZoneItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)basicTariffZoneItem->title);
			memcpy(pdata,basicTariffZoneItem->title,datalen);
			break;
		case 3:			
			datalen = strlen((char *)basicTariffZoneItem->mcc);			
			memcpy(pdata,basicTariffZoneItem->mcc,datalen);
			pdata[datalen] = 0;
		break;			
		case 4:			
			datalen = strlen((char *)basicTariffZoneItem->mnc);			
			memcpy(pdata,basicTariffZoneItem->mnc,datalen);
			pdata[datalen] = 0;
		break;		
		case 5:
			datalen = PPS_GET_INTEGER(basicTariffZoneItem->lac,pdata,vartype);			
		break;
		case 6:
			datalen = PPS_GET_INTEGER(basicTariffZoneItem->cellId,pdata,vartype);			
		break;
		case 7:			
			datalen = PPS_GET_INTEGER(basicTariffZoneItem->moTariffId,pdata,vartype);	
		break;
		case 8:
			datalen = PPS_GET_INTEGER(basicTariffZoneItem->mtTariffId,pdata,vartype);				
		break;
		case 9:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_basicTariffZone(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	BasicTariffZone			*basicTariffZoneItem;
	int						index;
			
	index = instance[0];	
	if(isIndexValid(BasicTariffZoneTable,index) == FALSE)
		return -1;
	basicTariffZoneItem = &ppsParam.ppsTables.basicTariffZone[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isBasicTariffZoneIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				basicTariffZoneItem = &ppsParam.ppsTables.basicTariffZone[index];
				basicTariffZoneItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(basicTariffZoneItem->title,pdata,datalen);
			basicTariffZoneItem->title[datalen] = 0;			
		break;
		case 3:			
			if(datalen > 3)
				return -1;
			memcpy(basicTariffZoneItem->mcc,pdata,datalen);
			basicTariffZoneItem->mcc[datalen] = 0;
		break;			
		case 4:			
			if(datalen > 3)
				return -1;
			memcpy(basicTariffZoneItem->mnc,pdata,datalen);
			basicTariffZoneItem->mnc[datalen] = 0;
		break;		
		case 5:
			basicTariffZoneItem->lac = PPS_SET_INTEGER(pdata,datalen);							
		break;
		case 6:		
			basicTariffZoneItem->cellId = PPS_SET_INTEGER(pdata,datalen);								
		break;
		case 7:
			basicTariffZoneItem->moTariffId = PPS_SET_INTEGER(pdata,datalen)%MAX_ZONE_NUM;				
		break;
		case 8:
			basicTariffZoneItem->mtTariffId = PPS_SET_INTEGER(pdata,datalen)%MAX_ZONE_NUM;			
		break;
		case 9:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(basicTariffZoneItem,0,sizeof(BasicTariffZone));			
				basicTariffZoneItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	BasicTariffZone	Table 	************************/
/***************************************************************************/


/***********************************************************************/
/************************	IvrSource	Table 	************************/
int pps_getnext_ivrSource(index_t *id)
{	
	return pps_getnext_Index(IvrSourceTable,id);	
}

int pps_getIdle_ivrSource(index_t *id)
{	
	return pps_getIdle_Index(IvrSourceTable,id);		
}

int isIvrSourceIndexBusy(index_t *index)
{
	return isIndexBusy(IvrSourceTable,index);
}

int pps_get_ivrSource(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	IvrSource				*ivrSourceItem;
	
	index = instance[0];	
	if(isIndexValid(IvrSourceTable,index) == FALSE)
		return -1;
	if(isIndexBusy(IvrSourceTable,(index_t *)&index) == FALSE)
		return -1;
	ivrSourceItem = &ppsParam.ppsTables.ivrSource[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
		break;
		case 2:
			ivrSourceItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)ivrSourceItem->title);
			memcpy(pdata,ivrSourceItem->title,datalen);
		break;
		case 3:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = ivrSourceItem->inquiry;
		break;			
		case 4:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = ivrSourceItem->recharge;
		break;
		case 5:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_ivrSource(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	IvrSource				*ivrSourceItem;
	int						index;
		
	index = instance[0];	
	if(isIndexValid(IvrSourceTable,index) == FALSE)
		return -1;	
	ivrSourceItem = &ppsParam.ppsTables.ivrSource[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isIvrSourceIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				ivrSourceItem = &ppsParam.ppsTables.ivrSource[index];
				ivrSourceItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(ivrSourceItem->title,pdata,datalen);
			ivrSourceItem->title[datalen] = 0;
		break;
		case 3:
			ivrSourceItem->inquiry = pdata[0];
		break;			
		case 4:
			ivrSourceItem->recharge = pdata[0];
		break;				
		case 5:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(ivrSourceItem,0,sizeof(IvrSource));			
				ivrSourceItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	IvrSource	Table 	************************/
/***********************************************************************/


/***********************************************************************/
/************************	SrfNumber	Table 	************************/
int pps_getnext_srfNumber(index_t *id)
{	
	return pps_getnext_Index(SrfNumberTable,id);	
}

int pps_getIdle_srfNumber(index_t *id)
{	
	return pps_getIdle_Index(SrfNumberTable,id);		
}

int isSrfNumberIndexBusy(index_t *index)
{
	return isIndexBusy(SrfNumberTable,index);
}

int pps_get_srfNumber(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	SrfNumber				*srfNumberItem;
	
	index = instance[0];	
	if(isIndexValid(SrfNumberTable,index) == FALSE)
		return -1;
	if(isIndexBusy(SrfNumberTable,(index_t *)&index) == FALSE)
		return -1;	
		
	srfNumberItem = &ppsParam.ppsTables.srfNumber[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			srfNumberItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)srfNumberItem->title);
			memcpy(pdata,srfNumberItem->title,datalen);
			break;
		case 3:
			datalen = strlen((char *)srfNumberItem->number);
			memcpy(pdata,srfNumberItem->number,datalen);
		break;			
		case 4:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_srfNumber(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	SrfNumber				*srfNumberItem;
	int						index;
			
	index = instance[0];	
	if(isIndexValid(SrfNumberTable,index) == FALSE)
		return -1;
	srfNumberItem = &ppsParam.ppsTables.srfNumber[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isSrfNumberIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				srfNumberItem = &ppsParam.ppsTables.srfNumber[index];
				srfNumberItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(srfNumberItem->title,pdata,datalen);
			srfNumberItem->title[datalen] = 0;
			break;
		case 3:
			memcpy(srfNumberItem->number,pdata,datalen);
			srfNumberItem->number[datalen] = 0;
		break;					
		case 4:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(srfNumberItem,0,sizeof(SrfNumber));			
				srfNumberItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	SrfNumber	Table 	************************/
/***********************************************************************/


/***********************************************************************/
/************************	ServiceNumber	Table 	************************/
int pps_getnext_ussd_serviceNumber(index_t *id)
{	
	return pps_getnext_Index(UssdServiceNumberTable,id);	
}

int pps_getIdle_ussd_serviceNumber(index_t *id)
{	
	return pps_getIdle_Index(UssdServiceNumberTable,id);		
}

int isUssdServiceNumberIndexBusy(index_t *index)
{
	return isIndexBusy(UssdServiceNumberTable,index);
}

int pps_get_ussd_serviceNumber(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	ServiceNumber			*serviceNumberItem;
	
	index = instance[0];	
	if(isIndexValid(UssdServiceNumberTable,index) == FALSE)
		return -1;
	if(isIndexBusy(UssdServiceNumberTable,(index_t *)&index) == FALSE)
		return -1;
	serviceNumberItem = &ppsParam.ppsTables.ussdServiceNumber[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			serviceNumberItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)serviceNumberItem->title);
			memcpy(pdata,serviceNumberItem->title,datalen);
			break;
		case 3:
			datalen = strlen((char *)serviceNumberItem->number);
			memcpy(pdata,serviceNumberItem->number,datalen);
		break;			
		case 4:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_ussd_serviceNumber(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	ServiceNumber			*serviceNumberItem;
	int						index;
	
	index = instance[0];	
	if(isIndexValid(UssdServiceNumberTable,index) == FALSE)
		return -1;
	serviceNumberItem = &ppsParam.ppsTables.ussdServiceNumber[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isUssdServiceNumberIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				serviceNumberItem = &ppsParam.ppsTables.ussdServiceNumber[index];
				serviceNumberItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;			
			memset(serviceNumberItem->title,0,PpsMaxTitleLen);
			memcpy(serviceNumberItem->title,pdata,datalen);
			break;
		case 3:
			memcpy(serviceNumberItem->number,pdata,datalen);
			serviceNumberItem->number[datalen] = 0;
		break;					
		case 4:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(serviceNumberItem,0,sizeof(ServiceNumber));			
				serviceNumberItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	ServiceNumber	Table 	************************/
/***************************************************************************/

/***********************************************************************/
/************************	ServiceKey	Table 	************************/
int pps_getnext_ussd_serviceKey(index_t *id)
{	
	return pps_getnext_Index(UssdServiceKeyTable,id);	
}

int pps_getIdle_ussd_serviceKey(index_t *id)
{	
	return pps_getIdle_Index(UssdServiceKeyTable,id);		
}

int isUssdServiceKeyIndexBusy(index_t *index)
{
	return isIndexBusy(UssdServiceKeyTable,index);
}

int pps_get_ussd_serviceKey(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 				datalen = 0,index;
	ServiceKey			*serviceKeyItem;
	
	index = instance[0];	
	if(isIndexValid(UssdServiceKeyTable,index) == FALSE)
		return -1;
	if(isIndexBusy(UssdServiceKeyTable,(index_t *)&index) == FALSE)
		return -1;
	serviceKeyItem = &ppsParam.ppsTables.ussdServiceKey[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			serviceKeyItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)serviceKeyItem->title);
			memcpy(pdata,serviceKeyItem->title,datalen);
			break;
		case 3:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = serviceKeyItem->key;
		break;			
		case 4:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_ussd_serviceKey(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	ServiceKey			*serviceKeyItem;
	int						index;
		
	index = instance[0];	
	if(isIndexValid(UssdServiceKeyTable,index) == FALSE)
		return -1;
	serviceKeyItem = &ppsParam.ppsTables.ussdServiceKey[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isUssdServiceKeyIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				serviceKeyItem = &ppsParam.ppsTables.ussdServiceKey[index];
				serviceKeyItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(serviceKeyItem->title,pdata,datalen);
			serviceKeyItem->title[datalen] = 0;
			break;
		case 3:
			serviceKeyItem->key = pdata[0];
		break;					
		case 4:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(serviceKeyItem,0,sizeof(ServiceKey));			
				serviceKeyItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	ServiceKey	Table 	************************/


/************************	ServiceNumber	Table 	************************/
int pps_getnext_serviceNumber(index_t *id)
{	
	return pps_getnext_Index(ServiceNumberTable,id);	
}

int pps_getIdle_serviceNumber(index_t *id)
{	
	return pps_getIdle_Index(ServiceNumberTable,id);		
}

int isServiceNumberIndexBusy(index_t *index)
{
	return isIndexBusy(ServiceNumberTable,index);
}

int pps_get_serviceNumber(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 					datalen = 0,index;
	ServiceNumber			*serviceNumberItem;
	
	index = instance[0];	
	if(isIndexValid(ServiceNumberTable,index) == FALSE)
		return -1;
	if(isIndexBusy(ServiceNumberTable,(index_t *)&index) == FALSE)
		return -1;
	serviceNumberItem = &ppsParam.ppsTables.serviceNumber[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			serviceNumberItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)serviceNumberItem->title);
			memcpy(pdata,serviceNumberItem->title,datalen);
			break;
		case 3:
			datalen = strlen((char *)serviceNumberItem->number);
			memcpy(pdata,serviceNumberItem->number,datalen);
		break;			
		case 4:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_serviceNumber(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	ServiceNumber			*serviceNumberItem;
	int						index;
	
	index = instance[0];	
	if(isIndexValid(ServiceNumberTable,index) == FALSE)
		return -1;
	serviceNumberItem = &ppsParam.ppsTables.serviceNumber[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isServiceNumberIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				serviceNumberItem = &ppsParam.ppsTables.serviceNumber[index];
				serviceNumberItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;			
			memset(serviceNumberItem->title,0,PpsMaxTitleLen);
			memcpy(serviceNumberItem->title,pdata,datalen);
			break;
		case 3:
			memcpy(serviceNumberItem->number,pdata,datalen);
			serviceNumberItem->number[datalen] = 0;
		break;					
		case 4:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(serviceNumberItem,0,sizeof(ServiceNumber));			
				serviceNumberItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	ServiceNumber	Table 	************************/
/***************************************************************************/

/***********************************************************************/
/************************	ServiceKey	Table 	************************/
int pps_getnext_serviceKey(index_t *id)
{	
	return pps_getnext_Index(ServiceKeyTable,id);	
}

int pps_getIdle_serviceKey(index_t *id)
{	
	return pps_getIdle_Index(ServiceKeyTable,id);		
}

int isServiceKeyIndexBusy(index_t *index)
{
	return isIndexBusy(ServiceKeyTable,index);
}

int pps_get_serviceKey(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 				datalen = 0,index;
	ServiceKey			*serviceKeyItem;
	
	index = instance[0];	
	if(isIndexValid(ServiceKeyTable,index) == FALSE)
		return -1;
	if(isIndexBusy(ServiceKeyTable,(index_t *)&index) == FALSE)
		return -1;
	serviceKeyItem = &ppsParam.ppsTables.serviceKey[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			serviceKeyItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)serviceKeyItem->title);
			memcpy(pdata,serviceKeyItem->title,datalen);
			break;
		case 3:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = serviceKeyItem->key;
		break;			
		case 4:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_serviceKey(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	ServiceKey			*serviceKeyItem;
	int						index;
		
	index = instance[0];	
	if(isIndexValid(ServiceKeyTable,index) == FALSE)
		return -1;
	serviceKeyItem = &ppsParam.ppsTables.serviceKey[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isServiceKeyIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				serviceKeyItem = &ppsParam.ppsTables.serviceKey[index];
				serviceKeyItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(serviceKeyItem->title,pdata,datalen);
			serviceKeyItem->title[datalen] = 0;
			break;
		case 3:
			serviceKeyItem->key = pdata[0];
		break;					
		case 4:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(serviceKeyItem,0,sizeof(ServiceKey));			
				serviceKeyItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	ServiceKey	Table 	************************/

/***********************************************************************/

/***********************************************************************/
/************************	VmsUserSegment	Table 	************************/
int pps_getnext_vmsUserSegment(index_t *id)
{	
	return pps_getnext_Index(VmsUserSegmentTable,id);	
}

int pps_getIdle_vmsUserSegment(index_t *id)
{	
	return pps_getIdle_Index(VmsUserSegmentTable,id);		
}

int isVmsUserSegmentIndexBusy(index_t *index)
{
	return isIndexBusy(VmsUserSegmentTable,index);
}

int pps_get_vmsUserSegment(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 0,index;
	VmsUserSegment				*vmsUserSegmentItem;
	
	index = instance[0];	
	if(isIndexValid(VmsUserSegmentTable,index) == FALSE)
		return -1;
	if(isIndexBusy(VmsUserSegmentTable,(index_t *)&index) == FALSE)
		return -1;
	vmsUserSegmentItem = &ppsParam.ppsTables.vmsUserSegment[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			vmsUserSegmentItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)vmsUserSegmentItem->title);
			memcpy(pdata,vmsUserSegmentItem->title,datalen);
			break;
		case 3:
			datalen = strlen((char *)vmsUserSegmentItem->startMsisdn);
			memcpy(pdata,vmsUserSegmentItem->startMsisdn,datalen);
		break;			
		case 4:
			datalen = strlen((char *)vmsUserSegmentItem->endMsisdn);
			memcpy(pdata,vmsUserSegmentItem->endMsisdn,datalen);
		break;		
		case 5:
			datalen = strlen((char *)vmsUserSegmentItem->vmsPLMNserviceNumber);
			memcpy(pdata,vmsUserSegmentItem->vmsPLMNserviceNumber,datalen);			
		break;
		case 6:
			datalen = strlen((char *)vmsUserSegmentItem->vmsPSTNserviceNumber);
			memcpy(pdata,vmsUserSegmentItem->vmsPSTNserviceNumber,datalen);
		break;
		case 7:			
			datalen = strlen((char *)vmsUserSegmentItem->leaveMessageNumber);
			memcpy(pdata,vmsUserSegmentItem->leaveMessageNumber,datalen);
		break;		
		case 8:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_vmsUserSegment(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	VmsUserSegment			*vmsUserSegmentItem;
	int						index;
			
	index = instance[0];	
	if(isIndexValid(VmsUserSegmentTable,index) == FALSE)
		return -1;
	vmsUserSegmentItem = &ppsParam.ppsTables.vmsUserSegment[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isVmsUserSegmentIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				vmsUserSegmentItem = &ppsParam.ppsTables.vmsUserSegment[index];
				vmsUserSegmentItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(vmsUserSegmentItem->title,pdata,datalen);
			vmsUserSegmentItem->title[datalen] = 0;
		break;
		case 3:
			memcpy(vmsUserSegmentItem->startMsisdn,pdata,datalen);
			vmsUserSegmentItem->startMsisdn[datalen] = 0;
		break;			
		case 4:
			memcpy(vmsUserSegmentItem->endMsisdn,pdata,datalen);
			vmsUserSegmentItem->endMsisdn[datalen] = 0;
		break;		
		case 5:
			memcpy(vmsUserSegmentItem->vmsPLMNserviceNumber,pdata,datalen);	
			vmsUserSegmentItem->vmsPLMNserviceNumber[datalen] = 0;		
		break;
		case 6:
			memcpy(vmsUserSegmentItem->vmsPSTNserviceNumber,pdata,datalen);
			vmsUserSegmentItem->vmsPSTNserviceNumber[datalen] = 0;
		break;
		case 7:			
			memcpy(vmsUserSegmentItem->leaveMessageNumber,pdata,datalen);
			vmsUserSegmentItem->leaveMessageNumber[datalen] = 0;
		break;		
		case 8:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(vmsUserSegmentItem,0,sizeof(VmsUserSegment));			
				vmsUserSegmentItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/*************	VmsUserSegment	Table 	************************/

/************************	gsn	Table 	************************/
int pps_getnext_gsn(index_t *id)
{	
	return pps_getnext_Index(RadiusGsnTable,id);	
}

int pps_getIdle_gsn(index_t *id)
{	
	return pps_getIdle_Index(RadiusGsnTable,id);		
}

int isGsnIndexBusy(index_t *index)
{
	return isIndexBusy(RadiusGsnTable,index);
}



int pps_get_gsn(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 								datalen = 1,index;
	PPS_RADIUS_NAS_INFO					*gsnItem;
	
	index = instance[0];	
	if(isIndexValid(RadiusGsnTable,index) == FALSE)
		return -1;
	if(isIndexBusy(RadiusGsnTable,(index_t *)&index) == FALSE)
		return -1;	
		
	gsnItem = &ppsParam.ppsTables.gsn[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			gsnItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)gsnItem->title);
			memcpy(pdata,gsnItem->title,datalen);
			break;
		case 3:
			datalen = PPS_GET_INTEGER(gsnItem->volumeMeterUnit,pdata,vartype);
		break;			
		case 4:
			datalen = PPS_GET_INTEGER(gsnItem->durationMeterUnit,pdata,vartype);
		break;
		case 5:
			pdata[0] = gsnItem->tariffID;
		break;
		case 6:
			*vartype = 0x40;
			memcpy(pdata,&gsnItem->nasInfo.nas_ip,4);			
			datalen = 4; 
		break;
		case 7:
			datalen = strlen((char *)gsnItem->nasInfo.share_key);
			memcpy(pdata,&gsnItem->nasInfo.share_key,datalen);	
		break;
		case 8:
			datalen = strlen((char *)gsnItem->nasInfo.password);
			memcpy(pdata,&gsnItem->nasInfo.password,datalen);	
		break;
		case 9:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_gsn(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	PPS_RADIUS_NAS_INFO					*gsnItem;
	int									index;
			
	index = instance[0];	
	if(isIndexValid(RadiusGsnTable,index) == FALSE)
		return -1;
	gsnItem = &ppsParam.ppsTables.gsn[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isGsnIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				gsnItem = &ppsParam.ppsTables.gsn[index];
				gsnItem->existFlag = TRUE;
				memset(&gsnItem->nasInfo,0,sizeof(RADIUS_NAS_INFORMATION));
				pps_set_nas(index,&gsnItem->nasInfo);
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(gsnItem->title,pdata,datalen);
			gsnItem->title[datalen] = 0;
			break;
		case 3:
			gsnItem->volumeMeterUnit = PPS_SET_INTEGER(pdata,datalen) << 10;
		break;	
		case 4:
			gsnItem->durationMeterUnit = PPS_SET_INTEGER(pdata,datalen) << 10;
		break;
		case 5:
			gsnItem->tariffID = pdata[0];
		break;
		case 6:
			memcpy(&gsnItem->nasInfo.nas_ip,pdata,4);
			pps_set_nas(index,&gsnItem->nasInfo);
		break;
		case 7:
			datalen %= RADIUS_MAX_LEN_OF_SHARE_KEY;
			memcpy(&gsnItem->nasInfo.share_key,pdata,datalen);
			gsnItem->nasInfo.share_key[datalen] = 0;
			pps_set_nas(index,&gsnItem->nasInfo);
		break;
		case 8:
			datalen %= RADIUS_MAX_LEN_OF_PASSWORD;
			memcpy(&gsnItem->nasInfo.password,pdata,datalen);
			gsnItem->nasInfo.password[datalen] = 0;
			pps_set_nas(index,&gsnItem->nasInfo);
		break;
		case 9:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{				
				memset(gsnItem,0,sizeof(PPS_RADIUS_NAS_INFO));			
				gsnItem->existFlag = FALSE;
				pps_del_nas(index);
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	gsn	Table 	************************/


/************************	sgsn	Table 	************************/
int pps_getnext_sgsn(index_t *id)
{	
	return pps_getnext_Index(RadiusSgsnTable,id);	
}

int pps_getIdle_sgsn(index_t *id)
{	
	return pps_getIdle_Index(RadiusSgsnTable,id);		
}

int isSgsnIndexBusy(index_t *index)
{
	return isIndexBusy(RadiusSgsnTable,index);
}

int pps_get_sgsn(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 								datalen = 1,index;
	PPS_RADIUS_SGSN_INFO				*sgsnItem;
	
	index = instance[0];	
	if(isIndexValid(RadiusSgsnTable,index) == FALSE)
		return -1;
	if(isIndexBusy(RadiusSgsnTable,(index_t *)&index) == FALSE)
		return -1;	
		
	sgsnItem = &ppsParam.ppsTables.sgsn[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			sgsnItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)sgsnItem->title);
			memcpy(pdata,sgsnItem->title,datalen);
			break;
		break;
		case 3:
			*vartype = 0x40;
			memcpy(pdata,&sgsnItem->sgsnIP,4);			
			datalen = 4; 
		break;
		case 4:
			*vartype = INTEGER;
			pdata[0] = sgsnItem->cosID;
		break;			
		case 5:
			*vartype = OctetString;
			strcpy((char *)pdata, (char *)sgsnItem->apnName);			
			datalen = strlen((char *)sgsnItem->apnName); 
		break;
		case 6:
			*vartype = INTEGER;
			pdata[0] = sgsnItem->tariffID;
		break;			
		case 7:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_sgsn(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	PPS_RADIUS_SGSN_INFO				*sgsnItem;
	int									index;
			
	index = instance[0];	
	if(isIndexValid(RadiusSgsnTable,index) == FALSE)
		return -1;
	sgsnItem = &ppsParam.ppsTables.sgsn[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isSgsnIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				sgsnItem = &ppsParam.ppsTables.sgsn[index];
				sgsnItem->existFlag = TRUE;		
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(sgsnItem->title,pdata,datalen);
			sgsnItem->title[datalen] = 0;
			break;
		case 3:
			memcpy(&sgsnItem->sgsnIP,pdata,4);
		break;
		case 4:
			sgsnItem->cosID = pdata[0];
		break;				
		case 5:
			memset(sgsnItem->apnName, 0x00, 16);			
			memcpy(&sgsnItem->apnName,pdata, datalen);
		break;
		case 6:
			sgsnItem->tariffID = pdata[0];
		break;				
		case 7:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{				
				memset(sgsnItem,0,sizeof(PPS_RADIUS_SGSN_INFO));			
				sgsnItem->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/************************	sgsn	Table 	************************/

/************************	Begining of BundlePlan Table 	********/
int pps_getnext_bundlePlan(index_t *id)
{	
	return pps_getnext_Index(BundlePlanTable,id);	
}

int pps_getIdle_bundlePlan(index_t *id)
{	
	return pps_getIdle_Index(BundlePlanTable, id);		
}

int isBundlePlanIndexBusy(index_t *index)
{
	return isIndexBusy(BundlePlanTable,index);
}


int pps_get_bundle_plan(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int				datalen = 1,index;
	serviceBundlePlan	*bundlePlan;
	
	index = instance[0];	
	if(isIndexValid(BundlePlanTable,index) == FALSE)
		return -1;
	if(isIndexBusy(BundlePlanTable,(index_t *)&index) == FALSE)
		return -1;	
		
	bundlePlan = &ppsParam.ppsTables.bundlePlans[index];
	*vartype = OctetString;
	switch(column)
	{
		case 1:
			*vartype = INTEGER;
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			bundlePlan->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)bundlePlan->title);
			memcpy(pdata,bundlePlan->title,datalen);
			break;
		break;
		case 3:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->charge, pdata, vartype);
		break;
		case 4:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->data, pdata, vartype);
			break;			
		case 5:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->mo_voice, pdata, vartype);
		break;			
		break;
		case 6:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->mt_voice, pdata, vartype);
		break;			
		break;
		case 7:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->sms, pdata, vartype);
		break;			
		break;	
		case 8:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->validity, pdata, vartype);
		break;			
		break;
		case 9:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->apply_flag, pdata, vartype);
		break;
		case 10:
			*vartype = INTEGER;
			datalen = PPS_GET_INTEGER(bundlePlan->apply_code, pdata, vartype);
		break;
		case 11:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_bundle_plan(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	serviceBundlePlan	*bundlePlan;
	int				index;
			
	index = instance[0];	
	if(isIndexValid(BundlePlanTable,index) == FALSE)
		return -1;
	bundlePlan = &ppsParam.ppsTables.bundlePlans[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isBundlePlanIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				bundlePlan = &ppsParam.ppsTables.bundlePlans[index];
				bundlePlan->existFlag = TRUE;		
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(bundlePlan->title,pdata,datalen);
			bundlePlan->title[datalen] = 0;
			break;
		case 3:
			bundlePlan->charge = PPS_SET_INTEGER(pdata, datalen);
		break;
		case 4:
			bundlePlan->data = PPS_SET_INTEGER(pdata, datalen);
		break;				
		case 5:
			bundlePlan->mo_voice = PPS_SET_INTEGER(pdata, datalen);
		break;
		case 6:
			bundlePlan->mt_voice = PPS_SET_INTEGER(pdata, datalen);
		break;
		case 7:
			bundlePlan->sms = PPS_SET_INTEGER(pdata, datalen);
		break;
		case 8:
			bundlePlan->validity = PPS_SET_INTEGER(pdata, datalen);
		break;
		case 9:
			bundlePlan->apply_flag = PPS_SET_INTEGER(pdata, datalen);
		break;
		case 10:
			bundlePlan->apply_code = PPS_SET_INTEGER(pdata, datalen);
		break;		
		case 11:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{				
				memset(bundlePlan,0,sizeof(serviceBundlePlan));			
				bundlePlan->existFlag = FALSE;
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}

/************************	Begining of BundlePlan Table 	********/

/***************************************************************/
/*************************	COS	Table 	************************/
int pps_getnext_cos(index_t *id)
{	
	return pps_getnext_Index(CosTable,id);	
}

int pps_getIdle_cos(index_t *id)
{	
	return pps_getIdle_Index(CosTable,id);		
}

int isCosIndexBusy(index_t *id)
{
	return isIndexBusy(CosTable,id);
}

int pps_get_cos(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 0,index;
	COSTable					*cosItem;
	
	index = instance[0];	
	if(isIndexValid(CosTable,index) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&index) == FALSE)
		return -1;	
		
	cosItem = &ppsParam.ppsTables.cosTable[index];
	*vartype = INTEGER;
	switch(column)
	{
		case 1:
			datalen = 1;
			pdata[0] = index;
			break;
		case 2:
			*vartype = OctetString;
			cosItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)cosItem->title);
			memcpy(pdata,cosItem->title,datalen);
			break;
		case 3:
			datalen = 1;
			pdata[0] = MaxTariffTableItem;
		break;			
		case 4:
			datalen = 1;
			pdata[0] = MaxServiceControlTableItem;
		break;		
		case 5:
			datalen = 1;
			pdata[0] = MaxAccountValidityTableItem;			
		break;
		case 6:
			datalen = 1;
			pdata[0] = MaxSmsNotificationInquiryTableItem;			
		break;
		case 7:			
			datalen = 1;
			pdata[0] = MaxRechargeCardType;			
		break;		
		case 8:
			datalen = 1;
			pdata[0] = MaxRechargeCardType;
		break;
		case 9:
			datalen = 1;
			pdata[0] = MaxcapPlanTableItem;
		break;
		case 10:
			datalen = 1;
			pdata[0] = MaxPoolAccountTableItem;
		break;
		case 11:
			datalen = 1; 
			pdata[0] = MaxGprsTableItem;
		break;
		case 12:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
			datalen = 1;		
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cos(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	COSTable				*cosItem;
	int						index;
			
	index = instance[0];	
	if(isIndexValid(CosTable,index) == FALSE)
		return -1;
	cosItem = &ppsParam.ppsTables.cosTable[index];
	switch(column)
	{
		case 1:/* create	*/		
			index =  pdata[0];
			if(isCosIndexBusy((index_t *)&index) == TRUE)
				return -1;
			else
			{
				cosItem = &ppsParam.ppsTables.cosTable[index];
				initCosTable(cosItem);
				cosItem->existFlag = TRUE;
				return index;
			}
		break;
		case 2:
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(cosItem->title,pdata,datalen);
			cosItem->title[datalen] = 0;
		break;
		case 3:			
		case 4:			
		case 5:			
		case 6:
		case 7:
		case 8:
		case 9:
		case 10:
			return -1;
		break;
		case 11:
			return -1;
		break;
		case 12:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(cosItem,0,sizeof(COSTable));			
				cosItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break; 
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/*************************	COS	Table 	************************/
/***************************************************************/

/***************************************************************/
/**********************	tariff	Table 	**********************/
int pps_getnext_cosTariff(index_t *id)
{	
	return pps_getnext_Index(TariffTable,id);	
}

int pps_getIdle_cosTariff(index_t *id)
{	
	return pps_getIdle_Index(TariffTable,id);		
}

int isCosTariffIndexBusy(index_t *id)
{
	return isIndexBusy(TariffTable,id);
}

int pps_get_cosTariff(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 1,cosIndex,subIndex;
	CosTariff					*tariffCosItem;	
	promotion_plan_control		*pPromotionControl;
			
						
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(TariffTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(TariffTable,(index_t *)instance) == FALSE)
		return -1;
		
	tariffCosItem = &ppsParam.ppsTables.cosTable[cosIndex].tariff[subIndex];
	pPromotionControl = &tariffCosItem->promotionUseControl;
	*vartype = INTEGER;
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			tariffCosItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)tariffCosItem->title);
			memcpy(pdata,tariffCosItem->title,datalen);
		break;
		case 4:
			pdata[0] = tariffCosItem->moTariffID;
		break;			
		case 5:
			pdata[0] = tariffCosItem->mtTariffID;
		break;		
		case 6:
			pdata[0] = tariffCosItem->chargeBy;			
		break;
		case 7:
			*vartype = OctetString;
			datalen = 8;
			AsciiTime((char *)pdata,tariffCosItem->promotionUseControl.rechargePromotionStartDate);
		break;
		case 8:			
			*vartype = OctetString;
			datalen = 8;
			AsciiTime((char *)pdata,tariffCosItem->promotionUseControl.rechargePromotionEndDate);	
		break;		
		case 9:
			pdata[0] = tariffCosItem->capPlanResetDay;
		break;		
		case 10:
			pdata[0] = pPromotionControl->usedForCall.IDD;
		break;
		case 11:
			pdata[0] = pPromotionControl->usedForCall.NDD;
		break;
		case 12:
			pdata[0] = pPromotionControl->usedForCall.LOCAL;
		break;
		case 13:
			pdata[0] = pPromotionControl->usedForSMS.IDD;
		break;
		case 14:
			pdata[0] = pPromotionControl->usedForSMS.NDD;
		break;
		case 15:
			pdata[0] = pPromotionControl->usedForSMS.LOCAL;
		break;
		case 16:
			pdata[0] = pPromotionControl->usedForGPRS.allowed;
		break;
		case 17:
			pdata[0] = pPromotionControl->transfer.transfer;
		break;		
		case 18:
			pdata[0] = pPromotionControl->transfer.transferPrioriy;
		break;
		case 19:
			pdata[0] = tariffCosItem->promotionUsedForRoDebit;
		break;
		case 20:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosTariff(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	CosTariff					*tariffCosItem;
	int							cosIndex,subIndex;
	promotion_plan_control		*pPromotionControl;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(TariffTable,subIndex) == FALSE)
		return -1;	
		
	tariffCosItem = &ppsParam.ppsTables.cosTable[cosIndex].tariff[subIndex];
	pPromotionControl = &tariffCosItem->promotionUseControl;
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(tariffCosItem->title,pdata,datalen);
			tariffCosItem->title[datalen] = 0;
		break;
		case 4:
			tariffCosItem->moTariffID = pdata[0];
		break;			
		case 5:
			tariffCosItem->mtTariffID = pdata[0];
		break;		
		case 6:
			tariffCosItem->chargeBy = pdata[0];			
		break;
		case 7:
			{
				u_char buf[32] = {0};
				//struct tm tmnow;	
				
				memcpy(buf,pdata,8);
				strcat((char *)buf+8, "000000");												
				tariffCosItem->promotionUseControl.rechargePromotionStartDate = MakeTime(NULL, (char *)buf);					
			}
		break;
		case 8:				
			{							
				u_char buf[32] = {0};
				//struct tm tmnow;	
				
				memcpy(buf,pdata,8);
				strcat((char *)buf+8, "000000");												
				tariffCosItem->promotionUseControl.rechargePromotionEndDate = MakeTime(NULL, (char *)buf);
			}
		break;		
		case 9:
			tariffCosItem->capPlanResetDay = pdata[0];
		break;		
		case 10:
			pPromotionControl->usedForCall.IDD = pdata[0];
		break;
		case 11:
			pPromotionControl->usedForCall.NDD = pdata[0];
		break;
		case 12:
			pPromotionControl->usedForCall.LOCAL = pdata[0];
		break;
		case 13:
			pPromotionControl->usedForSMS.IDD = pdata[0];
		break;
		case 14:
			pPromotionControl->usedForSMS.NDD = pdata[0];
		break;
		case 15:
			pPromotionControl->usedForSMS.LOCAL = pdata[0];
		break;
		case 16:
			pPromotionControl->usedForGPRS.allowed = pdata[0];
		break;
		case 17:
			pPromotionControl->transfer.transfer = pdata[0];
		break;			
		case 18:
			pPromotionControl->transfer.transferPrioriy = pdata[0];
		break;
		case 19:
			tariffCosItem->promotionUsedForRoDebit = pdata[0];
		break;
		case 20:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(tariffCosItem,0,sizeof(CosTariff));			
				tariffCosItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/***********************	tariff	Table 	**********************/
/***************************************************************/


/***************************************************************/
/******************	serviceControl	Table 	******************/
int pps_getnext_cosServiceControl(index_t *id)
{	
	return pps_getnext_Index(ServiceControlTable,id);	
}

int pps_getIdle_cosServiceControl(index_t *id)
{	
	return pps_getIdle_Index(ServiceControlTable,id);		
}

int isCosServiceControlIndexBusy(index_t *id)
{
	return isIndexBusy(ServiceControlTable,id);
}

int pps_get_cosServiceControl(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 1,cosIndex,subIndex;
	CosServiceControl			*serviceControlItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(ServiceControlTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(ServiceControlTable,(index_t *)instance) == FALSE)
		return -1;
		
	serviceControlItem = &ppsParam.ppsTables.cosTable[cosIndex].serviceControl[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			serviceControlItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)serviceControlItem->title);
			memcpy(pdata,serviceControlItem->title,datalen);
		break;
		case 4:
			pdata[0] = serviceControlItem->moThresholdSet;
		break;			
		case 5:
			datalen = PPS_GET_INTEGER(serviceControlItem->moMinimumBalance,pdata,vartype);
		break;		
		case 6:
			pdata[0] = serviceControlItem->mtChargeFlag;			
		break;
		case 7:
			pdata[0] = serviceControlItem->mtBalanceControl;			
		break;
		case 8:			
			datalen = PPS_GET_INTEGER(serviceControlItem->mtBalanceThreshold,pdata,vartype);	
		break;		
		case 9:	
			pdata[0] = serviceControlItem->closeUserGroupService;
		break;
		case 10:
			pdata[0] = serviceControlItem->rechargeViaCreditCard;
		break;
		case 11:
			pdata[0] = serviceControlItem->creditVault;
		break;
		case 12:
			datalen = PPS_GET_INTEGER(serviceControlItem->creditVaultAmount,pdata,vartype);	
		break;
		case 13:
			pdata[0] = serviceControlItem->poolAccountFlag;
		break;
		case 14:
			pdata[0] = serviceControlItem->poolAccountChangeChargeFlag;
		break;
		case 15:
			pdata[0] = serviceControlItem->poolAccountFreeChangeTimes;
		break;		
		case 16:
			pdata[0] = serviceControlItem->relatedCosID;
		break;
		case 17:
			pdata[0] = serviceControlItem->freeSMSActiveDays;
		break;
		case 18:
			pdata[0] = serviceControlItem->freeSMSRentType;
		break;
		case 19:
			pdata[0] = serviceControlItem->callMeBackThreshold;
			//datalen = PPS_GET_INTEGER(serviceControlItem->callMeBackThreshold,pdata,vartype);
		break;  
		case 20:
			pdata[0] = serviceControlItem->callMeBackMaxTimes;
		break;
		case 21:
			pdata[0] = serviceControlItem->mtSMSCharge;
		break;		
		case 22:
			//pdata[0] = serviceControlItem->bundle_data_warning_threashold;
			datalen = PPS_GET_INTEGER(serviceControlItem->bundle_data_warning_threashold*5,pdata,vartype);
		break;
		case 23:
			//pdata[0] = serviceControlItem->bundle_data_warning_threashold_low;
			datalen = PPS_GET_INTEGER(serviceControlItem->bundle_data_warning_threashold_low*5,pdata,vartype);
		break;
		case 24:// Event charging flag
			datalen = PPS_GET_INTEGER(serviceControlItem->event_charging_flag, pdata, vartype);
		break;
		case 25:// Cap or Bundle used in Tariff Table
			datalen = PPS_GET_INTEGER(serviceControlItem->cap_or_bundle_in_tariff, pdata, vartype);
		break;
		case 26:// bundle function control
			datalen = PPS_GET_INTEGER(serviceControlItem->bundle_plan_contorl, pdata, vartype);
		break;
		case 30:/* rowStatus	*/			
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosServiceControl(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosServiceControl			*serviceControlItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(ServiceControlTable,subIndex) == FALSE)
		return -1;	
		
	serviceControlItem = &ppsParam.ppsTables.cosTable[cosIndex].serviceControl[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(serviceControlItem->title,pdata,datalen);
			serviceControlItem->title[datalen] = 0;
		break;
		case 4:
			serviceControlItem->moThresholdSet = pdata[0];
		break;			
		case 5:
			serviceControlItem->moMinimumBalance = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 6:
			serviceControlItem->mtChargeFlag = pdata[0];			
		break;
		case 7:
			serviceControlItem->mtBalanceControl = pdata[0];			
		break;
		case 8:						
			serviceControlItem->mtBalanceThreshold = PPS_SET_INTEGER(pdata,datalen);
		break;			
		case 9:	
			serviceControlItem->closeUserGroupService = pdata[0];
		break;
		case 10:
			serviceControlItem->rechargeViaCreditCard = pdata[0];
		break;
		case 11:
			serviceControlItem->creditVault = pdata[0];
		break;
		case 12:
			serviceControlItem->creditVaultAmount = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 13:
			serviceControlItem->poolAccountFlag = pdata[0];
		break;
		case 14:
			serviceControlItem->poolAccountChangeChargeFlag = pdata[0];
		break;
		case 15:
			serviceControlItem->poolAccountFreeChangeTimes = pdata[0];
		break;			
		case 16:
			serviceControlItem->relatedCosID = pdata[0];
		break;
		case 17:
			serviceControlItem->freeSMSActiveDays = PPS_SET_INTEGER(pdata,datalen); //pdata[0];
		break;
		case 18:
			serviceControlItem->freeSMSRentType = pdata[0];
		break;
		case 19:
			serviceControlItem->callMeBackThreshold = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 20:
			serviceControlItem->callMeBackMaxTimes = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 21:
			serviceControlItem->mtSMSCharge = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 22:
			//serviceControlItem->bundle_data_warning_threashold = pdata[0];
			serviceControlItem->bundle_data_warning_threashold = PPS_SET_INTEGER(pdata,datalen) / 5;
		break;
		case 23:
			//serviceControlItem->bundle_data_warning_threashold_low = pdata[0];
			serviceControlItem->bundle_data_warning_threashold_low = PPS_SET_INTEGER(pdata,datalen) / 5;
		break;
		case 24:// Event Charging flag
			serviceControlItem->event_charging_flag = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 25:// Cap or Bundle used in Tariff Table
			serviceControlItem->cap_or_bundle_in_tariff = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 26:// Bundle control
			serviceControlItem->bundle_plan_contorl = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 30:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(serviceControlItem,0,sizeof(CosServiceControl));			
				serviceControlItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/***********************	serviceControl	Table 	**********************/
/************************************************************************/

/***********************	serviceControl	Table 	**********************/
/************************************************************************/

/***************************************************************/
/******************	accountValidity	Table 	******************/
int pps_getnext_cosAccountValidity(index_t *id)
{	
	return pps_getnext_Index(AccountValidityTable,id);	
}

int pps_getIdle_cosAccountValidity(index_t *id)
{	
	return pps_getIdle_Index(AccountValidityTable,id);		
}

int isCosAccountValidityIndexBusy(index_t *id)
{
	return isIndexBusy(AccountValidityTable,id);
}

int pps_get_cosAccountValidity(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 1,cosIndex,subIndex;
	CosAccountValidity			*accountValidityItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(AccountValidityTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(AccountValidityTable,(index_t *)instance) == FALSE)
		return -1;
		
	accountValidityItem = &ppsParam.ppsTables.cosTable[cosIndex].accountValidity[subIndex];
	*vartype = INTEGER;
		
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			accountValidityItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)accountValidityItem->title);
			memcpy(pdata,accountValidityItem->title,datalen);
		break;
		case 4:
			datalen = PPS_GET_INTEGER(accountValidityItem->maxAccountValidityDays,pdata,vartype);
		break;			
		case 5:
			pdata[0] = accountValidityItem->actionWhenAccountExpires;
		break;		
		case 6:
			datalen = PPS_GET_INTEGER(accountValidityItem->daysKeepingAnExpiredAccount,pdata,vartype);
		break;
		case 7:
			pdata[0] = accountValidityItem->actionAfterDaysKeepingAnExpiredAccount;			
		break;
		case 8:
			pdata[0] = accountValidityItem->actionAfterRecharge;			
		break;			
		case 9:
			pdata[0] = accountValidityItem->actionAfterBalanceDepleted;
		break;		
		case 10:
			pdata[0] = accountValidityItem->validDaysChangeTo;
		break;
		case 11:
			pdata[0] = accountValidityItem->activiationByInquiryIs;			
		break;
		case 12:	
			datalen = PPS_GET_INTEGER(accountValidityItem->validiDaysActivatedByInquiringAccountWithZeroBalance,pdata,vartype);
		break;
		case 13:
			pdata[0] = accountValidityItem->actionWhenMOorMTExpired;
		break;
		case 14:
			pdata[0] = accountValidityItem->bundlePlanIDWhenActivated;
		break;
		case 20:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosAccountValidity(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosAccountValidity			*accountValidityItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(AccountValidityTable,subIndex) == FALSE)
		return -1;	
		
	accountValidityItem = &ppsParam.ppsTables.cosTable[cosIndex].accountValidity[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(accountValidityItem->title,pdata,datalen);
			accountValidityItem->title[datalen] = 0;
		break;
		case 4:
			accountValidityItem->maxAccountValidityDays = PPS_SET_INTEGER(pdata,datalen);
		break;			
		case 5:
			accountValidityItem->actionWhenAccountExpires = pdata[0];
		break;		
		case 6:
			accountValidityItem->daysKeepingAnExpiredAccount = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 7:
			accountValidityItem->actionAfterDaysKeepingAnExpiredAccount = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 8:
			accountValidityItem->actionAfterRecharge = pdata[0];			
		break;			
		case 9:
			accountValidityItem->actionAfterBalanceDepleted = pdata[0];			
		break;		
		case 10:
			accountValidityItem->validDaysChangeTo = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 11:
			accountValidityItem->activiationByInquiryIs = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 12:	
			accountValidityItem->validiDaysActivatedByInquiringAccountWithZeroBalance = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 13:
			accountValidityItem->actionWhenMOorMTExpired = pdata[0];
		break;
		case 14:
			accountValidityItem->bundlePlanIDWhenActivated = pdata[0];
		break;
		case 20:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(accountValidityItem,0,sizeof(CosAccountValidity));			
				accountValidityItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/***********************	accountValidity	Table 	**********************/
/************************************************************************/

/******************	FriendFamilyControl Table 	******************/
int pps_getnext_cos_friend_family(index_t *id)
{	
	return pps_getnext_Index(FriendFamilyTable,id);	
}

int pps_getIdle_cos_friend_family(index_t *id)
{	
	return pps_getIdle_Index(FriendFamilyTable,id);		
}

int isCosFriendFamilyIndexBusy(index_t *id)
{
	return isIndexBusy(FriendFamilyTable,id);
}

int pps_get_cos_friend_family(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 						datalen = 1,cosIndex,subIndex;
	CosFriendFamilyControl			*friendFamilyControl;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(FriendFamilyTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(FriendFamilyTable,(index_t *)instance) == FALSE)
		return -1;
		
	friendFamilyControl = &ppsParam.ppsTables.cosTable[cosIndex].friendFamilyControl[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			friendFamilyControl->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)friendFamilyControl->title);
			memcpy(pdata,friendFamilyControl->title,datalen);
		break;
		case 4:
			pdata[0] = friendFamilyControl->friendFamilyFlag;
		break;			
		case 5:
			pdata[0] = friendFamilyControl->friendFamilyChangeChargeFlag;
		break;
		case 6:
			pdata[0] = friendFamilyControl->friendFamilyFreeChangeTimes;
		break;
		case 7:
			pdata[0] = friendFamilyControl->friendFamilyNumberTypeLocal;
		break;
		case 8:
			pdata[0] = friendFamilyControl->friendFamilyNumberTypeNDD;
		break;
		case 9:
			pdata[0] = friendFamilyControl->friendFamilyNumberTypeIDD;
		break;
		case 10:
			datalen = PPS_GET_INTEGER(friendFamilyControl->balanceThresholdForFriendFamilyCall,pdata,vartype);
		break;
		case 11:
			pdata[0] = friendFamilyControl->keepOrRemoveFriendFamilyNumber;
		break;
		case 12:			
			datalen = PPS_GET_INTEGER(friendFamilyControl->balanceThresholdToKeepFriendFamilyNumber,pdata,vartype);	
		break;		
		case 13:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[0].rentCharge,pdata,vartype);
		break;	
		case 14:
			pdata[0] = friendFamilyControl->friendFamilyPlan[0].maxNumbers;
		break;
		case 15:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[0].freeCallDuration,pdata,vartype);
		break;	
		case 16:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[0].freeSMS,pdata,vartype);
		break;
		case 17:
			pdata[0] = friendFamilyControl->friendFamilyPlan[0].rentID;
		break;
	       case 18:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[1].rentCharge,pdata,vartype);
		break;
		case 19:
			pdata[0] = friendFamilyControl->friendFamilyPlan[1].maxNumbers;
		break;
		case 20:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[1].freeCallDuration,pdata,vartype);
		break;	
		case 21:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[1].freeSMS,pdata,vartype);
		break;
		case 22:
			pdata[0] = friendFamilyControl->friendFamilyPlan[1].rentID;
		break;		
		case 23:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[2].rentCharge,pdata,vartype);
		break;
		case 24:
			pdata[0] = friendFamilyControl->friendFamilyPlan[2].maxNumbers;
		break;		
		case 25:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[2].freeCallDuration,pdata,vartype);
		break;	
		case 26:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[2].freeSMS,pdata,vartype);
		break;
		case 27:
			pdata[0] = friendFamilyControl->friendFamilyPlan[2].rentID;
		break;		
		case 28:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[3].rentCharge,pdata,vartype);
		break;
		case 29:
			pdata[0] = friendFamilyControl->friendFamilyPlan[3].maxNumbers;
		break;		
		case 30:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[3].freeCallDuration,pdata,vartype);
		break;	
		case 31:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[3].freeSMS,pdata,vartype);
		break;
		case 32:
			pdata[0] = friendFamilyControl->friendFamilyPlan[3].rentID;
		break;		
		case 33:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[4].rentCharge,pdata,vartype);
		break;
		case 34:
			pdata[0] = friendFamilyControl->friendFamilyPlan[4].maxNumbers;
		break;
		case 35:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[4].freeCallDuration,pdata,vartype);
		break;	
		case 36:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[4].freeSMS,pdata,vartype);
		break;
		case 37:
			pdata[0] = friendFamilyControl->friendFamilyPlan[4].rentID;
		break;		
		case 38:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[5].rentCharge,pdata,vartype);
		break;
		case 39:
			pdata[0] = friendFamilyControl->friendFamilyPlan[5].maxNumbers;
		break;
		case 40:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[5].freeCallDuration,pdata,vartype);
		break;	
		case 41:
			datalen = PPS_GET_INTEGER(friendFamilyControl->friendFamilyPlan[5].freeSMS,pdata,vartype);
		break;
		case 42:
			pdata[0] = friendFamilyControl->friendFamilyPlan[5].rentID;
		break;		
		case 43:/* rowStatus	*/			
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cos_friend_family(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosFriendFamilyControl		*friendFamilyControl;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(FriendFamilyTable,subIndex) == FALSE)
		return -1;	
		
	friendFamilyControl = &ppsParam.ppsTables.cosTable[cosIndex].friendFamilyControl[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(friendFamilyControl->title,pdata,datalen);
			friendFamilyControl->title[datalen] = 0;
		break;
		case 4:
			friendFamilyControl->friendFamilyFlag = pdata[0];
		break;
		case 5:
			friendFamilyControl->friendFamilyChangeChargeFlag = pdata[0];
		break;
		case 6:
			friendFamilyControl->friendFamilyFreeChangeTimes = pdata[0];
		break;
		case 7:
			friendFamilyControl->friendFamilyNumberTypeLocal= pdata[0];
		break;
		case 8:
			friendFamilyControl->friendFamilyNumberTypeNDD= pdata[0];
		break;
		case 9:
			friendFamilyControl->friendFamilyNumberTypeIDD= pdata[0];
		break;
		case 10:
			friendFamilyControl->balanceThresholdForFriendFamilyCall = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 11:
			friendFamilyControl->keepOrRemoveFriendFamilyNumber = pdata[0];
		break;
		case 12:
			friendFamilyControl->balanceThresholdToKeepFriendFamilyNumber = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 13:
			friendFamilyControl->friendFamilyPlan[0].rentCharge = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 14:
			friendFamilyControl->friendFamilyPlan[0].maxNumbers = pdata[0];
		break;
		case 15:
			friendFamilyControl->friendFamilyPlan[0].freeCallDuration= PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 16:
			friendFamilyControl->friendFamilyPlan[0].freeSMS= PPS_SET_INTEGER(pdata,datalen);
		break;
		case 17:
			friendFamilyControl->friendFamilyPlan[0].rentID = pdata[0];
		break;
		case 18:
			friendFamilyControl->friendFamilyPlan[1].rentCharge = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 19:
			friendFamilyControl->friendFamilyPlan[1].maxNumbers = pdata[0];
		break;		
		case 20:
			friendFamilyControl->friendFamilyPlan[1].freeCallDuration = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 21:
			friendFamilyControl->friendFamilyPlan[1].freeSMS= PPS_SET_INTEGER(pdata,datalen);
		break;
		case 22:
			friendFamilyControl->friendFamilyPlan[1].rentID = pdata[0];
		break;
		case 23:
			friendFamilyControl->friendFamilyPlan[2].rentCharge = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 24:
			friendFamilyControl->friendFamilyPlan[2].maxNumbers = pdata[0];
		break;		
		case 25:
			friendFamilyControl->friendFamilyPlan[2].freeCallDuration = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 26:
			friendFamilyControl->friendFamilyPlan[2].freeSMS= PPS_SET_INTEGER(pdata,datalen);
		break;
		case 27:
			friendFamilyControl->friendFamilyPlan[2].rentID = pdata[0];
		break;		
		case 28:
			friendFamilyControl->friendFamilyPlan[3].rentCharge = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 29:
			friendFamilyControl->friendFamilyPlan[3].maxNumbers = pdata[0];
		break;		
		case 30:
			friendFamilyControl->friendFamilyPlan[3].freeCallDuration = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 31:
			friendFamilyControl->friendFamilyPlan[3].freeSMS= PPS_SET_INTEGER(pdata,datalen);
		break;
		case 32:
			friendFamilyControl->friendFamilyPlan[3].rentID = pdata[0];
		break;		
		case 33:
			friendFamilyControl->friendFamilyPlan[4].rentCharge = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 34:
			friendFamilyControl->friendFamilyPlan[4].maxNumbers = pdata[0];
		break;		
		case 35:
			friendFamilyControl->friendFamilyPlan[4].freeCallDuration = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 36:
			friendFamilyControl->friendFamilyPlan[4].freeSMS= PPS_SET_INTEGER(pdata,datalen);
		break;
		case 37:
			friendFamilyControl->friendFamilyPlan[4].rentID = pdata[0];
		break;		
		case 38:
			friendFamilyControl->friendFamilyPlan[5].rentCharge = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 39:
			friendFamilyControl->friendFamilyPlan[5].maxNumbers = pdata[0];
		break;		
		case 40:
			friendFamilyControl->friendFamilyPlan[5].freeCallDuration = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 41:
			friendFamilyControl->friendFamilyPlan[5].freeSMS= PPS_SET_INTEGER(pdata,datalen);
		break;
		case 42:
			friendFamilyControl->friendFamilyPlan[5].rentID = pdata[0];
		break;
		
		case 43:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(friendFamilyControl,0,sizeof(CosFriendFamilyControl));			
				friendFamilyControl->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/******************  FriendFamilyControlTable ******************/

/***************************************************************/
/******************	smsNotification	Table 	******************/
int pps_getnext_cosSmsNotification(index_t *id)
{	
	return pps_getnext_Index(SmsNotificationInquiryTable,id);	
}

int pps_getIdle_cosSmsNotification(index_t *id)
{	
	return pps_getIdle_Index(SmsNotificationInquiryTable,id);		
}

int isCosSmsNotificationIndexBusy(index_t *id)
{
	return isIndexBusy(SmsNotificationInquiryTable,id);
}

int pps_get_cosSmsNotification(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 								datalen = 1,cosIndex,subIndex;
	CosSmsNotificationInquiry			*smsNotificationItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(SmsNotificationInquiryTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(SmsNotificationInquiryTable,(index_t *)instance) == FALSE)
		return -1;
		
	smsNotificationItem = &ppsParam.ppsTables.cosTable[cosIndex].smsNotificationInquiry[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			smsNotificationItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)smsNotificationItem->title);
			memcpy(pdata,smsNotificationItem->title,datalen);
		break;
		case 4:
			pdata[0] = smsNotificationItem->smsNotificationWhenRecharge;
		break;			
		case 5:
			pdata[0] = smsNotificationItem->smsNotificationWhenInquiry;
		break;		
		case 6:
			pdata[0] = smsNotificationItem->smsNotificationWhenExpired;
		break;
		case 7:
			pdata[0] = smsNotificationItem->theDaysSendingSMSBeforeExpiredDay;			
		break;
		case 8:
			pdata[0] = smsNotificationItem->smsNotificationWhenBalanceInsufficient;			
		break;			
		case 9:
			datalen = PPS_GET_INTEGER(smsNotificationItem->insufficientBalanceThreshold,pdata,vartype);
		break;		
		case 10:
			pdata[0] = smsNotificationItem->chargeWhenInquiryBySMS;
		break;
		case 11:
			pdata[0] = smsNotificationItem->freeInquiryPerDay;			
		break;	
		case 12:
			pdata[0] = smsNotificationItem->smsNotificationWhenCleanBalance; //2010-03-08			
		break;	
		case 13:
			pdata[0] = smsNotificationItem->smsNotificationWhenCapPlanChanged; //2010-03-08			
		break;	
		case 14:
			pdata[0] = smsNotificationItem->smsNotificationWhenApplyOverdraft; //2010-03-08		
		break;
		case 15:
			pdata[0] = smsNotificationItem->smsNotificationWhenRentCharge;
		break;
		case 16:
			pdata[0] = smsNotificationItem->smsNotificationWhenFriendFamilyServiceReg;
		break;
		case 17:
			pdata[0] = smsNotificationItem->smsNotificationWhenFriendFamilyServiceSuspend;
		break;
		case 18:
			pdata[0] = smsNotificationItem->smsNotificationWhenFriendFamilyPlanExhaust;
		break;
		case 19:
			pdata[0] = smsNotificationItem->smsNotificationWhenFriendFamilyServiceRemoved;
		break;
		case 20:/* rowStatus	*/  //2010-03-08
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosSmsNotification(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosSmsNotificationInquiry	*smsNotificationItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(SmsNotificationInquiryTable,subIndex) == FALSE)
		return -1;	
		
	smsNotificationItem = &ppsParam.ppsTables.cosTable[cosIndex].smsNotificationInquiry[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(smsNotificationItem->title,pdata,datalen);
			smsNotificationItem->title[datalen] = 0;
		break;
		case 4:
			smsNotificationItem->smsNotificationWhenRecharge = pdata[0];
		break;			
		case 5:
			smsNotificationItem->smsNotificationWhenInquiry = pdata[0];
		break;		
		case 6:
			smsNotificationItem->smsNotificationWhenExpired = pdata[0];
		break;
		case 7:
			smsNotificationItem->theDaysSendingSMSBeforeExpiredDay = pdata[0];			
		break;
		case 8:
			smsNotificationItem->smsNotificationWhenBalanceInsufficient = pdata[0];			
		break;			
		case 9:
			smsNotificationItem->insufficientBalanceThreshold = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 10:
			smsNotificationItem->chargeWhenInquiryBySMS = pdata[0];
		break;
		case 11:
			smsNotificationItem->freeInquiryPerDay = pdata[0];			
		break;		
		case 12:
			smsNotificationItem->smsNotificationWhenCleanBalance = pdata[0];
		break;
		case 13:
			smsNotificationItem->smsNotificationWhenCapPlanChanged = pdata[0];
		break;	
		case 14:
			smsNotificationItem->smsNotificationWhenApplyOverdraft = pdata[0];
		break;
		case 15:
			smsNotificationItem->smsNotificationWhenRentCharge = pdata[0];
		break;
		case 16:
			smsNotificationItem->smsNotificationWhenFriendFamilyServiceReg = pdata[0];
		break;
		case 17:
			smsNotificationItem->smsNotificationWhenFriendFamilyServiceSuspend = pdata[0];
		break;
		case 18:
			smsNotificationItem->smsNotificationWhenFriendFamilyPlanExhaust = pdata[0];
		break;
		case 19:
			smsNotificationItem->smsNotificationWhenFriendFamilyServiceRemoved = pdata[0];
		break;
		case 20:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(smsNotificationItem,0,sizeof(CosSmsNotificationInquiry));			
				smsNotificationItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/***********************	smsNotification	Table 	**********************/
/************************************************************************/



/***************************************************************/
/******************	rechargeCardValidity	Table 	******************/
int pps_getnext_cosRechargeCardValidity(index_t *id)
{	
	return pps_getnext_Index(RechargeCardValidityTable,id);	
}

int pps_getIdle_cosRechargeCardValidity(index_t *id)
{	
	return pps_getIdle_Index(RechargeCardValidityTable,id);		
}

int isCosRechargeCardValidityIndexBusy(index_t *id)
{
	return isIndexBusy(RechargeCardValidityTable,id);
}

int pps_get_cosRechargeCardValidity(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 							datalen = 1,cosIndex,subIndex;
	CosRechargeCardValidity			*rechargeCardValidityItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(RechargeCardValidityTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(RechargeCardValidityTable,(index_t *)instance) == FALSE)
		return -1;
		
	rechargeCardValidityItem = &ppsParam.ppsTables.cosTable[cosIndex].rechargeCardValidity[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			rechargeCardValidityItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)rechargeCardValidityItem->title);
			memcpy(pdata,rechargeCardValidityItem->title,datalen);
		break;
		case 4:
			datalen = PPS_GET_INTEGER(rechargeCardValidityItem->cardCredit,pdata,vartype);
		break;			
		case 5:
			datalen = PPS_GET_INTEGER(rechargeCardValidityItem->moValidity,pdata,vartype);
		break;		
		case 6:
			datalen = PPS_GET_INTEGER(rechargeCardValidityItem->mtValidity,pdata,vartype);
		break;		
		case 7:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosRechargeCardValidity(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosRechargeCardValidity		*rechargeCardValidityItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(RechargeCardValidityTable,subIndex) == FALSE)
		return -1;	
		
	rechargeCardValidityItem = &ppsParam.ppsTables.cosTable[cosIndex].rechargeCardValidity[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(rechargeCardValidityItem->title,pdata,datalen);
			rechargeCardValidityItem->title[datalen] = 0;
		break;
		case 4:
			rechargeCardValidityItem->cardCredit = PPS_SET_INTEGER(pdata,datalen);
		break;			
		case 5:
			rechargeCardValidityItem->moValidity = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 6:
			rechargeCardValidityItem->mtValidity = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 7:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(rechargeCardValidityItem,0,sizeof(CosRechargeCardValidity));			
				rechargeCardValidityItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/*********************	rechargeCardValidity	Table 	*********************/
/************************************************************************/


/****************************************************************/
/******************	rechargePromotion	Table 	******************/
int pps_getnext_cosRechargePromotion(index_t *id)
{	
	return pps_getnext_Index(RechargePromotionTable,id);	
}

int pps_getIdle_cosRechargePromotion(index_t *id)
{	
	return pps_getIdle_Index(RechargePromotionTable,id);		
}

int isCosRechargePromotionIndexBusy(index_t *id)
{
	return isIndexBusy(RechargePromotionTable,id);
}

int pps_get_cosRechargePromotion(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 							datalen = 1,cosIndex,subIndex;
	CosRechargePromotion			*rechargePromotionItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(RechargePromotionTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(RechargePromotionTable,(index_t *)instance) == FALSE)
		return -1;
		
	rechargePromotionItem = &ppsParam.ppsTables.cosTable[cosIndex].rechargePromotion[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			rechargePromotionItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)rechargePromotionItem->title);
			memcpy(pdata,rechargePromotionItem->title,datalen);
		break;
		case 4:
			datalen = PPS_GET_INTEGER(rechargePromotionItem->rechargeCardCredit,pdata,vartype);
		break;			
		case 5:
			datalen = PPS_GET_INTEGER(rechargePromotionItem->promotionBonus,pdata,vartype);
		break;		
		case 6:
			datalen = PPS_GET_INTEGER(rechargePromotionItem->promotionValidity,pdata,vartype);
		break;		
		case 7:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosRechargePromotion(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosRechargePromotion		*rechargePromotionItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(RechargePromotionTable,subIndex) == FALSE)
		return -1;	
		
	rechargePromotionItem = &ppsParam.ppsTables.cosTable[cosIndex].rechargePromotion[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(rechargePromotionItem->title,pdata,datalen);
			rechargePromotionItem->title[datalen] = 0;
		break;
		case 4:
			rechargePromotionItem->rechargeCardCredit = PPS_SET_INTEGER(pdata,datalen);
		break;			
		case 5:
			rechargePromotionItem->promotionBonus = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 6:
			rechargePromotionItem->promotionValidity = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 7:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(rechargePromotionItem,0,sizeof(CosRechargePromotion));			
				rechargePromotionItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/*********************	rechargePromotion	Table 	*********************/
/************************************************************************/



/****************************************************************/
/******************	capPlan	Table 	******************/
int pps_getnext_cosCapPlan(index_t *id)
{	
	return pps_getnext_Index(CapPlanTable,id);	
}

int pps_getIdle_cosCapPlan(index_t *id)
{	
	return pps_getIdle_Index(CapPlanTable,id);		
}

int isCosCapPlanIndexBusy(index_t *id)
{
	return isIndexBusy(CapPlanTable,id);
}

int pps_get_cosCapPlan(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 							datalen = 1,cosIndex,subIndex;
	CosCapPlan						*capPlanItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(CapPlanTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(CapPlanTable,(index_t *)instance) == FALSE)
		return -1;
		
	capPlanItem = &ppsParam.ppsTables.cosTable[cosIndex].capPlan[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			capPlanItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)capPlanItem->title);
			memcpy(pdata,capPlanItem->title,datalen);
		break;
		case 4:
			pdata[0] = capPlanItem->flag;
		break;
		case 5:
			pdata[0] = capPlanItem->type;
		break;
		case 6:
			datalen = PPS_GET_INTEGER(capPlanItem->threshold0,pdata,vartype);
		break;			
		case 7:
			datalen = PPS_GET_INTEGER(capPlanItem->threshold1,pdata,vartype);
		break;		
		case 8:
			datalen = PPS_GET_INTEGER(capPlanItem->threshold2,pdata,vartype);
		break;		
		case 9:
			pdata[0] = capPlanItem->tariffID0;
		break;
		case 10:
			pdata[0] = capPlanItem->tariffID1;
		break;
		case 11:
			pdata[0] = capPlanItem->tariffID2;
		break;
		case 12:
			pdata[0] = capPlanItem->tariffID3;
		break;	
		case 13:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosCapPlan(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	CosCapPlan					*capPlanItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(CapPlanTable,subIndex) == FALSE)
		return -1;	
		
	capPlanItem = &ppsParam.ppsTables.cosTable[cosIndex].capPlan[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(capPlanItem->title,pdata,datalen);
			capPlanItem->title[datalen] = 0;
		break;
		case 4:
			capPlanItem->flag = pdata[0];
		break;
		case 5:
			capPlanItem->type = pdata[0];
		break;
		case 6:
			capPlanItem->threshold0 = PPS_SET_INTEGER(pdata,datalen);
		break;			
		case 7:
			capPlanItem->threshold1 = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 8:
			capPlanItem->threshold2 = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 9:
			capPlanItem->tariffID0 = pdata[0];
		break;
		case 10:
			capPlanItem->tariffID1 = pdata[0];
		break;
		case 11:
			capPlanItem->tariffID2 = pdata[0];
		break;
		case 12:
			capPlanItem->tariffID3 = pdata[0];
		break;	
		case 13:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(capPlanItem,0,sizeof(CosCapPlan));			
				capPlanItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/*********************	capPlan	Table 	*********************/


/******************	poolAccount	Table 	******************/
int pps_getnext_cosPoolAccount(index_t *id)
{	
	return pps_getnext_Index(PoolAccountTable,id);	
}

int pps_getIdle_cosPoolAccount(index_t *id)
{	
	return pps_getIdle_Index(PoolAccountTable,id);		
}

int isCosPoolAccountIndexBusy(index_t *id)
{
	return isIndexBusy(PoolAccountTable,id);
}

int pps_get_cosPoolAccount(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 							datalen = 1,cosIndex,subIndex;
	COS_Pool_Account				*poolAccountItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(PoolAccountTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(PoolAccountTable,(index_t *)instance) == FALSE)
		return -1;
		
	poolAccountItem = &ppsParam.ppsTables.cosTable[cosIndex].poolAccount[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			poolAccountItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)poolAccountItem->title);
			memcpy(pdata,poolAccountItem->title,datalen);
		break;
		case 4:
			pdata[0] = poolAccountItem->role;
		break;
		case 5:
			pdata[0] = poolAccountItem->roleParty.parent.cosIDForChild[0];
		break;
		case 6:
			pdata[0] = poolAccountItem->roleParty.parent.cosIDForChild[1];
		break;					
		case 7:
			pdata[0] = poolAccountItem->roleParty.child.isRechargeAllowed;
		break;		
		case 8:
			pdata[0] = poolAccountItem->roleParty.child.isTransferAllowed;
		break;		
		case 9:
			pdata[0] = poolAccountItem->roleParty.child.periodicTransferOrAutoByParent;
		break;
		case 10:
			datalen = PPS_GET_INTEGER(poolAccountItem->roleParty.child.maxCallsPerDay,pdata,vartype);
		break;
		case 11:
			datalen = PPS_GET_INTEGER(poolAccountItem->roleParty.child.maxSMSPerDay,pdata,vartype);
		break;
		case 12:
			datalen = PPS_GET_INTEGER(poolAccountItem->roleParty.child.maxFeePerDay,pdata,vartype);
		break;	
		case 13:/* rowStatus	*/
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}

int pps_set_cosPoolAccount(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	COS_Pool_Account			*poolAccountItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(PoolAccountTable,subIndex) == FALSE)
		return -1;	
		
	poolAccountItem = &ppsParam.ppsTables.cosTable[cosIndex].poolAccount[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(poolAccountItem->title,pdata,datalen);
			poolAccountItem->title[datalen] = 0;
		break;
		case 4:
			 poolAccountItem->role = pdata[0];
		break;
		case 5:
			poolAccountItem->roleParty.parent.cosIDForChild[0] = pdata[0];
		break;
		case 6:
			poolAccountItem->roleParty.parent.cosIDForChild[1] = pdata[0];
		break;			
		case 7:
			poolAccountItem->roleParty.child.isRechargeAllowed = pdata[0];
		break;		
		case 8:
			poolAccountItem->roleParty.child.isTransferAllowed = pdata[0];
		break;		
		case 9:
			poolAccountItem->roleParty.child.periodicTransferOrAutoByParent = pdata[0];
		break;
		case 10:
			poolAccountItem->roleParty.child.maxCallsPerDay = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 11:
			poolAccountItem->roleParty.child.maxSMSPerDay = PPS_SET_INTEGER(pdata,datalen);;
		break;
		case 12:
			poolAccountItem->roleParty.child.maxFeePerDay = PPS_SET_INTEGER(pdata,datalen);
		break;	
		case 13:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(poolAccountItem,0,sizeof(COS_Pool_Account));			
				poolAccountItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/*********************	poolAccount	Table 	*********************/


/******************	cos gprs	Table 	******************/
int pps_getnext_cosGprs(index_t *id)
{	
	return pps_getnext_Index(CosGprsTable,id);	
}

int pps_getIdle_cosGprs(index_t *id)
{	
	return pps_getIdle_Index(CosGprsTable,id);		
}

int isCosGprsBusy(index_t *id)
{
	return isIndexBusy(CosGprsTable,id);
}

int pps_get_cosGprs(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
{
	int 								datalen = 1,cosIndex,subIndex;
	PPS_COS_RADIUS_ITEM					*gprsItem;
	
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(CosGprsTable,subIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosGprsTable,(index_t *)instance) == FALSE)
		return -1;
		
	gprsItem = &ppsParam.ppsTables.cosTable[cosIndex].gprs[subIndex];
	*vartype = INTEGER;
	
	switch(column)
	{
		case 1:
			pdata[0] = cosIndex;
		break;
		case 2:
			pdata[0] = subIndex;
		break;
		case 3:
			*vartype = OctetString;
			gprsItem->title[PpsMaxTitleLen-1] = 0;
			datalen = strlen((char *)gprsItem->title);
			memcpy(pdata,gprsItem->title,datalen);
		break;
		case 4:
			pdata[0] = gprsItem->gprsChargeFlag;
		break;			
		case 5:
			datalen = PPS_GET_INTEGER(gprsItem->miniBalanceForGprs,pdata,vartype);				
		break;		
		case 6:
			datalen = PPS_GET_INTEGER(gprsItem->inactiveSessionLimit,pdata,vartype);						
		break;
		case 7:
			pdata[0] = gprsItem->notificationWhenSessionTerminate;
		break;
		case 8:
			datalen = PPS_GET_INTEGER(gprsItem->maxSmsForGprsNotificationPerDay,pdata,vartype);		
		break;
		case 9:
			datalen = PPS_GET_INTEGER(gprsItem->maxVolumeQuotaEachTime>>10,pdata,vartype);			
		break;
		case 10:
			datalen = PPS_GET_INTEGER(gprsItem->volumeThresholdDiff>>10,pdata,vartype);				
		break;			
		case 11:
			datalen = PPS_GET_INTEGER(gprsItem->maxDurationQuotaEachTime,pdata,vartype);	
		break;		
		case 12:
			datalen = PPS_GET_INTEGER(gprsItem->durationThresholdDiff,pdata,vartype);	
		break;		
		case 13:
			pdata[0] = gprsItem->gprsChargedBy;
		break;
		case 14:
			pdata[0] = gprsItem->capPlan[0].type;
		break;
		case 15:
			datalen = PPS_GET_INTEGER(gprsItem->capPlan[0].threshold0,pdata,vartype);	
		break;	
		case 16:
			datalen = PPS_GET_INTEGER(gprsItem->capPlan[0].threshold1,pdata,vartype);	
		break;
		case 17:
			datalen = PPS_GET_INTEGER(gprsItem->capPlan[0].threshold2,pdata,vartype);	
		break;
		case 18:
			
			pdata[0] = gprsItem->capPlan[0].tariffID0;
		break;
		case 19:
			pdata[0] = gprsItem->capPlan[0].tariffID1;
		break;
		case 20:
			pdata[0] = gprsItem->capPlan[0].tariffID2;
		break;
		case 21:
			pdata[0] = gprsItem->capPlan[0].tariffID3;
		break;
		case 22:/* rowStatus	*/  //2010-03-08
			*vartype = INTEGER;
			pdata[0] = TABLE_ACTIVE_COMMAND;	
		break;				
		default:
			return -1;
		break;			
	}
	return datalen;
}


int pps_set_cosGprs(u32 column, u32 *instance, u8 *pdata, u16 datalen)
{
	int 						cosIndex,subIndex;
	PPS_COS_RADIUS_ITEM			*gprsItem;
				
	cosIndex = instance[0];	
	if(isIndexValid(CosTable,cosIndex) == FALSE)
		return -1;
	if(isIndexBusy(CosTable,(index_t *)&cosIndex) == FALSE)
		return -1;
	
	subIndex = instance[1];
	if(isIndexValid(CosGprsTable,subIndex) == FALSE)
		return -1;	
		
	gprsItem = &ppsParam.ppsTables.cosTable[cosIndex].gprs[subIndex];
	switch(column)
	{
		case 3:			
			if(datalen > PpsMaxTitleLen)
				return -1;
			memcpy(gprsItem->title,pdata,datalen);
			gprsItem->title[datalen] = 0;
		break;
		case 4:
			gprsItem->gprsChargeFlag = pdata[0];
		break;			
		case 5:
			gprsItem->miniBalanceForGprs = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 6:
			gprsItem->inactiveSessionLimit = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 7:
			gprsItem->notificationWhenSessionTerminate = pdata[0];			
		break;
		case 8:
			gprsItem->maxSmsForGprsNotificationPerDay = PPS_SET_INTEGER(pdata,datalen);		
		break;
		case 9:
			gprsItem->maxVolumeQuotaEachTime =  PPS_SET_INTEGER(pdata,datalen) << 10;	
		break;
		case 10:
			gprsItem->volumeThresholdDiff = PPS_SET_INTEGER(pdata,datalen) << 10;		
		break;			
		case 11:
			gprsItem->maxDurationQuotaEachTime = PPS_SET_INTEGER(pdata,datalen);
		break;		
		case 12:
			gprsItem->durationThresholdDiff = PPS_SET_INTEGER(pdata,datalen);
		break;	
		case 13:
			gprsItem->gprsChargedBy = pdata[0];
		break;
		case 14:
			gprsItem->capPlan[0].type = pdata[0];
		break;
		case 15:
			gprsItem->capPlan[0].threshold0 = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 16:
			gprsItem->capPlan[0].threshold1 = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 17:
			gprsItem->capPlan[0].threshold2 = PPS_SET_INTEGER(pdata,datalen);
		break;
		case 18:
			gprsItem->capPlan[0].tariffID0 = pdata[0];
		break;
		case 19:
			gprsItem->capPlan[0].tariffID1 = pdata[0];
		break;
		case 20:
			gprsItem->capPlan[0].tariffID2 = pdata[0];
		break;
		case 21:
			gprsItem->capPlan[0].tariffID3 = pdata[0];
		break;
		case 22:/* command	*/
			if(pdata[0] == TABLE_DESTROY_COMMAND)
			{
				memset(gprsItem,0,sizeof(PPS_COS_RADIUS_ITEM));			
				gprsItem->existFlag = FALSE; 
			}
			else
				return -1;
		break;	
		default:
			return -1;
		break;
	}
	ppsSetParameterAutoSaveFlag();
	return datalen;
}
/***********************	cos gprs	Table 	**********************/
/************************************************************************/

/************************************************************************/


static struct snmp_table_profile pps_tables[] = {
	{
		.name = "PromptResolutionTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl ,PromptResolutionTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 0},
		.level = 1,
		.get_instance = pps_getnext_promptResolution,
		.get_resp = pps_get_promptResolution,
		.set_resp = pps_set_promptResolution
	},
	{
		.name = "MnpPrefixTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, MnpPrefixTable},
		.column = {1, 2, 3, 4, 0},
		.level = 1,
		.get_instance = pps_getnext_mnpPrefix,
		.get_resp = pps_get_mnpPrefix,
		.set_resp = pps_set_mnpPrefix
	},
	{
		.name = "SmsSentenceTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, SmsSentenceTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0},
		.level = 1,
		.get_instance = pps_getnext_smsSentence,
		.get_resp = pps_get_smsSentence,
		.set_resp = pps_set_smsSentence
	},
	{
		.name = "ThirdPartyInfoTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, ThirdPartyInfoTable},
		.column = {1, 2, 3, 4, 5, 0},
		.level = 1,
		.get_instance = pps_getnext_thirdPartyInfo,
		.get_resp = pps_get_thirdPartyInfo,
		.set_resp = pps_set_thirdPartyInfo
	},
	{
		.name = "BasicTariffZoneTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, BasicTariffZoneTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
		.level = 1,
		.get_instance = pps_getnext_basicTariffZone,
		.get_resp = pps_get_basicTariffZone,
		.set_resp = pps_set_basicTariffZone
	},
	{
		.name = "GsnTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, RadiusGsnTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
		.level = 1,
		.get_instance = pps_getnext_gsn,
		.get_resp = pps_get_gsn,
		.set_resp = pps_set_gsn
	},
	{
		.name = "SgsnTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, RadiusSgsnTable},
		.column = {1, 2, 3, 4, 5,6,7,0},
		.level = 1,
		.get_instance = pps_getnext_sgsn,
		.get_resp = pps_get_sgsn,
		.set_resp = pps_set_sgsn
	},
	{
		.name = "BundlePlanTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, ServiceControl, BundlePlanTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9,10,0},
		.level = 1,
		.get_instance = pps_getnext_bundlePlan,
		.get_resp = pps_get_bundle_plan,
		.set_resp = pps_set_bundle_plan
	},
	{
		.name = "IvrSourceTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, SrfParameter, IvrSourceTable},
		.column = {1, 2, 3, 4, 5, 0},
		.level = 1,
		.get_instance = pps_getnext_ivrSource,
		.get_resp = pps_get_ivrSource,
		.set_resp = pps_set_ivrSource
	},
	{
		.name = "SrfNumberTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, SrfParameter, SrfNumberTable},
		.column = {1, 2, 3, 4, 0},
		.level = 1,
		.get_instance = pps_getnext_srfNumber,
		.get_resp = pps_get_srfNumber,
		.set_resp = pps_set_srfNumber
	},
	{
		.name = "ServiceNumberTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, SrfParameter, ServiceNumberTable},
		.column = {1, 2, 3, 4, 0},
		.level = 1,
		.get_instance = pps_getnext_serviceNumber,
		.get_resp = pps_get_serviceNumber,
		.set_resp = pps_set_serviceNumber
	},
	{
		.name = "ServiceKeyTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, SrfParameter, ServiceKeyTable},
		.column = {1, 2, 3, 4, 0},
		.level = 1,
		.get_instance = pps_getnext_serviceKey,
		.get_resp = pps_get_serviceKey,
		.set_resp = pps_set_serviceKey
	},	
	{
		.name = "VmsUserSegmentTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, RouteVMS, VmsUserSegmentTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8,0},
		.level = 1,
		.get_instance = pps_getnext_vmsUserSegment,
		.get_resp = pps_get_vmsUserSegment,
		.set_resp = pps_set_vmsUserSegment
	},		
	{
		.name = "CosTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, CosTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0},
		.level = 1,
		.get_instance = pps_getnext_cos,
		.get_resp = pps_get_cos,
		.set_resp = pps_set_cos
	},
	{
		.name = "TariffTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, TariffTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19, 0},
		.level = 2,
		.get_instance = pps_getnext_cosTariff,
		.get_resp = pps_get_cosTariff,
		.set_resp = pps_set_cosTariff
	},
	{
		.name = "ServiceControlTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, ServiceControlTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17,18,19,20,21,22, 23,24,25,26,30,0},
		.level = 2,
		.get_instance = pps_getnext_cosServiceControl,
		.get_resp = pps_get_cosServiceControl,
		.set_resp = pps_set_cosServiceControl
	},
	{
		.name = "AccountValidityTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, AccountValidityTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 20,0},
		.level = 2,
		.get_instance = pps_getnext_cosAccountValidity,
		.get_resp = pps_get_cosAccountValidity,
		.set_resp = pps_set_cosAccountValidity
	},
	{
		.name = "SmsNotificationInquiryTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, SmsNotificationInquiryTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15,16,17,18, 0},
		.level = 2,
		.get_instance = pps_getnext_cosSmsNotification,
		.get_resp = pps_get_cosSmsNotification,
		.set_resp = pps_set_cosSmsNotification
	},
	{
		.name = "RechargeCardValidityTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, RechargeCardValidityTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 0},
		.level = 2,
		.get_instance = pps_getnext_cosRechargeCardValidity,
		.get_resp = pps_get_cosRechargeCardValidity,
		.set_resp = pps_set_cosRechargeCardValidity
	},
	{
		.name = "RechargePromotionTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, RechargePromotionTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 0},
		.level = 2,
		.get_instance = pps_getnext_cosRechargePromotion,
		.get_resp = pps_get_cosRechargePromotion,
		.set_resp = pps_set_cosRechargePromotion
	},
	{
		.name = "CapPlanTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, CapPlanTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0},
		.level = 2,
		.get_instance = pps_getnext_cosCapPlan,
		.get_resp = pps_get_cosCapPlan,
		.set_resp = pps_set_cosCapPlan
	},
	{
		.name = "PoolAccountTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, PoolAccountTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0},
		.level = 2,
		.get_instance = pps_getnext_cosPoolAccount,
		.get_resp = pps_get_cosPoolAccount,
		.set_resp = pps_set_cosPoolAccount
	},
	{
		.name = "GprsTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, CosGprsTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,21,22, 0},
		.level = 2,
		.get_instance = pps_getnext_cosGprs,
		.get_resp = pps_get_cosGprs,
		.set_resp = pps_set_cosGprs
	},
	{
		.name = "FriendFamilyTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, COSID, FriendFamilyTable},
		.column = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,21,22, 23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,0},
		.level = 2,
		.get_instance = pps_getnext_cos_friend_family,
		.get_resp = pps_get_cos_friend_family,
		.set_resp = pps_set_cos_friend_family
	},
	{
		.name = "USSDServiceTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, SrfParameter, UssdServiceNumberTable},
		.column = {1, 2, 3, 4, 0},
		.level = 1,
		.get_instance = pps_getnext_ussd_serviceNumber,
		.get_resp = pps_get_ussd_serviceNumber,
		.set_resp = pps_set_ussd_serviceNumber
	},
	{
		.name = "USSDKeyTable",
		.index.len = 14,
		.index.oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID, PPS_PARAMETER, SrfParameter, UssdServiceKeyTable},
		.column = {1, 2, 3, 4, 0},
		.level = 1,
		.get_instance = pps_getnext_ussd_serviceKey,
		.get_resp = pps_get_ussd_serviceKey,
		.set_resp = pps_set_ussd_serviceKey
	}
	
};

extern int 			snmpGetPPS(BYTE oidLen, DWORD *oid, BYTE *pdata, BYTE *vartype);
extern int 			snmpSetPPS(BYTE oidLen, DWORD *oid,  BYTE *pdata, u_short dataLen);
extern void 		snmpTrapPPS(BYTE oidLen, DWORD *oid, BYTE *pdata, u_short dataLen,snmp_addr *addr);
extern int 			snmpResponse(snmp_pdu *pdu, snmp_addr *addr);
extern int 			thirdPartyChargeProc(snmp_pdu *pdu, snmp_addr *addr);

extern DWORD     	PPS_OID_PREFIX[]; 
extern DWORD	 	PPS_OID_THIRDPARTY[];

static struct snmp_register pps_register = {
	.name = "PPS",
	.prefix_len = 11,
	.prefix_oid = {1, 3, 6, 1, 4, 1, 1373, 2, 3, 3, PPSOID},
	.num_of_table = sizeof(pps_tables)/sizeof(struct snmp_table_profile),
	.table = pps_tables,	
	.default_get_resp = (getcall)snmpGetPPS,
	.default_set_resp = (setcall)snmpSetPPS	
};


static void initTables()
{
	int i;
	PpsTable	*tablePoint;
	
	tablePoint = &ppsParam.ppsTables;
	
	/*******************	Prompt Resolution		**********************/
	memset(tablePoint->promptResolution[0].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->promptResolution[0].title,"Prompt Resolution",PpsMaxTitleLen);
	tablePoint->promptResolution[0].existFlag = TRUE;
	
	/*******************	IVR source		**********************/
	memset(tablePoint->ivrSource[0].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ivrSource[0].title,"IVR Source",PpsMaxTitleLen);
	tablePoint->ivrSource[0].existFlag = TRUE;
	 
	/*******************	SRF Number		**********************/
	memset(tablePoint->srfNumber[0].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->srfNumber[0].title,"SRF0 Number",PpsMaxTitleLen);	
	tablePoint->srfNumber[0].existFlag = TRUE;
	
	memset(tablePoint->srfNumber[1].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->srfNumber[1].title,"SRF1 Number",PpsMaxTitleLen);
	tablePoint->srfNumber[1].existFlag = TRUE;
	
	
	/*******************	Service Number		**********************/
	memset(tablePoint->serviceNumber[HotLineNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[HotLineNumberPosition].title,"HotLine Number",PpsMaxTitleLen);	
	tablePoint->serviceNumber[HotLineNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[InquiryNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[InquiryNumberPosition].title,"Inquiry Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[InquiryNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[ScratchCardRechargeNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[ScratchCardRechargeNumberPosition].title,"Scratch Card Recharge Number",PpsMaxTitleLen);	
	tablePoint->serviceNumber[ScratchCardRechargeNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[CreditCardRechargeNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[CreditCardRechargeNumberPosition].title,"Bundle Plan Subscribe Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[CreditCardRechargeNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[ThirdPartyRechargeNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[ThirdPartyRechargeNumberPosition].title,"ThirdParty Recharge Number",PpsMaxTitleLen);	
	tablePoint->serviceNumber[ThirdPartyRechargeNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[CustomerCareCenterNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[CustomerCareCenterNumberPosition].title,"Customer Care Center Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[CustomerCareCenterNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[RechargeNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[RechargeNumberPosition].title,"Recharge Number",PpsMaxTitleLen);	
	tablePoint->serviceNumber[RechargeNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[OPRNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[OPRNumberPosition].title,"OPR Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[OPRNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[VirtualCallingCardNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[VirtualCallingCardNumberPosition].title,"Virtual Calling Card Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[VirtualCallingCardNumberPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[PalimRegisterNumberPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[PalimRegisterNumberPosition].title,"Palim Register Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[PalimRegisterNumberPosition].existFlag = TRUE;

	memset(tablePoint->serviceNumber[PoolAccountPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[PoolAccountPosition].title,"Pool Account Service Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[PoolAccountPosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[FeeTransferPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[FeeTransferPosition].title,"Credit Transfer Service Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[FeeTransferPosition].existFlag = TRUE;

	memset(tablePoint->serviceNumber[FreeServicePosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[FreeServicePosition].title,"Free SMS Service Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[FreeServicePosition].existFlag = TRUE;
	
	memset(tablePoint->serviceNumber[CallMeBackPosition].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[CallMeBackPosition].title,"Call Me Back Service Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[CallMeBackPosition].existFlag = TRUE;

	memset(tablePoint->serviceNumber[GPRSPrepaidPostion].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[GPRSPrepaidPostion].title,"Gprs Service Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[GPRSPrepaidPostion].existFlag = TRUE;	      

	memset(tablePoint->serviceNumber[TellMeNumber].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceNumber[TellMeNumber].title,"Tell Me My Number",PpsMaxTitleLen);
	tablePoint->serviceNumber[TellMeNumber].existFlag = TRUE;	

	
	/*******************	Service Key		**********************/
	memset(tablePoint->serviceKey[HELP].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[HELP].title,"Help",PpsMaxTitleLen);	
	tablePoint->serviceKey[HELP].existFlag = TRUE;
	
	memset(tablePoint->serviceKey[INQUIRY_SERVICE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[INQUIRY_SERVICE].title,"Inquiry Service",PpsMaxTitleLen);
	tablePoint->serviceKey[INQUIRY_SERVICE].existFlag = TRUE;
	
	memset(tablePoint->serviceKey[SCRATCH_CARD_RECHARGE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[SCRATCH_CARD_RECHARGE].title,"Scratch Card Recharge",PpsMaxTitleLen);	
	tablePoint->serviceKey[SCRATCH_CARD_RECHARGE].existFlag = TRUE;
	
	memset(tablePoint->serviceKey[CREDIT_CARD_RECHARGE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[CREDIT_CARD_RECHARGE].title,"Credit Card Recharge",PpsMaxTitleLen);
	tablePoint->serviceKey[CREDIT_CARD_RECHARGE].existFlag = TRUE;
	
	memset(tablePoint->serviceKey[FAVORITE_NUMBER_SERVICE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[FAVORITE_NUMBER_SERVICE].title,"Favorite Number Service",PpsMaxTitleLen);	
	tablePoint->serviceKey[FAVORITE_NUMBER_SERVICE].existFlag = TRUE;
	
	memset(tablePoint->serviceKey[LANGUAGE_MANAGEMENT].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[LANGUAGE_MANAGEMENT].title,"Language Management",PpsMaxTitleLen);
	tablePoint->serviceKey[LANGUAGE_MANAGEMENT].existFlag = TRUE;
	
	memset(tablePoint->serviceKey[PIN_MANAGEMENT].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->serviceKey[PIN_MANAGEMENT].title,"Pin Management",PpsMaxTitleLen);			
	tablePoint->serviceKey[PIN_MANAGEMENT].existFlag = TRUE;


/******************* USSD	Service Number		**********************/
	for(i=0; i<MaxServiceNumberItem+MaxServiceNumberReservedItem; i++)
		tablePoint->ussdServiceNumber[i].existFlag = FALSE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_HOTLINE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_HOTLINE].title,"HotLine Number",PpsMaxTitleLen);	
	tablePoint->ussdServiceNumber[USSD_OC_HOTLINE].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_INQUIRY].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_INQUIRY].title,"Inquiry Number",PpsMaxTitleLen);
	tablePoint->ussdServiceNumber[USSD_OC_INQUIRY].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_RECHARGE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_RECHARGE].title,"Recharge Number",PpsMaxTitleLen);	
	tablePoint->ussdServiceNumber[USSD_OC_RECHARGE].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_FEE_TRANSFER].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_FEE_TRANSFER].title,"Credit Transfer Number",PpsMaxTitleLen);
	tablePoint->ussdServiceNumber[USSD_OC_FEE_TRANSFER].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_CALL_ME_BACK].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_CALL_ME_BACK].title,"Call Me Back Number",PpsMaxTitleLen);	
	tablePoint->ussdServiceNumber[USSD_OC_CALL_ME_BACK].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_TELL_ME_NUMBER].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_TELL_ME_NUMBER].title,"Tell Me Number",PpsMaxTitleLen);
	tablePoint->ussdServiceNumber[USSD_OC_TELL_ME_NUMBER].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceNumber[USSD_OC_FRIEND_FAMILY_QUERY].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_FRIEND_FAMILY_QUERY].title,"Friends and Family Plan Query",PpsMaxTitleLen);
	tablePoint->ussdServiceNumber[USSD_OC_FRIEND_FAMILY_QUERY].existFlag = TRUE;

	memset(tablePoint->ussdServiceNumber[USSD_OC_BUNDLE_PLAN].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_BUNDLE_PLAN].title,"Bundle Plan",PpsMaxTitleLen);
	tablePoint->ussdServiceNumber[USSD_OC_BUNDLE_PLAN].existFlag = TRUE;

	memset(tablePoint->ussdServiceNumber[USSD_OC_BUNDLE_QUERY].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceNumber[USSD_OC_BUNDLE_QUERY].title,"Bundle Query",PpsMaxTitleLen);
	tablePoint->ussdServiceNumber[USSD_OC_BUNDLE_QUERY].existFlag = TRUE;
	
	/*******************	Service Key		**********************/
	for(i=0; i<10+3; i++)
		tablePoint->ussdServiceKey[i].existFlag = FALSE;

	memset(tablePoint->ussdServiceKey[USSD_OC_HOTLINE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceKey[USSD_OC_HOTLINE].title,"Exit",PpsMaxTitleLen);
	//tablePoint->ussdServiceKey[USSD_OC_HOTLINE].key = 0;
	tablePoint->ussdServiceKey[USSD_OC_HOTLINE].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceKey[USSD_OC_INQUIRY].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceKey[USSD_OC_INQUIRY].title,"Inquiry Service",PpsMaxTitleLen);
	//tablePoint->ussdServiceKey[USSD_OC_INQUIRY].key = 1;
	tablePoint->ussdServiceKey[USSD_OC_INQUIRY].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceKey[USSD_OC_RECHARGE].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceKey[USSD_OC_RECHARGE].title,"Recharge",PpsMaxTitleLen);	
	//tablePoint->ussdServiceKey[USSD_OC_RECHARGE].key = 2;	
	tablePoint->ussdServiceKey[USSD_OC_RECHARGE].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceKey[USSD_OC_FEE_TRANSFER].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceKey[USSD_OC_FEE_TRANSFER].title,"Credit Transfer",PpsMaxTitleLen);	
	//tablePoint->ussdServiceKey[USSD_OC_FEE_TRANSFER].key = 3;	
	tablePoint->ussdServiceKey[USSD_OC_FEE_TRANSFER].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceKey[USSD_OC_CALL_ME_BACK].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceKey[USSD_OC_CALL_ME_BACK].title,"Call Me Back",PpsMaxTitleLen);
	//tablePoint->ussdServiceKey[USSD_OC_CALL_ME_BACK].key = 4;
	tablePoint->ussdServiceKey[USSD_OC_CALL_ME_BACK].existFlag = TRUE;
	
	memset(tablePoint->ussdServiceKey[USSD_OC_TELL_ME_NUMBER].title,0,PpsMaxTitleLen);
	memcpy(tablePoint->ussdServiceKey[USSD_OC_TELL_ME_NUMBER].title,"Tell Me Number",PpsMaxTitleLen);			
	//tablePoint->ussdServiceKey[USSD_OC_TELL_ME_NUMBER].key = 5;
	tablePoint->ussdServiceKey[USSD_OC_TELL_ME_NUMBER].existFlag = TRUE;

       memset(tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].title,0,PpsMaxTitleLen);
	sprintf((char *)tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].title,"%s", "Friends and Family Plan Query");			
	//tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].key = 6;
	tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].existFlag = TRUE;

       memset(tablePoint->ussdServiceKey[USSD_OC_BUNDLE_PLAN].title,0,PpsMaxTitleLen);
	sprintf((char *)tablePoint->ussdServiceKey[USSD_OC_BUNDLE_PLAN].title,"%s", "Data Plan");
	//tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].key = 7;
	tablePoint->ussdServiceKey[USSD_OC_BUNDLE_PLAN].existFlag = TRUE;
	
       memset(tablePoint->ussdServiceKey[USSD_OC_BUNDLE_QUERY].title,0,PpsMaxTitleLen);
	sprintf((char *)tablePoint->ussdServiceKey[USSD_OC_BUNDLE_QUERY].title,"%s", "Bundle Query");
	//tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].key = 7;
	tablePoint->ussdServiceKey[USSD_OC_BUNDLE_QUERY].existFlag = TRUE;
	
 	memset(tablePoint->ussdServiceKey[USSD_OC_BUNDLE_PLAN_ALL].title,0,PpsMaxTitleLen);
	sprintf((char *)tablePoint->ussdServiceKey[USSD_OC_BUNDLE_PLAN_ALL].title,"%s", "Bundle Plan");
	//tablePoint->ussdServiceKey[USSD_OC_FRIEND_FAMILY_QUERY].key = 7;
	tablePoint->ussdServiceKey[USSD_OC_BUNDLE_PLAN_ALL].existFlag = TRUE;

	initSmsSentence();
}
 
static void initCosTable(COSTable	*cosItem)
{			
	int 	i;
	u_char	buf[PpsMaxTitleLen]={0};
		
	memset(cosItem->tariff,0,MaxTariffTableItem*sizeof(CosTariff));
	memcpy(cosItem->tariff[0].title,"Tariff",PpsMaxTitleLen);
	cosItem->tariff[0].existFlag = TRUE;
	
	memset(cosItem->serviceControl,0,MaxServiceControlTableItem*sizeof(CosServiceControl));
	memcpy(cosItem->serviceControl[0].title,"Service Control",PpsMaxTitleLen);
	cosItem->serviceControl[0].existFlag = TRUE;
	cosItem->serviceControl[0].serviceNumberFlag = 0xFFFF;
	cosItem->serviceControl[0].smsServiceFlag = 0xFFFF;
	cosItem->serviceControl[0].ussdServiceFlag = 0xFFFF;
					
	memset(cosItem->accountValidity,0,MaxAccountValidityTableItem*sizeof(CosAccountValidity));
	memcpy(cosItem->accountValidity[0].title,"Account Validity",PpsMaxTitleLen);
	cosItem->accountValidity[0].existFlag = TRUE;
				
	memset(cosItem->smsNotificationInquiry,0,MaxSmsNotificationInquiryTableItem*sizeof(CosSmsNotificationInquiry));
	
	memcpy(cosItem->smsNotificationInquiry[0].title,"SMS Notification & Inquiry",PpsMaxTitleLen);
	cosItem->smsNotificationInquiry[0].existFlag = TRUE;
	
	memset(cosItem->rechargeCardValidity,0,	MaxRechargeCardType*sizeof(CosRechargeCardValidity));		
	for(i=0;i<MaxRechargeCardType;i++)
	{
		memset(buf,0,PpsMaxTitleLen);
		sprintf((char *)buf,"Recharge Card Type %d",i);
		memcpy(cosItem->rechargeCardValidity[i].title,buf,PpsMaxTitleLen);
		cosItem->rechargeCardValidity[i].existFlag = TRUE;		
	}
	
	memset(cosItem->rechargePromotion,0,MaxRechargeCardType*sizeof(CosRechargePromotion));	
	for(i=0;i<MaxRechargeCardType;i++)
	{
		memset(buf,0,PpsMaxTitleLen);
		sprintf((char *)buf,"Promotion %d",i);
		memcpy(cosItem->rechargePromotion[i].title,buf,PpsMaxTitleLen);
		cosItem->rechargePromotion[i].existFlag = TRUE;		
	}
									
	memset(cosItem->capPlan,0,MaxcapPlanTableItem*sizeof(CosCapPlan));
	for(i=0;i<MaxcapPlanTableItem;i++)
	{
		memset(buf,0,PpsMaxTitleLen);
		sprintf((char *)buf,"Cap Plan %d",i);
		memcpy(cosItem->capPlan[i].title,buf,PpsMaxTitleLen);
		cosItem->capPlan[i].existFlag = TRUE;		
	}
	
	memset(cosItem->poolAccount,0,MaxPoolAccountTableItem*sizeof(COS_Pool_Account));
	for(i=0;i<MaxPoolAccountTableItem;i++)
	{
		memset(buf,0,PpsMaxTitleLen);
		sprintf((char *)buf,"Pool Account %d",i);
		memcpy(cosItem->poolAccount[i].title,buf,PpsMaxTitleLen);
		cosItem->poolAccount[i].existFlag = TRUE;		
	}

	memset(cosItem->gprs,0,MaxGprsTableItem*sizeof(PPS_COS_RADIUS_ITEM));
	for(i=0;i<MaxGprsTableItem;i++)
	{
		memset(buf,0,PpsMaxTitleLen);
		sprintf((char *)buf,"Gprs Control %d",i);
		memcpy(cosItem->gprs[i].title,buf,PpsMaxTitleLen);
		cosItem->gprs[i].existFlag = TRUE;		
	}

	memset(cosItem->friendFamilyControl,0,MaxFriendFamilyTableItem*sizeof(CosFriendFamilyControl));
	for(i=0;i<MaxFriendFamilyTableItem;i++)
	{
		memset(buf,0,PpsMaxTitleLen);
		sprintf((char *)buf,"Friend Family Control %d",i);
		memcpy(cosItem->friendFamilyControl[i].title,buf,PpsMaxTitleLen);
		cosItem->friendFamilyControl[i].existFlag = TRUE;		
	}
}

extern int initRCMReponse();
int initSNMP()
{
   register_snmp_table(&pps_register);
   inquire_trapmsg(snmpTrapPPS);
   inquire_rspmsg(11,PPS_OID_PREFIX,(void *)snmpResponse);

   inquire_snmpmsg(13,PPS_OID_THIRDPARTY,(void *)thirdPartyChargeProc);

   memset(&debugmib,0,sizeof(_debug_mib));
   pps_debug_set();
   
   initTables();

   initRCMReponse();
   return 1;
}


