[Yellowstone] Move yellowstone yunq def to yellowstone/lib/

This commit is contained in:
Drew Galbraith 2023-10-24 23:49:42 -07:00
parent af0852a5fa
commit 4c2237fa72
13 changed files with 5 additions and 54 deletions

View file

@ -0,0 +1,25 @@
interface Yellowstone {
method RegisterEndpoint(RegisterEndpointRequest) -> (Empty);
method GetAhciInfo(Empty) -> (AhciInfo);
method GetDenali(Empty) -> (DenaliInfo);
}
message RegisterEndpointRequest {
string endpoint_name;
capability endpoint_capability;
}
message Empty {
}
message AhciInfo {
capability ahci_region;
u64 region_length;
}
message DenaliInfo {
capability denali_endpoint;
u64 device_id;
u64 lba_offset;
}

View file

@ -0,0 +1,105 @@
// Generated file - DO NOT MODIFY
#include "yellowstone.yunq.client.h"
#include <glacier/buffer/byte_buffer.h>
#include <glacier/buffer/cap_buffer.h>
#include <zcall.h>
glcr::ErrorCode YellowstoneClient::RegisterEndpoint(const RegisterEndpointRequest& request, Empty& response) {
uint64_t buffer_size = kBufferSize;
uint64_t cap_size = kCapBufferSize;
const uint32_t kSentinel = 0xBEEFDEAD;
buffer_.WriteAt<uint32_t>(0, kSentinel);
buffer_.WriteAt<uint64_t>(8, 0);
cap_buffer_.Reset();
uint64_t length = request.SerializeToBytes(buffer_, /*offset=*/16, cap_buffer_);
buffer_.WriteAt<uint32_t>(4, 16 + length);
z_cap_t reply_port_cap;
RET_ERR(ZEndpointSend(endpoint_, 16 + length, buffer_.RawPtr(), cap_buffer_.UsedSlots(), cap_buffer_.RawPtr(), &reply_port_cap));
// FIXME: Add a way to zero out the first buffer.
RET_ERR(ZReplyPortRecv(reply_port_cap, &buffer_size, buffer_.RawPtr(), &cap_size, cap_buffer_.RawPtr()));
if (buffer_.At<uint32_t>(0) != kSentinel) {
return glcr::INVALID_RESPONSE;
}
// Check Response Code.
RET_ERR(buffer_.At<uint64_t>(8));
response.ParseFromBytes(buffer_, 16, cap_buffer_);
return glcr::OK;
}
glcr::ErrorCode YellowstoneClient::GetAhciInfo(const Empty& request, AhciInfo& response) {
uint64_t buffer_size = kBufferSize;
uint64_t cap_size = kCapBufferSize;
const uint32_t kSentinel = 0xBEEFDEAD;
buffer_.WriteAt<uint32_t>(0, kSentinel);
buffer_.WriteAt<uint64_t>(8, 1);
cap_buffer_.Reset();
uint64_t length = request.SerializeToBytes(buffer_, /*offset=*/16, cap_buffer_);
buffer_.WriteAt<uint32_t>(4, 16 + length);
z_cap_t reply_port_cap;
RET_ERR(ZEndpointSend(endpoint_, 16 + length, buffer_.RawPtr(), cap_buffer_.UsedSlots(), cap_buffer_.RawPtr(), &reply_port_cap));
// FIXME: Add a way to zero out the first buffer.
RET_ERR(ZReplyPortRecv(reply_port_cap, &buffer_size, buffer_.RawPtr(), &cap_size, cap_buffer_.RawPtr()));
if (buffer_.At<uint32_t>(0) != kSentinel) {
return glcr::INVALID_RESPONSE;
}
// Check Response Code.
RET_ERR(buffer_.At<uint64_t>(8));
response.ParseFromBytes(buffer_, 16, cap_buffer_);
return glcr::OK;
}
glcr::ErrorCode YellowstoneClient::GetDenali(const Empty& request, DenaliInfo& response) {
uint64_t buffer_size = kBufferSize;
uint64_t cap_size = kCapBufferSize;
const uint32_t kSentinel = 0xBEEFDEAD;
buffer_.WriteAt<uint32_t>(0, kSentinel);
buffer_.WriteAt<uint64_t>(8, 2);
cap_buffer_.Reset();
uint64_t length = request.SerializeToBytes(buffer_, /*offset=*/16, cap_buffer_);
buffer_.WriteAt<uint32_t>(4, 16 + length);
z_cap_t reply_port_cap;
RET_ERR(ZEndpointSend(endpoint_, 16 + length, buffer_.RawPtr(), cap_buffer_.UsedSlots(), cap_buffer_.RawPtr(), &reply_port_cap));
// FIXME: Add a way to zero out the first buffer.
RET_ERR(ZReplyPortRecv(reply_port_cap, &buffer_size, buffer_.RawPtr(), &cap_size, cap_buffer_.RawPtr()));
if (buffer_.At<uint32_t>(0) != kSentinel) {
return glcr::INVALID_RESPONSE;
}
// Check Response Code.
RET_ERR(buffer_.At<uint64_t>(8));
response.ParseFromBytes(buffer_, 16, cap_buffer_);
return glcr::OK;
}

