Making another one, cleaning up some
This commit is contained in:
24
src/connection.h
Normal file
24
src/connection.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
// This is to wrap the platform specific kinds of connect/read/write.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct RpcMessageFrame {
|
||||
uint32_t length;
|
||||
char message[64 * 1024 - sizeof(uint32_t)];
|
||||
};
|
||||
|
||||
struct RpcConnection {
|
||||
void (*onConnect)() = nullptr;
|
||||
void (*onDisconnect)() = nullptr;
|
||||
|
||||
static RpcConnection* Create();
|
||||
static void Destroy(RpcConnection*&);
|
||||
void Open();
|
||||
void Close();
|
||||
void Write(const void* data, size_t length);
|
||||
|
||||
RpcMessageFrame* GetNextFrame();
|
||||
void WriteFrame(RpcMessageFrame* frame);
|
||||
};
|
Reference in New Issue
Block a user