PageRenderTime 74ms CodeModel.GetById 63ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/vp_plugins/sptsd/sptsdserver.cpp

http://cupsfilter.googlecode.com/
C++ | 49 lines | 40 code | 8 blank | 1 comment | 0 complexity | ece2f141c09c8204eefeac4a394eea72 MD5 | raw file
 1#include "sptsdserver.h"
 2
 3sptsdServer::sptsdServer(Q_UINT16 port, int conn,  QObject* parent )
 4		:QServerSocket(port, conn, parent) { }
 5
 6sptsdServer::~sptsdServer() { }
 7
 8void sptsdServer::newConnection( int socket )
 9{
10        sptsd *daemon = new sptsd(socket, this);
11	peerIP = daemon->peerAddress().toString();
12        qDebug("\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
13	qDebug("New connection from [" + peerIP + "]");
14//	qDebug("=========================================================================================");
15        connect(daemon, SIGNAL(connectionClosed()), this, SLOT(clientDisconnected()));
16}
17
18void writeSettings()
19{
20    QSettings config;
21    config.insertSearchPath(QSettings::Unix, "/usr/local/src/daemon-2010-01-22/settings");
22    QString file = "sptsd";
23    config.writeEntry(file + "/pgsql/pgsql_host", "localhost");
24    config.writeEntry(file + "/pgsql/pgsql_port", "5432");
25    config.writeEntry(file + "/pgsql/pgsql_database", "cupslog");
26    config.writeEntry(file + "/pgsql/pgsql_user", "postgres");
27    config.writeEntry(file + "/pgsql/pgsql_password", "postgres");
28    config.writeEntry(file + "/sptsd/sptsd_log", "/var/log/cups/sptsd_log");
29    config.writeEntry(file + "/sptsd/sptsd_port", "4242");
30    config.writeEntry(file + "/seclevels/nc", "??????????");
31    config.writeEntry(file + "/seclevels/dcp", "??? ?????????? ???????????");
32    config.writeEntry(file + "/seclevels/c", "????????");
33    config.writeEntry(file + "/seclevels/cc", "?????????? ????????");
34    config.writeEntry(file + "/seclevels/num1", "1");
35    config.writeEntry(file + "/seclevels/num2", "5");
36    config.writeEntry(file + "/seclevels/num3", "10");
37    config.writeEntry(file + "/seclevels/num4", "20");
38    config.writeEntry(file + "/surd/surd_host", "127.0.0.1");
39    config.writeEntry(file + "/surd/surd_port", "80");
40}
41
42void sptsdServer::clientDisconnected()
43{
44	qDebug("Peer [" + peerIP + "] closed connection");
45	qDebug ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
46}
47
48
49