View file

@ -0,0 +1,32 @@
// Generated file - DO NOT MODIFY
#pragma once
#include <glacier/buffer/byte_buffer.h>
#include <glacier/buffer/cap_buffer.h>
#include <glacier/status/error.h>
#include <ztypes.h>
#include "yellowstone.yunq.h"
class YellowstoneClient {
public:
YellowstoneClient(z_cap_t Yellowstone_cap) : endpoint_(Yellowstone_cap) {}
YellowstoneClient(const YellowstoneClient&) = delete;
YellowstoneClient(YellowstoneClient&& other) : endpoint_(other.endpoint_) {other.endpoint_ = 0;};
z_cap_t Capability() { return endpoint_; }
[[nodiscard]] glcr::ErrorCode RegisterEndpoint(const RegisterEndpointRequest& request, Empty& response);
[[nodiscard]] glcr::ErrorCode GetAhciInfo(const Empty& request, AhciInfo& response);
[[nodiscard]] glcr::ErrorCode GetDenali(const Empty& request, DenaliInfo& response);
private:
z_cap_t endpoint_;
uint64_t kBufferSize = 0x1000;
glcr::ByteBuffer buffer_{kBufferSize};
uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize};
};

View file

@ -0,0 +1,234 @@
// Generated file -- DO NOT MODIFY.
#include "yellowstone.yunq.h"
namespace {
const uint64_t header_size = 24; // 4x uint32, 1x uint64
struct ExtPointer {
uint32_t offset;
uint32_t length;
};
void CheckHeader(const glcr::ByteBuffer& bytes) {
// TODO: Check ident.
// TODO: Parse core size.
// TODO: Parse extension size.
// TODO: Check CRC32
// TODO: Parse options.
}
void WriteHeader(glcr::ByteBuffer& bytes, uint64_t offset, uint32_t core_size, uint32_t extension_size) {
bytes.WriteAt<uint32_t>(offset + 0, 0xDEADBEEF); // TODO: Chose a more unique ident sequence.
bytes.WriteAt<uint32_t>(offset + 4, core_size);
bytes.WriteAt<uint32_t>(offset + 8, extension_size);
bytes.WriteAt<uint32_t>(offset + 12, 0); // TODO: Calculate CRC32.
bytes.WriteAt<uint64_t>(offset + 16, 0); // TODO: Add options.
}
} // namespace
void RegisterEndpointRequest::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
CheckHeader(bytes);
// Parse endpoint_name.
auto endpoint_name_pointer = bytes.At<ExtPointer>(offset + header_size + (8 * 0));
set_endpoint_name(bytes.StringAt(offset + endpoint_name_pointer.offset, endpoint_name_pointer.length));
// Parse endpoint_capability.
// FIXME: Implement in-buffer capabilities for inprocess serialization.
set_endpoint_capability(0);
}
void RegisterEndpointRequest::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset, const glcr::CapBuffer& caps) {
CheckHeader(bytes);
// Parse endpoint_name.
auto endpoint_name_pointer = bytes.At<ExtPointer>(offset + header_size + (8 * 0));
set_endpoint_name(bytes.StringAt(offset + endpoint_name_pointer.offset, endpoint_name_pointer.length));
// Parse endpoint_capability.
uint64_t endpoint_capability_ptr = bytes.At<uint64_t>(offset + header_size + (8 * 1));
set_endpoint_capability(caps.At(endpoint_capability_ptr));
}
uint64_t RegisterEndpointRequest::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset) const {
uint32_t next_extension = header_size + 8 * 2;
const uint32_t core_size = next_extension;
// Write endpoint_name.
ExtPointer endpoint_name_ptr{
.offset = next_extension,
// FIXME: Check downcast of str length.
.length = (uint32_t)endpoint_name().length(),
};
bytes.WriteStringAt(offset + next_extension, endpoint_name());
next_extension += endpoint_name_ptr.length;
bytes.WriteAt<ExtPointer>(offset + header_size + (8 * 0), endpoint_name_ptr);
// Write endpoint_capability.
// FIXME: Implement inbuffer capabilities.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), 0);
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
uint64_t RegisterEndpointRequest::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, glcr::CapBuffer& caps) const {
uint32_t next_extension = header_size + 8 * 2;
const uint32_t core_size = next_extension;
uint64_t next_cap = 0;
// Write endpoint_name.
ExtPointer endpoint_name_ptr{
.offset = next_extension,
// FIXME: Check downcast of str length.
.length = (uint32_t)endpoint_name().length(),
};
bytes.WriteStringAt(offset + next_extension, endpoint_name());
next_extension += endpoint_name_ptr.length;
bytes.WriteAt<ExtPointer>(offset + header_size + (8 * 0), endpoint_name_ptr);
// Write endpoint_capability.
caps.WriteAt(next_cap, endpoint_capability());
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), next_cap++);
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
void Empty::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
CheckHeader(bytes);
}
void Empty::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset, const glcr::CapBuffer& caps) {
CheckHeader(bytes);
}
uint64_t Empty::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset) const {
uint32_t next_extension = header_size + 8 * 0;
const uint32_t core_size = next_extension;
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
uint64_t Empty::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, glcr::CapBuffer& caps) const {
uint32_t next_extension = header_size + 8 * 0;
const uint32_t core_size = next_extension;
uint64_t next_cap = 0;
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
void AhciInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
CheckHeader(bytes);
// Parse ahci_region.
// FIXME: Implement in-buffer capabilities for inprocess serialization.
set_ahci_region(0);
// Parse region_length.
set_region_length(bytes.At<uint64_t>(offset + header_size + (8 * 1)));
}
void AhciInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset, const glcr::CapBuffer& caps) {
CheckHeader(bytes);
// Parse ahci_region.
uint64_t ahci_region_ptr = bytes.At<uint64_t>(offset + header_size + (8 * 0));
set_ahci_region(caps.At(ahci_region_ptr));
// Parse region_length.
set_region_length(bytes.At<uint64_t>(offset + header_size + (8 * 1)));
}
uint64_t AhciInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset) const {
uint32_t next_extension = header_size + 8 * 2;
const uint32_t core_size = next_extension;
// Write ahci_region.
// FIXME: Implement inbuffer capabilities.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 0), 0);
// Write region_length.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), region_length());
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
uint64_t AhciInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, glcr::CapBuffer& caps) const {
uint32_t next_extension = header_size + 8 * 2;
const uint32_t core_size = next_extension;
uint64_t next_cap = 0;
// Write ahci_region.
caps.WriteAt(next_cap, ahci_region());
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 0), next_cap++);
// Write region_length.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), region_length());
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
void DenaliInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
CheckHeader(bytes);
// Parse denali_endpoint.
// FIXME: Implement in-buffer capabilities for inprocess serialization.
set_denali_endpoint(0);
// Parse device_id.
set_device_id(bytes.At<uint64_t>(offset + header_size + (8 * 1)));
// Parse lba_offset.
set_lba_offset(bytes.At<uint64_t>(offset + header_size + (8 * 2)));
}
void DenaliInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset, const glcr::CapBuffer& caps) {
CheckHeader(bytes);
// Parse denali_endpoint.
uint64_t denali_endpoint_ptr = bytes.At<uint64_t>(offset + header_size + (8 * 0));
set_denali_endpoint(caps.At(denali_endpoint_ptr));
// Parse device_id.
set_device_id(bytes.At<uint64_t>(offset + header_size + (8 * 1)));
// Parse lba_offset.
set_lba_offset(bytes.At<uint64_t>(offset + header_size + (8 * 2)));
}
uint64_t DenaliInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset) const {
uint32_t next_extension = header_size + 8 * 3;
const uint32_t core_size = next_extension;
// Write denali_endpoint.
// FIXME: Implement inbuffer capabilities.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 0), 0);
// Write device_id.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), device_id());
// Write lba_offset.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 2), lba_offset());
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
uint64_t DenaliInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, glcr::CapBuffer& caps) const {
uint32_t next_extension = header_size + 8 * 3;
const uint32_t core_size = next_extension;
uint64_t next_cap = 0;
// Write denali_endpoint.
caps.WriteAt(next_cap, denali_endpoint());
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 0), next_cap++);
// Write device_id.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), device_id());
// Write lba_offset.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 2), lba_offset());
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}

