mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-09-18 16:43:16 +00:00
.github
.vscode
Architecture
Core
Execute
FileSystem
Files
GUI
Library
Network
Profiling
Recovery
SystemCalls
Tasking
Tests
include
boot
cpu
filesystem
net
abi.h
assert.h
atomic.hpp
bitmap.hpp
cargs.h
convert.h
cpu.hpp
crc32.h
cstring
cwalk.h
debug.h
disk.hpp
display.hpp
driver.hpp
dumper.hpp
elf.h
exec.hpp
filesystem.hpp
gui.hpp
hashmap.hpp
interrupts.hpp
io.h
ipc.hpp
kconfig.hpp
limits.h
lock.hpp
md5.h
memory.hpp
msexec.h
pci.hpp
power.hpp
printf.h
rand.hpp
recovery.hpp
smartptr.hpp
smp.hpp
std.hpp
stddef.h
stdint.h
string.hpp
symbols.hpp
sys.h
syscalls.hpp
task.hpp
time.hpp
types.h
uart.hpp
vector.hpp
.gitignore
DAPI.hpp
Doxyfile
Fex.hpp
KConfig.cpp
KThread.cpp
Kernel.cpp
LICENSE
Makefile
README.md
dump.sh
ipc.h
kernel.h
syscalls.h
76 lines
1.7 KiB
C++
76 lines
1.7 KiB
C++
#ifndef __FENNIX_KERNEL_IPC_H__
|
|
#define __FENNIX_KERNEL_IPC_H__
|
|
|
|
#include <types.h>
|
|
#include <filesystem.hpp>
|
|
#include <vector.hpp>
|
|
#include <memory.hpp>
|
|
#include <atomic.hpp>
|
|
#include <lock.hpp>
|
|
|
|
namespace InterProcessCommunication
|
|
{
|
|
typedef int IPCID;
|
|
|
|
enum IPCType
|
|
{
|
|
IPCNone,
|
|
IPCMessagePassing,
|
|
IPCPort,
|
|
IPCSharedMemory,
|
|
IPCPipe,
|
|
IPCSocket
|
|
};
|
|
|
|
enum IPCErrorCode
|
|
{
|
|
IPCError = -1,
|
|
IPCSuccess,
|
|
IPCNotListening,
|
|
IPCTimeout,
|
|
IPCInvalidCommand,
|
|
IPCAlreadyAllocated,
|
|
IPCNotAllocated,
|
|
IPCIDInUse,
|
|
IPCIDNotRegistered,
|
|
IPCIDNotFound
|
|
};
|
|
|
|
struct IPCHandle
|
|
{
|
|
IPCID ID;
|
|
VirtualFileSystem::Node *Node;
|
|
void *Buffer;
|
|
long Length;
|
|
Atomic<bool> Listening;
|
|
};
|
|
|
|
class IPC
|
|
{
|
|
private:
|
|
NewLock(IPCLock);
|
|
IPCID NextID = 0;
|
|
Vector<IPCHandle *> Handles;
|
|
Memory::MemMgr *mem;
|
|
VirtualFileSystem::Node *IPCNode;
|
|
void *Process;
|
|
|
|
public:
|
|
IPCHandle *Create(IPCType Type, char UniqueToken[16]);
|
|
IPCErrorCode Destroy(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();
|
|
};
|
|
}
|
|
|
|
#endif // !__FENNIX_KERNEL_IPC_H__
|