|
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 #if !defined(__SS_FLOWBINDERS_H__) |
|
17 #define __SS_FLOWBINDERS_H__ |
|
18 |
|
19 #include <comms-infras/ss_common.h> |
|
20 #include <es_enum.h> |
|
21 #include <e32base.h> |
|
22 #include <comms-infras/es_protbinder.h> |
|
23 |
|
24 #include <comms-infras/ss_flowbinders_internal.h> |
|
25 |
|
26 class RMBufChain; |
|
27 class MProvdSecurityChecker; |
|
28 |
|
29 namespace ESock |
|
30 { |
|
31 |
|
32 class MUpperDataReceiver; |
|
33 class MUpperControl; |
|
34 class MLowerDataSender; |
|
35 class MLowerControl; |
|
36 |
|
37 class MSessionDataNotify; |
|
38 class MSessionControlNotify; |
|
39 class MSessionData; |
|
40 class MSessionControl; |
|
41 |
|
42 class CSubConnectionFlowBase; |
|
43 |
|
44 const TInt KErrBindersInvalid = -17205; //The recepient of this error must abandoned its binders |
|
45 //as they have become invalid |
|
46 |
|
47 // ========================================================================================= |
|
48 |
|
49 class MSessionDataNotify |
|
50 /** Abstract base class used by a CSubConnectionFlowBase to support session binders, through its |
|
51 iSocket member, to notify the socket server that various events have occurred. |
|
52 |
|
53 The class provides several up-call member functions. |
|
54 |
|
55 All up-calls on an MSocketNotify should be made in the context of the socket |
|
56 server's thread - i.e. the thread which called NewSAPL() on the protocol. |
|
57 |
|
58 @publishedPartner |
|
59 @released Since v9.3 */ |
|
60 { |
|
61 public: |
|
62 |
|
63 /** |
|
64 Indicates that new data is available on a service access point |
|
65 |
|
66 For a stream-oriented protocol aCount should be a byte count; for datagram-oriented |
|
67 sockets aCount should be a datagram count. |
|
68 |
|
69 @note aCount is the amount of new data, not the total amount of data waiting |
|
70 to be read. |
|
71 |
|
72 @param aCount The amount of new data. A value of KNewDataEndofData indicates |
|
73 that the socket is in a half-closed state and will receive no more data. Any subsequent |
|
74 reads will complete with KErrEof and a length of 0. */ |
|
75 virtual void NewData(TUint aCount) = 0; |
|
76 /** Indicates that new buffer space is available on a service. */ |
|
77 virtual void CanSend() = 0; |
|
78 }; |
|
79 |
|
80 class MSessionControlNotify |
|
81 /** Abstract base class used by a CSubConnectionFlowBase to support session binders, through its |
|
82 iSocket member, to notify the socket server that various events have occurred. |
|
83 |
|
84 The class provides several up-call member functions. |
|
85 |
|
86 All up-calls on an MSocketNotify should be made in the context of the socket |
|
87 server's thread - i.e. the thread which called NewSAPL() on the protocol. |
|
88 |
|
89 @publishedPartner |
|
90 @released Since v9.3 */ |
|
91 { |
|
92 public: |
|
93 enum TDelete |
|
94 { |
|
95 /** Delete SAP */ |
|
96 EDelete, |
|
97 /** Don't delete SAP */ |
|
98 EDetach |
|
99 }; |
|
100 enum TOperationBitmasks |
|
101 { |
|
102 /** An error has occurred which affects Send() operations */ |
|
103 EErrorSend=0x0000001, |
|
104 |
|
105 /** An error has occurred which affects Receive() operations. */ |
|
106 EErrorRecv=0x0000002, |
|
107 |
|
108 /** An error has occurred which affects Connect() operations */ |
|
109 EErrorConnect=0x0000004, |
|
110 |
|
111 /** An error has occurred which affects Close() operations */ |
|
112 EErrorClose=0x00000008, |
|
113 |
|
114 /** An error has occurred which affects Ioctl() operations */ |
|
115 EErrorIoctl=0x00000010, |
|
116 |
|
117 /** An error has occurred which only requires to CompleteConnect beeing called **/ |
|
118 EErrorCompleteConnect=0x00000020, |
|
119 /** An error has occurred which affects SetLocalName() operations */ |
|
120 EErrorCompleteSetLocalName=0x00000040, |
|
121 |
|
122 /** A fatal error has occurred */ |
|
123 EErrorFatal=0x10000000, |
|
124 |
|
125 /** An error has occurred which affects all operations */ |
|
126 EErrorAllOperations=0x7fffffff, |
|
127 |
|
128 #if defined(SYMBIAN_NETWORKING_LEGACY_COMPATIBILITY_SUPPORT) |
|
129 /** A pseudo-error: the SAP is requesting a legacy compatibility feature as specified |
|
130 by the error code. This flag cannot be combined with any others |
|
131 */ |
|
132 EErrorLegacySupportRequest = 0x40000000, |
|
133 #endif |
|
134 }; |
|
135 /** Indicates that a connection attempt has completed successfully (for active opens). |
|
136 |
|
137 There are four versions of this up-call: two are for active opens and two are for passive |
|
138 opens. Both active and passive versions support a variant carrying user connection |
|
139 data for protocols which support it. |
|
140 |
|
141 @note A connection-less protocol should never call the ConnectComplete() up-calls. |
|
142 @note A protocol should keep a count of sockets which have called ConnectComplete() |
|
143 but have not had Start() called. Sockets in this state have their Error() |
|
144 and NewData() calls deferred until Start() is called.*/ |
|
145 virtual void ConnectComplete() = 0; |
|
146 /** Indicates that a connection attempt has completed successfully (for active opens). |
|
147 |
|
148 There are four versions of this up-call: two are for active opens and two are for passive |
|
149 opens. Both active and passive versions support a variant carrying user connection |
|
150 data for protocols which support it. |
|
151 |
|
152 @note A connection-less protocol should never call the ConnectComplete() up-calls. |
|
153 @note A protocol should keep a count of sockets which have called ConnectComplete() |
|
154 but have not had Start() called. Sockets in this state have their Error() |
|
155 and NewData() calls deferred until Start() is called. |
|
156 |
|
157 @param aConnectData Connect data (if supported). |
|
158 */ |
|
159 virtual void ConnectComplete(const TDesC8& aConnectData) = 0; |
|
160 /** Indicates that a connection attempt has completed successfully (for passive opens). |
|
161 |
|
162 There are four versions of this up-call: two are for active opens and two are for passive |
|
163 opens. Both active and passive versions support a variant carrying user connection |
|
164 data for protocols which support it. |
|
165 |
|
166 The versions of ConnectComplete() for passive opens carry a new SSP (socket service |
|
167 provider, or SAP) for the newly created socket. A new socket will then be linked up to |
|
168 the SSP and data transfer can take place. The original socket stays listening. |
|
169 |
|
170 @note A connection-less protocol should never call the ConnectComplete() up-calls. |
|
171 @note A protocol should keep a count of sockets which have called ConnectComplete() |
|
172 but have not had Start() called. Sockets in this state have their Error() |
|
173 and NewData() calls deferred until Start() is called. |
|
174 |
|
175 @param aSSP The new SSP for passive opens. |
|
176 */ |
|
177 virtual void ConnectComplete(CSubConnectionFlowBase& aSSP) = 0; |
|
178 /** Indicates that a connection attempt has completed successfully (for passive opens). |
|
179 |
|
180 There are four versions of this up-call: two are for active opens and two are for passive |
|
181 opens. Both active and passive versions support a variant carrying user connection |
|
182 data for protocols which support it. |
|
183 |
|
184 The versions of ConnectComplete() for passive opens carry a new SSP (socket service |
|
185 provider, or SAP) for the newly created socket. A new socket will then be linked up to |
|
186 the SSP and data transfer can take place. The original socket stays listening. |
|
187 |
|
188 @note A connection-less protocol should never call the ConnectComplete() up-calls. |
|
189 @note A protocol should keep a count of sockets which have called ConnectComplete() |
|
190 but have not had Start() called. Sockets in this state have their Error() |
|
191 and NewData() calls deferred until Start() is called. |
|
192 |
|
193 @param aSSP The new SSP for passive opens. |
|
194 @param aConnectData Connect data (if supported). */ |
|
195 virtual void ConnectComplete(CSubConnectionFlowBase& aSSP,const TDesC8& aConnectData) = 0; |
|
196 /** Indicates that the SAP has finished closing down. |
|
197 |
|
198 This up-call is the response to a Shutdown(). A connection-oriented protocol should call |
|
199 CanClose() when it has terminated communications with the remote host. Protocols can call |
|
200 CanClose() from within their Shutdown() code. After CanClose() has been called, an SAP may |
|
201 be deleted by the socket server. |
|
202 |
|
203 @note The protocol must not access the CSubConnectionFlowBase object after calling CanClose(). |
|
204 @param aDelete Delete SAP. |
|
205 */ |
|
206 virtual void CanClose(MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete) = 0; |
|
207 /** Indicates that the SAP has finished closing down. |
|
208 |
|
209 This up-call is the response to a Shutdown(). A connection-oriented protocol should call |
|
210 CanClose() when it has terminated communications with the remote host. Protocols can call |
|
211 CanClose() from within their Shutdown() code. After CanClose() has been called, an SAP may |
|
212 be deleted by the socket server. |
|
213 |
|
214 @note The protocol must not access the CSubConnectionFlowBase object after calling CanClose(). |
|
215 @param aDisconnectData Any user data carried on the disconnect frame. |
|
216 @param aDelete Delete SAP. |
|
217 */ |
|
218 virtual void CanClose(const TDesC8& aDisconnectData,MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete) = 0; |
|
219 /** Tells the socket server that an error state has arisen within the protocol. |
|
220 |
|
221 It should not be used to report programmatic errors, either in the protocol |
|
222 itself or the socket server (a panic should be used in these cases). When |
|
223 Error() is called on a connection-oriented socket, the socket is moved into |
|
224 a dead state which denies user access to it. |
|
225 |
|
226 @param anError KErrNone or another of the system-wide error codes. |
|
227 @param anOperationMask A bitmask of TOperationBitmasks values specifying which |
|
228 @return error code translated by the object |
|
229 pending operations are affected by the Error up-call. */ |
|
230 virtual TInt Error(TInt anError,TUint anOperationMask=MSessionControlNotify::EErrorAllOperations) = 0; |
|
231 /** Indicates that the other end of a connection has disconnected. |
|
232 |
|
233 This is analogous to CanClose(), but in this case the other end initiated it. |
|
234 |
|
235 Once the client has called Shutdown() it is illegal to call Disconnect(). Instead, |
|
236 CanClose() or Error(KErrDisconnected) should be called. |
|
237 */ |
|
238 virtual void Disconnect(void) = 0; |
|
239 /** Indicates that the other end of a connection has disconnected. |
|
240 |
|
241 This is analogous to CanClose(), but in this case the other end initiated it. |
|
242 |
|
243 Once the client has called Shutdown() it is illegal to call Disconnect(). Instead, |
|
244 CanClose() or Error(KErrDisconnected) should be called. |
|
245 |
|
246 @param aConnectData User data in the disconnect frame. |
|
247 */ |
|
248 virtual void Disconnect(TDesC8& aDisconnectData) = 0; |
|
249 /** Indicates that the currently pending Ioctl has completed. |
|
250 |
|
251 The parameter aBuf is protocol defined - in fact it is defined by the specific |
|
252 Ioctl. |
|
253 |
|
254 @param aBuf Any data requested by the Ioctl operation. */ |
|
255 virtual void IoctlComplete(TDesC8* aBuf) = 0; |
|
256 /** Indicates that the other end of a passively opened connection which has not been |
|
257 accepted yet and is waiting in the accept queue has been disconnected. |
|
258 |
|
259 This is analogous to Disconnect(), but is directed towards the listening socket |
|
260 so that it can remove the SAP from the accept queue. |
|
261 |
|
262 It is illegal to call DisconnectFromListener twice. |
|
263 */ |
|
264 virtual void DisconnectFromListener(CSubConnectionFlowBase& aSSP) = 0; |
|
265 |
|
266 /** |
|
267 Indicates that the set local name sequence is complete. |
|
268 */ |
|
269 virtual void SetLocalNameComplete() = 0; |
|
270 |
|
271 |
|
272 }; |
|
273 } //namespace ESock |
|
274 |
|
275 #endif //__SS_FLOWBINDERS_H__ |
|
276 |