⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isupptl.cpp

📁 ABis无线接口全套资料
💻 CPP
📖 第 1 页 / 共 4 页
字号:
						
						pIe = GetIE(PSG_IE_CLNPRTNUM);
						inf->ii.cpari = (pIe->id != IE_NOT_EXIST) ? 0x01 : 0x00;
						pIe = GetIE(PSG_IE_CLNPRTCTG);
						inf->ii.cpcri = (pIe->id != IE_NOT_EXIST) ? 0x01 : 0x00;

						DelIE(PSG_IE_INFIND);
					}
					else
					{ // Set default value.
						memset((char *)&inf->ii, 0, sizeof(SInformationIndicators));
						
						pIe = GetIE(PSG_IE_CLNPRTNUM);
						inf->ii.cpari = (pIe->id != IE_NOT_EXIST) ? 0x01 : 0x00;
						pIe = GetIE(PSG_IE_CLNPRTCTG);
						inf->ii.cpcri = (pIe->id != IE_NOT_EXIST) ? 0x01 : 0x00;
					}

					inf->op = 0;

					pPdu += sizeof(SCIsupInfHeader);
					opos = sizeof(SCIsupInfHeader) - 1;
				}
				break;

			case PSG_MSG_ISUP_INR:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupInrHeader  * inr = (SCIsupInrHeader *)pPdu;
					inr->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_INFRQSIND);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy((char *)&inr->iri, pIe->GetIeData(tmplen), sizeof(SInformationRequestIndicators));
						DelIE(PSG_IE_INFRQSIND);
					}
					else
					{ // Set default value.
						memset((char *)&inr->iri, 0, sizeof(SInformationRequestIndicators));
						inr->iri.cpari = 0x01; // Request the calling party number.
					}

					inr->op = 0;

					pPdu += sizeof(SCIsupInrHeader);
					opos = sizeof(SCIsupInrHeader) - 1;
				}
				
				break;

			case PSG_MSG_ISUP_IAM:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupIamHeader  * iam = (SCIsupIamHeader *)pPdu;
					iam->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_NTRCONIND);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy((char *)&iam->noc, pIe->GetIeData(tmplen), sizeof(SNatureOfConnection));
						DelIE(PSG_IE_NTRCONIND);
					}
					else
					{ // Set default value.
						// NOC = 0x00;
						iam->noc.si = 0x00;
						iam->noc.cci = 0x00;
						iam->noc.ecdi = 0x00;
						iam->noc.reserved = 0x00;
					}

					pIe = GetIE(PSG_IE_FWDCALLIND);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy((char *)&iam->fci, pIe->GetIeData(tmplen), sizeof(SForwardCallIndicators));
						DelIE(PSG_IE_FWDCALLIND);
					}
					else
					{ // Set default value.
						// FCI = 0x0040;
						iam->fci.nici = 0x00;
						iam->fci.e2emi = 0x00;
						iam->fci.ii = 0x00;
						iam->fci.e2eii = 0x00;
						iam->fci.isupi = 0x00;
						iam->fci.isuppi = 0x01;
						iam->fci.isdnai = 0x00;
						iam->fci.sccpmi = 0x00;
						iam->fci.spare = 0x00;
						iam->fci.reserved = 0x00;
					}

					pIe = GetIE(PSG_IE_CLNPRTCTG);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy((char *)&iam->cpc, pIe->GetIeData(tmplen), sizeof(SCallingPartysCatetgory));
						DelIE(PSG_IE_CLNPRTCTG);
					}
					else
					{ // Set default value.
						// CPC = 0xF8
						iam->cpc.category = CPC_ORDINARY_LS;
					}

					pIe = GetIE(PSG_IE_TRNMDMRQR);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy((char *)&iam->tmr, pIe->GetIeData(tmplen), sizeof(STransmissionMediumRequirement));
						DelIE(PSG_IE_TRNMDMRQR);
					}
					else
					{ // Set default value.
						// TMR = 0x03
						iam->tmr.tmr = 0x03;
					}

					iam->vp = 2;
					iam->op = 0;

					pPdu += sizeof(SCIsupIamHeader);
					opos = sizeof(SCIsupIamHeader) - 1;

					pIe = GetIE(PSG_IE_CLDPRTNUM);

					if (pIe->id != IE_NOT_EXIST)
					{
						tmplen = WrapCalledPartyNumber((unsigned char *)pIe->GetIeData(tmplen), pIe->len, (unsigned char *)tmpbuf);

						*pPdu ++ = tmplen;
						memcpy(pPdu, tmpbuf, tmplen);
						pPdu += tmplen;
						DelIE(PSG_IE_CLDPRTNUM);
					}
					else
					{ // Exception.
						r = -1; // Missing VARIABLE parameter.
					}
				}
				
				break;

			case PSG_MSG_ISUP_REL:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupRelHeader  * rel = (SCIsupRelHeader *)pPdu;
					rel->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					rel->vp = 2;
					rel->op = 0;

					pPdu += sizeof(SCIsupRelHeader);
					opos = sizeof(SCIsupRelHeader) - 1;
					
					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_CAUSEIND);

					if (pIe->id != IE_NOT_EXIST)
					{
						*pPdu ++ = pIe->len;
						memcpy(pPdu, pIe->GetIeData(tmplen), pIe->len);
						pPdu += sizeof(SCauseIndicators);
						DelIE(PSG_IE_CAUSEIND);
					}
					else
					{ // Set default value.
						// Normal release. 0x9F80
						*pPdu ++ = sizeof(SCauseIndicators);
						((SCauseIndicators *)pPdu)->location = CAU_LOCATION_U; // User
						((SCauseIndicators *)pPdu)->spare = 0;
						((SCauseIndicators *)pPdu)->coding = CAU_CS_ITUT;
						((SCauseIndicators *)pPdu)->ext0 = 1;
						((SCauseIndicators *)pPdu)->cause = 0x1F; // Normal, unspecific.
						((SCauseIndicators *)pPdu)->ext1 = 1;
						pPdu += sizeof(SCauseIndicators);
					}
				}
				
				break;

			case PSG_MSG_ISUP_SAM:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupSamHeader  * sam = (SCIsupSamHeader *)pPdu;
					sam->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					sam->vp = 2;
					sam->op = 0;

					pPdu += sizeof(SCIsupSamHeader);
					opos = sizeof(SCIsupSamHeader) - 1;
					
					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_SUBNUM);

					if (pIe->id != IE_NOT_EXIST)
					{
						tmplen = WrapSubsequentNumber((unsigned char *)pIe->GetIeData(tmplen), pIe->len, (unsigned char *)tmpbuf);

						*pPdu ++ = tmplen;
						memcpy(pPdu, tmpbuf, tmplen);
						pPdu += tmplen;

						DelIE(PSG_IE_SUBNUM);
					}
					else
					{ // Exception.
						r = -1; // Missing VARIABLE parameter.
					}
				}
				
				break;

			case PSG_MSG_ISUP_USR:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupUsrHeader  * usr = (SCIsupUsrHeader *)pPdu;
					usr->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					usr->vp = 2;
					usr->op = 0;

					pPdu += sizeof(SCIsupUsrHeader);
					opos = sizeof(SCIsupUsrHeader) - 1;

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_USRTOUSRINF);

					if (pIe->id != IE_NOT_EXIST)
					{
						*pPdu ++ = pIe->len;
						memcpy(pPdu, pIe->GetIeData(tmplen), pIe->len);
						pPdu += pIe->len;

						DelIE(PSG_IE_USRTOUSRINF);
					}
					else
					{ // Exception
						r = -1; // Missing VARIABLE parameter.
					}
				}
				
				break;
				
			case PSG_MSG_ISUP_SUS:
			case PSG_MSG_ISUP_RES:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupSusHeader  * sus = (SCIsupSusHeader *)pPdu;
					sus->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_RESSUSIND);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy((char *)&sus->sri, pIe->GetIeData(tmplen), sizeof(SSuspendResumeIndicators));
						DelIE(PSG_IE_RESSUSIND);
					}
					else
					{ // Set to default value.
						sus->sri.sri = SRI_SUBSCRIBER;
						sus->sri.spare = 0;
					}

					sus->op = 0;

					pPdu += sizeof(SCIsupSusHeader);
					opos = sizeof(SCIsupSusHeader) - 1;
				}
				
				break;

			case PSG_MSG_ISUP_BLO: // Not any parameters.
			case PSG_MSG_ISUP_BLA:
			case PSG_MSG_ISUP_CCR:
			case PSG_MSG_ISUP_LPA:
			case PSG_MSG_ISUP_OLM:
			case PSG_MSG_ISUP_RSC:
			case PSG_MSG_ISUP_UBL:
			case PSG_MSG_ISUP_UBA:
			case PSG_MSG_ISUP_UCIC:
				// No any parameters be included.
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupBloHeader  * blo = (SCIsupBloHeader *)pPdu;
					blo->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					pPdu += sizeof(SCIsupBloHeader);
					opos = sizeof(SCIsupBloHeader) - 1;
				}

				break;

			case PSG_MSG_ISUP_CGB:
			case PSG_MSG_ISUP_CGBA:
			case PSG_MSG_ISUP_CGU:
			case PSG_MSG_ISUP_CGUA:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupCgbHeader  * cgb = (SCIsupCgbHeader *)pPdu;
					cgb->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_CG_IND);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy(tmpbuf, pIe->GetIeData(tmplen), pIe->len);

						if (CGIND_MAINTENANCE == tmpbuf[0])
						{
							cgb->cgsmt.ti = CGS_MAINTENANCE;
							cgb->cgsmt.spare = 0;
						}
						else if (CGIND_HARDWARE == tmpbuf[0])
						{
							cgb->cgsmt.ti = CGS_HARDWARE;
							cgb->cgsmt.spare = 0;
						}

						tmpbuf[1] --; // Number of circuits --> Range.

						cgb->vp = 1;

						pPdu += sizeof(SCIsupCgbaHeader);

						*pPdu ++ = pIe->len-1;
						memcpy(pPdu, tmpbuf+1, pIe->len-1);
						pPdu += pIe->len-1;

						DelIE(PSG_IE_CG_IND);
					}
					else
					{ // Exception.
						r = -1; // Missing VARIABLE parameter.
					}
				}
				
				break;

			case PSG_MSG_ISUP_GRS:
			case PSG_MSG_ISUP_CQM:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupGrsHeader  * grs = (SCIsupGrsHeader *)pPdu;
					grs->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					grs->vp = 1;
					
					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_RNGSTATUS);

					if (pIe->id != IE_NOT_EXIST)
					{
						memcpy(tmpbuf, pIe->GetIeData(tmplen), pIe->len);

						
						grs->vp = 1;

						pPdu += sizeof(SCIsupGrsHeader);
						
						*(pPdu ++) = pIe->len;
						memcpy(pPdu, tmpbuf, pIe->len);
						pPdu += pIe->len;

						DelIE(PSG_IE_RNGSTATUS);
					
					}
					else
					{ // Exception.
						r = -1; // Missing VARIABLE parameter.
					}
				
				
				}
				
				break;

			case PSG_MSG_ISUP_FAA:
			case PSG_MSG_ISUP_FAR:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupFaaHeader  * faa = (SCIsupFaaHeader *)pPdu;
					faa->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_FACIND);

					if (pIe->id != IE_NOT_EXIST)
					{
						faa->fi.fi = pIe->GetIeData( );
						
						DelIE(PSG_IE_FACIND);
					}
					else
					{ // Set default value.
						faa->fi.fi = 0x02;
					}

					faa->op = 0;

					pPdu += sizeof(SCIsupFaaHeader);
					opos = sizeof(SCIsupFaaHeader) - 1;
				}
				
				break;

			case PSG_MSG_ISUP_PAM:
				break;

			case PSG_MSG_ISUP_MPM:
				if ((24 == GetSS7Pcf( )) &&
					(GetVariant( ) == ISUP_VAR_CHINA))
				{
					SCIsupMpmHeader  * mpm = (SCIsupMpmHeader *)pPdu;
					mpm->hdr.msgtype = ToIsupMsg(GetMessageType( ));
					// Construct other fields here.

					CIeBase  * pIe;
					pIe = GetIE(PSG_IE_CRGINF);

					if (pIe->id != IE_NOT_EXIST)
					{
						mpm->ci.ci = pIe->GetIeData( );
						
						DelIE(PSG_IE_CRGINF);
					}
					else
					{ // Exception.
						// mpm->ci.ci = 0x06;
						r = -1;
					}

					mpm->op = 0;

					pPdu += sizeof(SCIsupMpmHeader);
					opos = sizeof(SCIsupMpmHeader) - 1;
				}
				break;

			default:
				break;
		} // End of switch(GetMessageType( ))

		if (r < 0)
		{
			// delete pPdu;
			delete pdu; // Modify 2005-12-06, by Wu jianjin.
			pdu = NULL;
			pPdu = NULL;
		}
		else if (opos > 0) // The message has optional parameter pointer.
		{ // Make up OPTIONAL parameters.
			if (NoIe( ) > 0)
			{ // Calculate the optional pointer value.
				pdu[opos] = (pPdu - pdu) - opos;
			}
			
			uchar eoop = 0;
			for (int i=0; i<NoIe( ); ++i)
			{
				switch (IE[i].id)
				{
					case PSG_IE_ENDOPT:
						eoop = 1; // Include end of optional parameter.
						break;

					case PSG_IE_CLNPRTNUM:
						*pPdu ++ = CIsupPdu::ToIsupIe(IE[i].id); // ISUP IE id

						tmplen = WrapCallingPartyNumber((unsigned char *)IE[i].GetIeData(tmplen), IE[i].len, (unsigned char *)tmpbuf);
						*pPdu ++ = tmplen;
						memcpy(pPdu, tmpbuf, tmplen);
						pPdu += tmplen;
						break;
					
					case PSG_IE_ORGCLDNUM:	// Original called number
					case PSG_IE_REDNGNUM:	// Redirecting number
					case PSG_IE_REDIRNUM:	// Redirection number
					case PSG_IE_CONNUM:		// Connected number
					case PSG_IE_LCTNUM:		// Location number
						*pPdu ++ = CIsupPdu::ToIsupIe(IE[i].id); // ISUP IE id

						tmplen = WrapOthersNumber((unsigned char *)IE[i].GetIeData(tmplen), IE[i].len, (unsigned char *)tmpbuf);
						*pPdu ++ = tmplen;
						memcpy(pPdu, tmpbuf, tmplen);
						pPdu += tmplen;
						break;

					case PSG_IE_GNRNUM:
						*pPdu ++ = CIsupPdu::ToIsupIe(IE[i].id); // ISUP IE id

						tmplen = WrapGenericNumber((unsigned char *)IE[i].GetIeData(tmplen), IE[i].len, (unsigned char *)tmpbuf);
						*pPdu ++ = tmplen;
						memcpy(pPdu, tmpbuf, tmplen);
						pPdu += tmplen;
						break;

					default:
						*pPdu ++ = CIsupPdu::ToIsupIe(IE[i].id); // ISUP IE id

						*pPdu ++ = IE[i].len;
						memcpy(pPdu, IE[i].GetIeData(tmplen), IE[i].len);
						pPdu += IE[i].len;
						break;
				} // End of switch(IE[i].id)
			}

			if (eoop)
			{
				*pPdu ++ = 0; // Adding End-of-optional-parameter.
			}
			else
			{
				// According to ITU-T ISUP specification, determine which message will be attached
				// end of optional parameter.
				switch (GetMessageType( ))
				{
					case PSG_MSG_ISUP_ACM:
					case PSG_MSG_ISUP_ANM:
					case PSG_MSG_ISUP_CPG:
					case PSG_MSG_ISUP_CFN: // 
					case PSG_MSG_ISUP_CON:
					case PSG_MSG_ISUP_FRJ:
					case PSG_MSG_ISUP_INF:
					case PSG_MSG_ISUP_INR:
					case PSG_MSG_ISUP_IAM:
					case PSG_MSG_ISUP_REL:
					case PSG_MSG_ISUP_RLC:
					case PSG_MSG_ISUP_SAM:
					case PSG_MSG_ISUP_USR:
					case PSG_MSG_ISUP_FOT:
					case PSG_MSG_ISUP_SUS:
					case PSG_MSG_ISUP_RES:
					case PSG_MSG_ISUP_FAA:
					case PSG_MSG_ISUP_FAR:
					case PSG_MSG_ISUP_UPT:
					case PSG_MSG_ISUP_UPA:
					case PSG_MSG_ISUP_FAC:
					case PSG_MSG_ISUP_NRM:
					case PSG_MSG_ISUP_IDR:
					case PSG_MSG_ISUP_IRS:
					case PSG_MSG_ISUP_SGM:
					case PSG_MSG_ISUP_OPR:
					case PSG_MSG_ISUP_CCL:
					case PSG_MSG_ISUP_MPM:
						break;
				} // End of switch(GetMessageType( ))
			}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -