Files
VoidNet/include/NetworkMessage.hpp
xX-TheDoctor-Xx 0ac8b4f6e8 Added Handshake class
Fixed NetworkBuffer include
Fixed some data types
TcpClient: Added SendBytes, SetOnDisconnectCallback, SetOnConnectCallback, SetOnMessageCallback methods and made callback std::function's private and fixed some method implementations
Added AcceptConnection on TcpServer
Fixed TcpServer AddToClientsList
2016-08-01 00:28:22 +01:00

36 lines
707 B
C++

#ifndef NETWORK_MESSAGE_HPP
#define NETWORK_MESSAGE_HPP
#ifdef _MSC_VER
#pragma once
#endif
#include "Defs.hpp"
#include "NetworkBuffer.hpp"
struct NetworkMessage
{
NetworkMessage();
NetworkMessage(const NetworkBuffer &buffer);
NetworkMessage(uint16 sender, byte distribution_mode, uint16 destination_id, byte tag, byte subject, NetworkBuffer buffer);
~NetworkMessage();
static const NetworkBuffer &EncodeMessage(const NetworkMessage &message);
static const NetworkMessage &DecodeMessage(const NetworkBuffer &buffer);
uint16 sender = -2;
byte distribution_mode;
uint16 destination_id;
byte tag;
byte subject;
void *data;
bool valid = false;
private:
NetworkBuffer buffer;
};
#endif