|
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: Container class for containing MCC SRTP crypto contexts |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MMCCCRYPTOCONTEXTCONTAINER_H |
|
22 #define MMCCCRYPTOCONTEXTCONTAINER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TMMFMessage; |
|
30 class TMccCryptoContext; |
|
31 class TMccSrtpMasterKey; |
|
32 class TMccSrtpMasterSalt; |
|
33 class TMccSrtpCryptoParams; |
|
34 |
|
35 /** |
|
36 * Container class for containing and handling |
|
37 * MCC crypto contexts. |
|
38 * |
|
39 * @lib mmccinterface.lib |
|
40 */ |
|
41 NONSHARABLE_CLASS( CMccCryptoContextContainer ) : public CBase |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CMccCryptoContextContainer* NewL( ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CMccCryptoContextContainer(); |
|
54 |
|
55 public: // New functions |
|
56 |
|
57 /** |
|
58 * Creates new crypto context. |
|
59 * @since Series 60 3.2 |
|
60 * @param aMasterKey The master key value.e. |
|
61 * @param aSaltKey The master salt value. |
|
62 * @param aContextId ID of the new context if successful. |
|
63 * @param aCryptoParams Crypto context optional parameters. |
|
64 * @return KErrNone if success; otherwise system wide error code. |
|
65 */ |
|
66 TInt CreateContext( const TMccSrtpMasterKey& aMasterKey, |
|
67 const TMccSrtpMasterSalt& aSaltKey, |
|
68 TUint32& aContextId, |
|
69 const TMccSrtpCryptoParams& aCryptoParams ); |
|
70 |
|
71 /** |
|
72 * Removes crypto context. |
|
73 * @since Series 60 3.2 |
|
74 * @param aContextId ID of the removable context. |
|
75 * @return KErrNone if success; otherwise system wide error code. |
|
76 */ |
|
77 TInt RemoveContext( TUint32 aContextId ); |
|
78 |
|
79 /** |
|
80 * Updates existing context. |
|
81 * @since Series 60 3.2 |
|
82 * @param aContextId ID of the updating context. |
|
83 * @param aContext New context which updates existing context. |
|
84 * @return KErrNone if success; otherwise system wide error code. |
|
85 */ |
|
86 TInt UpdateContext( TUint32 aContextId, |
|
87 TMccCryptoContext& aContext ); |
|
88 |
|
89 /** |
|
90 * Finds right context and returns it to caller. |
|
91 * @since Series 60 3.2 |
|
92 * @param aContextId ID of the new context if successful. |
|
93 * @param aContext Founded context |
|
94 * @return KErrNone if success; otherwise system wide error code. |
|
95 */ |
|
96 TInt GetContext( TUint32 aContextId, |
|
97 TMccCryptoContext* &aContext ); |
|
98 |
|
99 private: |
|
100 |
|
101 /** |
|
102 * By default Symbian 2nd phase constructor is private. |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 /** |
|
107 * Generates a new crypto context identifier |
|
108 * @since Series 60 3.2 |
|
109 * @return TUint32 New crypto context id; |
|
110 */ |
|
111 TUint32 GenerateContextId(); |
|
112 |
|
113 /** |
|
114 * Finds given crypto context from context array. |
|
115 * @since Series 60 3.2 |
|
116 * @param aContextId Crypto context ID |
|
117 * @return Index to context array or KErrNotFound. |
|
118 */ |
|
119 TInt FindContext( TUint32 aContextId ); |
|
120 |
|
121 private: // Data |
|
122 |
|
123 /** |
|
124 * Array contains the Crypto contexts. |
|
125 */ |
|
126 RArray<TMccCryptoContext> iContextArray; |
|
127 |
|
128 }; |
|
129 |
|
130 |
|
131 #endif /* MMCCCRYPTOCONTEXTCONTAINER_H */ |