CCF
Loading...
Searching...
No Matches
node_info.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#include "ccf/crypto/pem.h"
6#include "ccf/ds/json.h"
7#include "ccf/ds/quote_info.h"
8#include "ccf/kv/version.h"
10
11#define FMT_HEADER_ONLY
12#include <fmt/format.h>
13#include <optional>
14
15namespace ccf
16{
17 enum class NodeStatus
18 {
19 PENDING = 0,
20 TRUSTED = 1,
21 RETIRED = 2
22 };
25 {{NodeStatus::PENDING, "Pending"},
26 {NodeStatus::TRUSTED, "Trusted"},
27 {NodeStatus::RETIRED, "Retired"}});
28
30 {
37
40 std::optional<ccf::kv::Version> ledger_secret_seqno = std::nullopt;
41
43 std::optional<std::string> code_digest = std::nullopt;
44
50 std::optional<ccf::crypto::Pem> certificate_signing_request = std::nullopt;
51
53 std::optional<ccf::crypto::Pem> public_key = std::nullopt;
54
57 nlohmann::json node_data = nullptr;
58
67 std::optional<ccf::crypto::Pem> cert = std::nullopt;
68
74 bool retired_committed = false;
75 };
78 NodeInfo, quote_info, encryption_pub_key, status);
81 cert,
82 ledger_secret_seqno,
83 code_digest,
84 certificate_signing_request,
85 public_key,
86 node_data,
87 retired_committed);
88}
89
90FMT_BEGIN_NAMESPACE
91template <>
92struct formatter<ccf::NodeStatus>
93{
94 template <typename ParseContext>
95 constexpr auto parse(ParseContext& ctx)
96 {
97 return ctx.begin();
98 }
99
100 template <typename FormatContext>
101 auto format(const ccf::NodeStatus& state, FormatContext& ctx) const
102 -> decltype(ctx.out())
103 {
104 switch (state)
105 {
107 {
108 return format_to(ctx.out(), "PENDING");
109 }
111 {
112 return format_to(ctx.out(), "TRUSTED");
113 }
115 {
116 return format_to(ctx.out(), "RETIRED");
117 }
118 }
119 }
120};
121FMT_END_NAMESPACE
Definition pem.h:18
#define DECLARE_JSON_TYPE_WITH_BASE_AND_OPTIONAL_FIELDS(TYPE, BASE)
Definition json.h:702
#define DECLARE_JSON_REQUIRED_FIELDS(TYPE,...)
Definition json.h:714
#define DECLARE_JSON_OPTIONAL_FIELDS(TYPE,...)
Definition json.h:786
#define DECLARE_JSON_ENUM(TYPE,...)
Definition json.h:837
Definition app_interface.h:14
NodeStatus
Definition node_info.h:18
Definition node_info_network.h:196
Definition node_info.h:30
std::optional< ccf::crypto::Pem > certificate_signing_request
Node certificate signing request.
Definition node_info.h:50
std::optional< ccf::crypto::Pem > cert
Definition node_info.h:67
bool retired_committed
Definition node_info.h:74
std::optional< std::string > code_digest
Code identity for the node.
Definition node_info.h:43
std::optional< ccf::crypto::Pem > public_key
Public key.
Definition node_info.h:53
QuoteInfo quote_info
Node enclave quote.
Definition node_info.h:32
NodeStatus status
Node status.
Definition node_info.h:36
ccf::crypto::Pem encryption_pub_key
Node encryption public key, used to distribute ledger re-keys.
Definition node_info.h:34
std::optional< ccf::kv::Version > ledger_secret_seqno
Definition node_info.h:40
nlohmann::json node_data
Definition node_info.h:57
Describes a quote (attestation) from trusted hardware.
Definition quote_info.h:26
constexpr auto parse(ParseContext &ctx)
Definition node_info.h:95
auto format(const ccf::NodeStatus &state, FormatContext &ctx) const -> decltype(ctx.out())
Definition node_info.h:101