72 lines
1.7 KiB
C++
72 lines
1.7 KiB
C++
#ifndef MESSAGE_SENDER_H_INCLUDED
|
|
#define MESSAGE_SENDER_H_INCLUDED
|
|
|
|
|
|
#include "UserInfo.h"
|
|
|
|
|
|
struct TSignalSender
|
|
: public boost::enable_shared_from_this<TSignalSender>
|
|
{
|
|
boost::asio::ip::tcp::socket& Socket;
|
|
|
|
int MessageType;
|
|
|
|
TSignalSender(boost::asio::ip::tcp::socket& socket, int messageType);
|
|
|
|
void Send();
|
|
|
|
void Handle(const boost::system::error_code& error);
|
|
};
|
|
|
|
|
|
struct TMessageSender
|
|
: public boost::enable_shared_from_this<TMessageSender>
|
|
{
|
|
boost::asio::ip::tcp::socket& Socket;
|
|
|
|
int MessageType;
|
|
|
|
int MessageDataSize;
|
|
|
|
std::vector<char> MessageData;
|
|
|
|
TMessageSender(boost::asio::ip::tcp::socket& socket, int messageType, std::vector<char> messageData);
|
|
|
|
void Send();
|
|
|
|
void Handle(const boost::system::error_code& error);
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<char> CreateMessage(const TUserInfo& userInfo, std::string message);
|
|
|
|
void DecodeMessage(std::vector<char> msgData, TUserInfo& userInfo, std::string& message);
|
|
|
|
|
|
std::vector<char> CreateKickPlayerSignal(std::string lastName, std::string firstName, std::string middleName);
|
|
|
|
void DecodeKickPlayerSignal(std::vector<char> msgData, std::string& lastName, std::string& firstName, std::string& middleName);
|
|
|
|
|
|
|
|
|
|
std::vector<char> CreateProfileUpdateQuery(const TUserInfo& userInfo);
|
|
|
|
void DecodeProfileUpdateQuery(std::vector<char>& msgData, TUserInfo& userInfo);
|
|
|
|
|
|
std::vector<char> CreateHeartBeatQuery(const TUserInfo& userInfo);
|
|
|
|
void DecodeHeartBeatQuery(std::vector<char>& msgData, TUserInfo& userInfo);
|
|
|
|
void DecodeMapUpdateResponce(std::vector<char> msgData, std::vector<TUserInfo>& userInfoArr);
|
|
|
|
void DecodeAlarmMapUpdateResponce(std::vector<char> msgData, std::vector<TUserInfo>& userInfoArr);
|
|
|
|
|
|
#endif
|