|
1 // Copyright (c) 2006-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 #ifndef __CSOCKETCONTROLLER_H__ |
|
17 #define __CSOCKETCONTROLLER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "msocketcontroller.h" |
|
22 |
|
23 // Forward declarations |
|
24 class CSocket; |
|
25 class MInputStream; |
|
26 class MOutputStream; |
|
27 class CSocketReader; |
|
28 class CSocketWriter; |
|
29 class MSocketControllerStore; |
|
30 class MConnectionPrefsProvider; |
|
31 |
|
32 /** |
|
33 The CSocketController class owns a connected socket. It provides input and |
|
34 output stream objects that use that socket via the CSocketReader and |
|
35 CSocketWriter attributes. |
|
36 |
|
37 A CSocketController object will self-delete once the socket it owns has been |
|
38 closed. The socket can be closed either by the remote client, the input stream |
|
39 observer or the output stream observer. |
|
40 |
|
41 @internalTechnology |
|
42 @prototype |
|
43 */ |
|
44 class CSocketController: public CBase, public MSocketController |
|
45 { |
|
46 public: |
|
47 static CSocketController* NewL(CSocket* aSocket, MConnectionPrefsProvider& aConnectionPrefsProvider); |
|
48 virtual ~CSocketController(); |
|
49 |
|
50 void NotifyInStore(MSocketControllerStore& aStore); |
|
51 MInputStream& InputStream() const; |
|
52 MOutputStream& OutputStream() const; |
|
53 |
|
54 private: |
|
55 CSocketController(CSocket* aSocket, MConnectionPrefsProvider& aConnectionPrefsProvider); |
|
56 void ConstructL(); |
|
57 |
|
58 // from MSocketController |
|
59 virtual void StreamClosed(TInt aError, MSocketController::TStreamType aStreamType); |
|
60 virtual void StreamSuspended(MSocketController::TStreamType aSuspendedStream); |
|
61 virtual void StreamResumed(MSocketController::TStreamType aResumedStream); |
|
62 virtual void ConnectionInfo(TDes8& aRemoteHost, TUint16& aRemotePort, TUint16& aLocalPort); |
|
63 |
|
64 private: |
|
65 /** The socket controller store. This is not owned.*/ |
|
66 MSocketControllerStore* iStore; |
|
67 /** The connected socket.*/ |
|
68 CSocket* iSocket; |
|
69 /** The socket reader. */ |
|
70 CSocketReader* iSocketReader; |
|
71 /** The socket writer. */ |
|
72 CSocketWriter* iSocketWriter; |
|
73 /** The connection preference */ |
|
74 MConnectionPrefsProvider& iConnectionPrefsProvider; |
|
75 }; |
|
76 |
|
77 #endif // __CSOCKETCONTROLLER_H__ |