rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSession.h
changeset 0 307788aac0a8
child 19 b5e99d8877c7
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __UT_CRTPSESSION_H__
       
    22 #define __UT_CRTPSESSION_H__
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <digia/eunit/ceunittestsuiteclass.h>
       
    26 
       
    27 //  INTERNAL INCLUDES
       
    28 #include "rtpsdes.h"
       
    29 #include "rtppacket.h"
       
    30 #include "rtppacketparam.h"
       
    31 #include "rtpstream.h"
       
    32 #include "rtpasignuniqueid.h"
       
    33 #include <rtpdef.h>
       
    34 #include <commdbconnpref.h>
       
    35 #include <e32std.h>
       
    36 #include "rtptimer.h"
       
    37 
       
    38 
       
    39 //  FORWARD DECLARATIONS
       
    40 class CRtpSession;
       
    41 
       
    42 #include <e32def.h>
       
    43 #ifndef NONSHARABLE_CLASS
       
    44     #define NONSHARABLE_CLASS(x) class x
       
    45 #endif
       
    46 const TInt KRtpNumPayloadTypes = 128;
       
    47 
       
    48 //  CLASS DEFINITION
       
    49 /**
       
    50  *
       
    51  * EUnitWizard generated test class. 
       
    52  *
       
    53  */
       
    54 NONSHARABLE_CLASS( UT_CRtpSession )
       
    55      : public CEUnitTestSuiteClass,
       
    56       public MRtpErrNotify,
       
    57       public MRtpAsignUniqueID,
       
    58       public MRtcpObserver, MRtpObserver,
       
    59       public MNonRTPDataObserver,MTimeOutNotify
       
    60     {
       
    61     public:     // Constructors and destructors
       
    62 
       
    63         /**
       
    64          * Two phase construction
       
    65          */
       
    66         static UT_CRtpSession* NewL();
       
    67         static UT_CRtpSession* NewLC();
       
    68         /**
       
    69          * Destructor
       
    70          */
       
    71         ~UT_CRtpSession();
       
    72 
       
    73     private:    // Constructors and destructors
       
    74 
       
    75         UT_CRtpSession();
       
    76         void ConstructL();
       
    77 
       
    78     public:     // From observer interface
       
    79 		void ErrorNotify( TInt aErrCode );
       
    80 		 //from MRtpAsignUniqueID     
       
    81         TRtpId AssignUniqueID();
       
    82 		TInt AddStreamToSession(TRtpId aSessionId, TRtpId aStreamId);
       
    83     	// from MRtpObserver
       
    84         void RtpPacketReceived( TRtpId aStreamId,
       
    85                                 const TRtpRecvHeader& aHeaderInfo, 
       
    86                                 const TDesC8& aPayloadData );
       
    87     	// from MRtcpObserver
       
    88 
       
    89         void SdesReceived( TRtpSSRC aSSRC,
       
    90                            const TRtpSdesParams& aParams );
       
    91     
       
    92         void ByeReceived( TRtpId aStreamId, TRtpSSRC aSSRC,
       
    93                           const TDesC8& aReason );
       
    94 
       
    95         void AppReceived( TRtpId aStreamId, TRtpSSRC aSSRC,
       
    96                           const TRtcpApp& aApp );
       
    97     
       
    98         void SrReceived( TRtpId aStreamId, TRtpSSRC aSSRC,
       
    99                          const TTimeStamps& aTimeStamps );
       
   100     
       
   101         void RrReceived( TRtpId aStreamId, TRtpSSRC aSSRC );
       
   102 
       
   103 		// from MNonRTPDataObserver
       
   104         void NonRTPDataReceived( TUint aPort, TBool aRTPport, const TDesC8& aNonRTPData );
       
   105         
       
   106           // from MTimeOutNotify
       
   107         void OnExpiredL( TInt aStatus );
       
   108     private:    // New methods
       
   109 
       
   110          void SetupL();
       
   111          
       
   112          void Setup2L();
       
   113         
       
   114          void Teardown();
       
   115         
       
   116          void UT_CRtpSession_NewLL();
       
   117         
       
   118         
       
   119          void UT_CRtpSession_SSRCL();
       
   120         
       
   121         
       
   122          void UT_CRtpSession_StartSessionL();
       
   123         
       
   124         
       
   125          void UT_CRtpSession_SetRemoteAddressL();
       
   126         
       
   127         
       
   128          void UT_CRtpSession_SetRemoteRtcpAddressL();
       
   129         
       
   130         
       
   131          void UT_CRtpSession_CreateReceiveStreamLL();
       
   132         
       
   133         
       
   134          void UT_CRtpSession_CreateTransmitStreamLL();
       
   135         
       
   136         
       
   137          void UT_CRtpSession_CreateTransmitStreamExtLL();
       
   138         
       
   139         
       
   140          void UT_CRtpSession_CloseStreamL();
       
   141         
       
   142         
       
   143          void UT_CRtpSession_ResetTxStreamStatsL();
       
   144         
       
   145         
       
   146          void UT_CRtpSession_ResetRxStreamStatsL();
       
   147         
       
   148         
       
   149          void UT_CRtpSession_RegisterRtpObserverL();
       
   150         
       
   151         
       
   152          void UT_CRtpSession_UnregisterRtpObserverL();
       
   153         
       
   154         
       
   155          void UT_CRtpSession_SetNonRTPDataObserverL();
       
   156         
       
   157         
       
   158          void UT_CRtpSession_SendRtpPacketL();
       
   159         
       
   160         
       
   161          void UT_CRtpSession_SendRtpPacket_1L();
       
   162         
       
   163         
       
   164          void UT_CRtpSession_SendRtpPacket_2L();
       
   165         
       
   166         
       
   167          void UT_CRtpSession_SendRtpPacket_3L();
       
   168         
       
   169         
       
   170          void UT_CRtpSession_SendRtpPacket_4L();
       
   171         
       
   172         
       
   173          void UT_CRtpSession_SendDataL();
       
   174         
       
   175         
       
   176          void UT_CRtpSession_CancelSendL();
       
   177         
       
   178         
       
   179          void UT_CRtpSession_RegisterRtcpObserverL();
       
   180         
       
   181         
       
   182          void UT_CRtpSession_UnregisterRtcpObserverL();
       
   183         
       
   184         
       
   185          void UT_CRtpSession_SendRtcpByePacketLL();
       
   186         
       
   187         
       
   188          void UT_CRtpSession_SendRtcpAppPacketL();
       
   189         
       
   190         
       
   191          void UT_CRtpSession_SendRtcpSrPacket1L();
       
   192          void UT_CRtpSession_SendRtcpSrPacket2L();
       
   193          void UT_CRtpSession_RemoveSdesFromArrayL();
       
   194         
       
   195          void UT_CRtpSession_SendRtcpRrPacketL();
       
   196         
       
   197          void UT_CRtpSession_DoBuildSendRTCPReportIfNotSentL();
       
   198          void UT_CRtpSession_DoBuildSendRTCPReportL();
       
   199          void UT_CRtpSession_BuildSendRTCPReport1L();
       
   200          void UT_CRtpSession_BuildSendRTCPReport2L();
       
   201          void UT_CRtpSession_SendRTCPReportL(  );
       
   202          
       
   203          void UT_CRtpSession_CreateSDESL( ) ;
       
   204          void UT_CRtpSession_ProcessOneRTCPReportSectionL();
       
   205          
       
   206          void UT_CRtpSession_ProcessRTCPReportL();
       
   207          
       
   208          void UT_CRtpSession_ProcessSDESDataL();
       
   209          
       
   210          void UT_CRtpSession_ProcessSDESData2L();
       
   211          
       
   212          void UT_CRtpSession_ProcessRRSectionL();
       
   213          
       
   214          void UT_CRtpSession_ProcessSRSectionL();
       
   215          
       
   216          void UT_CRtpSession_ProcessBYESectionL();
       
   217          void UT_CRtpSession_GetRtpSocketL();
       
   218         
       
   219         
       
   220          void UT_CRtpSession_GetRtcpSocketL();
       
   221         
       
   222         
       
   223          void UT_CRtpSession_GetStreamStatisticsL();
       
   224         
       
   225         
       
   226          void UT_CRtpSession_SetRtcpParametersL();
       
   227         
       
   228         
       
   229          void UT_CRtpSession_GetSessionIdL();
       
   230         
       
   231         
       
   232          void UT_CRtpSession_StopRtcpSendingL();
       
   233         
       
   234         
       
   235          void UT_CRtpSession_ResumeRtcpSendingL();
       
   236         
       
   237         
       
   238          void UT_CRtpSession_IsRtcpSendingSuspendedL();
       
   239         
       
   240         
       
   241          void UT_CRtpSession_CheckRemoteSsrcL();
       
   242         
       
   243         
       
   244          void UT_CRtpSession_OnExpiredL();
       
   245         
       
   246          void UT_CRtpSession_ScheduleRtcpSend();
       
   247         
       
   248          void UT_CRtpSession_OnRtpReceivedLL();
       
   249         
       
   250          void UT_CRtpSession_OnRtpReceivedL2L(  );	
       
   251         
       
   252          void UT_CRtpSession_OnRtcpReceivedLL();
       
   253         
       
   254         
       
   255          void UT_CRtpSession_OnReceptionErrorL();
       
   256         
       
   257         
       
   258          void UT_CRtpSession_OnPacketRejectedL();
       
   259          
       
   260          void UT_CRtpSession_BuildRTCPReportWithoutStreams();
       
   261          
       
   262          void UT_CRtpSession_BuildRTCPReportWithoutPackets();
       
   263 
       
   264       	void UT_CRtpSession_OnRtpReceivedL3L(  );
       
   265          void UT_CRtpSession_SendSRTCPReport();
       
   266       	void UT_CRtpSession_DeallocateMemoryForSdesL( );   
       
   267          void UT_CRtpSession_NextRTCPIntervalL();
       
   268          void UT_CRtpSession_MatchSSRCToStreamL();
       
   269       	void UT_CRtpSession_MatchSSRCToStream2L( );
       
   270       	void UT_CRtpSession_RcvStreamReceivedRtpPacketL();
       
   271       	
       
   272       	void UT_CRtpSession_GetRcvStreamByIndexL( );
       
   273       	void UT_CRtpSession_CreateNewRecvStreamLL();
       
   274       	void UT_CRtpSession_SendSrtcpReportLL();
       
   275       	//Test Utility function	  
       
   276 		TBool PeerStatsEqual( TRtpPeerStat aStat1, TRtpPeerStat aStat2 );
       
   277 
       
   278 		void Hex(HBufC8& aString);
       
   279     private:    // Data
       
   280 		CRtpSession* iSession;
       
   281 		CRtpSession* iSession2;
       
   282         RSocketServ iSocketServ;
       
   283         RConnection iConn;
       
   284         CRtpSDES* iSdes;
       
   285         TUint32 iProfileRTPTimeRates[KRtpNumPayloadTypes];
       
   286         RLibrary iLibrary;
       
   287         TRtpId iNumOfObjects;   // count of session and participants IDs assigned
       
   288         TRtpSSRC iTxStreamSSRC; // the local SSRC of the Tx stream we work with
       
   289         TRtpSSRC iRxStreamSSRC; // the remote SSRC of the Rx stream we work with
       
   290         TInt iPacketsExpected;
       
   291         TRtpId iTranstreamId;
       
   292 		TRtpId iRecvstreamId;
       
   293 		
       
   294 		TBool iRollBackRtcp;
       
   295 		TBool iRollBackRtcpValue;
       
   296 		
       
   297         EUNIT_DECLARE_TEST_TABLE; 
       
   298 
       
   299     };
       
   300 
       
   301 #endif      //  __UT_CRTPSESSION_H__
       
   302 
       
   303 // End of file