Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | e6835fe | 2017-01-19 20:05:01 -0800 | [diff] [blame] | 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 6 | * |
| 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 20 | */ |
| 21 | |
| 22 | #ifndef NDN_MGMT_NFD_COMMAND_OPTIONS_HPP |
| 23 | #define NDN_MGMT_NFD_COMMAND_OPTIONS_HPP |
| 24 | |
| 25 | #include "../../security/signing-info.hpp" |
| 26 | |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 27 | namespace ndn { |
| 28 | |
| 29 | namespace security { |
| 30 | namespace v1 { |
| 31 | class IdentityCertificate; |
| 32 | } // namespace v1 |
| 33 | } // namespace security |
| 34 | |
| 35 | namespace nfd { |
| 36 | |
| 37 | /** \ingroup management |
| 38 | * \brief contains options for ControlCommand execution |
| 39 | * \note This type is intentionally copyable |
| 40 | */ |
| 41 | class CommandOptions |
| 42 | { |
| 43 | public: |
| 44 | /** \brief constructs CommandOptions |
| 45 | * \post getTimeout() == DEFAULT_TIMEOUT |
| 46 | * \post getPrefix() == DEFAULT_PREFIX |
| 47 | * \post getSigningInfo().getSignerType() == SIGNER_TYPE_NULL |
| 48 | */ |
| 49 | CommandOptions(); |
| 50 | |
| 51 | /** \return command timeout |
| 52 | */ |
| 53 | const time::milliseconds& |
| 54 | getTimeout() const |
| 55 | { |
| 56 | return m_timeout; |
| 57 | } |
| 58 | |
| 59 | /** \brief sets command timeout |
| 60 | * \param timeout the new command timeout, must be positive |
| 61 | * \throw std::out_of_range if timeout is non-positive |
| 62 | * \return self |
| 63 | */ |
| 64 | CommandOptions& |
| 65 | setTimeout(const time::milliseconds& timeout); |
| 66 | |
| 67 | /** \return command prefix |
| 68 | */ |
| 69 | const Name& |
| 70 | getPrefix() const |
| 71 | { |
| 72 | return m_prefix; |
| 73 | } |
| 74 | |
| 75 | /** \brief sets command prefix |
| 76 | * \return self |
| 77 | */ |
| 78 | CommandOptions& |
| 79 | setPrefix(const Name& prefix); |
| 80 | |
| 81 | /** \return signing parameters |
| 82 | */ |
| 83 | const security::SigningInfo& |
| 84 | getSigningInfo() const |
| 85 | { |
| 86 | return m_signingInfo; |
| 87 | } |
| 88 | |
| 89 | /** \brief sets signing parameters |
| 90 | * \return self |
| 91 | */ |
| 92 | CommandOptions& |
| 93 | setSigningInfo(const security::SigningInfo& signingInfo); |
| 94 | |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 95 | public: |
| 96 | /** \brief gives the default command timeout: 10000ms |
| 97 | */ |
| 98 | static const time::milliseconds DEFAULT_TIMEOUT; |
| 99 | |
| 100 | /** \brief gives the default command prefix: ndn:/localhost/nfd |
| 101 | */ |
| 102 | static const Name DEFAULT_PREFIX; |
| 103 | |
| 104 | private: |
| 105 | time::milliseconds m_timeout; |
| 106 | Name m_prefix; |
| 107 | security::SigningInfo m_signingInfo; |
| 108 | }; |
| 109 | |
| 110 | } // namespace nfd |
| 111 | } // namespace ndn |
| 112 | |
| 113 | #endif // NDN_MGMT_NFD_COMMAND_OPTIONS_HPP |