|
1 /* |
|
2 * Copyright (c) 2004 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: See class definition below. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CTCTCPMANAGER_H__ |
|
19 #define __CTCTCPMANAGER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <es_sock.h> |
|
23 #include <commdbconnpref.h> |
|
24 #include "CTcTcpConnection.h" |
|
25 #include "MTcBearerManager.h" |
|
26 #include "MTcBearerObserver.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TTcTcpFactory; |
|
30 |
|
31 // CLASS DEFINITION |
|
32 /** |
|
33 * CTcTcpManager implements TCP/IP specific connection management, |
|
34 * like Internet access point settings. It also owns and controls |
|
35 * the CTcTcpConnection instance. |
|
36 */ |
|
37 class CTcTcpManager |
|
38 : public CActive, |
|
39 public MTcBearerManager, |
|
40 public MTcBearerObserver |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Static constructor. |
|
46 * |
|
47 * @param aFactory Specifies the used bearer type |
|
48 * @return An initialized instance of this class |
|
49 */ |
|
50 static CTcTcpManager* NewL( const TTcTcpFactory& aFactory ); |
|
51 |
|
52 /// Destructor |
|
53 ~CTcTcpManager(); |
|
54 |
|
55 private: // Constructors |
|
56 |
|
57 /** |
|
58 * Constructor |
|
59 * |
|
60 * @param aFactory Specifies the used bearer type |
|
61 */ |
|
62 CTcTcpManager( const TTcTcpFactory& aFactory ); |
|
63 |
|
64 /// Default constructor. Not implemented. |
|
65 CTcTcpManager(); |
|
66 |
|
67 /// 2nd phase constructor. |
|
68 void ConstructL(); |
|
69 |
|
70 public: // From CActive |
|
71 |
|
72 void RunL(); |
|
73 void DoCancel(); |
|
74 |
|
75 public: // From MTcBearerManager |
|
76 |
|
77 void ConnectL( TInetAddr* aRemoteAddr ); |
|
78 void Close(); |
|
79 void Send( const TDesC8& aDes ); |
|
80 void Receive( TDes8& aDes ); |
|
81 void ReceiveOneOrMore( TDes8& aDes ); |
|
82 void SetObserver( MTcBearerObserver* aObserver ); |
|
83 void GetLocalAddressL( TDes& aDes ); |
|
84 |
|
85 public: // From MTcBearerObserver |
|
86 |
|
87 void BearerCompletion( MTcBearerObserver::TOperation aOp, |
|
88 TInt aStatus ); |
|
89 |
|
90 private: // Data |
|
91 |
|
92 /// Connection implementation. Owned. |
|
93 CTcTcpConnection iConn; |
|
94 |
|
95 /// Connection observer. Not owned. |
|
96 MTcBearerObserver* iObserver; |
|
97 |
|
98 /// Connection server session. Owned. |
|
99 RConnection iConnServ; |
|
100 |
|
101 /// Socket server session. Owned. |
|
102 RSocketServ iSockServ; |
|
103 |
|
104 /// Internet Access Point Id. |
|
105 /// 0 = ask user, >0 = use quietly |
|
106 TInt iIAPId; |
|
107 |
|
108 TCommDbConnPref iPrefs; |
|
109 |
|
110 TInetAddr* iRemoteAddr; |
|
111 |
|
112 }; |
|
113 |
|
114 #endif // __CTCTCPMANAGER_H__ |