void Forward() { GetTop(); if (t == NULL) return; if (!strcmp(cname, "IEFrame") || !strcmp(cname, "CabinetWClass")) { //FindIE(t); if (t) { wb2 wb = GetIE(t); if (wb) { wb->raw_GoForward(); } } } }
// =========================================================================== // // Description: Get the specific IE from PDU object. // Input: // ie CIeBase object // seq The sequence of (may be) repeated IE, default value equal to zero. // Output: Null // Return: int // >= 0 Success. // -1 IE not exist. // // =========================================================================== int CPduBase::GetIE(CIeBase& ie, UINT8 seq) // Get IE content from PDU. { int r = 0; CIeBase * pIe; pIe = GetIE(ie.id, seq); if ((NULL == pIe) || (IE_NOT_EXIST == pIe->id)) { r = -1; // IE not exist. } else { ie = *pIe; } return r; }
// =========================================================================== // // Description: Pack up IE into Joyit API message. // Input: Null // Output: // len Length of Joyit API message. // Return: char * // NULL Failure. // Other Pointer point to Joyit API message. // // =========================================================================== char * CPduBase::ComposeJoyitApi(UINT16& len) { char * pPdu = NULL; char pdu[MAX_MSGLEN] = { 0 }; UINT8 pos = 0; UINT16 l; int i; // Make up API header. memcpy(pdu, Header, sizeof(SInterApiHead)); pos += sizeof(SInterApiHead); // #### Add 2005-10-30, by Wujianjin. ### // Construct the FIX information element first. UINT8 pt = GetProtocolType( ); if ((MOD_TUPAPI == pt) || (MOD_ISUPAPI == pt) || (MOD_Q931API == pt)) { // Construct the fix ie first. // Message index. CIeBase * pIe; pIe = GetIE(PSG_IE_MSGTYPE); if ((pIe != NULL) && (pIe->id != IE_NOT_EXIST)) { pdu[pos++] = pIe->id; pdu[pos++] = pIe->len; memcpy(pdu+pos, pIe->GetIeData(l), pIe->len); pos += pIe->len; } else { // Not exist, I will get it from mType. pdu[pos++] = PSG_IE_MSGTYPE; pdu[pos++] = 2; memcpy(pdu+pos, &mType, 2); pos += 2; } if (pIe != NULL) { DelIE(PSG_IE_MSGTYPE); } // Circuit structure. pIe = GetIE(PSG_IE_CIR_STRUCT); if ((pIe != NULL) && (pIe->id != IE_NOT_EXIST)) { pdu[pos++] = pIe->id; pdu[pos++] = pIe->len; memcpy(pdu+pos, pIe->GetIeData(l), pIe->len); pos += pIe->len; DelIE(PSG_IE_CIR_STRUCT); } else { // Exception handle. return pPdu; } // Circuit group indicator. pIe = GetIE(PSG_IE_CG_IND); if ((pIe != NULL) && (pIe->id != IE_NOT_EXIST)) { pdu[pos++] = pIe->id; pdu[pos++] = pIe->len; memcpy(pdu+pos, pIe->GetIeData(l), pIe->len); pos += pIe->len; } if (pIe != NULL) { DelIE(PSG_IE_CG_IND); } } // ### End 2005-10-30 ### // Make up all other IEs. for (i=0; i<IeCounter; ++i) { pdu[pos++] = IE[i].id; pdu[pos++] = IE[i].len; if ((pos + IE[i].len) >= MAX_MSGLEN) { // Message too long. printf("Joyit API too long. mType:0x%04X\n", mType); break; } memcpy(pdu+pos, IE[i].GetIeData(l), IE[i].len); pos += IE[i].len; } // Allocate memory for this PDU. if (i == IeCounter) { pPdu = new char[pos]; if (pPdu != NULL) { // ((SJoyitApiHead *)pdu)->msgType = mType; /* // Delete 2006-05-11, by Wu jianjin. ((SJoyitApiHead *)pdu)->primType = primType; // Modify 2005-10-27, by Wujianjin. ((SJoyitApiHead *)pdu)->noie = IeCounter; */ // ((SJoyitApiHead *)pdu)->PktLength = pos; // Modify 2006-05-11, by Wu jianjin. ((SInterApiHead *)pdu)->primType = primType; ((SInterApiHead *)pdu)->noie = IeCounter; memcpy(pPdu, pdu, pos); len = pos; } else { // Out of memory. printf("Make up Joyit API out of memory. mType:0x%04X\n", mType); } } return pPdu; }
char * CQ931Pdu::ComposeJoyitApi(UINT16& len) { char * pPdu = NULL; char pdu[MAX_MSGLEN] = { 0 }; UINT8 pos = 0; UINT16 l; int i; UINT16 msgType = GetMessageType( ); UINT8 noIe = 2; // = NoIe( ); // Make up API header. memcpy(pdu, Header, sizeof(SInterApiHead)); pos += sizeof(SInterApiHead); // #### Add 2005-10-30, by Wujianjin. ### // Construct the FIX information element first. // UINT8 pt = GetProtocolType( ); // if ((MOD_TUPAPI == pt) // || (MOD_ISUPAPI == pt) // || (MOD_Q931API == pt)) // { // Construct the fix ie first. // Message index. CIeBase * pIe; pIe = GetIE(PSG_IE_MSGTYPE); if ((pIe != NULL) && (pIe->id != IE_NOT_EXIST)) { pdu[pos++] = pIe->id; pdu[pos++] = pIe->len; memcpy(pdu+pos, pIe->GetIeData(l), pIe->len); pos += pIe->len; } else { // Not exist, I will get it from mType. pdu[pos++] = PSG_IE_MSGTYPE; pdu[pos++] = 2; // memcpy(pdu+pos, &mType, 2); memcpy(pdu+pos, &msgType, 2); pos += 2; } if (pIe != NULL) { DelIE(PSG_IE_MSGTYPE); } // Circuit structure. pIe = GetIE(PSG_IE_CIR_STRUCT); if ((pIe != NULL) && (pIe->id != IE_NOT_EXIST)) { pdu[pos++] = pIe->id; pdu[pos++] = pIe->len; memcpy(pdu+pos, pIe->GetIeData(l), pIe->len); pos += pIe->len; } else { // Exception handle. // return pPdu; pdu[pos ++] = PSG_IE_CIR_STRUCT; pdu[pos ++] = sizeof(SCircuitStructIE); SCircuitStructIE chn; chn.pcmId = GetPri( ); chn.tsId = GetTs( ); memcpy(pdu+pos, &chn, sizeof(SCircuitStructIE)); pos += sizeof(SCircuitStructIE); } if (pIe != NULL) { DelIE(PSG_IE_CIR_STRUCT); } // Circuit group indicator. pIe = GetIE(PSG_IE_CG_IND); if ((pIe != NULL) && (pIe->id != IE_NOT_EXIST)) { pdu[pos++] = pIe->id; pdu[pos++] = pIe->len; memcpy(pdu+pos, pIe->GetIeData(l), pIe->len); pos += pIe->len; ++ noIe; } if (pIe != NULL) { DelIE(PSG_IE_CG_IND); } // } // ### End 2005-10-30 ### // Make up all other IEs. for (i=0; i<NoIe( ); ++i) { if ((PSG_IE_L3_SGM == IE[i].id) // || (PSG_IE_L3_SNDCMP == IE[i].id) // Delete 2005-11-21, by Wujianjin. || (PSG_IE_L3_MOREDATA == IE[i].id) || (PSG_IE_L3_CR == IE[i].id) || (PSG_IE_L3_PTLDCM == IE[i].id) || (PSG_IE_L3_CHNID == IE[i].id)) { // noIe --; continue; } pdu[pos++] = IE[i].id; pdu[pos++] = IE[i].len; noIe ++; if ((pos + IE[i].len) >= MAX_MSGLEN) { // Message too long. printf("Joyit API too long. mType:0x%04X\n", msgType); break; } memcpy(pdu+pos, IE[i].GetIeData(l), IE[i].len); pos += IE[i].len; } // Allocate memory for this PDU. // if (i == IeCounter) // { pPdu = new char[pos]; if (pPdu != NULL) { ((SInterApiHead *)pdu)->primType = GetPrimitiveType( ); // Modify 2005-10-27, by Wujianjin. ((SInterApiHead *)pdu)->noie = noIe;; // ((SJoyitApiHead *)pdu)->PktLength = pos; memcpy(pPdu, pdu, pos); len = pos; } else { // Out of memory. printf("Make up Joyit API out of memory. mType:0x%04X\n", msgType); } // } return pPdu; }