Ejemplo n.º 1
0
void CDevCommWriterBase::Ready()
	{
	if (IsActive())
		return;
	SetActive();
	iTester->iComm.Write(iStatus, TPtr8(NULL, 0));
	}
Ejemplo n.º 2
0
THttpDataParser::THttpDataParser(MHttpBufferSupplier& aBufferSupplier)
: iBufferSupplier(aBufferSupplier), iLineBuffer(TPtr8(NULL, 0))
/**
	Constructor.
	@param		aBufferSupplier	The buffer supplier.
*/
	{
	}
Ejemplo n.º 3
0
THttpDataComposer::THttpDataComposer(MHttpBufferSupplier& aBufferSupplier)
: iBufferSupplier(aBufferSupplier), iBuffer(TPtr8(NULL, 0))
/**
	Constructor.
	@param		aBufferSupplier	The buffer supplier.
*/
	{
	iRequiredLength = 0;
	}
/**
 * Launch a process
 * @param aProcess the RProcess object used for creating the process
 * @param aExeName the name of the executable to run 
 * @param aCommandLine command line parameters to pass when creating the process 
 * @return KErrNone on success, or one of the other system wide error codes
 */
TInt LaunchProcess(RProcess& aProcess, TDesC& aExeName, TDesC& aCommandLine )    
	{
	LOG_MSG("ENTER: t_multi_agent_launcher: launchProcess"); 

	LOG_MSG2("aExeName %S ", &TPtr8((TUint8*)aExeName.Ptr(), 2*aExeName.Length(), 2*aExeName.Length()));
	LOG_MSG2("aCommandLine %S", &TPtr8((TUint8*)aCommandLine.Ptr(), 2*aCommandLine.Length(), 2*aCommandLine.Length()));

	TInt err = aProcess.Create( aExeName, aCommandLine );
	LOG_MSG2("t_multi_agent_launcher launchProcess, aProcess.Create err = %d", err); 

	// check that there was no error raised
	if(err != KErrNone)
		{
		return err;
		}

	// rendezvous with process
	TRequestStatus status = KRequestPending;
	aProcess.Rendezvous(status);

	if(KRequestPending != status.Int())
		{
		// startup failed so kill the process
		LOG_MSG2("t_multi_agent_launcher: launchProcess: RProcess Rendezvous() failed with %d. Killing process", status.Int());
		aProcess.Kill(KErrNone);
		return status.Int();
		}
	else
		{
		aProcess.Resume();
		User::WaitForRequest(status);

		LOG_MSG2("t_multi_agent_launcher: launchProcess: RProcess Resume() Rendezvous successful %d: ", status.Int());

		if(KErrNone != status.Int())
			{
			LOG_MSG2("t_multi_agent_launcher: RProcess Resume() failed with %d. Killing process", status.Int());
			aProcess.Kill(KErrNone);
			}

		LOG_MSG("EXIT: t_multi_agent_launcher launchProcess");
		return status.Int();
		}
	}
Ejemplo n.º 5
0
void CProcessPair::ConstructL(const TDesC& aProcessName, const TProcessId aProcessId)
	{
	//allocate the process name buffer and fill with aProcessName
	iProcessName = aProcessName.Alloc();
	if(iProcessName == NULL)
		User::Leave(KErrNoMemory);

	LOG_MSG2( "CProcessPair::ConstructL() process name: %S", &TPtr8((TUint8*)iProcessName->Ptr(), 2*iProcessName->Length(), 2*iProcessName->Length()) );

	//set process id
	iProcessId = aProcessId;
	}
