A Discrete-Event Network Simulator
API
ns3::HttpHeader Class Reference

Header used by web browsing applications to transmit information about content type, content length and timestamps for delay statistics. More...

#include "http-header.h"

+ Inheritance diagram for ns3::HttpHeader:
+ Collaboration diagram for ns3::HttpHeader:

Public Types

enum  ContentType_t {
  NOT_SET = 0 , MAIN_OBJECT = 1 , EMBEDDED_OBJECT = 2 , NOT_SET = 0 ,
  MAIN_OBJECT = 1 , EMBEDDED_OBJECT = 2
}
 The possible types of content (default = NOT_SET). More...
 
enum  ContentType_t {
  NOT_SET = 0 , MAIN_OBJECT = 1 , EMBEDDED_OBJECT = 2 , NOT_SET = 0 ,
  MAIN_OBJECT = 1 , EMBEDDED_OBJECT = 2
}
 The possible types of content (default = NOT_SET). More...
 
enum  HttpMethod {
  DELETE = 0 , GET = 1 , HEAD = 2 , PATCH = 3 ,
  POST = 4 , PUT = 5 , DELETE = 0 , GET = 1 ,
  HEAD = 2 , PATCH = 3 , POST = 4 , PUT = 5
}
 
enum  HttpMethod {
  DELETE = 0 , GET = 1 , HEAD = 2 , PATCH = 3 ,
  POST = 4 , PUT = 5 , DELETE = 0 , GET = 1 ,
  HEAD = 2 , PATCH = 3 , POST = 4 , PUT = 5
}
 
enum  HttpStatus {
  Continue = 100 , SwitchingProtocol = 101 , Processing = 102 , EarlyHints = 103 ,
  Ok = 200 , Created = 201 , Accepted = 202 , NonAuthoritativeInformation = 203 ,
  NoContent = 204 , ResetContent = 205 , PartialContent = 206 , MultiStatus = 207 ,
  AlreadyReported = 208 , ImUsed = 226 , MultipleChoice = 300 , MovedPermanently = 301 ,
  Found = 302 , SeeOther = 303 , NotModified = 304 , UseProxy = 305 ,
  TemporaryRedirect = 307 , PermanentRedirect = 308 , BadRequest = 400 , Unauthorized = 401 ,
  PaymentRequired = 402 , Forbidden = 403 , NotFound = 404 , MethodNotAllowed = 405 ,
  NotAcceptable = 406 , ProxyAuthenticationRequired = 407 , RequestTimeout = 408 , Conflict = 409 ,
  Gone = 410 , LengthRequired = 411 , PreconditionFailed = 412 , PayloadTooLarge = 413 ,
  UriTooLong = 414 , UnsupportedMediaType = 415 , RangeNotSatisfiable = 416 , ExpectationFailed = 417 ,
  ImaTeapot = 418 , MisdirectedRequest = 421 , UnprocessableEntity = 422 , Locked = 423 ,
  FailedDependency = 424 , TooEarly = 425 , UpgradeRequired = 426 , PreconditionRequired = 428 ,
  TooManyRequests = 429 , RequestHeaderFieldsTooLarge = 431 , UnavailableForLegalReasons = 451 , InternalServerError = 500 ,
  NotImplemented = 501 , BadGateway = 502 , ServiceUnavailable = 503 , GatewayTimeout = 504 ,
  HttpVersionNotSupported = 505 , VariantAlsoNegotiates = 506 , InsufficientStorage = 507 , LoopDetected = 508 ,
  NotExtended = 510 , NetworkAuthenticationRequired = 511 , Continue = 100 , SwitchingProtocol = 101 ,
  Processing = 102 , EarlyHints = 103 , Ok = 200 , Created = 201 ,
  Accepted = 202 , NonAuthoritativeInformation = 203 , NoContent = 204 , ResetContent = 205 ,
  PartialContent = 206 , MultiStatus = 207 , AlreadyReported = 208 , ImUsed = 226 ,
  MultipleChoice = 300 , MovedPermanently = 301 , Found = 302 , SeeOther = 303 ,
  NotModified = 304 , UseProxy = 305 , TemporaryRedirect = 307 , PermanentRedirect = 308 ,
  BadRequest = 400 , Unauthorized = 401 , PaymentRequired = 402 , Forbidden = 403 ,
  NotFound = 404 , MethodNotAllowed = 405 , NotAcceptable = 406 , ProxyAuthenticationRequired = 407 ,
  RequestTimeout = 408 , Conflict = 409 , Gone = 410 , LengthRequired = 411 ,
  PreconditionFailed = 412 , PayloadTooLarge = 413 , UriTooLong = 414 , UnsupportedMediaType = 415 ,
  RangeNotSatisfiable = 416 , ExpectationFailed = 417 , ImaTeapot = 418 , MisdirectedRequest = 421 ,
  UnprocessableEntity = 422 , Locked = 423 , FailedDependency = 424 , TooEarly = 425 ,
  UpgradeRequired = 426 , PreconditionRequired = 428 , TooManyRequests = 429 , RequestHeaderFieldsTooLarge = 431 ,
  UnavailableForLegalReasons = 451 , InternalServerError = 500 , NotImplemented = 501 , BadGateway = 502 ,
  ServiceUnavailable = 503 , GatewayTimeout = 504 , HttpVersionNotSupported = 505 , VariantAlsoNegotiates = 506 ,
  InsufficientStorage = 507 , LoopDetected = 508 , NotExtended = 510 , NetworkAuthenticationRequired = 511
}
 
