|
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Secure Sockets |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file securesocket_internal.h |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef __SECURESOCKET_INTERNAL_H__ |
|
24 #define __SECURESOCKET_INTERNAL_H__ |
|
25 |
|
26 /** |
|
27 * Maximum length of the protocol name. |
|
28 * |
|
29 * @internalComponent |
|
30 */ |
|
31 const TInt KMaxProtocolName = 32; |
|
32 |
|
33 class TSecSocketProtocol |
|
34 /** |
|
35 * The secure socket protocol class. |
|
36 * |
|
37 * @internalComponent |
|
38 * |
|
39 * @since v7.0 |
|
40 */ |
|
41 { |
|
42 public: |
|
43 /** Protocol name. */ |
|
44 TBuf<KMaxProtocolName> iName; |
|
45 /** Handle to the DLL. */ |
|
46 RLibrary iLibrary; |
|
47 static inline TInt Offset() |
|
48 /** |
|
49 * Gets the offset to the iSlink member. |
|
50 * |
|
51 * @return The offset to the iSlink member. */ |
|
52 {return _FOFF(TSecSocketProtocol,iSlink);} |
|
53 // Moved the implementation to the cpp file |
|
54 virtual ~TSecSocketProtocol(); |
|
55 private: |
|
56 TSglQueLink iSlink; |
|
57 }; |
|
58 |
|
59 |
|
60 class TSecureSocketGlobals |
|
61 /** |
|
62 * Class to store the Secure Sockets Globals. |
|
63 * |
|
64 * @internalComponent |
|
65 * |
|
66 * @since v7.0 |
|
67 */ |
|
68 { |
|
69 public: |
|
70 inline TSecureSocketGlobals(): |
|
71 iSecureSocketProtocols(TSecSocketProtocol::Offset()), |
|
72 /** Constructor. */ |
|
73 iSecureSocketProtocolsIter(iSecureSocketProtocols), |
|
74 iUseCount(0){}; |
|
75 /** List of supported protocols. */ |
|
76 TSglQue<TSecSocketProtocol> iSecureSocketProtocols; |
|
77 /** A templated class that provides for iterating through the list of supported |
|
78 * protocols. */ |
|
79 TSglQueIter<TSecSocketProtocol> iSecureSocketProtocolsIter; |
|
80 /** Use counter. */ |
|
81 TInt iUseCount; |
|
82 }; |
|
83 |
|
84 class MGenericSecureSocket; |
|
85 |
|
86 /** |
|
87 * Definition for the entry point function exported by Secure Socket modules. |
|
88 * |
|
89 * @internalComponent |
|
90 */ |
|
91 typedef TInt (*TSecSockDllLibraryFunction)( RSocket& aSocket, const TDesC& aProtocol ); |
|
92 typedef TInt (*TSecSockDllLibraryGenericFunction)(MGenericSecureSocket& aSocket, const TDesC& aProtocol); |
|
93 |
|
94 /** |
|
95 * Definition for the entry point for the cleanup function exported by secureSocket modules |
|
96 * |
|
97 * @internalComponent |
|
98 */ |
|
99 typedef void (*TSecSockDllUnloadFunction)( TAny* ); |
|
100 |
|
101 class CSecureSocketLibraryLoader : public CBase |
|
102 /** |
|
103 * Factory class for creating secure sockets. |
|
104 * |
|
105 * @internalAll |
|
106 * |
|
107 * @since v6.2 */ |
|
108 // Create and reference Secure Sockets |
|
109 { |
|
110 public: |
|
111 static TInt OpenL(const TDesC& aProtocolName,TSecSockDllLibraryFunction& anEntryPoint); |
|
112 static TInt OpenL(const TDesC& aProtocolName, TSecSockDllLibraryGenericFunction& aEntryPoint); |
|
113 static void FindItemInDbL(const TDesC& aProtocolName, TDes& aLibraryName); |
|
114 IMPORT_C static void Unload(); |
|
115 |
|
116 private: |
|
117 static void OpenWithIdL(TInt aId, const TDesC& aProtocolName, TLibraryFunction& aEntryPoint); |
|
118 }; |
|
119 |
|
120 |
|
121 |
|
122 #endif // __SECURESOCKET_H__ |