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