|
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 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef __CBNEPBRIDGE_H |
|
22 #define __CBNEPBRIDGE_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include "MPanDevice.h" |
|
26 #include "MPanDeviceOwner.h" |
|
27 #include "BnepPacketNotifier.h" |
|
28 #include <networking/pktdrv.h> |
|
29 #include <networking/pktdrv_internal.h> |
|
30 |
|
31 |
|
32 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
33 #include <elements/nm_node.h> |
|
34 #include <comms-infras/ss_common.h> |
|
35 #endif |
|
36 |
|
37 class MPanConnectionNotify; |
|
38 class MBnepChannelControl; |
|
39 class RBnepFrame; |
|
40 class TBTDevAddr; |
|
41 class RInternalSocket; |
|
42 |
|
43 |
|
44 const TUint KBnepLocalDeviceArrayId = 0; |
|
45 |
|
46 const TUint KBnepPacketNotifyInterval=2000000; |
|
47 const TUint KBnepPacketNotifySleepTicks=10; |
|
48 |
|
49 /** |
|
50 Acts as a GN, routing packets between interfaces |
|
51 This occurs even if the local role is PANU, although in this case there are |
|
52 only two devices in its lists. |
|
53 @note The local device is treated differently - it is joined to the bridge |
|
54 at startup and has a special (known) place in the bridging array |
|
55 */ |
|
56 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
57 NONSHARABLE_CLASS(CBnepBridge) : public CBase, public Messages::ASimpleNodeIdBase, public MPanDeviceOwner |
|
58 #else |
|
59 NONSHARABLE_CLASS(CBnepBridge) : public CBase, public MPanDeviceOwner |
|
60 #endif |
|
61 { |
|
62 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
63 private: |
|
64 NONSHARABLE_CLASS(CPanLinkControl) : public CBase, public MPanLinkControl |
|
65 { |
|
66 public: |
|
67 static CPanLinkControl* NewL(); |
|
68 ~CPanLinkControl(); |
|
69 private: |
|
70 void ConstructL(); |
|
71 CPanLinkControl(); |
|
72 |
|
73 private: |
|
74 // MPanLinkControl methods |
|
75 virtual TAny* MplcbGetInterface(const TUid & aInterface); |
|
76 virtual TInt MplcRequestSniff(const TBTDevAddr &); |
|
77 virtual TInt MplcRequestActive(const TBTDevAddr &); |
|
78 |
|
79 private: |
|
80 RSocketServ iSockServ; |
|
81 }; |
|
82 #endif |
|
83 |
|
84 public: |
|
85 ~CBnepBridge(); |
|
86 TInt AttachDevice (MPanDevice& aDevice); |
|
87 const TBTDevAddr& DefaultAddress () const; |
|
88 void LinkGoingDown (MPanDevice& aDevice); |
|
89 void RemoteDeviceReady (); |
|
90 |
|
91 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
92 inline void SetPacketDriverOwner(CPacketDriverOwner& aPktDrvOwner); |
|
93 void AttemptNewBnepConnection(const Messages::TNodeId& aSender, const Messages::TSignatureBase& aMessage, TUint16 aActivity); |
|
94 #else |
|
95 MBnepChannelControl& NewBnepConnectionL (RInternalSocket& aConnectedSocket, MPanConnectionNotify& aNotify); |
|
96 #endif |
|
97 |
|
98 static CBnepBridge* NewL (MPanDevice& aLocalDevice); |
|
99 TInt Process (RBnepFrame& aFrame, const TBTDevAddr& aSourceIfAddr); |
|
100 void StopLinks (); |
|
101 virtual void SetRetryConnect(); |
|
102 void DataCountUpdated(); |
|
103 |
|
104 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
105 protected: |
|
106 // From ESock::MCFNode, via ESock::ACFNodeIdBase |
|
107 void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aCFMessage); |
|
108 #endif |
|
109 |
|
110 private: |
|
111 CBnepBridge (MPanDevice& aLocalDevice); |
|
112 void ConstructL(); |
|
113 void RemoveDevice (MPanDevice& aDevice); |
|
114 TInt GetVacantSlot (TUint& aSlotIndex); |
|
115 static TInt DataCounterCallBack(TAny*); |
|
116 void DataCounterNotify(); |
|
117 |
|
118 private: |
|
119 TUint8 iLinkCount; |
|
120 TFixedArray< MPanDevice* , KMaxPanConnections > iLinks; |
|
121 RLibrary iLib; |
|
122 CPeriodic* iDataCounterTimer; |
|
123 MBnepPacketNotifier* iBnepPacketNotifier; |
|
124 RArray<TBnepBytesTransferred> iDataTransferred; |
|
125 TUint iIdleCount; |
|
126 TBool iRetryConnect; |
|
127 |
|
128 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
129 // Points to the owner of the packet driver lib and is passed to |
|
130 // CBnepChannelControllers when we create them - DON'T DELETE IT |
|
131 CPacketDriverOwner* iPktDrvOwner; |
|
132 // MPanLinkControl implementation |
|
133 CPanLinkControl* iPanLinkControl; |
|
134 #endif |
|
135 }; |
|
136 |
|
137 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
138 void CBnepBridge::SetPacketDriverOwner(CPacketDriverOwner& aPktDrvOwner) |
|
139 { |
|
140 iPktDrvOwner = &aPktDrvOwner; |
|
141 } |
|
142 |
|
143 #endif |
|
144 // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
145 |
|
146 #endif |
|
147 // __CBNEPBRIDGE_H |
|
148 |