acadia/zion/object/endpoint.h

40 lines
897 B
C
Raw Normal View History

2023-06-21 23:14:42 -07:00
#pragma once
#include <glacier/container/intrusive_list.h>
#include <glacier/memory/ref_ptr.h>
#include <glacier/status/error.h>
#include "lib/message_queue.h"
#include "lib/mutex.h"
2023-06-21 23:42:21 -07:00
#include "object/ipc_object.h"
2023-06-21 23:14:42 -07:00
#include "object/kernel_object.h"
class Endpoint;
class ReplyPort;
template <>
struct KernelObjectTag<Endpoint> {
static const uint64_t type = KernelObject::ENDPOINT;
};
2023-06-21 23:42:21 -07:00
class Endpoint : public IpcObject {
2023-06-21 23:14:42 -07:00
public:
uint64_t TypeTag() override { return KernelObject::ENDPOINT; }
static glcr::RefPtr<Endpoint> Create();
glcr::ErrorCode Read(uint64_t* num_bytes, void* data,
z_cap_t* reply_port_cap);
2023-06-21 23:42:21 -07:00
virtual MessageQueue& GetSendMessageQueue() override {
return message_queue_;
}
virtual MessageQueue& GetRecvMessageQueue() override {
return message_queue_;
}
2023-06-21 23:14:42 -07:00
private:
UnboundedMessageQueue message_queue_;
Endpoint() {}
};