[Mammoth] Add Channel object for simple IPC messages
This commit is contained in:
parent
65439c163a
commit
40b21d9c75
8 changed files with 116 additions and 30 deletions
22
lib/mammoth/include/mammoth/channel.h
Normal file
22
lib/mammoth/include/mammoth/channel.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <zerrors.h>
|
||||
|
||||
class Channel {
|
||||
public:
|
||||
Channel() {}
|
||||
void adopt_cap(uint64_t id);
|
||||
uint64_t release_cap();
|
||||
|
||||
z_err_t WriteStr(const char* msg);
|
||||
z_err_t ReadStr(char* buffer, uint64_t* size);
|
||||
|
||||
// FIXME: Close channel here.
|
||||
~Channel() {}
|
||||
|
||||
private:
|
||||
uint64_t chan_cap_ = 0;
|
||||
};
|
||||
|
||||
uint64_t CreateChannels(Channel& c1, Channel& c2);
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <zerrors.h>
|
||||
|
||||
void dbgln(const char*);
|
||||
|
||||
// Checks that the code is ok.
|
||||
// if not exits the process.
|
||||
void check(uint64_t);
|
||||
|
||||
void crash(const char*, z_err_t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue