acadia/lib/mammoth/include/mammoth/endpoint_server.h
2023-06-21 23:14:42 -07:00

25 lines
575 B
C++

#pragma once
#include <glacier/status/error_or.h>
#include <ztypes.h>
#include "mammoth/endpoint_client.h"
class EndpointServer {
public:
static glcr::ErrorOr<EndpointServer> Create();
static EndpointServer Adopt(z_cap_t endpoint_cap);
glcr::ErrorOr<EndpointClient> CreateClient();
// FIXME: Release Cap here.
z_cap_t GetCap() { return endpoint_cap_; }
glcr::ErrorCode Recieve(uint64_t* num_bytes, void* data,
z_cap_t* reply_port_cap);
private:
z_cap_t endpoint_cap_;
EndpointServer(z_cap_t cap) : endpoint_cap_(cap) {}
};