From fb790b07aeba8e22e4190cf3e1834d11ecde6c96 Mon Sep 17 00:00:00 2001 From: Amlal Date: Fri, 25 Apr 2025 13:08:33 +0200 Subject: dev: better .clang-format, ran format command. Signed-off-by: Amlal --- dev/kernel/NetworkKit/IPC.h | 130 +++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 67 deletions(-) (limited to 'dev/kernel/NetworkKit/IPC.h') diff --git a/dev/kernel/NetworkKit/IPC.h b/dev/kernel/NetworkKit/IPC.h index 6de306b2..43b58d35 100644 --- a/dev/kernel/NetworkKit/IPC.h +++ b/dev/kernel/NetworkKit/IPC.h @@ -1,9 +1,9 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.. + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.. - File: IPC.h. - Purpose: IPC protocol. + File: IPC.h. + Purpose: IPC protocol. ------------------------------------------- */ @@ -25,67 +25,63 @@ #define kIPCHeaderMagic (0x4950434) -namespace Kernel -{ - struct IPC_ADDR; - struct IPC_MSG; - - /// @brief 128-bit IPC address. - struct PACKED IPC_ADDR final - { - UInt64 UserProcessID; - UInt64 UserProcessTeam; - - //////////////////////////////////// - // some operators. - //////////////////////////////////// - - bool operator==(const IPC_ADDR& addr) noexcept; - - bool operator==(IPC_ADDR& addr) noexcept; - - bool operator!=(const IPC_ADDR& addr) noexcept; - - bool operator!=(IPC_ADDR& addr) noexcept; - }; - - typedef struct IPC_ADDR IPC_ADDR; - - enum - { - kIPCLittleEndian = 0, - kIPCBigEndian = 1, - kIPCMixedEndian = 2, - }; - - constexpr inline auto kIPCMsgSize = 6094U; - - /// @brief IPC connection header, message cannot be greater than 6K. - typedef struct IPC_MSG final - { - UInt32 IpcHeaderMagic; // cRemoteHeaderMagic - UInt8 IpcEndianess; // 0 : LE, 1 : BE - SizeT IpcPacketSize; - IPC_ADDR IpcFrom; - IPC_ADDR IpcTo; - UInt32 IpcCRC32; - UInt32 IpcMsg; - UInt32 IpcMsgSz; - UInt8 IpcData[kIPCMsgSize]; - - /// @brief Passes the message to target, could be anything, HTTP packet, JSON or whatever. - static Bool Pass(IPC_MSG* self, IPC_MSG* target) noexcept; - } PACKED IPC_MSG; - - /// @brief Sanitize packet function - /// @retval true packet is correct. - /// @retval false packet is incorrect and process has crashed. - Bool ipc_sanitize_packet(_Input IPC_MSG* pckt_in); - - /// @brief Construct packet function - /// @retval true packet is correct. - /// @retval false packet is incorrect and process has crashed. - Bool ipc_construct_packet(_Output _Input IPC_MSG** pckt_in); -} // namespace Kernel - -#endif // INC_IPC_H +namespace Kernel { +struct IPC_ADDR; +struct IPC_MSG; + +/// @brief 128-bit IPC address. +struct PACKED IPC_ADDR final { + UInt64 UserProcessID; + UInt64 UserProcessTeam; + + //////////////////////////////////// + // some operators. + //////////////////////////////////// + + bool operator==(const IPC_ADDR& addr) noexcept; + + bool operator==(IPC_ADDR& addr) noexcept; + + bool operator!=(const IPC_ADDR& addr) noexcept; + + bool operator!=(IPC_ADDR& addr) noexcept; +}; + +typedef struct IPC_ADDR IPC_ADDR; + +enum { + kIPCLittleEndian = 0, + kIPCBigEndian = 1, + kIPCMixedEndian = 2, +}; + +constexpr inline auto kIPCMsgSize = 6094U; + +/// @brief IPC connection header, message cannot be greater than 6K. +typedef struct IPC_MSG final { + UInt32 IpcHeaderMagic; // cRemoteHeaderMagic + UInt8 IpcEndianess; // 0 : LE, 1 : BE + SizeT IpcPacketSize; + IPC_ADDR IpcFrom; + IPC_ADDR IpcTo; + UInt32 IpcCRC32; + UInt32 IpcMsg; + UInt32 IpcMsgSz; + UInt8 IpcData[kIPCMsgSize]; + + /// @brief Passes the message to target, could be anything, HTTP packet, JSON or whatever. + static Bool Pass(IPC_MSG* self, IPC_MSG* target) noexcept; +} PACKED IPC_MSG; + +/// @brief Sanitize packet function +/// @retval true packet is correct. +/// @retval false packet is incorrect and process has crashed. +Bool ipc_sanitize_packet(_Input IPC_MSG* pckt_in); + +/// @brief Construct packet function +/// @retval true packet is correct. +/// @retval false packet is incorrect and process has crashed. +Bool ipc_construct_packet(_Output _Input IPC_MSG** pckt_in); +} // namespace Kernel + +#endif // INC_IPC_H -- cgit v1.2.3