summaryrefslogtreecommitdiff
path: root/common/connectionbase.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/connectionbase.h')
m---------common0
-rw-r--r--common/connectionbase.h49
2 files changed, 0 insertions, 49 deletions
diff --git a/common b/common
new file mode 160000
+Subproject dd64a35c949738c2c321989d065e0754556823d
diff --git a/common/connectionbase.h b/common/connectionbase.h
deleted file mode 100644
index f86a9ab..0000000
--- a/common/connectionbase.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef CONNECTIONBASE_H
-#define CONNECTIONBASE_H
-
-#include <stdint.h>
-#include <cstdlib>
-#include <string>
-
-#include "message.h"
-
-class ConnectionBase {
- private:
- Message::Type pending_type;
- std::size_t pending_size;
-
- protected:
- //! Initiate reception of a message.
- void start_recv();
-
- //! Deliver received data.
- //! \param data Pointer to received data. Ownership is retained by caller.
- //! \param bytes Size of data.
- void got_data(uint8_t* data, std::size_t bytes);
-
- //! Called to request data.
- //! \param bytes Amount of data requested.
- virtual void request_data(std::size_t bytes) = 0;
-
- //! Called to write data.
- //! \param data Pointer to data to send. Ownership is transferred to callee.
- //! \param bytes Size of data.
- virtual void write_data(uint8_t* data, std::size_t bytes) = 0;
-
- //! Called when a message is received.
- //! \param msg Received message.
- virtual void got_message(const Message::p& msg) = 0;
-
- //! Called upon error (lost connection or failed deserialization).
- //! \param msg Error message.
- virtual void error(const std::string& msg) = 0;
-
- public:
- ConnectionBase();
- virtual ~ConnectionBase();
-
- //! Send a message.
- void send(const Message::p& msg);
-};
-
-#endif