pub trait ServerDispatcher {
// Required methods
fn try_validate_parameters(&self) -> Result<&ServerParameters, Status>;
fn dispatch_get_option(&self, code: OptionCode) -> Result<Option_, Status>;
fn dispatch_get_parameter(
&self,
name: ParameterName,
) -> Result<Parameter, Status>;
fn dispatch_set_option(&mut self, value: Option_) -> Result<(), Status>;
fn dispatch_set_parameter(&mut self, value: Parameter) -> Result<(), Status>;
fn dispatch_list_options(&self) -> Result<Vec<Option_>, Status>;
fn dispatch_list_parameters(&self) -> Result<Vec<Parameter>, Status>;
fn dispatch_reset_options(&mut self) -> Result<(), Status>;
fn dispatch_reset_parameters(
&mut self,
defaults: &ServerParameters,
) -> Result<(), Status>;
fn dispatch_clear_leases(&mut self) -> Result<(), Status>;
}
Expand description
The ability to dispatch fuchsia.net.dhcp.Server protocol requests and return a value.
Implementers of this trait can be used as the backing server-side logic of the fuchsia.net.dhcp.Server protocol. Implementers must maintain a store of DHCP Options, DHCP server parameters, and leases issued to clients, and support the trait methods to retrieve and modify these stores.
Required Methods§
Sourcefn try_validate_parameters(&self) -> Result<&ServerParameters, Status>
fn try_validate_parameters(&self) -> Result<&ServerParameters, Status>
Validates the current set of server parameters returning a reference to the parameters if the configuration is valid or an error otherwise.
Sourcefn dispatch_get_option(&self, code: OptionCode) -> Result<Option_, Status>
fn dispatch_get_option(&self, code: OptionCode) -> Result<Option_, Status>
Retrieves the stored DHCP option value that corresponds to the OptionCode argument.
Sourcefn dispatch_get_parameter(
&self,
name: ParameterName,
) -> Result<Parameter, Status>
fn dispatch_get_parameter( &self, name: ParameterName, ) -> Result<Parameter, Status>
Retrieves the stored DHCP server parameter value that corresponds to the ParameterName argument.
Sourcefn dispatch_set_option(&mut self, value: Option_) -> Result<(), Status>
fn dispatch_set_option(&mut self, value: Option_) -> Result<(), Status>
Updates the stored DHCP option value to the argument.
Sourcefn dispatch_set_parameter(&mut self, value: Parameter) -> Result<(), Status>
fn dispatch_set_parameter(&mut self, value: Parameter) -> Result<(), Status>
Updates the stored DHCP server parameter to the argument.
Sourcefn dispatch_list_options(&self) -> Result<Vec<Option_>, Status>
fn dispatch_list_options(&self) -> Result<Vec<Option_>, Status>
Retrieves all of the stored DHCP option values.
Sourcefn dispatch_list_parameters(&self) -> Result<Vec<Parameter>, Status>
fn dispatch_list_parameters(&self) -> Result<Vec<Parameter>, Status>
Retrieves all of the stored DHCP parameter values.
Sourcefn dispatch_reset_options(&mut self) -> Result<(), Status>
fn dispatch_reset_options(&mut self) -> Result<(), Status>
Resets all DHCP options to have no value.
Sourcefn dispatch_reset_parameters(
&mut self,
defaults: &ServerParameters,
) -> Result<(), Status>
fn dispatch_reset_parameters( &mut self, defaults: &ServerParameters, ) -> Result<(), Status>
Resets all DHCP server parameters to their default values in defaults
.
Sourcefn dispatch_clear_leases(&mut self) -> Result<(), Status>
fn dispatch_clear_leases(&mut self) -> Result<(), Status>
Clears all leases from the store maintained by the ServerDispatcher.