24 #ifndef CCONNECTION_HPP
25 #define CCONNECTION_HPP
33 #include <boost/noncopyable.hpp>
50 :
virtual std::runtime_error
53 : std::runtime_error(what) { }
58 :
private boost::noncopyable
65 CConnection(std::string uuid, boost::asio::ip::udp::endpoint endpoint);
77 void Send(
const ModuleMessage& msg);
83 bool Receive(
const ProtocolMessage& msg);
110 #endif // CCONNECTION_HPP
void ReceiveACK(const ProtocolMessage &msg)
Handles acknowledgement messages from the peer.
Definition: CConnection.cpp:139
Used for errors communicating with peers.
Definition: CConnection.hpp:49
boost::shared_ptr< CConnection > ConnectionPtr
Definition: CConnection.hpp:105
void ChangePhase(bool newround)
Allows protocols to peform an action when a phase ends.
Definition: CConnection.cpp:99
Represents a single outgoing connection to a client.
Definition: CConnection.hpp:57
boost::shared_ptr< IProtocol > m_protocol
The network protocol to use for sending/receiving messages.
Definition: CConnection.hpp:102
int GetReliability() const
Get the connection reliability for DCUSTOMNETWORK.
Definition: CConnection.cpp:213
std::string GetUUID() const
Gets the UUID of the peer for this connection.
Definition: CConnection.cpp:184
bool GetStopped()
Tests to see if the protocol is stopped.
Definition: CConnection.cpp:85
EConnectionError(const std::string &what)
Definition: CConnection.hpp:52
boost::shared_ptr< CConnection > ConnectionPtr
Definition: CConnection.hpp:62
void SetReliability(int r)
Set the connection reliability for DCUSTOMNETWORK.
Definition: CConnection.cpp:199
CConnection(std::string uuid, boost::asio::ip::udp::endpoint endpoint)
Construct a CConnection to a peer.
Definition: CConnection.cpp:54
~CConnection()
Destructor.
Definition: CConnection.cpp:63
void OnReceive()
Performs an action based on receiving a Protocol Message Window.
Definition: CConnection.cpp:172
bool Receive(const ProtocolMessage &msg)
Handles messages from the peer.
Definition: CConnection.cpp:152
void Stop()
Stop all asynchronous operations associated with the CConnection.
Definition: CConnection.cpp:74
void Send(const ModuleMessage &msg)
Puts a message into the channel.
Definition: CConnection.cpp:113