FeatherMC/src/network/Protocol.h

33 lines
656 B
C++

#pragma once
#include "NetworkMessage.h"
#include "ClientHandle.h"
namespace Feather::Network
{
class PacketReader;
enum class ProtocolState
{
HANDSHAKING = -1,
PLAY = 0,
STATUS = 1,
LOGIN = 2,
};
// TODO: This should become abstract so we can support multiple versions
class Protocol
{
private:
ClientHandle* m_client;
ProtocolState m_state = ProtocolState::HANDSHAKING;
public:
Protocol(ClientHandle* client) : m_client(client) {}
void HandlePacket(PacketReader& packet);
protected:
void SetState(ProtocolState state);
};
}