/** Adds a filter to the session's filter queue. Note: This function only adds filters; it doesn't replace or otherwise affect any pre-existing filters. @pre The session is open and no transactions have been created yet. @param aFilter The filter to add @param aEvent The event that triggers this filter (or all) @param aHeader The header whose presence triggers this filter (or KNullDesC for any) @param aStatusCode The status code that triggers this filter (or -1 for all) @param aPosition The position of the filter in the queue. Standard values are documented in the documentation for the supplied filters, and are based on the standard defines in MHTTPFilter::TPositions @param aName the name of the Filter to add @see See MHTTPFilter::TPositions */ EXPORT_C void RHTTPFilterCollection::AddFilterL(MHTTPFilter& aFilter, THTTPEvent aEvent, RStringF aHeader, TInt aStatusCode, TInt aPosition, RStringF aName) { // You're only allowed to add filters if there aren't any transactions. __ASSERT_DEBUG(iImplementation->CanAddFilters(),HTTPPanic::Panic(HTTPPanic::EAddingFilterWithOutstandingTransactions)); // You're only allowed to add filters between the protocol handler // and the client __ASSERT_DEBUG(aPosition >= MHTTPFilter::EProtocolHandler && aPosition <= MHTTPFilter::EClient, HTTPPanic::Panic(HTTPPanic::EFilterInvalidPosition)); // Copy the strings for use by this filter. aHeader.Copy(); aName.Copy(); //In case Leave happens when inserting filter in array that has reference of above variables, //their reference count needs to be decremented. So push onto CleanupStack. CleanupClosePushL(aHeader); CleanupClosePushL(aName); THTTPFilterRegistration r(aFilter, aEvent, aHeader, aStatusCode, aPosition, aName, iImplementation->NextFilterHandle()); User::LeaveIfError(iImplementation->FilterQueue().InsertInSignedKeyOrderAllowRepeats(r)); CleanupStack::Pop(2); // aName, aHeader THTTPFilterHandle h; h.iValue = r.iHandle; aFilter.MHFLoad(Session(), h); }
// ----------------------------------------------------------------------------- // TSIPHeaderLookupEntry::TSIPHeaderLookupEntry // ----------------------------------------------------------------------------- // TSIPHeaderLookupEntry::TSIPHeaderLookupEntry (RStringF aName, RStringF aCompactName, RPointerArray<CSIPHeaderBase>(*aDecode)(const TDesC8&), CSIPHeaderBase*(*aInternalize)(RReadStream&)) : iName(aName.Copy()), iCompactName(aCompactName.Copy()), iDecodeFunction (aDecode), iInternalizeFunction(aInternalize) { }
// ----------------------------------------------------------------------------- // CSdpConnectionField::SetAddressL // Sets new address and types, leaves on error // ----------------------------------------------------------------------------- // EXPORT_C void CSdpConnectionField::SetAddressL( RStringF aNetType, RStringF aAddressType, const TDesC8& aAddress ) { __TEST_INVARIANT; TInt err( KErrNone ); RStringF netTypeBackup = iNetType.Copy(); RStringF addressTypeBackup = iAddressType.Copy(); CleanupClosePushL( netTypeBackup ); CleanupClosePushL( addressTypeBackup ); TRAP( err, CopyNetTypeL( aNetType.DesC() ) ); if ( !err ) { // Netowrk type changed successfully TRAP( err, CopyAddressTypeL( aAddressType.DesC() ) ); if ( !err ) { // Address type & network type changed successfully TRAP( err, CopyAddressL( aAddress, iAddressType.Pool() ) ); if ( err ) { // Place back old netType & address iNetType.Close(); iNetType = netTypeBackup.Copy(); iAddressType.Close(); iAddressType = addressTypeBackup.Copy(); User::LeaveIfError( err ); } // Everything changed succesfully } else { // Place back old netType iNetType.Close(); iNetType = netTypeBackup.Copy(); User::LeaveIfError( err ); } } else { User::LeaveIfError( err ); } CleanupStack::PopAndDestroy( 2 ); // netTypeBackup, addressTypeBackup }
// ---------------------------------------------------------------------------- // CSdpMediaField::SetMedia // ---------------------------------------------------------------------------- // EXPORT_C void CSdpMediaField::SetMediaL(RStringF aMedia) { __ASSERT_ALWAYS(SdpUtil::IsTokenChar(aMedia.DesC()), User::Leave(KErrSdpCodecMediaField)); iMedia.Close(); iMedia = aMedia.Copy(); }
// ----------------------------------------------------------------------------- // CSIPRequestElements::SetMethodL // ----------------------------------------------------------------------------- // EXPORT_C void CSIPRequestElements::SetMethodL(RStringF aMethod) { __ASSERT_ALWAYS (aMethod.DesC().Length() > 0, User::Leave(KErrArgument)); iMethod.Close(); iMethod = aMethod.Copy(); }
// ---------------------------------------------------------------------------- // CSdpMediaField::ConstructL // ---------------------------------------------------------------------------- // void CSdpMediaField::ConstructL(RStringF aMedia, TUint aPort, RStringF aProtocol, const TDesC8& aFormatList) { __ASSERT_ALWAYS(SdpUtil::IsTokenChar(aMedia.DesC()) && (aPort== 0 || (aPort >= 1024 && aPort <= 65535)) && SdpUtil::IsTokenCharWithOptionalSlash(aProtocol.DesC()) && SdpUtil::IsTokenCharWithSpacesL(aFormatList), User::Leave(KErrArgument)); ConstructL(); iMedia = aMedia.Copy(); iProtocol = aProtocol.Copy(); SetPortL(aPort); delete iFormatList; iFormatList = 0; iFormatList = aFormatList.AllocL(); }
// ----------------------------------------------------------------------------- // CTransactionItemBase::CTransactionItemBase // ----------------------------------------------------------------------------- // CTransactionItemBase::CTransactionItemBase (TTransactionId aTransactionId, RStringF aMethod) : iTerminate(EFalse), iPassResponseToOwner(ETrue), iTransactionId (aTransactionId) { iMethod = aMethod.Copy(); }
// ----------------------------------------------------------------------------- // CSdpOriginField::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CSdpOriginField::ConstructL( const TDesC8& aUserName, TInt64 aSessionId, TInt64 aSessionVersion, RStringF aNetType, RStringF aAddressType, const TDesC8& aAddress ) { iPool = SdpCodecStringPool::StringPoolL(); __ASSERT_ALWAYS( IsValidUserName( aUserName ) && IsValidAddress( aAddress ) && TypeMatchesWithFormat( aAddress, aAddressType.DesC(), iPool ) && ( SdpUtil::IsToken( aNetType.DesC() ) ) && ( SdpUtil::IsToken( aAddressType.DesC() ) ) && aSessionId >= 0 && aSessionVersion >= 0, User::Leave( KErrSdpCodecOriginField ) ); iUserName = reinterpret_cast< HBufC8* > ( CSdpOriginFieldPtrs::NewL( aSessionId, aSessionVersion ) ); OriginFieldPtrs().SetUserNameL( aUserName ); iNetType = aNetType.Copy(); TInetAddr addr; TBuf<KMaxAddressLength> address; address.Copy(aAddress); TInt err = addr.Input(address); if ( err == KErrNone ) { // Valid IP address TBuf< KMaxIPDesLength > buf; addr.Output( buf ); iAddress.Copy( buf ); SetIPAddressType( addr ); } else { iAddress = aAddress; iAddressType = aAddressType.Copy(); } __TEST_INVARIANT; }
// ---------------------------------------------------------------------------- // CSdpMediaField::SetProtocol // ---------------------------------------------------------------------------- // EXPORT_C void CSdpMediaField::SetProtocolL(RStringF aProtocol) { __ASSERT_ALWAYS(SdpUtil::IsTokenCharWithOptionalSlash(aProtocol.DesC()), User::Leave(KErrSdpCodecMediaField)); if (aProtocol == iPool.StringF( SdpCodecStringConstants::EProtocolUdp, SdpCodecStringConstants::Table )) { __ASSERT_ALWAYS((iPort == 0 || (iPort >= 1024 && iPort <= 65535)), User::Leave(KErrSdpCodecMediaField)); } iProtocol.Close(); iProtocol = aProtocol.Copy(); }
void CNwssConnectGuard::ReceivedMethodInvokeReqL( MWspCOMethodCallback& aMethodCallback, RStringF aMethod, const TUriC8& aRequestUri, const TDesC8& aRequestHeaders, const TDesC8& aRequestBody ) { if( iMethodCallback ) { // Have already got method info - leave as this is not allowed. User::Leave(KErrAlreadyExists); } iMethodCallback = &aMethodCallback; iMethod = aMethod.Copy(); iRequestUri = CUri8::NewL(aRequestUri); iRequestHeaders = aRequestHeaders.AllocL(); iRequestBody = aRequestBody.AllocL(); }
// ----------------------------------------------------------------------------- // CSIPTransactionBase::ConstructL // ----------------------------------------------------------------------------- // void CSIPTransactionBase::ConstructL(RStringF aType) { SIPStrings::OpenL(); iState = ETrying; iType = aType.Copy(); if (iType == SIPStrings::StringF(SipStrConsts::EInvite)) { if (iIsClientTransaction) { iState = ECalling; } else { iState = EProceeding; } } iAssociation->AddTransactionL(*this); }
// ----------------------------------------------------------------------------- // CSdpOriginField::SetAddressL // Sets address from the buffer // ----------------------------------------------------------------------------- // EXPORT_C void CSdpOriginField::SetAddressL( const TDesC8& aAddress, RStringF aNetType, RStringF aAddressType ) { __TEST_INVARIANT; __ASSERT_ALWAYS( SdpUtil::IsToken( aNetType.DesC() ) && SdpUtil::IsToken( aAddressType.DesC() ) && IsValidAddress( aAddress ) && TypeMatchesWithFormat( aAddress, aAddressType.DesC(), iPool ), User::Leave( KErrSdpCodecOriginField ) ); iAddress = aAddress; iAddressType.Close(); iAddressType = aAddressType.Copy(); __TEST_INVARIANT; }