|
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_CSRTPSTREAMIN_H__ |
|
22 #define __UT_CSRTPSTREAMIN_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/ceunittestsuiteclass.h> |
|
26 |
|
27 // INTERNAL INCLUDES |
|
28 #include "srtpmastersalt.h" |
|
29 #include "srtpmasterkey.h" |
|
30 #include "srtpcryptocontext.h" |
|
31 #include <in_sock.h> |
|
32 #include "msrtprekeyingobserver.h" |
|
33 |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CSRTPCryptoHandlerSRTP; |
|
37 class CSRTPCryptoHandlerSRTCP; |
|
38 class CSRTPSession; |
|
39 class CSRTPStreamIn; |
|
40 |
|
41 |
|
42 // CLASS DEFINITION |
|
43 /** |
|
44 * |
|
45 * EUnitWizard generated test class. |
|
46 * |
|
47 */ |
|
48 class UT_CSRTPStreamIn |
|
49 : public CEUnitTestSuiteClass, |
|
50 public MSRTPReKeyingObserver |
|
51 { |
|
52 |
|
53 class TPayloadDetails |
|
54 { |
|
55 public: |
|
56 TPayloadDetails(); |
|
57 |
|
58 public: |
|
59 TUint16 seqNr; |
|
60 // TUint8* ssrc; |
|
61 TUint8 padding; |
|
62 TUint8 numCSRC; |
|
63 TBool fHeaderExtension; |
|
64 TUint8 payloadLen; |
|
65 const TUint8* payloadData; |
|
66 TUint8 MKILen; |
|
67 const TUint8* MKIData; |
|
68 TUint8 authTagLen; |
|
69 const TUint8* authTagData; |
|
70 }; |
|
71 |
|
72 public: // Constructors and destructors |
|
73 |
|
74 /** |
|
75 * Two phase construction |
|
76 */ |
|
77 static UT_CSRTPStreamIn* NewL(); |
|
78 static UT_CSRTPStreamIn* NewLC(); |
|
79 /** |
|
80 * Destructor |
|
81 */ |
|
82 ~UT_CSRTPStreamIn(); |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 private: // Constructors and destructors |
|
88 |
|
89 UT_CSRTPStreamIn(); |
|
90 void ConstructL(); |
|
91 |
|
92 public: // From observer interface |
|
93 |
|
94 void SRTPMasterKeyStaleEvent(const CSRTPStream& aStream); |
|
95 void SRTPMasterKeyStaleEvent(const CSRTPSession& aSession); |
|
96 |
|
97 private: // New methods |
|
98 |
|
99 void SetupL(); |
|
100 |
|
101 void Teardown(); |
|
102 |
|
103 void UT_CSRTPStreamIn_NewL_1L(); |
|
104 void UT_CSRTPStreamIn_NewL_2L(); |
|
105 void UT_CSRTPStreamIn_NewL_3L(); |
|
106 void UT_CSRTPStreamIn_NewL_4L(); |
|
107 |
|
108 |
|
109 void UT_CSRTPStreamIn_UnprotectSrtpLL(); |
|
110 |
|
111 void UT_CSRTPStreamIn_UnprotectSrtpL2L( ); |
|
112 void UT_CSRTPStreamIn_UnprotectSrtpL3L( ); |
|
113 void UT_CSRTPStreamIn_UnprotectSrtcpLL(); |
|
114 void UT_CSRTPStreamIn_UnprotectSrtcpL2L(); |
|
115 void UT_CSRTPStreamIn_StateTestsL(); |
|
116 void UT_CSRTPStreamIn_StateTests2L(); |
|
117 HBufC8* BuildPacketL(TBool aSrtp, TPayloadDetails& details); |
|
118 void UT_CSRTPStreamIn_NewL_5L( ); |
|
119 void UT_CSRTPStreamIn_SetCryptoInL( ); |
|
120 |
|
121 void Hex(HBufC8& aString); |
|
122 |
|
123 private: // Data |
|
124 |
|
125 CSRTPMasterSalt* iMasterSalt; |
|
126 CSRTPMasterKey* iMasterKey; |
|
127 |
|
128 CSRTPCryptoContext* iContext; |
|
129 |
|
130 HBufC8* iTestPayload160Bits; |
|
131 HBufC8* iTestMKI128Bits; |
|
132 HBufC8* iTestAuthTag80Bits; |
|
133 |
|
134 CSRTPSession* iSRTPSession; |
|
135 CSRTPStreamIn* iStreamIn; |
|
136 CSRTPStreamIn* iStreamInLateBD; |
|
137 CSRTPCryptoHandlerSRTP *iCryptoHandlerSRTP; |
|
138 CSRTPCryptoHandlerSRTCP *iCryptoHandlerSRTCP; |
|
139 CSRTPCryptoHandlerSRTP *iCryptoHandlerSRTP2; |
|
140 CSRTPCryptoHandlerSRTCP *iCryptoHandlerSRTCP2; |
|
141 TInetAddr iDestination; |
|
142 |
|
143 |
|
144 HBufC8* iRFC3711_SessionEncrKey128bits; |
|
145 HBufC8* iRFC3711_SessionSaltKey128bits; |
|
146 HBufC8* iRFC3711_SessionAuthKey128bits; |
|
147 HBufC8* iRFC3711_RtcpEncrKey128bits; |
|
148 HBufC8* iRFC3711_RtcpSaltKey128bits; |
|
149 HBufC8* iRFC3711_RtcpAuthKey128bits; |
|
150 |
|
151 HBufC8* iDecryptedPayload; |
|
152 TBool iMasterKeyStaleRefresh; |
|
153 EUNIT_DECLARE_TEST_TABLE; |
|
154 |
|
155 }; |
|
156 |
|
157 #endif // __UT_CSRTPSTREAMIN_H__ |
|
158 |
|
159 // End of file |