blob: c413778d178b5081a9a504e1ee4c7f9ad3e542ea [file] [log] [blame]
Zhiyi Zhang48f23782020-09-28 12:11:24 -07001/* -*- 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 "ndncert-common.hpp"
22
23namespace ndn {
24namespace ndncert {
25
tylerliu96a67e82020-10-15 13:37:12 -070026std::ostream&
27operator<<(std::ostream& out, ErrorCode code)
tylerliu36d97f52020-09-30 22:32:54 -070028{
tylerliu96a67e82020-10-15 13:37:12 -070029 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;
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) {
tylerliu96a67e82020-10-15 13:37:12 -070049 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;
Zhiyi Zhanga749f442020-09-29 17:19:51 -070056}
57
Zhiyi Zhange4891b72020-10-10 15:11:57 -070058} // namespace ndncert
59} // namespace ndn