mojo消息相关的宏人工比较难展开,所以让gpt帮忙展开了一下,写在这里
bool NodeMessageListener::OnMessage(Message& message) {
return DispatchMessage(message);
}
bool NodeMessageListener::OnTransportMessage(
const DriverTransport::RawMessage& raw_message,
const DriverTransport& transport) {
if (raw_message.data.size() < sizeof(internal::MessageHeaderV0)) {
return false;
}
const auto& header =
*reinterpret_cast<const internal::MessageHeaderV0*>(
raw_message.data.data());
switch (header.message_id) {
case ConnectFromBrokerToNonBroker::kId: {
ConnectFromBrokerToNonBroker message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ConnectFromNonBrokerToBroker::kId: {
ConnectFromNonBrokerToBroker message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ReferNonBroker::kId: {
ReferNonBroker message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ConnectToReferredBroker::kId: {
ConnectToReferredBroker message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ConnectToReferredNonBroker::kId: {
ConnectToReferredNonBroker message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case NonBrokerReferralAccepted::kId: {
NonBrokerReferralAccepted message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case NonBrokerReferralRejected::kId: {
NonBrokerReferralRejected message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ConnectFromBrokerToBroker::kId: {
ConnectFromBrokerToBroker message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RequestIntroduction::kId: {
RequestIntroduction message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case AcceptIntroduction::kId: {
AcceptIntroduction message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RejectIntroduction::kId: {
RejectIntroduction message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RequestIndirectIntroduction::kId: {
RequestIndirectIntroduction message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case AddBlockBuffer::kId: {
AddBlockBuffer message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case AcceptParcel::kId: {
AcceptParcel message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case AcceptParcelDriverObjects::kId: {
AcceptParcelDriverObjects message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RouteClosed::kId: {
RouteClosed message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RouteDisconnected::kId: {
RouteDisconnected message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case BypassPeer::kId: {
BypassPeer message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case AcceptBypassLink::kId: {
AcceptBypassLink message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case StopProxying::kId: {
StopProxying message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ProxyWillStop::kId: {
ProxyWillStop message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case BypassPeerWithLink::kId: {
BypassPeerWithLink message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case StopProxyingToLocalPeer::kId: {
StopProxyingToLocalPeer message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case FlushRouter::kId: {
FlushRouter message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RequestMemory::kId: {
RequestMemory message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case ProvideMemory::kId: {
ProvideMemory message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case RelayMessage::kId: {
RelayMessage message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
case AcceptRelayedMessage::kId: {
AcceptRelayedMessage message(Message::kIncoming);
if (!message.Deserialize(raw_message, transport)) {
return false;
}
return OnMessage(message);
}
default: {
Message message;
return message.DeserializeUnknownType(raw_message, transport) &&
OnMessage(message);
}
}
}
// 定义 NodeMessageListener 类
class NodeMessageListener {
public:
bool DispatchMessage(Message& message) {
switch (message.header().message_id) {
case msg::Node::kId:
return OnNode(static_cast<msg::Node&>(message));
case msg::ConnectFromBrokerToNonBroker::kId:
return OnConnectFromBrokerToNonBroker(static_cast<msg::ConnectFromBrokerToNonBroker&>(message));
case msg::ConnectFromNonBrokerToBroker::kId:
return OnConnectFromNonBrokerToBroker(static_cast<msg::ConnectFromNonBrokerToBroker&>(message));
case msg::ReferNonBroker::kId:
return OnReferNonBroker(static_cast<msg::ReferNonBroker&>(message));
case msg::ConnectToReferredBroker::kId:
return OnConnectToReferredBroker(static_cast<msg::ConnectToReferredBroker&>(message));
case msg::ConnectToReferredNonBroker::kId:
return OnConnectToReferredNonBroker(static_cast<msg::ConnectToReferredNonBroker&>(message));
case msg::NonBrokerReferralAccepted::kId:
return OnNonBrokerReferralAccepted(static_cast<msg::NonBrokerReferralAccepted&>(message));
case msg::NonBrokerReferralRejected::kId:
return OnNonBrokerReferralRejected(static_cast<msg::NonBrokerReferralRejected&>(message));
case msg::ConnectFromBrokerToBroker::kId:
return OnConnectFromBrokerToBroker(static_cast<msg::ConnectFromBrokerToBroker&>(message));
case msg::RequestIntroduction::kId:
return OnRequestIntroduction(static_cast<msg::RequestIntroduction&>(message));
case msg::AcceptIntroduction::kId:
return OnAcceptIntroduction(static_cast<msg::AcceptIntroduction&>(message));
case msg::RejectIntroduction::kId:
return OnRejectIntroduction(static_cast<msg::RejectIntroduction&>(message));
case msg::RequestIndirectIntroduction::kId:
return OnRequestIndirectIntroduction(static_cast<msg::RequestIndirectIntroduction&>(message));
case msg::AddBlockBuffer::kId:
return OnAddBlockBuffer(static_cast<msg::AddBlockBuffer&>(message));
case msg::AcceptParcel::kId:
return OnAcceptParcel(static_cast<msg::AcceptParcel&>(message));
case msg::AcceptParcelDriverObjects::kId:
return OnAcceptParcelDriverObjects(static_cast<msg::AcceptParcelDriverObjects&>(message));
case msg::RouteClosed::kId:
return OnRouteClosed(static_cast<msg::RouteClosed&>(message));
case msg::RouteDisconnected::kId:
return OnRouteDisconnected(static_cast<msg::RouteDisconnected&>(message));
case msg::BypassPeer::kId:
return OnBypassPeer(static_cast<msg::BypassPeer&>(message));
case msg::AcceptBypassLink::kId:
return OnAcceptBypassLink(static_cast<msg::AcceptBypassLink&>(message));
case msg::StopProxying::kId:
return OnStopProxying(static_cast<msg::StopProxying&>(message));
case msg::ProxyWillStop::kId:
return OnProxyWillStop(static_cast<msg::ProxyWillStop&>(message));
case msg::BypassPeerWithLink::kId:
return OnBypassPeerWithLink(static_cast<msg::BypassPeerWithLink&>(message));
case msg::StopProxyingToLocalPeer::kId:
return OnStopProxyingToLocalPeer(static_cast<msg::StopProxyingToLocalPeer&>(message));
case msg::FlushRouter::kId:
return OnFlushRouter(static_cast<msg::FlushRouter&>(message));
case msg::RequestMemory::kId:
return OnRequestMemory(static_cast<msg::RequestMemory&>(message));
case msg::ProvideMemory::kId:
return OnProvideMemory(static_cast<msg::ProvideMemory&>(message));
case msg::RelayMessage::kId:
return OnRelayMessage(static_cast<msg::RelayMessage&>(message));
case msg::AcceptRelayedMessage::kId:
return OnAcceptRelayedMessage(static_cast<msg::AcceptRelayedMessage&>(message));
default:
return true;
}
}
bool OnNode(msg::Node& message) {
// 实现处理 Node 消息的逻辑
return true;
}
bool OnConnectFromBrokerToNonBroker(msg::ConnectFromBrokerToNonBroker& message) {
// 实现处理 ConnectFromBrokerToNonBroker 消息的逻辑
return true;
}
// 展开其他消息类型的处理方法
};
struct NodeMessageListener_Params {
NodeMessageListener_Params();
~NodeMessageListener_Params();
static constexpr uint8_t kId = x;
static constexpr uint32_t kVersion = x;
internal::StructHeader header;
};
struct ConnectFromBrokerToNonBroker_Params {
ConnectFromBrokerToNonBroker_Params();
~ConnectFromBrokerToNonBroker_Params();
static constexpr uint8_t kId = 0;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName broker_name;
NodeName receiver_name;
uint32_t protocol_version;
uint32_t num_initial_portals;
uint32_t buffer;
uint32_t padding;
};
struct ConnectFromNonBrokerToBroker_Params {
ConnectFromNonBrokerToBroker_Params();
~ConnectFromNonBrokerToBroker_Params();
static constexpr uint8_t kId = 1;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint32_t protocol_version;
uint32_t num_initial_portals;
};
struct ReferNonBroker_Params {
ReferNonBroker_Params();
~ReferNonBroker_Params();
static constexpr uint8_t kId = 2;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint64_t referral_id;
uint32_t num_initial_portals;
uint32_t transport;
};
struct ConnectToReferredBroker_Params {
ConnectToReferredBroker_Params();
~ConnectToReferredBroker_Params();
static constexpr uint8_t kId = 3;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint32_t protocol_version;
uint32_t num_initial_portals;
};
struct ConnectToReferredNonBroker_Params {
ConnectToReferredNonBroker_Params();
~ConnectToReferredNonBroker_Params();
static constexpr uint8_t kId = 4;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName name;
NodeName broker_name;
NodeName referrer_name;
uint32_t broker_protocol_version;
uint32_t referrer_protocol_version;
uint32_t num_initial_portals;
uint32_t broker_link_buffer;
uint32_t referrer_link_transport;
uint32_t referrer_link_buffer;
};
struct NonBrokerReferralAccepted_Params {
NonBrokerReferralAccepted_Params();
~NonBrokerReferralAccepted_Params();
static constexpr uint8_t kId = 5;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint64_t referral_id;
uint32_t protocol_version;
uint32_t num_initial_portals;
NodeName name;
uint32_t transport;
uint32_t buffer;
};
struct NonBrokerReferralRejected_Params {
NonBrokerReferralRejected_Params();
~NonBrokerReferralRejected_Params();
static constexpr uint8_t kId = 6;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint64_t referral_id;
};
struct ConnectFromBrokerToBroker_Params {
ConnectFromBrokerToBroker_Params();
~ConnectFromBrokerToBroker_Params();
static constexpr uint8_t kId = 7;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName name;
uint32_t protocol_version;
uint32_t num_initial_portals;
uint32_t buffer;
uint32_t padding;
};
struct RequestIntroduction_Params {
RequestIntroduction_Params();
~RequestIntroduction_Params();
static constexpr uint8_t kId = 10;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName name;
};
struct AcceptIntroduction_Params {
AcceptIntroduction_Params();
~AcceptIntroduction_Params();
static constexpr uint8_t kId = 11;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName name;
LinkSide link_side;
NodeType remote_node_type;
uint16_t padding;
uint32_t remote_protocol_version;
uint32_t transport;
uint32_t memory;
};
struct RejectIntroduction_Params {
RejectIntroduction_Params();
~RejectIntroduction_Params();
static constexpr uint8_t kId = 12;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName name;
};
struct RequestIndirectIntroduction_Params {
RequestIndirectIntroduction_Params();
~RequestIndirectIntroduction_Params();
static constexpr uint8_t kId = 13;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName source_node;
NodeName target_node;
};
struct AddBlockBuffer_Params {
AddBlockBuffer_Params();
~AddBlockBuffer_Params();
static constexpr uint8_t kId = 14;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
BufferId id;
uint32_t block_size;
uint32_t buffer;
};
struct AcceptParcel_Params {
AcceptParcel_Params();
~AcceptParcel_Params();
static constexpr uint8_t kId = 20;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SequenceNumber sequence_number;
uint32_t subparcel_index;
uint32_t num_subparcels;
FragmentDescriptor parcel_fragment;
uint8_t parcel_data[];
HandleType handle_types[];
RouterDescriptor new_routers[];
uint32_t padding;
uint32_t driver_objects[];
};
struct AcceptParcelDriverObjects_Params {
AcceptParcelDriverObjects_Params();
~AcceptParcelDriverObjects_Params();
static constexpr uint8_t kId = 21;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SequenceNumber sequence_number;
uint32_t driver_objects[];
};
struct RouteClosed_Params {
RouteClosed_Params();
~RouteClosed_Params();
static constexpr uint8_t kId = 22;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SequenceNumber sequence_length;
};
struct RouteDisconnected_Params {
RouteDisconnected_Params();
~RouteDisconnected_Params();
static constexpr uint8_t kId = 23;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
};
struct BypassPeer_Params {
BypassPeer_Params();
~BypassPeer_Params();
static constexpr uint8_t kId = 30;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
uint64_t reserved0;
NodeName bypass_target_node;
SublinkId bypass_target_sublink;
};
struct AcceptBypassLink_Params {
AcceptBypassLink_Params();
~AcceptBypassLink_Params();
static constexpr uint8_t kId = 31;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName current_peer_node;
SublinkId current_peer_sublink;
SequenceNumber inbound_sequence_length_from_bypassed_link;
SublinkId new_sublink;
FragmentDescriptor new_link_state_fragment;
};
struct StopProxying_Params {
StopProxying_Params();
~StopProxying_Params();
static constexpr uint8_t kId = 32;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SequenceNumber inbound_sequence_length;
SequenceNumber outbound_sequence_length;
};
struct ProxyWillStop_Params {
ProxyWillStop_Params();
~ProxyWillStop_Params();
static constexpr uint8_t kId = 33;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SequenceNumber inbound_sequence_length;
};
struct BypassPeerWithLink_Params {
BypassPeerWithLink_Params();
~BypassPeerWithLink_Params();
static constexpr uint8_t kId = 34;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SublinkId new_sublink;
FragmentDescriptor new_link_state_fragment;
SequenceNumber inbound_sequence_length;
};
struct StopProxyingToLocalPeer_Params {
StopProxyingToLocalPeer_Params();
~StopProxyingToLocalPeer_Params();
static constexpr uint8_t kId = 35;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
SequenceNumber outbound_sequence_length;
};
struct FlushRouter_Params {
FlushRouter_Params();
~FlushRouter_Params();
static constexpr uint8_t kId = 36;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
SublinkId sublink;
};
struct RequestMemory_Params {
RequestMemory_Params();
~RequestMemory_Params();
static constexpr uint8_t kId = 64;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint32_t size;
uint32_t padding;
};
struct ProvideMemory_Params {
ProvideMemory_Params();
~ProvideMemory_Params();
static constexpr uint8_t kId = 65;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
uint32_t size;
uint32_t buffer;
};
struct RelayMessage_Params {
RelayMessage_Params();
~RelayMessage_Params();
static constexpr uint8_t kId = 66;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName destination;
uint8_t data[];
uint32_t padding;
uint32_t driver_objects[];
};
struct AcceptRelayedMessage_Params {
AcceptRelayedMessage_Params();
~AcceptRelayedMessage_Params();
static constexpr uint8_t kId = 67;
static constexpr uint32_t kVersion = 0;
internal::StructHeader header;
NodeName source;
uint8_t data[];
uint32_t padding;
uint32_t driver_objects[];
};
struct NodeMessageListener_Params {
NodeMessageListener_Params();
~NodeMessageListener_Params();
constexpr internal::ParamMetadata kMetadata[] = {};
};
ConnectFromBrokerToNonBroker::ConnectFromBrokerToNonBroker()
: MessageWithParams(kIncoming) {}
ConnectFromBrokerToNonBroker::~ConnectFromBrokerToNonBroker() = default;
bool ConnectFromBrokerToNonBroker::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool ConnectFromBrokerToNonBroker::DeserializeRelayed(
absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata ConnectFromBrokerToNonBroker::kMetadata[] = {};
ConnectFromNonBrokerToBroker::ConnectFromNonBrokerToBroker()
: MessageWithParams(kIncoming) {}
ConnectFromNonBrokerToBroker::~ConnectFromNonBrokerToBroker() = default;
bool ConnectFromNonBrokerToBroker::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool ConnectFromNonBrokerToBroker::DeserializeRelayed(
absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata ConnectFromNonBrokerToBroker::kMetadata[] = {};
ReferNonBroker::ReferNonBroker() : MessageWithParams(kIncoming) {}
ReferNonBroker::~ReferNonBroker() = default;
bool ReferNonBroker::Deserialize(const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool ReferNonBroker::DeserializeRelayed(absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata ReferNonBroker::kMetadata[] = {};
ConnectToReferredBroker::ConnectToReferredBroker()
: MessageWithParams(kOutgoing) {}
ConnectToReferredBroker::~ConnectToReferredBroker() = default;
bool ConnectToReferredBroker::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
ConnectToReferredNonBroker::ConnectToReferredNonBroker()
: MessageWithParams(kOutgoing) {}
ConnectToReferredNonBroker::~ConnectToReferredNonBroker() = default;
bool ConnectToReferredNonBroker::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
NonBrokerReferralAccepted::NonBrokerReferralAccepted()
: MessageWithParams(kOutgoing) {}
NonBrokerReferralAccepted::~NonBrokerReferralAccepted() = default;
bool NonBrokerReferralAccepted::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
NonBrokerReferralRejected::NonBrokerReferralRejected()
: MessageWithParams(kOutgoing) {}
NonBrokerReferralRejected::~NonBrokerReferralRejected() = default;
bool NonBrokerReferralRejected::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
ConnectFromBrokerToBroker::ConnectFromBrokerToBroker()
: MessageWithParams(kIncoming) {}
ConnectFromBrokerToBroker::~ConnectFromBrokerToBroker() = default;
bool ConnectFromBrokerToBroker::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool ConnectFromBrokerToBroker::DeserializeRelayed(
absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata ConnectFromBrokerToBroker::kMetadata[] = {};
RequestIntroduction::RequestIntroduction() : MessageWithParams(kOutgoing) {}
RequestIntroduction::~RequestIntroduction() = default;
bool RequestIntroduction::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
AcceptIntroduction::AcceptIntroduction() : MessageWithParams(kIncoming) {}
AcceptIntroduction::~AcceptIntroduction() = default;
bool AcceptIntroduction::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool AcceptIntroduction::DeserializeRelayed(
absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata AcceptIntroduction::kMetadata[] = {};
RejectIntroduction::RejectIntroduction() : MessageWithParams(kIncoming) {}
RejectIntroduction::~RejectIntroduction() = default;
bool RejectIntroduction::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool RejectIntroduction::DeserializeRelayed(absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata RejectIntroduction::kMetadata[] = {};
RequestIndirectIntroduction::RequestIndirectIntroduction()
: MessageWithParams(kOutgoing) {}
RequestIndirectIntroduction::~RequestIndirectIntroduction() = default;
bool RequestIndirectIntroduction::Serialize(
DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
AddBlockBuffer::AddBlockBuffer() : MessageWithParams(kOutgoing) {}
AddBlockBuffer::~AddBlockBuffer() = default;
bool AddBlockBuffer::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
AcceptParcel::AcceptParcel() : MessageWithParams(kIncoming) {}
AcceptParcel::~AcceptParcel() = default;
bool AcceptParcel::Deserialize(const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool AcceptParcel::DeserializeRelayed(absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata AcceptParcel::kMetadata[] = {};
AcceptParcelDriverObjects::AcceptParcelDriverObjects()
: MessageWithParams(kIncoming) {}
AcceptParcelDriverObjects::~AcceptParcelDriverObjects() = default;
bool AcceptParcelDriverObjects::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
bool AcceptParcelDriverObjects::DeserializeRelayed(
absl::Span<const uint8_t> data,
absl::Span<DriverObject> objects) {
return DeserializeFromRelay(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), data, objects);
}
constexpr internal::ParamMetadata AcceptParcelDriverObjects::kMetadata[] = {};
RouteClosed::RouteClosed() : MessageWithParams(kIncoming) {}
RouteClosed::~RouteClosed() = default;
bool RouteClosed::Deserialize(const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
constexpr internal::ParamMetadata RouteClosed::kMetadata[] = {};
RouteDisconnected::RouteDisconnected() : MessageWithParams(kIncoming) {}
RouteDisconnected::~RouteDisconnected() = default;
bool RouteDisconnected::Deserialize(const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
constexpr internal::ParamMetadata RouteDisconnected::kMetadata[] = {};
BypassPeer::BypassPeer() : MessageWithParams(kOutgoing) {}
BypassPeer::~BypassPeer() = default;
bool BypassPeer::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
AcceptBypassLink::AcceptBypassLink() : MessageWithParams(kIncoming) {}
AcceptBypassLink::~AcceptBypassLink() = default;
bool AcceptBypassLink::Deserialize(const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
constexpr internal::ParamMetadata AcceptBypassLink::kMetadata[] = {};
StopProxying::StopProxying() : MessageWithParams(kOutgoing) {}
StopProxying::~StopProxying() = default;
bool StopProxying::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
ProxyWillStop::ProxyWillStop() : MessageWithParams(kOutgoing) {}
ProxyWillStop::~ProxyWillStop() = default;
bool ProxyWillStop::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
BypassPeerWithLink::BypassPeerWithLink() : MessageWithParams(kOutgoing) {}
BypassPeerWithLink::~BypassPeerWithLink() = default;
bool BypassPeerWithLink::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
StopProxyingToLocalPeer::StopProxyingToLocalPeer() : MessageWithParams(kOutgoing) {}
StopProxyingToLocalPeer::~StopProxyingToLocalPeer() = default;
bool StopProxyingToLocalPeer::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
FlushRouter::FlushRouter() : MessageWithParams(kOutgoing) {}
FlushRouter::~FlushRouter() = default;
bool FlushRouter::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
RequestMemory::RequestMemory() : MessageWithParams(kOutgoing) {}
RequestMemory::~RequestMemory() = default;
bool RequestMemory::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
ProvideMemory::ProvideMemory() : MessageWithParams(kIncoming) {}
ProvideMemory::~ProvideMemory() = default;
bool ProvideMemory::Deserialize(const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
constexpr internal::ParamMetadata ProvideMemory::kMetadata[] = {};
RelayMessage::RelayMessage() : MessageWithParams(kOutgoing) {}
RelayMessage::~RelayMessage() = default;
bool RelayMessage::Serialize(DriverTransport::RawMessage* message,
const DriverTransport& transport) const {
return SerializeToTransport(ParamsType::kVersion, absl::MakeSpan(kMetadata),
message, transport);
}
AcceptRelayedMessage::AcceptRelayedMessage() : MessageWithParams(kIncoming) {}
AcceptRelayedMessage::~AcceptRelayedMessage() = default;
bool AcceptRelayedMessage::Deserialize(
const DriverTransport::RawMessage& message,
const DriverTransport& transport) {
return DeserializeFromTransport(sizeof(ParamsType), kVersion,
absl::MakeSpan(kMetadata), message, transport);
}
constexpr internal::ParamMetadata AcceptRelayedMessage::kMetadata[] = {};
class Node : public MessageWithParams<Node_Params> {
public:
using ParamsType = Node_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 0;
static constexpr uint32_t kVersion = 0;
Node();
explicit Node(decltype(kIncoming));
~Node();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
};
};
class ConnectFromBrokerToNonBroker : public MessageWithParams<ConnectFromBrokerToNonBroker_Params> {
public:
using ParamsType = ConnectFromBrokerToNonBroker_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 0;
static constexpr uint32_t kVersion = 0;
ConnectFromBrokerToNonBroker();
~ConnectFromBrokerToNonBroker();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, broker_name), sizeof(ParamsType::broker_name), 0, internal::ParamType::kData},
{offsetof(ParamsType, receiver_name), sizeof(ParamsType::receiver_name), 0, internal::ParamType::kData},
{offsetof(ParamsType, protocol_version), sizeof(ParamsType::protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
{offsetof(ParamsType, buffer), sizeof(ParamsType::buffer), 0, internal::ParamType::kDriverObject},
{offsetof(ParamsType, padding), sizeof(ParamsType::padding), 0, internal::ParamType::kData},
};
};
class ConnectFromNonBrokerToBroker : public MessageWithParams<ConnectFromNonBrokerToBroker_Params> {
public:
using ParamsType = ConnectFromNonBrokerToBroker_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 1;
static constexpr uint32_t kVersion = 0;
ConnectFromNonBrokerToBroker();
~ConnectFromNonBrokerToBroker();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, protocol_version), sizeof(ParamsType::protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
};
};
class ReferNonBroker : public MessageWithParams<ReferNonBroker_Params> {
public:
using ParamsType = ReferNonBroker_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 2;
static constexpr uint32_t kVersion = 0;
ReferNonBroker();
~ReferNonBroker();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, referral_id), sizeof(ParamsType::referral_id), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
{offsetof(ParamsType, transport), sizeof(ParamsType::transport), 0, internal::ParamType::kDriverObject},
};
};
class ConnectToReferredBroker : public MessageWithParams<ConnectToReferredBroker_Params> {
public:
using ParamsType = ConnectToReferredBroker_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 3;
static constexpr uint32_t kVersion = 0;
ConnectToReferredBroker();
~ConnectToReferredBroker();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, protocol_version), sizeof(ParamsType::protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
};
};
class ConnectToReferredNonBroker : public MessageWithParams<ConnectToReferredNonBroker_Params> {
public:
using ParamsType = ConnectToReferredNonBroker_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 4;
static constexpr uint32_t kVersion = 0;
ConnectToReferredNonBroker();
~ConnectToReferredNonBroker();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, name), sizeof(ParamsType::name), 0, internal::ParamType::kData},
{offsetof(ParamsType, broker_name), sizeof(ParamsType::broker_name), 0, internal::ParamType::kData},
{offsetof(ParamsType, referrer_name), sizeof(ParamsType::referrer_name), 0, internal::ParamType::kData},
{offsetof(ParamsType, broker_protocol_version), sizeof(ParamsType::broker_protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, referrer_protocol_version), sizeof(ParamsType::referrer_protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
{offsetof(ParamsType, broker_link_buffer), sizeof(ParamsType::broker_link_buffer), 0, internal::ParamType::kDriverObject},
{offsetof(ParamsType::referrer_link_transport), sizeof(ParamsType::referrer_link_transport), 0, internal::ParamType::kDriverObject},
{offsetof(ParamsType::referrer_link_buffer), sizeof(ParamsType::referrer_link_buffer), 0, internal::ParamType::kDriverObject},
};
};
class NonBrokerReferralAccepted : public MessageWithParams<NonBrokerReferralAccepted_Params> {
public:
using ParamsType = NonBrokerReferralAccepted_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 5;
static constexpr uint32_t kVersion = 0;
NonBrokerReferralAccepted();
~NonBrokerReferralAccepted();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, referral_id), sizeof(ParamsType::referral_id), 0, internal::ParamType::kData},
{offsetof(ParamsType, protocol_version), sizeof(ParamsType::protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
{offsetof(ParamsType, name), sizeof(ParamsType::name), 0, internal::ParamType::kData},
{offsetof(ParamsType, transport), sizeof(ParamsType::transport), 0, internal::ParamType::kDriverObject},
{offsetof(ParamsType, buffer), sizeof(ParamsType::buffer), 0, internal::ParamType::kDriverObject},
};
};
class NonBrokerReferralRejected : public MessageWithParams<NonBrokerReferralRejected_Params> {
public:
using ParamsType = NonBrokerReferralRejected_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 6;
static constexpr uint32_t kVersion = 0;
NonBrokerReferralRejected();
~NonBrokerReferralRejected();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, referral_id), sizeof(ParamsType::referral_id), 0, internal::ParamType::kData},
};
};
class ConnectFromBrokerToBroker : public MessageWithParams<ConnectFromBrokerToBroker_Params> {
public:
using ParamsType = ConnectFromBrokerToBroker_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 7;
static constexpr uint32_t kVersion = 0;
ConnectFromBrokerToBroker();
~ConnectFromBrokerToBroker();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
bool DeserializeRelayed(absl::Span<const uint8_t> data, absl::Span<DriverObject> objects);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, name), sizeof(ParamsType::name), 0, internal::ParamType::kData},
{offsetof(ParamsType, protocol_version), sizeof(ParamsType::protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, num_initial_portals), sizeof(ParamsType::num_initial_portals), 0, internal::ParamType::kData},
{offsetof(ParamsType, buffer), sizeof(ParamsType::buffer), 0, internal::ParamType::kDriverObject},
{offsetof(ParamsType, padding), sizeof(ParamsType::padding), 0, internal::ParamType::kData},
};
};
class RequestIntroduction : public MessageWithParams<RequestIntroduction_Params> {
public:
using ParamsType = RequestIntroduction_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 10;
static constexpr uint32_t kVersion = 0;
RequestIntroduction();
~RequestIntroduction();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, name), sizeof(ParamsType::name), 0, internal::ParamType::kData},
};
};
class AcceptIntroduction : public MessageWithParams<AcceptIntroduction_Params> {
public:
using ParamsType = AcceptIntroduction_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 11;
static constexpr uint32_t kVersion = 0;
AcceptIntroduction();
~AcceptIntroduction();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, name), sizeof(ParamsType::name), 0, internal::ParamType::kData},
{offsetof(ParamsType, link_side), sizeof(ParamsType::link_side), 0, internal::ParamType::kData},
{offsetof(ParamsType, remote_node_type), sizeof(ParamsType::remote_node_type), 0, internal::ParamType::kData},
{offsetof(ParamsType, padding), sizeof(ParamsType::padding), 0, internal::ParamType::kData},
{offsetof(ParamsType, remote_protocol_version), sizeof(ParamsType::remote_protocol_version), 0, internal::ParamType::kData},
{offsetof(ParamsType, transport), sizeof(ParamsType::transport), 0, internal::ParamType::kDriverObject},
{offsetof(ParamsType, memory), sizeof(ParamsType::memory), 0, internal::ParamType::kDriverObject},
};
};
class RejectIntroduction : public MessageWithParams<RejectIntroduction_Params> {
public:
using ParamsType = RejectIntroduction_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 12;
static constexpr uint32_t kVersion = 0;
RejectIntroduction();
~RejectIntroduction();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, name), sizeof(ParamsType::name), 0, internal::ParamType::kData},
};
};
class RequestIndirectIntroduction : public MessageWithParams<RequestIndirectIntroduction_Params> {
public:
using ParamsType = RequestIndirectIntroduction_Params;
static_assert(sizeof(ParamsType) % 8 == 0, "Invalid size");
static constexpr uint8_t kId = 13;
static constexpr uint32_t kVersion = 0;
RequestIndirectIntroduction();
~RequestIndirectIntroduction();
bool Deserialize(const DriverTransport::RawMessage& message, const DriverTransport& transport);
static constexpr internal::ParamMetadata kMetadata[] = {
{offsetof(ParamsType, source_node), sizeof(ParamsType::source_node), 0, internal::ParamType::kData},
{offsetof(ParamsType, target_node), sizeof(ParamsType::