blob: eb308e966ea0aa5b1457fe264ecf1add44390fc7 [file] [log] [blame]
Zhiyi Zhang48f23782020-09-28 12:11:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento0dc02012021-11-23 22:55:03 -05002/*
Davide Pesavento9510c912024-02-25 17:50:05 -05003 * Copyright (c) 2017-2024, Regents of the University of California.
Zhiyi Zhang48f23782020-09-28 12:11:24 -07004 *
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 Zhangb041d442020-10-22 21:57:11 -070021#include "detail/ndncert-common.hpp"
Zhiyi Zhang48f23782020-09-28 12:11:24 -070022
Davide Pesavento9510c912024-02-25 17:50:05 -050023#include <ndn-cxx/util/backports.hpp>
24
Zhiyi Zhang48f23782020-09-28 12:11:24 -070025namespace ndncert {
26
tylerliu96a67e82020-10-15 13:37:12 -070027std::ostream&
28operator<<(std::ostream& out, ErrorCode code)
tylerliu36d97f52020-09-30 22:32:54 -070029{
tylerliu96a67e82020-10-15 13:37:12 -070030 switch (code) {
Davide Pesavento9510c912024-02-25 17:50:05 -050031 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";
tylerliu96a67e82020-10-15 13:37:12 -070041 }
Davide Pesavento9510c912024-02-25 17:50:05 -050042 return out << "<Unknown Error " << ndn::to_underlying(code) << ">";
tylerliu36d97f52020-09-30 22:32:54 -070043}
44
tylerliu96a67e82020-10-15 13:37:12 -070045std::ostream&
46operator<<(std::ostream& out, RequestType type)
Zhiyi Zhanga749f442020-09-29 17:19:51 -070047{
Zhiyi Zhang7bd01982020-10-17 08:18:16 -070048 switch (type) {
Davide Pesavento9510c912024-02-25 17:50:05 -050049 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";
tylerliu96a67e82020-10-15 13:37:12 -070053 }
Davide Pesavento9510c912024-02-25 17:50:05 -050054 return out << "<Unknown Request Type " << ndn::to_underlying(type) << ">";
Zhiyi Zhanga749f442020-09-29 17:19:51 -070055}
56
Zhiyi Zhange4891b72020-10-10 15:11:57 -070057} // namespace ndncert