2013-11-21 13:42:38 +01:00
|
|
|
#ifndef NETWORK_DEPENDENCIES_MESSAGE_HEADER_H
|
|
|
|
#define NETWORK_DEPENDENCIES_MESSAGE_HEADER_H
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by Pontus Fransson 2013
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <string>
|
2013-11-21 14:49:30 +01:00
|
|
|
#include "../Protocols.h"
|
2013-11-21 13:42:38 +01:00
|
|
|
|
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Network
|
|
|
|
{
|
|
|
|
namespace Messages
|
|
|
|
{
|
|
|
|
class MessageHeader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MessageHeader();
|
|
|
|
virtual ~MessageHeader();
|
|
|
|
|
2013-11-22 14:23:08 +01:00
|
|
|
virtual void Translate(Protocols::ProtocolHeader& header, unsigned char msg[] );
|
2013-11-21 14:49:30 +01:00
|
|
|
virtual void Translate(unsigned char message[], Protocols::ProtocolHeader& header);
|
2013-11-21 13:42:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
//Add variables to messages
|
2013-11-22 14:23:08 +01:00
|
|
|
void AddInt(int i, unsigned char msg[]);
|
|
|
|
void AddStr(std::string str, unsigned char msg[]);
|
2013-11-21 13:42:38 +01:00
|
|
|
|
|
|
|
//Get variables from message
|
|
|
|
int GetInt(unsigned char message[]);
|
|
|
|
std::string GetStr(unsigned char message[]);
|
|
|
|
|
2013-11-22 15:48:49 +01:00
|
|
|
void SetSize(unsigned char msg[]);
|
|
|
|
|
2013-11-21 13:42:38 +01:00
|
|
|
private:
|
|
|
|
int size;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|