enum  HttpStatus {
  Continue = 100 , SwitchingProtocol = 101 , Processing = 102 , EarlyHints = 103 ,
  Ok = 200 , Created = 201 , Accepted = 202 , NonAuthoritativeInformation = 203 ,
  NoContent = 204 , ResetContent = 205 , PartialContent = 206 , MultiStatus = 207 ,
  AlreadyReported = 208 , ImUsed = 226 , MultipleChoice = 300 , MovedPermanently = 301 ,
  Found = 302 , SeeOther = 303 , NotModified = 304 , UseProxy = 305 ,
  TemporaryRedirect = 307 , PermanentRedirect = 308 , BadRequest = 400 , Unauthorized = 401 ,
  PaymentRequired = 402 , Forbidden = 403 , NotFound = 404 , MethodNotAllowed = 405 ,
  NotAcceptable = 406 , ProxyAuthenticationRequired = 407 , RequestTimeout = 408 , Conflict = 409 ,
  Gone = 410 , LengthRequired = 411 , PreconditionFailed = 412 , PayloadTooLarge = 413 ,
  UriTooLong = 414 , UnsupportedMediaType = 415 , RangeNotSatisfiable = 416 , ExpectationFailed = 417 ,
  ImaTeapot = 418 , MisdirectedRequest = 421 , UnprocessableEntity = 422 , Locked = 423 ,
  FailedDependency = 424 , TooEarly = 425 , UpgradeRequired = 426 , PreconditionRequired = 428 ,
  TooManyRequests = 429 , RequestHeaderFieldsTooLarge = 431 , UnavailableForLegalReasons = 451 , InternalServerError = 500 ,
  NotImplemented = 501 , BadGateway = 502 , ServiceUnavailable = 503 , GatewayTimeout = 504 ,
  HttpVersionNotSupported = 505 , VariantAlsoNegotiates = 506 , InsufficientStorage = 507 , LoopDetected = 508 ,
  NotExtended = 510 , NetworkAuthenticationRequired = 511 , Continue = 100 , SwitchingProtocol = 101 ,
  Processing = 102 , EarlyHints = 103 , Ok = 200 , Created = 201 ,
  Accepted = 202 , NonAuthoritativeInformation = 203 , NoContent = 204 , ResetContent = 205 ,
  PartialContent = 206 , MultiStatus = 207 , AlreadyReported = 208 , ImUsed = 226 ,
  MultipleChoice = 300 , MovedPermanently = 301 , Found = 302 , SeeOther = 303 ,
  NotModified = 304 , UseProxy = 305 , TemporaryRedirect = 307 , PermanentRedirect = 308 ,
  BadRequest = 400 , Unauthorized = 401 , PaymentRequired = 402 , Forbidden = 403 ,
  NotFound = 404 , MethodNotAllowed = 405 , NotAcceptable = 406 , ProxyAuthenticationRequired = 407 ,
  RequestTimeout = 408 , Conflict = 409 , Gone = 410 , LengthRequired = 411 ,
  PreconditionFailed = 412 , PayloadTooLarge = 413 , UriTooLong = 414 , UnsupportedMediaType = 415 ,
  RangeNotSatisfiable = 416 , ExpectationFailed = 417 , ImaTeapot = 418 , MisdirectedRequest = 421 ,
  UnprocessableEntity = 422 , Locked = 423 , FailedDependency = 424 , TooEarly = 425 ,
  UpgradeRequired = 426 , PreconditionRequired = 428 , TooManyRequests = 429 , RequestHeaderFieldsTooLarge = 431 ,
  UnavailableForLegalReasons = 451 , InternalServerError = 500 , NotImplemented = 501 , BadGateway = 502 ,
  ServiceUnavailable = 503 , GatewayTimeout = 504 , HttpVersionNotSupported = 505 , VariantAlsoNegotiates = 506 ,
  InsufficientStorage = 507 , LoopDetected = 508 , NotExtended = 510 , NetworkAuthenticationRequired = 511
}
 

