diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2017-04-16 22:49:17 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2017-04-16 22:49:17 +0200 |
| commit | 4895eff27938fa72e5a638ff173920e823ebb115 (patch) | |
| tree | 6e8424f95f6b3c4cefd6ef4d1891a76059ce8276 | |
| parent | 33f81a3a57a047326160f371f3269dfb47c59cba (diff) | |
| download | cmix-4895eff27938fa72e5a638ff173920e823ebb115.tar.gz cmix-4895eff27938fa72e5a638ff173920e823ebb115.tar.bz2 cmix-4895eff27938fa72e5a638ff173920e823ebb115.zip | |
Updated documentation and bumped Cmix to Version 1.0
| -rw-r--r-- | CMakeLists.txt | 4 | ||||
| -rw-r--r-- | Doxyfile.in | 2 | ||||
| -rw-r--r-- | libcmix-common/performanceclient.hpp | 19 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/CMakeLists.txt | 32 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/curve25519.c | 34 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/curve25519.h | 67 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/null/CMakeLists.txt | 15 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/null/null_curve25519.c | 47 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/sodium/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/sodium/libsodium_curve25519.c | 104 | ||||
| -rw-r--r-- | libcmix-crypto/impl_macros.h | 4 | ||||
| -rw-r--r-- | libcmix-network/connect.hpp | 2 | ||||
| -rw-r--r-- | libcmix-network/protobufclient.hpp | 3 | ||||
| -rw-r--r-- | libcmix/cmix.h | 73 | ||||
| -rw-r--r-- | node/node.hpp | 19 | ||||
| -rw-r--r-- | statsd/stats.hpp | 20 |
16 files changed, 102 insertions, 357 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b13ae4f..226c73d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,8 @@ if(COMPILING_WITH_CLANG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-documentation-unknown-command -Wno-documentation -Wno-shadow-field-in-constructor") endif(COMPILING_WITH_CLANG) -set(VERSION_MAJOR 0 CACHE STRING "Project major version number.") -set(VERSION_MINOR 1 CACHE STRING "Project minor version number.") +set(VERSION_MAJOR 1 CACHE STRING "Project major version number.") +set(VERSION_MINOR 0 CACHE STRING "Project minor version number.") set(VERSION_PATCH 0 CACHE STRING "Project patch version number.") mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH) diff --git a/Doxyfile.in b/Doxyfile.in index dcab54d..5f6a2bc 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -12,4 +12,4 @@ FILE_PATTERNS = *.h \ RECURSIVE = YES USE_MDFILE_AS_MAINPAGE = @doxy_main_page@ ENABLE_PREPROCESSING = YES - +OUTPUT_LANGUAGE = ENGLISH diff --git a/libcmix-common/performanceclient.hpp b/libcmix-common/performanceclient.hpp index cb9afb1..7c4e501 100644 --- a/libcmix-common/performanceclient.hpp +++ b/libcmix-common/performanceclient.hpp @@ -4,13 +4,32 @@ #include <boost/timer/timer.hpp> +/*! + * \file + */ + +/*! + * \brief The PerformanceClient class: Cpu timing class to keep track of performance. + */ class PerformanceClient { std::string node_name; Sender sender; boost::timer::cpu_timer timer; public: + + /*! + * \brief PerformanceClient Cpu timing class to keep track of performance. + * \param name The name of the client this will result in seperate files on the server side. + * \param io_service the io_service it should run under. + * \param host The host on which the statsd is running. + * \param port The port on which the statsd is running. + */ PerformanceClient(std::string name, boost::asio::io_service& io_service, std::string host, std::string port); + /*! + * \brief send Send a timestamp message to the server. + * \param column What event (or column) + */ void send(std::string column); };
\ No newline at end of file diff --git a/libcmix-crypto/curve25519/CMakeLists.txt b/libcmix-crypto/curve25519/CMakeLists.txt deleted file mode 100644 index 847c26c..0000000 --- a/libcmix-crypto/curve25519/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -add_library(curve25519-interface INTERFACE) - -target_include_directories(curve25519-interface - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_sources(curve25519-interface - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/curve25519.h -) - -target_link_libraries(curve25519-interface - INTERFACE cmix-crypto-interface -) - -foreach(impl ${libcmix_crypto_curve25519_implementations}) - add_subdirectory(${impl}) -endforeach() - -add_library(curve25519-implementation - curve25519.h curve25519.c -) - -target_include_directories(curve25519-implementation - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_link_libraries(curve25519-implementation - PUBLIC curve25519-interface - PUBLIC curve25519-${libcmix_crypto_curve25519_implementation} -) - - diff --git a/libcmix-crypto/curve25519/curve25519.c b/libcmix-crypto/curve25519/curve25519.c deleted file mode 100644 index 2fb99c3..0000000 --- a/libcmix-crypto/curve25519/curve25519.c +++ /dev/null @@ -1,34 +0,0 @@ - -#include "curve25519.h" - -struct Api get_curve25519_implementation() -{ - curve25519_initialize(); - return (struct Api) { - .initialize = curve25519_initialize, - .create_keypair = curve25519_create_keypair, - .free_keypair = curve25519_delete_keypair, - .element_to_array = curve25519_element_to_array, - .free_buffer = curve25519_free_buffer, - .array_to_element = curve25519_array_to_element, - .message_to_element = curve25519_message_to_element, - .get_pub_key_hash = curve25519_get_pub_key_hash, - .get_pub_key_hash_length = curve25519_get_pub_key_hash_length, - .get_group_element = curve25519_get_group_element, - .get_group_element_array_size = curve25519_get_group_element_array_size, - .free_group_element = curve25519_delete_group_element, - .get_key_exchange_value = curve25519_get_key_exchange_value, - .combine = curve25519_combine, - .uncombine = curve25519_uncombine, - .get_decryption_share = curve25519_get_decryption_share, - .add_public_share = curve25519_add_public_share, - .derive_shared_key = curve25519_derive_shared_key, - .free_shared_key = curve25519_delete_shared_key, - .encrypt = curve25519_encrypt, - .invert = curve25519_invert, - .get_uniform_int = curve25519_get_uniform_int, - .deinitialize = curve25519_deinitialize - }; -} - -ImplementationGetter get_implementation = &get_curve25519_implementation; diff --git a/libcmix-crypto/curve25519/curve25519.h b/libcmix-crypto/curve25519/curve25519.h deleted file mode 100644 index f424144..0000000 --- a/libcmix-crypto/curve25519/curve25519.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * \file - */ - -extern Initializer curve25519_initialize; - -extern KeyPairCreator curve25519_create_keypair; - -extern KeyPairDeleter curve25519_delete_keypair; - -extern ElementToArray curve25519_element_to_array; - -extern BufferDeleter curve25519_free_buffer; - -extern ArrayToElement curve25519_array_to_element; - -extern MessageToElement curve25519_message_to_element; - -extern PubKeyHashGetter curve25519_get_pub_key_hash; - -extern PubKeyHashLengthGetter curve25519_get_pub_key_hash_length; - -extern GroupElementGetter curve25519_get_group_element; - -extern GroupElementDeleter curve25519_delete_group_element; - -extern KeyExchangeValueGetter curve25519_get_key_exchange_value; - -extern GroupElementCombiner curve25519_combine; - -extern GroupElementUncombiner curve25519_uncombine; - -extern DecryptionShareGetter curve25519_get_decryption_share; - -extern GroupElementArraySizeGetter curve25519_get_group_element_array_size; - -extern PublicShareAdder curve25519_add_public_share; - -extern SharedKeyDeriver curve25519_derive_shared_key; - -extern SharedKeyDeleter curve25519_delete_shared_key; - -extern Encrypter curve25519_encrypt; - -extern Inverter curve25519_invert; - -extern UniformIntGetter curve25519_get_uniform_int; - -extern Deinitializer curve25519_deinitialize; - -/*! - * \brief get_curve25519_implementation - * \return An Api struct filled with a curve25519 implementation. - */ -struct Api get_curve25519_implementation(); - -#ifdef __cplusplus -} -#endif diff --git a/libcmix-crypto/curve25519/null/CMakeLists.txt b/libcmix-crypto/curve25519/null/CMakeLists.txt deleted file mode 100644 index 94dac1b..0000000 --- a/libcmix-crypto/curve25519/null/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -include(get_target_name) - -get_target_name(target_name algo api) - -add_library(${target_name} SHARED - null_curve25519.c -) - -target_compile_options(${target_name} - PRIVATE -Wno-unused-parameter -) - -target_link_libraries(${target_name} - PRIVATE curve25519-interface -) diff --git a/libcmix-crypto/curve25519/null/null_curve25519.c b/libcmix-crypto/curve25519/null/null_curve25519.c deleted file mode 100644 index 19c52f4..0000000 --- a/libcmix-crypto/curve25519/null/null_curve25519.c +++ /dev/null @@ -1,47 +0,0 @@ - -#include "curve25519.h" - -#include <stddef.h> -#include <stdbool.h> - -void null_curve25519_initialize(void){} - -struct KeyPair null_curve25519_create_keypair(void) { - return (struct KeyPair){ - NULL, - NULL, - }; -} - -void null_curve25519_delete_keypair(struct KeyPair* p) {} - -void null_curve25519_get_key_array(char** buffer, size_t* len, void* key) {} - -void null_curve25519_add_public_share(char** buffer, size_t* len_out, char const* share, size_t in_len, void* pubkey) {} - -void null_curve25519_shared_key_deleter(struct SharedKey* s) {} - - -GroupElement null_curve25519_derive_shared_key(struct KeyPair keypair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap) { - return NULL; -} - -void null_curve25519_deinitialize(void){} - -Initializer curve25519_initialize = &null_curve25519_initialize; -KeyPairCreator curve25519_create_keypair = &null_curve25519_create_keypair; -KeyPairDeleter curve25519_delete_keypair = &null_curve25519_delete_keypair; -ElementToArray curve25519_element_to_array = NULL;//&null_curve25519_element_to_array; -BufferDeleter curve25519_free_buffer = NULL;//&null_curve25519_free_buffer; -ArrayToElement curve25519_array_to_element = NULL;//&null_curve25519_array_to_element; -GroupElementGetter curve25519_get_group_element = NULL;//&null_curve25519_get_group_element; -GroupElementDeleter curve25519_delete_group_element = NULL;//&null_curve25519_delete_group_element; -KeyExchangeValueGetter curve25519_get_key_exchange_value = NULL;//&null_curve25519_get_key_exchange_value; -GroupElementCombiner curve25519_multiply = NULL;//&null_curve25519_multiply; -DecryptionShareGetter curve25519_get_decryption_share = NULL;//&null_curve25519_get_decryption_share; -GroupElementArraySizeGetter curve25519_get_group_element_array_size = NULL;//&null_curve25519_get_group_element_array_size; -PublicShareAdder curve25519_add_public_share = NULL;//&null_curve25519_add_public_share; -SharedKeyDeriver curve25519_derive_shared_key = &null_curve25519_derive_shared_key; -SharedKeyDeleter curve25519_delete_shared_key = NULL;//&null_curve25519_delete_shared_key; -Encrypter curve25519_encrypt = NULL;//&null_curve25519_encrypt; -Deinitializer curve25519_deinitialize = &null_curve25519_deinitialize; diff --git a/libcmix-crypto/curve25519/sodium/CMakeLists.txt b/libcmix-crypto/curve25519/sodium/CMakeLists.txt deleted file mode 100644 index f93abb4..0000000 --- a/libcmix-crypto/curve25519/sodium/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -include(get_target_name) - -get_target_name(target_name algo api) - -find_package(sodium REQUIRED CONFIG) - -add_library(${target_name} SHARED - libsodium_curve25519.c -) - -target_link_libraries(${target_name} - PRIVATE curve25519-interface - PUBLIC sodium -) diff --git a/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c b/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c deleted file mode 100644 index b8ed4c2..0000000 --- a/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c +++ /dev/null @@ -1,104 +0,0 @@ - -#include "curve25519.h" - -#include <sodium.h> - -#include <stddef.h> -#include <stdlib.h> - -void sodium_curve25519_initialize(void) { - if(sodium_init() == -1) { - exit(-1); - } -} - -void sodium_curve25519_delete_keypair(struct KeyPair* p) { - sodium_free(p->sec); - free(p->pub); - - p->sec = NULL; - p->pub = NULL; -} - -struct KeyPair sodium_curve25519_create_keypair(void) { - unsigned char* sec = (unsigned char*) sodium_malloc(crypto_box_SECRETKEYBYTES); - unsigned char* pub = (unsigned char*) malloc(crypto_box_PUBLICKEYBYTES); - - randombytes_buf(sec, crypto_box_SECRETKEYBYTES); - crypto_scalarmult_base(pub, sec); - - return (struct KeyPair){ - sec, - pub, - }; -} - -void sodium_curve25519_shared_key_deleter(struct SharedKey* s) { - sodium_free(s->shared); - - s->shared = NULL; -} - -void sodium_curve25519_key_to_array(unsigned char** buffer, size_t* len, void* key) { - (void)buffer; - (void)len; - (void)key; -} - -void sodium_curve25519_add_public_share(char** buffer, size_t* out_len, char const* share, size_t in_len, void* pubkey) { - (void) buffer; - (void) out_len; - (void) share; - (void) in_len; - (void) pubkey; -} - -GroupElement sodium_curve25519_derive_shared_key(struct KeyPair pair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap_pub_order) { - (void) pub_len; - (void) value_len; - unsigned char* shared = (unsigned char*) sodium_malloc(crypto_generichash_BYTES); - - crypto_generichash_state h; - - unsigned char* scalarmult_q = (unsigned char*) sodium_malloc(crypto_scalarmult_BYTES); - - if (crypto_scalarmult(scalarmult_q, (unsigned char const*) priv_value, (unsigned char const*) value) != 0) { - exit(-1); - } - - crypto_generichash_init(&h, NULL, 0U, crypto_generichash_BYTES); - crypto_generichash_update(&h, scalarmult_q, crypto_scalarmult_BYTES); - if(swap_pub_order) { - crypto_generichash_update(&h, (unsigned char const*) other_pub, crypto_box_PUBLICKEYBYTES); - crypto_generichash_update(&h, (unsigned char const*) pair.pub, crypto_box_PUBLICKEYBYTES); - } else { - crypto_generichash_update(&h, (unsigned char const*) pair.pub, crypto_box_PUBLICKEYBYTES); - crypto_generichash_update(&h, (unsigned char const*) other_pub, crypto_box_PUBLICKEYBYTES); - } - crypto_generichash_final(&h, shared, crypto_generichash_BYTES); - - sodium_free(scalarmult_q); - - return shared; -} - -void sodium_curve25519_deinitialize(void) {} - -Initializer curve25519_initialize = &sodium_curve25519_initialize; -KeyPairCreator curve25519_create_keypair = &sodium_curve25519_create_keypair; -KeyPairDeleter curve25519_delete_keypair = &sodium_curve25519_delete_keypair; -ElementToArray curve25519_element_to_array = NULL;//&sodium_curve25519_element_to_array; -BufferDeleter curve25519_free_buffer = NULL;//&sodium_curve25519_free_buffer; -ArrayToElement curve25519_array_to_element = NULL;//&sodium_curve25519_array_to_element; -GroupElementGetter curve25519_get_group_element = NULL;//&sodium_curve25519_get_group_element; -GroupElementDeleter curve25519_delete_group_element = NULL;//&sodium_curve25519_delete_group_element; -KeyExchangeValueGetter curve25519_get_key_exchange_value = NULL;//&sodium_curve25519_get_key_exchange_value; -GroupElementCombiner curve25519_combine = NULL;//&sodium_curve25519_multiply; -GroupElementUncombiner curve25519_uncombine = NULL; -DecryptionShareGetter curve25519_get_decryption_share = NULL;//&sodium_curve25519_get_decryption_share; -GroupElementArraySizeGetter curve25519_get_group_element_array_size = NULL;//&sodium_curve25519_get_group_element_array_size; -PublicShareAdder curve25519_add_public_share = NULL;//&sodium_curve25519_add_public_share; -SharedKeyDeriver curve25519_derive_shared_key = &sodium_curve25519_derive_shared_key; -SharedKeyDeleter curve25519_delete_shared_key = NULL;//&sodium_curve25519_delete_shared_key; -Encrypter curve25519_encrypt = NULL;//&sodium_curve25519_encrypt; -Deinitializer curve25519_deinitialize = &sodium_curve25519_deinitialize; diff --git a/libcmix-crypto/impl_macros.h b/libcmix-crypto/impl_macros.h index 15d8ddf..6c297b0 100644 --- a/libcmix-crypto/impl_macros.h +++ b/libcmix-crypto/impl_macros.h @@ -1,5 +1,9 @@ #pragma once +/*! + * \file + */ + #define VAR_IN_(x, y) x ## _ ## y #define VAR_IN(x, y) VAR_IN_(x, y) #define VAR(y) VAR_IN(ALGORITHM, y) diff --git a/libcmix-network/connect.hpp b/libcmix-network/connect.hpp index f58c3e1..ba70c70 100644 --- a/libcmix-network/connect.hpp +++ b/libcmix-network/connect.hpp @@ -21,7 +21,7 @@ boost::asio::ip::tcp::socket connect(std::string host, std::string port, boost:: * \brief async_connect Asynchronously connects to the supplied endpoint. * \param socket The socket on which to invoke the asynchronous connect. * \param host The host - * \param next_port The port + * \param port The port * \param on_connect The function to call when the connect has succeeded. */ void async_connect(boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp>>& socket, std::string host, std::string port, std::function<void()> on_connect);
\ No newline at end of file diff --git a/libcmix-network/protobufclient.hpp b/libcmix-network/protobufclient.hpp index 15bcaec..a5d2cc5 100644 --- a/libcmix-network/protobufclient.hpp +++ b/libcmix-network/protobufclient.hpp @@ -72,6 +72,9 @@ public: using C::is_open; }; +/*! + * \brief Its a conveniance typedef for non SSL connections. + */ template <typename T> using ProtobufClient = BaseProtobufClient<Client, T>; diff --git a/libcmix/cmix.h b/libcmix/cmix.h index 54df573..563fc02 100644 --- a/libcmix/cmix.h +++ b/libcmix/cmix.h @@ -48,10 +48,10 @@ struct CMixContext { size_t nr_participants; ///< The number of mix participants. GroupElement* r; ///< An array of random values (R in the paper). GroupElement* s; ///< An array of random values (S in the paper). - unsigned int* permutation; ///< a permutation (π in the paper (called Pi in source)). + unsigned int* permutation; ///< a permutation (Pi in the paper (called Pi in source)). GroupElement* decryption_shares; ///< The decryption share for each slot. - GroupElement* EPiRS; ///< stores teh current π(R) * S for this node. Only usfull for the last node. - GroupElement* PiMRS; ///< stores the current π(M * R) * S for this node. Only usefull for the last node. + GroupElement* EPiRS; ///< stores teh current Pi(R) * S for this node. Only usfull for the last node. + GroupElement* PiMRS; ///< stores the current Pi(M * R) * S for this node. Only usefull for the last node. }; /*! @@ -233,7 +233,7 @@ enum cmix_error encrypt_r(struct CMixContext const* ctx, char** random_buffer, c * \param message_buffer The message component output buffer. * \param random_element The random component of a previous encryption. * \param message_element The message componenet of a previous encryption. - * \return + * \return A cmix_error */ enum cmix_error encrypt_r_and_multiply(struct CMixContext const* ctx, char** random_buffer, char** message_buffer, char const** random_element, char const** message_element); @@ -244,14 +244,14 @@ enum cmix_error encrypt_r_and_multiply(struct CMixContext const* ctx, char** ran * \param message_buffer The message component output buffer. * \param random_element The random component of a previous encryption. * \param message_element The message component of a previous encryption. - * \return + * \return A cmix_error */ enum cmix_error permute_and_multiply_encrypted_s(struct CMixContext const* ctx, char** random_buffer, char** message_buffer, char const** random_element, char const** message_element); /*! - * \brief get_commitment_length - * \param ctx - * \return + * \brief get_commitment_length Function to know how large you need to make the commitment buffer. + * \param ctx The relevant context. + * \return the length of the Mix commitment hash. */ size_t get_commitment_length(struct CMixContext const* ctx); @@ -261,15 +261,16 @@ size_t get_commitment_length(struct CMixContext const* ctx); * \param ctx The relevant context. * \param commitment a buffer of size get_commitment_length() to store the commitment. * \param r_epirs The input buffer for the random components. + * \param m_epirs The input buffer for the message components. * \return A cmix_error */ enum cmix_error precomputation_post_process(struct CMixContext* ctx, char* commitment, const char** r_epirs, const char** m_epirs); /*! - * \brief commit_precomputation_ciphertext - * \param ctx - * \param commitment - * \param m_epirs + * \brief commit_precomputation_ciphertext Generate a hash for the encryption of Pi * R * S + * \param ctx The relevant context. + * \param commitment Buffer that can hold get_commitment_length bytes. + * \param m_epirs The values to calculate the commitment on. * \return */ enum cmix_error commit_precomputation_ciphertext(struct CMixContext* ctx, char* commitment, const char** m_epirs); @@ -294,46 +295,46 @@ enum cmix_error swap_k_for_r(struct CMixContext const* ctx, char** out_buffer, c enum cmix_error permute_and_multiply_s(struct CMixContext* ctx, char** out_buffer, char const** message); /*! - * \brief get_epirs - * \param ctx - * \param out_buffer - * \return + * \brief get_epirs Gets the encrypted pi * R * S values from the context. + * \param ctx The relevant context. + * \param out_buffer a 2 dimensional buffer that can hold number of clients group elements. + * \return A cmix_error */ enum cmix_error get_epirs(struct CMixContext const* ctx, char** out_buffer); /*! - * \brief get_pimrs_commitment - * \param ctx - * \param out_buffer - * \param pimrss - * \return + * \brief get_pimrs_commitment calculate a hash over Pi * R * S * m to commit to this mix. + * \param ctx The relevant context + * \param out_buffer A buffer large enough to hold get_commitment_length bytes. + * \param pimrss The values over which to calculate the commitment. + * \return A cmix_error */ enum cmix_error get_pimrs_commitment(struct CMixContext const* ctx, char* out_buffer, const char** pimrss); /*! - * \brief decrypt_epirs - * \param ctx - * \param out_buffer - * \param epirs - * \return + * \brief decrypt_epirs decrypt the Encrypted Pi * R * S with the decryption chare in ctx. + * \param ctx The relevant context. + * \param out_buffer a 2 dimensional buffer large enough to hold nr_clients arrays of GroupElement size bytes. + * \param epirs The values to decrypt. + * \return A cmix_error */ enum cmix_error decrypt_epirs(struct CMixContext const* ctx, char** out_buffer, const char** epirs); /*! - * \brief remove_pirs - * \param ctx - * \param out_buffer - * \param pirs - * \return + * \brief remove_pirs Remove Pirs form the M * Pirs in the context. + * \param ctx The relevant context. + * \param out_buffer The buffer to place m in + * \param pirs The Pirs to remove from the M * Pirs in the context. + * \return A cmix_error */ enum cmix_error remove_pirs(struct CMixContext const* ctx, char** out_buffer, const char** pirs); /*! - * \brief element_to_message - * \param ctx - * \param buffer - * \param el - * \return + * \brief element_to_message Transforms an Element into a message. + * \param ctx The relevant context. + * \param buffer A buffer large enough to hold get_message_size bytes. + * \param el The group element to convert. + * \return A cmix_error */ enum cmix_error element_to_message(struct CMixContext const* ctx, unsigned char** buffer, char const* el); diff --git a/node/node.hpp b/node/node.hpp index d9e16d4..335a264 100644 --- a/node/node.hpp +++ b/node/node.hpp @@ -56,16 +56,26 @@ struct NodeNetworkSettings { * \brief Details if and where to send performance data. */ struct PerformanceSettings { - bool run; - std::string host; - std::string port; - std::string name; + bool run; ///< bool indicating if we should even run performance tasks. + std::string host; ///< host at which a statsd runs. + std::string port; ///< port on which a statsd runs. + std::string name; ///< our identifier for the statsd. }; +/*! + * \brief some boilerplate to optimize some of the google protobuf memory allocations. + */ template <typename T> struct ArenaMessage { + /*! + * \brief arena The arena allocater provided by protobuf. + */ google::protobuf::Arena arena; + /*! + * \brief get Create a new object in the arena and create a ref. + * \return a new ref to a T. + */ T& get() { return *google::protobuf::Arena::CreateMessage<T>(&arena); } @@ -143,6 +153,7 @@ public: * \brief Node * \param listen_settings The listen settings for the accepter. * \param network_settings The network settings containing if we are first and who is the next node. + * \param performance_settings The connections settings for a statsd. */ Node(ListenSettings const& listen_settings, NodeNetworkSettings network_settings, PerformanceSettings performance_settings); ~Node(); diff --git a/statsd/stats.hpp b/statsd/stats.hpp index bcf85c5..4e1c18f 100644 --- a/statsd/stats.hpp +++ b/statsd/stats.hpp @@ -9,6 +9,13 @@ #include <list> +/*! + * \file + */ + +/*! + * \brief The Stats class A daemon that receives statistics on a socket and writes it to CSV. + */ class Stats { boost::asio::io_service& io_service; Server server; @@ -27,8 +34,21 @@ class Stats { void handle_message(std::list<Receiver>::iterator it, cmix_proto::CMixMessage message); public: + /*! + * \brief Stats The statsd server to be created. + * \param io_service The io_service it will run under. + * \param lsettings The listen_settings that it will use. + */ Stats(boost::asio::io_service& io_service, ListenSettings lsettings); + /*! + * \brief run Stars the stats daemon, Does not return unless the io_service ends. + */ void run(); + + /*! + * \brief output Writes the data to file. + * \param file The filename to write it to. + */ void output(std::string file); }; |
