From da70596895d8135e08f8caac6978117697b4c021 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 18 Aug 2024 21:39:29 +0200 Subject: [REFACTOR] Improved project structure. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/Sources/Network/IPC.cxx | 68 -------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 dev/Kernel/Sources/Network/IPC.cxx (limited to 'dev/Kernel/Sources/Network/IPC.cxx') diff --git a/dev/Kernel/Sources/Network/IPC.cxx b/dev/Kernel/Sources/Network/IPC.cxx deleted file mode 100644 index f703e650..00000000 --- a/dev/Kernel/Sources/Network/IPC.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include -#include -#include - -using namespace Kernel; - -/// @internal -/// @brief The internal sanitize function. -Bool ipc_int_sanitize_packet(IPC_MESSAGE_STRUCT* pckt) -{ - auto endian = DEDUCE_ENDIAN(pckt, ((char*)pckt)[0]); - - switch (endian) - { - case Endian::kEndianBig: { - if (pckt->IpcEndianess == eIPCEPLittleEndian) - goto ipc_check_failed; - - break; - } - case Endian::kEndianLittle: { - if (pckt->IpcEndianess == eIPCEPBigEndian) - goto ipc_check_failed; - - break; - } - case Endian::kEndianMixed: - break; - default: - goto ipc_check_failed; - } - - if (pckt->IpcFrom == pckt->IpcTo || - pckt->IpcPacketSize > cIPCEPMsgSize) - { - goto ipc_check_failed; - } - - return pckt->IpcPacketSize > 1 && pckt->IpcHeaderMagic == cRemoteHeaderMagic; - -ipc_check_failed: - ErrLocal() = kErrorIPC; - return false; -} - -namespace Kernel -{ - /// @brief Sanitize packet function - /// @retval true packet is correct. - /// @retval false packet is incorrect and process has crashed. - Bool ipc_sanitize_packet(IPC_MESSAGE_STRUCT* pckt) - { - if (!pckt || - !ipc_int_sanitize_packet(pckt)) - { - ProcessScheduler::The().Leak().TheCurrent().Leak().Crash(); - return false; - } - - return true; - } -} // namespace Kernel -- cgit v1.2.3