Public Member Functions

 HttpHeader ()
 Creates an empty instance . More...
 
 HttpHeader ()
 Creates an empty instance . More...
 
void CreateRequest (const std::string &url, const std::string &method, const std::map< std::string, std::string > &parameters, const std::vector< std::string > &headers={})
 
void CreateRequest (const std::string &url, const std::string &method, const std::vector< uint8_t > &body, const std::vector< std::string > &headers)
 
void CreateRequest (const std::string &url, const std::string &method="GET", const std::string &body="", const std::vector< std::string > &headers={})
 
void CreateResponse (const HttpHeader::HttpStatus status, const std::map< std::string, std::string > &body, const std::vector< std::string > &headers={})
 
void CreateResponse (const HttpHeader::HttpStatus status, const std::string &body="", const std::vector< std::string > &headers={})
 
void CreateResponse (const HttpHeader::HttpStatus status, const std::vector< uint8_t > &body, const std::vector< std::string > &headers)
 
virtual uint32_t Deserialize (Buffer::Iterator start)
 
virtual uint32_t Deserialize (Buffer::Iterator start)
 
uint32_t GetContentLength () const
 
uint32_t GetContentSize ()
 
ContentType_t GetContentType () const
 
uint32_t GetHeaderSize ()
 
std::string GetHeaderString ()
 
virtual TypeId GetInstanceTypeId () const
 Get the most derived TypeId for this Object. More...
 
virtual TypeId GetInstanceTypeId () const
 Get the most derived TypeId for this Object. More...
 
HttpMethod GetMethod () const
 
HttpMethod GetMethod () const
 
std::vector< uint8_t > GetPayload ()
 
std::string GetPayloadString ()
 
std::string GetRequestUri () const
 
virtual uint32_t GetSerializedSize () const
 
virtual uint32_t GetSerializedSize () const
 
uint32_t GetSize () const
 
uint64_t GetSize (void) const
 Get the size information that the header is carrying. More...
 
HttpStatus GetStatus () const
 
HttpStatus GetStatus () const
 
std::string GetStatusString () const
 
std::string GetUri () const
 
std::string GetUri () const
 
bool IsFragmented ()
 
void ParseResponse ()
 
virtual void Print (std::ostream &os) const
 
virtual void Print (std::ostream &os) const
 
virtual void Serialize (Buffer::Iterator start) const
 
virtual void Serialize (Buffer::Iterator start) const
 
void SetContentLength (uint32_t contentLength)
 
void SetContentType (ContentType_t contentType)
 
void SetHeaderString (std::string input)
 
void SetMethod (const std::string &m)
 
void SetMethod (HttpMethod method)
 
void SetMethod (HttpMethod method)
 
void SetSize (uint64_t size)
 Set the size information that the header will carry. More...
 
void SetStatus (HttpStatus status)
 
void SetStatus (HttpStatus status)
 
void SetUri (const std::string &url)
 
void SetUri (std::string uri)
 
std::string ToString () const
 
std::string ToString () const
 
std::string urlEncode (const std::string &str)
 
- Public Member Functions inherited from ns3::Header
 ~Header () override
 
virtual uint32_t Deserialize (Buffer::Iterator start)=0
 Deserialize the object from a buffer iterator. More...
 
virtual uint32_t Deserialize (Buffer::Iterator start, Buffer::Iterator end)
 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 errors. 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 TypeId GetTypeId ()
 Returns the object TypeId. More...
 
- Static Public Member Functions inherited from ns3::Header
static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Chunk
static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID. More...
 

Private Attributes

std::vector< uint8_t > m_allData
 
uint32_t m_contentLength
 " Content length field (in bytes unit). More...
 
uint16_t m_contentType
 " Content type field in integer format. More...
 
std::string m_domain
 
bool m_fragmented
 
std::vector< std::string > m_headers
 
uint32_t m_headerSize
 
