A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
three-gpp-http-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 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_HEADER_H
22
#define THREE_GPP_HTTP_HEADER_H
23
24
#include <ns3/header.h>
25
#include <ns3/nstime.h>
26
27
namespace
ns3
28
{
29
30
class
Packet;
31
32
/**
33
* \ingroup http
34
* \brief Header used by web browsing applications to transmit information about
35
* content type, content length and timestamps for delay statistics.
36
*
37
* The header contains the following fields (and their respective size when
38
* serialized):
39
* - content type (2 bytes);
40
* - content length (4 bytes);
41
* - client time stamp (8 bytes); and
42
* - server time stamp (8 bytes).
43
*
44
* The header is attached to every packet transmitted by ThreeGppHttpClient and
45
* ThreeGppHttpServer applications. In received, split packets, only the first packet
46
* of transmitted object contains the header, which helps to identify how many bytes are
47
* left to be received.
48
*
49
* The last 2 fields allow the applications to compute the propagation delay of
50
* each packet. The *client TS* field indicates the time when the request
51
* packet is sent by the ThreeGppHttpClient, while the *server TS* field indicates the
52
* time when the response packet is sent by the ThreeGppHttpServer.
53
*/
54
class
ThreeGppHttpHeader
:
public
Header
55
{
56
public
:
57
/// Creates an empty instance.
58
ThreeGppHttpHeader
();
59
60
/**
61
* Returns the object TypeId.
62
* \return The object TypeId.
63
*/
64
static
TypeId
GetTypeId
();
65
66
// Inherited from ObjectBase base class.
67
TypeId
GetInstanceTypeId
()
const override
;
68
69
// Inherited from Header base class.
70
uint32_t
GetSerializedSize
()
const override
;
71
void
Serialize
(
Buffer::Iterator
start)
const override
;
72
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
73
void
Print
(std::ostream& os)
const override
;
74
75
/**
76
* \return The string representation of the header.
77
*/
78
std::string
ToString
()
const
;
79
80
/// The possible types of content (default = NOT_SET).
81
enum
ContentType_t
82
{
83
NOT_SET
,
///< Integer equivalent = 0.
84
MAIN_OBJECT
,
///< Integer equivalent = 1.
85
EMBEDDED_OBJECT
///< Integer equivalent = 2.
86
};
87
88
/**
89
* \param contentType The content type.
90
*/
91
void
SetContentType
(
ContentType_t
contentType);
92
93
/**
94
* \return The content type.
95
*/
96
ContentType_t
GetContentType
()
const
;
97
98
/**
99
* \param contentLength The content length (in bytes).
100
*/
101
void
SetContentLength
(
uint32_t
contentLength);
102
103
/**
104
* \return The content length (in bytes).
105
*/
106
uint32_t
GetContentLength
()
const
;
107
108
/**
109
* \param clientTs The client time stamp.
110
*/
111
void
SetClientTs
(
Time
clientTs);
112
113
/**
114
* \return The client time stamp.
115
*/
116
Time
GetClientTs
()
const
;
117
118
/**
119
* \param serverTs The server time stamp.
120
*/
121
void
SetServerTs
(
Time
serverTs);
122
123
/**
124
* \return The server time stamp.
125
*/
126
Time
GetServerTs
()
const
;
127
128
private
:
129
uint16_t
m_contentType
;
//!<" Content type field in integer format.
130
uint32_t
m_contentLength
;
//!<" Content length field (in bytes unit).
131
uint64_t
m_clientTs
;
//!<" Client time stamp field (in time step unit).
132
uint64_t
m_serverTs
;
//!<" Server time stamp field (in time step unit).
133
134
};
// end of `class ThreeGppHttpHeader`
135
136
}
// namespace ns3
137
138
#endif
/* THREE_GPP_HTTP_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::ThreeGppHttpHeader
Header used by web browsing applications to transmit information about content type,...
Definition:
three-gpp-http-header.h:55
ns3::ThreeGppHttpHeader::SetClientTs
void SetClientTs(Time clientTs)
Definition:
three-gpp-http-header.cc:176
ns3::ThreeGppHttpHeader::ToString
std::string ToString() const
Definition:
three-gpp-http-header.cc:111
ns3::ThreeGppHttpHeader::SetServerTs
void SetServerTs(Time serverTs)
Definition:
three-gpp-http-header.cc:189
ns3::ThreeGppHttpHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
three-gpp-http-header.cc:61
ns3::ThreeGppHttpHeader::GetClientTs
Time GetClientTs() const
Definition:
three-gpp-http-header.cc:183
ns3::ThreeGppHttpHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition:
three-gpp-http-header.cc:77
ns3::ThreeGppHttpHeader::SetContentLength
void SetContentLength(uint32_t contentLength)
Definition:
three-gpp-http-header.cc:163
ns3::ThreeGppHttpHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition:
three-gpp-http-header.cc:67
ns3::ThreeGppHttpHeader::SetContentType
void SetContentType(ContentType_t contentType)
Definition:
three-gpp-http-header.cc:120
ns3::ThreeGppHttpHeader::ContentType_t
ContentType_t
The possible types of content (default = NOT_SET).
Definition:
three-gpp-http-header.h:82
ns3::ThreeGppHttpHeader::NOT_SET
@ NOT_SET
Integer equivalent = 0.
Definition:
three-gpp-http-header.h:83
ns3::ThreeGppHttpHeader::EMBEDDED_OBJECT
@ EMBEDDED_OBJECT
Integer equivalent = 2.
Definition:
three-gpp-http-header.h:85
ns3::ThreeGppHttpHeader::MAIN_OBJECT
@ MAIN_OBJECT
Integer equivalent = 1.
Definition:
three-gpp-http-header.h:84
ns3::ThreeGppHttpHeader::ThreeGppHttpHeader
ThreeGppHttpHeader()
Creates an empty instance.
Definition:
three-gpp-http-header.cc:35
ns3::ThreeGppHttpHeader::m_clientTs
uint64_t m_clientTs
" Client time stamp field (in time step unit).
Definition:
three-gpp-http-header.h:131
ns3::ThreeGppHttpHeader::m_contentLength
uint32_t m_contentLength
" Content length field (in bytes unit).
Definition:
three-gpp-http-header.h:130
ns3::ThreeGppHttpHeader::Print
void Print(std::ostream &os) const override
Definition:
three-gpp-http-header.cc:102
ns3::ThreeGppHttpHeader::m_serverTs
uint64_t m_serverTs
" Server time stamp field (in time step unit).
Definition:
three-gpp-http-header.h:132
ns3::ThreeGppHttpHeader::GetContentType
ContentType_t GetContentType() const
Definition:
three-gpp-http-header.cc:141
ns3::ThreeGppHttpHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
three-gpp-http-header.cc:55
ns3::ThreeGppHttpHeader::GetServerTs
Time GetServerTs() const
Definition:
three-gpp-http-header.cc:196
ns3::ThreeGppHttpHeader::GetContentLength
uint32_t GetContentLength() const
Definition:
three-gpp-http-header.cc:170
ns3::ThreeGppHttpHeader::m_contentType
uint16_t m_contentType
" Content type field in integer format.
Definition:
three-gpp-http-header.h:129
ns3::ThreeGppHttpHeader::GetTypeId
static TypeId GetTypeId()
Returns the object TypeId.
Definition:
three-gpp-http-header.cc:47
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
model
three-gpp-http-header.h
Generated on Tue May 28 2024 23:34:10 for ns-3 by
1.9.6