|
1 /* |
|
2 * Copyright (c) 2009 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 #ifndef __LEGACY_LOOPBACK_FLOW_H__ |
|
18 #define __LEGACY_LOOPBACK_FLOW_H__ |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <e32std.h> |
|
22 |
|
23 #include <comms-infras/nifif.h> |
|
24 #include "binder.h" |
|
25 #include <comms-infras/ss_subconnflow.h> |
|
26 |
|
27 #ifdef SYMBIAN_OLD_EXPORT_LOCATION |
|
28 #include <comms-infras/legacy_loopback_driver.h> |
|
29 #else |
|
30 //this header is not exported, needs to be a user include |
|
31 #include "legacy_loopback_driver.h" |
|
32 #endif |
|
33 |
|
34 class CLegacyLoopbackProvision; |
|
35 class TLegacyLoopbackIp6Provision; |
|
36 class TLegacyLoopBackAgentProvision; |
|
37 |
|
38 const TInt KLegacyLoopbackFlowImplementationUid = 0x102871C3; |
|
39 |
|
40 // String literals for protocol name used during flow binding |
|
41 _LIT8(KProtocol4, "ip"); |
|
42 _LIT8(KProtocol6, "ip6"); |
|
43 |
|
44 class CLegacyLoopbackSubConnectionFlowFactory : public ESock::CSubConnectionFlowFactoryBase |
|
45 /** |
|
46 */ |
|
47 { |
|
48 public: |
|
49 static CLegacyLoopbackSubConnectionFlowFactory* NewL(TAny* aConstructionParameters); |
|
50 virtual ESock::CSubConnectionFlowBase* DoCreateFlowL(ESock::CProtocolIntfBase* aProtocolIntf, ESock::TFactoryQueryBase& aQuery); |
|
51 protected: |
|
52 CLegacyLoopbackSubConnectionFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer); |
|
53 }; |
|
54 |
|
55 class CLegacyLoopbackBinder4; |
|
56 class CLegacyLoopbackBinder6; |
|
57 class CLegacyLoopbackFlowTestingSubscriber; |
|
58 class CLegacyLoopbackSubConnectionFlow : public ESock::CSubConnectionFlowBase, public ESock::MFlowBinderControl |
|
59 /** |
|
60 */ |
|
61 { |
|
62 friend class CLegacyLoopbackSubConnectionFlowFactory; |
|
63 public: |
|
64 static CLegacyLoopbackSubConnectionFlow* NewL(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); |
|
65 |
|
66 // from Messages::ANode (via CSubConnectionFlowBase) |
|
67 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
68 |
|
69 // Methods called from Binders |
|
70 void FlowDown(TInt aError, TInt aAction = MNifIfNotify::EDisconnect); |
|
71 void Progress(TInt aStage, TInt aError); |
|
72 const TLegacyLoopbackIp6Provision* Ip6Provision() const; |
|
73 const TLegacyLoopBackAgentProvision* AgentProvision() const; |
|
74 |
|
75 // Functions for dealing with SCPR messages |
|
76 void StartFlowL(); |
|
77 void StopFlow(TInt aError); |
|
78 void Destroy(); |
|
79 void SubConnectionGoingDown(); |
|
80 void SubConnectionError(TInt aError); |
|
81 |
|
82 // from MFlowBinderControl |
|
83 virtual ESock::MLowerControl* GetControlL(const TDesC8& aProtocol); |
|
84 virtual ESock::MLowerDataSender* BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
85 virtual void Unbind(ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl); |
|
86 virtual ESock::CSubConnectionFlowBase* Flow(); |
|
87 |
|
88 protected: |
|
89 CLegacyLoopbackSubConnectionFlow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf); |
|
90 virtual ~CLegacyLoopbackSubConnectionFlow(); |
|
91 |
|
92 // CSubConnectionFlowBase |
|
93 virtual ESock::MFlowBinderControl* DoGetBinderControlL(); |
|
94 |
|
95 // Utilities for posting SCPR messages |
|
96 void PostProgressMessage(TInt aStage, TInt aError); |
|
97 void PostDataClientStartedMessage(); |
|
98 void PostFlowDownMessage(TInt aError, TInt aAction = MNifIfNotify::EDisconnect); |
|
99 void MaybePostDataClientIdle(); |
|
100 |
|
101 inline void SetBinder4(CLegacyLoopbackBinder4* aBinder4); |
|
102 inline void SetBinder6(CLegacyLoopbackBinder6* aBinder4); |
|
103 |
|
104 private: |
|
105 virtual void ProvisionConfig(const ESock::RMetaExtensionContainerC& aConfigData); |
|
106 void AgentProvisionConfigL(); |
|
107 |
|
108 protected: |
|
109 __FLOG_DECLARATION_MEMBER; |
|
110 |
|
111 CLegacyLoopbackBinder4* iBinder4; // IPv4 binder |
|
112 CLegacyLoopbackBinder6* iBinder6; // IPv6 binder |
|
113 const CLegacyLoopbackProvision* iProvision; // cached pointer to provisioning structure in SCPR (in control side memory) |
|
114 const TLegacyLoopBackAgentProvision* iAgentProvision;// cached pointer to provisioning structure in SCPR (in control side memory) |
|
115 TInt iSavedError; // errors during processing of ProvisionConfig message |
|
116 TBool iFlowStarted:1; |
|
117 |
|
118 public: |
|
119 TBool iDisableStart:1; |
|
120 |
|
121 RLegacyLoopbackDriver iLoopbackLdd; |
|
122 }; |
|
123 |
|
124 enum TLegacyLoopbackPanicNum |
|
125 { |
|
126 EUnexpectedMessage |
|
127 }; |
|
128 |
|
129 void Panic(TLegacyLoopbackPanicNum); |
|
130 |
|
131 #include "flow.inl" |
|
132 |
|
133 #endif // __LEGACY_LOOPBACK_FLOW_H__ |