2023-06-21 21:26:24 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-26 11:38:17 -07:00
|
|
|
#include <glacier/memory/unique_ptr.h>
|
2023-06-21 21:26:24 -07:00
|
|
|
#include <glacier/status/error_or.h>
|
|
|
|
#include <ztypes.h>
|
|
|
|
|
|
|
|
#include "mammoth/endpoint_client.h"
|
|
|
|
|
|
|
|
class EndpointServer {
|
|
|
|
public:
|
2023-06-26 11:38:17 -07:00
|
|
|
EndpointServer() = delete;
|
|
|
|
EndpointServer(const EndpointServer&) = delete;
|
|
|
|
EndpointServer& operator=(const EndpointServer&) = delete;
|
|
|
|
|
|
|
|
static glcr::ErrorOr<glcr::UniquePtr<EndpointServer>> Create();
|
|
|
|
static glcr::UniquePtr<EndpointServer> Adopt(z_cap_t endpoint_cap);
|
2023-06-21 21:26:24 -07:00
|
|
|
|
2023-06-26 11:54:36 -07:00
|
|
|
glcr::ErrorOr<glcr::UniquePtr<EndpointClient>> CreateClient();
|
2023-06-21 21:26:24 -07:00
|
|
|
|
|
|
|
// FIXME: Release Cap here.
|
|
|
|
z_cap_t GetCap() { return endpoint_cap_; }
|
|
|
|
|
2023-06-21 23:14:42 -07:00
|
|
|
glcr::ErrorCode Recieve(uint64_t* num_bytes, void* data,
|
|
|
|
z_cap_t* reply_port_cap);
|
|
|
|
|
2023-06-21 21:26:24 -07:00
|
|
|
private:
|
|
|
|
z_cap_t endpoint_cap_;
|
|
|
|
|
|
|
|
EndpointServer(z_cap_t cap) : endpoint_cap_(cap) {}
|
|
|
|
};
|