/usr/include/timblserver/ServerBase.h is in libtimblserver4-dev 1.8-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | /*
$Id: ServerBase.h 16902 2014-01-30 13:24:03Z sloot $
$URL: https://ilk.uvt.nl/svn/trunk/sources/TimblServer/include/timblserver/ServerBase.h $
Copyright (c) 1998 - 2013
ILK - Tilburg University
CLiPS - University of Antwerp
This file is part of timblserver
timblserver is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
timblserver is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
For questions and suggestions, see:
http://ilk.uvt.nl/software.html
or send mail to:
timbl@uvt.nl
*/
#ifndef SERVERBASE_H
#define SERVERBASE_H
#include "ticcutils/LogStream.h"
#include "ticcutils/Configuration.h"
#include "timblserver/SocketBasics.h"
namespace TimblServer {
class childArgs;
class ServerBase {
public:
bool doDebug() { return debug; };
virtual ~ServerBase(){};
static std::string VersionInfo( bool );
static int daemonize( int , int );
int maxConn() const { return _maxConn; };
ServerBase( const TiCC::Configuration * );
void setDebug( bool d ){ debug = d; };
Sockets::ServerSocket *TcpSocket() const { return tcp_socket; };
static void *callChild( void * );
int Run();
virtual void socketChild( childArgs * );
virtual void callback( childArgs* ) = 0;
virtual void sendReject( std::ostream& os ) const;
TiCC::LogStream myLog;
std::string logFile;
std::string pidFile;
std::string name;
bool doDaemon;
bool debug;
int _maxConn;
int serverPort;
void *callback_data;
Sockets::ServerSocket *tcp_socket;
std::string serverProtocol;
std::string serverConfigFile;
const TiCC::Configuration *config;
std::map<std::string, std::string> serverConfig;
};
class childArgs {
public:
childArgs( ServerBase *, Sockets::ServerSocket * );
~childArgs();
int id() const { return _id; };
fdostream& os() { return _os; };
fdistream& is() { return _is; };
ServerBase *mother() const { return _mother; };
TiCC::LogStream& logstream() { return _mother->myLog; }
Sockets::ServerSocket *socket() const { return _socket; };
bool debug() const { return _mother->doDebug(); };
private:
ServerBase *_mother;
Sockets::ServerSocket *_socket;
int _id;
fdistream _is;
fdostream _os;
};
void *ServerBase::callChild( void *a ) {
childArgs* ca = (childArgs*)a;
ca->mother()->socketChild( ca );
return 0;
}
class TcpServerBase : public ServerBase {
public:
TcpServerBase( const TiCC::Configuration *c ):ServerBase( c ){};
};
class HttpServerBase : public ServerBase {
public:
void socketChild( childArgs * );
virtual void sendReject( std::ostream& os ) const;
HttpServerBase( const TiCC::Configuration *c ): ServerBase( c ){};
};
std::string Version();
std::string VersionName();
int daemonize( int noCD , int noClose ){
return ServerBase::daemonize( noCD, noClose);
}
}
#endif // SERVERBASE_H
|