OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2013 Magister Solutions |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Budiarto Herman <budiarto.herman@magister.fi> |
| 19 * |
| 20 */ |
| 21 |
| 22 #ifndef THREE_GPP_HTTP_VARIABLES_H |
| 23 #define THREE_GPP_HTTP_VARIABLES_H |
| 24 |
| 25 #include <ns3/object.h> |
| 26 #include <ns3/nstime.h> |
| 27 #include <ns3/random-variable-stream.h> |
| 28 |
| 29 |
| 30 namespace ns3 { |
| 31 |
| 32 |
| 33 /** |
| 34 * \ingroup http |
| 35 * Container of various random variables to assist in generating web browsing |
| 36 * traffic pattern. |
| 37 * |
| 38 * The available random values to be retrieved are: |
| 39 * - MTU size --- 536 bytes or 1460 bytes; |
| 40 * - request size --- constant 350 bytes; |
| 41 * - delay in generating a main object --- 0 second; |
| 42 * - main object size --- truncated LogNormal distribution with a mean of |
| 43 * 10710 bytes; |
| 44 * \image html http-main-object-size.png |
| 45 * - delay in generating an embedded object --- 0 second; |
| 46 * - embedded object size (in bytes) --- truncated LogNormal distribution |
| 47 * with a mean of 7758 bytes; |
| 48 * \image html http-embedded-object-size.png |
| 49 * - number of embedded object per web page --- truncated Pareto distribution |
| 50 * with a mean of approximately 3.95 (after truncation); |
| 51 * \image html http-num-of-embedded-objects.png |
| 52 * - length of reading time (in seconds) --- unbounded exponential |
| 53 * distribution with a mean of 30 seconds; and |
| 54 * \image html http-reading-time.png |
| 55 * - length of parsing time (in seconds) --- unbounded exponential |
| 56 * distribution with a mean of 0.13 seconds. |
| 57 * \image html http-parsing-time.png |
| 58 * |
| 59 * Most parameters of the random distributions are configurable via attributes |
| 60 * and methods of this class. The default values are according to the following |
| 61 * references: |
| 62 * - 3GPP TR 25.892, "Feasibility Study for Orthogonal Frequency Division |
| 63 * Multiplexing (OFDM) for UTRAN enhancement" |
| 64 * - IEEE 802.16m, "Evaluation Methodology Document (EMD)", |
| 65 * IEEE 802.16m-08/004r5, July 2008. |
| 66 * - NGMN Alliance, "NGMN Radio Access Performance Evaluation Methodology", |
| 67 * v1.0, January 2008. |
| 68 * - 3GPP2-TSGC5, "HTTP, FTP and TCP models for 1xEV-DV simulations", 2001. |
| 69 */ |
| 70 class ThreeGppHttpVariables : public Object |
| 71 { |
| 72 public: |
| 73 /// Create a new instance with default configuration of random distributions. |
| 74 ThreeGppHttpVariables (); |
| 75 |
| 76 /** |
| 77 * Returns the object TypeId. |
| 78 * \return The object TypeId. |
| 79 */ |
| 80 static TypeId GetTypeId (); |
| 81 |
| 82 /** |
| 83 * Draws a random value of maximum transmission unit (MTU) size in bytes. |
| 84 * |
| 85 * The possible MTU sizes are 1460 bytes and 536 bytes with 76% and 24% |
| 86 * chances, respectively. The selected value is typically used by the sockets |
| 87 * of HTTP servers to send the response packets (both main objects and |
| 88 * embedded objects) to the requesting HTTP clients. |
| 89 * |
| 90 * \return MTU size in bytes. |
| 91 */ |
| 92 uint32_t GetMtuSize (); |
| 93 |
| 94 /** |
| 95 * Returns the constant HTTP request size in bytes. |
| 96 * |
| 97 * By default, HTTP request size is 350 bytes, which can be modified by |
| 98 * setting the `RequestSize` attribute or calling the SetRequestSize() |
| 99 * method. This value applies to requests by HTTP client for main objects |
| 100 * and embedded objects alike. |
| 101 * |
| 102 * \return Request size in bytes. |
| 103 */ |
| 104 uint32_t GetRequestSize (); |
| 105 |
| 106 /** |
| 107 * Returns the constant length of time needed by an HTTP server to generate |
| 108 * a main object. |
| 109 * |
| 110 * By default, main objects are generated instantly, i.e., zero delay. This |
| 111 * can be modified by setting the `MainObjectGenerationDelay` attribute or by |
| 112 * calling the SetMainObjectGenerationDelay() method. |
| 113 * |
| 114 * \return The delay for generating a main object. |
| 115 */ |
| 116 Time GetMainObjectGenerationDelay (); |
| 117 |
| 118 /** |
| 119 * Draws a random main object size (in bytes) to be sent by an HTTP server. |
| 120 * |
| 121 * The size of main objects are determined by a truncated log-normal random |
| 122 * distribution. The default distribution settings produces random integers |
| 123 * with a mean of 10710 bytes and a standard deviation of 25032 bytes, and |
| 124 * then truncated to fit between 100 bytes and 2 MB. These default settings |
| 125 * can be modified via attributes or class methods. |
| 126 * |
| 127 * \return Main object size in bytes. |
| 128 */ |
| 129 uint32_t GetMainObjectSize (); |
| 130 |
| 131 /** |
| 132 * Returns the constant length of time needed by an HTTP server to generate |
| 133 * an embedded object. |
| 134 * |
| 135 * By default, embedded objects are generated instantly, i.e., zero delay. |
| 136 * This can be modified by setting the `EmbeddedObjectGenerationDelay` |
| 137 * attribute or by calling the SetEmbeddedObjectGenerationDelay() method. |
| 138 * |
| 139 * \return The delay for generating an embedded object. |
| 140 */ |
| 141 Time GetEmbeddedObjectGenerationDelay (); |
| 142 |
| 143 /** |
| 144 * Draws a random embedded object size (in bytes) to be sent by an HTTP |
| 145 * server. |
| 146 * |
| 147 * The size of embedded objects are determined by a truncated log-normal |
| 148 * random distribution. The default distribution settings produces random |
| 149 * integers with a mean of 7758 bytes and a standard deviation of 126168 |
| 150 * bytes, and then truncated to fit between 50 bytes and 2 MB. These default |
| 151 * settings can be modified via attributes or class methods. |
| 152 * |
| 153 * \return Embedded object size in bytes. |
| 154 */ |
| 155 uint32_t GetEmbeddedObjectSize (); |
| 156 |
| 157 /** |
| 158 * Draws a random integer indicating the number of embedded objects in a |
| 159 * main object. |
| 160 * |
| 161 * The number of embedded objects in a main object is typically discovered |
| 162 * when the HTTP client is parsing the main object in question. This number |
| 163 * is determined by a truncated Pareto distribution. The default distribution |
| 164 * settings produces (after truncation) random integers within [0, 53) |
| 165 * interval, with an actual mean of approximately 3.95. |
| 166 * |
| 167 * \return The number of embedded objects. |
| 168 */ |
| 169 uint32_t GetNumOfEmbeddedObjects (); |
| 170 |
| 171 /** |
| 172 * Draws a random length of time which is spent by a hypothetical human user |
| 173 * (HTTP client) to read a web page before transitioning to another web page. |
| 174 * |
| 175 * Reading time is determined by an exponential distribution. The default |
| 176 * distribution settings produces random values with a mean of 30 seconds |
| 177 * without any maximum bound. The mean can be modified by setting the |
| 178 * `ReadingTimeMean` attribute or by calling the SetReadingTimeMean() method. |
| 179 * |
| 180 * \return Time interval for reading a web page. |
| 181 */ |
| 182 Time GetReadingTime (); |
| 183 |
| 184 /** |
| 185 * Draws a random length of time which simulate the small delay caused by |
| 186 * HTTP client looking for any embedded objects within the received main |
| 187 * object. |
| 188 * |
| 189 * Parsing time is determined by an exponential distribution. The default |
| 190 * distribution settings produces random values with a mean of 130 ms without |
| 191 * any maximum bound. The mean can be modified by setting the |
| 192 * `ParsingTimeMean` attribute or by calling the SetParsingTimeMean() method. |
| 193 * |
| 194 * \return time interval for parsing a main object |
| 195 */ |
| 196 Time GetParsingTime (); |
| 197 |
| 198 /** |
| 199 * Assign a fixed random variable stream number to the random variables used |
| 200 * by this model. |
| 201 * |
| 202 * Different random variable stream number makes random number generators to |
| 203 * produce different set of random values, thus possibly resulting to |
| 204 * different simulation results. On the other hand, two identical simulations |
| 205 * which use the same stream number should produce identical results (the |
| 206 * repeatability property of ns-3 simulation). |
| 207 * |
| 208 * \param stream The first stream index to use. |
| 209 * \return The number of stream indices assigned by this model. |
| 210 */ |
| 211 int64_t AssignStreams (int64_t stream); |
| 212 |
| 213 // SETTER METHODS |
| 214 |
| 215 /** |
| 216 * \param constant Request size in bytes. |
| 217 */ |
| 218 void SetRequestSize (uint32_t constant); |
| 219 /** |
| 220 * \param constant The delay for generating a main object. |
| 221 */ |
| 222 void SetMainObjectGenerationDelay (Time constant); |
| 223 /** |
| 224 * \param mean The mean of main object sizes in bytes. Must be greater than |
| 225 * zero. |
| 226 */ |
| 227 void SetMainObjectSizeMean (uint32_t mean); |
| 228 /** |
| 229 * \param stdDev The standard deviation of main object sizes in bytes. |
| 230 */ |
| 231 void SetMainObjectSizeStdDev (uint32_t stdDev); |
| 232 /** |
| 233 * \param constant The delay for generating an embedded object. |
| 234 */ |
| 235 void SetEmbeddedObjectGenerationDelay (Time constant); |
| 236 /** |
| 237 * \param mean The mean of embedded object sizes in bytes. Must be greater |
| 238 * than zero. |
| 239 */ |
| 240 void SetEmbeddedObjectSizeMean (uint32_t mean); |
| 241 /** |
| 242 * \param stdDev The standard deviation of embedded object sizes in bytes. |
| 243 */ |
| 244 void SetEmbeddedObjectSizeStdDev (uint32_t stdDev); |
| 245 /** |
| 246 * \param max The upper bound parameter of the Pareto distribution for |
| 247 * determining the number of embedded objects per web page. |
| 248 */ |
| 249 void SetNumOfEmbeddedObjectsMax (uint32_t max); |
| 250 /** |
| 251 * \param shape The shape parameter of the Pareto distribution for |
| 252 * determining the number of embedded objects per web page. |
| 253 */ |
| 254 void SetNumOfEmbeddedObjectsShape (double shape); |
| 255 /** |
| 256 * \param scale The scale parameter of the Pareto distribution for |
| 257 * determining the number of embedded objects per web page. |
| 258 */ |
| 259 void SetNumOfEmbeddedObjectsScale (uint32_t scale); |
| 260 /** |
| 261 * \param mean The mean length of time needed for reading a web page. |
| 262 */ |
| 263 void SetReadingTimeMean (Time mean); |
| 264 /** |
| 265 * \param mean The mean length of time needed for parsing a main object. |
| 266 */ |
| 267 void SetParsingTimeMean (Time mean); |
| 268 |
| 269 private: |
| 270 /** |
| 271 * Random variable for determining MTU size (in bytes). |
| 272 */ |
| 273 Ptr<UniformRandomVariable> m_mtuSizeRng; |
| 274 /** |
| 275 * Random variable for determining request size (in bytes). |
| 276 */ |
| 277 Ptr<ConstantRandomVariable> m_requestSizeRng; |
| 278 /** |
| 279 * Random variable for determining the delay needed to generate a main object |
| 280 * (in seconds). |
| 281 */ |
| 282 Ptr<ConstantRandomVariable> m_mainObjectGenerationDelayRng; |
| 283 /** |
| 284 * Random variable for determining main object size (in bytes). |
| 285 */ |
| 286 Ptr<LogNormalRandomVariable> m_mainObjectSizeRng; |
| 287 /// Mean parameter for #m_mainObjectSizeRng; |
| 288 uint32_t m_mainObjectSizeMean; |
| 289 /// Standard deviation parameter for #m_mainObjectSizeRng; |
| 290 uint32_t m_mainObjectSizeStdDev; |
| 291 /// Lower bound parameter for #m_mainObjectSizeRng; |
| 292 uint32_t m_mainObjectSizeMin; |
| 293 /// Upper bound parameter for #m_mainObjectSizeRng; |
| 294 uint32_t m_mainObjectSizeMax; |
| 295 /// Lower MTU size |
| 296 uint32_t m_lowMtu; |
| 297 /// Higher MTU size |
| 298 uint32_t m_highMtu; |
| 299 /// High MTU size probability |
| 300 double m_highMtuProbability; |
| 301 /** |
| 302 * Random variable for determining the delay needed to generate an embedded |
| 303 * object (in seconds). |
| 304 */ |
| 305 Ptr<ConstantRandomVariable> m_embeddedObjectGenerationDelayRng; |
| 306 /** |
| 307 * Random variable for determining embedded object size (in bytes). |
| 308 */ |
| 309 Ptr<LogNormalRandomVariable> m_embeddedObjectSizeRng; |
| 310 /// Mean parameter for #m_embeddedObjectSizeRng. |
| 311 uint32_t m_embeddedObjectSizeMean; |
| 312 /// Standard deviation parameter for #m_embeddedObjectSizeRng. |
| 313 uint32_t m_embeddedObjectSizeStdDev; |
| 314 /// Lower bound parameter for #m_embeddedObjectSizeRng. |
| 315 uint32_t m_embeddedObjectSizeMin; |
| 316 /// Upper bound parameter for #m_embeddedObjectSizeRng. |
| 317 uint32_t m_embeddedObjectSizeMax; |
| 318 /** |
| 319 * Random variable for determining the number of embedded objects. |
| 320 */ |
| 321 Ptr<ParetoRandomVariable> m_numOfEmbeddedObjectsRng; |
| 322 /// Scale parameter for #m_numOfEmbeddedObjectsRng. |
| 323 uint32_t m_numOfEmbeddedObjectsScale; |
| 324 /** |
| 325 * Random variable for determining the length of reading time (in seconds). |
| 326 */ |
| 327 Ptr<ExponentialRandomVariable> m_readingTimeRng; |
| 328 /** |
| 329 * Random variable for determining the length of parsing time (in seconds). |
| 330 */ |
| 331 Ptr<ExponentialRandomVariable> m_parsingTimeRng; |
| 332 |
| 333 }; // end of `class TreeGppHttpVariables` |
| 334 |
| 335 |
| 336 } // end of `namespace ns3` |
| 337 |
| 338 #endif /* THREE_GPP_HTTP_VARIABLES_H */ |
| 339 |
OLD | NEW |