blob: ea6663c5938a8904b938c46499be20b421575cd2 [file] [log] [blame]
// Copyright 2022 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.net.multicast.admin;
using fuchsia.net;
/// The properties used to lookup IPv4 multicast routes.
type Ipv4UnicastSourceAndMulticastDestination = struct {
/// A unicast source address found in a multicast packet.
unicast_source fuchsia.net.Ipv4Address;
/// A multicast destination address found in a multicast packet.
multicast_destination fuchsia.net.Ipv4Address;
};
/// The IPv4 multicast routing controller.
///
/// Closing the client-end of the controller will disable multicast routing and
/// clear the multicast routing table.
@discoverable
closed protocol Ipv4RoutingTableController {
/// Adds a route such that packets matching the addresses will be forwarded
/// accordingly.
///
/// If a packet arrives at an interface different from the expected input
/// interface set in the route, the packet will not be forwarded and a
/// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
/// See [`WatchRoutingEvents`] for more details.
///
/// + request `addresses` the addresses used to identify a route.
/// + request `route` the multicast route.
strict AddRoute(struct {
addresses Ipv4UnicastSourceAndMulticastDestination;
route Route;
}) -> () error strict enum {
/// Indicates that the address is invalid (not a unicast source address
/// or not a multicast destination address).
INVALID_ADDRESS = 1;
/// Indicates that the route is missing fields that are required.
REQUIRED_ROUTE_FIELDS_MISSING = 2;
/// Indicates that an interface was not found.
INTERFACE_NOT_FOUND = 3;
/// Indicates that the route's set of output interfaces contains the
/// input interface.
INPUT_CANNOT_BE_OUTPUT = 4;
};
/// Delete a route.
///
/// + request `addresses` the addresses used to identify a route.
strict DelRoute(struct {
addresses Ipv4UnicastSourceAndMulticastDestination;
}) -> () error strict enum {
/// Indicates that the address is invalid (not a unicast source address
/// or not a multicast destination address).
INVALID_ADDRESS = 1;
/// Indicates that the route was not found.
NOT_FOUND = 2;
};
/// Get a snapshot of statistics about a specific route.
///
/// + request `addresses` the addresses used to identify a route.
strict GetRouteStats(struct {
addresses Ipv4UnicastSourceAndMulticastDestination;
}) -> (struct {
stats RouteStats;
}) error strict enum {
/// Indicates that the address is invalid (not a unicast source address
/// or not a multicast destination address).
INVALID_ADDRESS = 1;
/// Indicates that the route was not found.
NOT_FOUND = 2;
};
/// Watch for events triggered by multicast packets.
///
/// The server will queue events to return when this method is called. If no
/// events are ready, the call will block until an event is ready. The
/// server will drop new events if the client is not consuming them fast
/// enough and return the number of events dropped in-between events.
///
/// It is invalid to call this method while a previous call is pending.
/// Doing so will cause the server end of the protocol to be closed.
///
/// - response `dropped_events` the number of events that were dropped
/// _immediately before_ the returned event was queued.
/// returned event.
/// - response `addresses` the addresses in the multicast packet triggering
/// the event.
/// - response `input_interface` the interface the multicast packet
/// triggering the event arrived at.
/// - response `event` the event.
strict WatchRoutingEvents() -> (struct {
dropped_events uint64;
addresses Ipv4UnicastSourceAndMulticastDestination;
input_interface fuchsia.net.InterfaceId;
event RoutingEvent;
});
/// Terminal event. Immediately precedes the closure of the server end of
/// the protocol.
///
/// - response `error` the removal reason.
strict -> OnClose(struct {
error TableControllerCloseReason;
});
};