[yellowstone] Add yellowstone server for endpoint registration.

This commit is contained in:
Drew Galbraith 2023-06-22 02:19:16 -07:00
parent 8dcb1ddabd
commit a46694d0f7
13 changed files with 248 additions and 31 deletions

View file

@ -12,6 +12,8 @@ class EndpointClient {
template <typename Req, typename Resp>
glcr::ErrorOr<glcr::Pair<Resp, z_cap_t>> CallEndpoint(const Req& req);
z_cap_t GetCap() { return cap_; }
private:
EndpointClient(uint64_t cap) : cap_(cap) {}
z_cap_t cap_;

View file

@ -1,17 +1,27 @@
#pragma once
#include <glacier/status/error_or.h>
#include <glacier/string/string.h>
#include <stdint.h>
#include <zcall.h>
// FIXME: Split send and receive.
class Port {
public:
static glcr::ErrorOr<Port> Create();
Port(uint64_t port_cap);
glcr::ErrorCode RecvCap(uint64_t* num_bytes, char* msg, uint64_t* cap);
z_err_t PollForIntCap(uint64_t* msg, uint64_t* cap);
template <typename T>
z_err_t WriteMessage(const T& obj, uint64_t cap);
glcr::ErrorCode WriteString(glcr::String str, uint64_t cap);
// FIXME: We can't create error_ors of ints
glcr::ErrorCode Duplicate(uint64_t* new_cap);
private:
uint64_t port_cap_;
};

View file

@ -1,8 +1,9 @@
#pragma once
#include <glacier/status/error_or.h>
#include <glacier/status/error.h>
#include <stdint.h>
#include "mammoth/endpoint_client.h"
glcr::ErrorOr<EndpointClient> SpawnProcessFromElfRegion(uint64_t program);
glcr::ErrorCode SpawnProcessFromElfRegion(uint64_t program,
EndpointClient client);