|
|
@ -33,19 +33,19 @@ public:
|
|
|
|
ClientTest()
|
|
|
|
ClientTest()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sock = new TQSocket;
|
|
|
|
sock = new TQSocket;
|
|
|
|
connect(sock, SIGNAL(connected()), SLOT(sock_connected()));
|
|
|
|
connect(sock, TQ_SIGNAL(connected()), TQ_SLOT(sock_connected()));
|
|
|
|
connect(sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed()));
|
|
|
|
connect(sock, TQ_SIGNAL(connectionClosed()), TQ_SLOT(sock_connectionClosed()));
|
|
|
|
connect(sock, SIGNAL(readyRead()), SLOT(sock_readyRead()));
|
|
|
|
connect(sock, TQ_SIGNAL(readyRead()), TQ_SLOT(sock_readyRead()));
|
|
|
|
connect(sock, SIGNAL(error(int)), SLOT(sock_error(int)));
|
|
|
|
connect(sock, TQ_SIGNAL(error(int)), TQ_SLOT(sock_error(int)));
|
|
|
|
|
|
|
|
|
|
|
|
sasl = new QCA::SASL;
|
|
|
|
sasl = new QCA::SASL;
|
|
|
|
connect(sasl, SIGNAL(clientFirstStep(const TQString &, const TQByteArray *)), SLOT(sasl_clientFirstStep(const TQString &, const TQByteArray *)));
|
|
|
|
connect(sasl, TQ_SIGNAL(clientFirstStep(const TQString &, const TQByteArray *)), TQ_SLOT(sasl_clientFirstStep(const TQString &, const TQByteArray *)));
|
|
|
|
connect(sasl, SIGNAL(nextStep(const TQByteArray &)), SLOT(sasl_nextStep(const TQByteArray &)));
|
|
|
|
connect(sasl, TQ_SIGNAL(nextStep(const TQByteArray &)), TQ_SLOT(sasl_nextStep(const TQByteArray &)));
|
|
|
|
connect(sasl, SIGNAL(needParams(bool, bool, bool, bool)), SLOT(sasl_needParams(bool, bool, bool, bool)));
|
|
|
|
connect(sasl, TQ_SIGNAL(needParams(bool, bool, bool, bool)), TQ_SLOT(sasl_needParams(bool, bool, bool, bool)));
|
|
|
|
connect(sasl, SIGNAL(authenticated()), SLOT(sasl_authenticated()));
|
|
|
|
connect(sasl, TQ_SIGNAL(authenticated()), TQ_SLOT(sasl_authenticated()));
|
|
|
|
connect(sasl, SIGNAL(readyRead()), SLOT(sasl_readyRead()));
|
|
|
|
connect(sasl, TQ_SIGNAL(readyRead()), TQ_SLOT(sasl_readyRead()));
|
|
|
|
connect(sasl, SIGNAL(readyReadOutgoing(int)), SLOT(sasl_readyReadOutgoing(int)));
|
|
|
|
connect(sasl, TQ_SIGNAL(readyReadOutgoing(int)), TQ_SLOT(sasl_readyReadOutgoing(int)));
|
|
|
|
connect(sasl, SIGNAL(error(int)), SLOT(sasl_error(int)));
|
|
|
|
connect(sasl, TQ_SIGNAL(error(int)), TQ_SLOT(sasl_error(int)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
~ClientTest()
|
|
|
|
~ClientTest()
|
|
|
@ -308,14 +308,14 @@ public:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!ok()) {
|
|
|
|
if(!ok()) {
|
|
|
|
printf("Error binding to port %d!\n", port);
|
|
|
|
printf("Error binding to port %d!\n", port);
|
|
|
|
TQTimer::singleShot(0, this, SIGNAL(quit()));
|
|
|
|
TQTimer::singleShot(0, this, TQ_SIGNAL(quit()));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char myhostname[256];
|
|
|
|
char myhostname[256];
|
|
|
|
int r = gethostname(myhostname, sizeof(myhostname)-1);
|
|
|
|
int r = gethostname(myhostname, sizeof(myhostname)-1);
|
|
|
|
if(r == -1) {
|
|
|
|
if(r == -1) {
|
|
|
|
printf("Error getting hostname!\n");
|
|
|
|
printf("Error getting hostname!\n");
|
|
|
|
TQTimer::singleShot(0, this, SIGNAL(quit()));
|
|
|
|
TQTimer::singleShot(0, this, TQ_SIGNAL(quit()));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
host = myhostname;
|
|
|
|
host = myhostname;
|
|
|
@ -335,18 +335,18 @@ public:
|
|
|
|
printf("Connection received! Starting SASL handshake...\n");
|
|
|
|
printf("Connection received! Starting SASL handshake...\n");
|
|
|
|
|
|
|
|
|
|
|
|
sock = new TQSocket;
|
|
|
|
sock = new TQSocket;
|
|
|
|
connect(sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed()));
|
|
|
|
connect(sock, TQ_SIGNAL(connectionClosed()), TQ_SLOT(sock_connectionClosed()));
|
|
|
|
connect(sock, SIGNAL(readyRead()), SLOT(sock_readyRead()));
|
|
|
|
connect(sock, TQ_SIGNAL(readyRead()), TQ_SLOT(sock_readyRead()));
|
|
|
|
connect(sock, SIGNAL(error(int)), SLOT(sock_error(int)));
|
|
|
|
connect(sock, TQ_SIGNAL(error(int)), TQ_SLOT(sock_error(int)));
|
|
|
|
connect(sock, SIGNAL(bytesWritten(int)), SLOT(sock_bytesWritten(int)));
|
|
|
|
connect(sock, TQ_SIGNAL(bytesWritten(int)), TQ_SLOT(sock_bytesWritten(int)));
|
|
|
|
|
|
|
|
|
|
|
|
sasl = new QCA::SASL;
|
|
|
|
sasl = new QCA::SASL;
|
|
|
|
connect(sasl, SIGNAL(authCheck(const TQString &, const TQString &)), SLOT(sasl_authCheck(const TQString &, const TQString &)));
|
|
|
|
connect(sasl, TQ_SIGNAL(authCheck(const TQString &, const TQString &)), TQ_SLOT(sasl_authCheck(const TQString &, const TQString &)));
|
|
|
|
connect(sasl, SIGNAL(nextStep(const TQByteArray &)), SLOT(sasl_nextStep(const TQByteArray &)));
|
|
|
|
connect(sasl, TQ_SIGNAL(nextStep(const TQByteArray &)), TQ_SLOT(sasl_nextStep(const TQByteArray &)));
|
|
|
|
connect(sasl, SIGNAL(authenticated()), SLOT(sasl_authenticated()));
|
|
|
|
connect(sasl, TQ_SIGNAL(authenticated()), TQ_SLOT(sasl_authenticated()));
|
|
|
|
connect(sasl, SIGNAL(readyRead()), SLOT(sasl_readyRead()));
|
|
|
|
connect(sasl, TQ_SIGNAL(readyRead()), TQ_SLOT(sasl_readyRead()));
|
|
|
|
connect(sasl, SIGNAL(readyReadOutgoing(int)), SLOT(sasl_readyReadOutgoing(int)));
|
|
|
|
connect(sasl, TQ_SIGNAL(readyReadOutgoing(int)), TQ_SLOT(sasl_readyReadOutgoing(int)));
|
|
|
|
connect(sasl, SIGNAL(error(int)), SLOT(sasl_error(int)));
|
|
|
|
connect(sasl, TQ_SIGNAL(error(int)), TQ_SLOT(sasl_error(int)));
|
|
|
|
|
|
|
|
|
|
|
|
sock->setSocket(s);
|
|
|
|
sock->setSocket(s);
|
|
|
|
mode = 0;
|
|
|
|
mode = 0;
|
|
|
@ -598,14 +598,14 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
|
|
|
|
if(server) {
|
|
|
|
if(server) {
|
|
|
|
ServerTest *s = new ServerTest(str, PROTO_PORT);
|
|
|
|
ServerTest *s = new ServerTest(str, PROTO_PORT);
|
|
|
|
TQObject::connect(s, SIGNAL(quit()), &app, SLOT(quit()));
|
|
|
|
TQObject::connect(s, TQ_SIGNAL(quit()), &app, TQ_SLOT(quit()));
|
|
|
|
s->start();
|
|
|
|
s->start();
|
|
|
|
app.exec();
|
|
|
|
app.exec();
|
|
|
|
delete s;
|
|
|
|
delete s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
ClientTest *c = new ClientTest;
|
|
|
|
ClientTest *c = new ClientTest;
|
|
|
|
TQObject::connect(c, SIGNAL(quit()), &app, SLOT(quit()));
|
|
|
|
TQObject::connect(c, TQ_SIGNAL(quit()), &app, TQ_SLOT(quit()));
|
|
|
|
c->start(host, PROTO_PORT, user, pass);
|
|
|
|
c->start(host, PROTO_PORT, user, pass);
|
|
|
|
app.exec();
|
|
|
|
app.exec();
|
|
|
|
delete c;
|
|
|
|
delete c;
|
|
|
|