[Mammoth] Move ipc calls to separate folder mammoth.
This commit is contained in:
parent
19e394ae7b
commit
ad5b55bf37
19 changed files with 21 additions and 27 deletions
36
lib/mammoth/ipc/endpoint_server.h
Normal file
36
lib/mammoth/ipc/endpoint_server.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <glacier/memory/unique_ptr.h>
|
||||
#include <glacier/status/error_or.h>
|
||||
#include <ztypes.h>
|
||||
|
||||
#include "mammoth/ipc/endpoint_client.h"
|
||||
#include "mammoth/request_context.h"
|
||||
#include "mammoth/response_context.h"
|
||||
#include "mammoth/thread.h"
|
||||
|
||||
class EndpointServer {
|
||||
public:
|
||||
EndpointServer() = delete;
|
||||
EndpointServer(const EndpointServer&) = delete;
|
||||
EndpointServer& operator=(const EndpointServer&) = delete;
|
||||
|
||||
glcr::ErrorOr<glcr::UniquePtr<EndpointClient>> CreateClient();
|
||||
|
||||
Thread RunServer();
|
||||
|
||||
virtual glcr::ErrorCode HandleRequest(RequestContext& request,
|
||||
ResponseContext& response) = 0;
|
||||
|
||||
protected:
|
||||
EndpointServer(z_cap_t cap) : endpoint_cap_(cap) {}
|
||||
|
||||
private:
|
||||
z_cap_t endpoint_cap_;
|
||||
|
||||
static const uint64_t kBufferSize = 1024;
|
||||
uint8_t recieve_buffer_[kBufferSize];
|
||||
|
||||
friend void EndpointServerThreadBootstrap(void* endpoint_server);
|
||||
void ServerThread();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue