diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-02 14:25:23 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-02 14:25:23 -0400 |
commit | 2a6b74746edbfde0b0f1468cdf153263670c908a (patch) | |
tree | 3e09ca56f65ea69e2d41df0a9d25ffb880270820 /netconf-service/netconf-test.cpp | |
parent | 741642ba531e487c18c8139c4a2e9510eed0466d (diff) | |
download | infinitytier-2a6b74746edbfde0b0f1468cdf153263670c908a.tar.gz infinitytier-2a6b74746edbfde0b0f1468cdf153263670c908a.zip |
Netconf service itself works, time to integrate.
Diffstat (limited to 'netconf-service/netconf-test.cpp')
-rw-r--r-- | netconf-service/netconf-test.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/netconf-service/netconf-test.cpp b/netconf-service/netconf-test.cpp index aadaa51d..6c7ef9f2 100644 --- a/netconf-service/netconf-test.cpp +++ b/netconf-service/netconf-test.cpp @@ -42,11 +42,13 @@ #include "../node/Identity.hpp" #include "../node/RuntimeEnvironment.hpp" #include "../node/Logger.hpp" +#include "../node/Thread.hpp" using namespace ZeroTier; static void svcHandler(void *arg,Service &svc,const Dictionary &msg) { + std::cout << msg.toString(); } int main(int argc,char **argv) @@ -59,8 +61,23 @@ int main(int argc,char **argv) std::vector<Identity> population; for(;;) { + Identity id; if ((population.empty())||(rand() < (RAND_MAX / 4))) { + id.generate(); + population.push_back(id); + std::cout << "Testing with new identity: " << id.address().toString() << std::endl; } else { + id = population[rand() % population.size()]; + Thread::sleep(1000); + std::cout << "Testing with existing identity: " << id.address().toString() << std::endl; } + + Dictionary request; + request["type"] = "netconf-request"; + request["peerId"] = id.toString(false); + request["nwid"] = "6c92786fee000001"; + request["requestId"] = "12345"; + + svc.send(request); } } |