Some checks failed
dev release / build (push) Failing after 12s
Builds out the full v1 scope: a vendored+patched openscreen subset for low-latency Cast Streaming (Mirroring receiver 0F5096E8) alongside the existing Cast V2/HLS and new DLNA/AVTransport casting paths, breadcastd's Idle/Casting state machine with a private IPC socket, the breadcast GTK4 popup as a thin IPC client, and bread.cast.*/bread.command.cast.* breadd integration (device discovery, start/stop, mirroring lifecycle events). Also adds bakery/systemd/Forgejo CI packaging. Validated end-to-end against a real Chromecast/Google TV: negotiated Cast Streaming session, live pipeline playback, and daemon+GUI click-to-cast/ stop through the actual popup.
86 lines
2.9 KiB
C++
86 lines
2.9 KiB
C++
// Copyright 2019 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef PLATFORM_BASE_INTERFACE_INFO_H_
|
|
#define PLATFORM_BASE_INTERFACE_INFO_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "platform/base/ip_address.h"
|
|
|
|
namespace openscreen {
|
|
|
|
// Unique identifier, usually provided by the operating system, for identifying
|
|
// a specific network interface. This value is used with UdpSocket to join
|
|
// multicast groups, or to make multicast broadcasts. An implementation may
|
|
// choose to make these values anything its UdpSocket implementation will
|
|
// recognize.
|
|
using NetworkInterfaceIndex = int64_t;
|
|
enum : NetworkInterfaceIndex { kInvalidNetworkInterfaceIndex = -1 };
|
|
|
|
struct IPSubnet {
|
|
IPAddress address;
|
|
|
|
// Prefix length of `address`, which is another way of specifying a subnet
|
|
// mask. For example, 192.168.0.10/24 is a common representation of the
|
|
// address 192.168.0.10 with a 24-bit prefix (this describes a range of IPv4
|
|
// addresses from 192.168.0.0 through 192.168.0.255). Likewise, for IPv6
|
|
// addresses such as 2001:db8::/96, the concept is the same (this specifies
|
|
// the range of addresses having the same leading 96 bits).
|
|
uint8_t prefix_length = 0;
|
|
|
|
IPSubnet();
|
|
IPSubnet(IPAddress address, uint8_t prefix);
|
|
~IPSubnet();
|
|
};
|
|
|
|
struct InterfaceInfo {
|
|
enum class Type : uint32_t { kEthernet = 0, kWifi, kLoopback, kOther };
|
|
|
|
// Interface index, typically as specified by the operating system,
|
|
// identifying this interface on the host machine.
|
|
NetworkInterfaceIndex index = kInvalidNetworkInterfaceIndex;
|
|
|
|
// MAC address of the interface. Typically 6 or 16 bytes. Empty if
|
|
// unavailable.
|
|
std::vector<uint8_t> hardware_address;
|
|
|
|
// Interface name (e.g. eth0) if available.
|
|
std::string name;
|
|
|
|
// Hardware type of the interface.
|
|
Type type = Type::kOther;
|
|
|
|
// All IP addresses associated with the interface.
|
|
std::vector<IPSubnet> addresses;
|
|
|
|
// Returns an IPAddress of the given type associated with this network
|
|
// interface, or the false IPAddress if the associated address family is not
|
|
// supported on this interface.
|
|
IPAddress GetIpAddressV4() const;
|
|
IPAddress GetIpAddressV6() const;
|
|
|
|
// Returns true if `hardware_address` is non-zero.
|
|
bool HasHardwareAddress() const;
|
|
|
|
InterfaceInfo();
|
|
InterfaceInfo(NetworkInterfaceIndex index,
|
|
const uint8_t hardware_address[6],
|
|
std::string name,
|
|
Type type,
|
|
std::vector<IPSubnet> addresses);
|
|
~InterfaceInfo();
|
|
};
|
|
|
|
// Human-readable output (e.g., for logging).
|
|
std::ostream& operator<<(std::ostream& out, InterfaceInfo::Type type);
|
|
std::ostream& operator<<(std::ostream& out, const IPSubnet& subnet);
|
|
std::ostream& operator<<(std::ostream& out, const InterfaceInfo& info);
|
|
|
|
} // namespace openscreen
|
|
|
|
#endif // PLATFORM_BASE_INTERFACE_INFO_H_
|