summaryrefslogtreecommitdiffhomepage
path: root/Kernel/NetworkKit
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-06-29 13:15:29 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-06-29 13:15:29 +0200
commitd9d42bcfeb444652ae198a6bd3481ce316549e55 (patch)
tree238e88d868855c4ab6e1c6671bfc18a9930048fe /Kernel/NetworkKit
parentf562fbf39333925689d6fb704af15efe5f99ed28 (diff)
kernel: Use local error codes for kernel calls. So that we know which
process caused the error, and it's not global as well. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/NetworkKit')
-rw-r--r--Kernel/NetworkKit/IPCEP.hxx41
1 files changed, 28 insertions, 13 deletions
diff --git a/Kernel/NetworkKit/IPCEP.hxx b/Kernel/NetworkKit/IPCEP.hxx
index c92f79cd..4725893e 100644
--- a/Kernel/NetworkKit/IPCEP.hxx
+++ b/Kernel/NetworkKit/IPCEP.hxx
@@ -18,19 +18,32 @@
/// IA separator.
#define cRemoteSeparator "."
-/// Interchange address, consists of domain:namespace.
-#define cRemoteInvalid "00.00.00.00:0000"
-#define cRemoteBitWidth (96) /* 96-bit address space. */
+/// Interchange address, consists of PID:TEAM.
+#define cRemoteInvalid "00:00"
-#define cRemoteHeaderMagic (0x4950434550)
+#define cRemoteHeaderMagic (0x4950434)
namespace NewOS
{
- /// @brief 96-bit number to represent the domain and namespace
+ /// @brief 128-bit IPC address.
struct PACKED IPCEPAddress final
{
- UInt32 RemoteAddress;
- UInt64 RemoteNamespace;
+ UInt64 ProcessID;
+ UInt64 ProcessTeam;
+
+ ////////////////////////////////////
+ // some operators.
+ ////////////////////////////////////
+
+ bool operator==(const IPCEPAddress& addr) noexcept
+ {
+ return addr.ProcessID == this->ProcessID && addr.ProcessTeam == this->ProcessTeam;
+ }
+
+ bool operator==(IPCEPAddress& addr) noexcept
+ {
+ return addr.ProcessID == this->ProcessID && addr.ProcessTeam == this->ProcessTeam;
+ }
};
typedef struct IPCEPAddress IPCEPAddressType;
@@ -41,12 +54,12 @@ namespace NewOS
eIPCEPBigEndian = 1
};
- /// @brief IPCEP connection header, must be the same on
- /// user side as well.
+ constexpr auto cIPCEPMsgSize = 6094U;
- typedef struct IPCEPConnectionHeader
+ /// @brief IPCEP connection header, message cannot be greater than 6K.
+ typedef struct IPCEPMessageHeader final
{
- UInt32 IpcHeader; // cRemoteHeaderMagic
+ UInt32 IpcHeaderMagic; // cRemoteHeaderMagic
UInt8 IpcEndianess; // 0 : LE, 1 : BE
SizeT IpcPacketSize;
IPCEPAddressType IpcFrom;
@@ -54,8 +67,10 @@ namespace NewOS
UInt32 IpcCRC32;
UInt32 IpcMsg;
UInt32 IpcMsgSz;
- UInt8 IpcData[];
- } PACKED IPCEPConnectionHeader;
+ UInt8 IpcData[cIPCEPMsgSize];
+ } PACKED IPCEPMessageHeader;
+
+ Bool ipc_sanitize_packet(IPCEPMessageHeader* pckt);
} // namespace NewOS
#endif // _INC_IPC_ENDPOINT_HXX_