|
INET Framework for OMNeT++/OMNEST
|
The controller module for HttpTools simulations. More...
#include <HttpController.h>
Classes | |
| struct | WebServerEntry |
| Registration entry for Web servers. More... | |
Public Member Functions | |
| HttpController () | |
| ~HttpController () | |
public interface used by server and browser objects in the simulation | |
| void | registerServer (const char *objectName, const char *wwwName, int port, int rank=INSERT_RANDOM, simtime_t activationTime=0.0) |
| Register a WWW server object. More... | |
| cModule * | getServerModule (const char *wwwName) |
| Get a specific server module reference. More... | |
| cModule * | getAnyServerModule () |
| Get a random server object. More... | |
| int | getServerInfo (const char *wwwName, char *module, int &port) |
| Get module and port for a server. More... | |
| int | getAnyServerInfo (char *wwwName, char *module, int &port) |
| Get module and port for a random server. More... | |
Protected Types | |
| enum | ServerStatus { SS_NORMAL, SS_SPECIAL } |
Protected Member Functions | |
| cModule * | getTcpApp (const char *node) |
| Helper used by the server registration to locate the tcpApp getModule(server or browser) More... | |
| void | setSpecialStatus (const char *www, ServerStatus status, double p, double amortize) |
| Set special status of a WWW server. More... | |
| void | cancelSpecialStatus (const char *www) |
| Cancel special popularity status for a server. More... | |
| WebServerEntry * | selectFromSpecialList () |
| Select a server from the special list. More... | |
| std::string | listRegisteredServers () |
| List the registered servers. More... | |
| std::string | listSpecials () |
| List the servers on the special list, i.e. More... | |
| std::string | listPickOrder () |
| List the registered servers in the order of the general population pick list. More... | |
| void | parseOptionsFile (std::string file, std::string section) |
| Parse a popularity modification events definition file at startup (if defined). More... | |
cSimpleModule redefinitions | |
| virtual void | initialize (int stage) override |
| Initialization of the component and startup of browse event scheduling. More... | |
| virtual void | finish () override |
| Report final statistics. More... | |
| virtual void | handleMessage (cMessage *msg) override |
| Handle incoming messages. More... | |
| virtual int | numInitStages () const override |
| Returns the number of initialization stages. More... | |
Protected Attributes | |
| std::map< std::string, WebServerEntry * > | webSiteList |
| A list of registered web sites (server objects) More... | |
| std::vector< WebServerEntry * > | pickList |
| The picklist used to select sites at random. More... | |
| std::list< WebServerEntry * > | specialList |
| The special list – contains sites with active popularity modification events. More... | |
| double | pspecial = NaN |
| The probability [0,1) of selecting a site from the special list. More... | |
| unsigned long | totalLookups = 0 |
| A counter for the total number of lookups. More... | |
| rdObject * | rdServerSelection = nullptr |
| The random object for the server selection. More... | |
Private Member Functions | |
| WebServerEntry * | __getRandomServerInfo () |
| Get a random server from the special list with p=pspecial or from the general population with p=1-pspecial. More... | |
The controller module for HttpTools simulations.
A controller object for OMNeT++ simulations which use the HttpTools browser and server components. A single controller must exist at the scenario level in each simulation.
|
protected |
| inet::httptools::HttpController::HttpController | ( | ) |
| inet::httptools::HttpController::~HttpController | ( | ) |
|
private |
Get a random server from the special list with p=pspecial or from the general population with p=1-pspecial.
Referenced by getAnyServerInfo(), and getAnyServerModule().
|
protected |
Cancel special popularity status for a server.
Called when popularity has been amortized to zero.
Referenced by selectFromSpecialList().
|
overrideprotectedvirtual |
Report final statistics.
| int inet::httptools::HttpController::getAnyServerInfo | ( | char * | wwwName, |
| char * | module, | ||
| int & | port | ||
| ) |
Get module and port for a random server.
Returns a OMNeT++ module name and port number for a randomly chosen server. The general popularity distribution is used in conjunction with the special list to determine the module returned. Called by browser modules to get a random communications partner.
Referenced by inet::httptools::HttpBrowser::sendRequestToRandomServer().
| cModule * inet::httptools::HttpController::getAnyServerModule | ( | ) |
Get a random server object.
Returns a OMNeT++ module reference to a randomly chosen server. The general popularity distribution is used in conjunction with the special list to determine the module returned. Called by browser modules to get a random communications partner.
Referenced by inet::httptools::HttpBrowserDirect::sendRequestToRandomServer().
| int inet::httptools::HttpController::getServerInfo | ( | const char * | wwwName, |
| char * | module, | ||
| int & | port | ||
| ) |
Get module and port for a server.
Get a module reference and port number for a specific www name. Used by the browser modules when using TCP transport.
Referenced by inet::httptools::HttpBrowser::sendRequestsToServer(), and inet::httptools::HttpBrowser::sendRequestToServer().
| cModule * inet::httptools::HttpController::getServerModule | ( | const char * | wwwName | ) |
Get a specific server module reference.
Returns a OMNeT++ module reference for a specific WWW name. Called by browser modules to get a communications partner.
Referenced by inet::httptools::HttpBrowserBase::readScriptedEvents(), inet::httptools::HttpBrowserDirect::sendRequestsToServer(), and inet::httptools::HttpBrowserDirect::sendRequestToServer().
|
protected |
Helper used by the server registration to locate the tcpApp getModule(server or browser)
Referenced by registerServer().
|
overrideprotectedvirtual |
Handle incoming messages.
|
overrideprotectedvirtual |
Initialization of the component and startup of browse event scheduling.
Multi-stage is required to properly initialize the object for random site selection after all servers have been registered.
|
protected |
List the registered servers in the order of the general population pick list.
Useful for debug.
|
protected |
List the registered servers.
Useful for debug.
|
protected |
List the servers on the special list, i.e.
those with custom selection probability. Useful for debug.
|
inlineoverrideprotectedvirtual |
Returns the number of initialization stages.
Two required.
|
protected |
Parse a popularity modification events definition file at startup (if defined).
Format: {time};{www name};{event kind};{p value};{amortization factor} Event kind is not used at the present – use 1 as a default here.
Referenced by initialize().
| void inet::httptools::HttpController::registerServer | ( | const char * | objectName, |
| const char * | wwwName, | ||
| int | port, | ||
| int | rank = INSERT_RANDOM, |
||
| simtime_t | activationTime = 0.0 |
||
| ) |
Register a WWW server object.
Called by server objects at startup.
Referenced by inet::httptools::HttpServerBase::registerWithController().
|
protected |
Select a server from the special list.
This method is called with the pspecial probability.
Referenced by __getRandomServerInfo().
|
protected |
Set special status of a WWW server.
Triggered by an event message.
Referenced by handleMessage().
|
protected |
The picklist used to select sites at random.
Referenced by __getRandomServerInfo(), getAnyServerInfo(), getAnyServerModule(), listPickOrder(), and registerServer().
|
protected |
The probability [0,1) of selecting a site from the special list.
Referenced by __getRandomServerInfo(), cancelSpecialStatus(), getAnyServerInfo(), getAnyServerModule(), initialize(), selectFromSpecialList(), and setSpecialStatus().
|
protected |
The random object for the server selection.
Referenced by __getRandomServerInfo(), initialize(), and ~HttpController().
|
protected |
The special list – contains sites with active popularity modification events.
Referenced by cancelSpecialStatus(), listSpecials(), selectFromSpecialList(), and setSpecialStatus().
|
protected |
A counter for the total number of lookups.
Referenced by finish(), getAnyServerInfo(), getAnyServerModule(), getServerInfo(), getServerModule(), and initialize().
|
protected |
A list of registered web sites (server objects)
Referenced by finish(), getAnyServerInfo(), getAnyServerModule(), getServerInfo(), getServerModule(), initialize(), listRegisteredServers(), registerServer(), setSpecialStatus(), and ~HttpController().