Zhiyi Zhang | 48f2378 | 2020-09-28 12:11:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | 0dc0201 | 2021-11-23 22:55:03 -0500 | [diff] [blame] | 2 | /* |
Davide Pesavento | 9510c91 | 2024-02-25 17:50:05 -0500 | [diff] [blame] | 3 | * Copyright (c) 2017-2024, Regents of the University of California. |
Zhiyi Zhang | 48f2378 | 2020-09-28 12:11:24 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndncert, a certificate management system based on NDN. |
| 6 | * |
| 7 | * ndncert is free software: you can redistribute it and/or modify it under the terms |
| 8 | * of the GNU General Public License as published by the Free Software Foundation, either |
| 9 | * version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndncert 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 General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License along with |
| 16 | * ndncert, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | * See AUTHORS.md for complete list of ndncert authors and contributors. |
| 19 | */ |
| 20 | |
Zhiyi Zhang | b041d44 | 2020-10-22 21:57:11 -0700 | [diff] [blame] | 21 | #include "detail/ndncert-common.hpp" |
Zhiyi Zhang | 48f2378 | 2020-09-28 12:11:24 -0700 | [diff] [blame] | 22 | |
Davide Pesavento | 9510c91 | 2024-02-25 17:50:05 -0500 | [diff] [blame] | 23 | #include <ndn-cxx/util/backports.hpp> |
| 24 | |
Zhiyi Zhang | 48f2378 | 2020-09-28 12:11:24 -0700 | [diff] [blame] | 25 | namespace ndncert { |
| 26 | |
tylerliu | 96a67e8 | 2020-10-15 13:37:12 -0700 | [diff] [blame] | 27 | std::ostream& |
| 28 | operator<<(std::ostream& out, ErrorCode code) |
tylerliu | 36d97f5 | 2020-09-30 22:32:54 -0700 | [diff] [blame] | 29 | { |
tylerliu | 96a67e8 | 2020-10-15 13:37:12 -0700 | [diff] [blame] | 30 | switch (code) { |
Davide Pesavento | 9510c91 | 2024-02-25 17:50:05 -0500 | [diff] [blame] | 31 | case ErrorCode::NO_ERROR: return out << "NO_ERROR"; |
| 32 | case ErrorCode::BAD_INTEREST_FORMAT: return out << "BAD_INTEREST_FORMAT"; |
| 33 | case ErrorCode::BAD_PARAMETER_FORMAT: return out << "BAD_PARAMETER_FORMAT"; |
| 34 | case ErrorCode::BAD_SIGNATURE: return out << "BAD_SIGNATURE"; |
| 35 | case ErrorCode::INVALID_PARAMETER: return out << "INVALID_PARAMETER"; |
| 36 | case ErrorCode::NAME_NOT_ALLOWED: return out << "NAME_NOT_ALLOWED"; |
| 37 | case ErrorCode::BAD_VALIDITY_PERIOD: return out << "BAD_VALIDITY_PERIOD"; |
| 38 | case ErrorCode::OUT_OF_TRIES: return out << "OUT_OF_TRIES"; |
| 39 | case ErrorCode::OUT_OF_TIME: return out << "OUT_OF_TIME"; |
| 40 | case ErrorCode::NO_AVAILABLE_NAMES: return out << "NO_AVAILABLE_NAMES"; |
tylerliu | 96a67e8 | 2020-10-15 13:37:12 -0700 | [diff] [blame] | 41 | } |
Davide Pesavento | 9510c91 | 2024-02-25 17:50:05 -0500 | [diff] [blame] | 42 | return out << "<Unknown Error " << ndn::to_underlying(code) << ">"; |
tylerliu | 36d97f5 | 2020-09-30 22:32:54 -0700 | [diff] [blame] | 43 | } |
| 44 | |
tylerliu | 96a67e8 | 2020-10-15 13:37:12 -0700 | [diff] [blame] | 45 | std::ostream& |
| 46 | operator<<(std::ostream& out, RequestType type) |
Zhiyi Zhang | a749f44 | 2020-09-29 17:19:51 -0700 | [diff] [blame] | 47 | { |
Zhiyi Zhang | 7bd0198 | 2020-10-17 08:18:16 -0700 | [diff] [blame] | 48 | switch (type) { |
Davide Pesavento | 9510c91 | 2024-02-25 17:50:05 -0500 | [diff] [blame] | 49 | case RequestType::NOTINITIALIZED: return out << "Not Initialized"; |
| 50 | case RequestType::NEW: return out << "New"; |
| 51 | case RequestType::RENEW: return out << "Renew"; |
| 52 | case RequestType::REVOKE: return out << "Revoke"; |
tylerliu | 96a67e8 | 2020-10-15 13:37:12 -0700 | [diff] [blame] | 53 | } |
Davide Pesavento | 9510c91 | 2024-02-25 17:50:05 -0500 | [diff] [blame] | 54 | return out << "<Unknown Request Type " << ndn::to_underlying(type) << ">"; |
Zhiyi Zhang | a749f44 | 2020-09-29 17:19:51 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Zhiyi Zhang | e4891b7 | 2020-10-10 15:11:57 -0700 | [diff] [blame] | 57 | } // namespace ndncert |