Making another one, cleaning up some

This commit is contained in:
Chris Marsh
2017-06-30 16:18:54 -07:00
parent ae13d40b74
commit 47c488ac6b
9 changed files with 441 additions and 3 deletions

24
src/connection.h Normal file
View 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);
};