|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _TELENET_ENGINE_H_ |
|
20 #define _TELENET_ENGINE_H_ |
|
21 |
|
22 #include <telsess.h> |
|
23 #include "TELFSM.H" |
|
24 |
|
25 class CTelnetResolver; |
|
26 class CAtiveWriter; |
|
27 class CActiveReader; |
|
28 class CIOControl; |
|
29 class CReadTrigger; |
|
30 class MIONotifier; |
|
31 class CProto; |
|
32 |
|
33 const int KPortReadBufferSize = 128; |
|
34 |
|
35 const int KClientReadBufferSize = 512; |
|
36 |
|
37 NONSHARABLE_CLASS(CTelnetControl) : public CBase , public MTelnetResolver, public MIONotifier , public MProtoEvent |
|
38 /** |
|
39 @internalComponent |
|
40 */ |
|
41 { |
|
42 public: |
|
43 |
|
44 CTelnetControl(); |
|
45 ~CTelnetControl(); |
|
46 |
|
47 static CTelnetControl* NewL(const TTelnetConfig& aConfig,MTelnetNotification* aTelnetNotification); |
|
48 void ConstructL(const TTelnetConfig& aConfig,MTelnetNotification* aTelnetNotification); |
|
49 void Reset(); |
|
50 |
|
51 TInt Connect(const TDesC& aServerName, TUint aPort); |
|
52 TInt Connect(const TInetAddr& aInetAddr, TUint aPort); |
|
53 |
|
54 TInt SetOption(const TInt aOption); |
|
55 TInt SetConfig(const TTelnetConfig& aConfig); |
|
56 TInt OptionStatus(TOptionStatus& aStatus); |
|
57 |
|
58 TInt Disconnect(); |
|
59 |
|
60 TInt Read(); |
|
61 TInt Write(const TDesC8& aBuffer); |
|
62 TInt Write(TTelnetUserControl& aControlCode); |
|
63 |
|
64 |
|
65 // MTelnetResolver |
|
66 void ResolverConnectedL(); |
|
67 void ResolverDisconnected(); |
|
68 void ResolverError(TInt aError); |
|
69 |
|
70 // MIONotification |
|
71 void WriteComplete(); |
|
72 void WriteError(TInt aError); |
|
73 void ReadCompleteL(); |
|
74 void ReadComplete(TInt aError); |
|
75 void Event(TInt aEvent, TInt aEventCode); |
|
76 |
|
77 // MProtoEvent |
|
78 void ProtoError(TInt aError); |
|
79 void ProtoEvent(); |
|
80 |
|
81 |
|
82 private: |
|
83 // For passing data to the client app |
|
84 TBuf8<KClientReadBufferSize> iClientReadBuffer; |
|
85 // Passed to IO control for receiving data from the server |
|
86 TBuf8<KPortReadBufferSize> iPortReadBuffer; |
|
87 |
|
88 TBool iClientWriteOutstanding; |
|
89 |
|
90 MTelnetNotification* iTelnetNotification; |
|
91 |
|
92 CTelnetResolver* iTelnetResolver; |
|
93 |
|
94 CActiveWriter* iPortWriter; |
|
95 CActiveReader* iPortReader; |
|
96 CIOBufferControl* iPortIOControl; |
|
97 |
|
98 CProto* iProto; |
|
99 |
|
100 }; |
|
101 |
|
102 #endif |