summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/NetworkKit/IPC.h
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /dev/kernel/NetworkKit/IPC.h
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/NetworkKit/IPC.h')
-rw-r--r--dev/kernel/NetworkKit/IPC.h130
1 files changed, 63 insertions, 67 deletions
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