|
1 // Copyright (c) 1997-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 // ESock external utils |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include <ss_pman.h> |
|
23 #include <ss_std.h> |
|
24 #include <comms-infras/ss_log.h> |
|
25 |
|
26 EXPORT_C CProtocolBase* SocketServExt::FindAndLoadProtocolL(const TDesC& aName, TProtocolType aType) |
|
27 /** |
|
28 Find a protocol by name and load it. |
|
29 Caller is responsible for ultimately deleting the protocol |
|
30 |
|
31 */ |
|
32 { |
|
33 return ProtocolManager::FindAndLoadProtocolL(aName, aType); |
|
34 } |
|
35 |
|
36 EXPORT_C CProtocolBase* SocketServExt::FindAndLoadProtocolL(TUint aAddrFamily,TUint aSockType,TUint aProtocol) |
|
37 /** |
|
38 Find a protocol by address family, socket type and protocol ID and load it. |
|
39 Caller is responsible for ultimately deleting the protocol |
|
40 */ |
|
41 { |
|
42 return ProtocolManager::FindAndLoadProtocolL(aAddrFamily, aSockType, aProtocol); |
|
43 } |
|
44 |
|
45 EXPORT_C void SocketServExt::InstallExtensionL(const TDesC& aDllName, const TDesC& aArgs) |
|
46 /** |
|
47 Installs an Esock extension dll |
|
48 |
|
49 */ |
|
50 { |
|
51 SocketServer::InstallExtensionL(aDllName, aArgs); |
|
52 } |
|
53 |
|
54 EXPORT_C void SocketServExt::OpenSession() |
|
55 { |
|
56 // Before 9.1 this provided extensions (ie NifMan) the ability to defer spontaneous shutdown. Now obsolete but retained for compatibility |
|
57 } |
|
58 |
|
59 EXPORT_C void SocketServExt::CloseSession() |
|
60 { |
|
61 // Before 9.1 this provided extensions (ie NifMan) the ability to defer spontaneous shutdown. Now obsolete but retained for compatibility |
|
62 } |
|
63 |
|
64 EXPORT_C void SocketServExt::InstallSchedulerWaitHook(TCallBack* /*aCall*/) |
|
65 { |
|
66 // CSocketScheduler::SetWaitHook(aCall); |
|
67 } |
|
68 |
|
69 EXPORT_C CSocketServExtBase::CSocketServExtBase() |
|
70 { |
|
71 __DECLARE_NAME(_S("CSocketServExtBase")); |
|
72 } |
|
73 |
|
74 EXPORT_C CSocketServExtBase::~CSocketServExtBase() |
|
75 { |
|
76 // if (iExtRef) |
|
77 // delete iExtRef; |
|
78 } |
|
79 |
|
80 CSocketServExtRef::CSocketServExtRef() |
|
81 { |
|
82 __DECLARE_NAME(_S("CSocketServExtRef")); |
|
83 iExtLink.iPrev = &iExtLink; |
|
84 iExtLink.iNext = &iExtLink; |
|
85 } |
|
86 |
|
87 CSocketServExtRef::~CSocketServExtRef() |
|
88 { |
|
89 iExtLink.Deque(); |
|
90 } |
|
91 |
|
92 static void CloseLibrary(TAny* aLib) |
|
93 { |
|
94 |
|
95 ((RLibrary*)aLib)->Close(); |
|
96 } |
|
97 |
|
98 void CSocketServExtRef::InstallL(const TDesC& aDllName, const TDesC& aArgs) |
|
99 /** |
|
100 installs an extension |
|
101 */ |
|
102 { |
|
103 LOG(TBuf8<64> buf8); |
|
104 LOG(buf8.Copy(aDllName)); |
|
105 LOG(ESockLog::Printf(_L8("Loading extension '%S'"), &buf8)); |
|
106 User::LeaveIfError(iLibrary.Load(aDllName)); |
|
107 CleanupStack::PushL(TCleanupItem(CloseLibrary, &iLibrary)); |
|
108 TSocketServExtInstallFn entry = (TSocketServExtInstallFn)iLibrary.Lookup(1); |
|
109 CSocketServExtBase* sx = entry(); |
|
110 User::LeaveIfNull(sx); |
|
111 CleanupStack::PushL(sx); |
|
112 sx->InstallL(aArgs); |
|
113 iExtension = sx; |
|
114 sx->iExtRef = this; |
|
115 CleanupStack::Pop(2); |
|
116 } |
|
117 |
|
118 void CSocketServExtRef::Remove() |
|
119 { |
|
120 if (iExtension) |
|
121 iExtension->Remove(); |
|
122 } |
|
123 |
|
124 void CSocketServExtRef::Close() |
|
125 { |
|
126 if (iExtension) |
|
127 delete iExtension; |
|
128 iLibrary.Close(); |
|
129 } |
|
130 |