blob: 7de7346fb9a12640cd039d1f8d6203987844a8b9 [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// A simple mDNS service for the daemon. Includes an API for subscribing to
/// events, as well as inspecting cached info.
///
/// Some more context on how targets are cached: when receiving an mDNS packet,
/// there is an additional record section that contains the nodename of the
/// target, its TTL (in seconds), and some additional metadata.
library fuchsia.developer.bridge;
/// Contains information about the socket bound during mDNS setup.
table MdnsBindEvent {
1: uint16 port;
};
union MdnsEventType {
/// Sent to subscribers when a new target is found on the network. This
/// is only propagated when the target is either seen for the first time,
/// or if the target has previously expired.
1: Target target_found;
/// Sent to subscribers when a target has been discovered after having
/// alreaady been stored in the cache. This can often be treated the same
/// as `target_found`.
2: Target target_rediscovered;
/// Sent to subscribers when a target has expired (the target has not been
/// rediscovered after the TTL has been reached). The target can be
/// rediscovered later. If this happens a `target_found` event will be sent.
3: Target target_expired;
/// An event propagated when the multicast listener is bound. Primarily
/// for testing.
4: MdnsBindEvent socket_bound;
};
[Discoverable]
protocol Mdns {
/// Gets the next event from the protocol. There is only ever meant to be
/// one event ready at a time on the service side, so it is important that
/// the client call this frequently.
GetNextEvent() -> (MdnsEventType? event);
/// Gets full cache of targets. It is advised to call this before
/// `GetNextEvent()`.
GetTargets() -> (vector<Target>:512 targets);
};