2010-12-06 23:12:51 +00:00
|
|
|
// Cyphesis Online RPG Server and AI Engine
|
|
|
|
|
// Copyright (C) 2010 Alistair Riddoch
|
|
|
|
|
//
|
|
|
|
|
// This program 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 2 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program 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, write to the Free Software Foundation,
|
|
|
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
|
|
|
2011-02-15 09:30:46 +00:00
|
|
|
#ifdef NDEBUG
|
|
|
|
|
#undef NDEBUG
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef DEBUG
|
|
|
|
|
#define DEBUG
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
#include "server/Juncture.h"
|
|
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
#include "server/CommPeer.h"
|
|
|
|
|
#include "server/Connection.h"
|
|
|
|
|
#include "server/Peer.h"
|
|
|
|
|
#include "server/ServerRouting.h"
|
2014-02-03 12:19:42 +01:00
|
|
|
#include "server/CommAsioClient_impl.h"
|
2010-12-06 23:12:51 +00:00
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
#include "common/Connect.h"
|
2014-02-03 12:19:42 +01:00
|
|
|
#include "common/CommSocket.h"
|
2012-08-01 21:13:14 +01:00
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
#include <Atlas/Objects/Operation.h>
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
class BaseWorld;
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
class StubSocket : public CommSocket
|
|
|
|
|
{
|
2012-08-01 21:13:14 +01:00
|
|
|
public:
|
2014-02-04 11:16:21 +01:00
|
|
|
StubSocket(boost::asio::io_service& io_service) : CommSocket(io_service)
|
2014-02-03 12:19:42 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void disconnect()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int flush()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
};
|
|
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
// Test class to expose protected methods.
|
|
|
|
|
class TestJuncture : public Juncture
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TestJuncture(Connection * c = 0) : Juncture(c, "1", 1) { }
|
|
|
|
|
|
|
|
|
|
void test_onPeerLost() { onPeerLost(); }
|
|
|
|
|
void test_onPeerReplied(const Operation & op) { onPeerReplied(op); }
|
|
|
|
|
|
|
|
|
|
void test_addPeer(Peer * p) { m_peer = p; }
|
2014-02-03 12:19:42 +01:00
|
|
|
// void test_addSocket(CommPeer * cp) { m_socket = cp; }
|
2010-12-09 15:40:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int stub_CommPeer_connect_return = 0;
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
2010-12-09 15:40:20 +00:00
|
|
|
Operation op;
|
2010-12-06 23:12:51 +00:00
|
|
|
j->operation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Atlas::Objects::Operation::Login op;
|
|
|
|
|
j->operation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
// Login op, no args
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Operation op;
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, empty arg
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, username in arg
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, bad username in arg
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", 0x69e362c6);
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, username & password in arg
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
|
|
|
|
|
arg->setAttr("password", "a12a2f3a-03a4-11e0-8379-001ec93e7c08");
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, username & bad password in arg
|
2010-12-06 23:12:51 +00:00
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
2010-12-09 15:40:20 +00:00
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
|
2010-12-09 16:33:05 +00:00
|
|
|
arg->setAttr("password", 0x12a2f3aL);
|
2010-12-09 15:40:20 +00:00
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, username & password in arg, connected
|
|
|
|
|
{
|
|
|
|
|
ServerRouting sr(*(BaseWorld*)0, "", "", "2", 2, "3", 3);
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
2014-02-04 11:16:21 +01:00
|
|
|
boost::asio::io_service io_service;
|
|
|
|
|
CommPeer * cp = new CommPeer("", io_service);
|
2012-07-19 22:58:30 +01:00
|
|
|
j->test_addPeer(new Peer(*cp, sr, "", 6767, "4", 4));
|
2010-12-09 15:40:20 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
|
|
|
|
|
arg->setAttr("password", "a12a2f3a-03a4-11e0-8379-001ec93e7c08");
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, username & password in arg, connected already authenticating
|
|
|
|
|
{
|
|
|
|
|
ServerRouting sr(*(BaseWorld*)0, "", "", "2", 2, "3", 3);
|
|
|
|
|
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
2014-02-04 11:16:21 +01:00
|
|
|
boost::asio::io_service io_service;
|
|
|
|
|
CommPeer * cp = new CommPeer("", io_service);
|
2012-07-19 22:58:30 +01:00
|
|
|
Peer * p = new Peer(*cp, sr, "", 6767, "4", 4);
|
2010-12-09 15:40:20 +00:00
|
|
|
j->test_addPeer(p);
|
|
|
|
|
|
|
|
|
|
p->setAuthState(PEER_AUTHENTICATING);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
|
|
|
|
|
arg->setAttr("password", "a12a2f3a-03a4-11e0-8379-001ec93e7c08");
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Login op, username & password in arg, connected, with serialno
|
|
|
|
|
{
|
|
|
|
|
ServerRouting sr(*(BaseWorld*)0, "", "", "2", 2, "3", 3);
|
|
|
|
|
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
2014-02-04 11:16:21 +01:00
|
|
|
boost::asio::io_service io_service;
|
|
|
|
|
CommPeer * cp = new CommPeer("", io_service);
|
2012-07-19 22:58:30 +01:00
|
|
|
j->test_addPeer(new Peer(*cp, sr, "", 6767, "4", 4));
|
2010-12-09 15:40:20 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
|
|
|
|
|
arg->setAttr("password", "a12a2f3a-03a4-11e0-8379-001ec93e7c08");
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
op->setSerialno(0x6dc5b5eaL);
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
j->LoginOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
2010-12-09 15:40:20 +00:00
|
|
|
Operation op;
|
2010-12-06 23:12:51 +00:00
|
|
|
j->OtherOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Atlas::Objects::Operation::Connect op;
|
|
|
|
|
j->OtherOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
// Connect op, no args
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Operation op;
|
|
|
|
|
j->customConnectOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Connect op, no args, already connected
|
|
|
|
|
{
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
2012-07-19 22:58:30 +01:00
|
|
|
j->test_addPeer(new Peer(*(CommPeer*)0, *(ServerRouting*)0, "", 6767, "4", 4));
|
2010-12-09 15:40:20 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Operation op;
|
|
|
|
|
j->customConnectOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Connect op, hostname in arg
|
2010-12-06 23:12:51 +00:00
|
|
|
{
|
2010-12-07 23:56:38 +00:00
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
2010-12-06 23:12:51 +00:00
|
|
|
|
|
|
|
|
OpVector res;
|
2010-12-09 15:40:20 +00:00
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("hostname", "3752ca4a-03a9-11e0-bd8a-001ec93e7c08");
|
|
|
|
|
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
j->customConnectOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
// Connect op, bad hostname in arg
|
|
|
|
|
{
|
|
|
|
|
Juncture * j = new Juncture(0, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("hostname", 0x3752ca4aL);
|
|
|
|
|
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->customConnectOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Connect op, hostname and port in arg, connected this end
|
|
|
|
|
{
|
|
|
|
|
ServerRouting sr(*(BaseWorld*)0, "", "", "2", 2, "3", 3);
|
2014-02-04 11:16:21 +01:00
|
|
|
boost::asio::io_service io_service;
|
|
|
|
|
CommSocket * cc = new StubSocket(io_service);
|
2010-12-09 15:40:20 +00:00
|
|
|
Connection * c = new Connection(*cc, sr, "", "4", 4);
|
|
|
|
|
|
|
|
|
|
Juncture * j = new Juncture(c, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("hostname", "3752ca4a-03a9-11e0-bd8a-001ec93e7c08");
|
|
|
|
|
arg->setAttr("port", 0x03a9);
|
|
|
|
|
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->customConnectOperation(op, res);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Connect op, hostname and port in arg, connected this end, connect fails
|
|
|
|
|
{
|
|
|
|
|
stub_CommPeer_connect_return = -1;
|
|
|
|
|
|
|
|
|
|
ServerRouting sr(*(BaseWorld*)0, "", "", "2", 2, "3", 3);
|
2014-02-04 11:16:21 +01:00
|
|
|
boost::asio::io_service io_service;
|
|
|
|
|
CommSocket * cc = new StubSocket(io_service);
|
2010-12-09 15:40:20 +00:00
|
|
|
Connection * c = new Connection(*cc, sr, "", "4", 4);
|
|
|
|
|
|
|
|
|
|
Juncture * j = new Juncture(c, "1", 1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
|
|
|
|
Operation op;
|
|
|
|
|
Atlas::Objects::Root arg;
|
|
|
|
|
arg->setAttr("hostname", "3752ca4a-03a9-11e0-bd8a-001ec93e7c08");
|
|
|
|
|
arg->setAttr("port", 0x03a9);
|
|
|
|
|
|
|
|
|
|
op->setArgs1(arg);
|
|
|
|
|
|
|
|
|
|
j->customConnectOperation(op, res);
|
|
|
|
|
|
|
|
|
|
stub_CommPeer_connect_return = 0;
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Teleport unconnected
|
|
|
|
|
{
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
|
|
|
|
j->teleportEntity(0);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Teleport connected
|
|
|
|
|
{
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
2012-07-19 22:58:30 +01:00
|
|
|
j->test_addPeer(new Peer(*(CommPeer*)0, *(ServerRouting*)0, "", 6767, "4", 4));
|
2010-12-09 15:40:20 +00:00
|
|
|
j->teleportEntity(0);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
|
|
|
|
j->test_onPeerLost();
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Peer replied, unconnected this end
|
|
|
|
|
{
|
|
|
|
|
TestJuncture * j = new TestJuncture(0);
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
j->test_onPeerReplied(op);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Peer replied, connected this end
|
|
|
|
|
{
|
2012-08-01 21:13:14 +01:00
|
|
|
Connection * c = new Connection(*(CommSocket*)0,
|
2010-12-09 15:40:20 +00:00
|
|
|
*(ServerRouting*)0, "", "4", 4);
|
|
|
|
|
|
|
|
|
|
TestJuncture * j = new TestJuncture(c);
|
|
|
|
|
|
|
|
|
|
Operation op;
|
|
|
|
|
j->test_onPeerReplied(op);
|
|
|
|
|
|
|
|
|
|
delete j;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// stubs
|
|
|
|
|
|
|
|
|
|
#include "common/log.h"
|
|
|
|
|
|
2010-12-07 23:56:38 +00:00
|
|
|
#include <Atlas/Negotiate.h>
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
namespace Atlas { namespace Objects { namespace Operation {
|
|
|
|
|
|
|
|
|
|
int CONNECT_NO = 500;
|
|
|
|
|
|
|
|
|
|
} } }
|
|
|
|
|
|
2010-12-09 15:40:20 +00:00
|
|
|
ServerRouting::ServerRouting(BaseWorld & wrld,
|
|
|
|
|
const std::string & ruleset,
|
|
|
|
|
const std::string & name,
|
|
|
|
|
const std::string & id, long intId,
|
|
|
|
|
const std::string & lId, long lIntId) :
|
|
|
|
|
Router(id, intId),
|
|
|
|
|
m_svrRuleset(ruleset), m_svrName(name),
|
|
|
|
|
m_numClients(0), m_world(wrld), m_lobby(*(Lobby*)0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ServerRouting::~ServerRouting()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addToMessage(Atlas::Message::MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void ServerRouting::externalOperation(const Operation & op, Link &)
|
2012-11-14 00:12:02 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::operation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
2010-12-09 15:40:20 +00:00
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
CommPeer::CommPeer(const std::string & n, boost::asio::io_service& svr) :
|
|
|
|
|
CommAsioClient<boost::asio::ip::tcp> (n, svr), m_auth_timer(svr)
|
2010-12-07 23:56:38 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommPeer::~CommPeer()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
void CommPeer::setup(Link * connection)
|
2010-12-07 23:56:38 +00:00
|
|
|
{
|
2010-12-09 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
void CommPeer::connect(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&)
|
2010-12-07 23:56:38 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
CommSocket::CommSocket(boost::asio::io_service& svr) : m_io_service(svr) { }
|
2010-12-07 23:56:38 +00:00
|
|
|
|
|
|
|
|
CommSocket::~CommSocket()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
int CommSocket::flush()
|
2010-12-07 23:56:38 +00:00
|
|
|
{
|
2012-08-01 21:13:14 +01:00
|
|
|
return 0;
|
2010-12-07 23:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
Peer::Peer(CommSocket & client,
|
2010-12-07 23:56:38 +00:00
|
|
|
ServerRouting & svr,
|
|
|
|
|
const std::string & addr,
|
2012-07-19 22:58:30 +01:00
|
|
|
int port,
|
2010-12-07 23:56:38 +00:00
|
|
|
const std::string & id, long iid) :
|
2012-08-01 21:13:14 +01:00
|
|
|
Link(client, id, iid),
|
2010-12-07 23:56:38 +00:00
|
|
|
m_state(PEER_INIT),
|
|
|
|
|
m_server(svr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Peer::~Peer()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerAuthState Peer::getAuthState()
|
|
|
|
|
{
|
|
|
|
|
return m_state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Peer::setAuthState(PeerAuthState state)
|
|
|
|
|
{
|
|
|
|
|
m_state = state;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void Peer::externalOperation(const Operation & op, Link &)
|
2012-11-13 23:33:23 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-07 23:56:38 +00:00
|
|
|
void Peer::operation(const Operation &op, OpVector &res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
int Peer::teleportEntity(const LocatedEntity * ent)
|
2010-12-07 23:56:38 +00:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Peer::cleanTeleports()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
Connection::Connection(CommSocket & client,
|
2010-12-07 23:56:38 +00:00
|
|
|
ServerRouting & svr,
|
|
|
|
|
const std::string & addr,
|
|
|
|
|
const std::string & id, long iid) :
|
2012-08-01 21:13:14 +01:00
|
|
|
Link(client, id, iid), m_obsolete(false),
|
2010-12-07 23:56:38 +00:00
|
|
|
m_server(svr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Account * Connection::newAccount(const std::string & type,
|
|
|
|
|
const std::string & username,
|
|
|
|
|
const std::string & passwd,
|
|
|
|
|
const std::string & id, long intId)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Connection::verifyCredentials(const Account &,
|
|
|
|
|
const Atlas::Objects::Root &) const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Connection::~Connection()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void Connection::externalOperation(const Operation & op, Link &)
|
2012-11-13 23:33:23 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-07 23:56:38 +00:00
|
|
|
void Connection::operation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connection::LoginOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connection::LogoutOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connection::CreateOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connection::GetOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter::ConnectableRouter(const std::string & id,
|
2010-12-13 14:54:47 +00:00
|
|
|
long iid,
|
|
|
|
|
Connection *c) :
|
|
|
|
|
Router(id, iid),
|
|
|
|
|
m_connection(c)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter::~ConnectableRouter()
|
2010-12-13 14:54:47 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 21:13:14 +01:00
|
|
|
Link::Link(CommSocket & socket, const std::string & id, long iid) :
|
|
|
|
|
Router(id, iid), m_encoder(0), m_commSocket(socket)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Link::~Link()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Link::send(const Operation & op) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Link::disconnect()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
Router::Router(const std::string & id, long intId) : m_id(id),
|
|
|
|
|
m_intId(intId)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Router::~Router()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToMessage(Atlas::Message::MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 23:34:58 +00:00
|
|
|
void Router::error(const Operation & op,
|
|
|
|
|
const std::string & errstring,
|
|
|
|
|
OpVector & res,
|
|
|
|
|
const std::string & to) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 23:12:51 +00:00
|
|
|
void log(LogLevel lvl, const std::string & msg)
|
|
|
|
|
{
|
|
|
|
|
}
|
2012-10-25 10:40:59 -04:00
|
|
|
|
|
|
|
|
#include <common/Shaker.h>
|
|
|
|
|
|
|
|
|
|
Shaker::Shaker()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string Shaker::generateSalt(size_t length)
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|