View file

@ -0,0 +1,88 @@
// Generated file - DO NOT MODIFY
#pragma once
#include <glacier/buffer/byte_buffer.h>
#include <glacier/buffer/cap_buffer.h>
#include <glacier/string/string.h>
#include <ztypes.h>
class RegisterEndpointRequest {
public:
RegisterEndpointRequest() {}
// Delete copy and move until implemented.
RegisterEndpointRequest(const RegisterEndpointRequest&) = delete;
RegisterEndpointRequest(RegisterEndpointRequest&&) = delete;
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
glcr::String endpoint_name() const { return endpoint_name_; }
void set_endpoint_name(const glcr::String& value) { endpoint_name_ = value; }
z_cap_t endpoint_capability() const { return endpoint_capability_; }
void set_endpoint_capability(const z_cap_t& value) { endpoint_capability_ = value; }
private:
glcr::String endpoint_name_;
z_cap_t endpoint_capability_;
};
class Empty {
public:
Empty() {}
// Delete copy and move until implemented.
Empty(const Empty&) = delete;
Empty(Empty&&) = delete;
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
private:
};
class AhciInfo {
public:
AhciInfo() {}
// Delete copy and move until implemented.
AhciInfo(const AhciInfo&) = delete;
AhciInfo(AhciInfo&&) = delete;
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
z_cap_t ahci_region() const { return ahci_region_; }
void set_ahci_region(const z_cap_t& value) { ahci_region_ = value; }
uint64_t region_length() const { return region_length_; }
void set_region_length(const uint64_t& value) { region_length_ = value; }
private:
z_cap_t ahci_region_;
uint64_t region_length_;
};
class DenaliInfo {
public:
DenaliInfo() {}
// Delete copy and move until implemented.
DenaliInfo(const DenaliInfo&) = delete;
DenaliInfo(DenaliInfo&&) = delete;
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
z_cap_t denali_endpoint() const { return denali_endpoint_; }
void set_denali_endpoint(const z_cap_t& value) { denali_endpoint_ = value; }
uint64_t device_id() const { return device_id_; }
void set_device_id(const uint64_t& value) { device_id_ = value; }
uint64_t lba_offset() const { return lba_offset_; }
void set_lba_offset(const uint64_t& value) { lba_offset_ = value; }
private:
z_cap_t denali_endpoint_;
uint64_t device_id_;
uint64_t lba_offset_;
};

