|
1 /** |
|
2 * Copyright (c) 2010 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 * Header file for the Default SubConnection Flow |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file tundriverflow.h |
|
24 @internalTechnology |
|
25 */ |
|
26 |
|
27 #ifndef TUNDRIVERFLOW_H |
|
28 #define TUNDRIVERFLOW_H |
|
29 |
|
30 #include <e32base.h> |
|
31 #include <e32std.h> |
|
32 #include <comms-infras/ss_subconnflow.h> |
|
33 #include <comms-infras/nifif.h> |
|
34 #include "tundriverbinder.h" |
|
35 #include "tundriverprovision.h" |
|
36 |
|
37 /** |
|
38 Tun Driver SubConnFlow Implementation UID |
|
39 */ |
|
40 const TInt KTunDriverFlowImplementationUid = 0x10281C3C; |
|
41 |
|
42 // String literals for protocol name used during flow binding |
|
43 _LIT8(KProtocol4, "ip"); |
|
44 #ifdef IPV6SUPPORT |
|
45 _LIT8(KProtocol6, "ip6"); |
|
46 #endif |
|
47 |
|
48 class CTunDriverSubConnectionFlowFactory : public ESock::CSubConnectionFlowFactoryBase |
|
49 /** |
|
50 */ |
|
51 { |
|
52 public: |
|
53 static CTunDriverSubConnectionFlowFactory* NewL(TAny* aConstructionParameters); |
|
54 virtual ESock::CSubConnectionFlowBase* DoCreateFlowL(ESock::CProtocolIntfBase* aProtocolIntf, ESock::TFactoryQueryBase& aQuery); |
|
55 protected: |
|
56 CTunDriverSubConnectionFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer); |
|
57 }; |
|
58 |
|
59 class CTunDriverBinder4; |
|
60 #ifdef IPV6SUPPORT |
|
61 class CTunDriverBinder6; |
|
62 #endif |
|
63 class CTunDriverSubConnectionFlow : public ESock::CSubConnectionFlowBase, public ESock::MFlowBinderControl |
|
64 /** |
|
65 */ |
|
66 { |
|
67 public: |
|
68 static CTunDriverSubConnectionFlow* NewL(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); |
|
69 |
|
70 // from Messages::ANode (via CSubConnectionFlowBase) |
|
71 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
72 |
|
73 // Methods called from Binders |
|
74 void FlowDown(TInt aError, TInt aAction = MNifIfNotify::EDisconnect); |
|
75 void Progress(TInt aStage, TInt aError); |
|
76 const TTunDriverIp4Provision* Ip4Provision() const; |
|
77 #ifdef IPV6SUPPORT |
|
78 const TTunDriverIp6Provision* Ip6Provision() const; |
|
79 #endif |
|
80 |
|
81 // Functions for dealing with SCPR messages |
|
82 void StartFlowL(); |
|
83 void CancelFlow(TInt aError); |
|
84 void StopFlow(TInt aError); |
|
85 void Destroy(); |
|
86 void SubConnectionGoingDown(); |
|
87 void SubConnectionError(TInt aError); |
|
88 |
|
89 // from MFlowBinderControl |
|
90 virtual ESock::MLowerControl* GetControlL(const TDesC8& aProtocol); |
|
91 virtual ESock::MLowerDataSender* BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
92 virtual void Unbind(ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
93 virtual ESock::CSubConnectionFlowBase* Flow(); |
|
94 |
|
95 protected: |
|
96 CTunDriverSubConnectionFlow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); |
|
97 virtual ~CTunDriverSubConnectionFlow(); |
|
98 |
|
99 // CSubConnectionFlowBase |
|
100 virtual ESock::MFlowBinderControl* DoGetBinderControlL(); |
|
101 |
|
102 // Utilities for posting SCPR messages |
|
103 void PostProgressMessage(TInt aStage, TInt aError); |
|
104 void PostDataClientStartedMessage(); |
|
105 void PostFlowDownMessage(TInt aError, TInt aAction = MNifIfNotify::EDisconnect); |
|
106 void MaybePostDataClientIdle(); |
|
107 |
|
108 private: |
|
109 void ProvisionConfig(const ESock::RMetaExtensionContainerC& aConfigData); |
|
110 |
|
111 private: |
|
112 CTunDriverBinder4* iBinder4; |
|
113 #ifdef IPV6SUPPORT |
|
114 CTunDriverBinder6* iBinder6; |
|
115 #endif |
|
116 const CTunDriverProtoProvision* iProvision; // cached pointer to provisioning structure in SCPR (in control side memory) |
|
117 TInt iSavedError; // errors during processing of ProvisionConfig message |
|
118 enum TMeshMachineFlowState |
|
119 { |
|
120 EStopped, |
|
121 EStarting, |
|
122 EStarted, |
|
123 EStopping, |
|
124 }; |
|
125 TMeshMachineFlowState iMMState; |
|
126 __FLOG_DECLARATION_MEMBER; |
|
127 public: |
|
128 }; |
|
129 |
|
130 #endif // TUNDRIVERFLOW_H |