uint16_t m_method
 " Connection method field in integer format. More...
 
std::string m_path
 
std::vector< uint8_t > m_payload
 
std::string m_request_uri
 
std::string m_scheme
 
uint64_t m_size {0}
 The 'size' information that the header is carrying. More...
 
uint16_t m_status
 " Connection status field in integer format. More...
 
std::string m_uri
 
std::vector< std::string > uriParams
 

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 ()
 Notifier called once the ObjectBase is fully constructed. More...
 

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 HttpClient and HttpServer 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 HttpClient, while the server TS field indicates the time when the response packet is sent by the HttpServer.

Definition at line 56 of file http-header.h.

Member Enumeration Documentation

◆ ContentType_t [1/2]

The possible types of content (default = NOT_SET).

Enumerator
NOT_SET 

Integer equivalent = 0.

MAIN_OBJECT 

Integer equivalent = 1.

EMBEDDED_OBJECT 

Integer equivalent = 2.

NOT_SET 

Integer equivalent = 0.

MAIN_OBJECT 

Integer equivalent = 1.

EMBEDDED_OBJECT 

Integer equivalent = 2.

Definition at line 83 of file http-header.h.

◆ ContentType_t [2/2]

The possible types of content (default = NOT_SET).

Enumerator
NOT_SET 

Integer equivalent = 0.

MAIN_OBJECT 

Integer equivalent = 1.

EMBEDDED_OBJECT 

Integer equivalent = 2.

NOT_SET 

Integer equivalent = 0.

MAIN_OBJECT 

Integer equivalent = 1.

EMBEDDED_OBJECT 

Integer equivalent = 2.

Definition at line 62 of file http-header.h.

◆ HttpMethod [1/2]

Enumerator
DELETE 

Http Method Delete.

GET 

Http Method GET.

HEAD 

Http Method Head.

PATCH 

Http Method Patch.

POST 

Http Method Post.

PUT 

Http Method Put.

DELETE 

Http Method Delete.

GET 

Http Method GET.

HEAD 

Http Method Head.

PATCH 

Http Method Patch.

POST 

Http Method Post.

PUT 

Http Method Put.

Definition at line 90 of file http-header.h.

◆ HttpMethod [2/2]

Enumerator
DELETE 

Http Method Delete.

GET 

Http Method GET.

HEAD 

Http Method Head.

PATCH 

Http Method Patch.

POST 

Http Method Post.

PUT 

Http Method Put.

DELETE 

Http Method Delete.

GET 

Http Method GET.

HEAD 

Http Method Head.

PATCH 

Http Method Patch.

POST 

Http Method Post.

PUT 

Http Method Put.

Definition at line 69 of file http-header.h.

◆ HttpStatus [1/2]

Enumerator
Continue 
SwitchingProtocol 
Processing 
EarlyHints 
Ok 
Created 
Accepted 
NonAuthoritativeInformation 
NoContent 
ResetContent 
PartialContent 
MultiStatus 
AlreadyReported 
ImUsed 
MultipleChoice 
MovedPermanently 
Found 
SeeOther 
NotModified 
UseProxy 
TemporaryRedirect 
PermanentRedirect 
BadRequest 
Unauthorized 
PaymentRequired 
Forbidden 
NotFound 
MethodNotAllowed 
NotAcceptable 
ProxyAuthenticationRequired 
RequestTimeout 
Conflict 
Gone 
LengthRequired 
PreconditionFailed 
PayloadTooLarge 
UriTooLong 
UnsupportedMediaType 
RangeNotSatisfiable 
ExpectationFailed 
ImaTeapot 
MisdirectedRequest 
UnprocessableEntity 
Locked 
FailedDependency 
TooEarly 
UpgradeRequired 
PreconditionRequired 
TooManyRequests 
RequestHeaderFieldsTooLarge 
UnavailableForLegalReasons 
InternalServerError 
NotImplemented 
BadGateway 
ServiceUnavailable 
GatewayTimeout 
HttpVersionNotSupported 
VariantAlsoNegotiates 
InsufficientStorage 
LoopDetected 
NotExtended 
NetworkAuthenticationRequired 
Continue 
SwitchingProtocol 
Processing 
EarlyHints 
Ok 
Created 
Accepted 
NonAuthoritativeInformation 
NoContent 
ResetContent 
PartialContent 
MultiStatus 
AlreadyReported 
ImUsed 
MultipleChoice 
MovedPermanently 
Found 
SeeOther 
NotModified 
UseProxy 
TemporaryRedirect 
PermanentRedirect 
BadRequest 
Unauthorized 
PaymentRequired 
Forbidden 
NotFound 
MethodNotAllowed 
NotAcceptable 
ProxyAuthenticationRequired 
RequestTimeout 
Conflict 
Gone 
LengthRequired 
PreconditionFailed 
PayloadTooLarge 
UriTooLong 
UnsupportedMediaType 
RangeNotSatisfiable 
ExpectationFailed 
ImaTeapot 
MisdirectedRequest 
UnprocessableEntity 
Locked 
FailedDependency 
TooEarly 
UpgradeRequired 
PreconditionRequired 
TooManyRequests 
RequestHeaderFieldsTooLarge 
UnavailableForLegalReasons 
InternalServerError 
NotImplemented 
BadGateway 
ServiceUnavailable 
GatewayTimeout 
HttpVersionNotSupported 
VariantAlsoNegotiates 
InsufficientStorage 
LoopDetected 
NotExtended 
NetworkAuthenticationRequired 

