organic-code / breep Goto Github PK
View Code? Open in Web Editor NEWC++ peer to peer library, built on the top of boost
License: European Union Public License 1.1
C++ peer to peer library, built on the top of boost
License: European Union Public License 1.1
Breed currently supports only peer-to-peer network architecture. It could be nice to add a client-server architecture.
For example, in /include/breep/network/detail/object_builder.hpp
, the logger is referenced as breep::logger
.
I believe it should be breep::detail::logger
.
This error was found while compiling the example code chat
.
Edit: This was using g++<4.9. This doesn't occur with g++5
Edit2: Now getting a lot of BREEP_DECLARE_TEMPLATE
-based errors. Saying things like:
template argument 1 is invalid
, parse error in template argument list
, expected unqualified-id before '...' token
. It says in type_traits.hpp
to use BREEP_DECLARE_TYPE
instead of BREEP_DECLARE_TEMPLATE
if getting errors. Is this the recommended action to take (editing basic_peer.hpp
, io_manager_base.hpp
, etc?
In file included from ../../include/breep/network/tcp.hpp:21:0,
from main.cpp:23:
../../include/breep/util/type_traits.hpp:66:221: error: expected ‘;’ at end of member declaration
const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \
^
../../include/breep/network/basic_peer.hpp:166:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’
BREEP_DECLARE_TEMPLATE(breep::basic_peer)
^
../../include/breep/util/type_traits.hpp:66:221: error: declaration of ‘const string breep::detail::networking_traits_impl<breep::basic_peer<T ...> >::T’
const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \
^
../../include/breep/network/basic_peer.hpp:166:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’
BREEP_DECLARE_TEMPLATE(breep::basic_peer)
^
../../include/breep/util/type_traits.hpp:63:16: error: shadows template parm ‘class ... T’
template <typename... T> \
^
../../include/breep/network/basic_peer.hpp:166:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’
BREEP_DECLARE_TEMPLATE(breep::basic_peer)
^
../../include/breep/util/type_traits.hpp:66:222: error: expected unqualified-id before ‘...’ token
const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \
...
Checked out both current master branch and 0.1.0 tag.
When trying to compile the examples by calling make, I get the following output:
Building chat.elf [ -- ] (1/1) Building main.o from main.cpp...In file included from ../../include/breep/network/tcp.hpp:21:0, from main.cpp:21: ../../include/breep/util/type_traits.hpp:66:221: error: expected ‘;’ at end of member declaration const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/detail/object_builder.hpp:151:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::detail::object_builder) ^ ../../include/breep/util/type_traits.hpp:66:221: error: declaration of ‘const string breep::detail::networking_traits_impl<breep::detail::object_builder<T ...> >::T’ const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/detail/object_builder.hpp:151:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::detail::object_builder) ^ ../../include/breep/util/type_traits.hpp:63:16: error: shadows template parm ‘class ... T’ template <typename... T> \ ^ ../../include/breep/network/detail/object_builder.hpp:151:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::detail::object_builder) ^ ../../include/breep/util/type_traits.hpp:66:222: error: expected unqualified-id before ‘...’ token const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/detail/object_builder.hpp:151:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::detail::object_builder) ^ ../../include/breep/util/type_traits.hpp:66:206: error: parse error in template argument list const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/detail/object_builder.hpp:151:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::detail::object_builder) ^ ../../include/breep/util/type_traits.hpp:66:206: error: template argument 1 is invalid const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/detail/object_builder.hpp:151:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::detail::object_builder) ^ ../../include/breep/util/type_traits.hpp:66:221: error: expected ‘;’ at end of member declaration const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/io_manager_base.hpp:158:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::io_manager_base) ^ ../../include/breep/util/type_traits.hpp:66:221: error: declaration of ‘const string breep::detail::networking_traits_impl<breep::io_manager_base<T ...> >::T’ const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/io_manager_base.hpp:158:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::io_manager_base) ^ ../../include/breep/util/type_traits.hpp:63:16: error: shadows template parm ‘class ... T’ template <typename... T> \ ^ ../../include/breep/network/io_manager_base.hpp:158:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::io_manager_base) ^ ../../include/breep/util/type_traits.hpp:66:222: error: expected unqualified-id before ‘...’ token const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/io_manager_base.hpp:158:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::io_manager_base) ^ ../../include/breep/util/type_traits.hpp:66:206: error: parse error in template argument list const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/io_manager_base.hpp:158:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::io_manager_base) ^ ../../include/breep/util/type_traits.hpp:66:206: error: template argument 1 is invalid const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/io_manager_base.hpp:158:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::io_manager_base) ^ ../../include/breep/util/type_traits.hpp:66:221: error: expected ‘;’ at end of member declaration const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_peer_manager.hpp:503:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_peer_manager) ^ ../../include/breep/util/type_traits.hpp:66:221: error: declaration of ‘const string breep::detail::networking_traits_impl<breep::basic_peer_manager<T ...> >::T’ const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_peer_manager.hpp:503:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_peer_manager) ^ ../../include/breep/util/type_traits.hpp:63:16: error: shadows template parm ‘class ... T’ template <typename... T> \ ^ ../../include/breep/network/basic_peer_manager.hpp:503:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_peer_manager) ^ ../../include/breep/util/type_traits.hpp:66:222: error: expected unqualified-id before ‘...’ token const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_peer_manager.hpp:503:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_peer_manager) ^ ../../include/breep/util/type_traits.hpp:66:206: error: parse error in template argument list const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_peer_manager.hpp:503:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_peer_manager) ^ ../../include/breep/util/type_traits.hpp:66:206: error: template argument 1 is invalid const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_peer_manager.hpp:503:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_peer_manager) ^ ../../include/breep/util/type_traits.hpp:66:221: error: expected ‘;’ at end of member declaration const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_network.hpp:653:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_network) ^ ../../include/breep/util/type_traits.hpp:66:221: error: declaration of ‘const string breep::detail::networking_traits_impl<breep::basic_network<T ...> >::T’ const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_network.hpp:653:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_network) ^ ../../include/breep/util/type_traits.hpp:63:16: error: shadows template parm ‘class ... T’ template <typename... T> \ ^ ../../include/breep/network/basic_network.hpp:653:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_network) ^ ../../include/breep/util/type_traits.hpp:66:222: error: expected unqualified-id before ‘...’ token const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_network.hpp:653:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_network) ^ ../../include/breep/util/type_traits.hpp:66:206: error: parse error in template argument list const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_network.hpp:653:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_network) ^ ../../include/breep/util/type_traits.hpp:66:206: error: template argument 1 is invalid const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ ../../include/breep/network/basic_network.hpp:653:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(breep::basic_network) ^ ../../include/breep/util/type_traits.hpp:66:221: error: expected ‘;’ at end of member declaration const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ main.cpp:88:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(chat_message) ^ ../../include/breep/util/type_traits.hpp:66:221: error: declaration of ‘const string breep::detail::networking_traits_impl<chat_message<T ...> >::T’ const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ main.cpp:88:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(chat_message) ^ ../../include/breep/util/type_traits.hpp:63:16: error: shadows template parm ‘class ... T’ template <typename... T> \ ^ main.cpp:88:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(chat_message) ^ ../../include/breep/util/type_traits.hpp:66:222: error: expected unqualified-id before ‘...’ token const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ main.cpp:88:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(chat_message) ^ ../../include/breep/util/type_traits.hpp:66:206: error: parse error in template argument list const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ main.cpp:88:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(chat_message) ^ ../../include/breep/util/type_traits.hpp:66:206: error: template argument 1 is invalid const std::string universal_name = std::string(#TType"<") + networking_traits_impl<typename std::tuple_element<0, std::tuple<T...>>::type>().universal_name + detail::identifier_from_tuple<detail::remove_type<0, T...>>().value + ">"; \ ^ main.cpp:88:1: note: in expansion of macro ‘BREEP_DECLARE_TEMPLATE’ BREEP_DECLARE_TEMPLATE(chat_message) ^ Makefile:224: die Regel für Ziel „build/main.o“ scheiterte make[1]: *** [build/main.o] Fehler 1 Makefile:161: die Regel für Ziel „all“ scheiterte make: *** [all] Fehler 2
The dependancies are installed. Do I need a special compiler version?
I'm interested in using this library for a project involving ad-hoc network building. How would you suggest building network discovery features to Breep? The simplest way that I can think of is to add broadcast messaging (using UDP, I suppose) to build a routing table. At least one problem with that, though, is that UDP still needs a router I think. Is there some forum where we could discuss this?
Alternatively, do you have links to sources where I can learn true peer-to-peer communication paradigm? Perhaps you have a diagram of Breep's comm flow or know of a similar one.
Cheers
Pointers serialization does not work out of the box. this is a missing feature, and deep serialization should be enabled for raw pointers and smart pointers (namely std::weak_ptr, std::shared_ptr and std::unique_ptr)
It may be useful to add a packet class overloading << operator, so as to be able to send more than one class at once
The forwarding requests seem to have no effect, leading to no one bridging for each other.
I get the following errors during compilation ( Microsoft Visual Studio Ultimate 2013):
error C2144: syntax error : 'bool' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
etc.
all in type_traits.hpp.
Unfortunately I do not have any experience using GCC.
It will be much appreciated if you could help.
It could be useful to have the possibility of adding data in basic_peer, accessible from user code, so that they can avoid using an extra map of their own when they would otherwise need it
Anyone can connect to any peer network (provided that they have the same protocol ID), even though they are from a completely different program
Although this is unlikely, it should be taken into account, maybe by adding an ID when the network is created and checking it on incomming connections.
Because of the way boost's serialization is used, it is not possible to send a class without first copying it (at least for const refs), which is quite bad.
One solution could be to implement a custom serialization system.
It could be nice to be able to add a watcher so that you can know when you are receiving bytes, even if data are not completely received yet
Adding hooks after serializing objects and before deserializing them could be useful in some circumstances (encryption & decryption, compression & decompression, …)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.