|
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 // |
|
15 |
|
16 /** |
|
17 @file IF_INT.CPP |
|
18 */ |
|
19 |
|
20 #include <comms-infras/nifif.h> |
|
21 #include "NI_STD.H" |
|
22 #include <in_sock.h> |
|
23 |
|
24 |
|
25 // |
|
26 // CNifIfFactory default implementations |
|
27 // |
|
28 |
|
29 EXPORT_C CNifIfBase* CNifIfFactory::NewInterfaceL(const TDesC& aName, MNifIfNotify* /*aNotify*/) |
|
30 /** |
|
31 * Create a new instance of the nif contained within this DLL, passing in the interface to nifman for nifs that need the MNifIfNotify pointer for early initialisation (eg: for CommDb access). |
|
32 * @note This should only be used as a temporary method of stacking nifs, where the commdb access is used to find out which additional nif to load |
|
33 * @param aName The name of the nif instance to create |
|
34 * @since v7.0s |
|
35 */ |
|
36 { |
|
37 return NewInterfaceL(aName); // By default, call the standard NewInterfaceL() virtual |
|
38 } |
|
39 |
|
40 |
|
41 // |
|
42 // CNifIfBase default implementations |
|
43 // |
|
44 |
|
45 EXPORT_C CNifIfBase::CNifIfBase(CNifIfFactory& aFactory) |
|
46 /** |
|
47 Constructor |
|
48 */ |
|
49 : iFactory(&aFactory) |
|
50 { |
|
51 |
|
52 iFactory->Open(); |
|
53 } |
|
54 |
|
55 EXPORT_C CNifIfBase::CNifIfBase(CNifIfLink& aLink) |
|
56 /** |
|
57 Constructor |
|
58 */ |
|
59 : iFactory(aLink.iFactory), iNotify(aLink.iNotify) |
|
60 { |
|
61 |
|
62 iFactory->Open(); |
|
63 } |
|
64 |
|
65 EXPORT_C CNifIfBase::CNifIfBase() |
|
66 /** |
|
67 Constructor |
|
68 */ |
|
69 { |
|
70 |
|
71 } |
|
72 |
|
73 EXPORT_C CNifIfBase::~CNifIfBase() |
|
74 /** |
|
75 Destructor |
|
76 */ |
|
77 { |
|
78 |
|
79 if(iFactory) |
|
80 iFactory->Close(); |
|
81 } |
|
82 |
|
83 EXPORT_C void CNifIfBase::Open() |
|
84 /** |
|
85 Increment reference count |
|
86 */ |
|
87 { |
|
88 ++iRefCount; |
|
89 } |
|
90 |
|
91 |
|
92 EXPORT_C void CNifIfBase::Close() |
|
93 /** |
|
94 Decrement reference count |
|
95 */ |
|
96 { |
|
97 |
|
98 --iRefCount; |
|
99 __ASSERT_DEBUG(iRefCount>=0, Panic(ENifManPanic_NegativeCloseCount)); |
|
100 if(iRefCount<=0) |
|
101 delete this; |
|
102 } |
|
103 |
|
104 EXPORT_C void CNifIfBase::Cleanup(TAny* aIf) |
|
105 /** |
|
106 Clean up an interface |
|
107 */ |
|
108 { |
|
109 |
|
110 ((CNifIfBase*)aIf)->Close(); |
|
111 } |
|
112 |
|
113 |
|
114 EXPORT_C void CNifIfBase::BindL(TAny* /*aId*/) |
|
115 /** |
|
116 * Bind to the protocol layer (store the pointer to the CProtocolBase object) |
|
117 * @param aId A pointer to the protocol layer (should be cast to a CProtocolBase object) |
|
118 */ |
|
119 { |
|
120 |
|
121 } |
|
122 |
|
123 EXPORT_C TInt CNifIfBase::Control(TUint /*aLevel*/, TUint /*aName*/, TDes8& /*aOption*/, TAny* /*aSource*/) |
|
124 /** |
|
125 * Control function for additional control of the nif |
|
126 * @param aLevel The intended level for this control option |
|
127 * @param aName The name of the control option |
|
128 * @param aOption Any data associated with this control option, contained within a TPckg(Buf) |
|
129 * @param aSource If provided, an identifier for the source of the control option; by default, zero |
|
130 * @return KErrNone if successful; otherwise one of the standard Symbian OS error codes |
|
131 */ |
|
132 { |
|
133 return KErrNotSupported; |
|
134 } |
|
135 |
|
136 EXPORT_C TInt CNifIfBase::State() |
|
137 /** |
|
138 * Return the current state of the interface |
|
139 * @return A TIfStatus indicating the current state of the interface |
|
140 * @note Return interface as being up for BC |
|
141 * @since v2.0? |
|
142 */ |
|
143 { |
|
144 // Panic as each nif should implement this method, however, for BC reasons this cannot be made pure virtual |
|
145 __ASSERT_DEBUG(ETrue, Panic(ENifManPanic_IncorrectNifOperation)); |
|
146 return TInt(EIfUp); |
|
147 } |
|
148 |
|
149 |
|
150 // |
|
151 // CNifIfLink default implementations |
|
152 // |
|
153 |
|
154 EXPORT_C CNifIfLink::CNifIfLink(CNifIfFactory& aFactory) |
|
155 /** |
|
156 * |
|
157 */ |
|
158 : CNifIfBase(aFactory) |
|
159 /** |
|
160 Constructor |
|
161 */ |
|
162 { |
|
163 } |
|
164 |
|
165 EXPORT_C void CNifIfLink::AuthenticateComplete(TInt /*aResult*/) |
|
166 /** |
|
167 * Indicate that the data returned by MNifIfNotify::Authenticate() is now valid |
|
168 * @note This function is unused because [*** to do ***] |
|
169 * @param aResult The error code, if any, from fetching the authentication data |
|
170 */ |
|
171 { |
|
172 } |
|
173 |
|
174 EXPORT_C void CNifIfLink::Restart(CNifIfBase* /*aIf*/) |
|
175 /** |
|
176 * Do nothing, as nifs do not have to support binder layer restart functionality |
|
177 * @note Obviously if a nif does support binder layer restart, then it should overload this method |
|
178 * @param aIf Pointer to the CNifIfBase binder layer to restart |
|
179 */ |
|
180 { |
|
181 } |
|
182 |
|
183 |
|
184 |
|
185 |