|
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 #ifndef __QOSPARAMETERS_H__ |
|
17 #define __QOSPARAMETERS_H__ |
|
18 |
|
19 |
|
20 #include <networking/pfqos.h> |
|
21 |
|
22 /** States the highest allowable priority for Interactive class traffic. */ |
|
23 const TInt KQoSHighestPriority = 0; |
|
24 /** States the lowest allowable priority for Interactive class traffic. */ |
|
25 const TInt KQoSLowestPriority = 7; |
|
26 |
|
27 class CExtension; |
|
28 |
|
29 // QoS policy options |
|
30 /** Flag to indicate that the application is able to adapt. */ |
|
31 const TUint KPfqosOptionCanAdapt = 1; // Application is able to adapt |
|
32 // Network and Transport layer hdrs are included in bitrate values. |
|
33 const TUint KPfqosOptionHeadersIncluded = 2; |
|
34 |
|
35 class TQoSParameters |
|
36 /** Holds information on the parameters that define Quality of Service (QoS). |
|
37 * |
|
38 * @internalTechnology |
|
39 */ |
|
40 { |
|
41 public: |
|
42 IMPORT_C TQoSParameters(); |
|
43 IMPORT_C TInt operator==(const TQoSParameters& aFlowSpec) const; |
|
44 IMPORT_C TQoSParameters &operator=(const TQoSParameters& aSpec); |
|
45 |
|
46 inline TInt GetUplinkBandwidth() const; |
|
47 inline TInt GetUpLinkMaximumBurstSize() const; |
|
48 inline TInt GetUpLinkMaximumPacketSize() const; |
|
49 inline TInt GetUpLinkAveragePacketSize() const; |
|
50 inline TInt GetUpLinkDelay() const; |
|
51 inline TInt GetUpLinkPriority() const; |
|
52 |
|
53 inline TInt GetDownlinkBandwidth() const; |
|
54 inline TInt GetDownLinkMaximumBurstSize() const; |
|
55 inline TInt GetDownLinkMaximumPacketSize() const; |
|
56 inline TInt GetDownLinkAveragePacketSize() const; |
|
57 inline TInt GetDownLinkDelay() const; |
|
58 inline TInt GetDownLinkPriority() const; |
|
59 |
|
60 IMPORT_C void SetUplinkBandwidth(TInt aBandwidth); |
|
61 IMPORT_C void SetUpLinkMaximumBurstSize(TInt aSize); |
|
62 IMPORT_C void SetUpLinkMaximumPacketSize(TInt aMaxSize); |
|
63 IMPORT_C void SetUpLinkAveragePacketSize(TInt aSize); |
|
64 IMPORT_C void SetUpLinkDelay(TInt aDelay); |
|
65 IMPORT_C void SetUpLinkPriority(TInt aPriority); |
|
66 |
|
67 IMPORT_C void SetDownlinkBandwidth(TInt aBandwidth); |
|
68 IMPORT_C void SetDownLinkMaximumBurstSize(TInt aSize); |
|
69 IMPORT_C void SetDownLinkMaximumPacketSize(TInt aMaxSize); |
|
70 IMPORT_C void SetDownLinkAveragePacketSize(TInt aSize); |
|
71 IMPORT_C void SetDownLinkDelay(TInt aDelay); |
|
72 IMPORT_C void SetDownLinkPriority(TInt aPriority); |
|
73 |
|
74 inline void SetFlags(TUint aFlags); |
|
75 inline TUint Flags() const; |
|
76 inline const TName& GetName() const; |
|
77 IMPORT_C TBool AdaptMode() const; |
|
78 IMPORT_C TBool GetHeaderMode() const; |
|
79 |
|
80 IMPORT_C TInt SetName(const TName& aName); |
|
81 IMPORT_C void SetAdaptMode(TBool aCanAdapt); |
|
82 |
|
83 IMPORT_C void SetHeaderMode(TBool aHeadersIncluded); |
|
84 |
|
85 IMPORT_C void Copy(CExtension& aExtension); |
|
86 |
|
87 private: |
|
88 /** The token rate for the uplink. */ |
|
89 TInt iUplinkBandwidth; |
|
90 /** The token bucket size for the uplink. */ |
|
91 TInt iUpLinkMaximumBurstSize; |
|
92 /** The maximum packet size for the uplink. */ |
|
93 TInt iUpLinkMaximumPacketSize; |
|
94 /** The size of the minimum policed unit for the uplink. */ |
|
95 TInt iUpLinkAveragePacketSize; |
|
96 /** The delay (in milliseconds) for the uplink. */ |
|
97 TInt iUpLinkDelay; |
|
98 /** The priority for the uplink. */ |
|
99 TInt iUpLinkPriority; |
|
100 |
|
101 /** The token rate for the downlink. */ |
|
102 TInt iDownlinkBandwidth; |
|
103 /** The token bucket size for the downlink. */ |
|
104 TInt iDownLinkMaximumBurstSize; |
|
105 /** The maximum packet size for the downlink. */ |
|
106 TInt iDownLinkMaximumPacketSize; |
|
107 /** The size of the minimum policed packet for the downlink. */ |
|
108 TInt iDownLinkAveragePacketSize; |
|
109 /** The delay (in milliseconds) for the downlink. */ |
|
110 TInt iDownLinkDelay; |
|
111 /** The priority for the downlink. */ |
|
112 TInt iDownLinkPriority; |
|
113 |
|
114 /** The name. */ |
|
115 TName iName; |
|
116 /** Internal represention of the flags. */ |
|
117 TUint iFlags; |
|
118 }; |
|
119 |
|
120 // Inline methods |
|
121 inline TInt TQoSParameters::GetUplinkBandwidth() const |
|
122 /** Gets the current token rate for the uplink. |
|
123 * |
|
124 * @return The current token rate for the uplink. */ |
|
125 { return iUplinkBandwidth; }; |
|
126 |
|
127 inline TInt TQoSParameters::GetUpLinkMaximumBurstSize() const |
|
128 /** Gets the current size of the token bucket, that is the maximum number |
|
129 * of tokens that the transfer can support. |
|
130 * |
|
131 * @return The current size of the token bucket. */ |
|
132 { return iUpLinkMaximumBurstSize; }; |
|
133 |
|
134 inline TInt TQoSParameters::GetUpLinkMaximumPacketSize() const |
|
135 /** Gets the maximum uplink single packet size. |
|
136 * |
|
137 * @return The maximum uplink single packet size. */ |
|
138 { return iUpLinkMaximumPacketSize; }; |
|
139 |
|
140 inline TInt TQoSParameters::GetUpLinkAveragePacketSize() const |
|
141 /** Gets the size of the minimum policed unit which is the smallest packet |
|
142 * size for traffic policing. |
|
143 * |
|
144 * @return The size of the minimum policed unit. */ |
|
145 { return iUpLinkAveragePacketSize; }; |
|
146 |
|
147 inline TInt TQoSParameters::GetUpLinkDelay() const |
|
148 /** Gets the delay for uplink direction (in milliseconds). |
|
149 * |
|
150 * @return The delay for uplink direction (in milliseconds). */ |
|
151 { return iUpLinkDelay; }; |
|
152 |
|
153 inline TInt TQoSParameters::GetUpLinkPriority() const |
|
154 /** Gets the uplink priority. |
|
155 * |
|
156 * @return The uplink priority. */ |
|
157 { return iUpLinkPriority; }; |
|
158 |
|
159 inline TInt TQoSParameters::GetDownlinkBandwidth() const |
|
160 /** Gets the token rate for downlink direction. |
|
161 * |
|
162 * Token rate defines the requested transfer rate that the application |
|
163 * requests. |
|
164 * |
|
165 * @return The downlink token rate in bytes/second. */ |
|
166 { return iDownlinkBandwidth; }; |
|
167 |
|
168 inline TInt TQoSParameters::GetDownLinkMaximumBurstSize() const |
|
169 /** Gets the token bucket size for downlink direction. |
|
170 * |
|
171 * Token bucket size defines the burst size that the application may send. |
|
172 * |
|
173 * @return The current token bucket size for downlink direction (bytes). */ |
|
174 { return iDownLinkMaximumBurstSize; }; |
|
175 |
|
176 inline TInt TQoSParameters::GetDownLinkMaximumPacketSize() const |
|
177 /** Gets the maximum packet size for downlink direction. |
|
178 * @return The maximum packet size for downlink direction in bytes. */ |
|
179 { return iDownLinkMaximumPacketSize; }; |
|
180 |
|
181 inline TInt TQoSParameters::GetDownLinkAveragePacketSize() const |
|
182 /** The minimum policed unit for downlink direction. |
|
183 * |
|
184 * Minimum policed unit is used as the smallest packet size when doing |
|
185 * traffic policing and estimating effect of protocol headers. The minimum |
|
186 * policed unit must be <= maximum packet size. |
|
187 * |
|
188 * @return The minimum policed unit for downlink direction in bytes. */ |
|
189 { return iDownLinkAveragePacketSize; }; |
|
190 |
|
191 inline TInt TQoSParameters::GetDownLinkDelay() const |
|
192 /** Gets the requested delay for downlink direction. |
|
193 * |
|
194 * @return The delay for downlink direction (in milliseconds). */ |
|
195 { return iDownLinkDelay; }; |
|
196 |
|
197 inline TInt TQoSParameters::GetDownLinkPriority() const |
|
198 /** Gets the priority for downlink direction. |
|
199 * Priority can be used to prioritise between traffic flows inside the |
|
200 * terminal. |
|
201 * |
|
202 * @return The priority for downlink direction, the value 0 represents the |
|
203 * highest priority. */ |
|
204 { return iDownLinkPriority; }; |
|
205 |
|
206 inline void TQoSParameters::SetFlags(TUint aFlags) |
|
207 /** Set the flags. |
|
208 * |
|
209 * Currently the only flag supported is KPfqosOptionCanAdapt that indicates |
|
210 * whether the aplication can adapt. |
|
211 * |
|
212 * @param aFlags The flag values to set. */ |
|
213 { iFlags = aFlags; }; |
|
214 |
|
215 inline TUint TQoSParameters::Flags() const |
|
216 /** Gets the current flags. |
|
217 * |
|
218 * @return The current flags. */ |
|
219 { return iFlags; }; |
|
220 |
|
221 inline const TName& TQoSParameters::GetName() const |
|
222 /** Gets a reference to the name. |
|
223 * |
|
224 * @return The reference to the name. */ |
|
225 { return iName; }; |
|
226 |
|
227 #endif |