View file

@ -0,0 +1,126 @@
// Generated file -- DO NOT MODIFY.
#include "yellowstone.yunq.server.h"
#include <mammoth/debug.h>
#include <zcall.h>
namespace {
const uint32_t kSentinel = 0xBEEFDEAD;
const uint32_t kHeaderSize = 0x10;
void WriteError(glcr::ByteBuffer& buffer, glcr::ErrorCode err) {
buffer.WriteAt<uint32_t>(0, kSentinel);
buffer.WriteAt<uint32_t>(4, kHeaderSize);
buffer.WriteAt<uint64_t>(8, err);
}
void WriteHeader(glcr::ByteBuffer& buffer, uint64_t message_length) {
buffer.WriteAt<uint32_t>(0, kSentinel);
buffer.WriteAt<uint32_t>(4, kHeaderSize + message_length);
buffer.WriteAt<uint64_t>(8, glcr::OK);
}
} // namespace
void YellowstoneServerBaseThreadBootstrap(void* server_base) {
((YellowstoneServerBase*)server_base)->ServerThread();
}
glcr::ErrorOr<YellowstoneClient> YellowstoneServerBase::CreateClient() {
uint64_t client_cap;
// FIXME: Restrict permissions to send-only here.
RET_ERR(ZCapDuplicate(endpoint_, &client_cap));
return YellowstoneClient(client_cap);
}
Thread YellowstoneServerBase::RunServer() {
return Thread(YellowstoneServerBaseThreadBootstrap, this);
}
void YellowstoneServerBase::ServerThread() {
glcr::ByteBuffer recv_buffer(0x1000);
glcr::CapBuffer recv_cap(0x10);
glcr::ByteBuffer resp_buffer(0x1000);
glcr::CapBuffer resp_cap(0x10);
z_cap_t reply_port_cap;
while (true) {
uint64_t recv_cap_size = 0x10;
uint64_t recv_buf_size = 0x1000;
glcr::ErrorCode recv_err = ZEndpointRecv(endpoint_, &recv_buf_size, recv_buffer.RawPtr(), &recv_cap_size, recv_cap.RawPtr(), &reply_port_cap);
if (recv_err != glcr::OK) {
dbgln("Error in receive: %x", recv_err);
continue;
}
uint64_t resp_length = 0;
glcr::ErrorCode reply_err = glcr::OK;
glcr::ErrorCode err = HandleRequest(recv_buffer, recv_cap, resp_buffer, resp_length, resp_cap);
if (err != glcr::OK) {
WriteError(resp_buffer, err);
reply_err = ZReplyPortSend(reply_port_cap, kHeaderSize, resp_buffer.RawPtr(), 0, nullptr);
} else {
WriteHeader(resp_buffer, resp_length);
reply_err = ZReplyPortSend(reply_port_cap, kHeaderSize + resp_length, resp_buffer.RawPtr(), resp_cap.UsedSlots(), resp_cap.RawPtr());
}
if (reply_err != glcr::OK) {
dbgln("Error in reply: %x", recv_err);
}
}
}
glcr::ErrorCode YellowstoneServerBase::HandleRequest(const glcr::ByteBuffer& request,
const glcr::CapBuffer& req_caps,
glcr::ByteBuffer& response, uint64_t& resp_length,
glcr::CapBuffer& resp_caps) {
if (request.At<uint32_t>(0) != kSentinel) {
return glcr::INVALID_ARGUMENT;
}
uint64_t method_select = request.At<uint64_t>(8);
switch(method_select) {
case 0: {
RegisterEndpointRequest yunq_request;
Empty yunq_response;
yunq_request.ParseFromBytes(request, kHeaderSize, req_caps);
RET_ERR(HandleRegisterEndpoint(yunq_request, yunq_response));
resp_length = yunq_response.SerializeToBytes(response, kHeaderSize, resp_caps);
break;
}
case 1: {
Empty yunq_request;
AhciInfo yunq_response;
yunq_request.ParseFromBytes(request, kHeaderSize, req_caps);
RET_ERR(HandleGetAhciInfo(yunq_request, yunq_response));
resp_length = yunq_response.SerializeToBytes(response, kHeaderSize, resp_caps);
break;
}
case 2: {
Empty yunq_request;
DenaliInfo yunq_response;
yunq_request.ParseFromBytes(request, kHeaderSize, req_caps);
RET_ERR(HandleGetDenali(yunq_request, yunq_response));
resp_length = yunq_response.SerializeToBytes(response, kHeaderSize, resp_caps);
break;
}
default: {
return glcr::UNIMPLEMENTED;
}
}
return glcr::OK;
}

