|
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_CRtpSessionSrtp_H__ |
|
22 #define __UT_CRtpSessionSrtp_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/ceunittestsuiteclass.h> |
|
26 |
|
27 // INTERNAL INCLUDES |
|
28 |
|
29 #include "srtpmastersalt.h" |
|
30 #include "srtpmasterkey.h" |
|
31 #include "srtpcryptocontext.h" |
|
32 #include <in_sock.h> |
|
33 #include "msrtprekeyingobserver.h" |
|
34 #include "rtpsessionsrtp.h" |
|
35 #include "srtpsession.h" |
|
36 #include "srtpstreamin.h" |
|
37 #include "srtpstreamout.h" |
|
38 |
|
39 #include "rtpsdes.h" |
|
40 #include "rtppacket.h" |
|
41 #include "rtppacketparam.h" |
|
42 #include "rtpstream.h" |
|
43 #include "rtpasignuniqueid.h" |
|
44 #include <rtpdef.h> |
|
45 #include <commdbconnpref.h> |
|
46 #include <e32std.h> |
|
47 #include "rtptimer.h" |
|
48 |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 class CRtpSessionSrtp; |
|
52 |
|
53 //Constant |
|
54 const TInt KTestRtpNumPayloadTypes = 128; |
|
55 |
|
56 |
|
57 #include <e32def.h> |
|
58 #ifndef NONSHARABLE_CLASS |
|
59 #define NONSHARABLE_CLASS(x) class x |
|
60 #endif |
|
61 |
|
62 // CLASS DEFINITION |
|
63 /** |
|
64 * |
|
65 * EUnitWizard generated test class. |
|
66 * |
|
67 */ |
|
68 NONSHARABLE_CLASS( UT_CRtpSessionSrtp ) |
|
69 : public CEUnitTestSuiteClass, |
|
70 public MSRTPReKeyingObserver, |
|
71 public MRtpErrNotify, |
|
72 public MRtpAsignUniqueID, |
|
73 public MRtcpObserver, MRtpObserver, |
|
74 public MNonRTPDataObserver,MTimeOutNotify |
|
75 { |
|
76 class TPayloadDetails |
|
77 { |
|
78 public: |
|
79 TPayloadDetails(); |
|
80 |
|
81 public: |
|
82 TUint16 seqNr; |
|
83 const TUint8* ssrc; |
|
84 TUint8 padding; |
|
85 TUint8 numCSRC; |
|
86 TBool fHeaderExtension; |
|
87 TUint8 payloadLen; |
|
88 const TUint8* payloadData; |
|
89 TUint8 MKILen; |
|
90 const TUint8* MKIData; |
|
91 TUint8 authTagLen; |
|
92 const TUint8* authTagData; |
|
93 }; |
|
94 public: // Constructors and destructors |
|
95 |
|
96 /** |
|
97 * Two phase construction |
|
98 */ |
|
99 static UT_CRtpSessionSrtp* NewL(); |
|
100 static UT_CRtpSessionSrtp* NewLC(); |
|
101 /** |
|
102 * Destructor |
|
103 */ |
|
104 ~UT_CRtpSessionSrtp(); |
|
105 |
|
106 private: // Constructors and destructors |
|
107 |
|
108 UT_CRtpSessionSrtp(); |
|
109 void ConstructL(); |
|
110 |
|
111 public: // From observer interface |
|
112 |
|
113 void SRTPMasterKeyStaleEvent(const CSRTPSession& aSession); |
|
114 void SRTPMasterKeyStaleEvent(const CSRTPStream& aStream); |
|
115 |
|
116 void ErrorNotify( TInt aErrCode ); |
|
117 //from MRtpAsignUniqueID |
|
118 TRtpId AssignUniqueID(); |
|
119 TInt AddStreamToSession(TRtpId aSessionId, TRtpId aStreamId); |
|
120 |
|
121 // from MRtpObserver |
|
122 void RtpPacketReceived( TRtpId aStreamId, |
|
123 const TRtpRecvHeader& aHeaderInfo, |
|
124 const TDesC8& aPayloadData ); |
|
125 // from MRtcpObserver |
|
126 |
|
127 void SdesReceived( TRtpSSRC aSSRC, |
|
128 const TRtpSdesParams& aParams ); |
|
129 |
|
130 void ByeReceived( TRtpId aStreamId, TRtpSSRC aSSRC, |
|
131 const TDesC8& aReason ); |
|
132 |
|
133 void AppReceived( TRtpId aStreamId, TRtpSSRC aSSRC, |
|
134 const TRtcpApp& aApp ); |
|
135 |
|
136 void SrReceived( TRtpId aStreamId, TRtpSSRC aSSRC, |
|
137 const TTimeStamps& aTimeStamps ); |
|
138 |
|
139 void RrReceived( TRtpId aStreamId, TRtpSSRC aSSRC ); |
|
140 |
|
141 // from MNonRTPDataObserver |
|
142 void NonRTPDataReceived( TUint aPort, TBool aRTPport, const TDesC8& aNonRTPData ); |
|
143 |
|
144 // from MTimeOutNotify |
|
145 void OnExpiredL( TInt aStatus ); |
|
146 |
|
147 |
|
148 private: // New methods |
|
149 |
|
150 void SetupL(); |
|
151 |
|
152 void Teardown(); |
|
153 |
|
154 void UT_CRtpSessionSrtp_NewLL(); |
|
155 |
|
156 |
|
157 void UT_CRtpSessionSrtp_SendRtpPacketL(); |
|
158 |
|
159 void UT_CRtpSessionSrtp_SendRtpPacket1L( ); |
|
160 |
|
161 void UT_CRtpSessionSrtp_SendRtpPacket_1L(); |
|
162 void UT_CRtpSessionSrtp_SendRtpPacket_1AL( ); |
|
163 |
|
164 void UT_CRtpSessionSrtp_SendRtpPacket_2L(); |
|
165 void UT_CRtpSessionSrtp_SendRtpPacket_2AL(); |
|
166 |
|
167 |
|
168 void UT_CRtpSessionSrtp_OnRtpReceivedL(); |
|
169 |
|
170 void UT_CRtpSessionSrtp_OnRtpReceived_1L( ); |
|
171 void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReport(); |
|
172 |
|
173 void UT_CRtpSessionSrtp_OnRtcpReceived(); |
|
174 |
|
175 |
|
176 |
|
177 HBufC8* BuildPacketL(TBool aSrtp, TPayloadDetails& details); |
|
178 |
|
179 void Write32( TUint8* const aPointer, TUint32 aValue ); |
|
180 |
|
181 void Hex(HBufC8& aString); |
|
182 void Write16( TUint8* const aPointer, TUint16 aValue ); |
|
183 private: // Data |
|
184 //Data for SRTP part |
|
185 TBuf8<32> iSalt; |
|
186 TBuf8<32> iKey; |
|
187 TBuf8<32> iMKI; |
|
188 CSRTPMasterSalt* iMasterSalt; |
|
189 CSRTPMasterKey* iMasterKey; |
|
190 |
|
191 CSRTPCryptoContext* iContext; |
|
192 |
|
193 HBufC8* iTestPayload160Bits; |
|
194 HBufC8* iTestMKI128Bits; |
|
195 HBufC8* iTestAuthTag80Bits; |
|
196 |
|
197 CSRTPSession* iSRTPSession; |
|
198 CSRTPStreamIn* iStreamIn; |
|
199 CSRTPStreamOut* iStreamOut; |
|
200 CSRTPCryptoHandlerSRTP *iCryptoHandlerSRTP; |
|
201 TInetAddr iDestination; |
|
202 TBuf8<32> iRFC3711_TestMasterKey128bits; |
|
203 TBuf8<32> iRFC3711_TestMasterSalt112bits; |
|
204 HBufC8* iRFC3711_SessionEncrKey128bits; |
|
205 HBufC8* iRFC3711_SessionSaltKey128bits; |
|
206 HBufC8* iRFC3711_SessionAuthKey128bits; |
|
207 HBufC8* iDecryptedPayload; |
|
208 TBool iMasterKeyStaleRefresh; |
|
209 //Data form RTPSession |
|
210 TRtpId iNumOfObjects; // count of session and participants IDs |
|
211 CRtpSessionSrtp* iSession; |
|
212 RSocketServ iSocketServ; |
|
213 RConnection iConn; |
|
214 CRtpSDES* iSdes; |
|
215 TUint32 iProfileRTPTimeRates[KTestRtpNumPayloadTypes]; |
|
216 RLibrary iLibrary; |
|
217 TRtpId iTranstreamId; |
|
218 TRtpId iRecvstreamId; |
|
219 EUNIT_DECLARE_TEST_TABLE; |
|
220 |
|
221 }; |
|
222 |
|
223 #endif // __UT_CRtpSessionSrtp_H__ |
|
224 |
|
225 // End of file |