Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Configurator Class Reference

#include <tnt/configurator.h>

List of all members.

Public Member Functions

 Configurator (tnt::Tntnet &tntnet_)
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.
unsigned getMaxRequestTime ()
 Returns the maximum request time, after which tntnet is automatically restarted in daemon mode.
void setMaxRequestTime (unsigned sec)
 Sets the maximum request time, after which tntnet is automatically restarted in daemon mode.
bool getEnableCompression ()
 Returns true, when http compression is used.
void setEnableCompression (bool sw=true)
 enables or disables http compression.
unsigned getSessionTimeout ()
 Returns the time of inactivity in seconds after which a session is destroyed.
void setSessionTimeout (unsigned sec)
 Sets the time of inactivity in seconds after which a session is destroyed.
int getListenBacklog ()
 Returns the listen backlog parameter (see also listen(2)).
void setListenBacklog (int n)
 Sets the listen backlog parameter (see also listen(2)).
unsigned getListenRetry ()
 Returns the number of retries, when a listen retried, when failing.
void setListenRetry (int n)
 Sets the number of retries, when a listen retried, when failing.
unsigned getMaxUrlMapCache ()
void setMaxUrlMapCache (int n)
 Sets the maximum number of cached urlmappings.
size_t getMaxRequestSize ()
void setMaxRequestSize (size_t s)
 Sets the maximum size of a request.
unsigned getSocketReadTimeout ()
void setSocketReadTimeout (unsigned ms)
 Sets the timeout in millisecods after which the request is passed to the poller.
unsigned getSocketWriteTimeout ()
void setSocketWriteTimeout (unsigned ms)
 Sets the write timeout in millisecods after which the request is timed out.
unsigned getKeepAliveMax ()
void setKeepAliveMax (unsigned ms)
 Sets the maximum number of requests handled over a single connection.
unsigned getSocketBufferSize ()
void setSocketBufferSize (unsigned ms)
 Sets the size of the socket buffer.
unsigned getMinCompressSize ()
void setMinCompressSize (unsigned s)
 Sets the minimum size of a request body for compression.
unsigned getKeepAliveTimeout ()
void setKeepAliveTimeout (unsigned s)
 Sets the keep alive timeout in milliseconds.
const std::string & getDefaultContentType ()
void setDefaultContentType (const std::string &s)
 Sets the default content type.
void addSearchPathEntry (const std::string &path)
 Adds a file path where components are searched.
void setAccessLog (const std::string &accessLog)


Detailed Description

Helper class for easier configuration of tntnet when used as library.

Configuration of tntnet is spread througout the system and it is a tendious task to search the right place, where to set some setting. This Class helps here and offers methods for all settings in one place. The methods dispatch the setting to the right place, so the user needs to know only this class, when he wants to set some settings.


Member Function Documentation

unsigned getMaxUrlMapCache (  ) 

Returns the maximum number of cached urlmappings. The cache stores results of the regular expressions used for defining mappings. Since the number of different urls used is normally quite limited, the cache reduces significantly the number of executed regular expressions.

size_t getMaxRequestSize (  ) 

Returns the maximum size of a request. Requestdata are collected in memory and therefore requests, which exceed the size of available memory may lead to a denial of service.

unsigned getSocketReadTimeout (  ) 

Returns the read timeout in millisecods after which the request is passed to the poller. Tntnet tries to keep a connection on the same thread to reduce context switches by waiting a short period if additional data arrives. After that period the request is passed to the poller, which waits for activity on the socket. The default value is 10 ms.

unsigned getSocketWriteTimeout (  ) 

Returns the write timeout in millisecods after which the request is timed out. The default value is 10000 ms.

unsigned getKeepAliveMax (  ) 

Returns the maximum number of requests handled over a single connection. The default value is 1000.

unsigned getSocketBufferSize (  ) 

Returns the size of the socket buffer. This specifies the maximum number of bytes after which the data sent or received over a socket is passed to the operating system. The default value is 16384 bytes (16 kBytes).

unsigned getMinCompressSize (  ) 

Returns the minimum size of a request body for compression. Small requests are not worth compressing, so tntnet has a limit, to save cpu. The default value is 1024 bytes.

unsigned getKeepAliveTimeout (  ) 

Returns the keep alive timeout in milliseconds. This specifies, how long a connection is kept for keep alive. A keep alive request binds (little) resources, so it is good to free it after some time of inactivity. The default value if 15000 ms.

const std::string& getDefaultContentType (  ) 

Returns the default content type. The default content type is "text/html; charset=iso-8859-1".

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6