INET Framework for OMNeT++/OMNEST
inet::httptools::HttpBrowserDirect Class Reference

A simulated browser module for OMNeT++ simulations. More...

#include <HttpBrowserDirect.h>

Inheritance diagram for inet::httptools::HttpBrowserDirect:
inet::httptools::HttpBrowserBase inet::httptools::HttpNodeBase inet::ILifecycle

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void finish () override
 
virtual void handleMessage (cMessage *msg) override
 
int numInitStages () const override
 
virtual void sendRequestToServer (BrowseEvent be) override
 
virtual void sendRequestToServer (HttpRequestMessage *request) override
 
virtual void sendRequestToRandomServer () override
 
virtual void sendRequestsToServer (std::string www, HttpRequestQueue queue) override
 
- Protected Member Functions inherited from inet::httptools::HttpBrowserBase
void handleDataMessage (cMessage *msg)
 
void handleSelfMessages (cMessage *msg)
 
void handleSelfActivityStart ()
 
void handleSelfStartSession ()
 
void handleSelfNextMessage ()
 
void handleSelfScriptedEvent ()
 
void handleSelfDelayedRequestMessage (cMessage *msg)
 
void scheduleNextBrowseEvent ()
 
HttpRequestMessagegeneratePageRequest (std::string www, std::string page, bool bad=false, int size=0)
 
HttpRequestMessagegenerateRandomPageRequest (std::string www, bool bad=false, int size=0)
 
HttpRequestMessagegenerateResourceRequest (std::string www, std::string resource="", int serial=0, bool bad=false, int size=0)
 
void readScriptedEvents (const char *filename)
 
- 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...
 

Additional Inherited Members

- Public Member Functions inherited from inet::httptools::HttpBrowserBase
 HttpBrowserBase ()
 
virtual ~HttpBrowserBase ()
 
- Public Member Functions inherited from inet::httptools::HttpNodeBase
 HttpNodeBase ()
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 
- Protected Types inherited from inet::httptools::HttpBrowserBase
typedef std::deque< BrowseEventBrowseEventsList
 
typedef std::deque< HttpRequestMessage * > HttpRequestQueue
 
- Protected Attributes inherited from inet::httptools::HttpBrowserBase
cMessage * eventTimer = nullptr
 
HttpControllercontroller = nullptr
 
bool scriptedMode = false
 
BrowseEventsList browseEvents
 
int reqInCurSession = 0
 
int reqNoInCurSession = 0
 
simtime_t acitivityPeriodEnd
 
rdObjectrdProcessingDelay = nullptr
 
rdObjectrdActivityLength = nullptr
 
rdObjectrdInterRequestInterval = nullptr
 
rdObjectrdInterSessionInterval = nullptr
 
rdObjectrdRequestSize = nullptr
 
rdObjectrdReqInSession = nullptr
 
long htmlRequested = 0
 
long htmlReceived = 0
 
long htmlErrorsReceived = 0
 
long imgResourcesRequested = 0
 
long imgResourcesReceived = 0
 
long textResourcesRequested = 0
 
long textResourcesReceived = 0
 
long messagesInCurrentSession = 0
 
long sessionCount = 0
 
long connectionsCount = 0
 
- 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
 

Detailed Description

A simulated browser module for OMNeT++ simulations.

This module implements direct message passing between modules.

See also
HttpBrowserBase
HttpBrowser
Author
Kristjan V. Jonsson (krist.nosp@m.janv.nosp@m.j@gma.nosp@m.il.c.nosp@m.om)

Member Function Documentation

void inet::httptools::HttpBrowserDirect::finish ( )
overrideprotectedvirtual

Reimplemented from inet::httptools::HttpBrowserBase.

39 {
41 }
virtual void finish() override
Definition: HttpBrowserBase.cc:166
void inet::httptools::HttpBrowserDirect::handleMessage ( cMessage *  msg)
overrideprotectedvirtual

Implements inet::httptools::HttpBrowserBase.

44 {
45  if (msg->isSelfMessage())
46  handleSelfMessages(msg);
47  else
48  handleDataMessage(msg);
49 }
void handleDataMessage(cMessage *msg)
Definition: HttpBrowserBase.cc:276
void handleSelfMessages(cMessage *msg)
Definition: HttpBrowserBase.cc:187
void inet::httptools::HttpBrowserDirect::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::httptools::HttpBrowserBase.

28 {
29  EV_DEBUG << "Initializing HTTP direct browser component - stage " << stage << endl;
31 
32  if (stage == INITSTAGE_LOCAL) {
33  // linkSpeed is used to model transmission delay.
34  linkSpeed = par("linkSpeed");
35  }
36 }
unsigned long linkSpeed
Definition: HttpNodeBase.h:59
virtual void initialize(int stage) override
Definition: HttpBrowserBase.cc:45
Local initializations.
Definition: InitStages.h:35
int inet::httptools::HttpBrowserDirect::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::httptools::HttpBrowserBase.

