|
1 |
|
2 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 // All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // qoslib.h - This file defines the generic QoS API interface. |
|
16 // |
|
17 |
|
18 #ifndef __QOSLIB_H__ |
|
19 #define __QOSLIB_H__ |
|
20 |
|
21 /** |
|
22 * @file qoslib.h |
|
23 * |
|
24 * QoS API - This file defines the generic QoS API interface. |
|
25 */ |
|
26 |
|
27 #include <e32std.h> |
|
28 #include <in_sock.h> |
|
29 |
|
30 #include <networking/qos_extension.h> |
|
31 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
32 #include <networking/qoslib_internal.h> |
|
33 #endif |
|
34 |
|
35 class CQoSParameters; |
|
36 class CPolicy; |
|
37 |
|
38 /** |
|
39 * Selector for QoS policies. The variables defined in TQoSSelector are used to find QoS policies |
|
40 * for traffic flows. Not all variables have to be set, the application can specify the variables that it wants to. |
|
41 * Note: TQoSSelector stores IPv4 addresses in "IPv4-mapped IPv6 address" format. |
|
42 * |
|
43 * @publishedPartner |
|
44 * @released |
|
45 */ |
|
46 class TQoSSelector |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * Constructor. Initialises all variables to unspecified values. |
|
51 */ |
|
52 IMPORT_C TQoSSelector(); |
|
53 |
|
54 /** |
|
55 * Compares if the selectors are equal. |
|
56 * |
|
57 * @param aSelector TQoSSelector object that is compared with this object. |
|
58 * @return ETrue if selectors are equal to this object, otherwise EFalse. |
|
59 */ |
|
60 IMPORT_C TInt operator==(const TQoSSelector& aSelector) const; |
|
61 |
|
62 /** |
|
63 * Compares if the selector matches aSocket. |
|
64 * |
|
65 * @param aSocket RSocket that is compared with this object. |
|
66 * @return ETrue if selector created from aSocket is equal to this object, otherwise EFalse. |
|
67 */ |
|
68 IMPORT_C TBool Match(RSocket& aSocket) const; |
|
69 |
|
70 /** |
|
71 * Sets the addresses for selector. |
|
72 * |
|
73 * @param aSrcAddr Source address. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
74 * @param aSrcAddrMask Source address mask. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
75 * @param aDstAddr Destination address. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
76 * @param aDstAddrMask Destination address mask. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
77 * @param aProtocol Protocol id. |
|
78 * @param aSrcPortMax Maximum source port. Must have value <= 65535 (0 is used as uspecified value for a port). |
|
79 * @param aDstPortMax Maximum destination port. Must have value <= 65535 (0 is used as uspecified value for a port). |
|
80 * @return KErrNone if parameters have valid values, otherwise KErrArgument. |
|
81 */ |
|
82 IMPORT_C TInt SetAddr(const TInetAddr& aSrcAddr, const TInetAddr& aSrcAddrMask, const TInetAddr& aDstAddr, const TInetAddr& aDstAddrMask, TUint aProtocol, TUint aSrcPortMax, TUint aDstPortMax); |
|
83 |
|
84 /** |
|
85 * Sets the addresses for selector. RSocket is used to fetch addresses and ports for a selector. The resulting |
|
86 * selector will match only for one socket. NOTE: RSocket::Connect() must be called before calling this method. |
|
87 * |
|
88 * @param aSocket RSocket object that is used to set the selector variables. Note: RSocket must be connected |
|
89 * @return KErrNone if parameters have valid values, otherwise KErrArgument. |
|
90 */ |
|
91 IMPORT_C TInt SetAddr(RSocket& aSocket); |
|
92 |
|
93 /** |
|
94 * Sets the source address for selector. |
|
95 * |
|
96 * @param aAddr Source address. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
97 * @return KErrNone if parameters have valid values, otherwise KErrArgument. |
|
98 */ |
|
99 IMPORT_C TInt SetSrc(const TInetAddr& aAddr); |
|
100 |
|
101 /** |
|
102 * Sets the destination address for selector. |
|
103 * |
|
104 * @param aAddr Source address. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
105 * @return KErrNone if parameters have valid values, otherwise KErrArgument. |
|
106 */ |
|
107 IMPORT_C TInt SetDst(const TInetAddr& aAddr); |
|
108 |
|
109 /** |
|
110 * Returns the current source address. |
|
111 * |
|
112 * @return Source address. |
|
113 */ |
|
114 IMPORT_C TInetAddr GetSrc() const; |
|
115 |
|
116 /** |
|
117 * Returns the current destination address. |
|
118 * |
|
119 * @return Destination address. |
|
120 */ |
|
121 IMPORT_C TInetAddr GetDst() const; |
|
122 |
|
123 /** |
|
124 * Sets the source address mask. |
|
125 * |
|
126 * @param aMask Source address mask. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
127 * @return KErrNone if parameters have valid values, otherwise KErrArgument. |
|
128 */ |
|
129 IMPORT_C TInt SetSrcMask(const TInetAddr& aMask); |
|
130 |
|
131 /** |
|
132 * Returns the current source address mask. |
|
133 * |
|
134 * @return Source address mask. |
|
135 */ |
|
136 IMPORT_C TInetAddr GetSrcMask() const; |
|
137 |
|
138 /** |
|
139 * Sets the destination address mask. |
|
140 * |
|
141 * @param aMask Destination address mask. Port must have value <= 65535 (0 is used as uspecified value for a port). |
|
142 * @return KErrNone if parameters have valid values, otherwise KErrArgument. |
|
143 */ |
|
144 IMPORT_C TInt SetDstMask(const TInetAddr& aMask); |
|
145 |
|
146 /** |
|
147 * Returns the current destination address mask. |
|
148 * |
|
149 * @return Destination address mask. |
|
150 */ |
|
151 IMPORT_C TInetAddr GetDstMask() const; |
|
152 |
|
153 /** |
|
154 * Sets the Internet access point identifier. 0 is used as unspecified value. |
|
155 * |
|
156 * @param aIapId Value to which to set the IapId. |
|
157 */ |
|
158 IMPORT_C void SetIapId(TInt aIapId); |
|
159 |
|
160 /** |
|
161 * Returns the current Internet access point identifier. |
|
162 * |
|
163 * @return Internet access point identifier. |
|
164 */ |
|
165 IMPORT_C TInt IapId() const; |
|
166 |
|
167 /** |
|
168 * Sets the protocol identifier. 0 is used as unspecified value. |
|
169 * |
|
170 * @param aProtocol Value to which to set the protocol id. |
|
171 */ |
|
172 IMPORT_C void SetProtocol(TUint aProtocol); |
|
173 |
|
174 /** |
|
175 * Returns the current protocol identifier. |
|
176 * |
|
177 * @return Protocol identifier. |
|
178 */ |
|
179 IMPORT_C TUint Protocol() const; |
|
180 |
|
181 /** |
|
182 * Sets the maximum source port. Port must have value <= 65535 (0 is used as unspecified value). |
|
183 * |
|
184 * @param aMaxPort Value to which to set maximum source port. |
|
185 * @return KErrNone if aMaxPort has valid values, otherwise KErrArgument. |
|
186 */ |
|
187 IMPORT_C TInt SetMaxPortSrc(TUint aMaxPort); |
|
188 |
|
189 /** |
|
190 * Sets the maximum destination port. Port must have value <= 65535 (0 is used as unspecified value). |
|
191 * |
|
192 * @param aMaxPort Value to which to set maximum destination port. |
|
193 * @return KErrNone if aMaxPort has valid values, otherwise KErrArgument. |
|
194 */ |
|
195 IMPORT_C TInt SetMaxPortDst(TUint aMaxPort); |
|
196 |
|
197 /** |
|
198 * Returns the maximum source port. |
|
199 * |
|
200 * @return Maximum source port. |
|
201 */ |
|
202 IMPORT_C TUint MaxPortSrc() const; |
|
203 |
|
204 /** |
|
205 * Returns the maximum destination port. |
|
206 * |
|
207 * @return Maximum destination port. |
|
208 */ |
|
209 IMPORT_C TUint MaxPortDst() const; |
|
210 |
|
211 private: |
|
212 /** The source address. */ |
|
213 TInetAddr iSrc; |
|
214 /** The destination address. */ |
|
215 TInetAddr iDst; |
|
216 /** The source address mask. */ |
|
217 TInetAddr iSrcMask; |
|
218 /** The destination address mask. */ |
|
219 TInetAddr iDstMask; |
|
220 /** The protocol ID. */ |
|
221 TUint iProtocol; |
|
222 /** The maximum source port. */ |
|
223 TUint iSrcPortMax; |
|
224 /** The maximum destination port. */ |
|
225 TUint iDstPortMax; |
|
226 /** The Internet access point identifier. */ |
|
227 TUint iIapId; |
|
228 }; |
|
229 |
|
230 /** |
|
231 * @name QoS capabilities. |
|
232 * |
|
233 * These are used to notify the application as to the type of QoS support provided. |
|
234 * @publishedPartner |
|
235 * @released |
|
236 */ |
|
237 //@{ |
|
238 /** End-to-end signalling is used, e.g. RSVP. */ |
|
239 const TUint KQoSSignaled = 0x0001; |
|
240 /** Signalling is used along some part of end-to-end path. */ |
|
241 const TUint KQoSPartiallySignaled = 0x0002; |
|
242 /** No signalling is used, e.g. DiffServ. */ |
|
243 const TUint KQoSProvisioned = 0x0004; |
|
244 //@} |
|
245 |
|
246 /** |
|
247 * QoS event types |
|
248 * @publishedPartner |
|
249 * @released |
|
250 */ |
|
251 enum TQoSEvent |
|
252 { |
|
253 /** QoS request failed. */ |
|
254 EQoSEventFailure=1, |
|
255 /** QoS request was successful. */ |
|
256 EQoSEventConfirm, |
|
257 /** QoS parameters have changed. */ |
|
258 EQoSEventAdapt, |
|
259 /** QoS channel is opened. */ |
|
260 EQoSEventChannel, |
|
261 /** A socket is attached to a QoS channel. */ |
|
262 EQoSEventJoin, |
|
263 /** A socket is detached from a QoS channel. */ |
|
264 EQoSEventLeave, |
|
265 /** QoS policy was added to QoS policy database. */ |
|
266 EQoSEventAddPolicy, |
|
267 /** QoS policy was searched from the QoS policy database. */ |
|
268 EQoSEventGetPolicy, |
|
269 /** QoS policy was deleted. */ |
|
270 EQoSEventDeletePolicy, |
|
271 /** QoS policy file was loaded. */ |
|
272 EQoSEventLoadPolicyFile, |
|
273 /** QoS policy file was unloaded. */ |
|
274 EQoSEventUnloadPolicyFile |
|
275 }; |
|
276 |
|
277 /** |
|
278 * Default mask for QoS events: all events are notified to the application. |
|
279 * @publishedPartner |
|
280 * @released |
|
281 */ |
|
282 const TUint KQoSEventAll = EQoSEventFailure | EQoSEventConfirm | EQoSEventAdapt | EQoSEventChannel | EQoSEventJoin | EQoSEventLeave | EQoSEventAddPolicy | EQoSEventGetPolicy | EQoSEventDeletePolicy | EQoSEventLoadPolicyFile | EQoSEventUnloadPolicyFile; |
|
283 |
|
284 /** |
|
285 * Base class for QoS events. |
|
286 * |
|
287 * @publishedPartner |
|
288 * @released |
|
289 */ |
|
290 class CQoSEventBase : public CBase |
|
291 { |
|
292 public: |
|
293 /** |
|
294 * Constructor. Sets the QoS event type. |
|
295 * |
|
296 * @param aEventType QoS event type (values defined in enum TQoSEvent). |
|
297 */ |
|
298 IMPORT_C CQoSEventBase(TInt aEventType); |
|
299 |
|
300 /** |
|
301 * Returns the QoS event type. |
|
302 * |
|
303 * @return QoS event type (values defined in enum TQoSEvent). |
|
304 */ |
|
305 IMPORT_C TInt EventType() const; |
|
306 |
|
307 private: |
|
308 /** The QoS event type. */ |
|
309 TInt iEventType; |
|
310 }; |
|
311 |
|
312 /** |
|
313 * Class for EQoSEventConfirm event whereby a QoS request was successful |
|
314 * |
|
315 * @publishedPartner |
|
316 * @released |
|
317 */ |
|
318 class CQoSConfirmEvent : public CQoSEventBase |
|
319 { |
|
320 public: |
|
321 /** |
|
322 * Constructor. Sets the QoS parameters. |
|
323 * |
|
324 * @param aParameters QoS parameters. |
|
325 */ |
|
326 IMPORT_C CQoSConfirmEvent(CQoSParameters& aParameters); |
|
327 |
|
328 /** |
|
329 * Returns the QoS parameters. |
|
330 * |
|
331 * @return QoS parameters. |
|
332 */ |
|
333 IMPORT_C CQoSParameters* Parameters() const; |
|
334 |
|
335 private: |
|
336 /** The address of the CQoSParameters parameter supplied during construction. */ |
|
337 CQoSParameters* iParameters; |
|
338 }; |
|
339 |
|
340 /** |
|
341 * Class for EQoSEventFailure event whereby a QoS request failed |
|
342 * |
|
343 * @publishedPartner |
|
344 * @released |
|
345 */ |
|
346 class CQoSFailureEvent : public CQoSEventBase |
|
347 { |
|
348 public: |
|
349 /** |
|
350 * Constructor. Sets the QoS parameters and reason code. |
|
351 * |
|
352 * @param aParameters QoS parameters. |
|
353 * @param aReason Reason code specifies the success or failure of the request. |
|
354 */ |
|
355 IMPORT_C CQoSFailureEvent(CQoSParameters& aParameters, TInt aReason); |
|
356 |
|
357 /** |
|
358 * Returns the QoS parameters. |
|
359 * |
|
360 * @return QoS parameters. |
|
361 */ |
|
362 IMPORT_C CQoSParameters* Parameters() const; |
|
363 |
|
364 /** |
|
365 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
366 * |
|
367 * @return Reason code. |
|
368 */ |
|
369 IMPORT_C TInt Reason() const; |
|
370 |
|
371 private: |
|
372 /** The address of the CQoSParameters parameter supplied during construction. */ |
|
373 CQoSParameters* iParameters; |
|
374 /** The reason code that specifies the success or failure of the request. */ |
|
375 TInt iReason; |
|
376 }; |
|
377 |
|
378 /** |
|
379 * Class for EQoSEventAdapt event whereby the QoS parameters have changed |
|
380 * |
|
381 * @publishedPartner |
|
382 * @released |
|
383 */ |
|
384 class CQoSAdaptEvent : public CQoSEventBase |
|
385 { |
|
386 public: |
|
387 /** |
|
388 * Constructor. Sets the QoS parameters and reason code. |
|
389 * |
|
390 * @param aParameters QoS parameters. |
|
391 * @param aReason Reason code specifies the success or failure of the request. |
|
392 */ |
|
393 IMPORT_C CQoSAdaptEvent(CQoSParameters& aParameters, TInt aReason); |
|
394 |
|
395 /** |
|
396 * Returns the QoS parameters. |
|
397 * |
|
398 * @return QoS parameters. |
|
399 */ |
|
400 IMPORT_C CQoSParameters* Parameters() const; |
|
401 |
|
402 /** |
|
403 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
404 * |
|
405 * @return Reason code. |
|
406 */ |
|
407 IMPORT_C TInt Reason() const; |
|
408 |
|
409 private: |
|
410 /** The address of the CQoSParameters parameter supplied during construction. */ |
|
411 CQoSParameters* iParameters; |
|
412 /** The reason code that specifies the success or failure of the request. */ |
|
413 TInt iReason; |
|
414 }; |
|
415 |
|
416 /** |
|
417 * Class for EQoSEventChannel event whereby a QoS channel is opened |
|
418 * |
|
419 * @publishedPartner |
|
420 * @released |
|
421 */ |
|
422 class CQoSChannelEvent : public CQoSEventBase |
|
423 { |
|
424 public: |
|
425 /** |
|
426 * Constructor. Sets the QoS parameters and reason code. |
|
427 * |
|
428 * @param aParameters QoS parameters. |
|
429 * @param aReason Reason code specifies the success or failure of the request. |
|
430 */ |
|
431 IMPORT_C CQoSChannelEvent(CQoSParameters* aParameters, TInt aReason); |
|
432 |
|
433 /** |
|
434 * Returns the QoS parameters. |
|
435 * |
|
436 * @return QoS parameters. |
|
437 */ |
|
438 IMPORT_C CQoSParameters* Parameters() const; |
|
439 |
|
440 /** |
|
441 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
442 * |
|
443 * @return Reason code. KErrNone if an existing channel was found, otherwise an error code. |
|
444 */ |
|
445 IMPORT_C TInt Reason() const; |
|
446 |
|
447 private: |
|
448 /** The address of the CQoSParameters parameter supplied during construction. */ |
|
449 CQoSParameters* iParameters; |
|
450 /** The reason code that specifies the success or failure of the request. */ |
|
451 TInt iReason; |
|
452 }; |
|
453 |
|
454 /** |
|
455 * Class for EQoSEventJoin event whereby a socket is attached to a QoS channel |
|
456 * |
|
457 * @publishedPartner |
|
458 * @released |
|
459 */ |
|
460 class CQoSJoinEvent : public CQoSEventBase |
|
461 { |
|
462 public: |
|
463 /** |
|
464 * Constructor. Sets the selector and reason code. Selector specifies the socket |
|
465 * that was attached to the QoS channel. |
|
466 * |
|
467 * @param aSelector Selector specifies the socket that was attached to the QoS channel. |
|
468 * @param aReason Reason code specifies the success or failure of the request. |
|
469 */ |
|
470 IMPORT_C CQoSJoinEvent(const TQoSSelector& aSelector, TInt aReason); |
|
471 |
|
472 /** |
|
473 * Returns the selector that was attached to the QoS channel. |
|
474 * |
|
475 * @return Selector that was attached to the QoS channel. |
|
476 */ |
|
477 IMPORT_C const TQoSSelector& Selector() const; |
|
478 |
|
479 /** |
|
480 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
481 * |
|
482 * @return Reason code. |
|
483 */ |
|
484 IMPORT_C TInt Reason() const; |
|
485 |
|
486 private: |
|
487 /** The selector that specifies the socket that was attached to the QoS channel. */ |
|
488 TQoSSelector iSelector; |
|
489 /** The reason code that specifies the success or failure of the request. */ |
|
490 TInt iReason; |
|
491 }; |
|
492 |
|
493 /** |
|
494 * Class for EQoSEventLeave event whereby a socket is detached from a QoS channel |
|
495 * |
|
496 * @publishedPartner |
|
497 * @released |
|
498 */ |
|
499 class CQoSLeaveEvent : public CQoSEventBase |
|
500 { |
|
501 public: |
|
502 /** |
|
503 * Constructor. Sets the selector and reason code. Selector specifies the socket |
|
504 * that was detached from the QoS channel. |
|
505 * |
|
506 * @param aSelector Selector specifies the socket that was detached from the QoS channel. |
|
507 * @param aReason Reason code specifies the success or failure of the request. |
|
508 */ |
|
509 IMPORT_C CQoSLeaveEvent(const TQoSSelector& aSelector, TInt aReason); |
|
510 |
|
511 /** |
|
512 * Returns the selector that was detached from the QoS channel. |
|
513 * |
|
514 * @return Selector that was detached from the QoS channel. |
|
515 */ |
|
516 IMPORT_C const TQoSSelector& Selector() const; |
|
517 |
|
518 /** |
|
519 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
520 * |
|
521 * @return Reason code. |
|
522 */ |
|
523 IMPORT_C TInt Reason() const; |
|
524 |
|
525 private: |
|
526 /** The QoS channel selector. */ |
|
527 TQoSSelector iSelector; |
|
528 /** The reason code that specifies the success or failure of the request. */ |
|
529 TInt iReason; |
|
530 }; |
|
531 |
|
532 /** |
|
533 * Class for EQoSEventAddPolicy event whereby a QoS policy was added to QoS policy database |
|
534 * |
|
535 * @publishedPartner |
|
536 * @released |
|
537 */ |
|
538 class CQoSAddEvent : public CQoSEventBase |
|
539 { |
|
540 public: |
|
541 /** |
|
542 * Constructor. Sets the QoS parameters and reason code. |
|
543 * |
|
544 * @param aParameters QoS parameters. |
|
545 * @param aReason Reason code specifies the success or failure of the request. |
|
546 */ |
|
547 IMPORT_C CQoSAddEvent(CQoSParameters* aParameters, TInt aReason); |
|
548 |
|
549 /** |
|
550 * Returns the QoS parameters. |
|
551 * |
|
552 * @return QoS parameters. |
|
553 */ |
|
554 IMPORT_C CQoSParameters* Parameters() const; |
|
555 |
|
556 /** |
|
557 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
558 * |
|
559 * @return Reason code. |
|
560 */ |
|
561 IMPORT_C TInt Reason() const; |
|
562 |
|
563 private: |
|
564 /** The address of the CQoSParameters parameter supplied during construction. */ |
|
565 CQoSParameters* iParameters; |
|
566 /** The reason code that specifies the success or failure of the request. */ |
|
567 TInt iReason; |
|
568 }; |
|
569 |
|
570 /** |
|
571 * Class for EQoSEventGetPolicy event whereby a QoS policy was searched from the |
|
572 * QoS policy database |
|
573 * |
|
574 * @publishedPartner |
|
575 * @released |
|
576 */ |
|
577 class CQoSGetEvent : public CQoSEventBase |
|
578 { |
|
579 public: |
|
580 /** |
|
581 * Constructor. Sets the QoS parameters and reason code. |
|
582 * |
|
583 * @param aParameters QoS parameters. |
|
584 * @param aReason Reason code specifies the success or failure of the request. |
|
585 */ |
|
586 IMPORT_C CQoSGetEvent(CQoSParameters* aParameters, TInt aReason); |
|
587 |
|
588 /** |
|
589 * Returns the QoS parameters. |
|
590 * |
|
591 * @return QoS parameters. |
|
592 */ |
|
593 IMPORT_C CQoSParameters* Parameters() const; |
|
594 |
|
595 /** |
|
596 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
597 * |
|
598 * @return Reason code. |
|
599 */ |
|
600 IMPORT_C TInt Reason() const; |
|
601 |
|
602 private: |
|
603 /** The address of the CQoSParameters parameter supplied during construction. */ |
|
604 CQoSParameters* iParameters; |
|
605 /** The reason code that specifies the success or failure of the request. */ |
|
606 TInt iReason; |
|
607 }; |
|
608 |
|
609 /** |
|
610 * Class for EQoSEventDeletePolicy event whereby a QoS policy was deleted |
|
611 * |
|
612 * @publishedPartner |
|
613 * @released |
|
614 */ |
|
615 class CQoSDeleteEvent : public CQoSEventBase |
|
616 { |
|
617 public: |
|
618 /** |
|
619 * Constructor. Sets the reason code indicating the success or failure of the request. |
|
620 * |
|
621 * @param aReason Reason code. |
|
622 */ |
|
623 IMPORT_C CQoSDeleteEvent(TInt aReason); |
|
624 |
|
625 /** |
|
626 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
627 * |
|
628 * @return Reason code. |
|
629 */ |
|
630 IMPORT_C TInt Reason() const; |
|
631 |
|
632 private: |
|
633 /** The reason code specifies the success or failure of the request. */ |
|
634 TInt iReason; |
|
635 }; |
|
636 |
|
637 /** |
|
638 * Class for EQoSEventLoadPolicyFile and EQoSEventUnloadPolicyFile events whereby |
|
639 * policy files are loaded or unloaded |
|
640 * |
|
641 * @publishedPartner |
|
642 * @released |
|
643 */ |
|
644 class CQoSLoadEvent : public CQoSEventBase |
|
645 { |
|
646 public: |
|
647 /** |
|
648 * Constructor. |
|
649 * |
|
650 * @param aEvent Sets the event type (EQoSEventLoadPolicyFile or EQoSEventUnloadPolicyFile). |
|
651 * @param aReason Reason code. |
|
652 * @param aFileName The name of the policy file. |
|
653 */ |
|
654 IMPORT_C CQoSLoadEvent(const TQoSEvent& aEvent, TInt aReason, const TDesC& aFileName); |
|
655 |
|
656 /** |
|
657 * Returns the name of the policy file. |
|
658 * |
|
659 * @return The name of the policy file. |
|
660 */ |
|
661 IMPORT_C const TFileName& FileName() const; |
|
662 |
|
663 /** |
|
664 * Returns the reason code. Reason code specifies the success or failure of the request. |
|
665 * |
|
666 * @return Reason code. |
|
667 */ |
|
668 IMPORT_C TInt Reason() const; |
|
669 |
|
670 private: |
|
671 /** The reason code that specifies the success or failure of the request. */ |
|
672 TInt iReason; |
|
673 /** The name of the QoS policy file. */ |
|
674 TFileName iFileName; |
|
675 }; |
|
676 |
|
677 /** |
|
678 * An interface to catch QoS events. |
|
679 * |
|
680 * @publishedPartner |
|
681 * @released |
|
682 */ |
|
683 class MQoSObserver |
|
684 { |
|
685 public: |
|
686 /** |
|
687 This method is called by the QoS API when a QoS event occurs. |
|
688 |
|
689 @publishedPartner |
|
690 @released |
|
691 @capability NetworkServices Restrict QoS operations in similar way as |
|
692 normal socket operations. |
|
693 @param aQoSEvent QoS event class. |
|
694 */ |
|
695 virtual void Event(const CQoSEventBase& aQoSEvent)=0; |
|
696 }; |
|
697 |
|
698 /** |
|
699 * An interface to manage QoS policies and QoS policy files. RQoSPolicy::Open must always be called before |
|
700 * any other methods in the RQoSPolicy can be called. Note that only one request can be pending at once |
|
701 * (QoS event should be received before issuing next request). |
|
702 * |
|
703 * @publishedPartner |
|
704 * @released |
|
705 */ |
|
706 class RQoSPolicy |
|
707 { |
|
708 public: |
|
709 IMPORT_C RQoSPolicy(); |
|
710 IMPORT_C ~RQoSPolicy(); |
|
711 |
|
712 /** |
|
713 * RQoSPolicy::Open must always be called before any other method can be used. |
|
714 * Specifies the selector for a QoS policy. |
|
715 * |
|
716 * @param aSelector Selector for the QoS policy. |
|
717 * @return KErrNone if everything is ok, != KErrNone is the QoS channel cannot be opened. |
|
718 */ |
|
719 IMPORT_C TInt Open(const TQoSSelector& aSelector); |
|
720 |
|
721 /** |
|
722 * Sets the QoS parameters for the QoS policy. CQoSAddEvent event is received |
|
723 * asynchronously to indicate the success of failure of the request. |
|
724 * |
|
725 * @param aPolicy QoS parameters. |
|
726 * @return KErrNone if request was issued, != KErrNone if there was an error. |
|
727 */ |
|
728 IMPORT_C TInt SetQoS(CQoSParameters& aPolicy); |
|
729 |
|
730 /** |
|
731 * Gets the QoS policy from QoS policy database. CQoSGetEvent event is received |
|
732 * asynchronously to indicate the success of failure of the request. |
|
733 * |
|
734 * @return KErrNone if request was issued, != KErrNone if there was an error. |
|
735 */ |
|
736 IMPORT_C TInt GetQoS(); |
|
737 |
|
738 /** |
|
739 * Deletes the QoS policy. |
|
740 * @return KErrNone if request was issued, != KErrNone if there was an error (for example, |
|
741 * RQoSPolicy::Open was not called). |
|
742 */ |
|
743 IMPORT_C TInt Close(); |
|
744 |
|
745 /** |
|
746 * Registers an event observer to catch QoS events. |
|
747 * |
|
748 * @param aObserver Event observer. |
|
749 * @param aMask An event mask. An application can specify a set of QoS events that it wants to receive. |
|
750 * By default all events are notified to the application. |
|
751 * @return KErrNone if request was issued, != KErrNone if there was an error. |
|
752 */ |
|
753 IMPORT_C TInt NotifyEvent(MQoSObserver& aObserver, TUint aMask=KQoSEventAll); |
|
754 |
|
755 /** |
|
756 * Deregisters an event observer to catch QoS events. |
|
757 * |
|
758 * @param aObserver Event observer. |
|
759 * @return KErrNone if request was issued, != KErrNone if there was an error. |
|
760 */ |
|
761 IMPORT_C TInt CancelNotifyEvent(MQoSObserver& aObserver); |
|
762 |
|
763 /** |
|
764 * Loads a QoS policy file into the QoS policy database. EQoSEventLoadPolicyFile event is received |
|
765 * asynchronously to indicate the success of failure of the request. |
|
766 * |
|
767 * @param aName Name of the QoS policy file to be loaded. |
|
768 * @return KErrNone if request was issued, != KErrNone if there was an error. |
|
769 */ |
|
770 IMPORT_C TInt LoadPolicyFile(const TDesC& aName); |
|
771 |
|
772 /** |
|
773 * Unloads a QoS policy file from the QoS policy database. EQoSEventUnloadPolicyFile event is received |
|
774 * asynchronously to indicate the success of failure of the request. |
|
775 * |
|
776 * @param aName Name of the QoS policy file to be unloaded. |
|
777 * @return KErrNone if request was issued, != KErrNone if there was an error. |
|
778 */ |
|
779 IMPORT_C TInt UnloadPolicyFile(const TDesC& aName); |
|
780 |
|
781 private: |
|
782 /** A dynamically allocated QoS policy. */ |
|
783 CPolicy* iPolicy;// //< Used internally by qoslib |
|
784 }; |
|
785 |
|
786 #endif |