Ejemplo n.º 6
0
// -----------------------------------------------------------------------------
// CWimCertHandler::CopyCertificateInfo
// Copies certificate information to client's allocated memory area.
// This function MAY NOT leave.
// -----------------------------------------------------------------------------
//
TInt CWimCertHandler::CopyCertificateInfo(
    TWimCertInfo& aCertInfo,
    WIMI_Ref_t* aCert,
    const RMessage2& /*aMessage*/ )
    {
    _WIMTRACE(_L("WIM | WIMServer | CWimCertHandler::CopyCertificateInfo | Begin"));
    WIMI_Ref_t* tempRef = NULL;
    WIMI_BinData_t ptLabel;
    WIMI_BinData_t ptKeyID;
    WIMI_BinData_t ptCAID;
    WIMI_BinData_t ptIssuerHash;
    WIMI_BinData_t ptTrustedUsage;
    TUint8 uiCDFRefs;
    TUint8 usage;
    TUint8 type;
    TUint16 certLen;
    TUint8 modifiable = 0;
    WIMI_STAT callStatus = WIMI_GetCertificateInfo(
                                aCert,
                                &tempRef,
                                &ptLabel,
                                &ptKeyID, /* Key Id (hash)*/
                                &ptCAID,
                                &ptIssuerHash,
                                &ptTrustedUsage,
                                &uiCDFRefs,
                                &usage,  /* 0 = client, 1 = CA */
                                &type,   /* WTLSCert(1),
                                            X509Cert(2),
                                            X968Cert(3),
                                            CertURL(4) */
                                &certLen,   /* cert. content or URL length */
                                &modifiable );

    if ( callStatus == WIMI_Ok )
        {
        free_WIMI_Ref_t( tempRef );

        // To make sure the length of the certificate is not zero
        _WIMTRACE2(_L("WIM | WIMServer | CWimCertHandler::CopyCertificateInfoL | certLen %d"), certLen);
        if ( certLen == 0 )
            {
            WSL_OS_Free( ptLabel.pb_buf );
            WSL_OS_Free( ptKeyID.pb_buf );
            WSL_OS_Free( ptCAID.pb_buf );
            WSL_OS_Free( ptIssuerHash.pb_buf );
            WSL_OS_Free( ptTrustedUsage.pb_buf );
        	return KErrArgument;
            }

        // it is x509cert
        if ( type == WIMI_CT_X509 && certLen != 0 )
            {
            //use this rough sanity checking for temp
            if ( certLen < 10 )
                {
                _WIMTRACE(_L("WIM | WIMServer | CWimCertHandler::CopyCertificateInfoL | cert is malformated, return KErrArgument"));
                WSL_OS_Free( ptLabel.pb_buf );
                WSL_OS_Free( ptKeyID.pb_buf );
                WSL_OS_Free( ptCAID.pb_buf );
                WSL_OS_Free( ptIssuerHash.pb_buf );
                WSL_OS_Free( ptTrustedUsage.pb_buf );
                return KErrArgument;
                }
            }
        _WIMTRACE(_L("WIM | WIMServer | CWimCertHandler::CopyCertificateInfoL | X509 check ok"));

        aCertInfo.iLabel.Copy(
            TPtr8(
                ptLabel.pb_buf,
                ptLabel.ui_buf_length,
                ptLabel.ui_buf_length ) );

        aCertInfo.iKeyId.Copy(
            TPtr8(
                ptKeyID.pb_buf,
                ptKeyID.ui_buf_length,
                ptKeyID.ui_buf_length ) );

        aCertInfo.iCAId.Copy(
            TPtr8(
                ptCAID.pb_buf,
                ptCAID.ui_buf_length,
                ptCAID.ui_buf_length ) );

        aCertInfo.iIssuerHash.Copy(
            TPtr8(
                ptIssuerHash.pb_buf,
                ptIssuerHash.ui_buf_length,
                ptIssuerHash.ui_buf_length ) );

        aCertInfo.iUsage = usage;
        aCertInfo.iType = type;
        aCertInfo.iCertlen = certLen;
        aCertInfo.iModifiable = modifiable;

        // Certificate location
        aCertInfo.iCDFRefs = iWimUtilFuncs->MapCertLocation( uiCDFRefs );

        //Allocate enough memory for OID
        aCertInfo.iTrustedUsageLength = ptTrustedUsage.ui_buf_length * 16;

        WSL_OS_Free( ptLabel.pb_buf );
        WSL_OS_Free( ptKeyID.pb_buf );
        WSL_OS_Free( ptCAID.pb_buf );
        WSL_OS_Free( ptIssuerHash.pb_buf );
        WSL_OS_Free( ptTrustedUsage.pb_buf );
        }

    return KErrNone;
    }
Ejemplo n.º 7
0
	inline TPtrC8 Value() { return TPtr8((TUint8 *)this + sizeof(COptionValue), iLength, iLength); }
Ejemplo n.º 8
0
	COptionValue(TInt aLevel, TInt aName, const TDesC8 &aOption) : iLevel(aLevel), iName(aName), iLength(aOption.Length())
		{
		TPtr8((TUint8 *)this + sizeof(COptionValue), iLength).Copy(aOption);
		}
Ejemplo n.º 9
0
// Called by the framework to process frame data
TFrameState CPngReadCodec::ProcessFrameL(TBufPtr8& aSrc)
	{
	CImageProcessor*const imageProc = ImageProcessor();
	CImageProcessor*const maskProc = MaskProcessor();

	TUint8* startDataPtr = const_cast<TUint8*>(aSrc.Ptr());
	TUint8* dataPtr = startDataPtr;
	const TUint8* dataPtrLimit = dataPtr + aSrc.Length();
	while (dataPtr < dataPtrLimit)
		{
		// If at the end of a PNG chunk
		if (iChunkBytesRemaining == 0)
			{
			if (iChunkId == KPngIDATChunkId) // Need to skip IDAT chunk CRCs
				{
				if (dataPtr + KPngChunkCRCSize + KPngChunkLengthSize + KPngChunkIdSize > dataPtrLimit)
					break;

				dataPtr += KPngChunkCRCSize;
				}
			else
				{
				if (dataPtr + KPngChunkLengthSize + KPngChunkIdSize > dataPtrLimit)
					break;
				}

			iChunkBytesRemaining = PtrReadUtil::ReadBigEndianUint32Inc(const_cast<const TUint8*&>(dataPtr));
			iChunkId = TPtr8(dataPtr,KPngChunkIdSize,KPngChunkIdSize);
			dataPtr += KPngChunkIdSize;
			}
		// Process an image data chunk
		if (iChunkId == KPngIDATChunkId)
			DoProcessDataL(const_cast<const TUint8*&>(dataPtr),dataPtrLimit);
		// Process an END chunk -- frame is complete
		else if (iChunkId == KPngIENDChunkId)
			{
			iDecompressor->InflateL();
			imageProc->FlushPixels();
			if (maskProc)
				maskProc->FlushPixels();
			return EFrameComplete;
			}
		else 
		// Skip other chunks
			{
			TInt bytesLeft = dataPtrLimit - dataPtr;
			if (bytesLeft >= iChunkBytesRemaining + KPngChunkCRCSize)
				{
				dataPtr += iChunkBytesRemaining + KPngChunkCRCSize;
				iChunkBytesRemaining = 0;
				}
			else
				{
				dataPtr += bytesLeft;
				iChunkBytesRemaining -= bytesLeft;
				}
			}
		}

	aSrc.Shift(dataPtr - startDataPtr);
	return EFrameIncomplete;
	}