|
1 // Copyright (c) 2004-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 |
|
17 |
|
18 /** |
|
19 @internalComponent |
|
20 */ |
|
21 #ifndef __IN_FLOW_H__ |
|
22 #define __IN_FLOW_H__ |
|
23 |
|
24 #include <flow.h> |
|
25 |
|
26 |
|
27 // ************ |
|
28 // CFlowContext |
|
29 // ************ |
|
30 // A base class of the Flow Context, cannot be instantiated as is |
|
31 // |
|
32 class TFlowHook; |
|
33 class MNetworkServiceExtension; |
|
34 class CFlowInternalContext : public CFlowContext |
|
35 { |
|
36 friend class MFlowManager; |
|
37 friend class RFlowContext; |
|
38 protected: |
|
39 CFlowInternalContext(const void *aOwner, MFlowManager *aManager) |
|
40 : CFlowContext(aOwner, aManager) {} |
|
41 CFlowInternalContext(const void *aOwner, MFlowManager *aManager, CFlowContext &aFlow) |
|
42 : CFlowContext(aOwner, aManager, aFlow) {} |
|
43 virtual ~CFlowInternalContext(); |
|
44 public: |
|
45 // |
|
46 // Hook management part |
|
47 // |
|
48 // |
|
49 // Hook Calling Sequences: |
|
50 // Transport Hooks Flow Interface |
|
51 // Setup/prepare |
|
52 // -----> Open() ---> StartL() |
|
53 // After interface is ready |
|
54 // <----- Ready() <-- Reset() |
|
55 // Packet pipeline (flow state = READY) |
|
56 // -----> ApplyL() --> |
|
57 // Shutdown |
|
58 // <----- Close() <-- |
|
59 // |
|
60 /** |
|
61 */ |
|
62 TInt ApplyHooks(RMBufSendPacket &aPacket, RMBufSendInfo &aInfo, RMBufPktQ &aFragments, MNetworkServiceExtension &aExt); |
|
63 /** |
|
64 // Attach the outbound flow hook handler to the flow. |
|
65 // |
|
66 // Called from CProtocolIP::FlowSetupHooks, when the OpenL |
|
67 // returns a non-NULL handle for the hook. |
|
68 // |
|
69 // If the parameter aFrag is non-negative, then it gives the |
|
70 // total header space requirement from the preceding hooks, and |
|
71 // requests that the fragmentation process to the path MTU |
|
72 // must be done before calling the ApplyL of this hook. |
|
73 // |
|
74 // @param aHook The handler for the packets of the flow |
|
75 // @param aFrag Request fragmenation before this hook, if > -1 |
|
76 */ |
|
77 void AddHookL(MFlowHook *aHook, TInt aFrag); |
|
78 /** |
|
79 // Recompute TPacketHead::iInterfaceIndex. Also, find non-zero |
|
80 // TPacketHead::iDstId, if unspecified after the hook (= 0). |
|
81 // |
|
82 // Use the current addressing information in the aHead and locate |
|
83 // a route. If a route is found, fill in iInterfaceIndex and iDstId |
|
84 // (if unspecified). |
|
85 // |
|
86 // This is internal and function which is called after OpenL |
|
87 // in CProtocolIP::FlowSetupHooks, in case the hook changed |
|
88 // the addresses of the TPacketHead (tunneling or some other |
|
89 // reason). |
|
90 // |
|
91 // @param aHead |
|
92 // current flow information |
|
93 // @return |
|
94 // @li EFlow_READY, if route found |
|
95 // @li EFlow_PENDING, if route not found (abort OpenL phase) |
|
96 */ |
|
97 virtual TInt RouteFlow(TPacketHead &aHead) = 0; |
|
98 |
|
99 /** |
|
100 // Remove all hooks from the flow. |
|
101 */ |
|
102 void RemoveHooks(); |
|
103 // IsChanged should probably be in the base CFlowContext. -- msa |
|
104 inline TBool IsChanged() |
|
105 /** |
|
106 * Return the state iChanged bit. |
|
107 */ |
|
108 { |
|
109 return iChanged != 0; |
|
110 } |
|
111 protected: |
|
112 /** |
|
113 // Start will save/freeze "interface end" state of the |
|
114 // flow information (TPackeHead). |
|
115 // |
|
116 // Start is called after all hooks have been added and their |
|
117 // preparation work (OpenL methods) has been completed. After |
|
118 // this the flow is ready for hook ReadyL() methods. |
|
119 */ |
|
120 void Start(); |
|
121 /** |
|
122 // Reset is called to before the ReadyL() method chaing is |
|
123 // called (restores the flow to the state saved by Start()) |
|
124 */ |
|
125 void Reset(); |
|
126 /** |
|
127 // Call all ReadyL of all attached hooks |
|
128 */ |
|
129 void RefreshHooks(); |
|
130 private: |
|
131 TInt ApplyHooksL(RMBufSendPacket &aPacket, RMBufSendInfo &aInfo); |
|
132 void ApplyHooksFragmentedL(TInt aStart, RMBufSendPacket &aPacket); |
|
133 /** |
|
134 // Records the currently attached hooks |
|
135 */ |
|
136 CArrayFixFlat<TFlowHook> *iHookList; |
|
137 protected: |
|
138 /** |
|
139 // The flow parameters after the OpenL hooks have been run. |
|
140 // (see Start() and Reset()). |
|
141 */ |
|
142 TPacketHead iStart; |
|
143 }; |
|
144 #endif |