mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
cpp: replace <stdio.h> by <iostream>
This commit is contained in:
parent
242c549cd9
commit
132a0b88c0
12 changed files with 216 additions and 163 deletions
|
@ -24,6 +24,8 @@
|
|||
* @{
|
||||
*********************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <villas/utils.h>
|
||||
#include <villas/io.h>
|
||||
#include <villas/sample.h>
|
||||
|
@ -31,13 +33,13 @@
|
|||
|
||||
static void usage()
|
||||
{
|
||||
printf("Usage: villas-convert [OPTIONS]\n");
|
||||
printf(" OPTIONS are:\n");
|
||||
printf(" -i FMT set the input format\n");
|
||||
printf(" -o FMT set the output format\n");
|
||||
printf(" -d LVL set debug log level to LVL\n");
|
||||
printf(" -h show this usage information\n");
|
||||
printf(" -V show the version of the tool\n\n");
|
||||
std::cout << "Usage: villas-convert [OPTIONS]" << std::endl;
|
||||
std::cout << " OPTIONS are:" << std::endl;
|
||||
std::cout << " -i FMT set the input format" << std::endl;
|
||||
std::cout << " -o FMT set the output format" << std::endl;
|
||||
std::cout << " -d LVL set debug log level to LVL" << std::endl;
|
||||
std::cout << " -h show this usage information" << std::endl;
|
||||
std::cout << " -V show the version of the tool" << std::endl << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <villas/timing.h>
|
||||
|
@ -83,27 +83,27 @@ static void quit(int signal, siginfo_t *sinfo, void *ctx)
|
|||
|
||||
static void usage()
|
||||
{
|
||||
printf("Usage: villas-hook [OPTIONS] NAME [[PARAM1] [PARAM2] ...]\n");
|
||||
printf(" NAME the name of the hook function\n");
|
||||
printf(" PARAM* a string of configuration settings for the hook\n");
|
||||
printf(" OPTIONS is one or more of the following options:\n");
|
||||
printf(" -f FMT the data format\n");
|
||||
printf(" -d LVL set debug level to LVL\n");
|
||||
printf(" -v CNT process CNT smps at once\n");
|
||||
printf(" -h show this help\n");
|
||||
printf(" -V show the version of the tool\n\n");
|
||||
std::cout << "Usage: villas-hook [OPTIONS] NAME [[PARAM1] [PARAM2] ...]" << std::endl;
|
||||
std::cout << " NAME the name of the hook function" << std::endl;
|
||||
std::cout << " PARAM* a string of configuration settings for the hook" << std::endl;
|
||||
std::cout << " OPTIONS is one or more of the following options:" << std::endl;
|
||||
std::cout << " -f FMT the data format" << std::endl;
|
||||
std::cout << " -d LVL set debug level to LVL" << std::endl;
|
||||
std::cout << " -v CNT process CNT smps at once" << std::endl;
|
||||
std::cout << " -h show this help" << std::endl;
|
||||
std::cout << " -V show the version of the tool" << std::endl << std::endl;
|
||||
|
||||
printf("The following hook functions are supported:\n");
|
||||
std::cout << "Supported hooks:" << std::endl;
|
||||
plugin_dump(PLUGIN_TYPE_HOOK);
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
|
||||
printf("Supported IO formats:\n");
|
||||
std::cout << "Supported IO formats:" << std::endl;
|
||||
plugin_dump(PLUGIN_TYPE_FORMAT);
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
|
||||
printf("Example:");
|
||||
printf(" villas-signal random | villas-hook skip_first seconds=10\n");
|
||||
printf("\n");
|
||||
std::cout << "Example:" << std::endl;
|
||||
std::cout << " villas-signal random | villas-hook skip_first seconds=10" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <villas/config.h>
|
||||
#include <villas/utils.h>
|
||||
#include <villas/super_node.h>
|
||||
|
@ -66,36 +68,36 @@ static void quit(int signal, siginfo_t *sinfo, void *ctx)
|
|||
|
||||
static void usage()
|
||||
{
|
||||
printf("Usage: villas-node [OPTIONS] [CONFIG]\n");
|
||||
printf(" OPTIONS is one or more of the following options:\n");
|
||||
printf(" -h show this usage information\n");
|
||||
printf(" -V show the version of the tool\n\n");
|
||||
printf(" CONFIG is the path to an optional configuration file\n");
|
||||
printf(" if omitted, VILLASnode will start without a configuration\n");
|
||||
printf(" and wait for provisioning over the web interface.\n\n");
|
||||
std::cout << "Usage: villas-node [OPTIONS] [CONFIG]" << std::endl;
|
||||
std::cout << " OPTIONS is one or more of the following options:" << std::endl;
|
||||
std::cout << " -h show this usage information" << std::endl;
|
||||
std::cout << " -V show the version of the tool" << std::endl << std::endl;
|
||||
std::cout << " CONFIG is the path to an optional configuration file" << std::endl;
|
||||
std::cout << " if omitted, VILLASnode will start without a configuration" << std::endl;
|
||||
std::cout << " and wait for provisioning over the web interface." << std::endl << std::endl;
|
||||
#ifdef ENABLE_OPAL_ASYNC
|
||||
printf("Usage: villas-node OPAL_ASYNC_SHMEM_NAME OPAL_ASYNC_SHMEM_SIZE OPAL_PRINT_SHMEM_NAME\n");
|
||||
printf(" This type of invocation is used by OPAL-RT Asynchronous processes.\n");
|
||||
printf(" See in the RT-LAB User Guide for more information.\n\n");
|
||||
std::cout << "Usage: villas-node OPAL_ASYNC_SHMEM_NAME OPAL_ASYNC_SHMEM_SIZE OPAL_PRINT_SHMEM_NAME" << std::endl;
|
||||
std::cout << " This type of invocation is used by OPAL-RT Asynchronous processes." << std::endl;
|
||||
std::cout << " See in the RT-LAB User Guide for more information." << std::endl << std::endl;
|
||||
#endif /* ENABLE_OPAL_ASYNC */
|
||||
|
||||
printf("Supported node-types:\n");
|
||||
std::cout << "Supported node-types:" << std::endl;
|
||||
plugin_dump(PLUGIN_TYPE_NODE);
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
|
||||
#ifdef WITH_HOOKS
|
||||
printf("Supported hooks:\n");
|
||||
std::cout << "Supported hooks:" << std::endl;
|
||||
plugin_dump(PLUGIN_TYPE_HOOK);
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
#endif /* WITH_HOOKS */
|
||||
|
||||
printf("Supported API commands:\n");
|
||||
std::cout << "Supported API commands:" << std::endl;
|
||||
plugin_dump(PLUGIN_TYPE_API);
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
|
||||
printf("Supported IO formats:\n");
|
||||
std::cout << "Supported IO formats:" << std::endl;
|
||||
plugin_dump(PLUGIN_TYPE_FORMAT);
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
|
||||
print_copyright();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <villas/config.h>
|
||||
#include <villas/config_helper.h>
|
||||
|
@ -106,21 +107,21 @@ static void quit(int signal, siginfo_t *sinfo, void *ctx)
|
|||
|
||||
static void usage()
|
||||
{
|
||||
printf("Usage: villas-pipe [OPTIONS] CONFIG NODE\n");
|
||||
printf(" CONFIG path to a configuration file\n");
|
||||
printf(" NODE the name of the node to which samples are sent and received from\n");
|
||||
printf(" OPTIONS are:\n");
|
||||
printf(" -f FMT set the format\n");
|
||||
printf(" -d LVL set debug log level to LVL\n");
|
||||
printf(" -o OPTION=VALUE overwrite options in config file\n");
|
||||
printf(" -x swap read / write endpoints\n");
|
||||
printf(" -s only read data from stdin and send it to node\n");
|
||||
printf(" -r only read data from node and write it to stdout\n");
|
||||
printf(" -t NUM terminate after NUM seconds\n");
|
||||
printf(" -L NUM terminate after NUM samples sent\n");
|
||||
printf(" -l NUM terminate after NUM samples received\n");
|
||||
printf(" -h show this usage information\n");
|
||||
printf(" -V show the version of the tool\n\n");
|
||||
std::cout << "Usage: villas-pipe [OPTIONS] CONFIG NODE" << std::endl;
|
||||
std::cout << " CONFIG path to a configuration file" << std::endl;
|
||||
std::cout << " NODE the name of the node to which samples are sent and received from" << std::endl;
|
||||
std::cout << " OPTIONS are:" << std::endl;
|
||||
std::cout << " -f FMT set the format" << std::endl;
|
||||
std::cout << " -d LVL set debug log level to LVL" << std::endl;
|
||||
std::cout << " -o OPTION=VALUE overwrite options in config file" << std::endl;
|
||||
std::cout << " -x swap read / write endpoints" << std::endl;
|
||||
std::cout << " -s only read data from stdin and send it to node" << std::endl;
|
||||
std::cout << " -r only read data from node and write it to stdout" << std::endl;
|
||||
std::cout << " -t NUM terminate after NUM seconds" << std::endl;
|
||||
std::cout << " -L NUM terminate after NUM samples sent" << std::endl;
|
||||
std::cout << " -l NUM terminate after NUM samples received" << std::endl;
|
||||
std::cout << " -h show this usage information" << std::endl;
|
||||
std::cout << " -V show the version of the tool" << std::endl << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <villas/io.h>
|
||||
#include <villas/utils.h>
|
||||
|
@ -46,28 +47,28 @@ struct sample *t;
|
|||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: villas-signal [OPTIONS] SIGNAL\n");
|
||||
printf(" SIGNAL is on of the following signal types:\n");
|
||||
printf(" mixed\n");
|
||||
printf(" random\n");
|
||||
printf(" sine\n");
|
||||
printf(" triangle\n");
|
||||
printf(" square\n");
|
||||
printf(" ramp\n");
|
||||
printf(" constants\n");
|
||||
printf(" counter\n");
|
||||
printf("\n");
|
||||
printf(" OPTIONS is one or more of the following options:\n");
|
||||
printf(" -d LVL set debug level\n");
|
||||
printf(" -f FMT set the format\n");
|
||||
printf(" -v NUM specifies how many values a message should contain\n");
|
||||
printf(" -r HZ how many messages per second\n");
|
||||
printf(" -n non real-time mode. do not throttle output.\n");
|
||||
printf(" -F HZ the frequency of the signal\n");
|
||||
printf(" -a FLT the amplitude\n");
|
||||
printf(" -D FLT the standard deviation for 'random' signals\n");
|
||||
printf(" -o OFF the DC bias\n");
|
||||
printf(" -l NUM only send LIMIT messages and stop\n\n");
|
||||
std::cout << "Usage: villas-signal [OPTIONS] SIGNAL" << std::endl;
|
||||
std::cout << " SIGNAL is on of the following signal types:" << std::endl;
|
||||
std::cout << " mixed" << std::endl;
|
||||
std::cout << " random" << std::endl;
|
||||
std::cout << " sine" << std::endl;
|
||||
std::cout << " triangle" << std::endl;
|
||||
std::cout << " square" << std::endl;
|
||||
std::cout << " ramp" << std::endl;
|
||||
std::cout << " constants" << std::endl;
|
||||
std::cout << " counter" << std::endl;
|
||||
std::cout << "" << std::endl;
|
||||
std::cout << " OPTIONS is one or more of the following options:" << std::endl;
|
||||
std::cout << " -d LVL set debug level" << std::endl;
|
||||
std::cout << " -f FMT set the format" << std::endl;
|
||||
std::cout << " -v NUM specifies how many values a message should contain" << std::endl;
|
||||
std::cout << " -r HZ how many messages per second" << std::endl;
|
||||
std::cout << " -n non real-time mode. do not throttle output." << std::endl;
|
||||
std::cout << " -F HZ the frequency of the signal" << std::endl;
|
||||
std::cout << " -a FLT the amplitude" << std::endl;
|
||||
std::cout << " -D FLT the standard deviation for 'random' signals" << std::endl;
|
||||
std::cout << " -o OFF the DC bias" << std::endl;
|
||||
std::cout << " -l NUM only send LIMIT messages and stop" << std::endl << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <stdbool.h>
|
||||
#include <getopt.h>
|
||||
|
||||
|
@ -45,26 +45,24 @@ struct side {
|
|||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: villas-test-cmp [OPTIONS] FILE1 FILE2 ... FILEn\n");
|
||||
printf(" FILE a list of files to compare\n");
|
||||
printf(" OPTIONS is one or more of the following options:\n");
|
||||
printf(" -d LVL adjust the debug level\n");
|
||||
printf(" -e EPS set epsilon for floating point comparisons to EPS\n");
|
||||
printf(" -v ignore data values\n");
|
||||
printf(" -t ignore timestamp\n");
|
||||
printf(" -s ignore sequence no\n");
|
||||
printf(" -f FMT file format for all files\n");
|
||||
printf(" -h show this usage information\n");
|
||||
printf(" -V show the version of the tool\n\n");
|
||||
|
||||
printf("Return codes:\n");
|
||||
printf(" 0 files are equal\n");
|
||||
printf(" 1 file length not equal\n");
|
||||
printf(" 2 sequence no not equal\n");
|
||||
printf(" 3 timestamp not equal\n");
|
||||
printf(" 4 number of values is not equal\n");
|
||||
printf(" 5 data is not equal\n");
|
||||
printf("\n");
|
||||
std::cout << "Usage: villas-test-cmp [OPTIONS] FILE1 FILE2 ... FILEn" << std::endl;
|
||||
std::cout << " FILE a list of files to compare" << std::endl;
|
||||
std::cout << " OPTIONS is one or more of the following options:" << std::endl;
|
||||
std::cout << " -d LVL adjust the debug level" << std::endl;
|
||||
std::cout << " -e EPS set epsilon for floating point comparisons to EPS" << std::endl;
|
||||
std::cout << " -v ignore data values" << std::endl;
|
||||
std::cout << " -t ignore timestamp" << std::endl;
|
||||
std::cout << " -s ignore sequence no" << std::endl;
|
||||
std::cout << " -f FMT file format for all files" << std::endl;
|
||||
std::cout << " -h show this usage information" << std::endl;
|
||||
std::cout << " -V show the version of the tool" << std::endl << std::endl;
|
||||
std::cout << "Return codes:" << std::endl;
|
||||
std::cout << " 0 files are equal" << std::endl;
|
||||
std::cout << " 1 file length not equal" << std::endl;
|
||||
std::cout << " 2 sequence no not equal" << std::endl;
|
||||
std::cout << " 3 timestamp not equal" << std::endl;
|
||||
std::cout << " 4 number of values is not equal" << std::endl;
|
||||
std::cout << " 5 data is not equal" << std::endl << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
@ -165,7 +163,7 @@ retry: eofs = 0;
|
|||
if (eofs == n)
|
||||
ret = 0;
|
||||
else {
|
||||
printf("length unequal\n");
|
||||
std::cout << "length unequal" << std::endl;
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <villas/config.h>
|
||||
#include <villas/super_node.h>
|
||||
|
@ -66,17 +67,16 @@ void quit(int signal, siginfo_t *sinfo, void *ctx)
|
|||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: villas-test-rtt [OPTIONS] CONFIG NODE\n");
|
||||
printf(" CONFIG path to a configuration file\n");
|
||||
printf(" NODE name of the node which shoud be used\n");
|
||||
printf(" OPTIONS is one or more of the following options:\n");
|
||||
printf(" -c CNT send CNT messages\n");
|
||||
printf(" -f FD use file descriptor FD for result output instead of stdout\n");
|
||||
printf(" -b BKTS number of buckets for histogram\n");
|
||||
printf(" -w WMUP duration of histogram warmup phase\n");
|
||||
printf(" -h show this usage information\n");
|
||||
printf(" -V show the version of the tool\n\n");
|
||||
printf("\n");
|
||||
std::cout << "Usage: villas-test-rtt [OPTIONS] CONFIG NODE" << std::endl;
|
||||
std::cout << " CONFIG path to a configuration file" << std::endl;
|
||||
std::cout << " NODE name of the node which shoud be used" << std::endl;
|
||||
std::cout << " OPTIONS is one or more of the following options:" << std::endl;
|
||||
std::cout << " -c CNT send CNT messages" << std::endl;
|
||||
std::cout << " -f FD use file descriptor FD for result output instead of stdout" << std::endl;
|
||||
std::cout << " -b BKTS number of buckets for histogram" << std::endl;
|
||||
std::cout << " -w WMUP duration of histogram warmup phase" << std::endl;
|
||||
std::cout << " -h show this usage information" << std::endl;
|
||||
std::cout << " -V show the version of the tool" << std::endl << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*********************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <villas/config.h>
|
||||
#include <villas/log.h>
|
||||
|
@ -38,10 +39,10 @@ struct shmem_int shm;
|
|||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: villas-test-shmem WNAME VECTORIZE\n");
|
||||
printf(" WNAME name of the shared memory object for the output queue\n");
|
||||
printf(" RNAME name of the shared memory object for the input queue\n");
|
||||
printf(" VECTORIZE maximum number of samples to read/write at a time\n");
|
||||
std::cout << "Usage: villas-test-shmem WNAME VECTORIZE" << std::endl;
|
||||
std::cout << " WNAME name of the shared memory object for the output queue" << std::endl;
|
||||
std::cout << " RNAME name of the shared memory object for the input queue" << std::endl;
|
||||
std::cout << " VECTORIZE maximum number of samples to read/write at a time" << std::endl;
|
||||
}
|
||||
|
||||
void quit(int sig)
|
||||
|
@ -83,7 +84,7 @@ int main(int argc, char* argv[])
|
|||
while (1) {
|
||||
readcnt = shmem_int_read(&shm, insmps, vectorize);
|
||||
if (readcnt == -1) {
|
||||
printf("Node stopped, exiting");
|
||||
std::cout << "Node stopped, exiting" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*********************************************************************************/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <jansson.h>
|
||||
#include <libconfig.h>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: conf2json input.conf > output.json\n\n");
|
||||
std::cout << "Usage: conf2json input.conf > output.json" << std::endl << std::endl;
|
||||
|
||||
print_copyright();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,34 @@
|
|||
/** Delete semaphores.
|
||||
*
|
||||
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
* @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
|
||||
* @license GNU General Public License (version 3)
|
||||
*
|
||||
* VILLASnode
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************************/
|
||||
|
||||
#include <semaphore.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; i++) {
|
||||
int ret = sem_unlink(argv[i]);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to unlink: %s\n", argv[i]);
|
||||
std::cerr << "Failed to unlink: " << argv[i] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,12 +1,34 @@
|
|||
/** Delete shared memory regions.
|
||||
*
|
||||
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
* @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
|
||||
* @license GNU General Public License (version 3)
|
||||
*
|
||||
* VILLASnode
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************************/
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; i++) {
|
||||
int ret = shm_unlink(argv[i]);
|
||||
if (ret)
|
||||
fprintf(stderr, "Failed to unlink: %s\n", argv[i]);
|
||||
std::cerr << "Failed to unlink: " << argv[i] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,32 +1,33 @@
|
|||
/*
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
libzmq is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
As a special exception, the Contributors give you permission to link
|
||||
this library with independent modules to produce an executable,
|
||||
regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the
|
||||
terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library.
|
||||
If you modify this library, you must extend this exception to your
|
||||
version of the library.
|
||||
|
||||
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
*
|
||||
* This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
*
|
||||
* libzmq is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
* by the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* As a special exception, the Contributors give you permission to link
|
||||
* this library with independent modules to produce an executable,
|
||||
* regardless of the license terms of these independent modules, and to
|
||||
* copy and distribute the resulting executable under terms of your choice,
|
||||
* provided that you also meet, for each linked independent module, the
|
||||
* terms and conditions of the license of that module. An independent
|
||||
* module is a module which is not derived from or based on this library.
|
||||
* If you modify this library, you must extend this exception to your
|
||||
* version of the library.
|
||||
*
|
||||
* libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <zmq.h>
|
||||
|
@ -37,20 +38,23 @@
|
|||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
char public_key [41];
|
||||
char secret_key [41];
|
||||
if (zmq_curve_keypair(public_key, secret_key)) {
|
||||
if (zmq_errno() == ENOTSUP)
|
||||
printf("To use %s, please install libsodium and then rebuild libzmq.", argv[0]);
|
||||
int ret;
|
||||
char public_key[41];
|
||||
char secret_key[41];
|
||||
|
||||
exit (EXIT_FAILURE);
|
||||
ret = zmq_curve_keypair(public_key, secret_key);
|
||||
if (ret) {
|
||||
if (zmq_errno() == ENOTSUP)
|
||||
std::cout << "To use " << argv[0] << ", please install libsodium and then rebuild libzmq." << std::endl;
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("# Copy these lines to your 'zeromq' node-configuration\n");
|
||||
printf("curve = {\n");
|
||||
printf("\tpublic_key = \"%s\";\n", public_key);
|
||||
printf("\tsecret_key = \"%s\";\n", secret_key);
|
||||
printf("}\n");
|
||||
std::cout << "# Copy these lines to your 'zeromq' node-configuration" << std::endl;
|
||||
std::cout << "curve = {" << std::endl;
|
||||
std::cout << "\tpublic_key = \"" << public_key << "\";" << std::endl;
|
||||
std::cout << "\tsecret_key = \"" << secret_key << "\";" << std::endl;
|
||||
std::cout << "}" << std::endl;
|
||||
|
||||
exit (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue