in proxy mode, log subcommands not implemented in the server
This commit is contained in:
+25
-1
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "PSOProtocol.hh"
|
||||
#include "ReceiveCommands.hh"
|
||||
#include "ReceiveSubcommands.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -324,7 +325,30 @@ void ProxyServer::receive_and_process_commands(bool from_server) {
|
||||
log(INFO, "[ProxyServer] %s:", from_server ? "server" : "client");
|
||||
print_data(stderr, command);
|
||||
|
||||
// preprocess the command if needed
|
||||
// Preprocess the command if needed
|
||||
|
||||
// Preprocessing for bidirectional commands...
|
||||
switch (this->get_command_field(input_header)) {
|
||||
case 0x60:
|
||||
case 0x62:
|
||||
case 0x6C:
|
||||
case 0x6D:
|
||||
case 0xC9:
|
||||
case 0xCB: { // broadcast/target commands
|
||||
if (command.size() <= this->header_size) {
|
||||
log(WARNING, "[ProxyServer] Received broadcast/target command with no contents");
|
||||
} else {
|
||||
uint8_t which = *reinterpret_cast<uint8_t*>(command.data() + this->header_size);
|
||||
if (!subcommand_is_implemented(which)) {
|
||||
log(WARNING, "[ProxyServer] Received broadcast/target subcommand %02hhX which is not implemented on the server",
|
||||
which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Preprocessing for server->client commands...
|
||||
if (from_server) {
|
||||
switch (this->get_command_field(input_header)) {
|
||||
case 0x02: // init encryption
|
||||
|
||||
@@ -1011,7 +1011,7 @@ subcommand_handler_t subcommand_handlers[0x100] = {
|
||||
process_subcommand_forward_check_size_client, // Intra-map warp
|
||||
process_subcommand_forward_check_size_client,
|
||||
process_subcommand_forward_check_size_client,
|
||||
process_subcommand_unimplemented,
|
||||
process_subcommand_forward_check_size_game,
|
||||
process_subcommand_forward_check_size_game,
|
||||
process_subcommand_pick_up_item,
|
||||
process_subcommand_unimplemented,
|
||||
@@ -1196,3 +1196,7 @@ void process_subcommand(shared_ptr<ServerState> s, shared_ptr<Lobby> l,
|
||||
const PSOSubcommand* sub, size_t count) {
|
||||
subcommand_handlers[sub->byte[0]](s, l, c, command, flag, sub, count);
|
||||
}
|
||||
|
||||
bool subcommand_is_implemented(uint8_t which) {
|
||||
return subcommand_handlers[which] != process_subcommand_unimplemented;
|
||||
}
|
||||
|
||||
@@ -12,3 +12,5 @@ void check_size(uint16_t size, uint16_t min_size, uint16_t max_size = 0);
|
||||
void process_subcommand(std::shared_ptr<ServerState> s,
|
||||
std::shared_ptr<Lobby> l, std::shared_ptr<Client> c, uint8_t command,
|
||||
uint8_t flag, const PSOSubcommand* sub, size_t count);
|
||||
|
||||
bool subcommand_is_implemented(uint8_t which);
|
||||
|
||||
Reference in New Issue
Block a user