CCF
Loading...
Searching...
No Matches
node_types.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
6#include "ccf/frame_format.h"
7#include "ccf/tx_id.h"
9
10#include <cstdint>
11#include <limits>
12
13namespace ccf
14{
15 using Node2NodeMsg = uint64_t;
16
17 // NOLINTBEGIN(performance-enum-size)
18
19 // Type of messages exchanged between nodes
26 // NB: The node-to-node channels assume only 2 types of messages exist, and
27 // treat them differently. Adding a new message type will likely need
28 // additional changes.
29
30 // Types of channel messages
37
38 // Types of frontend messages
40 {
43
44 // Includes a command_id, so that forwarded requests and responses can be
45 // precisely correlated. Supported since 2.0.8, emitted since 3.0.0
48
49 // Includes session consistency information:
50 // - cmd contains view in which all session requests must execute
51 // - response contains bool indicating that session should be closed
54 };
55
56 // NOLINTEND(performance-enum-size)
57
58#pragma pack(push, 1)
59 // Channel-specific header for key exchange
65
66 // Frontend-specific header for forwarding
72
74 {
75 using ForwardedCommandId = size_t;
77 };
78
80 {
89
90 // The view in which this session is being executed. For consistency, we
91 // pessimistically close this session if the node is in any other view.
93 };
94
96 {
105
106 // If the response contains a fatal error, indicate to the original node
107 // that the session should be terminated.
109 };
110
112 {
113 MessageHash() = default;
115 msg(msg_),
116 hash(std::move(hash_))
117 {}
118
121 };
122#pragma pack(pop)
123
126 {
128 DEFINE_RINGBUFFER_MSG_TYPE(associate_node_address),
129
132 DEFINE_RINGBUFFER_MSG_TYPE(node_inbound),
133
138 DEFINE_RINGBUFFER_MSG_TYPE(node_outbound),
139
141 DEFINE_RINGBUFFER_MSG_TYPE(close_node_outbound)
142 };
143}
144
146 ccf::associate_node_address, ccf::NodeId::Value, std::string, std::string);
148 ccf::node_inbound,
153 ccf::node_outbound,
159 ccf::close_node_outbound, ccf::NodeId::Value);
Definition sha256_hash.h:16
Definition app_interface.h:14
@ DEFINE_RINGBUFFER_MSG_TYPE
Change the network nodes. Enclave -> Host.
Definition node_types.h:128
ChannelMsg
Definition node_types.h:32
@ key_exchange_init
Definition node_types.h:33
@ key_exchange_final
Definition node_types.h:35
@ key_exchange_response
Definition node_types.h:34
view
Definition signatures.h:54
uint64_t Node2NodeMsg
Definition node_types.h:15
ForwardedMsg
Definition node_types.h:40
@ forwarded_cmd_v3
Definition node_types.h:52
@ forwarded_cmd_v2
Definition node_types.h:46
@ forwarded_response_v1
Definition node_types.h:42
@ forwarded_response_v3
Definition node_types.h:53
@ forwarded_response_v2
Definition node_types.h:47
@ forwarded_cmd_v1
Definition node_types.h:41
uint64_t View
Definition tx_id.h:23
FrameFormat
Definition frame_format.h:8
NodeMsgType
Definition node_types.h:21
@ channel_msg
Definition node_types.h:22
@ consensus_msg
Definition node_types.h:23
@ forwarded_msg
Definition node_types.h:24
uint32_t Message
Definition ring_buffer_types.h:19
STL namespace.
#define DECLARE_RINGBUFFER_MESSAGE_PAYLOAD(MTYPE,...)
Definition ring_buffer_types.h:183
Definition node_types.h:61
ChannelMsg msg
Definition node_types.h:62
NodeId from_node
Definition node_types.h:63
std::string Value
Definition entity_id.h:19
Definition node_types.h:80
ccf::View active_view
Definition node_types.h:92
ForwardedCommandHeader_v3(ForwardedHeader_v2::ForwardedCommandId cmd_id, ccf::View view)
Definition node_types.h:82
Definition node_types.h:68
ForwardedMsg msg
Definition node_types.h:69
ccf::FrameFormat frame_format
Definition node_types.h:70
Definition node_types.h:74
ForwardedCommandId id
Definition node_types.h:76
size_t ForwardedCommandId
Definition node_types.h:75
Definition node_types.h:96
ForwardedResponseHeader_v3(ForwardedHeader_v2::ForwardedCommandId cmd_id, bool terminate)
Definition node_types.h:98
bool terminate_session
Definition node_types.h:108
Definition node_types.h:112
MessageHash()=default
MessageHash(ForwardedMsg msg_, ccf::crypto::Sha256Hash &&hash_)
Definition node_types.h:114
ForwardedMsg msg
Definition node_types.h:119
ccf::crypto::Sha256Hash hash
Definition node_types.h:120
Definition serializer.h:27