mirror of
https://github.com/HikikoMarmy/Champions-Reborn-Server.git
synced 2026-04-05 00:49:48 -03:00
Reorganized and cleaned up the solution.
This commit is contained in:
44
Include/Network/GenericNetRequest.hpp
Normal file
44
Include/Network/GenericNetRequest.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Common/ByteStream.hpp"
|
||||
|
||||
class GenericResponse;
|
||||
using sptr_generic_response = std::shared_ptr< GenericResponse >;
|
||||
|
||||
class RealmUser;
|
||||
using sptr_user = std::shared_ptr< RealmUser >;
|
||||
|
||||
class RealmSocket;
|
||||
using sptr_socket = std::shared_ptr< RealmSocket >;
|
||||
|
||||
class GenericRequest {
|
||||
public:
|
||||
int16_t m_packetId;
|
||||
uint32_t m_trackId;
|
||||
|
||||
virtual ~GenericRequest() = default;
|
||||
|
||||
virtual sptr_generic_response ProcessRequest( sptr_socket user, sptr_byte_stream stream )
|
||||
{
|
||||
throw std::runtime_error( "ProcessRequest not implemented for GenericRequest" );
|
||||
}
|
||||
|
||||
virtual sptr_generic_response ProcessRequest( sptr_byte_stream stream )
|
||||
{
|
||||
throw std::runtime_error( "ProcessRequest not implemented for GenericRequest" );
|
||||
}
|
||||
|
||||
void DeserializeHeader( sptr_byte_stream stream )
|
||||
{
|
||||
m_packetId = stream->read_u16();
|
||||
m_trackId = stream->read_u32();
|
||||
auto version = stream->read_u32(); // 2 for CON and 6 for RTA
|
||||
};
|
||||
|
||||
virtual void Deserialize( sptr_byte_stream stream ) = 0;
|
||||
};
|
||||
|
||||
using sptr_generic_request = std::shared_ptr< GenericRequest >;
|
||||
|
||||
Reference in New Issue
Block a user