#include "ipcz/node.h"
#include <optional>
#include <utility>
#include <vector>
#include "ipcz/driver_memory.h"
#include "ipcz/features.h"
#include "ipcz/ipcz.h"
#include "ipcz/link_side.h"
#include "ipcz/node_connector.h"
#include "ipcz/node_link.h"
#include "ipcz/node_link_memory.h"
#include "ipcz/router.h"
#include "third_party/abseil-cpp/absl/base/macros.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/abseil-cpp/absl/container/inlined_vector.h"
#include "third_party/abseil-cpp/absl/synchronization/mutex.h"
#include "third_party/abseil-cpp/absl/types/span.h"
#include "util/log.h"
#include "util/ref_counted.h"
namespace ipcz {
namespace {
IpczCreateNodeOptions CopyOrUseDefaultOptions(
const IpczCreateNodeOptions* options) { … }
}
class Node::PendingIntroduction { … };
Node::Node(Type type,
const IpczDriver& driver,
const IpczCreateNodeOptions* options)
: … { … }
Node::~Node() = default;
IpczResult Node::Close() { … }
IpczResult Node::ConnectNode(IpczDriverHandle driver_transport,
IpczConnectNodeFlags flags,
absl::Span<IpczHandle> initial_portals) { … }
NodeName Node::GetAssignedName() { … }
Ref<NodeLink> Node::GetBrokerLink() { … }
bool Node::AddConnection(const NodeName& remote_node_name,
Connection connection) { … }
std::optional<Node::Connection> Node::GetConnection(const NodeName& name) { … }
Ref<NodeLink> Node::GetLink(const NodeName& name) { … }
NodeName Node::GenerateRandomName() const { … }
void Node::SetAllocationDelegate(Ref<NodeLink> link) { … }
void Node::AllocateSharedMemory(size_t size,
AllocateSharedMemoryCallback callback) { … }
void Node::EstablishLink(const NodeName& name, EstablishLinkCallback callback) { … }
void Node::HandleIntroductionRequest(NodeLink& from_node_link,
const NodeName& for_node) { … }
void Node::AcceptIntroduction(NodeLink& from_node_link,
const NodeName& name,
LinkSide side,
Node::Type remote_node_type,
uint32_t remote_protocol_version,
const Features& remote_features,
Ref<DriverTransport> transport,
Ref<NodeLinkMemory> memory) { … }
void Node::NotifyIntroductionFailed(NodeLink& from_broker,
const NodeName& name) { … }
bool Node::RelayMessage(const NodeName& from_node, msg::RelayMessage& relay) { … }
bool Node::AcceptRelayedMessage(msg::AcceptRelayedMessage& accept) { … }
void Node::DropConnection(const NodeLink& connection_link) { … }
void Node::WaitForBrokerLinkAsync(BrokerLinkCallback callback) { … }
bool Node::HandleIndirectIntroductionRequest(NodeLink& from_node_link,
const NodeName& our_node,
const NodeName& their_node) { … }
void Node::ShutDown() { … }
void Node::CancelAllIntroductions() { … }
void Node::IntroduceRemoteNodes(NodeLink& first, NodeLink& second) { … }
}