• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TDes8类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TDes8的典型用法代码示例。如果您正苦于以下问题:C++ TDes8类的具体用法?C++ TDes8怎么用?C++ TDes8使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TDes8类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Read

TInt CRefTestAgentData::Read(TDes8& aDes) 
	{
	return iServer.Read(aDes, aDes.MaxLength());
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:4,代码来源:Reftestagentdata.cpp


示例2: Read

/**
    Read a portion of data from the device.
    Note: at present it _APPENDS_ data to the aDataDes, so the caller must take care of setting its length

    @param  aPos     media position in bytes
    @param  aLength  how many bytes to read
    @param  aDataDes data descriptor

    @return KErrNone on success, standard Epoc error code otherwise

*/
TInt CWinImgFileDevice::Read(TInt64 aPos,TInt aLength, TDes8& aDataDes)
{
    
    //__PRINT3(_L("#-- CWinImgFileDevice::Read, pos:%LU, len:%u, desMaxLen:%u"), aPos, aLength, aDataDes.MaxLength());

    ASSERT(HandleValid());
    ASSERT(aLength <= aDataDes.MaxLength());

    //-- check position on the volume
    const TInt64 maxPos = iDrvGeometry.TotalSizeInBytes();
    if(aPos < 0 || aPos > maxPos)
        return KErrArgument;

    const TInt64 lastPos = aPos+aLength;
    if(lastPos > maxPos)
        return KErrArgument;

    TUint32 dataLen = aLength;

    if(dataLen == 0)
        return KErrNone;

    DWORD dwRes;
    DWORD dwBytesRead = 0;

    //aDataDes.SetLength(0);

    try
    {
        //-- 1. position to the media 
        LONG  mediaPosHi = I64HIGH(aPos);
        const TUint32 mediaPosLo = I64LOW(aPos);

        dwRes = SetFilePointer(iDevHandle, mediaPosLo, &mediaPosHi, FILE_BEGIN);
        if(dwRes == INVALID_SET_FILE_POINTER)
            throw KDiskOpError;


        //-- 2. read data to the scratch buffer and copy it to the descriptor.
        ASSERT(ipScratchBuf);

        TUint32 rem = dataLen;
        
        while(rem)
        {
            const TUint32 bytesToRead = Min(KScratchBufSz, rem);
            if(!ReadFile(iDevHandle, ipScratchBuf, bytesToRead, &dwBytesRead, NULL))
                throw KDiskOpError;

            aDataDes.Append(ipScratchBuf, bytesToRead);
            rem-=bytesToRead;
        }

    }
    catch(TInt nErrId)
    {//-- some disk operation finished with the error
        (void)nErrId;
        ASSERT(nErrId == KDiskOpError);
        const DWORD dwWinErr = GetLastError();
        const TInt  epocErr = MapWinError(dwWinErr);
        
        __PRINT2(_L("#-- CWinImgFileDevice::Read() error! WinErr:%d, EpocErr:%d"), dwWinErr, epocErr);
        ASSERT(epocErr != KErrNone);

        return epocErr;
    }


    return KErrNone;
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:81,代码来源:win_media_device.cpp


示例3: GetLocationValue

// ---------------------------------------------------------------------------
// TOMASuplLocationData::GetLocationValue
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
EXPORT_C void TOMASuplLocationData::GetLocationValue(TDes8& aLocationValue) const
    {
    if(aLocationValue.MaxLength() >= iLocationValue.Length())
        aLocationValue.Copy(iLocationValue);
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:10,代码来源:epos_comasupllocationidver2.cpp


示例4: sizeof

/** 
 Get the capabilities of the device. This function is not called by the 
 Symbian OS. However can be used by the LDD to get the capabilities from 
 the device/hardware. There is no definition for encoding capabilities, 
 and is a matter of convention between the LDD and the PDD.
 
 @param	aDes
 		descriptor returned after filling with capabilities 
 */ 
void DExDriverPhysicalDevice::GetCaps(TDes8& aDes) const
	{    
	// Package buffer of TCommCapsV03. This creates a descriptor
	// for the commcaps structure, and provide compatibility
	// to use with API using descriptors
	//
    TCommCaps3 capsBuf;
    
    // Retrieves the data structure from the package buffer
    //
	TCommCapsV03 &caps=capsBuf();
	
	// Baud rates supported by the UART device. However, channel may
	// be designed to support a subset of them as choice (applies to
	// other configurations as well).
	//
	caps.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600\
		|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600\
		|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200;		
	
	// Databit size	
	caps.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8;
	// Stop bits size supported
	caps.iStopBits=KCapsStop1|KCapsStop2;
	// Parity supported
	caps.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd|KCapsParityMark|KCapsParitySpace;
	// Handshaking protocol supported by device
	caps.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|
					KCapsObeyCTSSupported|KCapsFailCTSSupported|
					KCapsObeyDSRSupported|KCapsFailDSRSupported|
					KCapsObeyDCDSupported|KCapsFailDCDSupported|
					KCapsFreeRTSSupported|KCapsFreeDTRSupported;
	// Infrared mode
	caps.iSIR=1;
	// Signals supported
	caps.iSignals=KCapsSignalCTSSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported|
						KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRNGSupported;
	// FIFO enable/disable					
	caps.iFifo=KCapsHasFifo;
	// Notifications supported
	caps.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported;
	caps.iRoleCaps=0;
	caps.iFlowControlCaps=0;
	// Break supported
	caps.iBreakSupported=ETrue;

	// [TDes8::MaxLength()] - Get the descriptor's length.
	TInt len = aDes.MaxLength();
	
	// [TDes8::FillZ(len)] -Fill the descriptor's data area with binary 
	// zeroes, replacing any existing data and change its length. 
	aDes.FillZ(len);
	
    TInt size = sizeof(caps);
    if (size>len)
    	size=len;
    
    // [TDes8::Copy()] - Copy the data of length (size) into aDes descriptor
    //  replacing any existing data in the descriptor.
    aDes.Copy((TUint8*)&caps, size);
        	
	aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength()));	
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:72,代码来源:d_expio_pdd.cpp


示例5: Panic

TInt CBase64CodecBase::Encode(const TDesC8& aSource, TDes8& aResult) const
//
// Encode an arbitrary number of octets in aSource append the output to aResult.
// If the number of octets in aSource is not a multiple of 3
// padding will be added terminating the encoding
//
{
    TInt sourceLength = aSource.Length();
    if (sourceLength == 0)
        return KErrNone;
    __ASSERT_ALWAYS(((sourceLength * 4)/3 + sourceLength%3) <= (aResult.MaxLength()-aResult.Length()), Panic(EBase64Overflow));

    sourceLength -= sourceLength%3;
    TUint8 sixBit=NULL;
    TText8 source;
    TInt i;

    for (i = 0; i < sourceLength; i++)
    {
        source=aSource[i];
        sixBit = STATIC_CAST(TUint8,(source & 0xFC) >> 2);
        aResult.Append(KBase64Alphabet[sixBit]);
        sixBit = NULL;
        sixBit = STATIC_CAST(TUint8,(source & 0x03) << 4);
        source=aSource[++i];
        sixBit |= STATIC_CAST(TUint8,(source & 0xF0) >> 4);
        aResult.Append(KBase64Alphabet[sixBit]);
        sixBit = NULL;
        sixBit = STATIC_CAST(TUint8,(source & 0x0F) << 2);
        source=aSource[++i];
        sixBit |= STATIC_CAST(TUint8,(source & 0xC0) >> 6);
        aResult.Append(KBase64Alphabet[sixBit]);
        sixBit = NULL;
        sixBit = STATIC_CAST(TUint8,(source & 0x3F));
        aResult.Append(KBase64Alphabet[sixBit]);
    }
    switch (aSource.Length() % 3)
    {
    case 2:
        source=aSource[i];
        sixBit = STATIC_CAST(TUint8,(source & 0xFC) >> 2);
        aResult.Append(KBase64Alphabet[sixBit]);
        sixBit = NULL;
        sixBit = STATIC_CAST(TUint8,(source & 0x03) << 4);
        source=aSource[++i];
        sixBit |= STATIC_CAST(TUint8,(source & 0xF0) >> 4);
        aResult.Append(KBase64Alphabet[sixBit]);
        sixBit = NULL;
        sixBit = STATIC_CAST(TUint8,(source & 0x0F) << 2);
        aResult.Append(KBase64Alphabet[sixBit]);
        aResult.Append(KBase64Alphabet[KBase64Pad]);
        break;
    case 1:
        source=aSource[i];
        sixBit = STATIC_CAST(TUint8,(source & 0xFC) >> 2);
        aResult.Append(KBase64Alphabet[sixBit]);
        sixBit = NULL;
        sixBit = STATIC_CAST(TUint8,(source & 0x03) << 4);
        aResult.Append(KBase64Alphabet[sixBit]);
        aResult.Append(KBase64Alphabet[KBase64Pad]);
        aResult.Append(KBase64Alphabet[KBase64Pad]);
        break;
    default:
        break;
    }
    return KErrNone;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:67,代码来源:BASE64.CPP


示例6: ParseHeader

// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseHeader( TDes8& aBuffer, TInt& aPos )
	{
    if ( IsEmpty( aBuffer, aPos ) )
        {	    
        return ETrue;
        }
    iChunkSize = KErrNotFound;
    iBytesAppended = 0;
    TPtrC8 pointer(NULL,0);
    //if '\r\n' exists
    TInt lineFeed = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KLineFeed );
    //if ';' exists
    TInt semiColon = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KSemiColon );
    //semicolon ignored if occurs after the linefeed
    if ( semiColon !=KErrNotFound && lineFeed !=KErrNotFound && lineFeed<semiColon )
        {
        semiColon = KErrNotFound;
        }
    if ( semiColon !=KErrNotFound )
        {		
        pointer.Set(aBuffer.Right( aBuffer.Length() - aPos ).Mid( 0,semiColon ) );		
        }
    else if ( lineFeed !=KErrNotFound )
        {
        pointer.Set( aBuffer.Right( aBuffer.Length() - aPos ).Mid( 0,lineFeed ) );		
        }
    else
        {
        pointer.Set( aBuffer.Right( aBuffer.Length() - aPos ) );		
        }

    TLex8 lex( pointer );	
    //skip white spaces	
    lex.SkipSpace();
    TUint size;
    //neither semicolon nor linefeed found
    if ( lineFeed == KErrNotFound && semiColon == KErrNotFound )
        {
        //remember the num of cut spaces
        TInt len = lex.Offset();
        if ( !lex.Eos() )
            {
            //check the chunk header size for the limit
            TInt error = lex.Val( size, EHex );			
            if ( error!= KErrNone || size > KMaxTInt )	
                {
                //size too big
                iError = ( error ) ? error: EHttpInsufficientStorage;
                iContext = EError;
                return EFalse;
                }			
            }

        aBuffer.Delete( aPos,len );
        return ETrue;
        }
			
    //get size	
    TInt error = lex.Val( size, EHex );
    if ( error!= KErrNone || size > KMaxTInt )
        {
        //unexpected characters or size too big
        iError = ( error ) ? error: EHttpInsufficientStorage ;
        iContext = EError;
        return EFalse;
        }	
    iChunkSize = size;	
    //skip white spaces	
    lex.SkipSpace();	
    if ( !lex.Eos() )
        {
        //unexpected characters
        iError = KErrGeneral;
        iContext = EError;
        return EFalse;
        }
    if ( lineFeed != KErrNotFound )
        {
        //the whole chunk header is parsed
        aBuffer.Delete( aPos, lineFeed + UpnpString::KLineFeed().Length() );
        //chunk size == 0
        if ( !iChunkSize )
            {        
            iContext = ELastChunk;
            }
        else
            {        
            iContext = EBody;
            }
        return ( aPos == aBuffer.Length() );
        }
    else if ( semiColon != KErrNotFound )
        {
        //extension found, 
        //one character left - possible linefeed
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:upnphttpchunkparser.cpp


示例7: UnPadL

void CPaddingNone::UnPadL(const TDesC8& aInput,TDes8& aOutput)
	{
	__ASSERT_DEBUG(aOutput.MaxLength() >= MaxPaddedLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow));
	aOutput.Append(aInput);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:5,代码来源:padding.cpp


示例8: GetSipUri

 /**
  * Getter method to Get SIP URI
  */
 EXPORT_C void COMASuplThirdpartyId::GetSipUri(TDes8& aSIPUri)
     {
     if(iSipUri && aSIPUri.MaxLength() >= iSipUri->Length())
         aSIPUri.Copy(*iSipUri);
     }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:8,代码来源:epos_comasuplstartver2.cpp


示例9: GetIMSPublicId

 /**
  * Getter method to Get IMS public id
  */
 EXPORT_C void COMASuplThirdpartyId::GetIMSPublicId(TDes8& aPublicId)
     {
     if(iIMSPublicId && aPublicId.MaxLength() >= iIMSPublicId->Length())
         aPublicId.Copy(*iIMSPublicId);
     }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:8,代码来源:epos_comasuplstartver2.cpp


示例10: Write

TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const
	{
	TDes8* desPtr = (TDes8*)iParams[aParam];
	desPtr->Copy(aDes.Mid(aOffset));
	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:6,代码来源:clientrequest.cpp


示例11: GetMSISDN

 /**
  * Getter method to Get MSISDN
  */
 EXPORT_C void COMASuplThirdpartyId::GetMSISDN(TDes8& aMSISDN)
     {
     if(aMSISDN.MaxLength() >= iMSISDN.Length())
         aMSISDN.Copy(iMSISDN);
     }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:8,代码来源:epos_comasuplstartver2.cpp


示例12: Read

void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const
	{
	const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
	aDes.Copy(desPtr->Mid(aOffset));
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:5,代码来源:clientrequest.cpp


示例13: passwordHash

inline void CPppMsChap2::GenerateAuthenticatorResponseL(
    const TDesC16& aPassword,
    const TDesC8& aNTResponse,
    const TDesC8& aPeerChallenge,
    const TDesC8& aAuthenticatorChallenge,
    const TDesC8& aUserName,
    TDes8& aAuthenticatorResponse)
/**
   Generates the expected MS-CHAP-V2 Authenticator Response Value.
   @param aPassword [in] The Microsoft Windows NT password (0 to 256
   Unicode char).
   @param aNTResponse [in] The MS-CHAP-V2 NT-Response (24 octets).
   @param aPeerChallenge [in] The Peer Challenge (16 octets).
   @param aAuthenticatorChallenge [in] The Authenticator Challenge (16
   octets).
   @param aUserName [in] The Microsoft Windows NT username (0 to 256
   char).
   @param aAuthenticatorResponse [out] The expected MS-CHAP-V2
   Authenticator Response Value encoded in the format
   "S=<auth_string>" as specified in RFC 2759 (42 octets).
   @note This function implements the GenerateAuthenticatorResponse
   routine specified in RFC 2759.
   @internalComponent
*/
{
    ASSERT(aPassword.Length()<=KPppMsChapMaxNTPasswordLength);
    ASSERT(aNTResponse.Length() == KPppMsChap2NTResponseSize);
    ASSERT(aPeerChallenge.Length() ==
           KPppMsChap2PeerChallengeSize);
    ASSERT(aAuthenticatorChallenge.Length() ==
           KPppMsChap2AuthenticatorChallengeSize);
    ASSERT(aUserName.Length()<=KPppMsChapMaxNTUserNameLength);
    ASSERT(aAuthenticatorResponse.Length() ==
           KPppMsChap2AuthenticatorResponseSize);

    HBufC8* passwordHashBuf=HBufC8::NewMaxLC(KPppMsChap2HashSize);
    TPtr8 passwordHash(passwordHashBuf->Des());

    NtPasswordHashL(aPassword, passwordHash);

    HashNtPasswordHashL(passwordHash, passwordHash);

    CSHA1* sha1 = CSHA1::NewL();
    CleanupStack::PushL(sha1);

// A magic string literal specified in RFC 2759 used in reponse
// generation by the GenerateAuthenticatorResponse routine for SHA-1
// encryption.
    _LIT8(KMagic1, "Magic server to client signing constant");


    sha1->Update(passwordHash);
    sha1->Update(aNTResponse);
    TPtrC8 hash(sha1->Final(KMagic1));


    HBufC8* challengeHashBuf =
        HBufC8::NewMaxLC(KPppMsChap2ChallengeHashSize);
    TPtr8 challengeHash(challengeHashBuf->Des());
    ChallengeHashL(aPeerChallenge,
                   aAuthenticatorChallenge,
                   aUserName,
                   challengeHash);

// Another magic string literal specified in RFC 2759 used in reponse
// generation by the GenerateAuthenticatorResponse routine for SHA-1
// encryption.
    _LIT8(KMagic2, "Pad to make it do more than one iteration");


    sha1->Update(hash);
    sha1->Update(challengeHash);
    const TUint8* pHash = sha1->Final(KMagic2).Ptr();


    _LIT8(KFormat,
          "S=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X"
          "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X");
    aAuthenticatorResponse.Format(KFormat,
                                  *pHash,
                                  *(pHash + 1),
                                  *(pHash + 2),
                                  *(pHash + 3),
                                  *(pHash + 4),
                                  *(pHash + 5),
                                  *(pHash + 6),
                                  *(pHash + 7),
                                  *(pHash + 8),
                                  *(pHash + 9),
                                  *(pHash + 10),
                                  *(pHash + 11),
                                  *(pHash + 12),
                                  *(pHash + 13),
                                  *(pHash + 14),
                                  *(pHash + 15),
                                  *(pHash + 16),
                                  *(pHash + 17),
                                  *(pHash + 18),
                                  *(pHash + 19));

//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:101,代码来源:mschap2.cpp


示例14: input

inline void CPppMsChap2::ProcessFailureMessageL(
    const TDesC8& aFailureMessage,
    TUint& aErrorCode,
    TUint8& aRetryFlag,
    TDes8& aAuthChallenge,
    TUint8& aPasswordProtoVersion,
    TPtrC8& aMessage)
/**
   Processes a MS-CHAP-V2 Failure Message.
   @param aFailureMessage [in] A MS-CHAP-V2 Failure Message.  The
   Failure Message needs to be in the format specified in RFC 2759:
   "E=eeeeeeeeee R=r C=cccccccccccccccccccccccccccccccc V=vvvvvvvvvv
   M=<msg>".
   @param aErrorCode [out] The MS-CHAP-V2 Failure error code.
   @param aRetryFlag [out] The retry flag.  The flag will be set to
   "1" if a retry is allowed, and "0" if not.  When the authenticator
   sets this flag to "1" it disables short timeouts, expecting the
   peer to prompt the user for new credentials and resubmit the
   response.
   @param aAuthChallenge [out] The new Authenticator Challenge Value.
   @param aPasswordProtoVersion [out] The password changing protocol
   supported by the peer.
   @param aMessage [out] A failure text message.
   @internalComponent
*/
{
    ASSERT(aAuthChallenge.Length() ==
           KPppMsChap2AuthenticatorChallengeSize);

    TLex8 input(aFailureMessage);

    if (input.Get() != 'E')
        User::Leave(KErrGeneral);

    if (input.Get() != '=')
        User::Leave(KErrGeneral);


// RFC 2759: ""eeeeeeeeee" is the ASCII representation of a decimal
// error code (need not be 10 digits) corresponding to one of those
// listed below, though implementations should deal with codes not on
// this list gracefully."


    TInt ret;
    if ((ret = input.Val(aErrorCode))!=KErrNone)
        if (ret!= KErrOverflow)
            User::Leave(KErrGeneral);
        else
// Gracefully handle unusually large, yet valid, MS-CHAP-V2 specific
// error code values.  This code only handles the MS-CHAP-V2 specific
// error code values specified in RFC 2759.
            aErrorCode=0;

    input.SkipSpace();

    if (input.Get() != 'R')
        User::Leave(KErrGeneral);

    if (input.Get() != '=')
        User::Leave(KErrGeneral);

    if (input.Val(aRetryFlag, EDecimal)!=KErrNone)
        User::Leave(KErrGeneral);

    input.SkipSpace();

    if (input.Get() != 'C')
        User::Leave(KErrGeneral);

    if (input.Get() != '=')
        User::Leave(KErrGeneral);

    TPtrC8 token(input.NextToken());
// This field is 32 hexadecimal digits representing an ASCII
// representation of a new challenge value.  Each octet is represented
// in 2 hexadecimal digits.
    if (token.Length() != KPppMsChap2AuthenticatorChallengeSize*2)
        User::Leave(KErrGeneral);

    TLex8 lex;
    TUint8 octet;
    TUint8* pChallengeOctet =
        const_cast<TUint8*>(aAuthChallenge.Ptr());
    TUint8 i = 0;
    do
    {
        lex.Assign(token.Mid(i*2, 2));
        if (lex.Val(octet, EHex) != KErrNone)
            User::Leave(KErrGeneral);

        *(pChallengeOctet + i) = octet;
    }
    while (++i < KPppMsChap2AuthenticatorChallengeSize);

    input.SkipSpace();

    if (input.Get() != 'V')
        User::Leave(KErrGeneral);

//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:101,代码来源:mschap2.cpp


示例15: ProcessFailureMessageL

inline void CPppMsChap::ProcessFailureMessageL(
					const TDesC8& aFailureMessage,
					TUint& aErrorCode, 
					TUint8& aRetryFlag, 
					TBool& aHasNewChallenge, 
					TDes8& aChallenge, 
					TUint8&	aPasswordProtoVersion)
/**
   Processes a MS-CHAP Failure Message.
   @param aFailureMessage [in] A MS-CHAP Failure Message.  The Failure
   Message needs to be in the format specified in RFC 2433:
   "E=eeeeeeeeee R=r C=cccccccccccccccc V=vvvvvvvvvv".
   @param aErrorCode [out] The MS-CHAP Failure error code.
   @param aRetryFlag [out] The retry flag.  The flag will be set to
   "1" if a retry is allowed, and "0" if not.  When the authenticator
   sets this flag to "1" it disables short timeouts, expecting the
   peer to prompt the user for new credentials and resubmit the
   response.
   @param aHasNewChallenge [out] The flag that indicates if the
   Failure Message contains a new Challenge Value.
   @param aChallenge [out] The new Challenge Value, if the Failure
   Message contains a one.
   @param aPasswordProtoVersion [out] The password changing protocol
   supported by the peer.
   @internalComponent
*/
	{
	ASSERT(aChallenge.Length() == KPppMsChapChallengeSize);
	
	TLex8 input(aFailureMessage);

	if (input.Get() != 'E')
		User::Leave(KErrGeneral);

	if (input.Get() != '=')
		User::Leave(KErrGeneral);


// RFC 2433: ""eeeeeeeeee" is the ASCII representation of a decimal
// error code (need not be 10 digits) corresponding to one of those
// listed below, though implementations should deal with codes not on
// this list gracefully."

	
	TInt ret;
	if ((ret = input.Val(aErrorCode)) != KErrNone)
		if (ret != KErrOverflow)
			User::Leave(KErrGeneral);
		else
// Gracefully handle unusually large, yet valid, MS-CHAP specific
// error code values.  This code only handles the MS-CHAP specific
// error code values specified in RFC 2433.
			aErrorCode=0;

	input.SkipSpace();

	if (input.Get() != 'R')
		User::Leave(KErrGeneral);

	if (input.Get() != '=')
		User::Leave(KErrGeneral);

	if (input.Val(aRetryFlag, EDecimal)!=KErrNone)
		User::Leave(KErrGeneral);

	input.SkipSpace();

	switch (input.Get())
		{
	case 'C':
		{		
		if (input.Get() != '=')
			User::Leave(KErrGeneral);

		TPtrC8 token(input.NextToken());
// This field is 16 hexadecimal digits representing an ASCII
// representation of a new challenge value.  Each octet is represented
// in 2 hexadecimal digits.
		if (token.Length() != KPppMsChapChallengeSize*2)
			User::Leave(KErrGeneral);

		TLex8 lex;
		TUint8 octet;
		TUint8* pChallengeOctet = 
			const_cast<TUint8*>(aChallenge.Ptr());
		TUint8 i = 0;
		do
			{
			lex.Assign(token.Mid(i*2, 2));
			if (lex.Val(octet, EHex) != KErrNone)
				User::Leave(KErrGeneral);

			*(pChallengeOctet + i) = octet;
			}
		while (++i < KPppMsChapChallengeSize);

		aHasNewChallenge = ETrue;

		input.SkipSpace();

//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,代码来源:MSCHAP.CPP


示例16: GetMdnThirdPartyId

 /**
  * Getter method to Get Mdn parameter
  */
 EXPORT_C void COMASuplThirdpartyId::GetMdnThirdPartyId(TDes8& aMdn)
     {
     if(aMdn.MaxLength() >= iMdn.Length())
         aMdn.Copy(iMdn);
     }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:8,代码来源:epos_comasuplstartver2.cpp


示例17: ChallengeResponseL

inline void CPppMsChap::ChallengeResponseL(const TDesC8& aChallenge,
					TDes8& aPaddablePasswordHash,
					TDes8& aResponse)
/**
   Computes the Challenge Response.
   @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   @param aPaddablePasswordHash [in/out] The hash of the password in a
   paddable buffer (16 octets in a buffer with at least 21 octets
   maximum length).
   @param aResponse [out] The Challenge Response (24 octets).
   @note This function implements the ChallengeResponse routine
   specified in RFC 2433.
   @internalComponent
*/
	{
	ASSERT(aChallenge.Length()==KPppMsChapChallengeSize);
	ASSERT(aPaddablePasswordHash.Length()==KPppMsChapHashSize &&
		aPaddablePasswordHash.MaxLength() >=
			KPppMsChapPaddedHashSize);
	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);

// aPaddablePasswordHash contains the hash of the password (16 octets)
// zero-padded to 21 octets

// RFC 2433 - ChallengeResponse(): "Set ZPasswordHash to
// PasswordHash zero-padded to 21 octets", i.e. 5 octets
	aPaddablePasswordHash.AppendFill(0, 
					KPppMsChapPaddedHashSize -
						KPppMsChapHashSize);

// The first 8 octets of aResponse
	TPtr8 responseChunk(const_cast<TUint8*>(aResponse.Ptr()),
				KPppDESKeySize, 
				KPppDESKeySize);
	DesEncryptL(aChallenge,
		aPaddablePasswordHash.Left(KPppMsChapDESKeySize),
		responseChunk);

// The second 8 octets of aResponse
	responseChunk.Set(const_cast<TUint8*>(aResponse.Ptr()) +
					KPppDESKeySize, 
			KPppDESKeySize,
			KPppDESKeySize);
  	DesEncryptL(aChallenge,
		aPaddablePasswordHash.Mid(KPppMsChapDESKeySize,
			KPppMsChapDESKeySize), 
		responseChunk);

// The third 8 octets of aResponse
	responseChunk.Set(const_cast<TUint8*>(aResponse.Ptr()) +
		2*KPppDESKeySize, KPppDESKeySize, KPppDESKeySize);
 	DesEncryptL(aChallenge,
		aPaddablePasswordHash.Mid(2*KPppMsChapDESKeySize,
			KPppMsChapDESKeySize),
		responseChunk);


// Restore the original length of the password hash
	aPaddablePasswordHash.SetLength(KPppMsChapHashSize);

	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:62,代码来源:MSCHAP.CPP


示例18: GetURI

 /**
  * Getter method to Get URI
  */
 EXPORT_C void COMASuplThirdpartyId::GetURI(TDes8& aURI)
     {
     if(iURI && aURI.MaxLength() >= iURI->Length())
         aURI.Copy(*iURI);
     }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:8,代码来源:epos_comasuplstartver2.cpp


示例19: IsEmpty

// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::IsEmpty
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::IsEmpty( TDes8& aBuffer, TInt aPos )
    {
    return ( aPos >= aBuffer.Length() );
    }   
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:9,代码来源:upnphttpchunkparser.cpp


示例20: GetLineStatus

TInt CTelephonyFunctions::GetLineStatus(const CTelephony::TPhoneLine& aLine, TDes8& aStatus)
/**
Get the current line status.
*/
	{
	TInt ret=KErrAccessDenied;
	
	if(IsFlightModeOn())
		{
		return KErrAccessDenied;
		}

	CTelephony::TCallStatusV1& CallStatusV1 = reinterpret_cast<CTelephony::TCallStatusV1&> ( const_cast<TUint8&> ( *aStatus.Ptr() ) );
	RMobileCall::TMobileCallStatus callStatus=RMobileCall::EStatusUnknown;

	switch(aLine)
	{
	case CTelephony::EVoiceLine:
		ret= iLineVoice.GetMobileLineStatus(callStatus);
		break;
	case CTelephony::EDataLine:
		if(iLineIsDataOpen)
			{
			ret= iLineData.GetMobileLineStatus(callStatus);
			}
		else
			{
			return KErrNotSupported;
			}
		break;
	case CTelephony::EFaxLine:
		if(iLineIsFaxOpen)
			{
			ret= iLineFax.GetMobileLineStatus(callStatus);
			}
		else
			{
			return KErrNotSupported;
			}
		break;
	default:
		return KErrNotFound;
	}
	GetCallStatus(callStatus, CallStatusV1.iStatus);
	return ret;
	}	
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:46,代码来源:TelephonyFuncLine.cpp



注:本文中的TDes8类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TDesC类代码示例发布时间:2022-05-31
下一篇:
C++ TDes16类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap