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

A basic class to parse a HTTP message, both request and response. More...

#include "http.h"

Public Member Functions

void Parse (HTTPMessage *httpMessage, const std::string &buffer)
 Parse a std::string to a HTTP message. More...
 
void Parse (HTTPMessage *httpMessage, const std::vector< uint8_t > &buffer)
 Parse a binary vector to an HTTP message. More...
 
void stripUnicode (std::string &str)
 

Static Public Member Functions

static bool invalidChar (char c)
 

Detailed Description

A basic class to parse a HTTP message, both request and response.

Allows for either string data to be passed in, or for a vector of unsigned 8-bit integers to be passed in.

Requires that a whole message be sent in for parsing.

Definition at line 940 of file http.h.

Member Function Documentation

◆ invalidChar()

static bool ns3::HTTPMessageParser::invalidChar ( char  c)
inlinestatic

Definition at line 1183 of file http.h.

Referenced by stripUnicode().

+ Here is the caller graph for this function:

◆ Parse() [1/2]

void ns3::HTTPMessageParser::Parse ( HTTPMessage httpMessage,
const std::string &  buffer 
)
inline

Parse a std::string to a HTTP message.

Pass in a pointer to an HTTPMessage which is then written to for headers and other message data.

note: this must be a complete HTTP message

Definition at line 951 of file http.h.

References stripUnicode().

Referenced by ns3::QKDKeyManagerSystemApplication::PacketReceived(), ns3::QKDSDNController::PacketReceived(), ns3::QKDApp004::PacketReceivedFromKMS(), ns3::QKDApp014::PacketReceivedFromKMS(), ns3::QKDKeyManagerSystemApplication::PacketReceivedKMSs(), ns3::QKDKeyManagerSystemApplication::PacketReceivedSDN(), ns3::QKDApp004::SignalingPacketReceivedFromApp(), and ns3::QKDApp014::SignalingPacketReceivedFromApp().

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

◆ Parse() [2/2]

void ns3::HTTPMessageParser::Parse ( HTTPMessage httpMessage,
const std::vector< uint8_t > &  buffer 
)
inline

Parse a binary vector to an HTTP message.

Pass in a pointer to an HTTPMessage which is written to for headers and other message data.

note: shrink the vector buffer before passing it in with shrink_to_fit otherwise empty characters will show up for the body note: must be a complete HTTP message.

Definition at line 969 of file http.h.

References ns3::HTTPMessage::GetContentLength(), ns3::HTTPMessage::GetMessageBody(), ns3::HTTPMessage::GetStatusCode(), ns3::HEADER_KEY, ns3::HEADER_VALUE, ns3::HTTPVersion1, ns3::HTTPVersion11, ns3::PARSING_BODY, ns3::PARSING_START_LINE, ns3::HTTPMessage::SetFragmented(), ns3::HTTPMessage::SetHeader(), ns3::HTTPMessage::SetMethod(), ns3::HTTPMessage::SetPath(), ns3::HTTPMessage::SetStatusCode(), ns3::HTTPMessage::SetStatusMessage(), ns3::HTTPMessage::SetVersion(), ns3::START_LINE_REQUEST, and ns3::START_LINE_RESPONSE.

+ Here is the call graph for this function:

◆ stripUnicode()

void ns3::HTTPMessageParser::stripUnicode ( std::string &  str)
inline

Definition at line 1187 of file http.h.

References invalidChar().

Referenced by Parse().

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

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