2016-05-12 22:45:40 +02:00
|
|
|
/** @file
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2016, Edouard DUPIN, all right reserved
|
|
|
|
* @license APACHE v2.0 (see license file)
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-10-02 17:01:22 +02:00
|
|
|
#include <zeus/WebServer.hpp>
|
|
|
|
#include <ememory/memory.hpp>
|
2016-05-12 22:45:40 +02:00
|
|
|
|
2016-06-23 22:08:11 +02:00
|
|
|
namespace appl {
|
2016-11-23 22:03:04 +01:00
|
|
|
class Router;
|
2016-06-23 22:08:11 +02:00
|
|
|
class ClientInterface;
|
2016-11-21 22:15:46 +01:00
|
|
|
class GateWayInterface {
|
2016-06-23 22:08:11 +02:00
|
|
|
friend class appl::ClientInterface;
|
2016-05-22 22:40:42 +02:00
|
|
|
private:
|
2016-11-23 22:03:04 +01:00
|
|
|
appl::Router* m_routerInterface;
|
2016-06-23 22:08:11 +02:00
|
|
|
zeus::WebServer m_interfaceClient;
|
2016-05-12 22:45:40 +02:00
|
|
|
std::string m_name;
|
2016-11-21 22:15:46 +01:00
|
|
|
bool requestURI(const std::string& _uri);
|
2016-05-12 22:45:40 +02:00
|
|
|
public:
|
2016-11-23 22:03:04 +01:00
|
|
|
GateWayInterface(enet::Tcp _connection, appl::Router* _routerInterface);
|
2016-11-21 22:15:46 +01:00
|
|
|
virtual ~GateWayInterface();
|
2016-05-23 21:18:37 +02:00
|
|
|
void start();
|
2016-05-22 22:40:42 +02:00
|
|
|
void stop();
|
2016-07-19 22:31:27 +02:00
|
|
|
void onServiceData(ememory::SharedPtr<zeus::Buffer> _value);
|
2016-05-22 22:40:42 +02:00
|
|
|
public:
|
2016-07-19 22:31:27 +02:00
|
|
|
void SendData(uint64_t _userSessionId, ememory::SharedPtr<zeus::Buffer> _data);
|
2016-05-22 22:40:42 +02:00
|
|
|
const std::string& getName() {
|
|
|
|
return m_name;
|
|
|
|
}
|
2016-05-24 22:29:03 +02:00
|
|
|
bool isAlive();
|
2016-06-14 21:28:54 +02:00
|
|
|
protected:
|
|
|
|
void answerProtocolError(uint32_t _transactionId, const std::string& _errorHelp);
|
2016-05-12 22:45:40 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|