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 . More... | |
virtual uint32_t | Deserialize (Buffer::Iterator start) |
Time | GetClientTs () const |
uint32_t | GetContentLength () const |
ContentType_t | GetContentType () const |
virtual TypeId | GetInstanceTypeId () const |
Get the most derived TypeId for this Object. More... | |
virtual uint32_t | GetSerializedSize () const |
Time | GetServerTs () const |
virtual void | Print (std::ostream &os) const |
virtual void | Serialize (Buffer::Iterator start) const |
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 | |
virtual | ~Header () |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
virtual uint32_t | Deserialize (Buffer::Iterator start)=0 |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::Chunk | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Returns the object TypeId. More... | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Attributes | |
uint64_t | m_clientTs |
" Client time stamp field (in time step unit). More... | |
uint32_t | m_contentLength |
" Content length field (in bytes unit). More... | |
uint16_t | m_contentType |
" Content type field in integer format. More... | |
uint64_t | m_serverTs |
" Server time stamp field (in time step unit). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Header used by web browsing applications to transmit information about content type, content length and timestamps for delay statistics.
Introspection did not find any typical Config paths.
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.
No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 32 bytes (on a 64-bit architecture).
Definition at line 55 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 82 of file three-gpp-http-header.h.
ns3::ThreeGppHttpHeader::ThreeGppHttpHeader | ( | ) |
Creates an empty instance .
Definition at line 33 of file three-gpp-http-header.cc.
References NS_LOG_FUNCTION.
|
virtual |
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 82 of file three-gpp-http-header.cc.
References m_clientTs, m_contentLength, m_contentType, m_serverTs, NS_LOG_FUNCTION, and visualizer.core::start().
Time ns3::ThreeGppHttpHeader::GetClientTs | ( | ) | const |
Definition at line 197 of file three-gpp-http-header.cc.
References m_clientTs, and ns3::TimeStep().
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 182 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 151 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().
|
virtual |
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 57 of file three-gpp-http-header.cc.
References GetTypeId().
|
virtual |
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 64 of file three-gpp-http-header.cc.
Referenced by ns3::ThreeGppHttpServer::ServeFromTxBuffer().
Time ns3::ThreeGppHttpHeader::GetServerTs | ( | ) | const |
Definition at line 212 of file three-gpp-http-header.cc.
References m_serverTs, and ns3::TimeStep().
Referenced by ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), and ns3::ThreeGppHttpClient::Receive().
|
static |
Returns the object TypeId.
Definition at line 46 of file three-gpp-http-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
virtual |
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 108 of file three-gpp-http-header.cc.
References ns3::Time::GetSeconds(), m_clientTs, m_contentLength, m_contentType, m_serverTs, NS_LOG_FUNCTION, and ns3::TimeStep().
Referenced by ToString().
|
virtual |
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 71 of file three-gpp-http-header.cc.
References m_clientTs, m_contentLength, m_contentType, m_serverTs, NS_LOG_FUNCTION, and visualizer.core::start().
void ns3::ThreeGppHttpHeader::SetClientTs | ( | Time | clientTs | ) |
clientTs | The client time stamp. |
Definition at line 189 of file three-gpp-http-header.cc.
References ns3::Time::GetSeconds(), ns3::Time::GetTimeStep(), m_clientTs, and NS_LOG_FUNCTION.
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 174 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 129 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 204 of file three-gpp-http-header.cc.
References ns3::Time::GetSeconds(), ns3::Time::GetTimeStep(), m_serverTs, and NS_LOG_FUNCTION.
Referenced by ns3::ThreeGppHttpServer::ServeFromTxBuffer().
std::string ns3::ThreeGppHttpHeader::ToString | ( | ) | const |
Definition at line 119 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 132 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 131 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 130 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 133 of file three-gpp-http-header.h.
Referenced by Deserialize(), GetServerTs(), Print(), Serialize(), and SetServerTs().