Switching from asn.1 to protobuf as chat cleaner protocol.

This commit is contained in:
lotodore
2013-08-29 22:18:44 +02:00
parent 8adbe8edb9
commit 9686257e41
13 changed files with 3295 additions and 336 deletions
+69 -67
View File
@@ -34,7 +34,8 @@
#include <QtCore>
#include <cstdlib>
#include <string>
#include <third_party/asn1/ChatCleanerMessage.h>
#include <third_party/protobuf/chatcleaner.pb.h>
#include "messagefilter.h"
#include "cleanerconfig.h"
@@ -93,23 +94,38 @@ void CleanerServer::onRead()
bool error = bytesRead < 1;
if (!error) {
m_recvBufUsed += bytesRead;
asn_dec_rval_t retVal;
bool valid;
do {
// Try to decode the packets.
InternalChatCleanerPacket recvMsg;
retVal = ber_decode(0, &asn_DEF_ChatCleanerMessage, (void **)recvMsg.GetMsgPtr(), m_recvBuf, m_recvBufUsed);
if(retVal.code == RC_OK) {
if (retVal.consumed < m_recvBufUsed) {
m_recvBufUsed -= retVal.consumed;
memmove(m_recvBuf, m_recvBuf + retVal.consumed, m_recvBufUsed);
} else
valid = false;
if (m_recvBufUsed >= CLEANER_NET_HEADER_SIZE) {
// Read the size of the packet (first 4 bytes in network byte order).
uint32_t nativeVal;
memcpy(&nativeVal, &m_recvBuf[0], sizeof(uint32_t));
size_t packetSize = ntohl(nativeVal);
if (packetSize > MAX_CLEANER_PACKET_SIZE) {
m_recvBufUsed = 0;
// Handle the packets.
error = handleMessage(recvMsg);
qDebug() << "Invalid packet size: " << packetSize;
} else if (m_recvBufUsed >= packetSize + CLEANER_NET_HEADER_SIZE) {
try {
// Try to decode the packet.
boost::shared_ptr<ChatCleanerMessage> recvMsg(ChatCleanerMessage::default_instance().New());
if (recvMsg->ParseFromArray(&m_recvBuf[CLEANER_NET_HEADER_SIZE], static_cast<int>(packetSize))) {
m_recvBufUsed -= (packetSize + CLEANER_NET_HEADER_SIZE);
if (m_recvBufUsed) {
memmove(m_recvBuf, m_recvBuf + packetSize + CLEANER_NET_HEADER_SIZE, m_recvBufUsed);
}
}
// Handle the packet.
error = handleMessage(*recvMsg);
valid = true;
} catch (const exception &e) {
// Reset buffer on error.
m_recvBufUsed = 0;
qDebug() << "Exception while decoding packet: " << e.what();
}
}
}
} while (!error && retVal.code == RC_OK);
} while (valid && !error);
}
if (error) {
@@ -131,71 +147,58 @@ void CleanerServer::onRead()
tcpSocket->write(checkMessage.toAscii().data(), checkMessage.length());*/
}
bool CleanerServer::handleMessage(InternalChatCleanerPacket &msg)
bool CleanerServer::handleMessage(ChatCleanerMessage &msg)
{
bool error = true;
if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerInitMessage) {
CleanerInitMessage_t *netInit = &msg.GetMsg()->choice.cleanerInitMessage;
if (netInit->requestedVersion == CLEANER_PROTOCOL_VERSION) {
string tmpClientSecret((const char *)netInit->clientSecret.buf, netInit->clientSecret.size);
if (clientSecret == QString::fromStdString(tmpClientSecret)) {
if (msg.messagetype() == ChatCleanerMessage::Type_CleanerInitMessage) {
const CleanerInitMessage &netInit = msg.cleanerinitmessage();
if (netInit.requestedversion() == CLEANER_PROTOCOL_VERSION) {
if (clientSecret == QString::fromStdString(netInit.clientsecret())) {
error = false;
InternalChatCleanerPacket tmpAck;
tmpAck.GetMsg()->present = ChatCleanerMessage_PR_cleanerInitAckMessage;
CleanerInitAckMessage_t *netAck = &tmpAck.GetMsg()->choice.cleanerInitAckMessage;
netAck->serverVersion = CLEANER_PROTOCOL_VERSION;
string tmpServerSecret(serverSecret.toStdString());
OCTET_STRING_fromBuf(&netAck->serverSecret,
tmpServerSecret.c_str(),
tmpServerSecret.length());
sendMessageToClient(tmpAck);
boost::shared_ptr<ChatCleanerMessage> tmpAck(ChatCleanerMessage::default_instance().New());
tmpAck->set_messagetype(ChatCleanerMessage::Type_CleanerInitAckMessage);
CleanerInitAckMessage *netAck = tmpAck->mutable_cleanerinitackmessage();
netAck->set_serverversion(CLEANER_PROTOCOL_VERSION);
netAck->set_serversecret(serverSecret.toStdString());
sendMessageToClient(*tmpAck);
} else
qDebug() << "Invalid client secret.";
} else
qDebug() << "Invalid client version: " << netInit->requestedVersion;
} else if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerChatRequestMessage) {
qDebug() << "Invalid client version: " << netInit.requestedversion();
} else if (msg.messagetype() == ChatCleanerMessage::Type_CleanerChatRequestMessage) {
error = false;
CleanerChatRequestMessage_t *netRequest = &msg.GetMsg()->choice.cleanerChatRequestMessage;
unsigned playerId = netRequest->playerId;
QString nick(QString::fromUtf8(
string((const char *)netRequest->playerName.buf, netRequest->playerName.size).c_str()));
QString message(QString::fromUtf8(
string((const char *)netRequest->chatMessage.buf, netRequest->chatMessage.size).c_str()));
unsigned gameId = 0;
if (netRequest->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeGame) {
gameId = netRequest->cleanerChatType.choice.cleanerChatTypeGame.gameId;
}
const CleanerChatRequestMessage &netRequest = msg.cleanerchatrequestmessage();
unsigned playerId = netRequest.playerid();
QString nick(QString::fromUtf8(netRequest.playername().c_str()));
QString message(QString::fromUtf8(netRequest.chatmessage().c_str()));
unsigned gameId = netRequest.gameid();
QStringList checkreturn = myMessageFilter->check(gameId, playerId, nick, message);
QString checkAction = checkreturn.at(0);
QString checkMessage = checkreturn.at(1);
if (!checkAction.isEmpty()) {
InternalChatCleanerPacket tmpReply;
tmpReply.GetMsg()->present = ChatCleanerMessage_PR_cleanerChatReplyMessage;
CleanerChatReplyMessage_t *netReply = &tmpReply.GetMsg()->choice.cleanerChatReplyMessage;
netReply->requestId = netRequest->requestId;
netReply->cleanerChatType = netRequest->cleanerChatType;
netReply->playerId = netRequest->playerId;
boost::shared_ptr<ChatCleanerMessage> tmpReply(ChatCleanerMessage::default_instance().New());
tmpReply->set_messagetype(ChatCleanerMessage::Type_CleanerChatReplyMessage);
CleanerChatReplyMessage *netReply = tmpReply->mutable_cleanerchatreplymessage();
netReply->set_requestid(netRequest.requestid());
netReply->set_gameid(netRequest.gameid());
netReply->set_cleanerchattype(netRequest.cleanerchattype());
netReply->set_playerid(netRequest.playerid());
if(checkAction == "warn") {
netReply->cleanerActionType = cleanerActionType_cleanerActionWarning;
netReply->set_cleaneractiontype(CleanerChatReplyMessage_CleanerActionType_cleanerActionWarning);
} else if (checkAction == "kick") {
netReply->cleanerActionType = cleanerActionType_cleanerActionKick;
netReply->set_cleaneractiontype(CleanerChatReplyMessage_CleanerActionType_cleanerActionKick);
} else if (checkAction == "kickban") {
netReply->cleanerActionType = cleanerActionType_cleanerActionBan;
netReply->set_cleaneractiontype(CleanerChatReplyMessage_CleanerActionType_cleanerActionBan);
} else if (checkAction == "mute") {
netReply->cleanerActionType = cleanerActionType_cleanerActionMute;
netReply->set_cleaneractiontype(CleanerChatReplyMessage_CleanerActionType_cleanerActionMute);
}
string tmpCheck(checkMessage.toUtf8());
netReply->cleanerText =
OCTET_STRING_new_fromBuf(
&asn_DEF_OCTET_STRING,
(const char *)tmpCheck.c_str(),
tmpCheck.length());
sendMessageToClient(tmpReply);
netReply->set_cleanertext(checkMessage.toUtf8());
sendMessageToClient(*tmpReply);
}
}
return error;
@@ -220,14 +223,13 @@ void CleanerServer::refreshConfig()
myMessageFilter->refreshConfig();
}
void CleanerServer::sendMessageToClient(InternalChatCleanerPacket &msg)
void CleanerServer::sendMessageToClient(ChatCleanerMessage &msg)
{
unsigned char buf[MAX_CLEANER_PACKET_SIZE];
asn_enc_rval_t e = der_encode_to_buffer(&asn_DEF_ChatCleanerMessage, msg.GetMsg(), buf, MAX_CLEANER_PACKET_SIZE);
if (e.encoded == -1)
qDebug() << "Failed to encode chat cleaner packet: " << msg.GetMsg()->present;
else
tcpSocket->write((const char *)buf, e.encoded);
uint32_t packetSize = msg.ByteSize();
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize + CLEANER_NET_HEADER_SIZE];
*((uint32_t *)buf) = htonl(packetSize);
msg.SerializeWithCachedSizesToArray(&buf[CLEANER_NET_HEADER_SIZE]);
tcpSocket->write((const char *)buf, packetSize + CLEANER_NET_HEADER_SIZE);
delete[] buf;
}
+8 -4
View File
@@ -33,10 +33,14 @@
#include <QtCore>
#include <QtNetwork>
#include <net/internalchatcleanerpacket.h>
#define CLEANER_NET_HEADER_SIZE 4
#define MAX_CLEANER_PACKET_SIZE 512
#define CLEANER_PROTOCOL_VERSION 2
class MessageFilter;
class CleanerConfig;
class ChatCleanerMessage;
class CleanerServer: public QObject
{
@@ -49,10 +53,10 @@ public:
private slots:
void newCon();
void onRead();
bool handleMessage(InternalChatCleanerPacket &msg);
bool handleMessage(ChatCleanerMessage &msg);
void socketStateChanged(QAbstractSocket::SocketState);
void refreshConfig();
void sendMessageToClient(InternalChatCleanerPacket &msg);
void sendMessageToClient(ChatCleanerMessage &msg);
private:
QTcpServer *tcpServer;
@@ -66,7 +70,7 @@ private:
QString serverSecret;
unsigned char m_recvBuf[2*MAX_CLEANER_PACKET_SIZE];
unsigned m_recvBufUsed;
size_t m_recvBufUsed;
int secondsSinceLastConfigChange;
};
+7 -3
View File
@@ -37,9 +37,13 @@
#include <boost/enable_shared_from_this.hpp>
#include <string>
#include <net/chatcleanercallback.h>
#include <net/internalchatcleanerpacket.h>
#define CLEANER_NET_HEADER_SIZE 4
#define MAX_CLEANER_PACKET_SIZE 512
#define CLEANER_PROTOCOL_VERSION 2
class SendBuffer;
class ChatCleanerMessage;
class ChatCleanerManager : public boost::enable_shared_from_this<ChatCleanerManager>
{
@@ -58,9 +62,9 @@ protected:
void HandleResolve(const boost::system::error_code& ec, boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
void HandleConnect(const boost::system::error_code& ec, boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
void HandleRead(const boost::system::error_code &ec, size_t bytesRead);
bool HandleMessage(InternalChatCleanerPacket &msg);
bool HandleMessage(ChatCleanerMessage &msg);
void SendMessageToServer(InternalChatCleanerPacket &msg);
void SendMessageToServer(ChatCleanerMessage &msg);
unsigned GetNextRequestId();
private:
+73 -65
View File
@@ -33,7 +33,7 @@
#include <net/sendbuffer.h>
#include <boost/bind.hpp>
#include <core/loghelper.h>
#include <third_party/asn1/ChatCleanerMessage.h>
#include <third_party/protobuf/chatcleaner.pb.h>
#include <sstream>
@@ -98,24 +98,20 @@ void
ChatCleanerManager::HandleGameChatText(unsigned gameId, unsigned playerId, const std::string &name, const std::string &text)
{
if (m_connected) {
InternalChatCleanerPacket tmpChat;
tmpChat.GetMsg()->present = ChatCleanerMessage_PR_cleanerChatRequestMessage;
CleanerChatRequestMessage_t *netRequest = &tmpChat.GetMsg()->choice.cleanerChatRequestMessage;
netRequest->requestId = GetNextRequestId();
boost::shared_ptr<ChatCleanerMessage> tmpChat(ChatCleanerMessage::default_instance().New());
tmpChat->set_messagetype(ChatCleanerMessage::Type_CleanerChatRequestMessage);
CleanerChatRequestMessage *netRequest = tmpChat->mutable_cleanerchatrequestmessage();
netRequest->set_requestid(GetNextRequestId());
if (gameId) {
netRequest->cleanerChatType.present = CleanerChatType_PR_cleanerChatTypeGame;
netRequest->cleanerChatType.choice.cleanerChatTypeGame.gameId = gameId;
netRequest->set_cleanerchattype(cleanerChatTypeGame);
netRequest->set_gameid(gameId);
} else {
netRequest->cleanerChatType.present = CleanerChatType_PR_cleanerChatTypeLobby;
netRequest->set_cleanerchattype(cleanerChatTypeLobby);
}
netRequest->playerId = playerId;
OCTET_STRING_fromBuf(&netRequest->playerName,
name.c_str(),
(int)name.length());
OCTET_STRING_fromBuf(&netRequest->chatMessage,
text.c_str(),
(int)text.length());
SendMessageToServer(tmpChat);
netRequest->set_playerid(playerId);
netRequest->set_playername(name);
netRequest->set_chatmessage(text);
SendMessageToServer(*tmpChat);
}
}
@@ -141,14 +137,12 @@ ChatCleanerManager::HandleConnect(const boost::system::error_code& ec,
boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
{
if (!ec) {
InternalChatCleanerPacket tmpInit;
tmpInit.GetMsg()->present = ChatCleanerMessage_PR_cleanerInitMessage;
CleanerInitMessage_t *netInit = &tmpInit.GetMsg()->choice.cleanerInitMessage;
netInit->requestedVersion = CLEANER_PROTOCOL_VERSION;
OCTET_STRING_fromBuf(&netInit->clientSecret,
m_clientSecret.c_str(),
(int)m_clientSecret.length());
SendMessageToServer(tmpInit);
boost::shared_ptr<ChatCleanerMessage> tmpInit(ChatCleanerMessage::default_instance().New());
tmpInit->set_messagetype(ChatCleanerMessage::Type_CleanerInitMessage);
CleanerInitMessage *netInit = tmpInit->mutable_cleanerinitmessage();
netInit->set_requestedversion(CLEANER_PROTOCOL_VERSION);
netInit->set_clientsecret(m_clientSecret);
SendMessageToServer(*tmpInit);
m_socket->async_read_some(
boost::asio::buffer(m_recvBuf, sizeof(m_recvBuf)),
boost::bind(
@@ -180,24 +174,38 @@ ChatCleanerManager::HandleRead(const boost::system::error_code &ec, size_t bytes
bool error = false;
m_recvBufUsed += bytesRead;
asn_dec_rval_t retVal;
bool valid;
do {
InternalChatCleanerPacket recvMsg;
retVal = ber_decode(0, &asn_DEF_ChatCleanerMessage, (void **)recvMsg.GetMsgPtr(), m_recvBuf, m_recvBufUsed);
if(retVal.code == RC_OK) {
// Consume the bytes.
if (retVal.consumed < m_recvBufUsed) {
m_recvBufUsed -= retVal.consumed;
memmove(m_recvBuf, m_recvBuf + retVal.consumed, m_recvBufUsed);
} else
valid = false;
if (m_recvBufUsed >= CLEANER_NET_HEADER_SIZE) {
// Read the size of the packet (first 4 bytes in network byte order).
uint32_t nativeVal;
memcpy(&nativeVal, &m_recvBuf[0], sizeof(uint32_t));
size_t packetSize = ntohl(nativeVal);
if (packetSize > MAX_CLEANER_PACKET_SIZE) {
m_recvBufUsed = 0;
if (asn_check_constraints(&asn_DEF_ChatCleanerMessage, recvMsg.GetMsg(), NULL, NULL) == 0)
error = HandleMessage(recvMsg);
else
LOG_ERROR("Received invalid chat cleaner packet.");
LOG_ERROR("Invalid packet size: " << packetSize);
} else if (m_recvBufUsed >= packetSize + CLEANER_NET_HEADER_SIZE) {
try {
// Try to decode the packet.
boost::shared_ptr<ChatCleanerMessage> recvMsg(ChatCleanerMessage::default_instance().New());
if (recvMsg->ParseFromArray(&m_recvBuf[CLEANER_NET_HEADER_SIZE], static_cast<int>(packetSize))) {
m_recvBufUsed -= (packetSize + CLEANER_NET_HEADER_SIZE);
if (m_recvBufUsed) {
memmove(m_recvBuf, m_recvBuf + packetSize + CLEANER_NET_HEADER_SIZE, m_recvBufUsed);
}
}
// Handle the packet.
error = HandleMessage(*recvMsg);
valid = true;
} catch (const exception &e) {
// Reset buffer on error.
m_recvBufUsed = 0;
LOG_ERROR("Exception while decoding packet: " << e.what());
}
}
}
} while (!error && retVal.code == RC_OK);
} while (valid && !error);
if (!error) {
m_socket->async_read_some(
@@ -224,14 +232,13 @@ ChatCleanerManager::HandleRead(const boost::system::error_code &ec, size_t bytes
}
bool
ChatCleanerManager::HandleMessage(InternalChatCleanerPacket &msg)
ChatCleanerManager::HandleMessage(ChatCleanerMessage &msg)
{
bool error = true;
if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerInitAckMessage) {
CleanerInitAckMessage_t *netAck = &msg.GetMsg()->choice.cleanerInitAckMessage;
if (netAck->serverVersion == CLEANER_PROTOCOL_VERSION) {
string tmpSecret((const char *)netAck->serverSecret.buf, netAck->serverSecret.size);
if (m_serverSecret == tmpSecret) {
if (msg.messagetype() == ChatCleanerMessage::Type_CleanerInitAckMessage) {
const CleanerInitAckMessage &netAck = msg.cleanerinitackmessage();
if (netAck.serverversion() == CLEANER_PROTOCOL_VERSION) {
if (m_serverSecret == netAck.serversecret()) {
m_connected = true;
error = false;
LOG_MSG("Successfully connected to chat cleaner.");
@@ -239,36 +246,37 @@ ChatCleanerManager::HandleMessage(InternalChatCleanerPacket &msg)
}
if (!m_connected)
LOG_ERROR("Chat cleaner handshake failed.");
} else if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerChatReplyMessage) {
CleanerChatReplyMessage_t *netReply = &msg.GetMsg()->choice.cleanerChatReplyMessage;
if (netReply->cleanerText) {
if (netReply->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeLobby) {
m_callback.SignalChatBotMessage(string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size));
} else if (netReply->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeGame) {
m_callback.SignalChatBotMessage(netReply->cleanerChatType.choice.cleanerChatTypeGame.gameId, string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size));
} else if (msg.messagetype() == ChatCleanerMessage::Type_CleanerChatReplyMessage) {
const CleanerChatReplyMessage &netReply = msg.cleanerchatreplymessage();
if (!netReply.cleanertext().empty()) {
if (netReply.cleanerchattype() == cleanerChatTypeLobby) {
m_callback.SignalChatBotMessage(netReply.cleanertext());
} else if (netReply.cleanerchattype() == cleanerChatTypeGame) {
m_callback.SignalChatBotMessage(netReply.gameid(), netReply.cleanertext());
}
}
if (netReply->cleanerActionType == cleanerActionType_cleanerActionKick)
m_callback.SignalKickPlayer(netReply->playerId);
else if (netReply->cleanerActionType == cleanerActionType_cleanerActionBan)
m_callback.SignalBanPlayer(netReply->playerId);
else if (netReply->cleanerActionType == cleanerActionType_cleanerActionMute)
m_callback.SignalMutePlayer(netReply->playerId);
if (netReply.cleaneractiontype() == CleanerChatReplyMessage_CleanerActionType_cleanerActionKick)
m_callback.SignalKickPlayer(netReply.playerid());
else if (netReply.cleaneractiontype() == CleanerChatReplyMessage_CleanerActionType_cleanerActionBan)
m_callback.SignalBanPlayer(netReply.playerid());
else if (netReply.cleaneractiontype() == CleanerChatReplyMessage_CleanerActionType_cleanerActionMute)
m_callback.SignalMutePlayer(netReply.playerid());
error = false;
}
return error;
}
void
ChatCleanerManager::SendMessageToServer(InternalChatCleanerPacket &msg)
ChatCleanerManager::SendMessageToServer(ChatCleanerMessage &msg)
{
asn_enc_rval_t e = der_encode(&asn_DEF_ChatCleanerMessage, msg.GetMsg(), &SendBuffer::EncodeToBuf, m_sendManager.get());
uint32_t packetSize = msg.ByteSize();
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize + CLEANER_NET_HEADER_SIZE];
*((uint32_t *)buf) = htonl(packetSize);
msg.SerializeWithCachedSizesToArray(&buf[CLEANER_NET_HEADER_SIZE]);
SendBuffer::EncodeToBuf(buf, packetSize + CLEANER_NET_HEADER_SIZE, m_sendManager.get());
delete[] buf;
if (e.encoded == -1)
LOG_ERROR("Failed to encode chat cleaner packet: " << msg.GetMsg()->present);
else {
m_sendManager->AsyncSendNextPacket(m_socket);
}
m_sendManager->AsyncSendNextPacket(m_socket);
}
unsigned
@@ -1,47 +0,0 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
#include <net/internalchatcleanerpacket.h>
#include <third_party/asn1/ChatCleanerMessage.h>
#include <cstring>
using namespace std;
InternalChatCleanerPacket::InternalChatCleanerPacket()
{
m_msg = (ChatCleanerMessage_t *)calloc(1, sizeof(ChatCleanerMessage_t));
}
InternalChatCleanerPacket::~InternalChatCleanerPacket()
{
ASN_STRUCT_FREE(asn_DEF_ChatCleanerMessage, m_msg);
}
-62
View File
@@ -1,62 +0,0 @@
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* *
* Additional permission under GNU AGPL version 3 section 7 *
* *
* If you modify this program, or any covered work, by linking or *
* combining it with the OpenSSL project's OpenSSL library (or a *
* modified version of that library), containing parts covered by the *
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
* permission to convey the resulting work. *
* Corresponding Source for a non-source form of such a combination *
* shall include the source code for the parts of OpenSSL used as well *
* as that of the covered work. *
*****************************************************************************/
/* PokerTH chat cleaner packet. */
#ifndef _INTERNALCHATCLEANERPACKET_H_
#define _INTERNALCHATCLEANERPACKET_H_
#define CLEANER_PROTOCOL_VERSION 2
#define MAX_CLEANER_PACKET_SIZE 384
typedef struct ChatCleanerMessage ChatCleanerMessage_t;
class InternalChatCleanerPacket
{
public:
InternalChatCleanerPacket();
InternalChatCleanerPacket(ChatCleanerMessage_t *msg)
: m_msg(msg) {
}
~InternalChatCleanerPacket();
ChatCleanerMessage_t *GetMsg() {
return m_msg;
}
ChatCleanerMessage_t **GetMsgPtr() {
return &m_msg;
}
private:
ChatCleanerMessage_t *m_msg;
};
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff