|
1 /* |
|
2 * Copyright (c) 2004-2005 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 #ifndef __RTPCOMM_H |
|
21 #define __RTPCOMM_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "rtpcommdef.h" |
|
25 #include "rtpcommrecv.h" |
|
26 #include "rtpcommsend.h" |
|
27 |
|
28 |
|
29 /** |
|
30 * Class for socket communication. |
|
31 * |
|
32 * @lib RtpService.dll |
|
33 */ |
|
34 class CRtpComm : public CBase |
|
35 { |
|
36 #if defined( _DEBUG ) && defined( RTP_UNIT_TEST ) |
|
37 // Friend class used for testing |
|
38 friend class CRtpUtRtpComm; |
|
39 friend class CRtpUtRtpSession; |
|
40 #endif |
|
41 public: |
|
42 static CRtpComm* NewL( TUint& aLocalPort, |
|
43 RSocketServ& aSocketServ, |
|
44 RConnection& aRConn, |
|
45 const TCreateSessionParams& aParams, |
|
46 MRtpErrNotify& aErrNotify, |
|
47 TBool aEnableRtcp ); |
|
48 ~CRtpComm(); |
|
49 |
|
50 |
|
51 /** |
|
52 * Create the resources necessary for sending RTP, and RTCP if necessary |
|
53 */ |
|
54 void ConstructSenderL(TInetAddr& aRtpAddr, TInetAddr& aRtcpAddr); |
|
55 |
|
56 /** |
|
57 * Create the resources necessary for receiving RTP, and RTCP if |
|
58 * necessary. |
|
59 */ |
|
60 void ConstructReceiverL(TBool aNonRtpObserverSet); |
|
61 |
|
62 TInt SetToAddress( TPortType aPortType, TInetAddr& aAddr ); |
|
63 void SetAcceptedFromAddress(TInetAddr& aAddr); |
|
64 void SetRecvCallback( TPortType aPortType, TCallBack& aCallback ); |
|
65 |
|
66 TInt Send( TPortType aPortType, const TDesC8& aSendBuf ); |
|
67 void Send( TPortType aPortType, const TDesC8& aSendBuf, |
|
68 TRequestStatus& aStatus ); |
|
69 void CancelSend( TPortType aPortType ); |
|
70 |
|
71 TInt Receive( TPortType aPortType, TDes8& aRecvBuf ); |
|
72 |
|
73 void RegisterReceivedNotify( MReceivedNotify* aNotify ); |
|
74 |
|
75 RSocket* GetSocket( TPortType aPortType ); |
|
76 |
|
77 void SetNonRtpObserverFlag(TBool aValue); |
|
78 |
|
79 TInt MaxSocketSize(); |
|
80 |
|
81 private: |
|
82 CRtpComm(); |
|
83 void ConstructL( TUint& aLocalPort, |
|
84 RSocketServ& aSocketServ, |
|
85 RConnection& aRConn, |
|
86 const TCreateSessionParams& aParams, |
|
87 MRtpErrNotify& aErrNotify, |
|
88 TBool aEnableRtcp ); |
|
89 void Close(); |
|
90 |
|
91 protected: |
|
92 CRtpCommRecv* iReceiver[KMaxPorts]; |
|
93 private: |
|
94 RSocket iSocket[KMaxPorts]; |
|
95 CRtpCommSend* iSender[KMaxPorts]; |
|
96 |
|
97 TUint iPriority; |
|
98 MRtpErrNotify* iErrNotify; |
|
99 TBool iRtcpEnabled; |
|
100 MReceivedNotify* iReceivedNotify; |
|
101 TInt iSocketSize; |
|
102 |
|
103 private: |
|
104 friend class CRtpSession; |
|
105 #ifdef EUNIT_TESTING |
|
106 friend class UT_CRtpAPI; |
|
107 friend class UT_CRtpComm; |
|
108 friend class UT_CRtpSession; |
|
109 friend class UT_CRtpSessionSrtp; |
|
110 #endif |
|
111 |
|
112 }; |
|
113 |
|
114 #endif // __RTPCOMM_H |
|
115 |
|
116 // End of File |