|
1 // Copyright (c) 1997-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 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #if !defined(__PKTDRV_H__) |
|
23 #define __PKTDRV_H__ |
|
24 |
|
25 #include <comms-infras/nifprvar.h> |
|
26 #include <comms-infras/ss_nodemessages.h> |
|
27 |
|
28 /** |
|
29 Uid2 for all pkt drv |
|
30 @publishedPartner |
|
31 @released |
|
32 @since v8.1 (internalComponent from v5.0u) |
|
33 */ |
|
34 const TInt KUidNifmanPktDrv = 0x1000053F; |
|
35 |
|
36 /** |
|
37 @publishedPartner |
|
38 @released |
|
39 */ |
|
40 _LIT(KPacketDriverFileExtension, ".drv"); |
|
41 |
|
42 /** |
|
43 @publishedPartner |
|
44 @released |
|
45 */ |
|
46 const TInt KIeee802AddrSize = 0x06; |
|
47 |
|
48 /** |
|
49 An IEEE802-assigned address |
|
50 @note This should be compatible with TBTDevAddr |
|
51 @publishedPartner |
|
52 @released |
|
53 @since v8.1 |
|
54 */ |
|
55 class TIeee802Addr |
|
56 { |
|
57 public: |
|
58 /* |
|
59 // Commented out until we converge with Bluetooth definitions - these methods will then be defined |
|
60 inline TBool operator==(const TIeee802Addr& aAddr) const; |
|
61 inline TBool operator!=(const TIeee802Addr& aAddr) const; |
|
62 inline const TUint8 &operator[](TInt aIndex) const; |
|
63 inline TUint8 &operator[](TInt aIndex); |
|
64 inline TPtr8 Des(); //< Access value as a bigendian descriptor |
|
65 inline const TPtrC8 Des() const; |
|
66 IMPORT_C TInt SetReadable(const TDesC& aSource); |
|
67 inline void GetReadable(TDes& aDest) const; |
|
68 IMPORT_C void GetReadable(TDes& aDest, const TDesC& aPrepend, const TDesC& aByteSeperator, const TDesC& aAppend) const; |
|
69 */ |
|
70 IMPORT_C void Reset(); //< Zero fill |
|
71 protected: |
|
72 IMPORT_C TIeee802Addr(); |
|
73 IMPORT_C TIeee802Addr(const TInt64 &aInt); //< Construct from a TInt64 |
|
74 IMPORT_C TIeee802Addr(const TDesC8 &aDes); //< Construct from a buffer |
|
75 private: |
|
76 TFixedArray<TUint8, KIeee802AddrSize> iAddr; |
|
77 }; |
|
78 |
|
79 /** |
|
80 An ethernet or IEEE802.3 address. |
|
81 No special implementation at the moment |
|
82 @publishedPartner |
|
83 @released |
|
84 @since v8.1 |
|
85 */ |
|
86 class TEthernetAddr : public TIeee802Addr |
|
87 { |
|
88 public: |
|
89 IMPORT_C TEthernetAddr(); |
|
90 IMPORT_C TEthernetAddr(const TInt64 &aInt); //< Construct from a TInt64 |
|
91 IMPORT_C TEthernetAddr(const TDesC8 &aDes); //< Construct from a buffer |
|
92 }; |
|
93 |
|
94 typedef TEthernetAddr THWAddr; // for SC with code that uses THWAddr (note: SetAddress() method missing, so not full SC) |
|
95 |
|
96 /** |
|
97 @publishedPartner |
|
98 @released |
|
99 @since v8.1 (internalComponent from v5.0u) |
|
100 */ |
|
101 class TPacketDriverStats |
|
102 { |
|
103 public: |
|
104 TUint8 iPacketsIn; |
|
105 TUint8 iPacketsOut; |
|
106 TUint8 iBytesIn; |
|
107 TUint8 iBytesOut; |
|
108 TUint8 iErrorsIn; |
|
109 TUint8 iErrorsOut; |
|
110 TUint8 iPacketsLost; |
|
111 }; |
|
112 |
|
113 class CPktDrvBase; |
|
114 class CLANLinkCommon; |
|
115 class CEther802LLCBase; |
|
116 /** |
|
117 @publishedPartner |
|
118 @released |
|
119 @since v8.1 (internalComponent from v5.0u) |
|
120 */ |
|
121 class CPktDrvFactory : public CObject |
|
122 { |
|
123 public: |
|
124 virtual CPktDrvBase* NewDriverL(CLANLinkCommon* aParent)=0; |
|
125 void Install( RLibrary& aLib ); |
|
126 IMPORT_C virtual void Close(); |
|
127 virtual TVersion Version() const=0; |
|
128 public: |
|
129 RLibrary iLib; |
|
130 }; |
|
131 |
|
132 class RMBufChain; |
|
133 |
|
134 /** |
|
135 @publishedPartner |
|
136 @released |
|
137 @since v8.1 (internalComponent from v5.0u) |
|
138 */ |
|
139 class CPktDrvBase : public CBase |
|
140 { |
|
141 public: |
|
142 enum TRxMode {RxOff, RxPhysicalAddr, RxBroadcast, |
|
143 RxSomeMulticast, RxAllMulticast, RxPromiscuous}; |
|
144 public: |
|
145 IMPORT_C CPktDrvBase(CPktDrvFactory& aFactory); |
|
146 IMPORT_C ~CPktDrvBase(); |
|
147 IMPORT_C void SetNameL(const TDesC& aName); |
|
148 virtual void ConstructL(CLANLinkCommon* aParent)=0; |
|
149 virtual TInt Send(RMBufChain& aPkt)=0; |
|
150 virtual TInt StartInterface()=0; |
|
151 virtual TInt StopInterface()=0; |
|
152 virtual TInt ResetInterface()=0; |
|
153 virtual TInt SetRxMode(TRxMode AMode)=0; |
|
154 virtual TInt GetRxMode() const=0; |
|
155 virtual TInt SetInterfaceAddress(const THWAddr&)=0; |
|
156 virtual TUint8* GetInterfaceAddress()const=0; |
|
157 virtual TInt GetMulticastList(const THWAddr* aAddr, TInt& n) const=0; |
|
158 virtual TInt SetMulticastList(const THWAddr* aAddr, TInt n)=0; |
|
159 virtual TInt InterfacePowerUp()=0; |
|
160 virtual TInt InterfacePowerDown()=0; |
|
161 virtual TInt InterfaceSleep()=0; |
|
162 virtual TInt InterfaceResume()=0; |
|
163 virtual TInt Notification(enum TAgentToNifEventType aEvent, void* aInfo)=0; |
|
164 virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption, TAny* aSource=0)=0; |
|
165 |
|
166 // |
|
167 const TPacketDriverStats& GetInterfaceStats() const { return iStats;} |
|
168 TInt SenseInterfacePower() const {return iPowerState;} |
|
169 protected: |
|
170 HBufC* iName; |
|
171 CPktDrvFactory* iFactory; |
|
172 TInt iRefCount; |
|
173 CLANLinkCommon* iParent; |
|
174 enum TDriverResetState {EStart, EWarmStart, EInitialising, |
|
175 Ready, ESleeping, ERunning, EHalted}; |
|
176 enum TDriverPowerState {EPowerOn, EPowerOff, ESleep}; |
|
177 TDriverResetState iResetState; |
|
178 TDriverPowerState iPowerState; |
|
179 TPacketDriverStats iStats; |
|
180 THWAddr iHWAddr; |
|
181 TRxMode iRxMode; |
|
182 }; |
|
183 |
|
184 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
185 #include <networking/pktdrv_internal.h> |
|
186 #endif |
|
187 |
|
188 #endif |
|
189 |
|
190 |
|
191 |
|
192 |