This release addresses the following issues:
1. The crash bug fix when receiving file
2. Now the sending is based on MSRP messages, there is no longer file receiving or sending. Client sends data as MSRP was designed.
3. Soma MSRP stack was created so that the client told the correct session-id, Symbian stack generated it by itself. This is not allowed, it was changed so that clients tell the session-id (same as used in SIP INVITE).
4. Unnecessary division of data to chunks removed when there is no need to interrupt sending. The message is sent in as few chunks as possible.
5. Stack can now receive files and chunks with ?unlimited? size. Old stack wrote the incoming data to memory and did not utilize disk space until the end of chunk was reached (large chunks from another client crashed it).
6. Now when writing the incoming data to file, it will take into account the byte-range header values. So, this complies with the RFC4975 requirements that stack must be able to handle chunks that come in any sequence.
7. Some buffering changes to outgoing/incoming data.
8. The outgoing data is now checked that it does not contain the created transaction-id before sending the data.
9. MSRP success reports are now implemented and tested against servers.
10. Progress report system fixed so progress is now visible on client (all the way to 100%).
11. Message Cancel receiving / Cancel sending now corrected and made to work as rfc4975 requires. (termination from sender and error code from receiver when cancelling).
12. Bug correction related to messages received not belonging to any session, old stack implementation did send error response, but after response was written it did give the buffer to client anyway. Now corrected.
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// Name : SIPRefresh.cpp
// Part of : SIPAPI
// Version : SIP/4.0
//
#include "sipdefs.h"
#include "siperr.h"
#include "SipAssert.h"
#include "sipstrings.h"
#include "sipclientconnection.h"
#include "siprefresh.h"
#include "sipclienttransaction.h"
#include "siprefreshassociation.h"
#include "transactionassociation.h"
#ifdef CPPUNIT_TEST
#include "TestCleanupStack.h"
#undef EXPORT_C
#define EXPORT_C
#endif
// -----------------------------------------------------------------------------
// CSIPRefresh::NewL
// -----------------------------------------------------------------------------
//
EXPORT_C CSIPRefresh* CSIPRefresh::NewL()
{
CSIPRefresh* self = CSIPRefresh::NewLC();
CleanupStack::Pop(self);
return self;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::NewLC
// -----------------------------------------------------------------------------
//
EXPORT_C CSIPRefresh* CSIPRefresh::NewLC()
{
CSIPRefresh* self = new (ELeave) CSIPRefresh();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::CSIPRefresh
// -----------------------------------------------------------------------------
//
CSIPRefresh::CSIPRefresh() : iState(EConstructing)
{
}
// -----------------------------------------------------------------------------
// CSIPRefresh::ConstructL
// -----------------------------------------------------------------------------
//
void CSIPRefresh::ConstructL()
{
SIPStrings::OpenL();
iState = EInactive;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::~CSIPRefresh
// If iState is EConstructing, string pool was not opened.
// -----------------------------------------------------------------------------
//
EXPORT_C CSIPRefresh::~CSIPRefresh()
{
if (iClientTransaction)
{
iClientTransaction->RemoveRefresh();
}
if (iOwner)
{
iOwner->DeletingRefresh(*this, iRefreshId);
}
iRequestType.Close();
if (iState != EConstructing)
{
SIPStrings::Close();
}
}
// -----------------------------------------------------------------------------
// CSIPRefresh::State
// -----------------------------------------------------------------------------
//
EXPORT_C CSIPRefresh::TState CSIPRefresh::State() const
{
return iState;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::IsStandAlone
// -----------------------------------------------------------------------------
//
EXPORT_C TBool CSIPRefresh::IsStandAlone() const
{
return iOwner && (iOwner->CheckIfStandAlone() == KErrNone);
}
// -----------------------------------------------------------------------------
// CSIPRefresh::SIPTransaction
// -----------------------------------------------------------------------------
//
EXPORT_C const CSIPClientTransaction* CSIPRefresh::SIPTransaction() const
{
return iClientTransaction;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::TerminateL
// No need to check if this is a standalone refresh, as UpdateRefreshL leaves
// with the proper error if this refresh isn't standalone.
// -----------------------------------------------------------------------------
//
EXPORT_C CSIPClientTransaction*
CSIPRefresh::TerminateL(CSIPMessageElements* aElements)
{
CheckStateL();
return iOwner->UpdateRefreshL(*this, aElements, ETrue);
}
// -----------------------------------------------------------------------------
// CSIPRefresh::UpdateL
// No need to check if this is a standalone refresh, as UpdateRefreshL leaves
// with the proper error if this refresh isn't standalone.
// -----------------------------------------------------------------------------
//
EXPORT_C CSIPClientTransaction*
CSIPRefresh::UpdateL(CSIPMessageElements* aElements)
{
CheckStateL();
return iOwner->UpdateRefreshL(*this, aElements, EFalse);
}
// -----------------------------------------------------------------------------
// CSIPRefresh::operator==
// -----------------------------------------------------------------------------
//
EXPORT_C TBool CSIPRefresh::operator==(const CSIPRefresh& aRefresh) const
{
if (!iRefreshId || !aRefresh.iRefreshId)
{
//If either of the ids is empty, the refreshes are not considired same,
//unless the objects are actually same
return this == &aRefresh;
}
return iRefreshId == aRefresh.iRefreshId;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::IntervalL
// Allow getting interval even before active state.
// -----------------------------------------------------------------------------
//
EXPORT_C TUint CSIPRefresh::IntervalL() const
{
__ASSERT_ALWAYS(iOwner, User::Leave(KErrSIPResourceNotAvailable));
return iOwner->TransactionAssociation().ClientConnectionL().
RefreshIntervalL(iRefreshId);
}
// -----------------------------------------------------------------------------
// CSIPRefresh::SetIntervalL
// Allow interval setting even before active state.
// -----------------------------------------------------------------------------
//
EXPORT_C void CSIPRefresh::SetIntervalL(TUint aInterval)
{
__ASSERT_ALWAYS(iOwner, User::Leave(KErrSIPResourceNotAvailable));
__ASSERT_ALWAYS(aInterval > 0, User::Leave(KErrArgument));
return iOwner->TransactionAssociation().ClientConnectionL().
SetRefreshIntervalL(iRefreshId, aInterval);
}
// -----------------------------------------------------------------------------
// CSIPRefresh::SetRefreshOwner
// -----------------------------------------------------------------------------
//
void CSIPRefresh::SetRefreshOwner(MSIPRefreshAssociation& aAssoc)
{
iOwner = &aAssoc;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::RemoveRefreshOwner
// -----------------------------------------------------------------------------
//
void CSIPRefresh::RemoveRefreshOwner(const MSIPRefreshAssociation& aAssoc)
{
__SIP_ASSERT_RETURN(iOwner == &aAssoc, KErrUnknown);
iOwner = NULL;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::ChangeState
// -----------------------------------------------------------------------------
//
void CSIPRefresh::ChangeState(CSIPRefresh::TState aNextState)
{
iState = aNextState;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::RefreshId
// -----------------------------------------------------------------------------
//
TUint32 CSIPRefresh::RefreshId() const
{
return iRefreshId;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::SetRefreshIdIfEmpty
// -----------------------------------------------------------------------------
//
void CSIPRefresh::SetRefreshIdIfEmpty(TUint32 aRefreshId)
{
if (!iRefreshId)
{
iRefreshId = aRefreshId;
}
}
// -----------------------------------------------------------------------------
// CSIPRefresh::RequestType
// -----------------------------------------------------------------------------
//
RStringF CSIPRefresh::RequestType() const
{
return iRequestType;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::SetRequestType
// -----------------------------------------------------------------------------
//
void CSIPRefresh::SetRequestType(RStringF aType)
{
iRequestType.Close();
iRequestType = aType.Copy();
}
// -----------------------------------------------------------------------------
// CSIPRefresh::DoesMatch
// -----------------------------------------------------------------------------
//
TBool CSIPRefresh::DoesMatch(TUint32 aRefreshId) const
{
return aRefreshId == iRefreshId;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::AddTransaction
// Refresh is associated to a new client transaction. iClientTransaction might
// be non-NULL in case application has not deleted the previous transaction yet.
// -----------------------------------------------------------------------------
//
void CSIPRefresh::AddTransaction(CSIPClientTransaction& aTransaction)
{
//Remove possibly existing association to current transaction
if (iClientTransaction)
{
iClientTransaction->RemoveRefresh();
}
iClientTransaction = &aTransaction;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::RemoveTransaction
// -----------------------------------------------------------------------------
//
void CSIPRefresh::RemoveTransaction()
{
__SIP_ASSERT_RETURN(iClientTransaction, KErrNotFound);
iClientTransaction = NULL;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::Transaction
// -----------------------------------------------------------------------------
//
CSIPClientTransaction* CSIPRefresh::Transaction()
{
return iClientTransaction;
}
// -----------------------------------------------------------------------------
// CSIPRefresh::UpdateRefreshState
// -----------------------------------------------------------------------------
//
void CSIPRefresh::UpdateRefreshState(TUint aStatusCode)
{
if (aStatusCode >= 300)
{
ChangeState(CSIPRefresh::ETerminated);
}
else
{
if (aStatusCode >= 200)
{
ChangeState(CSIPRefresh::EActive);
}
}
}
// -----------------------------------------------------------------------------
// CSIPRefresh::CheckStateL
// -----------------------------------------------------------------------------
//
void CSIPRefresh::CheckStateL() const
{
__ASSERT_ALWAYS(iState == EActive,
User::Leave(KErrSIPInvalidTransactionState));
__ASSERT_ALWAYS(iOwner, User::Leave(KErrSIPResourceNotAvailable));
}