View file

@ -0,0 +1,41 @@
// Generated File -- DO NOT MODIFY.
#pragma once
#include <glacier/status/error_or.h>
#include <mammoth/thread.h>
#include <ztypes.h>
#include "yellowstone.yunq.h"
#include "yellowstone.yunq.client.h"
class YellowstoneServerBase {
public:
YellowstoneServerBase(z_cap_t Yellowstone_cap) : endpoint_(Yellowstone_cap) {}
YellowstoneServerBase(const YellowstoneServerBase&) = delete;
YellowstoneServerBase(YellowstoneServerBase&&) = delete;
glcr::ErrorOr<YellowstoneClient> CreateClient();
[[nodiscard]] Thread RunServer();
[[nodiscard]] virtual glcr::ErrorCode HandleRegisterEndpoint(const RegisterEndpointRequest&, Empty&) = 0;
[[nodiscard]] virtual glcr::ErrorCode HandleGetAhciInfo(const Empty&, AhciInfo&) = 0;
[[nodiscard]] virtual glcr::ErrorCode HandleGetDenali(const Empty&, DenaliInfo&) = 0;
private:
z_cap_t endpoint_;
friend void YellowstoneServerBaseThreadBootstrap(void*);
void ServerThread();
[[nodiscard]] glcr::ErrorCode HandleRequest(const glcr::ByteBuffer& request, const glcr::CapBuffer& req_caps,
glcr::ByteBuffer& response, uint64_t& resp_length,
glcr::CapBuffer& resp_caps);
};