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) 2004 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: Represents receiver (incoming) SRTP stream.
*
*/
#ifndef __SRTP_STREAM_IN_H__
#define __SRTP_STREAM_IN_H__
// INCLUDES
#include <e32def.h>
#include "srtpstream.h"
#include "msrtpstreamincontext.h"
// FORWARD DECLARATIONS
class CSRTPSession;
class CSRTPCryptoContext;
class MSRTPReKeyingObserver;
class TSRTPStreamInStateBase;
/**
* Represents an SRTP stream.
*/
class CSRTPStreamIn : public CSRTPStream,
public MSRTPStreamInContext
{
public:
/**
* Two-phased constructor.
* Use this function if the stream will use the SRTP session's default
* cryptographic context.
* @param aSession The session containing the cryptographic
* context for this object.
* @param aSSRC The synchronization source ID of the RTP stream
* that corresponds to this object.
* @leave KErrNone if success, system-wide error code otherwise
*/
IMPORT_C static CSRTPStreamIn* NewL( CSRTPSession& aSession,
TUint aSSRC);
/**
* Two-phased constructor.
* Use this function if the stream will have its own cryptographic
* context.
* @param aSession The session containing the cryptographic
* context for this object.
* @param aSSRC The synchronization source ID of the RTP stream
* that corresponds to this object.
* @param aCon The cryptographic context, ownership is transfered.
* @param aObs The callback object
* @leave KErrNone if success, system-wide error code otherwise
*/
IMPORT_C static CSRTPStreamIn* NewL( CSRTPSession& aSession,
TUint aSSRC,
CSRTPCryptoContext* aCon,
MSRTPReKeyingObserver& aObs );
/**
* Two-phased constructor.
* Use this function if the stream will use the SRTP session's default
* cryptographic context and "late binding" is to be used, that is,
* no SSRC is provided.
* @param aSession The session containing the cryptographic
* context for this object.
* @leave KErrNone if success, system-wide error code otherwise
*/
IMPORT_C static CSRTPStreamIn* NewL( CSRTPSession& aSession);
/**
* Two-phased constructor.
* Use this function if the stream will have its own cryptographic
* context and "late binding" is to be used, that is,
* no SSRC is provided.
* @param aSession The session containing the cryptographic
* context for this object.
* @param aCon The cryptographic context, ownership is transfered.
* @param aObs The callback object
* @leave KErrNone if success, system-wide error code otherwise
*/
IMPORT_C static CSRTPStreamIn* NewL( CSRTPSession& aSession,
CSRTPCryptoContext* aCon,
MSRTPReKeyingObserver& aObs );
/**
* Two-phased constructor.
* Use this function if the stream will have its own cryptographic
* context and this cryptographic context will be set later.
* Note that if the crypto context is not been set, the encoded packets
* will not be handled.
* @param aSession The session which includes the streams.
* @param aSSRC The synchronization source ID of the RTP stream
* that corresponds to this object.
* @param aObs The callback object
* @leave KErrNone if success, system-wide error code otherwise
*/
IMPORT_C static CSRTPStreamIn* NewL( CSRTPSession& aSession,
TUint aSSRC,
MSRTPReKeyingObserver& aObs );
/**
* Two-phased constructor.
* Use this function if the stream will have its own cryptographic
* context and "late binding" is to be used, that is,
* no SSRC is provided.Stream own cryptocontext will be set later.
* Note that if the crypto context is not been set, the encoded packets
* will not be handled.
* @param aSession The session which includes the streams.
* @param aObs The callback object
* @leave KErrNone if success, system-wide error code otherwise
*/
IMPORT_C static CSRTPStreamIn* NewL( CSRTPSession& aSession,
MSRTPReKeyingObserver& aObs );
/**
* Unprotect an SRTP packet.
* The settings for the protection are fetched from the appropriate
* cryptographic context. If the operation fails, the function leaves
* with a system error code.
* @param aPacket The SRTP packet to process.
* @leave KErrNone if success, system-wide error code otherwise
* @return An RTP packet.
*/
IMPORT_C HBufC8* UnprotectSrtpL( const TDesC8& aPacket );
/**
* Unprotect an SRTCP packet.
* The settings for the protection are fetched from the appropriate
* cryptographic context. If the operation fails, the function leaves
* with a system error code.
* @param aPacket The SRTCP packet to process.
* @leave KErrNone if success, system-wide error code otherwise
* @return An RTCP packet.
*/
IMPORT_C HBufC8* UnprotectSrtcpL( const TDesC8& aPacket );
/**
* Set/Update CryptoContext for InStream
* Setting cryptographic context must be done to enable encode/decode packets.
* During offer/Answer, offerer do not know which crypto context is
* chosen by answerer. CryptoContext then can be set after getting response
* from answerer. If crypto context has not been set, no packets in secure
* session will be handled.
* Updating stream specific crypto Context
* Note that to update crypto context, ROC will not be re-intialed to zero but
* the states and number of receiving packets will be reset. This can be
* use only when keys lifetime has not expired.
* Crypto context ownershíp is transfered.
* @param aCon aCryyptoContext which wants be used, ownership is transfered.
* @leave KErrNone if success, system-wide error code otherwise
* @return void
*/
IMPORT_C void SetCryptoInL(CSRTPCryptoContext* aCon);
/**
* Destructor
* Note that crypto context will be deleted if stream has it's own cryptocontext
*/
~CSRTPStreamIn( );
/**
* Delete the existed crypto context and re-initial the states
* @param None
* @leave KErrNone if success, system-wide error code otherwise
* @return void
*/
void UpdateCryptoAndStatesL();
private: //methods
CSRTPStreamIn (CSRTPSession& aSession,
TUint aSSRC);
CSRTPStreamIn (CSRTPSession& aSession,
TUint aSSRC,
CSRTPCryptoContext* aCon,
MSRTPReKeyingObserver& aObs );
CSRTPStreamIn (CSRTPSession& aSession,
TUint aSSRC,
MSRTPReKeyingObserver& aObs );
CSRTPStreamIn (CSRTPSession& aSession);
CSRTPStreamIn (CSRTPSession& aSession,
CSRTPCryptoContext* aCon,
MSRTPReKeyingObserver& aObs );
CSRTPStreamIn (CSRTPSession& aSession,
MSRTPReKeyingObserver& aObs );
void ConstructL();
/**
* Create states defined in TSRTPStreamInStateBase
* @leave KErrNone if success, system-wide error code otherwise
* @return void.
*/
void InitializeStatesL();
private:
TSRTPStreamInStateBase& CurrentRTPState();
TSRTPStreamInStateBase& CurrentRTCPState();
private: //from MSRTPStreamInContext
/*
* Change state of the current incoming stream (for RTP)
* @return void.
*/
void ChangeRTPState(MSRTPStreamInContext::TContextInState aNewState);
/*
* Change state of the current incoming stream (for RTCP)
* @return void.
*/
void ChangeRTCPState(MSRTPStreamInContext::TContextInState aNewState);
protected:
/*
states for CSRTPStreamIn
*/
CArrayVarFlat<TSRTPStreamInStateBase> iStates;
/*
the same stream can handle RTP and RTCP packets,
these can have different states
*/
MSRTPStreamInContext::TContextInState iCurrentRTPState;
MSRTPStreamInContext::TContextInState iCurrentRTCPState;
private:
friend class CSRTPSession;
#ifdef EUNIT_TESTING
friend class UT_CSRTPStreamIn;
friend class UT_CSRTPSession;
#endif
};
#endif // __SRTP_STREAM_IN_H__