[mammoth] Move port server operations to their own class.

This commit is contained in:
Drew Galbraith 2023-06-26 08:41:44 -07:00
parent 7989c9d616
commit 5fb9fa6ae6
8 changed files with 74 additions and 42 deletions

View file

@ -0,0 +1,20 @@
#pragma once
#include <glacier/status/error_or.h>
#include <ztypes.h>
class PortServer {
public:
static glcr::ErrorOr<PortServer> Create();
static PortServer AdoptCap(z_cap_t cap);
glcr::ErrorCode CreateClient(z_cap_t* new_port);
glcr::ErrorCode RecvCap(uint64_t* num_bytes, char* msg, uint64_t* cap);
glcr::ErrorCode PollForIntCap(uint64_t* msg, uint64_t* cap);
private:
z_cap_t port_cap_;
PortServer(z_cap_t cap);
};