Zhiyi Zhang | 63589b8 | 2020-10-10 10:27:09 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2017-2020, Regents of the University of California. |
| 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 | |
| 21 | #include "detail/ndncert-common.hpp" |
| 22 | |
| 23 | namespace ndn { |
| 24 | namespace ndncert { |
| 25 | |
| 26 | std::ostream& |
| 27 | operator<<(std::ostream& out, ErrorCode code) |
| 28 | { |
| 29 | switch (code) { |
| 30 | case ErrorCode::NO_ERROR: out << "NO_ERROR"; break; |
| 31 | case ErrorCode::BAD_INTEREST_FORMAT: out << "BAD_INTEREST_FORMAT"; break; |
| 32 | case ErrorCode::BAD_PARAMETER_FORMAT: out << "BAD_PARAMETER_FORMAT"; break; |
| 33 | case ErrorCode::BAD_SIGNATURE: out << "BAD_SIGNATURE"; break; |
| 34 | case ErrorCode::INVALID_PARAMETER: out << "INVALID_PARAMETER"; break; |
| 35 | case ErrorCode::NAME_NOT_ALLOWED: out << "NAME_NOT_ALLOWED"; break; |
| 36 | case ErrorCode::BAD_VALIDITY_PERIOD: out << "BAD_VALIDITY_PERIOD"; break; |
| 37 | case ErrorCode::OUT_OF_TRIES: out << "OUT_OF_TRIES"; break; |
| 38 | case ErrorCode::OUT_OF_TIME: out << "OUT_OF_TIME"; break; |
| 39 | case ErrorCode::NO_AVAILABLE_NAMES: out << "NO_AVAILABLE_NAMES"; break; |
| 40 | default: out << "UNKNOWN_ERROR"; break; |
| 41 | } |
| 42 | return out; |
| 43 | } |
| 44 | |
| 45 | std::ostream& |
| 46 | operator<<(std::ostream& out, RequestType type) |
| 47 | { |
| 48 | switch (type) { |
| 49 | case RequestType::NEW: out << "New"; break; |
| 50 | case RequestType::RENEW: out << "Renew"; break; |
| 51 | case RequestType::REVOKE: out << "Revoke"; break; |
| 52 | case RequestType::NOTINITIALIZED: out << "Not Initialized"; break; |
| 53 | default: out << "UNKNOWN_REQUEST_TYPE"; break; |
| 54 | } |
| 55 | return out; |
| 56 | } |
| 57 | |
| 58 | } // namespace ndncert |
| 59 | } // namespace ndn |