A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::ThreeGppHttpHeader Class Reference

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"

+ Inheritance diagram for ns3::ThreeGppHttpHeader:
+ Collaboration diagram for ns3::ThreeGppHttpHeader:

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.
 

Detailed Description

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):

  • content type (2 bytes);
  • content length (4 bytes);
  • client time stamp (8 bytes); and
  • server time stamp (8 bytes).

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.

Member Enumeration Documentation

◆ ContentType_t

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.

Constructor & Destructor Documentation

◆ ThreeGppHttpHeader()

ns3::ThreeGppHttpHeader::ThreeGppHttpHeader ( )

Creates an empty instance.

Definition at line 24 of file three-gpp-http-header.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ Deserialize()

uint32_t ns3::ThreeGppHttpHeader::Deserialize ( Buffer::Iterator start)
overridevirtual
Parameters
startan iterator which points to where the header should read from.
Returns
the number of bytes read.

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.

◆ GetClientTs()

Time ns3::ThreeGppHttpHeader::GetClientTs ( ) const
Returns
The client time stamp.

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().

+ Here is the caller graph for this function:

◆ GetContentLength()

uint32_t ns3::ThreeGppHttpHeader::GetContentLength ( ) const
Returns
The content length (in bytes).

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().

+ Here is the caller graph for this function:

◆ GetContentType()

ThreeGppHttpHeader::ContentType_t ns3::ThreeGppHttpHeader::GetContentType ( ) const
Returns
The content type.

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().

+ Here is the caller graph for this function:

◆ GetInstanceTypeId()

TypeId ns3::ThreeGppHttpHeader::GetInstanceTypeId ( ) const
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.

Returns
The TypeId associated to the most-derived type of this instance.

Implements ns3::ObjectBase.

Definition at line 44 of file three-gpp-http-header.cc.

References GetTypeId().

+ Here is the call graph for this function:

◆ GetSerializedSize()

uint32_t ns3::ThreeGppHttpHeader::GetSerializedSize ( ) const
overridevirtual
Returns
the expected size of the header.

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().

+ Here is the caller graph for this function:

◆ GetServerTs()

Time ns3::ThreeGppHttpHeader::GetServerTs ( ) const
Returns
The server time stamp.

Definition at line 185 of file three-gpp-http-header.cc.

References m_serverTs.

Referenced by ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), and ns3::ThreeGppHttpClient::Receive().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::ThreeGppHttpHeader::GetTypeId ( )
static

Returns the object TypeId.

Returns
The object TypeId.

Definition at line 36 of file three-gpp-http-header.cc.

References ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Print()

void ns3::ThreeGppHttpHeader::Print ( std::ostream & os) const
overridevirtual
Parameters
osoutput 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().

+ Here is the caller graph for this function:

◆ Serialize()

void ns3::ThreeGppHttpHeader::Serialize ( Buffer::Iterator start) const
overridevirtual
Parameters
startan 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.

◆ SetClientTs()

void ns3::ThreeGppHttpHeader::SetClientTs ( Time clientTs)
Parameters
clientTsThe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetContentLength()

void ns3::ThreeGppHttpHeader::SetContentLength ( uint32_t contentLength)
Parameters
contentLengthThe 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().

+ Here is the caller graph for this function:

◆ SetContentType()

void ns3::ThreeGppHttpHeader::SetContentType ( ThreeGppHttpHeader::ContentType_t contentType)
Parameters
contentTypeThe 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().

+ Here is the caller graph for this function:

◆ SetServerTs()

void ns3::ThreeGppHttpHeader::SetServerTs ( Time serverTs)
Parameters
serverTsThe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToString()

std::string ns3::ThreeGppHttpHeader::ToString ( ) const
Returns
The string representation of the header.

Definition at line 100 of file three-gpp-http-header.cc.

References NS_LOG_FUNCTION, and Print().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_clientTs

uint64_t ns3::ThreeGppHttpHeader::m_clientTs
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().

◆ m_contentLength

uint32_t ns3::ThreeGppHttpHeader::m_contentLength
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().

◆ m_contentType

uint16_t ns3::ThreeGppHttpHeader::m_contentType
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().

◆ m_serverTs

uint64_t ns3::ThreeGppHttpHeader::m_serverTs
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().


The documentation for this class was generated from the following files: