2018-04-10 23:35:16 +00:00
|
|
|
#pragma once
|
2018-04-11 00:13:37 +00:00
|
|
|
#include "Session.h"
|
|
|
|
#include "../dml/MessageManager.h"
|
2018-04-10 23:35:16 +00:00
|
|
|
|
|
|
|
namespace ki
|
|
|
|
{
|
|
|
|
namespace protocol
|
|
|
|
{
|
2018-04-11 00:16:21 +00:00
|
|
|
namespace net
|
2018-04-10 23:35:16 +00:00
|
|
|
{
|
2018-04-15 21:52:13 +00:00
|
|
|
/**
|
|
|
|
* Implements an application protocol that uses the DML
|
|
|
|
* message system (as seen in Wizard101 and Pirate101).
|
|
|
|
*/
|
|
|
|
class DMLSession : public virtual Session
|
2018-04-10 23:35:16 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-04-15 21:52:13 +00:00
|
|
|
DMLSession(uint16_t id, const dml::MessageManager &manager);
|
|
|
|
virtual ~DMLSession() = default;
|
2018-04-11 00:18:31 +00:00
|
|
|
|
2018-04-20 16:12:31 +00:00
|
|
|
const dml::MessageManager &get_manager() const;
|
|
|
|
|
2018-04-11 00:18:31 +00:00
|
|
|
void send_message(const dml::Message &message);
|
2018-04-10 23:35:16 +00:00
|
|
|
protected:
|
2018-04-11 00:16:21 +00:00
|
|
|
void on_application_message(const PacketHeader& header) override;
|
|
|
|
virtual void on_message(const dml::Message &message) {}
|
2018-04-10 23:35:16 +00:00
|
|
|
virtual void on_invalid_message() {}
|
|
|
|
private:
|
2018-04-11 00:16:21 +00:00
|
|
|
const dml::MessageManager &m_manager;
|
2018-04-10 23:35:16 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2018-04-15 21:52:13 +00:00
|
|
|
}
|