Definition at line 99 of file http-header.h.

◆ HttpStatus [2/2]

Enumerator
Continue 
SwitchingProtocol 
Processing 
EarlyHints 
Ok 
Created 
Accepted 
NonAuthoritativeInformation 
NoContent 
ResetContent 
PartialContent 
MultiStatus 
AlreadyReported 
ImUsed 
MultipleChoice 
MovedPermanently 
Found 
SeeOther 
NotModified 
UseProxy 
TemporaryRedirect 
PermanentRedirect 
BadRequest 
Unauthorized 
PaymentRequired 
Forbidden 
NotFound 
MethodNotAllowed 
NotAcceptable 
ProxyAuthenticationRequired 
RequestTimeout 
Conflict 
Gone 
LengthRequired 
PreconditionFailed 
PayloadTooLarge 
UriTooLong 
UnsupportedMediaType 
RangeNotSatisfiable 
ExpectationFailed 
ImaTeapot 
MisdirectedRequest 
UnprocessableEntity 
Locked 
FailedDependency 
TooEarly 
UpgradeRequired 
PreconditionRequired 
TooManyRequests 
RequestHeaderFieldsTooLarge 
UnavailableForLegalReasons 
InternalServerError 
NotImplemented 
BadGateway 
ServiceUnavailable 
GatewayTimeout 
HttpVersionNotSupported 
VariantAlsoNegotiates 
InsufficientStorage 
LoopDetected 
NotExtended 
NetworkAuthenticationRequired 
Continue 
SwitchingProtocol 
Processing 
EarlyHints 
Ok 
Created 
Accepted 
NonAuthoritativeInformation 
NoContent 
ResetContent 
PartialContent 
MultiStatus 
AlreadyReported 
ImUsed 
MultipleChoice 
MovedPermanently 
Found 
SeeOther 
NotModified 
UseProxy 
TemporaryRedirect 
PermanentRedirect 
BadRequest 
Unauthorized 
PaymentRequired 
Forbidden 
NotFound 
MethodNotAllowed 
NotAcceptable 
ProxyAuthenticationRequired 
RequestTimeout 
Conflict 
Gone 
LengthRequired 
PreconditionFailed 
PayloadTooLarge 
UriTooLong 
UnsupportedMediaType 
RangeNotSatisfiable 
ExpectationFailed 
ImaTeapot 
MisdirectedRequest 
UnprocessableEntity 
Locked 
FailedDependency 
TooEarly 
UpgradeRequired 
PreconditionRequired 
TooManyRequests 
RequestHeaderFieldsTooLarge 
UnavailableForLegalReasons 
InternalServerError 
NotImplemented 
BadGateway 
ServiceUnavailable 
GatewayTimeout 
HttpVersionNotSupported 
VariantAlsoNegotiates 
InsufficientStorage 
LoopDetected 
NotExtended 
NetworkAuthenticationRequired 

Definition at line 78 of file http-header.h.

Constructor & Destructor Documentation

◆ HttpHeader() [1/2]

ns3::HttpHeader::HttpHeader ( )

Creates an empty instance .

Definition at line 33 of file http-header.cc.

References NS_LOG_FUNCTION.

◆ HttpHeader() [2/2]

ns3::HttpHeader::HttpHeader ( )

Creates an empty instance .

Member Function Documentation

◆ CreateRequest() [1/3]

