Header used by web browsing applications to transmit information about content type, content length and timestamps for delay statistics. More...
#include "three-gpp-http-header.h"
Public Types | |
enum | ContentType_t { NOT_SET , MAIN_OBJECT , EMBEDDED_OBJECT } |
The possible types of content (default = NOT_SET). More... | |
Public Member Functions | |
ThreeGppHttpHeader () | |
Creates an empty instance. | |
uint32_t | Deserialize (Buffer::Iterator start) override |
Time | GetClientTs () const |
uint32_t | GetContentLength () const |
ContentType_t | GetContentType () const |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
uint32_t | GetSerializedSize () const override |
Time | GetServerTs () const |
void | Print (std::ostream &os) const override |
void | Serialize (Buffer::Iterator start) const override |
void | SetClientTs (Time clientTs) |
void | SetContentLength (uint32_t contentLength) |
void | SetContentType (ContentType_t contentType) |
void | SetServerTs (Time serverTs) |
std::string | ToString () const |
Public Member Functions inherited from ns3::Header | |
~Header () override | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Returns the object TypeId. | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Attributes | |
uint64_t | m_clientTs |
" Client time stamp field (in time step unit). | |
uint32_t | m_contentLength |
" Content length field (in bytes unit). | |
uint16_t | m_contentType |
" Content type field in integer format. | |
uint64_t | m_serverTs |
" Server time stamp field (in time step unit). | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Header used by web browsing applications to transmit information about content type, content length and timestamps for delay statistics.
The header contains the following fields (and their respective size when serialized):
The header is attached to every packet transmitted by ThreeGppHttpClient and ThreeGppHttpServer applications. In received, split packets, only the first packet of transmitted object contains the header, which helps to identify how many bytes are left to be received.
The last 2 fields allow the applications to compute the propagation delay of each packet. The client TS field indicates the time when the request packet is sent by the ThreeGppHttpClient, while the server TS field indicates the time when the response packet is sent by the ThreeGppHttpServer.
Definition at line 43 of file three-gpp-http-header.h.
The possible types of content (default = NOT_SET).
Enumerator | |
---|---|
NOT_SET | Integer equivalent = 0. |
MAIN_OBJECT | Integer equivalent = 1. |
EMBEDDED_OBJECT | Integer equivalent = 2. |
Definition at line 70 of file three-gpp-http-header.h.
ns3::ThreeGppHttpHeader::ThreeGppHttpHeader | ( | ) |
Creates an empty instance.
Definition at line 24 of file three-gpp-http-header.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
start | an iterator which points to where the header should read from. |
This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.
Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.
Implements ns3::Header.
Definition at line 66 of file three-gpp-http-header.cc.
References m_clientTs, m_contentLength, m_contentType, m_serverTs, and NS_LOG_FUNCTION.
Time ns3::ThreeGppHttpHeader::GetClientTs | ( | ) | const |
Definition at line 172 of file three-gpp-http-header.cc.
References m_clientTs.
Referenced by ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), ns3::ThreeGppHttpClient::Receive(), ns3::ThreeGppHttpServer::ReceivedDataCallback(), ns3::ThreeGppHttpServer::ServeFromTxBuffer(), and ThreeGppHttpObjectTestCase::ServerRxCallback().
uint32_t ns3::ThreeGppHttpHeader::GetContentLength | ( | ) | const |
Definition at line 159 of file three-gpp-http-header.cc.
References m_contentLength.
Referenced by ClientEmbeddedObjectReceived(), ClientMainObjectReceived(), ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), and ns3::ThreeGppHttpClient::Receive().
ThreeGppHttpHeader::ContentType_t ns3::ThreeGppHttpHeader::GetContentType | ( | ) | const |
Definition at line 130 of file three-gpp-http-header.cc.
References EMBEDDED_OBJECT, m_contentType, MAIN_OBJECT, NOT_SET, and NS_FATAL_ERROR.
Referenced by ClientEmbeddedObjectReceived(), ClientMainObjectReceived(), ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), and ns3::ThreeGppHttpServer::ReceivedDataCallback().
|
overridevirtual |
Get the most derived TypeId for this Object.
This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.
Implements ns3::ObjectBase.
Definition at line 44 of file three-gpp-http-header.cc.
References GetTypeId().
|
overridevirtual |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.
Implements ns3::Header.
Definition at line 50 of file three-gpp-http-header.cc.
Referenced by ns3::ThreeGppHttpServer::ServeFromTxBuffer().
Time ns3::ThreeGppHttpHeader::GetServerTs | ( | ) | const |
Definition at line 185 of file three-gpp-http-header.cc.
References m_serverTs.
Referenced by ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), and ns3::ThreeGppHttpClient::Receive().
|
static |
Returns the object TypeId.
Definition at line 36 of file three-gpp-http-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
overridevirtual |
os | output stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5 |
Implements ns3::Header.
Definition at line 91 of file three-gpp-http-header.cc.
References m_clientTs, m_contentLength, m_contentType, m_serverTs, NS_LOG_FUNCTION, and ns3::Time::S.
Referenced by ToString().
|
overridevirtual |
start | an iterator which points to where the header should be written. |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.
Implements ns3::Header.
Definition at line 56 of file three-gpp-http-header.cc.
References m_clientTs, m_contentLength, m_contentType, m_serverTs, and NS_LOG_FUNCTION.
void ns3::ThreeGppHttpHeader::SetClientTs | ( | Time | clientTs | ) |
clientTs | The client time stamp. |
Definition at line 165 of file three-gpp-http-header.cc.
References ns3::Time::As(), ns3::Time::GetTimeStep(), m_clientTs, NS_LOG_FUNCTION, and ns3::Time::S.
Referenced by ns3::ThreeGppHttpClient::RequestEmbeddedObject(), ns3::ThreeGppHttpClient::RequestMainObject(), and ns3::ThreeGppHttpServer::ServeFromTxBuffer().
void ns3::ThreeGppHttpHeader::SetContentLength | ( | uint32_t | contentLength | ) |
contentLength | The content length (in bytes). |
Definition at line 152 of file three-gpp-http-header.cc.
References m_contentLength, and NS_LOG_FUNCTION.
Referenced by ns3::ThreeGppHttpClient::RequestEmbeddedObject(), ns3::ThreeGppHttpClient::RequestMainObject(), and ns3::ThreeGppHttpServer::ServeFromTxBuffer().
void ns3::ThreeGppHttpHeader::SetContentType | ( | ThreeGppHttpHeader::ContentType_t | contentType | ) |
contentType | The content type. |
Definition at line 109 of file three-gpp-http-header.cc.
References EMBEDDED_OBJECT, m_contentType, MAIN_OBJECT, NOT_SET, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ns3::ThreeGppHttpClient::RequestEmbeddedObject(), ns3::ThreeGppHttpClient::RequestMainObject(), and ns3::ThreeGppHttpServer::ServeFromTxBuffer().
void ns3::ThreeGppHttpHeader::SetServerTs | ( | Time | serverTs | ) |
serverTs | The server time stamp. |
Definition at line 178 of file three-gpp-http-header.cc.
References ns3::Time::As(), ns3::Time::GetTimeStep(), m_serverTs, NS_LOG_FUNCTION, and ns3::Time::S.
Referenced by ns3::ThreeGppHttpServer::ServeFromTxBuffer().
std::string ns3::ThreeGppHttpHeader::ToString | ( | ) | const |
Definition at line 100 of file three-gpp-http-header.cc.
References NS_LOG_FUNCTION, and Print().
|
private |
" Client time stamp field (in time step unit).
Definition at line 120 of file three-gpp-http-header.h.
Referenced by Deserialize(), GetClientTs(), Print(), Serialize(), and SetClientTs().
|
private |
" Content length field (in bytes unit).
Definition at line 119 of file three-gpp-http-header.h.
Referenced by Deserialize(), GetContentLength(), Print(), Serialize(), and SetContentLength().
|
private |
" Content type field in integer format.
Definition at line 118 of file three-gpp-http-header.h.
Referenced by Deserialize(), GetContentType(), Print(), Serialize(), and SetContentType().
|
private |
" Server time stamp field (in time step unit).
Definition at line 121 of file three-gpp-http-header.h.
Referenced by Deserialize(), GetServerTs(), Print(), Serialize(), and SetServerTs().