aboutsummaryrefslogtreecommitdiff
path: root/node/node.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-12 14:26:12 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-12 14:26:12 +0200
commit7bca48bc5b5e37a3a8b0b23e57b88d069fa50589 (patch)
tree47cd62512e631a064852015c65bb1965bc72414a /node/node.hpp
parent0fb433690c0ca5f9561fe9e2e973e2cd61b873ba (diff)
downloadcmix-7bca48bc5b5e37a3a8b0b23e57b88d069fa50589.tar.gz
cmix-7bca48bc5b5e37a3a8b0b23e57b88d069fa50589.tar.bz2
cmix-7bca48bc5b5e37a3a8b0b23e57b88d069fa50589.zip
Major network rewrite.
One generic class has been introduced to handle all connection types. Typedefs provide Sender Receiver and SenderReceiver types, which limit the functionality of the types. As to not accidentally communicate with the wrong node about things.
Diffstat (limited to 'node/node.hpp')
-rw-r--r--node/node.hpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/node/node.hpp b/node/node.hpp
index 44e379f..9f1f3a2 100644
--- a/node/node.hpp
+++ b/node/node.hpp
@@ -1,9 +1,7 @@
#pragma once
#include "server.hpp"
-#include "nodeclient.hpp"
-#include "prevnode.hpp"
-#include "nextnode.hpp"
+#include "protobufclient.hpp"
#include "api.h"
@@ -33,13 +31,13 @@ class Node
{
boost::asio::io_service io_service;
Server server;
- std::list<Client> purgatory;
- std::list<Client> clients;
+ std::list<Receiver> purgatory;
+ std::list<SenderReceiver> clients;
NodeNetworkSettings network_settings;
- PrevNode prev_node;
- NextNode next_node;
+ Receiver prev_node;
+ Sender next_node;
Api api;
KeyPair keypair;
@@ -50,16 +48,14 @@ class Node
void start_precomputation();
void start_initialisation();
- cmix_proto::CMixMessage parse_cmix_message(std::vector<uint8_t> const& buffer);
-
void handle_initialization(cmix_proto::Initialization const& init);
- void handle_node_message(std::vector<uint8_t> const& message_buffer);
+ void handle_node_message(cmix_proto::CMixMessage message);
- void handle_client_message(std::list<Client>::iterator handle, std::vector<uint8_t> const& message_buffer);
+ void handle_client_message(std::list<SenderReceiver>::iterator handle, cmix_proto::CMixMessage message);
- void handle_imanode(std::list<Client>::iterator handle);
- void handle_imaclient(std::list<Client>::iterator handle);
- void handle_message(std::list<Client>::iterator handle, std::vector<uint8_t> const& message_buffer);
+ void handle_imanode(std::list<Receiver>::iterator handle);
+ void handle_imaclient(std::list<Receiver>::iterator handle);
+ void handle_message(std::list<ProtobufClient<Receive>>::iterator handle, cmix_proto::CMixMessage message);
public: