blob: 5e22afbbd0012f8123f62c79cf32edd7608bf630 [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/*
3 * Copyright (c) 2017-2021, 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
Zhiyi Zhang48f23782020-09-28 12:11:24 -070023namespace ndncert {
24
tylerliu96a67e82020-10-15 13:37:12 -070025std::ostream&
26operator<<(std::ostream& out, ErrorCode code)
tylerliu36d97f52020-09-30 22:32:54 -070027{
tylerliu96a67e82020-10-15 13:37:12 -070028 switch (code) {
29 case ErrorCode::NO_ERROR: out << "NO_ERROR"; break;
30 case ErrorCode::BAD_INTEREST_FORMAT: out << "BAD_INTEREST_FORMAT"; break;
31 case ErrorCode::BAD_PARAMETER_FORMAT: out << "BAD_PARAMETER_FORMAT"; break;
32 case ErrorCode::BAD_SIGNATURE: out << "BAD_SIGNATURE"; break;
33 case ErrorCode::INVALID_PARAMETER: out << "INVALID_PARAMETER"; break;
34 case ErrorCode::NAME_NOT_ALLOWED: out << "NAME_NOT_ALLOWED"; break;
35 case ErrorCode::BAD_VALIDITY_PERIOD: out << "BAD_VALIDITY_PERIOD"; break;
36 case ErrorCode::OUT_OF_TRIES: out << "OUT_OF_TRIES"; break;
37 case ErrorCode::OUT_OF_TIME: out << "OUT_OF_TIME"; break;
38 case ErrorCode::NO_AVAILABLE_NAMES: out << "NO_AVAILABLE_NAMES"; break;
39 default: out << "UNKNOWN_ERROR"; break;
40 }
41 return out;
tylerliu36d97f52020-09-30 22:32:54 -070042}
43
tylerliu96a67e82020-10-15 13:37:12 -070044std::ostream&
45operator<<(std::ostream& out, RequestType type)
Zhiyi Zhanga749f442020-09-29 17:19:51 -070046{
Zhiyi Zhang7bd01982020-10-17 08:18:16 -070047 switch (type) {
tylerliu96a67e82020-10-15 13:37:12 -070048 case RequestType::NEW: out << "New"; break;
49 case RequestType::RENEW: out << "Renew"; break;
50 case RequestType::REVOKE: out << "Revoke"; break;
51 case RequestType::NOTINITIALIZED: out << "Not Initialized"; break;
52 default: out << "UNKNOWN_REQUEST_TYPE"; break;
53 }
54 return out;
Zhiyi Zhanga749f442020-09-29 17:19:51 -070055}
56
Zhiyi Zhange4891b72020-10-10 15:11:57 -070057} // namespace ndncert