|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
System to handle player login operations on the server side. More...
#include <AuthSystem.hpp>
Public Member Functions | |
| AuthSystem (ServerNetwork &network, ecs::Registry ®istry) | |
| Constructor for AuthSystem. | |
| void | update (float dt) override |
| Update system logic for one frame. | |
| std::tuple< bool, std::string, uint8_t > | handleLoginRequest (uint32_t sessionId, const net::Packet &packet) |
| Handle a login request from a client. | |
| std::pair< bool, std::string > | handleRegisterRequest (uint32_t sessionId, const net::Packet &packet) |
| Handle a registration request from a client. | |
| void | sendLoginResponse (uint32_t sessionId, bool success, const std::string &username) |
| Send a login response to a client. | |
| void | sendRegisterResponse (uint32_t sessionId, bool success, const std::string &username) |
| Send a registration response to a client. | |
Public Member Functions inherited from rtp::ecs::ISystem | |
| virtual | ~ISystem () noexcept=default |
Private Attributes | |
| ServerNetwork & | _network |
| Reference to the server network manager. | |
| ecs::Registry & | _registry |
| Reference to the entity registry. | |
System to handle player login operations on the server side.
Definition at line 30 of file AuthSystem.hpp.
| rtp::server::AuthSystem::AuthSystem | ( | ServerNetwork & | network, |
| ecs::Registry & | registry | ||
| ) |
Constructor for AuthSystem.
| network | Reference to the server network manager |
| registry | Reference to the entity registry |
Definition at line 17 of file AuthSystem.cpp.
| std::tuple< bool, std::string, uint8_t > rtp::server::AuthSystem::handleLoginRequest | ( | uint32_t | sessionId, |
| const net::Packet & | packet | ||
| ) |
Handle a login request from a client.
| sessionId | ID of the network session |
| packet | Packet containing the login request data |
Definition at line 25 of file AuthSystem.cpp.
References rtp::log::error(), rtp::log::info(), rtp::net::LoginPayload::password, sendLoginResponse(), rtp::net::LoginPayload::username, rtp::log::warning(), and rtp::net::LoginPayload::weaponKind.
| std::pair< bool, std::string > rtp::server::AuthSystem::handleRegisterRequest | ( | uint32_t | sessionId, |
| const net::Packet & | packet | ||
| ) |
Handle a registration request from a client.
| sessionId | ID of the network session |
| packet | Packet containing the registration request data |
Definition at line 63 of file AuthSystem.cpp.
References rtp::log::error(), rtp::log::info(), rtp::net::RegisterPayload::password, sendRegisterResponse(), rtp::net::RegisterPayload::username, and rtp::log::warning().
| void rtp::server::AuthSystem::sendLoginResponse | ( | uint32_t | sessionId, |
| bool | success, | ||
| const std::string & | username | ||
| ) |
Send a login response to a client.
| sessionId | ID of the network session |
| success | Whether the login was successful |
| username | The username of the player |
Definition at line 111 of file AuthSystem.cpp.
References _network, rtp::net::LoginResponse, rtp::server::ServerNetwork::sendPacket(), rtp::net::LoginResponsePayload::success, and rtp::net::TCP.
Referenced by handleLoginRequest().
| void rtp::server::AuthSystem::sendRegisterResponse | ( | uint32_t | sessionId, |
| bool | success, | ||
| const std::string & | username | ||
| ) |
Send a registration response to a client.
| sessionId | ID of the network session |
| success | Whether the registration was successful |
| username | The username of the player |
Definition at line 122 of file AuthSystem.cpp.
References _network, rtp::net::RegisterResponse, rtp::server::ServerNetwork::sendPacket(), rtp::net::RegisterResponsePayload::success, and rtp::net::TCP.
Referenced by handleRegisterRequest().
|
overridevirtual |
Update system logic for one frame.
| dt | Time elapsed since last update in seconds |
Implements rtp::ecs::ISystem.
Definition at line 20 of file AuthSystem.cpp.
|
private |
Reference to the server network manager.
Definition at line 78 of file AuthSystem.hpp.
Referenced by sendLoginResponse(), and sendRegisterResponse().
|
private |
Reference to the entity registry.
Definition at line 79 of file AuthSystem.hpp.