本文整理汇总了C++中TLex8类的典型用法代码示例。如果您正苦于以下问题:C++ TLex8类的具体用法?C++ TLex8怎么用?C++ TLex8使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLex8类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetFieldName
// -----------------------------------------------------------------------------
// CWPPushMessage::GetFieldName
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetFieldName( TLex8& aPointer ) const
{
// Field name can be a short integer or text.
TUint result( 0 );
if( !aPointer.Eos() )
{
TUint first( aPointer.Peek() );
if( first > KShortIntegerMask )
{
result = GetShortInteger( aPointer );
}
else
{
// Only well-known fields are read
GetTokenText( aPointer );
}
}
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:26,代码来源:CWPPushMessage.cpp
示例2: GetIntegerValue
// -----------------------------------------------------------------------------
// CWPPushMessage::GetIntegerValue
// -----------------------------------------------------------------------------
//
TInt64 CWPPushMessage::GetIntegerValue( TLex8& aPointer ) const
{
// Integer value can be a short integer or a long integer.
// Short integer is always >KShortIntegerMask.
TInt64 result( 0 );
if( !aPointer.Eos() )
{
TUint first( aPointer.Peek() );
if( first > KShortIntegerMask )
{
result = GetShortInteger( aPointer );
}
else
{
result = GetLongInteger( aPointer );
}
}
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:26,代码来源:CWPPushMessage.cpp
示例3: GetInfoIndex
OMX_ERRORTYPE
CBellagioOpenMaxSymbianLoader::GetRolesOfComponent(OMX_STRING compName,
OMX_U32 *pNumRoles,
OMX_U8 **roles)
{
TInt index = 0;
index = GetInfoIndex(compName);
if (index < 0)
{
return OMX_ErrorComponentNotFound;
}
TLex8 lexer = TLex8((componentInfos[index])->OpaqueData());
lexer.Val((TUint32 &)(*pNumRoles), EDecimal);
if((*pNumRoles) == 0)
{
return OMX_ErrorNone;
}
// check if client is asking only for the number of roles
if (roles == NULL)
{
return OMX_ErrorNone;
}
// TODO We copy only one role here and there might be several of those
TBuf8<257> role;
TBufC8<1> endOfString((TText8*)"\0");
role.Append((componentInfos[index])->DataType());
role.Append(endOfString);
strcpy((char*)roles[0], (char*)role.Ptr());
return OMX_ErrorNone;
}
开发者ID:allenk,项目名称:libomxil-bellagio,代码行数:39,代码来源:BellagioOpenMaxSymbianLoader.cpp
示例4: GetConstrainedEncoding
// -----------------------------------------------------------------------------
// CWPPushMessage::GetConstrainedEncoding
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetConstrainedEncoding( TLex8& aPointer ) const
{
// Constrained encoding can be extension media or short integer
TUint result( 0 );
if( !aPointer.Eos() )
{
TUint first( aPointer.Peek() );
if( first > KShortIntegerMask )
{
result = GetShortInteger( aPointer );
}
else
{
// Just skip the text version
GetTokenText( aPointer );
}
}
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:26,代码来源:CWPPushMessage.cpp
示例5: SkipAndCheckContChars
// -----------------------------------------------------------------------------
// NATFWUNSAFUtils::SkipAndCheckContChars
// -----------------------------------------------------------------------------
//
TBool NATFWUNSAFUtils::SkipAndCheckContChars(TLex8& aLex, TInt aCount)
{
TInt counter = 0;
TChar chr = 0;
while (aCount > counter++)
{
chr = aLex.Get();
if (IsUTF8ContChar(chr))
{
return EFalse;
}
}
return ETrue;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:18,代码来源:natfwunsafutils.cpp
示例6: IsNewComment
TBool CTestConfig::IsNewComment(const TDesC8& aSource, const TLex8& aLex) const
{
TBool ret(EFalse);
const TPtrC8 token(aLex.MarkedToken());
const TPtrC8 commentStart(KScriptCommentStart);
const TInt commentStartLen(commentStart.Length());
const TInt tokenLen(token.Length());
if (commentStartLen <= tokenLen && token.Left(commentStartLen).Compare(commentStart) == 0)
{
ret = IsAtStartOfNewLine(aSource, aLex, ETrue);
}
return ret;
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:16,代码来源:testconfigfile.cpp
示例7: ReadTestFile
TBool CLinePaginatorTest::ReadTestFile(TPageLine& aLine)
{
TLex8 lex;
TBuf8<128> textBuffer;
TBuf8<128> numBuffer;
TInt startNum;
iTestFile.Read(iFilePos,textBuffer,128);
if (textBuffer.Locate('X') != KErrNotFound && textBuffer.Locate('X') < textBuffer.Locate('\r'))
{
startNum=textBuffer.Locate('\n')+1;
textBuffer.Delete(0,startNum);
iFilePos+=startNum;
lex=textBuffer;
lex.Val(aLine.iDocPos);
TBuf<254> buf;
buf.AppendFormat(_L("%d\tX\n"), aLine.iDocPos);
TESTPRINT(buf);
return EFalse;
}
startNum=textBuffer.Locate('\n')+1;
textBuffer.Delete(0,startNum);
iFilePos+=startNum;
lex=textBuffer;
lex.Val(aLine.iDocPos);
startNum=textBuffer.Locate('\t')+1;
textBuffer.Delete(0,startNum);
iFilePos+=startNum;
lex=textBuffer;
lex.Val(aLine.iLineHeight);
startNum=textBuffer.Locate('\t')+1;
textBuffer.Delete(0,startNum);
iFilePos+=startNum;
lex=textBuffer;
lex.Val(aLine.iKeepWithNext);
startNum=textBuffer.Locate('\t')+1;
textBuffer.Delete(0,startNum);
iFilePos+=startNum;
lex=textBuffer;
lex.Val(aLine.iStartNewPage);
if (textBuffer.Locate('\t')<textBuffer.Locate('\r')
&& textBuffer.Locate('B')!=KErrNotFound
&& textBuffer.Locate('B')<textBuffer.Locate('\r'))
iTestPageBreak=ETrue;
else
iTestPageBreak=EFalse;
iFilePos+=textBuffer.Locate('\r')+1;
return ETrue;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:TLINEPAG.CPP
示例8: GetNextElement
TInt CTestConfig::GetNextElement(TLex8& aInput, TChar aDelimiter, TPtrC8& aOutput)
{
if (aInput.Eos())
return KErrNotFound;
//Get to the start of the descriptor
while (!aInput.Eos() && aInput.Peek() != aDelimiter)
aInput.Inc();
aOutput.Set(aInput.MarkedToken());
if (!aInput.Eos())
aInput.SkipAndMark(1);
return KErrNone;
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:15,代码来源:testconfigfile.cpp
示例9: GetTextString
// -----------------------------------------------------------------------------
// CWPPushMessage::GetTextString
// -----------------------------------------------------------------------------
//
TPtrC8 CWPPushMessage::GetTextString( TLex8& aPointer ) const
{
// Text-string can be quoted.
if( aPointer.Peek() == KQuotedTextStringStart )
{
aPointer.Inc();
}
aPointer.Mark();
while( aPointer.Get() != EKeyNull )
{
// Nothing
}
// We don't want to have NULL in the resulting descriptor, so
// back that out.
aPointer.UnGet();
TPtrC8 result( aPointer.MarkedToken() );
aPointer.Inc();
return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:25,代码来源:CWPPushMessage.cpp
示例10: INFO_PRINTF1
TVerdict CSendSmsAndCancel::doTestStepL( void )
{
TInt i;
TRequestStatus status;
INFO_PRINTF1(_L("Sending SMS and cancelling."));
// Create message PDU and convert to binary
_LIT8(KMsgDataBeforeTargetAddress,"1d00");
_LIT8(KMsgDataAfterTargetAddress,"01A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A001A0");
TBuf8<400> msgData;
TLex8 lex;
TUint8 val;
msgData.Zero();
const TInt count_before((&KMsgDataBeforeTargetAddress)->Length()/2); // Assume length of pdu is always even
for(i=0;i<count_before;++i)
{
lex=(&KMsgDataBeforeTargetAddress)->Mid(i*2,2);
TESTL(KErrNone == lex.Val(val,EHex));
msgData.Append(TChar(val));
}
TBuf8<20> targetAddressAscii;
targetAddressAscii.Zero();
RMobilePhone::TMobileAddress targetAddress;
targetAddress.iTypeOfNumber=RMobilePhone::EInternationalNumber;
targetAddress.iNumberPlan=RMobilePhone::EIsdnNumberPlan;
targetAddress.iTelNumber.Copy(iTelNumber);
TInt ret = CATSmsUtils::AppendAddressToAscii(targetAddressAscii,targetAddress);
if(ret) return(EFail);
const TInt count_address(targetAddressAscii.Length()/2); // Assume length is always even
for(i=0;i<count_address;++i)
{
lex=targetAddressAscii.Mid(i*2,2);
lex.Val(val,EHex);
msgData.Append(TChar(val));
}
const TInt count_after((&KMsgDataAfterTargetAddress)->Length()/2); // Assume length of pdu is always even
for(i=0;i<count_after;++i)
{
lex=(&KMsgDataAfterTargetAddress)->Mid(i*2,2);
lex.Val(val,EHex);
msgData.Append(TChar(val));
}
// Create message attibutes
RMobileSmsMessaging::TMobileSmsSendAttributesV1 msgAttr;
msgAttr.iFlags=0x184;
msgAttr.iDataFormat=RMobileSmsMessaging::EFormatGsmTpdu;
msgAttr.iGsmServiceCentre.iTypeOfNumber=RMobilePhone::EInternationalNumber;
msgAttr.iGsmServiceCentre.iNumberPlan=RMobilePhone::EIsdnNumberPlan;
msgAttr.iGsmServiceCentre.iTelNumber.Copy(iSCANumber);
// Package up data ready for sending to etel
RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg msgAttrPkg(msgAttr);
// Send the message
INFO_PRINTF1(_L(".."));
TSmsPdu smsPduSent;
smsPduSent.Copy(KTestSendPduA,sizeof(KTestSendPduA));
iSms.SendMessage(status,smsPduSent,msgAttrPkg);
// Wait for a bit
User::After(KOneSecond*2);
// Cancel sending, then wait for sending operation to complete
iSms.CancelAsyncRequest(EMobileSmsMessagingSendMessage);
//if(status==KRequestPending)
User::WaitForRequest(status);
ret=KErrNone;
if(status!=KErrCancel && status!=KErrNone)
ret=status.Int();
else
INFO_PRINTF1(_L("TESTL(s) passed")); // If we don't cause a panic or leave the test has passed
/* iSms.Close();
iPhone->Close();
User::After(500000L);
iPhone.Open(iTelServer,GSM_NAME);
iSms.Open(iPhone);
*/
return TestStepResult();
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:92,代码来源:Te_SimSms.cpp
示例11: ptr
/**
* After the player has received the update after the last iteration of the game.
* We want to display the current game status, if there is only one player remaining then
* the game has finished.
*/
void CScabbyQueenPlayer::ReceiveNextRole()
{
if (iPlayerUpdate == iGameOverBuffer)
{
iConsole.Printf(_L("\nDealer Says: GAME OVER"));
}
else
{
// Break down the update descriptor and display the result
TBufC<20> buffer;
buffer.Des().Copy(iPlayerUpdate);
iConsole.Printf(_L("\n\nUpdate from the dealer...%S\n"), &buffer);
TInt position;
TPtrC8 ptr(iPlayerUpdate);
TLex8 lex;
TInt player;
TBool stillIn = EFalse;
iConsole.Printf(_L("\n Number of players: %d\n"), iPlayerUpdate.Length()-1);
TInt stillInCount = 0;
for (TInt i=0; i<iPlayerUpdate.Length();i++)
{
TChar inspect = ptr[i];
if (inspect != 'F')
{
TBuf8<2> buff;
buff.Append(inspect);
lex.Assign(buff);
lex.Val(player);
if (stillIn)
{
TBufC16<2> buff;
buff.Des().Append(inspect);
iConsole.Printf(_L("\n Player %S still in play"), &buff);
stillInCount++;
}
else
{
position = i+1;
if (i == 0)
{
iConsole.Printf(_L("\n The winner is player %d"), player);
}
else
{
iConsole.Printf(_L("\n In position %d is player %d"), position, player);
}
}
}
else
{
stillIn = ETrue;
}
}
if (stillInCount == 1)
{
// If there is only one player left the game is over.
iGameOver = ETrue;
iConsole.Printf(_L("\nThe loser is player %d, give them a smack"), player);
iConsole.Printf(_L("\n\nDealer Says: GAME OVER"));
}
iGameStatus = EReadyForToken;
iSendMode = ESendReadyForToken;
BaseSendTo(iGameStatus, KDealerIpAddr);
}
}
开发者ID:huellif,项目名称:symbian-example,代码行数:75,代码来源:player.cpp
示例12: ASSERT
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
示例13: DLTRACEIN
// ---------------------------------------------------------------------------
// Received a response header
// ---------------------------------------------------------------------------
//
void CCatalogsHttpTransaction::ResponseHeaderReceived( const TDesC8& aHeader,
const TDesC8& aValue )
{
DLTRACEIN( ("") );
DASSERT( iObserver );
TRAPD( err, iResponseHeaders->AddHeaderL( aHeader, aValue ) );
if ( err != KErrNone )
{
HandleHttpError( ECatalogsHttpErrorGeneral, err );
return;
}
iState.iOperationState = ECatalogsHttpOpInProgress;
iState.iProgressState = ECatalogsHttpResponseHeaderReceived;
if ( aHeader.CompareF( KHttpContentRangeHeader ) == 0 )
{
//
// Content-Range, bytes x-y/z
// Extract 'z' and use it as the total content length
//
TPtrC8 ptr( aValue );
TInt offset = ptr.Locate( '/' );
if ( offset != KErrNotFound )
{
TLex8 val;
val.Assign( ptr.Mid( offset + 1 ) );
TInt value;
TInt err = val.Val( value );
if ( err == KErrNone )
{
iContentLength = value;
DLTRACE(( "Content length: %i", iContentLength ));
}
}
}
else if ( aHeader.CompareF( KHttpContentLengthHeader ) == 0 )
{
//
// If content length for this request has not been already set
// e.g. from a Content-Range header, extract from Content-Length header
//
if ( iContentLength == 0 )
{
TLex8 val;
val.Assign( aValue );
TInt value;
TInt err = val.Val( value );
if ( err == KErrNone )
{
iContentLength = value;
DLTRACE(( "Content length: %i", iContentLength ));
}
}
else
{
DLTRACE(( "-> ContentLength set, ignoring" ));
}
}
else if ( aHeader.CompareF( KHttpContentTypeHeader ) == 0 )
{
// Content type from the header
DLTRACE( ( "Content type received" ) );
TRAPD( err, SetContentTypeL( aValue ) );
if ( err != KErrNone )
{
DLTRACE( ( "Content type setting failed with err: %i",
err ) );
HandleHttpError( ECatalogsHttpErrorGeneral, err );
return;
}
else
{
iState.iProgressState = ECatalogsHttpContentTypeReceived;
}
}
// Report the observer that a header has been received
NotifyObserver();
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:89,代码来源:catalogshttptransaction.cpp
示例14: ReadConfigFileL
// Function to read a line from a buffer
GLDEF_C void ReadConfigFileL(RFile& aConfigFile, TListeners& aListeners, RSocketServ& aSocketServ, RConnection& aConnect)
{
TInt fileLen;
User::LeaveIfError(aConfigFile.Size(fileLen));
HBufC8* readBuffer = HBufC8::NewL(fileLen);
CleanupStack::PushL(readBuffer);
TPtr8 buff = readBuffer->Des();
// Read File
// Here, we read the whole file as we know it's small
TRequestStatus status;
aConfigFile.Read(buff, status);
User::WaitForRequest(status);
if(status.Int() != KErrNone && status.Int() != KErrEof)
{
User::LeaveIfError(status.Int());
}
HBufC8* tempBuffer = HBufC8::NewL(KLineSize);
CleanupStack::PushL(tempBuffer);
TPtr8 lineBuff = tempBuffer->Des();
TLex8 lex;
lex.Assign(buff);
/* Parse whole stream in to split it in lines
We discard commented line with #
*/
TBool error = EFalse;
while(!lex.Eos() && !error)
{
TBool comment = EFalse;
if(lex.Peek() == '#')
{
// We've got a comment
comment = ETrue;
}
TInt nbCharRead = 0; // To count number of character per line. Used to avoid a buffer overflow
while(!error && !lex.Eos() && lex.Peek() != '\r' && lex.Peek() != '\n')
{
// We look if we are allowed to append character. Otherwise we stop loopping.
if(nbCharRead < KLineSize)
{
lineBuff.Append(lex.Get());
nbCharRead++;
}
else
{
error = ETrue;
}
}
if(!comment)
{
// We create a new listener
TInt nbListeners = aListeners.Count();
if(nbListeners < KNbListeners)
{
aListeners.Append(CListener::NewL(aSocketServ, aConnect, CListenerOptions::NewL(lineBuff)));
aListeners[nbListeners]->AcceptL();
}
}
lineBuff.Zero();
if(lex.Peek() == '\r')
{
lex.Get(); // Get rid of \r
}
lex.Get(); // Get rid of \n
}
// Delete buffers
CleanupStack::PopAndDestroy(tempBuffer);
CleanupStack::PopAndDestroy(readBuffer);
if(error)
{
// We have a bad line in our configuration file so we delete all listeners
aListeners.ResetAndDestroy();
}
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:80,代码来源:INETD.CPP
示例15: ChopElementsFromLineL
// ---------------------------------------------------------------------------
// SdpUtil::ChopElementsFromLineL
// Chops all the elements that are divided by delimiter from the string
// ---------------------------------------------------------------------------
//
void SdpUtil::ChopElementsFromLineL(
RArray<TPtrC8>& aArray,
TLex8& aLexer,
TChar aDelimiter,
TInt aErrCode )
{
// Chop the elements to the array from lexer
TBool eofcFound = EFalse;
while (!eofcFound)
{
aLexer.Mark();
// Parse single token, leave other special characters
// to token except aDelimiter | '\r' | '\n' | '\0'
while ( aLexer.Peek() != aDelimiter &&
aLexer.Peek() != KCRChar &&
aLexer.Peek() != KLFChar &&
aLexer.Peek() != KEofChar )
{
aLexer.Inc();
}
if ( aLexer.MarkedToken().Length() > 0 )
{
aArray.AppendL( aLexer.MarkedToken() );
}
if ( aDelimiter == KSPChar &&
aLexer.Peek() == aDelimiter )
{
SkipSpacesUntilNextLineBreak( aLexer );
}
// Check if its end-of-line
if ( aLexer.Peek() == KCRChar )
{
aLexer.Inc();
}
if ( aLexer.Peek() == KLFChar )
{
aLexer.Inc();
if ( aLexer.Peek() != KEofChar )
{
User::Leave( aErrCode );
}
eofcFound = ETrue;
}
else if ( aLexer.Peek() == KEofChar )
{
// EoF character not tolerated at the middle of the string
User::Leave( aErrCode );
}
else
{
aLexer.Inc();
}
}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:63,代码来源:sdputil.cpp
示例16: ASSERT
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
示例17: lexer
// -----------------------------------------------------------------------------
// CSeiForwardPlugin::HandleNotifyL
//
// -----------------------------------------------------------------------------
//
void CSeiForwardPlugin::HandleNotifyL( const CEcmtMessageEvent& aEvent )
{
const TPtrC8 m = iMessaging->Message( aEvent );
TLex8 lexer( m );
TPtrC8 type = lexer.NextToken();
TPtrC8 channelStr = lexer.NextToken();
TLex8 num ( channelStr );
TInt channel;
// Check message type
if ( ( type != KConnect ) &&
( type != KListen ) &&
( type != KMsg ) )
{
RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid message" ) );
return;
}
// Get channel number
if ( num.Val( channel ) )
{
RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid channel" ) );
return;
}
// Process message
if ( type == KConnect )
{
TPtrC8 portStr = lexer.NextToken();
TInt port;
num.Assign ( portStr );
// Get port number
if ( num.Val( port ) )
{
RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid port" ) );
return;
}
ConnectL( channel, port );
}
else if ( type == KListen )
{
ListenL( channel );
}
else if ( type == KMsg )
{
// Now this just sends the message back to the Java plug-in.
// Instead, should cancel the appropriate socket read and write
// the message to the socket.
TPtrC8 msg = lexer.Remainder();
SendMessageL( channel, msg );
}
}
开发者ID:fedor4ever,项目名称:packaging,代码行数:67,代码来源:EcmtSeiForwardPlugin.cpp
示例18: GetShortInteger
// -----------------------------------------------------------------------------
// CWPPushMessage::GetShortInteger
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetShortInteger( TLex8& aPointer ) const
{
return aPointer.Get() & KShortIntegerMask;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:8,代码来源:CWPPushMessage.cpp
示例19: EncodeL
void CDomainNameCodec::EncodeL(TDomainNameArray& aNames, RBuf8& aBuf8)
{
TUint requiredLength = 0;
TUint8 nameIdx = 0;
for (nameIdx=0;nameIdx<aNames.Count();nameIdx++)
{
// The total length required for the labels that comprise an
// individual domain name needs to take into the length octet
// for the initial label and the null-termination character.
// Hence the '+ 2' below.
requiredLength += (aNames[nameIdx].Length() + 2);
// A further length check is performed on each domain name to
// ensure it does not exceed the maximum length permitted according
// to RFC 1035.
if(aNames[nameIdx].Length() > KMaxDomainNameLength)
{
User::Leave(KErrArgument);
}
}
aBuf8.Zero();
aBuf8.ReAllocL(requiredLength);
TLex8 domainName;
TPtrC8 currentLabel;
for (nameIdx=0;nameIdx<aNames.Count();nameIdx++)
{
domainName.Assign(aNames[nameIdx]);
domainName.Mark();
while (!domainName.Eos())
{
TChar ch;
do
{
ch = domainName.Get();
}
while ( ch != TChar('.') && !domainName.Eos() );
// if not the end of the string, unget the previous char to skip the trailing
// dot in our marked token
//
if( !domainName.Eos() )
{
domainName.UnGet();
}
currentLabel.Set(domainName.MarkedToken());
// move past the dot again, or do nothing in particular at EOS
//
domainName.Get();
User::LeaveIfError(currentLabel.Length() > KMaxDnsLabelLength ?
KErrArgument : KErrNone);
aBuf8.Append(TChar(currentLabel.Length()));
aBuf8.Append(currentLabel);
domainName.Mark();
}
aBuf8.Append(TChar(0));
}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:68,代码来源:DomainNameDecoder.cpp
示例20: _L
// -----------------------------------------------------------------------------
// CEcmtPanPlugin::SendCurrentValues
//
// -----------------------------------------------------------------------------
//
void CEcmtPanPlugin::SendCurrentValuesL( )
{
#ifdef ECMT_RDEBUG
RDebug::Print( _L( "EcmtPanPlugin::SendCurrentValuesL" ) );
#endif
TBuf<KMaxWin32Path> buf;
TBuf8<KMaxPanMsgLen> msg;
TPtrC8 line;
TLex8 lexer;
/*
* Handle bt.esk
*/
GetBtEskFilename( buf );
REcmtFile btFile( buf );
btFile.Read();
if ( !btFile.IsGood() )
{
return;
}
line.Set( btFile.FindLine( KBtPort ) );
if ( line.Length() == 0 )
{
return;
}
msg.Append( KBtCom );
msg.Append( ' ' );
lexer.Assign( line );
lexer.SkipCharacters();
msg.Append( lexer.NextToken() );
msg.Append( ' ' );
line.Set( btFile.FindLine( KHciDll ) );
if ( line.Length() == 0 )
{
return;
}
msg.Append( KHci );
msg.Append( ' ' );
lexer.Assign( line );
lexer.SkipCharacters();
TPtrC8 dll( lexer.NextToken() );
if ( dll.CompareF( KHciDllBcsp ) == 0 )
{
msg.Append( '0' );
}
else if ( dll.CompareF( KHciDllH4 ) == 0 )
{
msg.Append( '1' );
}
else if ( dll.CompareF( KHciDllUsb ) == 0 )
{
msg.Append( '2' );
}
else
{
msg.Append( '-1' );
}
/*
* Handle irda.esk
*/
GetIrdaEskFilename( buf );
REcmtFile irdaFile( buf );
irdaFile.Read();
if ( !irdaFile.IsGood() )
{
return;
}
line.Set( irdaFile.FindLine( KIrdaPort ) );
if ( line.Length() == 0 )
{
return;
}
msg.Append( ' ' );
msg.Append( KIrdaCom );
msg.Append( ' ' );
lexer.Assign( line );
lexer.SkipCharacters();
msg.Append( lexer.NextToken() );
/*
* Send values
*/
CEcmtMessageEvent* m = iMessaging->NewMessageEvent( iTargetUid, msg );
if ( m )
//.........这里部分代码省略.........
开发者ID:fedor4ever,项目名称:packaging,代码行数:101,代码来源:EcmtPanPlugin.cpp
注:本文中的TLex8类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论