|
1 /* |
|
2 * Copyright (c) 2006 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: Class is used for encapsulating crypto context and |
|
15 * destination information in one class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MMCCCRYPTOCONTEXT_H |
|
22 #define MMCCCRYPTOCONTEXT_H |
|
23 |
|
24 #include <mmf/common/mmfcontrollerframework.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 #include "mmccsrtpmasterkey.h" |
|
28 #include "mmccsrtpmastersalt.h" |
|
29 #include "mmccsrtpcryptoparams.h" |
|
30 |
|
31 const TUint32 KTUintNumValue0 = 0; |
|
32 |
|
33 /**. |
|
34 * This class encapsulates crypto context and destiantion |
|
35 * related information. |
|
36 * |
|
37 * |
|
38 * @lib mmccinterface.dll |
|
39 * @since S60 3.2 |
|
40 */ |
|
41 |
|
42 class TMccCryptoContext |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Default constructor |
|
48 */ |
|
49 inline TMccCryptoContext() : |
|
50 iContextId( KTUintNumValue0 ), |
|
51 iSessionId( KTUintNumValue0 ), |
|
52 iLinkId( KTUintNumValue0 ), |
|
53 iStreamId( KTUintNumValue0 ), |
|
54 iEndPointId( KTUintNumValue0 ), |
|
55 iSrtpMasterKey( TMccSrtpMasterKey( KNullDesC8, KNullDesC8 ) ), |
|
56 iSrtpMasterSalt( TMccSrtpMasterSalt( KNullDesC8 ) ), |
|
57 iSrtpCryptoParams( TMccSrtpCryptoParams() ), |
|
58 iBindingDone( EFalse ) |
|
59 { |
|
60 }; |
|
61 |
|
62 /** |
|
63 * Parametric constructor |
|
64 */ |
|
65 inline TMccCryptoContext( TUint32 aContextId, |
|
66 const TMccSrtpMasterKey& aSrtpMasterKey, |
|
67 const TMccSrtpMasterSalt& aSrtpMasterSalt, |
|
68 const TMccSrtpCryptoParams& aSrtpCryptoParams ) : |
|
69 iContextId( aContextId ), |
|
70 iSessionId( KTUintNumValue0 ), |
|
71 iLinkId( KTUintNumValue0 ), |
|
72 iStreamId( KTUintNumValue0 ), |
|
73 iEndPointId( KTUintNumValue0 ), |
|
74 iSrtpMasterKey( aSrtpMasterKey ), |
|
75 iSrtpMasterSalt( aSrtpMasterSalt ), |
|
76 iSrtpCryptoParams( aSrtpCryptoParams ), |
|
77 iBindingDone( EFalse ) |
|
78 { |
|
79 }; |
|
80 |
|
81 /** |
|
82 * Checks the validity of the whole crypto context. |
|
83 * @since Series 60 3.2 |
|
84 * @return Error code |
|
85 */ |
|
86 TInt ValidateContext() const; |
|
87 |
|
88 /** |
|
89 * Updates the crypto context by the given crypto context. |
|
90 * @since Series 60 3.2 |
|
91 * @return Error code |
|
92 */ |
|
93 TInt UpdateContext( TMccCryptoContext& aCandidate ); |
|
94 |
|
95 /** |
|
96 * Gets the destination associated with this crypto context |
|
97 * @since Series 60 3.2 |
|
98 * @param aSessionId session where context belongs to |
|
99 * @param aLinkId link ID |
|
100 * @param aStreamId ID identifying stream |
|
101 * @param aEndpointId ID identifying endpoint of the stream |
|
102 * @return Error code |
|
103 */ |
|
104 TInt GetDestinationInfo( TUint32& aSessionId, TUint32& aLinkId, |
|
105 TUint32& aStreamId, TUint32& aEndPointId ) const; |
|
106 |
|
107 /** |
|
108 * Sets the destination associated with this crypto context |
|
109 * @since Series 60 3.2 |
|
110 * @param aSessionId session ID where context belongs to |
|
111 * @param aLinkId link ID |
|
112 * @param aStreamId ID identifying stream |
|
113 * @param aEndpointId ID identifying endpoint of the stream |
|
114 * @return Error code |
|
115 */ |
|
116 TInt SetDestinationInfo( TUint32 aSessionId, TUint32 aLinkId, |
|
117 TUint32 aStreamId, TUint32 aEndPoint ); |
|
118 |
|
119 /** |
|
120 * Sets the master key. |
|
121 * @since Series 60 3.2 |
|
122 * @param TMccSrtpMasterKey Master key. |
|
123 * @return void. |
|
124 */ |
|
125 void SetMasterKey( const TMccSrtpMasterKey& aSrtpMasterKey ); |
|
126 |
|
127 /** |
|
128 * Sets the master salt. |
|
129 * @since Series 60 3.2 |
|
130 * @param TMccSrtpMasterSalt Master salt. |
|
131 * @return void. |
|
132 */ |
|
133 void SetMasterSalt( const TMccSrtpMasterSalt& aSrtpMasterSalt ); |
|
134 |
|
135 /** |
|
136 * Sets the crypto params. |
|
137 * @since Series 60 3.2 |
|
138 * @param TMccSrtpCryptoParams Crypto params. |
|
139 * @return void. |
|
140 */ |
|
141 void SetCryptoParams( const TMccSrtpCryptoParams& aSrtpCryptoParams ); |
|
142 |
|
143 /** |
|
144 * Gets the master key. |
|
145 * @since Series 60 3.2 |
|
146 * @return Master key. |
|
147 */ |
|
148 const TMccSrtpMasterKey& MasterKey() const; |
|
149 |
|
150 /** |
|
151 * Gets the master salt. |
|
152 * @since Series 60 3.2 |
|
153 * @return Master salt. |
|
154 */ |
|
155 const TMccSrtpMasterSalt& MasterSalt() const; |
|
156 |
|
157 /** |
|
158 * Gets the crypto params. |
|
159 * @since Series 60 3.2 |
|
160 * @return Crypto params. |
|
161 */ |
|
162 const TMccSrtpCryptoParams& CryptoParams() const; |
|
163 |
|
164 /** |
|
165 * Gets the context id associated with this crypto context |
|
166 * @since Series 60 3.2 |
|
167 * @return Context id |
|
168 */ |
|
169 TUint32 ContextId() const; |
|
170 |
|
171 private: |
|
172 |
|
173 /** |
|
174 * MCC SRTP master key |
|
175 */ |
|
176 TMccSrtpMasterKey iSrtpMasterKey; |
|
177 |
|
178 /** |
|
179 * MCC SRTP master salt |
|
180 */ |
|
181 TMccSrtpMasterSalt iSrtpMasterSalt; |
|
182 |
|
183 /** |
|
184 * MCC SRTP crypto params |
|
185 */ |
|
186 TMccSrtpCryptoParams iSrtpCryptoParams; |
|
187 |
|
188 /** |
|
189 * context ID |
|
190 */ |
|
191 TUint32 iContextId; |
|
192 |
|
193 /** |
|
194 * ID of session. |
|
195 */ |
|
196 TUint32 iSessionId; |
|
197 |
|
198 /** |
|
199 * ID of link. |
|
200 */ |
|
201 TUint32 iLinkId; |
|
202 |
|
203 /** |
|
204 * ID of stream. |
|
205 */ |
|
206 TUint32 iStreamId; |
|
207 |
|
208 /** |
|
209 * ID identifying endpoint of the stream |
|
210 */ |
|
211 TUint32 iEndPointId; |
|
212 |
|
213 /** |
|
214 * Indicates is crypto context binded into the stream |
|
215 */ |
|
216 TBool iBindingDone; |
|
217 |
|
218 }; |
|
219 |
|
220 typedef TPckgBuf<TMccCryptoContext> TMccCryptoContextPckg; |
|
221 |
|
222 |
|
223 #endif // MMCCCRYPTOCONTEXT_H |