aboutsummaryrefslogtreecommitdiff
path: root/node/node.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-11-12 13:48:30 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2016-11-12 13:48:30 +0100
commitf93d52bbd0053574fb35d72b85c4b299dc1f3ee5 (patch)
tree4a2120a162ce9161d70074fd9ffa3ed21d80a40e /node/node.hpp
parent8ff9babe2da4a2efc8529e800a6093fbd0327286 (diff)
downloadcmix-f93d52bbd0053574fb35d72b85c4b299dc1f3ee5.tar.gz
cmix-f93d52bbd0053574fb35d72b85c4b299dc1f3ee5.tar.bz2
cmix-f93d52bbd0053574fb35d72b85c4b299dc1f3ee5.zip
Fixes decryption share calculation, adds lots of debugging statements.
Diffstat (limited to 'node/node.hpp')
-rw-r--r--node/node.hpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/node/node.hpp b/node/node.hpp
index a4c7992..b166c71 100644
--- a/node/node.hpp
+++ b/node/node.hpp
@@ -14,11 +14,23 @@
#include <list>
#include <string>
+#include <queue>
+#include <iomanip>
/*!
* \file
*/
+#ifndef NDEBUG
+inline std::string to_string(GroupElement el, CMixContext const& ctx) {
+ std::string ret;
+ ret.resize(get_group_element_array_size(&ctx));
+
+ element_to_buffer(&ctx, &ret[0], el);
+ return ret;
+}
+#endif
+
/*!
* \brief The NodeNetworkSettings struct
*/
@@ -30,29 +42,17 @@ struct NodeNetworkSettings {
std::string certdir; ///< Directory containing trusted certificate authorities.
};
-struct MixData {
- GroupElement r;
- GroupElement s;
- std::string client_handle;
- size_t new_location;
-
- ~MixData(){
- Api api = get_implementation();
- api.free_group_element(r);
- api.free_group_element(s);
- }
-};
-
/*!
* \brief The Node class
*/
class Node
{
struct CMixClientData {
- SharedKey shared_value;
+ GroupElement shared_value;
};
boost::asio::io_service io_service;
+ boost::asio::deadline_timer timer;
std::shared_ptr<boost::asio::ssl::context> ssl_ctx;
Server server;
@@ -63,6 +63,8 @@ class Node
ClientConnections clients;
typedef std::map<std::string, CMixClientData> ClientData;
ClientData data;
+ typedef std::map<std::string, std::queue<std::string>> ClientMessages;
+ ClientMessages messages;
NodeNetworkSettings network_settings;
@@ -71,26 +73,29 @@ class Node
CMixContext cmix_ctx;
- std::vector<MixData> precomputation_data;
- std::map<std::string, int> index_map;
+ std::map<std::string, unsigned int> index_map;
bool shutting_down;
void accept_handler(std::unique_ptr<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>>&& socket, std::shared_ptr<boost::asio::ssl::context> ctx);
void connect_to_next_node();
- void start_precomputation();
void start_initialisation();
+ void start_precomputation();
+ void start_realtime_phase();
void handle_node_initialization(cmix_proto::Initialization const& init);
void handle_node_secretkey(cmix_proto::SecretKey const& secret);
void handle_node_prepre(cmix_proto::PrePre const& prepre);
void handle_node_premix(cmix_proto::PreMix const& premix);
void handle_node_prepost(cmix_proto::PrePost const& prepost);
+ void handle_node_realpre(cmix_proto::RealPre const& realpre);
+ void handle_node_realmix(cmix_proto::RealMix const& realmix);
void handle_node_message(cmix_proto::CMixMessage message);
void handle_client_keyexchange(ClientConnections::key_type handle, cmix_proto::KeyExchange const& ke);
void handle_client_bye(ClientConnections::key_type handle, cmix_proto::Bye const&);
+ void handle_client_usermessage(ClientConnections::key_type handle, cmix_proto::UserMessage const& um);
void handle_client_message(ClientConnections::key_type handle, cmix_proto::CMixMessage message);
void handle_imanode(Purgatory::iterator handle, cmix_proto::ImANode const&);