blob: 280e5deaefcad10abd7147a55e31878de459b903 [file] [log] [blame]
// Copyright 2018 The Chromium 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.filter;
enum Status {
ok = 0;
err_internal = 1;
err_generation_mismatch = 2;
err_bad_rule = 3;
};
[Discoverable]
interface Filter {
/// Enable enables the filter if true is passed.
/// It disables the filter if false is passed.
1: Enable(bool enabled) -> (Status status);
/// IsEnabled returns true if the filter is enabled.
2: IsEnabled() -> (bool enabled);
/// GetRules gets the current rules. They do not include NAT or RDR rules.
/// (use GetNATRules or GetRDRRules instead).
///
/// GetRules also returns a generation number associated with the current
/// rules.
3: GetRules() -> (vector<Rule> rules, uint32 generation, Status status);
/// UpdateRules updates the current rules. It does not update NAT or RDR rules
/// (use UpdateNATRules or UpdateRDRRules instead).
///
/// UpdateRules takes a generation number that is previously returned from
/// GetRules. To successfully update the current rules, the generation number
/// passed to UpdateRules needs to be up-to-date.
///
/// If somebody else has updated the rules since the previous GetRules, the
/// generation number won't match and err_generation_mismatch will be returned.
4: UpdateRules(vector<Rule> rules, uint32 generation) -> (Status status);
/// GetNATRules gets the current NAT rules.
///
/// It also returns a generation number that can be passed to UpdateNATRules.
///
5: GetNATRules() -> (vector<NAT> rules, uint32 generation, Status status);
/// UpdateNATRules updates the current NAT rules.
///
/// It takes a generation number that is returned from GetNATRules. To
/// successfully update the current rules, the generation number passed to
/// UpdateNATRules needs to be up-to-date.
6: UpdateNATRules(vector<NAT> rules, uint32 generation) -> (Status status);
/// GetRDRRules gets the current RDR rules.
///
/// It also returns a generation number that can be passed to UpdateRDRRules.
7: GetRDRRules() -> (vector<RDR> rules, uint32 generation, Status status);
/// UpdateRDRRules updates the previous RDR rules with new rules.
///
/// It takes a generation number that is returned from GetRDRRules. To
/// successfully update the current rules, the generation number passed to
/// UpdateRDRRules needs to be up-to-date.
8: UpdateRDRRules(vector<RDR> rules, uint32 generation) -> (Status status);
};