acadia/zion/object/endpoint.h

41 lines
913 B
C
Raw Permalink 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"
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 uint64_t DefaultPermissions() {
return kZionPerm_Read | kZionPerm_Write | kZionPerm_Duplicate |
kZionPerm_Transmit;
}
2023-06-21 23:14:42 -07:00
static glcr::RefPtr<Endpoint> Create();
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() {}
};