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

/home/tommi/tntnet/framework/common/tnt/configurator.h

00001 /*
00002  * Copyright (C) 2008 Tommi Maekitalo
00003  * 
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  * 
00009  * As a special exception, you may use this file as part of a free
00010  * software library without restriction. Specifically, if other files
00011  * instantiate templates or use macros or inline functions from this
00012  * file, or you compile this file and link it with other files to
00013  * produce an executable, this file does not by itself cause the
00014  * resulting executable to be covered by the GNU General Public
00015  * License. This exception does not however invalidate any other
00016  * reasons why the executable file might be covered by the GNU Library
00017  * General Public License.
00018  * 
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Lesser General Public License for more details.
00023  * 
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this library; if not, write to the Free Software
00026  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00027  */
00028 
00029 #ifndef TNT_CONFIGURATOR_H
00030 #define TNT_CONFIGURATOR_H
00031 
00032 #include <tnt/tntnet.h>
00033 #include <tnt/worker.h>
00034 #include <tnt/sessionscope.h>
00035 #include <tnt/httpreply.h>
00036 #include <tnt/backgroundworker.h>
00037 
00038 namespace tnt
00039 {
00048   class Configurator
00049   {
00050       Tntnet& tntnet;
00051 
00052     public:
00053       explicit Configurator(tnt::Tntnet& tntnet_)
00054         : tntnet(tntnet_)
00055         { }
00056 
00058       unsigned getMinThreads() const
00059         { return tntnet.getMinThreads(); }
00061       void setMinThreads(unsigned n)
00062         { tntnet.setMinThreads(n); }
00063 
00065       unsigned getMaxThreads() const
00066         { return tntnet.getMaxThreads(); }
00068       void setMaxThreads(unsigned n)
00069         { tntnet.setMaxThreads(n); }
00070 
00072       unsigned getTimerSleep() const
00073         { return tntnet.getTimersleep(); }
00075       void setTimerSleep(unsigned sec)
00076         { tntnet.setTimersleep(sec); }
00077 
00079       unsigned getThreadStartDelay() const
00080         { return tntnet.getThreadStartDelay(); }
00082       void setThreadStartDelay(unsigned sec)
00083         { tntnet.setThreadStartDelay(sec); }
00084 
00086       unsigned getQueueSize() const
00087         { return tntnet.getQueueSize(); }
00089       void setQueueSize(unsigned n)
00090         { tntnet.setQueueSize(n); }
00091 
00093       unsigned getMaxRequestTime() const
00094         { return Worker::getMaxRequestTime(); }
00096       void setMaxRequestTime(unsigned sec)
00097         { Worker::setMaxRequestTime(sec); }
00098 
00100       bool getEnableCompression() const
00101         { return Worker::getEnableCompression(); }
00103       void setEnableCompression(bool sw = true)
00104         { Worker::setEnableCompression(sw); }
00105 
00107       unsigned getSessionTimeout() const
00108         { return Sessionscope::getDefaultTimeout(); }
00110       void setSessionTimeout(unsigned sec)
00111         { Sessionscope::setDefaultTimeout(sec); }
00112 
00114       int getListenBacklog() const;
00116       void setListenBacklog(int n);
00117 
00119       unsigned getListenRetry() const;
00121       void setListenRetry(int n);
00122 
00128       unsigned getMaxUrlMapCache() const
00129         { return Dispatcher::getMaxUrlMapCache(); }
00131       void setMaxUrlMapCache(int n)
00132         { Dispatcher::setMaxUrlMapCache(n); }
00133 
00137       size_t getMaxRequestSize() const
00138         { return HttpRequest::getMaxRequestSize(); }
00140       void setMaxRequestSize(size_t s)
00141         { HttpRequest::setMaxRequestSize(s); }
00142 
00149       unsigned getSocketReadTimeout() const
00150         { return Job::getSocketReadTimeout(); }
00152       void setSocketReadTimeout(unsigned ms)
00153         { Job::setSocketReadTimeout(ms); }
00154 
00157       unsigned getSocketWriteTimeout() const
00158         { return Job::getSocketWriteTimeout(); }
00160       void setSocketWriteTimeout(unsigned ms)
00161         { Job::setSocketWriteTimeout(ms); }
00162 
00165       unsigned getKeepAliveMax() const
00166         { return Job::getKeepAliveMax(); }
00168       void setKeepAliveMax(unsigned ms)
00169         { Job::setKeepAliveMax(ms); }
00170 
00175       unsigned getSocketBufferSize() const
00176         { return Job::getSocketBufferSize(); }
00178       void setSocketBufferSize(unsigned ms)
00179         { Job::setSocketBufferSize(ms); }
00180 
00184       unsigned getMinCompressSize() const
00185         { return HttpReply::getMinCompressSize(); }
00187       void setMinCompressSize(unsigned s)
00188         { HttpReply::setMinCompressSize(s); }
00189 
00194       unsigned getKeepAliveTimeout() const
00195         { return HttpReply::getKeepAliveTimeout(); }
00197       void setKeepAliveTimeout(unsigned s)
00198         { HttpReply::setKeepAliveTimeout(s); }
00199 
00202       const std::string& getDefaultContentType() const
00203         { return HttpReply::getDefaultContentType(); }
00205       void setDefaultContentType(const std::string& s)
00206         { HttpReply::setDefaultContentType(s); }
00207 
00209       void addSearchPathEntry(const std::string& path)
00210         { Comploader::addSearchPathEntry(path); }
00211 
00212       void setAccessLog(const std::string& accessLog)
00213         { tntnet.setAccessLog(accessLog); }
00214 
00215       void setMaxBackgroundTasks(unsigned n)
00216         { BackgroundWorker::setMaxJobs(n); }
00217       unsigned getMaxBackgroundTasks() const
00218         { return BackgroundWorker::getMaxJobs(); }
00219   };
00220 
00221 }
00222 
00223 #endif // TNT_CONFIGURATOR_H
00224 
Copyright © 2008 The Tntnet Development Team
Tntnet 1.6