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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Budiarto Herman <budiarto.herman@magister.fi>
7
*
8
*/
9
10
#ifndef THREE_GPP_HTTP_HEADER_H
11
#define THREE_GPP_HTTP_HEADER_H
12
13
#include <ns3/header.h>
14
#include <ns3/nstime.h>
15
16
namespace
ns3
17
{
18
19
class
Packet;
20
21
/**
22
* @ingroup http
23
* @brief Header used by web browsing applications to transmit information about
24
* content type, content length and timestamps for delay statistics.
25
*
26
* The header contains the following fields (and their respective size when
27
* serialized):
28
* - content type (2 bytes);
29
* - content length (4 bytes);
30
* - client time stamp (8 bytes); and
31
* - server time stamp (8 bytes).
32
*
33
* The header is attached to every packet transmitted by ThreeGppHttpClient and
34
* ThreeGppHttpServer applications. In received, split packets, only the first packet
35
* of transmitted object contains the header, which helps to identify how many bytes are
36
* left to be received.
37
*
38
* The last 2 fields allow the applications to compute the propagation delay of
39
* each packet. The *client TS* field indicates the time when the request
40
* packet is sent by the ThreeGppHttpClient, while the *server TS* field indicates the
41
* time when the response packet is sent by the ThreeGppHttpServer.
42
*/
43
class
ThreeGppHttpHeader
:
public
Header
44
{
45
public
:
46
/// Creates an empty instance.
47
ThreeGppHttpHeader
();
48
49
/**
50
* Returns the object TypeId.
51
* @return The object TypeId.
52
*/
53
static
TypeId
GetTypeId
();
54
55
// Inherited from ObjectBase base class.
56
TypeId
GetInstanceTypeId
()
const override
;
57
58
// Inherited from Header base class.
59
uint32_t
GetSerializedSize
()
const override
;
60
void
Serialize
(
Buffer::Iterator
start)
const override
;
61
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
62
void
Print
(std::ostream& os)
const override
;
63
64
/**
65
* @return The string representation of the header.
66
*/
67
std::string
ToString
()
const
;
68
69
/// The possible types of content (default = NOT_SET).
70
enum
ContentType_t
71
{
72
NOT_SET
,
///< Integer equivalent = 0.
73
MAIN_OBJECT
,
///< Integer equivalent = 1.
74
EMBEDDED_OBJECT
///< Integer equivalent = 2.
75
};
76
77
/**
78
* @param contentType The content type.
79
*/
80
void
SetContentType
(ContentType_t contentType);
81
82
/**
83
* @return The content type.
84
*/
85
ContentType_t
GetContentType
()
const
;
86
87
/**
88
* @param contentLength The content length (in bytes).
89
*/
90
void
SetContentLength
(
uint32_t
contentLength);
91
92
/**
93
* @return The content length (in bytes).
94
*/
95
uint32_t
GetContentLength
()
const
;
96
97
/**
98
* @param clientTs The client time stamp.
99
*/
100
void
SetClientTs
(
Time
clientTs);
101
102
/**
103
* @return The client time stamp.
104
*/
105
Time
GetClientTs
()
const
;
106
107
/**
108
* @param serverTs The server time stamp.
109
*/
110
void
SetServerTs
(
Time
serverTs);
111
112
/**
113
* @return The server time stamp.
114
*/
115
Time
GetServerTs
()
const
;
116
117
private
:
118
uint16_t
m_contentType
;
//!<" Content type field in integer format.
119
uint32_t
m_contentLength
;
//!<" Content length field (in bytes unit).
120
uint64_t
m_clientTs
;
//!<" Client time stamp field (in time step unit).
121
uint64_t
m_serverTs
;
//!<" Server time stamp field (in time step unit).
122
123
};
// end of `class ThreeGppHttpHeader`
124
125
}
// namespace ns3
126
127
#endif
/* THREE_GPP_HTTP_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::ThreeGppHttpHeader
Header used by web browsing applications to transmit information about content type,...
Definition
three-gpp-http-header.h:44
ns3::ThreeGppHttpHeader::SetClientTs
void SetClientTs(Time clientTs)
Definition
three-gpp-http-header.cc:165
ns3::ThreeGppHttpHeader::ToString
std::string ToString() const
Definition
three-gpp-http-header.cc:100
ns3::ThreeGppHttpHeader::SetServerTs
void SetServerTs(Time serverTs)
Definition
three-gpp-http-header.cc:178
ns3::ThreeGppHttpHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
three-gpp-http-header.cc:50
ns3::ThreeGppHttpHeader::GetClientTs
Time GetClientTs() const
Definition
three-gpp-http-header.cc:172
ns3::ThreeGppHttpHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
three-gpp-http-header.cc:66
ns3::ThreeGppHttpHeader::SetContentLength
void SetContentLength(uint32_t contentLength)
Definition
three-gpp-http-header.cc:152
ns3::ThreeGppHttpHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
three-gpp-http-header.cc:56
ns3::ThreeGppHttpHeader::SetContentType
void SetContentType(ContentType_t contentType)
Definition
three-gpp-http-header.cc:109
ns3::ThreeGppHttpHeader::ContentType_t
ContentType_t
The possible types of content (default = NOT_SET).
Definition
three-gpp-http-header.h:71
ns3::ThreeGppHttpHeader::NOT_SET
@ NOT_SET
Integer equivalent = 0.
Definition
three-gpp-http-header.h:72
ns3::ThreeGppHttpHeader::EMBEDDED_OBJECT
@ EMBEDDED_OBJECT
Integer equivalent = 2.
Definition
three-gpp-http-header.h:74
ns3::ThreeGppHttpHeader::MAIN_OBJECT
@ MAIN_OBJECT
Integer equivalent = 1.
Definition
three-gpp-http-header.h:73
ns3::ThreeGppHttpHeader::ThreeGppHttpHeader
ThreeGppHttpHeader()
Creates an empty instance.
Definition
three-gpp-http-header.cc:24
ns3::ThreeGppHttpHeader::m_clientTs
uint64_t m_clientTs
" Client time stamp field (in time step unit).
Definition
three-gpp-http-header.h:120
ns3::ThreeGppHttpHeader::m_contentLength
uint32_t m_contentLength
" Content length field (in bytes unit).
Definition
three-gpp-http-header.h:119
ns3::ThreeGppHttpHeader::Print
void Print(std::ostream &os) const override
Definition
three-gpp-http-header.cc:91
ns3::ThreeGppHttpHeader::m_serverTs
uint64_t m_serverTs
" Server time stamp field (in time step unit).
Definition
three-gpp-http-header.h:121
ns3::ThreeGppHttpHeader::GetContentType
ContentType_t GetContentType() const
Definition
three-gpp-http-header.cc:130
ns3::ThreeGppHttpHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
three-gpp-http-header.cc:44
ns3::ThreeGppHttpHeader::GetServerTs
Time GetServerTs() const
Definition
three-gpp-http-header.cc:185
ns3::ThreeGppHttpHeader::GetContentLength
uint32_t GetContentLength() const
Definition
three-gpp-http-header.cc:159
ns3::ThreeGppHttpHeader::m_contentType
uint16_t m_contentType
" Content type field in integer format.
Definition
three-gpp-http-header.h:118
ns3::ThreeGppHttpHeader::GetTypeId
static TypeId GetTypeId()
Returns the object TypeId.
Definition
three-gpp-http-header.cc:36
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
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 Fri Dec 13 2024 18:20:37 for ns-3 by
1.11.0