Files
VoidNet/include/NetworkMessage.hpp
xX-TheDoctor-Xx bb6a2a25d3 Massive update:
Changed all byte pointers to vectors
NetworkMessage: DecodeMessage and EncodeMessage are now static
TcpClient: Fixed OnMessage function
NetworkMessage: merged both private methods into 1 method
2016-07-31 01:28:36 +01:00

36 lines
711 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, uint16 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;
uint16 subject;
void *data;
bool valid = false;
private:
NetworkBuffer buffer;
};
#endif