IPC implementation

This commit is contained in:
Alex
2022-11-18 05:09:25 +02:00
parent 666991265f
commit 03d77c9774
2 changed files with 106 additions and 21 deletions

View File

@ -7,7 +7,7 @@
namespace InterProcessCommunication
{
typedef unsigned int IPCPort;
typedef int IPCPort;
enum IPCOperationType
{
@ -24,16 +24,17 @@ namespace InterProcessCommunication
IPCTimeout,
IPCInvalidPort,
IPCPortInUse,
IPCPortNotRegistered
IPCPortNotRegistered,
IPCIDNotFound
};
typedef struct
{
int ID;
int Length;
void *Buffer;
long Length;
uint8_t *Buffer;
bool Listening;
IPCOperationType Type;
IPCOperationType Operation;
IPCErrorCode Error;
LockClass Lock;
} IPCHandle;
@ -41,10 +42,10 @@ namespace InterProcessCommunication
typedef struct
{
int ID;
int Length;
IPCOperationType Type;
long Length;
IPCOperationType Operation;
IPCErrorCode Error;
void *Buffer;
uint8_t *Buffer;
// Reserved
IPCHandle *HandleBuffer;
@ -58,15 +59,15 @@ namespace InterProcessCommunication
class IPC
{
private:
public:
IPC();
~IPC();
IPCHandle *RegisterHandle(IPCPort Port);
IPCHandle *Wait(IPCPort port);
IPCError Read(int pid, IPCPort port, void *buf, int size);
IPCError Write(int pid, IPCPort port, void *buf, int size);
IPCError Listen(IPCPort Port);
IPCHandle *Wait(IPCPort Port);
IPCError Read(unsigned long /* Tasking::UPID */ ID, IPCPort Port, uint8_t *&Buffer, long &Size);
IPCError Write(unsigned long /* Tasking::UPID */ ID, IPCPort Port, uint8_t *Buffer, long Size);
};
}