diff --git a/core/common.hpp b/core/common.hpp index 4085d68..e8afc87 100644 --- a/core/common.hpp +++ b/core/common.hpp @@ -57,6 +57,6 @@ using std::size_t; using boost::noncopyable; -} // namespace +} // namespace ndn #endif // NDN_TOOLS_CORE_COMMON_HPP diff --git a/core/version.cpp b/core/version.cpp new file mode 100644 index 0000000..3195e68 --- /dev/null +++ b/core/version.cpp @@ -0,0 +1,28 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/** + * Copyright (c) 2014-2015, Arizona Board of Regents. + * + * This file is part of ndn-tools (Named Data Networking Essential Tools). + * See AUTHORS.md for complete list of ndn-tools authors and contributors. + * + * ndn-tools 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 (at your option) any later version. + * + * ndn-tools 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 + * ndn-tools, e.g., in COPYING.md file. If not, see . + */ + +#include "version.hpp" + +namespace ndn { +namespace tools { + +const char VERSION[] = "0.1.0-dev"; + +} // namespace tools +} // namespace ndn diff --git a/core/version.hpp b/core/version.hpp new file mode 100644 index 0000000..440f1bc --- /dev/null +++ b/core/version.hpp @@ -0,0 +1,35 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/** + * Copyright (c) 2014-2015, Arizona Board of Regents. + * + * This file is part of ndn-tools (Named Data Networking Essential Tools). + * See AUTHORS.md for complete list of ndn-tools authors and contributors. + * + * ndn-tools 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 (at your option) any later version. + * + * ndn-tools 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 + * ndn-tools, e.g., in COPYING.md file. If not, see . + */ + +#ifndef NDN_TOOLS_CORE_VERSION_HPP +#define NDN_TOOLS_CORE_VERSION_HPP + +#include "common.hpp" + +namespace ndn { +namespace tools { + +/** \brief version of ndn-tools + */ +extern const char VERSION[]; + +} // namespace tools +} // namespace ndn + +#endif // NDN_TOOLS_CORE_VERSION_HPP diff --git a/tools/peek/ndn-peek.cpp b/tools/peek/ndn-peek.cpp index 8f79a61..7bc8dae 100644 --- a/tools/peek/ndn-peek.cpp +++ b/tools/peek/ndn-peek.cpp @@ -48,11 +48,7 @@ * @author Jerald Paul Abraham */ -#include "version.hpp" - -#include - -#include +#include "core/version.hpp" namespace ndn { namespace peek { @@ -282,7 +278,7 @@ main(int argc, char* argv[]) program.setTimeout(atoi(optarg)); break; case 'V': - std::cout << NFD_VERSION_BUILD_STRING << std::endl; + std::cout << "ndnpeek " << tools::VERSION << std::endl; return 0; default: program.usage(); diff --git a/tools/peek/ndn-poke.cpp b/tools/peek/ndn-poke.cpp index 73e4a56..afdf1d6 100644 --- a/tools/peek/ndn-poke.cpp +++ b/tools/peek/ndn-poke.cpp @@ -48,12 +48,7 @@ * @author Jerald Paul Abraham */ -#include "version.hpp" - -#include - -#include -#include +#include "core/version.hpp" namespace ndn { namespace peek { @@ -274,7 +269,7 @@ main(int argc, char* argv[]) program.setTimeout(atoi(optarg)); break; case 'V': - std::cout << NFD_VERSION_BUILD_STRING << std::endl; + std::cout << "ndnpoke " << tools::VERSION << std::endl; return 0; default: program.usage(); diff --git a/tools/peek/version.hpp b/tools/peek/version.hpp deleted file mode 100644 index 9c758ba..0000000 --- a/tools/peek/version.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2015, Regents of the University of California, - * Arizona Board of Regents, - * Colorado State University, - * University Pierre & Marie Curie, Sorbonne University, - * Washington University in St. Louis, - * Beijing Institute of Technology, - * The University of Memphis. - * - * This file is part of ndn-tools (Named Data Networking Essential Tools). - * See AUTHORS.md for complete list of ndn-tools authors and contributors. - * - * ndn-tools 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 (at your option) any later version. - * - * ndn-tools 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 - * ndn-tools, e.g., in COPYING.md file. If not, see . - */ -/** - * Copyright (c) 2014, Regents of the University of California, - * Arizona Board of Regents, - * Colorado State University, - * University Pierre & Marie Curie, Sorbonne University, - * Washington University in St. Louis, - * Beijing Institute of Technology, - * The University of Memphis - * - * This file is part of NFD (Named Data Networking Forwarding Daemon). - * See AUTHORS.md for complete list of NFD authors and contributors. - * - * NFD 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 (at your option) any later version. - * - * NFD 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 - * NFD, e.g., in COPYING.md file. If not, see . - */ - -#ifndef NFD_VERSION_HPP -#define NFD_VERSION_HPP - -namespace nfd { - -/** NFD version follows Semantic Versioning 2.0.0 specification - * http://semver.org/ - */ - -// To change version number, modify VERSION variable in top-level wscript. - -/** \brief NFD version represented as an integer - * - * MAJOR*1000000 + MINOR*1000 + PATCH - */ -#define NFD_VERSION 3001 - -/** \brief NFD version represented as a string - * - * MAJOR.MINOR.PATCH - */ -#define NFD_VERSION_STRING "0.3.1" - -/** \brief NFD version string, including git commit information, if NFD is build from - * specific git commit - * - * NFD_VERSION_BUILD_STRING is obtained using the following command (`NFD-` prefix is - * afterwards removed): - * - * `git describe --match 'NFD-*'` - * - * When NFD is built not from git, NFD_VERSION_BUILD_STRING equals NFD_VERSION_STRING - * - * MAJOR.MINOR.PATCH(-release-candidate-tag)(-(number-of-commits-since-tag)-COMMIT-HASH) - * - * Example, 0.1.0-rc1-1-g5c86570 - */ -#define NFD_VERSION_BUILD_STRING "0.3.1-7-g2231ab5" - -/// MAJOR version -#define NFD_VERSION_MAJOR 0 -/// MINOR version -#define NFD_VERSION_MINOR 3 -/// PATCH version -#define NFD_VERSION_PATCH 1 - -} // namespace nfd - -#endif // NFD_VERSION_HPP diff --git a/tools/ping/ndn-ping-server.cpp b/tools/ping/ndn-ping-server.cpp index d508e6c..437c529 100644 --- a/tools/ping/ndn-ping-server.cpp +++ b/tools/ping/ndn-ping-server.cpp @@ -35,12 +35,7 @@ * @author: Jerald Paul Abraham */ -#include -#include -#include - -#include -#include +#include "core/version.hpp" namespace ndn { namespace ping { @@ -209,7 +204,7 @@ main(int argc, char* argv[]) int res; NdnPingServer program(argv[0]); - while ((res = getopt(argc, argv, "hdtp:x:")) != -1) + while ((res = getopt(argc, argv, "hdtp:x:V")) != -1) { switch (res) { case 'h': @@ -224,7 +219,10 @@ main(int argc, char* argv[]) case 't': program.setPrintTimestamp(); break; - default: + case 'V': + std::cout << "ndnpingserver " << tools::VERSION << std::endl; + return 0; + default: program.usage(); break; } diff --git a/tools/ping/ndn-ping.cpp b/tools/ping/ndn-ping.cpp index 11591a6..5d0908e 100644 --- a/tools/ping/ndn-ping.cpp +++ b/tools/ping/ndn-ping.cpp @@ -35,13 +35,9 @@ * @author: Jerald Paul Abraham */ -#include -#include +#include "core/version.hpp" -#include -#include #include -#include namespace ndn { namespace ping { @@ -389,7 +385,7 @@ main(int argc, char* argv[]) int res; NdnPing program(argv[0]); - while ((res = getopt(argc, argv, "htai:c:n:p:")) != -1) + while ((res = getopt(argc, argv, "htai:c:n:p:V")) != -1) { switch (res) { case 'a': @@ -418,6 +414,9 @@ main(int argc, char* argv[]) case 't': program.setPrintTimestamp(); break; + case 'V': + std::cout << "ndnping " << tools::VERSION << std::endl; + return 0; default: program.usage(); break;