21 #define INC_DROUTER_H |
21 #define INC_DROUTER_H |
22 |
22 |
23 #include <e32def.h> // For TUint16 |
23 #include <e32def.h> // For TUint16 |
24 #include <e32cmn.h> // For TDesC8 |
24 #include <e32cmn.h> // For TDesC8 |
25 #include "internalapi.h" // For MIAD2ChannelApi |
25 #include "internalapi.h" // For MIAD2ChannelApi |
26 //ISCE #include "mist2iadapi.h" // For TIADConnectionStatus, MIST2IADApi |
26 #include "mist2iadapi.h" // For TIADConnectionStatus, MIST2IADApi |
27 #include "iadinternaldefinitions.h" // For TIADConnectionStatus |
27 #include "iadinternaldefinitions.h" // For TIADConnectionStatus |
28 #include "iadnokiadefinitions.h" // For EIADSizeOfChannels |
28 #include "iadnokiadefinitions.h" // For EIADSizeOfChannels, includes iscnokiadefinitions.h. |
29 //ISCE |
29 |
30 #include "isirouterlinkifs.h" // For MLinkRouterIf |
|
31 //ISCE |
|
32 #ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT |
|
33 class DPipeHandler; |
30 class DPipeHandler; |
34 #endif |
31 class MIAD2ISTApi; |
35 //ISCE class MIAD2ISTApi; |
|
36 class DRouter; |
32 class DRouter; |
|
33 class DIndicationHandler; |
37 class MIAD2ChannelApi; |
34 class MIAD2ChannelApi; |
38 class DQueue; |
35 class DQueue; |
39 |
36 |
40 static DObject* iThreadPtr = NULL; |
37 static DObject* iThreadPtr = NULL; |
41 const TUint8 KIADEventSubscriptionObjId( 0xfc ); |
38 const TUint8 KIADEventSubscriptionObjId( 0xfc ); |
42 |
39 |
43 // TODO: own API for indicationhandler (and pipehandler allocate, deallocate, sendmessage ?) |
40 // own API for indicationhandler (and pipehandler allocate, deallocate, sendmessage ?) |
44 |
41 |
45 // - stores UL (APE destinated) message to receive queue |
42 // - stores UL (APE destinated) message to receive queue |
46 // |
43 // |
47 // add DL (CMT destinated) message to IST's appropriate send queue IS THIS |
44 // add DL (CMT destinated) message to IST's appropriate send queue IS THIS |
48 // NEEDED OR FROM HANDLERS? |
45 // NEEDED OR FROM HANDLERS? |
91 |
84 |
92 IMPORT_C TInt SendIndication( TDes8& aMessage, const TUint16 aCh ); |
85 IMPORT_C TInt SendIndication( TDes8& aMessage, const TUint16 aCh ); |
93 |
86 |
94 // From MChannel2IADApi end |
87 // From MChannel2IADApi end |
95 |
88 |
|
89 // From MIST2IADApi start const, check others too |
|
90 IMPORT_C void NotifyConnectionStatus( MIST2IADApi::TISTConnectionStatus aStatus ); |
|
91 |
|
92 IMPORT_C void ReceiveMessage( TDes8& aMsg ); |
|
93 |
|
94 IMPORT_C const RArray<TUint>& GetBlockConfig(); |
|
95 |
|
96 IMPORT_C void Register( MIAD2ISTApi* aISTApi ); |
|
97 |
96 // For Router and it's handler DPipeHandler and DIndicationHandler |
98 // For Router and it's handler DPipeHandler and DIndicationHandler |
97 TInt SendMsg( TDes8& aMsg ); |
99 TInt SendMsg( TDes8& aMsg ); |
98 |
100 |
99 // For PipeHandler |
101 // For PipeHandler |
100 MIAD2ChannelApi* GetChannel( const TUint16 aChannel ); |
102 MIAD2ChannelApi* GetChannel( const TUint16 aChannel ); |
101 // For PipeHandler |
103 // For PipeHandler |
102 // ISCE |
104 |
103 // TODO: DEF files!!! |
|
104 // From MISILinkRouterIf start |
105 // From MISILinkRouterIf start |
105 /* |
106 /* |
106 * See comments from MISILinkRouterIf. |
107 * See comments from MISILinkRouterIf. |
107 */ |
108 */ |
108 void NotifyTrxPresenceEnqueDfc( TBool aPresent ); |
109 void NotifyTrxPresenceEnqueDfc( TBool aPresent ); |
110 /* |
111 /* |
111 * See comments from MISILinkRouterIf. |
112 * See comments from MISILinkRouterIf. |
112 */ |
113 */ |
113 void Receive( TDes8& aMsg ); |
114 void Receive( TDes8& aMsg ); |
114 // From MISILinkRouterIf end |
115 // From MISILinkRouterIf end |
115 IMPORT_C void DummyDoNothing(); |
|
116 |
|
117 IMPORT_C void DummyDoNothing2(); |
|
118 |
|
119 // ISCE |
|
120 |
|
121 // For internal receiving. |
116 // For internal receiving. |
122 void DRouter::MessageReceived( TDes8& aMsg ); |
117 void DRouter::MessageReceived( TDes8& aMsg ); |
123 |
118 |
124 #if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95) |
119 |
125 EXPORT_C TInt Loan( const TUint16 aChannel, const TUint16 aRequest, |
120 EXPORT_C TInt Loan( const TUint16 aChannel, const TUint16 aRequest, |
126 MIAD2ChannelApi* aCallback ); |
121 MIAD2ChannelApi* aCallback ); |
127 EXPORT_C TInt ReturnLoan( const TUint16 aChannel, const TUint16 aRequest, |
122 EXPORT_C TInt ReturnLoan( const TUint16 aChannel, const TUint16 aRequest, |
128 MIAD2ChannelApi* aCallback ); |
123 MIAD2ChannelApi* aCallback ); |
129 #endif |
|
130 |
124 |
131 private: |
125 private: |
132 |
126 |
133 enum TRoutingRule |
127 enum TRoutingRule |
134 { |
128 { |
135 EIsiMsg = 1, |
129 EIsiMsg = 1, |
136 EPipeMsg, |
130 EPipeMsg, |
137 EMediaMsg, |
131 EMediaMsg, |
138 EIndicationMsg, |
132 EIndicationMsg, |
|
133 EControlMsg, |
|
134 EPnNameAddRespMsg, |
139 ENotKnownMsg, |
135 ENotKnownMsg, |
140 EUsbPhonetMsg |
|
141 }; |
136 }; |
142 |
137 |
143 enum TWaitingType |
138 enum TWaitingType |
144 { |
139 { |
145 ENormalOpen = 1, |
140 ENormalOpen = 1, |
146 #if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95) |
|
147 ELoan |
141 ELoan |
148 #endif |
|
149 }; |
142 }; |
150 |
143 |
151 void HandleIsiMessage( TDes8& aMsg ); |
144 void HandleIsiMessage( TDes8& aMsg ); |
152 |
145 |
153 void HandlePipeMessage( TDes8& aMsg ); |
146 void HandlePipeMessage( TDes8& aMsg ); |
154 |
147 |
155 void HandleMediaMessage( TDes8& aMsg ); |
148 void HandleMediaMessage( TDes8& aMsg ); |
156 |
149 |
|
150 void HandleControlMessage( TDes8& aMsg ); |
|
151 |
|
152 void HandlePnsNameAddResp( TDes8& aMsg ); |
157 |
153 |
158 void SendCommIsaEntityNotReachableResp( const TDesC8& aMsg ); |
154 void SendCommIsaEntityNotReachableResp( const TDesC8& aMsg ); |
159 |
155 |
160 static void CheckDfc(); |
156 static void CheckDfc(); |
161 |
157 |
162 TInt ValiDateIsiMessage( TDes8& aMsg ); |
158 TInt ValiDateIsiMessage( TDes8& aMsg ); |
163 |
159 |
164 public: |
160 public: |
165 static void CheckRouting( DRouter& aTmp, TDes8& aMsg ); |
161 static void CheckRouting( DRouter& aTmp, TDes8& aMsg ); |
166 |
162 |
167 static DRouter* iThisPtr; |
|
168 MISIRouterObjectIf* iNameService; |
|
169 MISIRouterObjectIf* iCommunicationManager; |
|
170 /* |
|
171 * See comments from MISIChannelRouterIf |
|
172 */ |
|
173 TDfcQue* GetDfcThread( const TISIDfcQThreadType aType ); |
|
174 |
|
175 void FreeDfcThread( TDfcQue* aThread ); |
|
176 |
|
177 |
|
178 private: |
163 private: |
179 static void CommonRxDfc( TAny* aPtr ); |
164 static void CommonRxDfc( TAny* aPtr ); |
180 |
165 |
181 static void InitCmtDfc( TAny* aPtr ); |
166 static void InitCmtDfc( TAny* aPtr ); |
182 |
167 |
183 void InitConnectionOk(); |
168 void InitCmtConnection(); |
|
169 |
|
170 void SendDrmReq( const TUint16 aChannelId ); |
|
171 |
|
172 void SendPnsNameAddReq( const TUint16 aChannel, const TDesC8& aOpenInfo ); |
184 |
173 |
185 static void NotifyObjLayerConnStatDfc( TAny* aPtr ); |
174 static void NotifyObjLayerConnStatDfc( TAny* aPtr ); |
186 |
175 |
187 void NotifyObjLayerConnStat( const TIADConnectionStatus aStatus ); |
176 void NotifyObjLayerConnStat( const TIADConnectionStatus aStatus ); |
188 |
177 |
189 void SetSenderInfo( TDes8& aMessage, const TUint16 aCh ); |
178 void SetSenderInfo( TDes8& aMessage, const TUint16 aCh ); |
190 |
|
191 //From objectapi |
|
192 TInt Send( TDes8& aMessage, const TUint8 aObjId ); |
|
193 |
179 |
194 // Member data |
180 // Member data |
195 private: |
181 private: |
196 |
182 |
197 void CheckSameThreadContext(); |
183 void CheckSameThreadContext(); |
198 |
184 |
199 // TODO |
185 // |
200 // Needed due to opening that are waiting a response from cmt side. |
186 // Needed due to opening that are waiting a response from cmt side. |
201 // Use iWaitingChannel to store a channel pointer then and when resp |
187 // Use iWaitingChannel to store a channel pointer then and when resp |
202 // received from cmt set iChannel = iWaitingChannel and complete request |
188 // received from cmt set iChannel = iWaitingChannel and complete request |
203 // Used also when initializing physical and datalink layers. |
189 // Used also when initializing physical and datalink layers. |
204 class TIADChannel |
190 class TIADChannel |
208 MIAD2ChannelApi* iChannel; |
194 MIAD2ChannelApi* iChannel; |
209 MIAD2ChannelApi* iWaitingChannel; |
195 MIAD2ChannelApi* iWaitingChannel; |
210 TWaitingType iType; |
196 TWaitingType iType; |
211 }; |
197 }; |
212 |
198 |
213 // ISCE |
|
214 TUint8 MapMediaToLinkId( const TUint8 aMedia ); |
|
215 |
|
216 enum TISIMedias |
|
217 { |
|
218 EISIMediaHostSSI = 0x00, |
|
219 EISIAmountOfMedias |
|
220 }; |
|
221 // ISCE |
|
222 |
|
223 // owned |
199 // owned |
224 // APE <-> CMT connection status ok/nok. |
200 // APE <-> CMT connection status ok/nok. |
225 TIADConnectionStatus iConnectionStatus; |
201 TIADConnectionStatus iConnectionStatus; |
226 #ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT |
|
227 DPipeHandler* iPipeHandler; |
202 DPipeHandler* iPipeHandler; |
228 #endif |
203 DIndicationHandler* iIndicationHandler; |
229 DQueue* iCommonRxQueue; |
204 DQueue* iCommonRxQueue; |
230 TIADChannel iChannelTable[ EIADSizeOfChannels ]; |
205 TIADChannel iChannelTable[ EIADSizeOfChannels ]; |
231 //static TDfc* iConnStatusBcDfc; |
206 //static TDfc* iConnStatusBcDfc; |
232 TDfc* iCommonRxDfc; |
207 TDfc* iCommonRxDfc; |
233 TDfc* iInitCmtDfc; |
208 TDfc* iInitCmtDfc; |
234 TDfc* iConnStatDfc; |
209 TDfc* iConnStatDfc; |
235 // Maximum size of isi/data messages to be send. |
210 // Maximum size of isi/data messages to be send. |
236 TUint16 iMaxFrameSize; |
211 TUint16 iMaxFrameSize; |
237 // not owned, just using |
212 // not owned, just using |
238 // When registered !NULL when unregistered NULL. API towards IST. |
213 // When registered !NULL when unregistered NULL. API towards IST. |
239 // ISCE RArray<TUint> iArray; |
214 MIAD2ISTApi* iIST; |
|
215 |
|
216 RArray<TUint> iArray; |
|
217 |
|
218 |
240 TBool iBootDone; |
219 TBool iBootDone; |
241 |
220 |
242 // ISCE |
|
243 MISIRouterLinkIf** iLinksArray; |
|
244 // ISCE |
|
245 |
221 |
246 |
222 |
247 }; |
223 }; |
248 |
224 |
249 |
225 |