chromium/third_party/ipcz/src/ipcz/link_side.h

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IPCZ_SRC_IPCZ_LINK_SIDE_H_
#define IPCZ_SRC_IPCZ_LINK_SIDE_H_

#include <cstdint>
#include <string>

namespace ipcz {

// A simple wrapper around an A/B enum to consistently distinguish between two
// sides of a single conceptual link between nodes or routers. Side A and side B
// are arbitrary choices, but it's important that each side of a link identifies
// as the opposite of the other side. This idenitity helps to establish
// conventions around usage and manipulation of state shared by both ends of a
// link.
struct LinkSide {};

// The bit which is set on any generated buffer or sublink ID if the ID was
// generated by side B of the NodeLink to which the buffer or sublink is scoped.
// IDs generated by side A do not set this bit. This convention is used to avoid
// ID collisions without requiring explicit cross-node cooperation when
// generating each ID.
inline constexpr int kLinkSideBIdBit =;

}  // namespace ipcz

#endif  // IPCZ_SRC_IPCZ_LINK_SIDE_H_