本文整理汇总了C++中TDes8::AppendFill方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::AppendFill方法的具体用法?C++ TDes8::AppendFill怎么用?C++ TDes8::AppendFill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes8
的用法示例。
在下文中一共展示了TDes8::AppendFill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// -----------------------------------------------------------------------------
// CG711PayloadFormatRead::DecodePayload
// Decodes all audio frames from the received RTP payload buffer. Decoded
// audio frames are saved to the internal array so that audio frames can be
// requested one at a time with GetNextFrame() -method.
// No assumption about frame count in RTP packet is done.
// -----------------------------------------------------------------------------
//
TInt CG711PayloadFormatRead::DecodePayload( TDes8& aSourceBuffer )
{
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload SourceBufSize: %d",
aSourceBuffer.Size() );
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload SourceBufLength: %d",
aSourceBuffer.Length() );
iFrameIndex = 0;
const TUint8* framePtr = aSourceBuffer.Ptr();
const TUint8* endPtr = aSourceBuffer.Ptr() + aSourceBuffer.Size();
TInt frames = aSourceBuffer.Size() / TInt( iCInfo.iFrameSize );
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload FrameSize: %d",
iCInfo.iFrameSize );
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload Frames: %d",
frames );
// Construct pointers to frames in payload if not in CN mode
if ( !iCnFrame )
{
while ( frames-- )
{
const TPtr8 bufPtr( const_cast<TUint8*>( framePtr ),
iCInfo.iFrameSize, iCInfo.iFrameSize );
iFrameArray.Append( bufPtr );
framePtr += iCInfo.iFrameSize;
if ( framePtr >= endPtr )
{
frames = 0;
}
}
}
else if ( aSourceBuffer.Size() && iCnFrame )
{
// If it is a CN frame, then we must do special handling. This is
// because e.g Cisco kit sends 1 byte CN frames, thus we need to
// expand the source buffer with zeroes.
TInt targetLen = iCInfo.iFrameSize;
targetLen = targetLen - aSourceBuffer.Size();
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload CN frame size adjust: %d",
targetLen );
const TChar zero( '0' );
aSourceBuffer.AppendFill( zero, targetLen );
const TPtr8 bufPtr( const_cast<TUint8*>( framePtr ),
iCInfo.iFrameSize, iCInfo.iFrameSize );
iFrameArray.Append( bufPtr );
}
return iFrameArray.Count();
}
示例2: 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);
}