INET Framework for OMNeT++/OMNEST
|
Web server base class. More...
#include <HttpServerBase.h>
Classes | |
struct | HtmlPageData |
Describes a HTML page. More... | |
Public Member Functions | |
HttpServerBase () | |
~HttpServerBase () | |
const std::string & | getHostName () |
Public Member Functions inherited from inet::httptools::HttpNodeBase | |
HttpNodeBase () | |
Public Member Functions inherited from inet::ILifecycle | |
virtual | ~ILifecycle () |
Protected Member Functions | |
virtual void | initialize (int stage) override |
virtual int | numInitStages () const override |
virtual void | finish () override |
virtual void | handleMessage (cMessage *msg) override=0 |
virtual void | refreshDisplay () const override |
HttpReplyMessage * | generateDocument (HttpRequestMessage *request, const char *resource, int size=0) |
HttpReplyMessage * | generateResourceMessage (HttpRequestMessage *request, std::string resource, HttpContentType category) |
HttpReplyMessage * | handleGetRequest (HttpRequestMessage *request, std::string resource) |
HttpReplyMessage * | generateErrorReply (HttpRequestMessage *request, int code) |
virtual std::string | generateBody () |
cPacket * | handleReceivedMessage (cMessage *msg) |
void | registerWithController () |
void | readSiteDefinition (std::string file) |
std::string | readHtmlBodyFile (std::string file, std::string path) |
Protected Member Functions inherited from inet::httptools::HttpNodeBase | |
void | sendDirectToModule (HttpNodeBase *receiver, cPacket *packet, simtime_t constdelay=0.0, rdObject *rd=nullptr) |
double | transmissionDelay (cPacket *packet) |
void | logRequest (const HttpRequestMessage *httpRequest) |
void | logResponse (const HttpReplyMessage *httpResponse) |
void | logEntry (std::string line) |
std::string | formatHttpRequestShort (const HttpRequestMessage *httpRequest) |
std::string | formatHttpResponseShort (const HttpReplyMessage *httpResponse) |
std::string | formatHttpRequestLong (const HttpRequestMessage *httpRequest) |
std::string | formatHttpResponseLong (const HttpReplyMessage *httpResponse) |
virtual bool | handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override |
Perform one stage of a lifecycle operation. More... | |
Protected Attributes | |
std::string | hostName |
int | port = -1 |
bool | scriptedMode = false |
std::map< std::string, HtmlPageData > | htmlPages |
std::map< std::string, unsigned int > | resources |
simtime_t | activationTime |
long | htmlDocsServed = 0 |
long | imgResourcesServed = 0 |
long | textResourcesServed = 0 |
long | badRequests = 0 |
rdObject * | rdReplyDelay = nullptr |
The processing delay of the server. More... | |
rdObject * | rdHtmlPageSize = nullptr |
The HTML page size distribution for the site. More... | |
rdObject * | rdTextResourceSize = nullptr |
The text resource size distribution for the site. More... | |
rdObject * | rdImageResourceSize = nullptr |
The image resource size distribution for the site. More... | |
rdObject * | rdNumResources = nullptr |
Number of resources per HTML page. More... | |
rdObject * | rdTextImageResourceRatio = nullptr |
The ratio of text resources to images referenced in HTML pages. More... | |
rdObject * | rdErrorMsgSize = nullptr |
The size of error messages. More... | |
Protected Attributes inherited from inet::httptools::HttpNodeBase | |
unsigned long | linkSpeed = 0 |
int | httpProtocol = 0 |
std::string | logFileName |
bool | enableLogging = true |
LOG_FORMAT | outputFormat = lf_short |
bool | m_bDisplayMessage = true |
bool | m_bDisplayResponseContent = true |
cModule * | host = nullptr |
Web server base class.
This module implements a flexible Web server. It is part of the HttpTools project and should be used in conjunction with a number of browsing clients.
The server base class cannot be instantiated directly in a simulation. Use rather the HttpServer for INET TCP/IP applications or HttpServerDirect for direct message passing. See those classes for details. See the INET documentation for details on the StandardHost and the TCP/IP simulation.
inet::httptools::HttpServerBase::~HttpServerBase | ( | ) |
|
overrideprotectedvirtual |
Reimplemented in inet::httptools::HttpServer, and inet::httptools::HttpServerDirect.
Referenced by inet::httptools::HttpServerDirect::finish(), and inet::httptools::HttpServer::finish().
|
protectedvirtual |
Reimplemented in inet::httptools::HttpServerDirectEvilA, inet::httptools::HttpServerDirectEvilB, inet::httptools::HttpServerEvilA, and inet::httptools::HttpServerEvilB.
Referenced by generateDocument().
|
protected |
Referenced by handleGetRequest().
|
protected |
Referenced by handleGetRequest(), and handleReceivedMessage().
|
protected |
Referenced by handleGetRequest().
|
inline |
|
protected |
Referenced by handleReceivedMessage().
|
overrideprotectedpure virtual |
Implemented in inet::httptools::HttpServer, and inet::httptools::HttpServerDirect.
|
protected |
Referenced by inet::httptools::HttpServerDirect::handleMessage(), and inet::httptools::HttpServer::socketDataArrived().
|
overrideprotectedvirtual |
Reimplemented from inet::httptools::HttpNodeBase.
Reimplemented in inet::httptools::HttpServer, inet::httptools::HttpServerDirectEvilA, inet::httptools::HttpServerDirectEvilB, inet::httptools::HttpServerEvilA, inet::httptools::HttpServerEvilB, and inet::httptools::HttpServerDirect.
Referenced by inet::httptools::HttpServerDirect::initialize(), and inet::httptools::HttpServer::initialize().
|
inlineoverrideprotectedvirtual |
|
protected |
Referenced by readSiteDefinition().
|
protected |
Referenced by initialize().
|
overrideprotectedvirtual |
|
protected |
Referenced by initialize().
|
protected |
Referenced by initialize(), refreshDisplay(), and registerWithController().
|
protected |
Referenced by finish(), generateErrorReply(), and initialize().
|
protected |
Referenced by generateDocument(), generateErrorReply(), generateResourceMessage(), handleReceivedMessage(), inet::httptools::HttpServerEvilA::initialize(), inet::httptools::HttpServerDirectEvilB::initialize(), inet::httptools::HttpServerEvilB::initialize(), inet::httptools::HttpServerDirectEvilA::initialize(), initialize(), and registerWithController().
|
protected |
Referenced by finish(), generateDocument(), initialize(), and refreshDisplay().
|
protected |
Referenced by generateDocument(), handleGetRequest(), and readSiteDefinition().
|
protected |
Referenced by finish(), generateResourceMessage(), and initialize().
|
protected |
Referenced by inet::httptools::HttpServer::initialize(), initialize(), and registerWithController().
|
protected |
The size of error messages.
Referenced by generateErrorReply(), initialize(), and ~HttpServerBase().
|
protected |
The HTML page size distribution for the site.
Referenced by generateDocument(), initialize(), and ~HttpServerBase().
|
protected |
The image resource size distribution for the site.
Referenced by generateResourceMessage(), initialize(), and ~HttpServerBase().
|
protected |
Number of resources per HTML page.
Referenced by generateBody(), initialize(), and ~HttpServerBase().
|
protected |
The processing delay of the server.
Referenced by inet::httptools::HttpServerDirect::handleMessage(), initialize(), and ~HttpServerBase().
|
protected |
The ratio of text resources to images referenced in HTML pages.
Referenced by generateBody(), initialize(), and ~HttpServerBase().
|
protected |
The text resource size distribution for the site.
Referenced by generateResourceMessage(), initialize(), and ~HttpServerBase().
|
protected |
Referenced by generateResourceMessage(), handleGetRequest(), and readSiteDefinition().
|
protected |
Referenced by generateDocument(), generateResourceMessage(), handleGetRequest(), and initialize().
|
protected |
Referenced by finish(), generateResourceMessage(), and initialize().