| // 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. |
| library fuchsia.developer.ffx; |
| |
| /// Contains information about the socket bound during mDNS setup. |
| type MdnsBindEvent = table { |
| 1: port uint16; |
| }; |
| |
| type MdnsEventType = strict union { |
| /// 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_found TargetInfo; |
| /// 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_rediscovered TargetInfo; |
| /// 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_expired TargetInfo; |
| /// An event propagated when the multicast listener is bound. Primarily |
| /// for testing. |
| 4: socket_bound MdnsBindEvent; |
| }; |
| |
| @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() -> (struct { |
| event MdnsEventType:optional; |
| }); |
| |
| /// Gets full cache of targets. It is advised to call this before |
| /// `GetNextEvent()`. |
| GetTargets() -> (struct { |
| targets vector<TargetInfo>:512; |
| }); |
| }; |