void ns3::HttpHeader::CreateRequest ( const std::string &  url,
const std::string &  method,
const std::map< std::string, std::string > &  parameters,
const std::vector< std::string > &  headers = {} 
)

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

References NS_LOG_FUNCTION, and http::urlEncode().

+ Here is the call graph for this function:

◆ CreateRequest() [2/3]

void ns3::HttpHeader::CreateRequest ( const std::string &  url,
const std::string &  method,
const std::vector< uint8_t > &  body,
const std::vector< std::string > &  headers 
)

Definition at line 84 of file http-header.cc.

References NS_LOG_FUNCTION, and nlohmann::to_string().

+ Here is the call graph for this function:

◆ CreateRequest() [3/3]

void ns3::HttpHeader::CreateRequest ( const std::string &  url,
const std::string &  method = "GET",
const std::string &  body = "",
const std::vector< std::string > &  headers = {} 
)

Definition at line 67 of file http-header.cc.

References NS_LOG_FUNCTION.

◆ CreateResponse() [1/3]

void ns3::HttpHeader::CreateResponse ( const HttpHeader::HttpStatus  status,
const std::map< std::string, std::string > &  body,
const std::vector< std::string > &  headers = {} 
)

◆ CreateResponse() [2/3]

void ns3::HttpHeader::CreateResponse ( const HttpHeader::HttpStatus  status,
const std::string &  body = "",
const std::vector< std::string > &  headers = {} 
)

Definition at line 141 of file http-header.cc.

◆ CreateResponse() [3/3]

void ns3::HttpHeader::CreateResponse ( const HttpHeader::HttpStatus  status,
const std::vector< uint8_t > &  body,
const std::vector< std::string > &  headers 
)

Definition at line 154 of file http-header.cc.

References NS_LOG_FUNCTION, and nlohmann::to_string().

+ Here is the call graph for this function:

◆ Deserialize() [1/2]

uint32_t ns3::HttpHeader::Deserialize ( Buffer::Iterator  start)
virtual
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 91 of file http-header.cc.

References ns3::Buffer::Iterator::GetDistanceFrom(), GetSerializedSize(), m_contentLength, m_contentType, m_method, m_size, m_status, m_uri, NS_ASSERT, NS_LOG_FUNCTION, ns3::Buffer::Iterator::Read(), ns3::Buffer::Iterator::ReadU16(), ns3::Buffer::Iterator::ReadU32(), ns3::Buffer::Iterator::ReadU64(), and two-ray-to-three-gpp-ch-calibration::start.

+ Here is the call graph for this function:

◆ Deserialize() [2/2]

virtual uint32_t ns3::HttpHeader::Deserialize ( Buffer::Iterator  start)
virtual
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.

◆ GetContentLength()

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

Definition at line 192 of file http-header.cc.

References m_contentLength.

◆ GetContentSize()

uint32_t ns3::HttpHeader::GetContentSize ( )

Definition at line 581 of file http-header.cc.

References NS_LOG_FUNCTION.

◆ GetContentType()

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

Definition at line 162 of file http-header.cc.

References EMBEDDED_OBJECT, m_contentType, MAIN_OBJECT, NOT_SET, and NS_FATAL_ERROR.

◆ GetHeaderSize()

uint32_t ns3::HttpHeader::GetHeaderSize ( )

Definition at line 576 of file http-header.cc.

◆ GetHeaderString()

std::string ns3::HttpHeader::GetHeaderString ( )

Definition at line 410 of file http-header.cc.

References NS_LOG_FUNCTION.

◆ GetInstanceTypeId() [1/2]

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

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

Implements ns3::ObjectBase.

Definition at line 54 of file http-header.cc.

References GetTypeId().

+ Here is the call graph for this function:

◆ GetInstanceTypeId() [2/2]

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

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

Implements ns3::ObjectBase.

◆ GetMethod() [1/2]

HttpHeader::HttpMethod ns3::HttpHeader::GetMethod ( ) const
Returns
The connection method.

Definition at line 649 of file http-header.cc.

References DELETE, GET, HEAD, m_method, NS_FATAL_ERROR, PATCH, POST, and PUT.

◆ GetMethod() [2/2]

HttpMethod ns3::HttpHeader::GetMethod ( ) const
Returns
The connection method.

◆ GetPayload()

std::vector<uint8_t> ns3::HttpHeader::GetPayload ( )
inline

Definition at line 210 of file http-header.h.

References m_payload.

◆ GetPayloadString()

std::string ns3::HttpHeader::GetPayloadString ( )
inline