43 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::httptools::HttpBrowserDirect::sendRequestsToServer ( std::string  www,
HttpRequestQueue  queue 
)
overrideprotectedvirtual

Implements inet::httptools::HttpBrowserBase.

82 {
83  HttpNodeBase *serverModule = dynamic_cast<HttpNodeBase *>(controller->getServerModule(www.c_str()));
84  if (serverModule == nullptr) {
85  EV_ERROR << "Failed to get server module " << www << endl;
86  while (!queue.empty()) {
87  HttpRequestMessage *msg = queue.back();
88  queue.pop_back();
89  delete msg;
90  }
91  }
92  else {
93  while (!queue.empty()) {
94  HttpRequestMessage *msg = queue.back();
95  queue.pop_back();
96  sendDirectToModule(serverModule, msg, 0.0, rdProcessingDelay);
97  }
98  }
99 }
rdObject * rdProcessingDelay
Definition: HttpBrowserBase.h:99
HttpController * controller
Definition: HttpBrowserBase.h:88
cModule * getServerModule(const char *wwwName)
Get a specific server module reference.
Definition: HttpController.cc:174
HttpNodeBase()
Definition: HttpNodeBase.cc:26
void sendDirectToModule(HttpNodeBase *receiver, cPacket *packet, simtime_t constdelay=0.0, rdObject *rd=nullptr)
Definition: HttpNodeBase.cc:43
void inet::httptools::HttpBrowserDirect::sendRequestToRandomServer ( )
overrideprotectedvirtual

Implements inet::httptools::HttpBrowserBase.

70 {
71  HttpServerBase *serverModule = dynamic_cast<HttpServerBase *>(controller->getAnyServerModule());
72  if (serverModule == nullptr) {
73  EV_ERROR << "Failed to get a random server module" << endl;
74  }
75  else {
76  EV_DEBUG << "Sending request randomly to " << serverModule->getHostName() << endl;
77  sendDirectToModule(serverModule, generateRandomPageRequest(serverModule->getHostName()), 0.0, rdProcessingDelay);
78  }
79 }
rdObject * rdProcessingDelay
Definition: HttpBrowserBase.h:99
HttpController * controller
Definition: HttpBrowserBase.h:88
HttpRequestMessage * generateRandomPageRequest(std::string www, bool bad=false, int size=0)
Definition: HttpBrowserBase.cc:422
void sendDirectToModule(HttpNodeBase *receiver, cPacket *packet, simtime_t constdelay=0.0, rdObject *rd=nullptr)
Definition: HttpNodeBase.cc:43
cModule * getAnyServerModule()
Get a random server object.
Definition: HttpController.cc:196
void inet::httptools::HttpBrowserDirect::sendRequestToServer ( BrowseEvent  be)
overrideprotectedvirtual

Implements inet::httptools::HttpBrowserBase.

52 {
53  sendDirectToModule(be.serverModule, generatePageRequest(be.wwwhost, be.resourceName), 0.0, rdProcessingDelay);
54 }
rdObject * rdProcessingDelay
Definition: HttpBrowserBase.h:99
HttpRequestMessage * generatePageRequest(std::string www, std::string page, bool bad=false, int size=0)
Definition: HttpBrowserBase.cc:388
void sendDirectToModule(HttpNodeBase *receiver, cPacket *packet, simtime_t constdelay=0.0, rdObject *rd=nullptr)
Definition: HttpNodeBase.cc:43
void inet::httptools::HttpBrowserDirect::sendRequestToServer ( HttpRequestMessage request)
overrideprotectedvirtual

Implements inet::httptools::HttpBrowserBase.

57 {
58  HttpServerBase *serverModule = dynamic_cast<HttpServerBase *>(controller->getServerModule(request->targetUrl()));
59  if (serverModule == nullptr) {
60  EV_ERROR << "Failed to get server module for " << request->targetUrl() << endl;
61  delete request;
62  }
63  else {
64  EV_DEBUG << "Sending request to " << serverModule->getHostName() << endl;
65  sendDirectToModule(serverModule, request, 0.0, rdProcessingDelay);
66  }
67 }
rdObject * rdProcessingDelay
Definition: HttpBrowserBase.h:99
HttpController * controller
Definition: HttpBrowserBase.h:88
cModule * getServerModule(const char *wwwName)
Get a specific server module reference.
Definition: HttpController.cc:174
void sendDirectToModule(HttpNodeBase *receiver, cPacket *packet, simtime_t constdelay=0.0, rdObject *rd=nullptr)
Definition: HttpNodeBase.cc:43

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