apply RDR in server command line tool and some format updates

Change-Id: Id59de3e8892e962062151911eb7fadf828ad69c5
diff --git a/src/name-assignments/assignment-funcs.cpp b/src/name-assignments/assignment-funcs.cpp
index 50c8df1..cba9c65 100644
--- a/src/name-assignments/assignment-funcs.cpp
+++ b/src/name-assignments/assignment-funcs.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2017-2019, Regents of the University of California.
+ * Copyright (c) 2017-2020, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -24,7 +24,7 @@
 namespace ndn {
 namespace ndncert {
 
-NameAssignmentFuncFactory::NameAssignmentFuncFactory(const std::string& factoryType, const std::string& format)
+NameAssignmentFunc::NameAssignmentFunc(const std::string& factoryType, const std::string& format)
   : FACTORY_TYPE(factoryType)
 {
   size_t index = 0, startIndex = 0;
@@ -40,18 +40,18 @@
   }
 }
 
-unique_ptr<NameAssignmentFuncFactory>
-NameAssignmentFuncFactory::createNameAssignmentFuncFactory(const std::string& challengeType, const std::string& format)
+unique_ptr<NameAssignmentFunc>
+NameAssignmentFunc::createNameAssignmentFunc(const std::string& challengeType, const std::string& format)
 {
   FuncFactoryFactory& factory = getFactory();
   auto i = factory.find(challengeType);
   return i == factory.end() ? nullptr : i->second(format);
 }
 
-NameAssignmentFuncFactory::FuncFactoryFactory&
-NameAssignmentFuncFactory::getFactory()
+NameAssignmentFunc::FuncFactoryFactory&
+NameAssignmentFunc::getFactory()
 {
-  static NameAssignmentFuncFactory::FuncFactoryFactory factory;
+  static NameAssignmentFunc::FuncFactoryFactory factory;
   return factory;
 }
 
diff --git a/src/name-assignments/assignment-funcs.hpp b/src/name-assignments/assignment-funcs.hpp
index b8c2dd1..39e1261 100644
--- a/src/name-assignments/assignment-funcs.hpp
+++ b/src/name-assignments/assignment-funcs.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2017-2019, Regents of the University of California.
+ * Copyright (c) 2017-2020, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -26,58 +26,55 @@
 namespace ndn {
 namespace ndncert {
 
-/**
- * @brief The name assignment function provided by the CA operator to generate available
- * namecomponents.
- * The function does not guarantee that all the returned names are available. Therefore the
- * CA should further check the availability of each returned name and remove unavailable results.
- *
- * @p vector, input, a list of parameter key-value pair used for name assignment.
- * @return a vector containing the possible namespaces derived from the parameters.
- */
-using NameAssignmentFunc = function<std::vector<PartialName>(const std::vector<std::tuple<std::string, std::string>>&)>;
-
-class NameAssignmentFuncFactory : noncopyable {
+class NameAssignmentFunc : noncopyable {
 public:
-  explicit
-  NameAssignmentFuncFactory(const std::string& factoryType, const std::string& format = "");
+  explicit NameAssignmentFunc(const std::string& factoryType, const std::string& format = "");
 
-  virtual ~NameAssignmentFuncFactory() = default;
+  virtual ~NameAssignmentFunc() = default;
 
+  /**
+   * @brief The name assignment function provided by the CA operator to generate available
+   * namecomponents.
+   * The function does not guarantee that all the returned names are available. Therefore the
+   * CA should further check the availability of each returned name and remove unavailable results.
+   *
+   * @p vector, input, a list of parameter key-value pair used for name assignment.
+   * @return a vector containing the possible namespaces derived from the parameters.
+   */
+  virtual std::vector<PartialName>
+  assignName(const std::vector<std::tuple<std::string, std::string>>& params) = 0;
+
+  const std::string FACTORY_TYPE;
+  std::vector<std::string> m_nameFormat;
+
+public:
   template <class ChallengeType>
   static void
-  registerNameAssignmentFuncFactories(const std::string& typeName)
+  registerNameAssignmentFunc(const std::string& typeName)
   {
     FuncFactoryFactory& factory = getFactory();
     BOOST_ASSERT(factory.count(typeName) == 0);
     factory[typeName] = [](const std::string& format) { return make_unique<ChallengeType>(format); };
   }
 
-  static unique_ptr<NameAssignmentFuncFactory>
-  createNameAssignmentFuncFactory(const std::string& challengeType, const std::string& format = "");
-
-  virtual std::vector<PartialName>
-  assignName(const std::vector<std::tuple<std::string, std::string>>& params) = 0;
-
-public:
-  const std::string FACTORY_TYPE;
-  std::vector<std::string> m_nameFormat;
+  static unique_ptr<NameAssignmentFunc>
+  createNameAssignmentFunc(const std::string& challengeType, const std::string& format = "");
 
 private:
-  typedef function<unique_ptr<NameAssignmentFuncFactory>(const std::string&)> FactoryCreateFunc;
+  typedef function<unique_ptr<NameAssignmentFunc>(const std::string&)> FactoryCreateFunc;
   typedef std::map<std::string, FactoryCreateFunc> FuncFactoryFactory;
 
   static FuncFactoryFactory&
   getFactory();
 };
 
-#define NDNCERT_REGISTER_FUNCFACTORY(C, T)                               \
-  static class NdnCert##C##FuncFactoryRegistrationClass {                \
-  public:                                                                \
-    NdnCert##C##FuncFactoryRegistrationClass()                           \
-    {                                                                    \
-      ::ndn::ndncert::NameAssignmentFuncFactory::registerNameAssignmentFuncFactories<C>(T); \
-    }                                                                    \
+#define NDNCERT_REGISTER_FUNCFACTORY(C, T)                                        \
+  static class NdnCert##C##FuncFactoryRegistrationClass {                         \
+  public:                                                                         \
+    NdnCert##C##FuncFactoryRegistrationClass()                                    \
+    {                                                                             \
+      ::ndn::ndncert::NameAssignmentFunc::registerNameAssignmentFunc<C>(T);       \
+    }                                                                             \
   } g_NdnCert##C##ChallengeRegistrationVariable
 
 }  // namespace ndncert
diff --git a/src/name-assignments/assignment-hash.cpp b/src/name-assignments/assignment-hash.cpp
index c71b369..7af3bf8 100644
--- a/src/name-assignments/assignment-hash.cpp
+++ b/src/name-assignments/assignment-hash.cpp
@@ -1,6 +1,22 @@
-//
-// Created by Tyler on 10/6/20.
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2017-2020, Regents of the University of California.
+ *
+ * This file is part of ndncert, a certificate management system based on NDN.
+ *
+ * ndncert 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.
+ *
+ * ndncert 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 copies of the GNU General Public License along with
+ * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndncert authors and contributors.
+ */
 
 #include "assignment-hash.hpp"
 #include <ndn-cxx/util/sha256.hpp>
@@ -11,7 +27,7 @@
 NDNCERT_REGISTER_FUNCFACTORY(AssignmentHash, "hash");
 
 AssignmentHash::AssignmentHash(const std::string& format)
-  : NameAssignmentFuncFactory("hash", format)
+  : NameAssignmentFunc("hash", format)
 {}
 
 std::vector<PartialName>
diff --git a/src/name-assignments/assignment-hash.hpp b/src/name-assignments/assignment-hash.hpp
index 9054bb7..b0cf417 100644
--- a/src/name-assignments/assignment-hash.hpp
+++ b/src/name-assignments/assignment-hash.hpp
@@ -1,6 +1,22 @@
-//
-// Created by Tyler on 10/6/20.
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2017-2020, Regents of the University of California.
+ *
+ * This file is part of ndncert, a certificate management system based on NDN.
+ *
+ * ndncert 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.
+ *
+ * ndncert 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 copies of the GNU General Public License along with
+ * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndncert authors and contributors.
+ */
 
 #ifndef NDNCERT_ASSIGNMENT_HASH_HPP
 #define NDNCERT_ASSIGNMENT_HASH_HPP
@@ -13,7 +29,7 @@
 /**
  * assign names base on client probe parameter
  */
-class AssignmentHash: public NameAssignmentFuncFactory {
+class AssignmentHash: public NameAssignmentFunc {
 public:
   AssignmentHash(const std::string& format = "");
 
diff --git a/src/name-assignments/assignment-param.cpp b/src/name-assignments/assignment-param.cpp
index 890af34..cf54951 100644
--- a/src/name-assignments/assignment-param.cpp
+++ b/src/name-assignments/assignment-param.cpp
@@ -1,6 +1,22 @@
-//
-// Created by Tyler on 10/6/20.
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2017-2020, Regents of the University of California.
+ *
+ * This file is part of ndncert, a certificate management system based on NDN.
+ *
+ * ndncert 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.
+ *
+ * ndncert 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 copies of the GNU General Public License along with
+ * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndncert authors and contributors.
+ */
 
 #include "assignment-param.hpp"
 
@@ -10,7 +26,7 @@
 NDNCERT_REGISTER_FUNCFACTORY(AssignmentParam, "param");
 
 AssignmentParam::AssignmentParam(const std::string& format)
-  : NameAssignmentFuncFactory("param", format)
+  : NameAssignmentFunc("param", format)
 {}
 
 std::vector<PartialName>
diff --git a/src/name-assignments/assignment-param.hpp b/src/name-assignments/assignment-param.hpp
index 9633a57..6b705df 100644
--- a/src/name-assignments/assignment-param.hpp
+++ b/src/name-assignments/assignment-param.hpp
@@ -1,6 +1,22 @@
-//
-// Created by Tyler on 10/6/20.
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2017-2020, Regents of the University of California.
+ *
+ * This file is part of ndncert, a certificate management system based on NDN.
+ *
+ * ndncert 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.
+ *
+ * ndncert 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 copies of the GNU General Public License along with
+ * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndncert authors and contributors.
+ */
 
 #ifndef NDNCERT_ASSIGNMENT_PARAM_HPP
 #define NDNCERT_ASSIGNMENT_PARAM_HPP
@@ -13,7 +29,7 @@
 /**
  * assign names base on client probe parameter
  */
-class AssignmentParam: public NameAssignmentFuncFactory{
+class AssignmentParam: public NameAssignmentFunc{
 public:
   AssignmentParam(const std::string& format = "");
 
diff --git a/src/name-assignments/assignment-random.cpp b/src/name-assignments/assignment-random.cpp
index 88e9a91..7b24481 100644
--- a/src/name-assignments/assignment-random.cpp
+++ b/src/name-assignments/assignment-random.cpp
@@ -1,6 +1,22 @@
-//
-// Created by Tyler on 10/6/20.
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2017-2020, Regents of the University of California.
+ *
+ * This file is part of ndncert, a certificate management system based on NDN.
+ *
+ * ndncert 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.
+ *
+ * ndncert 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 copies of the GNU General Public License along with
+ * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndncert authors and contributors.
+ */
 
 #include "assignment-random.hpp"
 #include <ndn-cxx/util/random.hpp>
@@ -11,7 +27,7 @@
 NDNCERT_REGISTER_FUNCFACTORY(AssignmentRandom, "random");
 
 AssignmentRandom::AssignmentRandom(const std::string& format)
-  : NameAssignmentFuncFactory("random", format)
+  : NameAssignmentFunc("random", format)
 {}
 
 std::vector<PartialName>
diff --git a/src/name-assignments/assignment-random.hpp b/src/name-assignments/assignment-random.hpp
index c35c143..a3e30dd 100644
--- a/src/name-assignments/assignment-random.hpp
+++ b/src/name-assignments/assignment-random.hpp
@@ -1,6 +1,22 @@
-//
-// Created by Tyler on 10/6/20.
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2017-2020, Regents of the University of California.
+ *
+ * This file is part of ndncert, a certificate management system based on NDN.
+ *
+ * ndncert 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.
+ *
+ * ndncert 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 copies of the GNU General Public License along with
+ * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndncert authors and contributors.
+ */
 
 #ifndef NDNCERT_ASSIGNMENT_RANDOM_HPP
 #define NDNCERT_ASSIGNMENT_RANDOM_HPP
@@ -13,7 +29,7 @@
 /**
  * assign names base on client probe parameter
  */
-class AssignmentRandom: public NameAssignmentFuncFactory {
+class AssignmentRandom: public NameAssignmentFunc {
 public:
   AssignmentRandom(const std::string& format = "");