1// 2// Copyright (C) 2015 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17// THIS CODE IS GENERATED. 18 19#include "tpm_manager/common/print_tpm_ownership_interface_proto.h" 20 21#include <string> 22 23#include <base/strings/string_number_conversions.h> 24#include <base/strings/stringprintf.h> 25 26#include "tpm_manager/common/print_local_data_proto.h" 27#include "tpm_manager/common/print_tpm_manager_status_proto.h" 28 29namespace tpm_manager { 30 31std::string GetProtoDebugString(const GetTpmStatusRequest& value) { 32 return GetProtoDebugStringWithIndent(value, 0); 33} 34 35std::string GetProtoDebugStringWithIndent(const GetTpmStatusRequest& value, 36 int indent_size) { 37 std::string indent(indent_size, ' '); 38 std::string output = 39 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 40 41 output += indent + "}\n"; 42 return output; 43} 44 45std::string GetProtoDebugString(const GetTpmStatusReply& value) { 46 return GetProtoDebugStringWithIndent(value, 0); 47} 48 49std::string GetProtoDebugStringWithIndent(const GetTpmStatusReply& value, 50 int indent_size) { 51 std::string indent(indent_size, ' '); 52 std::string output = 53 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 54 55 if (value.has_status()) { 56 output += indent + " status: "; 57 base::StringAppendF( 58 &output, "%s", 59 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 60 output += "\n"; 61 } 62 if (value.has_enabled()) { 63 output += indent + " enabled: "; 64 base::StringAppendF(&output, "%s", value.enabled() ? "true" : "false"); 65 output += "\n"; 66 } 67 if (value.has_owned()) { 68 output += indent + " owned: "; 69 base::StringAppendF(&output, "%s", value.owned() ? "true" : "false"); 70 output += "\n"; 71 } 72 if (value.has_local_data()) { 73 output += indent + " local_data: "; 74 base::StringAppendF(&output, "%s", GetProtoDebugStringWithIndent( 75 value.local_data(), indent_size + 2) 76 .c_str()); 77 output += "\n"; 78 } 79 if (value.has_dictionary_attack_counter()) { 80 output += indent + " dictionary_attack_counter: "; 81 base::StringAppendF(&output, "%d", value.dictionary_attack_counter()); 82 output += "\n"; 83 } 84 if (value.has_dictionary_attack_threshold()) { 85 output += indent + " dictionary_attack_threshold: "; 86 base::StringAppendF(&output, "%d", value.dictionary_attack_threshold()); 87 output += "\n"; 88 } 89 if (value.has_dictionary_attack_lockout_in_effect()) { 90 output += indent + " dictionary_attack_lockout_in_effect: "; 91 base::StringAppendF( 92 &output, "%s", 93 value.dictionary_attack_lockout_in_effect() ? "true" : "false"); 94 output += "\n"; 95 } 96 if (value.has_dictionary_attack_lockout_seconds_remaining()) { 97 output += indent + " dictionary_attack_lockout_seconds_remaining: "; 98 base::StringAppendF(&output, "%d", 99 value.dictionary_attack_lockout_seconds_remaining()); 100 output += "\n"; 101 } 102 output += indent + "}\n"; 103 return output; 104} 105 106std::string GetProtoDebugString(const TakeOwnershipRequest& value) { 107 return GetProtoDebugStringWithIndent(value, 0); 108} 109 110std::string GetProtoDebugStringWithIndent(const TakeOwnershipRequest& value, 111 int indent_size) { 112 std::string indent(indent_size, ' '); 113 std::string output = 114 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 115 116 output += indent + "}\n"; 117 return output; 118} 119 120std::string GetProtoDebugString(const TakeOwnershipReply& value) { 121 return GetProtoDebugStringWithIndent(value, 0); 122} 123 124std::string GetProtoDebugStringWithIndent(const TakeOwnershipReply& value, 125 int indent_size) { 126 std::string indent(indent_size, ' '); 127 std::string output = 128 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 129 130 if (value.has_status()) { 131 output += indent + " status: "; 132 base::StringAppendF( 133 &output, "%s", 134 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 135 output += "\n"; 136 } 137 output += indent + "}\n"; 138 return output; 139} 140 141std::string GetProtoDebugString(const RemoveOwnerDependencyRequest& value) { 142 return GetProtoDebugStringWithIndent(value, 0); 143} 144 145std::string GetProtoDebugStringWithIndent( 146 const RemoveOwnerDependencyRequest& value, 147 int indent_size) { 148 std::string indent(indent_size, ' '); 149 std::string output = 150 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 151 152 if (value.has_owner_dependency()) { 153 output += indent + " owner_dependency: "; 154 base::StringAppendF(&output, "%s", 155 base::HexEncode(value.owner_dependency().data(), 156 value.owner_dependency().size()) 157 .c_str()); 158 output += "\n"; 159 } 160 output += indent + "}\n"; 161 return output; 162} 163 164std::string GetProtoDebugString(const RemoveOwnerDependencyReply& value) { 165 return GetProtoDebugStringWithIndent(value, 0); 166} 167 168std::string GetProtoDebugStringWithIndent( 169 const RemoveOwnerDependencyReply& value, 170 int indent_size) { 171 std::string indent(indent_size, ' '); 172 std::string output = 173 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 174 175 if (value.has_status()) { 176 output += indent + " status: "; 177 base::StringAppendF( 178 &output, "%s", 179 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 180 output += "\n"; 181 } 182 output += indent + "}\n"; 183 return output; 184} 185 186} // namespace tpm_manager 187