Definition at line 214 of file http-header.h.

References m_headers, m_payload, and ParseResponse().

+ Here is the call graph for this function:

◆ GetRequestUri()

std::string ns3::HttpHeader::GetRequestUri ( ) const
Returns
The request uri value

Definition at line 1282 of file http-header.cc.

◆ GetSerializedSize() [1/2]

uint32_t ns3::HttpHeader::GetSerializedSize ( ) const
virtual
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 60 of file http-header.cc.

References m_contentLength.

Referenced by Deserialize().

+ Here is the caller graph for this function:

◆ GetSerializedSize() [2/2]

virtual uint32_t ns3::HttpHeader::GetSerializedSize ( ) const
virtual
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.

◆ GetSize() [1/2]

uint32_t ns3::HttpHeader::GetSize ( ) const
Returns
The content length (in bytes).

◆ GetSize() [2/2]

uint32_t ns3::HttpHeader::GetSize ( void  ) const

Get the size information that the header is carrying.

Returns
the size

Definition at line 205 of file http-header.cc.

References m_size.

◆ GetStatus() [1/2]

◆ GetStatus() [2/2]

HttpStatus ns3::HttpHeader::GetStatus ( ) const
Returns
The connection status.

◆ GetStatusString()

std::string ns3::HttpHeader::GetStatusString ( ) const

Definition at line 999 of file http-header.cc.

References NS_FATAL_ERROR.

◆ GetTypeId() [1/2]

TypeId ns3::HttpHeader::GetTypeId ( void  )
static

Returns the object TypeId.

Returns
The object TypeId.

Definition at line 44 of file 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:

◆ GetTypeId() [2/2]

static TypeId ns3::HttpHeader::GetTypeId ( )
static

Returns the object TypeId.

Returns
The object TypeId.

◆ GetUri() [1/2]

std::string ns3::HttpHeader::GetUri ( ) const
Returns
The the uri.

Definition at line 681 of file http-header.cc.

References m_uri.

◆ GetUri() [2/2]

std::string ns3::HttpHeader::GetUri ( ) const
Returns
The uri value

◆ IsFragmented()

bool ns3::HttpHeader::IsFragmented ( )
inline

Definition at line 275 of file http-header.h.

References m_fragmented.

◆ ParseResponse()

void ns3::HttpHeader::ParseResponse ( )

Definition at line 204 of file http-header.cc.

References min, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by GetPayloadString().

+ Here is the caller graph for this function:

◆ Print() [1/2]

void ns3::HttpHeader::Print ( std::ostream &  os) const
virtual
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 121 of file http-header.cc.

References m_contentLength, m_contentType, m_method, m_status, m_uri, and NS_LOG_FUNCTION.

Referenced by ToString().

+ Here is the caller graph for this function:

◆ Print() [2/2]

virtual void ns3::HttpHeader::Print ( std::ostream &  os) const
virtual
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.

◆ Serialize() [1/2]

void ns3::HttpHeader::Serialize ( Buffer::Iterator  start) const
virtual
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 69 of file http-header.cc.

References m_contentLength, m_contentType, m_method, m_size, m_status, m_uri, NS_LOG_FUNCTION, and two-ray-to-three-gpp-ch-calibration::start.

◆ Serialize() [2/2]

virtual void ns3::HttpHeader::Serialize ( Buffer::Iterator  start) const
virtual
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.

◆ SetContentLength()

void ns3::HttpHeader::SetContentLength ( uint32_t  contentLength)
Parameters
contentLengthThe content length (in bytes).

Definition at line 184 of file http-header.cc.

References m_contentLength, and NS_LOG_FUNCTION.

Referenced by SetUri().

+ Here is the caller graph for this function:

◆ SetContentType()

void ns3::HttpHeader::SetContentType ( HttpHeader::ContentType_t  contentType)
Parameters
contentTypeThe content type.

Definition at line 141 of file http-header.cc.

References EMBEDDED_OBJECT, m_contentType, MAIN_OBJECT, NOT_SET, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

◆ SetHeaderString()

void ns3::HttpHeader::SetHeaderString ( std::string  input)

Definition at line 421 of file http-header.cc.

References NS_LOG_FUNCTION.

◆ SetMethod() [1/3]

void ns3::HttpHeader::SetMethod ( const std::string &  m)

◆ SetMethod() [2/3]

void ns3::HttpHeader::SetMethod ( HttpHeader::HttpMethod  method)
Parameters
methodThe connection method.

