|
1 // Copyright (c) 2003-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 __MSOCKETCONTROLLER_H__ |
|
17 #define __MSOCKETCONTROLLER_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 class MSocketController |
|
22 /** |
|
23 The observer API for the socket reader and writer. Is used by the socket |
|
24 reader or writer to notify the socket controller of when either the input or |
|
25 output stream has been closed. It also provides name and port info for the |
|
26 remote host. |
|
27 @internalComponent |
|
28 @see CInputStream |
|
29 */ |
|
30 { |
|
31 public: // enums |
|
32 |
|
33 /** |
|
34 The TStremaType enumerates the types of streams. |
|
35 */ |
|
36 enum TStreamType |
|
37 { |
|
38 /** The input stream. |
|
39 */ |
|
40 EInputStream = 0, |
|
41 /** The output stream. |
|
42 */ |
|
43 EOutputStream |
|
44 }; |
|
45 |
|
46 public: // methods |
|
47 |
|
48 /** |
|
49 This notifies the socket controller that either the input or the output |
|
50 stream is closed. That stream is no longer valid. |
|
51 @param aError The error code explaining why the stream has closed. |
|
52 A value of KErrNone indicates that the stream |
|
53 observer requested that the stream be closed. |
|
54 @param aStreamType The stream that has been closed. |
|
55 */ |
|
56 virtual void StreamClosed(TInt aError, MSocketController::TStreamType aStreamType) =0; |
|
57 |
|
58 /** |
|
59 This notifies the socket controller that either the input or the output |
|
60 stream is suspended. The socket controller should suspend activity on the |
|
61 other stream. |
|
62 @param aStreamType The stream that has been suspended. |
|
63 */ |
|
64 virtual void StreamSuspend(MSocketController::TStreamType aStreamType) =0; |
|
65 |
|
66 /** |
|
67 This notifies the socket controller that either the input or the output |
|
68 stream has resumed. The socket controller should resume activity on the |
|
69 other stream. |
|
70 @param aStreamType The stream that has resumed. |
|
71 */ |
|
72 virtual void StreamResume(MSocketController::TStreamType aStreamType) =0; |
|
73 |
|
74 /** |
|
75 Provides name and port info for the remote host and the local port that the |
|
76 connection is established on. This functionality is only available in debug |
|
77 builds and therefore this function should only be used in debug builds. |
|
78 @param aRemoteHost The output buffer to hold the remote host name. |
|
79 @param aRemotePort The output argument for the remote host port. |
|
80 @param aLocalPort The output argument for the local port. |
|
81 @panic EInvariantFalse The function has been called in a release build. |
|
82 */ |
|
83 virtual void ConnectionInfo(TDes8& aRemoteHost, TUint16& aRemotePort, TUint16& aLocalPort) =0; |
|
84 |
|
85 }; |
|
86 |
|
87 #endif // __MSOCKETCONTROLLER_H__ |
|
88 |