| // 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] |
| protocol Filter { |
| /// Enable enables the filter if true is passed. |
| /// It disables the filter if false is passed. |
| Enable(bool enabled) -> (Status status); |
| |
| /// IsEnabled returns true if the filter is enabled. |
| 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. |
| 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. |
| 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. |
| /// |
| 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. |
| 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. |
| 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. |
| UpdateRDRRules(vector<RDR> rules, uint32 generation) -> (Status status); |
| }; |