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_nvram_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_tpm_manager_status_proto.h" 27 28namespace tpm_manager { 29 30std::string GetProtoDebugString(const DefineNvramRequest& value) { 31 return GetProtoDebugStringWithIndent(value, 0); 32} 33 34std::string GetProtoDebugStringWithIndent(const DefineNvramRequest& value, 35 int indent_size) { 36 std::string indent(indent_size, ' '); 37 std::string output = 38 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 39 40 if (value.has_index()) { 41 output += indent + " index: "; 42 base::StringAppendF(&output, "%d", value.index()); 43 output += "\n"; 44 } 45 if (value.has_length()) { 46 output += indent + " length: "; 47 base::StringAppendF(&output, "%d", value.length()); 48 output += "\n"; 49 } 50 output += indent + "}\n"; 51 return output; 52} 53 54std::string GetProtoDebugString(const DefineNvramReply& value) { 55 return GetProtoDebugStringWithIndent(value, 0); 56} 57 58std::string GetProtoDebugStringWithIndent(const DefineNvramReply& value, 59 int indent_size) { 60 std::string indent(indent_size, ' '); 61 std::string output = 62 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 63 64 if (value.has_status()) { 65 output += indent + " status: "; 66 base::StringAppendF( 67 &output, "%s", 68 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 69 output += "\n"; 70 } 71 output += indent + "}\n"; 72 return output; 73} 74 75std::string GetProtoDebugString(const DestroyNvramRequest& value) { 76 return GetProtoDebugStringWithIndent(value, 0); 77} 78 79std::string GetProtoDebugStringWithIndent(const DestroyNvramRequest& value, 80 int indent_size) { 81 std::string indent(indent_size, ' '); 82 std::string output = 83 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 84 85 if (value.has_index()) { 86 output += indent + " index: "; 87 base::StringAppendF(&output, "%d", value.index()); 88 output += "\n"; 89 } 90 output += indent + "}\n"; 91 return output; 92} 93 94std::string GetProtoDebugString(const DestroyNvramReply& value) { 95 return GetProtoDebugStringWithIndent(value, 0); 96} 97 98std::string GetProtoDebugStringWithIndent(const DestroyNvramReply& value, 99 int indent_size) { 100 std::string indent(indent_size, ' '); 101 std::string output = 102 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 103 104 if (value.has_status()) { 105 output += indent + " status: "; 106 base::StringAppendF( 107 &output, "%s", 108 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 109 output += "\n"; 110 } 111 output += indent + "}\n"; 112 return output; 113} 114 115std::string GetProtoDebugString(const WriteNvramRequest& value) { 116 return GetProtoDebugStringWithIndent(value, 0); 117} 118 119std::string GetProtoDebugStringWithIndent(const WriteNvramRequest& value, 120 int indent_size) { 121 std::string indent(indent_size, ' '); 122 std::string output = 123 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 124 125 if (value.has_index()) { 126 output += indent + " index: "; 127 base::StringAppendF(&output, "%d", value.index()); 128 output += "\n"; 129 } 130 if (value.has_data()) { 131 output += indent + " data: "; 132 base::StringAppendF( 133 &output, "%s", 134 base::HexEncode(value.data().data(), value.data().size()).c_str()); 135 output += "\n"; 136 } 137 output += indent + "}\n"; 138 return output; 139} 140 141std::string GetProtoDebugString(const WriteNvramReply& value) { 142 return GetProtoDebugStringWithIndent(value, 0); 143} 144 145std::string GetProtoDebugStringWithIndent(const WriteNvramReply& value, 146 int indent_size) { 147 std::string indent(indent_size, ' '); 148 std::string output = 149 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 150 151 if (value.has_status()) { 152 output += indent + " status: "; 153 base::StringAppendF( 154 &output, "%s", 155 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 156 output += "\n"; 157 } 158 output += indent + "}\n"; 159 return output; 160} 161 162std::string GetProtoDebugString(const ReadNvramRequest& value) { 163 return GetProtoDebugStringWithIndent(value, 0); 164} 165 166std::string GetProtoDebugStringWithIndent(const ReadNvramRequest& value, 167 int indent_size) { 168 std::string indent(indent_size, ' '); 169 std::string output = 170 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 171 172 if (value.has_index()) { 173 output += indent + " index: "; 174 base::StringAppendF(&output, "%d", value.index()); 175 output += "\n"; 176 } 177 output += indent + "}\n"; 178 return output; 179} 180 181std::string GetProtoDebugString(const ReadNvramReply& value) { 182 return GetProtoDebugStringWithIndent(value, 0); 183} 184 185std::string GetProtoDebugStringWithIndent(const ReadNvramReply& value, 186 int indent_size) { 187 std::string indent(indent_size, ' '); 188 std::string output = 189 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 190 191 if (value.has_status()) { 192 output += indent + " status: "; 193 base::StringAppendF( 194 &output, "%s", 195 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 196 output += "\n"; 197 } 198 if (value.has_data()) { 199 output += indent + " data: "; 200 base::StringAppendF( 201 &output, "%s", 202 base::HexEncode(value.data().data(), value.data().size()).c_str()); 203 output += "\n"; 204 } 205 output += indent + "}\n"; 206 return output; 207} 208 209std::string GetProtoDebugString(const IsNvramDefinedRequest& value) { 210 return GetProtoDebugStringWithIndent(value, 0); 211} 212 213std::string GetProtoDebugStringWithIndent(const IsNvramDefinedRequest& value, 214 int indent_size) { 215 std::string indent(indent_size, ' '); 216 std::string output = 217 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 218 219 if (value.has_index()) { 220 output += indent + " index: "; 221 base::StringAppendF(&output, "%d", value.index()); 222 output += "\n"; 223 } 224 output += indent + "}\n"; 225 return output; 226} 227 228std::string GetProtoDebugString(const IsNvramDefinedReply& value) { 229 return GetProtoDebugStringWithIndent(value, 0); 230} 231 232std::string GetProtoDebugStringWithIndent(const IsNvramDefinedReply& value, 233 int indent_size) { 234 std::string indent(indent_size, ' '); 235 std::string output = 236 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 237 238 if (value.has_status()) { 239 output += indent + " status: "; 240 base::StringAppendF( 241 &output, "%s", 242 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 243 output += "\n"; 244 } 245 if (value.has_is_defined()) { 246 output += indent + " is_defined: "; 247 base::StringAppendF(&output, "%s", value.is_defined() ? "true" : "false"); 248 output += "\n"; 249 } 250 output += indent + "}\n"; 251 return output; 252} 253 254std::string GetProtoDebugString(const IsNvramLockedRequest& value) { 255 return GetProtoDebugStringWithIndent(value, 0); 256} 257 258std::string GetProtoDebugStringWithIndent(const IsNvramLockedRequest& value, 259 int indent_size) { 260 std::string indent(indent_size, ' '); 261 std::string output = 262 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 263 264 if (value.has_index()) { 265 output += indent + " index: "; 266 base::StringAppendF(&output, "%d", value.index()); 267 output += "\n"; 268 } 269 output += indent + "}\n"; 270 return output; 271} 272 273std::string GetProtoDebugString(const IsNvramLockedReply& value) { 274 return GetProtoDebugStringWithIndent(value, 0); 275} 276 277std::string GetProtoDebugStringWithIndent(const IsNvramLockedReply& value, 278 int indent_size) { 279 std::string indent(indent_size, ' '); 280 std::string output = 281 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 282 283 if (value.has_status()) { 284 output += indent + " status: "; 285 base::StringAppendF( 286 &output, "%s", 287 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 288 output += "\n"; 289 } 290 if (value.has_is_locked()) { 291 output += indent + " is_locked: "; 292 base::StringAppendF(&output, "%s", value.is_locked() ? "true" : "false"); 293 output += "\n"; 294 } 295 output += indent + "}\n"; 296 return output; 297} 298 299std::string GetProtoDebugString(const GetNvramSizeRequest& value) { 300 return GetProtoDebugStringWithIndent(value, 0); 301} 302 303std::string GetProtoDebugStringWithIndent(const GetNvramSizeRequest& value, 304 int indent_size) { 305 std::string indent(indent_size, ' '); 306 std::string output = 307 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 308 309 if (value.has_index()) { 310 output += indent + " index: "; 311 base::StringAppendF(&output, "%d", value.index()); 312 output += "\n"; 313 } 314 output += indent + "}\n"; 315 return output; 316} 317 318std::string GetProtoDebugString(const GetNvramSizeReply& value) { 319 return GetProtoDebugStringWithIndent(value, 0); 320} 321 322std::string GetProtoDebugStringWithIndent(const GetNvramSizeReply& value, 323 int indent_size) { 324 std::string indent(indent_size, ' '); 325 std::string output = 326 base::StringPrintf("[%s] {\n", value.GetTypeName().c_str()); 327 328 if (value.has_status()) { 329 output += indent + " status: "; 330 base::StringAppendF( 331 &output, "%s", 332 GetProtoDebugStringWithIndent(value.status(), indent_size + 2).c_str()); 333 output += "\n"; 334 } 335 if (value.has_size()) { 336 output += indent + " size: "; 337 base::StringAppendF(&output, "%d", value.size()); 338 output += "\n"; 339 } 340 output += indent + "}\n"; 341 return output; 342} 343 344} // namespace tpm_manager 345