Added a new ConnectionCode - Close TcpServer: AddToClientsList and AllocateID are now called add_to_clients_list and allocate_id respectively and are now private, removed SendHandshake method - we now use SendMessage method and the HandshakeToNetworkMessage method in the Handshake class Added a new method to Utility::StringConverter - FromString Changed NetworkMessage conversions to allow Handshake conversions NetworkMessage: if subject is 1 then the NetworkMessage is a handshake I may be missing something but im going to check it I may be overcomplicating this but i want to make it as simple as possible xD
30 lines
642 B
C++
30 lines
642 B
C++
#ifndef HANDSHAKE_HPP
|
|
#define HANDSHAKE_HPP
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "Defs.hpp"
|
|
#include "NetworkMessage.hpp"
|
|
|
|
#include <vector>
|
|
|
|
struct Handshake
|
|
{
|
|
Handshake();
|
|
Handshake(uint16 id, byte con_code, byte distribution_mode);
|
|
~Handshake();
|
|
|
|
static const std::vector<byte> &EncodeHandshake(const Handshake &handshake);
|
|
static Handshake &DecodeHandshake(const std::vector<byte> &bytes);
|
|
static const NetworkMessage &HandshakeToNetworkMessage(const Handshake &handshake);
|
|
static const Handshake &NetworkMessageToHandshake(const NetworkMessage &message);
|
|
|
|
uint16 id;
|
|
byte con_code;
|
|
byte distribution_mode;
|
|
};
|
|
|
|
#endif
|