rtp/rtpstack/inc/rtpcomm.h
changeset 0 307788aac0a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtp/rtpstack/inc/rtpcomm.h	Tue Feb 02 01:03:15 2010 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2004-2005 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:   
+*
+*/
+
+
+
+#ifndef __RTPCOMM_H
+#define __RTPCOMM_H
+
+// INCLUDES
+#include "rtpcommdef.h"
+#include "rtpcommrecv.h"
+#include "rtpcommsend.h"
+
+
+/**
+*  Class for socket communication. 
+*
+*  @lib RtpService.dll
+*/
+class CRtpComm : public CBase
+    {
+    #if defined( _DEBUG ) && defined( RTP_UNIT_TEST )
+    // Friend class used for testing
+        friend class CRtpUtRtpComm;
+        friend class CRtpUtRtpSession;
+    #endif 
+    public:
+        static CRtpComm* NewL( TUint& aLocalPort, 
+                               RSocketServ& aSocketServ,
+                               RConnection& aRConn, 
+                               const TCreateSessionParams& aParams,
+                               MRtpErrNotify& aErrNotify,
+                               TBool aEnableRtcp );
+        ~CRtpComm();
+
+
+        /**
+        * Create the resources necessary for sending RTP, and RTCP if necessary
+        */
+        void ConstructSenderL(TInetAddr& aRtpAddr, TInetAddr& aRtcpAddr);
+
+        /**
+        * Create the resources necessary for receiving RTP, and RTCP if
+        * necessary.
+        */
+        void ConstructReceiverL(TBool aNonRtpObserverSet);
+
+        TInt SetToAddress( TPortType aPortType, TInetAddr& aAddr );
+        void SetAcceptedFromAddress(TInetAddr& aAddr);
+        void SetRecvCallback( TPortType aPortType, TCallBack& aCallback );
+
+        TInt Send( TPortType aPortType, const TDesC8& aSendBuf );
+        void Send( TPortType aPortType, const TDesC8& aSendBuf,
+                   TRequestStatus& aStatus ); 
+        void CancelSend( TPortType aPortType );
+
+        TInt Receive( TPortType aPortType, TDes8& aRecvBuf );
+
+        void RegisterReceivedNotify( MReceivedNotify* aNotify );
+
+        RSocket* GetSocket( TPortType aPortType );
+        
+        void SetNonRtpObserverFlag(TBool aValue);
+        
+        TInt MaxSocketSize();
+
+    private:
+        CRtpComm();
+        void ConstructL( TUint& aLocalPort, 
+                         RSocketServ& aSocketServ,             
+                         RConnection& aRConn, 
+                         const TCreateSessionParams& aParams,
+                         MRtpErrNotify& aErrNotify,
+                         TBool aEnableRtcp );
+        void Close();
+		
+   	protected:
+   		CRtpCommRecv* iReceiver[KMaxPorts];
+    private:
+        RSocket iSocket[KMaxPorts];
+        CRtpCommSend* iSender[KMaxPorts];
+        
+        TUint iPriority;
+        MRtpErrNotify* iErrNotify;
+        TBool iRtcpEnabled;
+        MReceivedNotify* iReceivedNotify;
+        TInt iSocketSize;
+    
+    private: 
+    	friend class CRtpSession;	
+    #ifdef EUNIT_TESTING
+	  friend class UT_CRtpAPI;
+	  friend class UT_CRtpComm;
+	  friend class UT_CRtpSession;
+	  friend class UT_CRtpSessionSrtp;
+	#endif     	    
+
+    };
+
+#endif  // __RTPCOMM_H
+
+// End of File