Definition at line 617 of file http-header.cc.

References DELETE, GET, HEAD, m_method, NS_FATAL_ERROR, NS_LOG_FUNCTION, PATCH, POST, and PUT.

◆ SetMethod() [3/3]

void ns3::HttpHeader::SetMethod ( HttpMethod  method)
Parameters
methodThe connection method.

◆ SetSize()

void ns3::HttpHeader::SetSize ( uint64_t  size)

Set the size information that the header will carry.

Parameters
sizethe size

Definition at line 199 of file http-header.cc.

References m_size.

◆ SetStatus() [1/2]

◆ SetStatus() [2/2]

void ns3::HttpHeader::SetStatus ( HttpStatus  status)
Parameters
statusThe connection status.

◆ SetUri() [1/2]

void ns3::HttpHeader::SetUri ( const std::string &  url)
Parameters
std::stringThe uri.

Definition at line 1287 of file http-header.cc.

References NS_LOG_FUNCTION.

◆ SetUri() [2/2]

void ns3::HttpHeader::SetUri ( std::string  uri)
Parameters
std::stringThe uri.

Definition at line 687 of file http-header.cc.

References m_uri, NS_LOG_FUNCTION, and SetContentLength().

+ Here is the call graph for this function:

◆ ToString() [1/2]

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

Definition at line 132 of file http-header.cc.

References NS_LOG_FUNCTION, and Print().

+ Here is the call graph for this function:

◆ ToString() [2/2]

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

◆ urlEncode()

std::string ns3::HttpHeader::urlEncode ( const std::string &  str)

Definition at line 1229 of file http-header.cc.

Member Data Documentation

◆ m_allData

std::vector<uint8_t> ns3::HttpHeader::m_allData
private

Definition at line 287 of file http-header.h.

◆ m_contentLength

uint32_t ns3::HttpHeader::m_contentLength
private

" Content length field (in bytes unit).

Definition at line 235 of file http-header.h.

Referenced by Deserialize(), GetContentLength(), GetSerializedSize(), Print(), Serialize(), and SetContentLength().

◆ m_contentType

uint16_t ns3::HttpHeader::m_contentType
private

" Content type field in integer format.

Definition at line 234 of file http-header.h.

Referenced by Deserialize(), GetContentType(), Print(), Serialize(), and SetContentType().

◆ m_domain

std::string ns3::HttpHeader::m_domain
private

Definition at line 282 of file http-header.h.

◆ m_fragmented

bool ns3::HttpHeader::m_fragmented
private

Definition at line 295 of file http-header.h.

Referenced by IsFragmented().

◆ m_headers

std::vector<std::string> ns3::HttpHeader::m_headers
private

Definition at line 285 of file http-header.h.

Referenced by GetPayloadString().

◆ m_headerSize

uint32_t ns3::HttpHeader::m_headerSize
private

Definition at line 293 of file http-header.h.

◆ m_method

uint16_t ns3::HttpHeader::m_method
private

" Connection method field in integer format.

Definition at line 232 of file http-header.h.

Referenced by Deserialize(), GetMethod(), Print(), Serialize(), and SetMethod().

◆ m_path

std::string ns3::HttpHeader::m_path
private

Definition at line 283 of file http-header.h.

◆ m_payload

std::vector<uint8_t> ns3::HttpHeader::m_payload
private

Definition at line 286 of file http-header.h.

Referenced by GetPayload(), and GetPayloadString().

◆ m_request_uri

std::string ns3::HttpHeader::m_request_uri
private

Definition at line 298 of file http-header.h.

◆ m_scheme

std::string ns3::HttpHeader::m_scheme
private

Definition at line 281 of file http-header.h.

◆ m_size

uint64_t ns3::HttpHeader::m_size {0}
private

The 'size' information that the header is carrying.

Definition at line 236 of file http-header.h.

Referenced by Deserialize(), GetSize(), Serialize(), and SetSize().

◆ m_status

uint16_t ns3::HttpHeader::m_status
private

" Connection status field in integer format.

Definition at line 233 of file http-header.h.

Referenced by Deserialize(), GetStatus(), Print(), Serialize(), and SetStatus().

◆ m_uri

std::string ns3::HttpHeader::m_uri
private

Definition at line 237 of file http-header.h.

Referenced by Deserialize(), GetUri(), Print(), Serialize(), and SetUri().

◆ uriParams

std::vector<std::string> ns3::HttpHeader::uriParams
private

Definition at line 238 of file http-header.h.


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