|
1 // Copyright (c) 2006-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 // @file pfqoslib.h |
|
15 // Header file for PF_QOS messages |
|
16 // @internalTechnology |
|
17 // @released |
|
18 // |
|
19 |
|
20 #ifndef __PFQOSLIB_H__ |
|
21 #define __PFQOSLIB_H__ |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <in_sock.h> |
|
25 #include <es_mbuf.h> |
|
26 |
|
27 #include <networking/pfqos.h> |
|
28 #include <networking/qosparameters.h> |
|
29 |
|
30 class CSelectorBase; |
|
31 |
|
32 /** |
|
33 * Map the basic PFQOS_MSG V1 structures into Classes with |
|
34 * constructors for initialized content. |
|
35 * |
|
36 * @internalTechnology |
|
37 */ |
|
38 class T_pfqos_msg : public pfqos_msg |
|
39 { |
|
40 public: |
|
41 IMPORT_C T_pfqos_msg(TUint8 aMsgType, TUint32 aSeq = 0); |
|
42 }; |
|
43 |
|
44 /** @internalTechnology */ |
|
45 class T_pfqos_selector : public pfqos_selector |
|
46 { |
|
47 public: |
|
48 IMPORT_C T_pfqos_selector(CSelectorBase* aSelector); |
|
49 }; |
|
50 |
|
51 /** @internalTechnology */ |
|
52 class T_pfqos_address : public pfqos_address |
|
53 { |
|
54 public: |
|
55 IMPORT_C T_pfqos_address(TUint aType, TUint16 aPortMax); |
|
56 }; |
|
57 |
|
58 /** @internalTechnology */ |
|
59 class T_pfqos_module : public pfqos_modulespec |
|
60 { |
|
61 public: |
|
62 IMPORT_C T_pfqos_module(TUint aProtocolId, TUint32 aFlags, const TDesC& aName, const TDesC& aPath, TInt aDataLen); |
|
63 }; |
|
64 |
|
65 /** @internalTechnology */ |
|
66 class T_pfqos_flowspec : public pfqos_flowspec |
|
67 { |
|
68 public: |
|
69 IMPORT_C T_pfqos_flowspec(const TQoSParameters& aParameters); |
|
70 }; |
|
71 |
|
72 /** @internalTechnology */ |
|
73 class T_pfqos_event : public pfqos_event |
|
74 { |
|
75 public: |
|
76 IMPORT_C T_pfqos_event(TUint8 aType, TUint16 aEventType, TUint16 aValue); |
|
77 }; |
|
78 |
|
79 /** @internalTechnology */ |
|
80 class T_pfqos_channel : public pfqos_channel |
|
81 { |
|
82 public: |
|
83 IMPORT_C T_pfqos_channel(TUint32 aChannelId); |
|
84 }; |
|
85 |
|
86 /** @internalTechnology */ |
|
87 class T_pfqos_configure : public pfqos_configure |
|
88 { |
|
89 public: |
|
90 IMPORT_C T_pfqos_configure(TUint16 aProtocolId); |
|
91 }; |
|
92 |
|
93 /** |
|
94 * Internal representation of PfqosMessage |
|
95 * |
|
96 * @internalTechnology |
|
97 */ |
|
98 class TPfqosBase |
|
99 { |
|
100 public: |
|
101 const struct pfqos_msg *iMsg; |
|
102 IMPORT_C TPfqosBase(); |
|
103 IMPORT_C TUint Length() const; |
|
104 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aTotal) const; |
|
105 }; |
|
106 |
|
107 /** @internalTechnology */ |
|
108 class TPfqosSelector |
|
109 { |
|
110 public: |
|
111 const struct pfqos_selector *iExt; |
|
112 IMPORT_C TPfqosSelector(); |
|
113 IMPORT_C TUint Length() const; |
|
114 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
115 IMPORT_C TInt GetUid(TCheckedUid& aUid); |
|
116 }; |
|
117 |
|
118 /** @internalTechnology */ |
|
119 class TPfqosAddress |
|
120 { |
|
121 public: |
|
122 const struct pfqos_address *iExt; |
|
123 const TInetAddr *iAddr; |
|
124 const TInetAddr *iPrefix; |
|
125 IMPORT_C TPfqosAddress(); |
|
126 IMPORT_C TUint Length() const; |
|
127 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
128 }; |
|
129 |
|
130 class CExtension; |
|
131 |
|
132 /** @internalTechnology */ |
|
133 class TPfqosModule |
|
134 { |
|
135 public: |
|
136 const struct pfqos_modulespec *iExt; |
|
137 TPtrC8 iData; |
|
138 IMPORT_C TPfqosModule(); |
|
139 IMPORT_C TUint Length() const; |
|
140 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
141 TSglQueLink iNext; |
|
142 }; |
|
143 |
|
144 /** @internalTechnology */ |
|
145 class TPfqosFlowSpec |
|
146 { |
|
147 public: |
|
148 const struct pfqos_flowspec *iExt; |
|
149 IMPORT_C TPfqosFlowSpec(); |
|
150 IMPORT_C TUint Length() const; |
|
151 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
152 }; |
|
153 |
|
154 /** @internalTechnology */ |
|
155 class TPfqosEvent |
|
156 { |
|
157 public: |
|
158 const struct pfqos_event *iExt; |
|
159 IMPORT_C TPfqosEvent(); |
|
160 IMPORT_C TUint Length() const; |
|
161 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
162 }; |
|
163 |
|
164 /** @internalTechnology */ |
|
165 class TPfqosChannel |
|
166 { |
|
167 public: |
|
168 struct pfqos_channel *iExt; |
|
169 IMPORT_C TPfqosChannel(); |
|
170 IMPORT_C TUint Length() const; |
|
171 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
172 }; |
|
173 |
|
174 /** @internalTechnology */ |
|
175 class TPfqosConfigure |
|
176 { |
|
177 public: |
|
178 const struct pfqos_configure *iExt; |
|
179 IMPORT_C TPfqosConfigure(); |
|
180 IMPORT_C TUint Length() const; |
|
181 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
182 }; |
|
183 |
|
184 /** @internalTechnology */ |
|
185 class TPfqosConfigFile |
|
186 { |
|
187 public: |
|
188 const struct pfqos_config_file *iExt; |
|
189 IMPORT_C TPfqosConfigFile(); |
|
190 IMPORT_C TUint Length() const; |
|
191 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
192 }; |
|
193 |
|
194 /** @internalTechnology */ |
|
195 class CPfqosPolicyData : public CBase |
|
196 { |
|
197 public: |
|
198 IMPORT_C ~CPfqosPolicyData(); |
|
199 IMPORT_C static CPfqosPolicyData* NewL(TInt aType); |
|
200 IMPORT_C static CPfqosPolicyData* NewL(TInt aType, const TUint8 *aBuf,TInt aLength); |
|
201 IMPORT_C TUint Length() const; |
|
202 IMPORT_C TInt Size() const; |
|
203 IMPORT_C void CopyL(const TUint8 *aBuf,TInt aLength); |
|
204 IMPORT_C TDesC8& Data(); |
|
205 IMPORT_C TInt Type(); |
|
206 IMPORT_C TInt ByteStream(RMBufChain &aPacket, TInt aOffset) const; |
|
207 |
|
208 TSglQueLink iNext; |
|
209 |
|
210 private: |
|
211 |
|
212 IMPORT_C CPfqosPolicyData(TInt aType); |
|
213 IMPORT_C void ConstructL(); |
|
214 TInt iType; |
|
215 TPtr8 iBufPtr; |
|
216 HBufC8* iBuf; |
|
217 }; |
|
218 |
|
219 |
|
220 |
|
221 /** |
|
222 * Internal representation of PF_QOS message |
|
223 * |
|
224 * This class is either misnamed (should not be a T-class) or |
|
225 * misdesigned. The instance of this object owns dynamically |
|
226 * allocated heap objects in member variables iModuleList and |
|
227 * iExtentions. Thus, the destructor of this class must always |
|
228 * be executed. |
|
229 * |
|
230 * @internalTechnology |
|
231 */ |
|
232 class TPfqosMessage |
|
233 { |
|
234 public: |
|
235 IMPORT_C TPfqosMessage(const TDesC8& aMsg); |
|
236 IMPORT_C TPfqosMessage(); |
|
237 IMPORT_C ~TPfqosMessage(); |
|
238 IMPORT_C void AddModuleL(T_pfqos_module& aModule, const TDesC8& aConfigData); |
|
239 IMPORT_C void AddExtensionL(const TDesC8& aExtension, TInt aType); |
|
240 IMPORT_C TUint ExtensionLength(); |
|
241 IMPORT_C TUint ModuleLength(); |
|
242 IMPORT_C TUint16 Length64(); |
|
243 IMPORT_C void ByteStreamL(RMBufChain &aPacket); |
|
244 IMPORT_C void Add(TPfqosModule& aModule); |
|
245 IMPORT_C void AddExtension(CPfqosPolicyData& aExtension); |
|
246 IMPORT_C TInt SetQoSParameters(TQoSParameters& aParameters) const; |
|
247 IMPORT_C void RemovePolicyData(); // Remove all policy data (flowspec, modules, extensions, event, configure) |
|
248 |
|
249 public: |
|
250 TInt iError; |
|
251 TPfqosBase iBase; |
|
252 TPfqosSelector iSelector; |
|
253 TPfqosAddress iSrcAddr; |
|
254 TPfqosAddress iDstAddr; |
|
255 TPfqosFlowSpec iFlowSpec; |
|
256 TPfqosEvent iEvent; |
|
257 TPfqosChannel iChannel; |
|
258 TPfqosConfigure iConfigure; |
|
259 TPfqosConfigFile iConfigFile; |
|
260 TUint iNumModules; |
|
261 TSglQue<TPfqosModule> iModuleList; |
|
262 TUint iNumExtensions; |
|
263 TSglQue<CPfqosPolicyData> iExtensions; |
|
264 }; |
|
265 |
|
266 |
|
267 #endif |