diff --git a/include/rcon.h b/include/rcon.h index 8d575aa..6b8e0fe 100644 --- a/include/rcon.h +++ b/include/rcon.h @@ -1,13 +1,6 @@ #pragma once -#include #include -#include -#include -#include -#include -#include -#include #include #define DEFAULT_TIMEOUT 4 @@ -124,13 +117,7 @@ class rcon { */ rcon_packet read_packet(); - inline const size_t read_packet_length() { - unsigned char* buffer = new unsigned char[4]{0}; - ::recv(sock, buffer, 4, 0); - const size_t len = byte32_to_int(buffer); - delete[] buffer; - return len; - } + const size_t read_packet_length(); inline const size_t byte32_to_int(unsigned char* buffer) { return static_cast(buffer[0] | buffer[1] << 8 | buffer[2] << 16 | buffer[3] << 24); diff --git a/src/rcon.cpp b/src/rcon.cpp index 7c962dc..d80fa99 100644 --- a/src/rcon.cpp +++ b/src/rcon.cpp @@ -1,6 +1,13 @@ #include "../include/rcon.h" +#include +#include +#include +#include +#include +#include #include +#include rcon::rcon(const std::string& addr, const unsigned int _port, const std::string& pass) : address(addr), port(_port), password(pass) { @@ -169,3 +176,11 @@ rcon_packet rcon::read_packet() { return {bytes, buffer}; } + +const size_t rcon::read_packet_length() { + unsigned char* buffer = new unsigned char[4]{0}; + ::recv(sock, buffer, 4, 0); + const size_t len = byte32_to_int(buffer); + delete[] buffer; + return len; +}