#include <tnt/tntnet.h>
Public Member Functions | |
| Tntnet () | |
| Initialize a default Tntnet-application without mappings. | |
| void | init (const Tntconfig &config) |
| Read settings from a Tntconfig object. | |
| void | listen (const std::string &ipaddr, unsigned short int port) |
| void | sslListen (const std::string &certificateFile, const std::string &keyFile, const std::string &ipaddr, unsigned short int port) |
| void | run () |
| Jobqueue & | getQueue () |
| Returns the queue, which helds active http requests. | |
| Poller & | getPoller () |
| Returns a reference to the poller thread object. | |
| const Dispatcher & | getDispatcher () const |
| Returns a reference to the dispatcher object. | |
| ScopeManager & | getScopemanager () |
| Returns a reference to the scope manager object. | |
| unsigned | getMinThreads () const |
| Returns the minimum number of worker threads. | |
| void | setMinThreads (unsigned n) |
| Sets the minimum number of worker threads. | |
| unsigned | getMaxThreads () const |
| Returns the maximum number of worker threads. | |
| void | setMaxThreads (unsigned n) |
| Sets the maximum number of worker threads. | |
| unsigned | getTimersleep () const |
| Returns the time in seconds after which cleanup like checking sessiontimeout is done. | |
| void | setTimersleep (unsigned sec) |
| Sets the time in seconds after which cleanup like checking sessiontimeout is done. | |
| unsigned | getThreadStartDelay () const |
| Returns the time in seconds between thread starts. | |
| void | setThreadStartDelay (unsigned sec) |
| Sets the time in seconds between thread starts. | |
| unsigned | getQueueSize () const |
| Returns the maximum number of jobs waiting for processing. | |
| void | setQueueSize (unsigned n) |
| Sets the maximum number of jobs waiting for processing. | |
| Maptarget & | mapUrl (const std::string &url, const std::string &ci) |
| void | mapUrl (const std::string &url, const std::string &pathinfo, const std::string &ci_) |
| Maptarget & | mapUrl (const std::string &url, const Maptarget &ci) |
| Maptarget & | vMapUrl (const std::string &vhost, const std::string &url, const Maptarget &ci) |
| void | setAppName (const std::string &appname_) |
| const std::string & | getAppName () const |
| void | setAccessLog (const std::string &accesslog) |
Static Public Member Functions | |
| static void | shutdown () |
| Shut down all instances of tntnet servers. | |
| static bool | shouldStop () |
| Tells, if a shutdown request was initiated. | |
Friends | |
| class | Worker |
To create a application you need to: instantiate a Tntnet class call listen and/or sslListen for each ip address to listen on set up your url mappings using mapUrl or vMapUrl call run()
| void listen | ( | const std::string & | ipaddr, | |
| unsigned short int | port | |||
| ) |
Set up a listener on the specified ip address and port. Listening on the port does not actually happen here but when the application is started using the run-method.
| void sslListen | ( | const std::string & | certificateFile, | |
| const std::string & | keyFile, | |||
| const std::string & | ipaddr, | |||
| unsigned short int | port | |||
| ) |
Set up a ssl listener on the specified ip address and port. Listening on the port does not actually happen here but when the application is started using the run-method.
| void run | ( | ) |
Starts all needed threads and the application loop. If no listeners are set up using listen or sslListen, a default listener is instantiated. By default it listens on the ip address 0.0.0.0 (i.e. all addresses). The port 80 is used, when started as root user, port 8000 otherwise.
| Maptarget& mapUrl | ( | const std::string & | url, | |
| const std::string & | ci | |||
| ) |
Adds a mapping from a url to a component. The url is specified using a regular expression and the mapped target may contain back references to the expression using $1, $2, ... .
| void setAppName | ( | const std::string & | appname_ | ) |
Set the app name.
The app name is used for the session cookie name if the webapplication is linked directly to a stand alone application. The name of the session cookie is then "tntnet." plus the library name of the web application. Since there is no library name, if the application is run through the Tntnet application class, this application name is used instead.
Setting the application explicitely reduces potential conflicts if multiple tntnet application servers are run on the same host on different ports.