2023-06-26 08:41:44 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glacier/status/error_or.h>
|
|
|
|
#include <ztypes.h>
|
|
|
|
|
2023-11-22 13:41:14 -08:00
|
|
|
#include "mammoth/ipc/port_client.h"
|
2023-06-26 08:59:28 -07:00
|
|
|
|
2023-11-22 14:59:41 -08:00
|
|
|
namespace mmth {
|
|
|
|
|
2023-06-26 08:41:44 -07:00
|
|
|
class PortServer {
|
|
|
|
public:
|
2023-11-25 13:08:30 -08:00
|
|
|
PortServer() {}
|
2023-06-26 08:41:44 -07:00
|
|
|
static glcr::ErrorOr<PortServer> Create();
|
|
|
|
static PortServer AdoptCap(z_cap_t cap);
|
|
|
|
|
2023-06-26 08:59:28 -07:00
|
|
|
glcr::ErrorOr<PortClient> CreateClient();
|
2023-06-26 08:41:44 -07:00
|
|
|
|
|
|
|
glcr::ErrorCode RecvCap(uint64_t* num_bytes, char* msg, uint64_t* cap);
|
|
|
|
glcr::ErrorCode PollForIntCap(uint64_t* msg, uint64_t* cap);
|
|
|
|
|
2023-06-26 08:59:28 -07:00
|
|
|
z_cap_t cap() { return port_cap_; }
|
|
|
|
|
2023-06-26 08:41:44 -07:00
|
|
|
private:
|
|
|
|
z_cap_t port_cap_;
|
|
|
|
|
|
|
|
PortServer(z_cap_t cap);
|
|
|
|
};
|
2023-11-22 14:59:41 -08:00
|
|
|
|
|
|
|
} // namespace mmth
|