1 #ifndef ERIS_BASE_CONNECTION_H 2 #define ERIS_BASE_CONNECTION_H 4 #include "StreamSocket.h" 6 #include <Atlas/Objects/ObjectsFwd.h> 7 #include <Atlas/Negotiate.h> 9 #include <sigc++/trackable.h> 10 #include <sigc++/signal.h> 12 #include <boost/asio/io_service.hpp> 44 virtual int connectRemote(
const std::string &host,
short port);
49 virtual int connectLocal(
const std::string &socket);
70 {
return (_status == CONNECTED) || (_status == DISCONNECTING);}
78 const std::string& getHost()
const;
85 short getPort()
const;
97 BaseConnection(boost::asio::io_service& io_service,
const std::string &cnm,
const std::string &
id, Atlas::Bridge& br);
102 virtual void setStatus(Status sc);
105 virtual void onConnect();
108 virtual void handleFailure(
const std::string &msg) = 0;
110 virtual void handleTimeout(
const std::string& msg) = 0;
112 virtual void dispatch() = 0;
114 void onConnectTimeout();
115 void onNegotiateTimeout();
119 void hardDisconnect(
bool emit);
121 boost::asio::io_service& _io_service;
122 std::shared_ptr<StreamSocket> _socket;
Status
possible states for the connection
Definition: BaseConnection.h:52
std::string _clientName
the client identified used during connection
Definition: BaseConnection.h:127
connection fully established
Definition: BaseConnection.h:56
stream / socket connection in progress
Definition: BaseConnection.h:55
clean disconnection in progress
Definition: BaseConnection.h:58
Every Eris class and type lives inside the Eris namespace; certain utility functions live in the Util...
Definition: Account.cpp:34
finished disconnection
Definition: BaseConnection.h:57
const std::string _id
a unique identifier for this connection
Definition: BaseConnection.h:125
sigc::signal< void > Connected
sent on successful negotiation of a game server connection
Definition: BaseConnection.h:88
Status getStatus() const
get the current status of the connection
Definition: BaseConnection.h:65
Atlas negotiation in progress.
Definition: BaseConnection.h:54
Status _status
current status of the connection
Definition: BaseConnection.h:124
short _port
the port we're connected to
Definition: BaseConnection.h:134
bool isConnected() const
Ascertain whether or not the connection is usable for transport.
Definition: BaseConnection.h:69
Atlas::Bridge & _bridge
the connection bridge (i.e something implementing objectArrived()) : this can be the derived class it...
Definition: BaseConnection.h:131
std::string _host
the host name we're connected to
Definition: BaseConnection.h:133
Status
Definition: StreamSocket.h:57
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: BaseConnection.h:36
sigc::signal< void > Disconnected
final disconnect (or hard disocnnect) notifcation
Definition: BaseConnection.h:91
Definition: BaseConnection.h:18