Updated IPC

This commit is contained in:
Alex
2023-02-10 16:30:45 +02:00
parent 7d37988e3c
commit 5bbef13d6a
3 changed files with 227 additions and 130 deletions

View File

@ -5,6 +5,7 @@
#include <filesystem.hpp>
#include <vector.hpp>
#include <memory.hpp>
#include <atomic.hpp>
#include <lock.hpp>
namespace InterProcessCommunication
@ -27,7 +28,7 @@ namespace InterProcessCommunication
IPCSuccess,
IPCNotListening,
IPCTimeout,
IPCInvalidPort,
IPCInvalidCommand,
IPCAlreadyAllocated,
IPCNotAllocated,
IPCIDInUse,
@ -38,11 +39,10 @@ namespace InterProcessCommunication
struct IPCHandle
{
IPCID ID;
long Length;
uint8_t *Buffer;
bool Listening;
VirtualFileSystem::Node *Node;
IPCErrorCode Error;
void *Buffer;
long Length;
Atomic<bool> Listening;
};
class IPC
@ -56,18 +56,19 @@ namespace InterProcessCommunication
void *Process;
public:
IPC(void *Process);
~IPC();
int HandleSyscall(long Command, long Type, int ID, int Flags, void *Buffer, size_t Size);
IPCHandle *Create(IPCType Type, char UniqueToken[16]);
IPCErrorCode Destroy(IPCID ID);
IPCErrorCode Read(IPCID ID, uint8_t *Buffer, long Size);
IPCErrorCode Write(IPCID ID, uint8_t *Buffer, long Size);
IPCErrorCode Listen(IPCID ID);
IPCHandle *Wait(IPCID ID);
IPCErrorCode Allocate(IPCID ID, long Size);
IPCErrorCode Deallocate(IPCID ID);
IPCErrorCode Read(IPCID ID, void *Buffer, long Size);
IPCErrorCode Write(IPCID ID, void *Buffer, long Size);
IPCErrorCode Listen(IPCID ID, bool Listen);
IPCErrorCode Wait(IPCID ID);
IPCHandle *SearchByToken(char UniqueToken[16]);
int HandleSyscall(long Command, long Type, int ID, int Flags, void *Buffer, size_t Size);
IPC(void *Process);
~IPC();
};
}