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§

source

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.

source

fn dispatch_get_option(&self, code: OptionCode) -> Result<Option_, Status>

Retrieves the stored DHCP option value that corresponds to the OptionCode argument.

source

fn dispatch_get_parameter( &self, name: ParameterName ) -> Result<Parameter, Status>

Retrieves the stored DHCP server parameter value that corresponds to the ParameterName argument.

source

fn dispatch_set_option(&mut self, value: Option_) -> Result<(), Status>

Updates the stored DHCP option value to the argument.

source

fn dispatch_set_parameter(&mut self, value: Parameter) -> Result<(), Status>

Updates the stored DHCP server parameter to the argument.

source

fn dispatch_list_options(&self) -> Result<Vec<Option_>, Status>

Retrieves all of the stored DHCP option values.

source

fn dispatch_list_parameters(&self) -> Result<Vec<Parameter>, Status>

Retrieves all of the stored DHCP parameter values.

source

fn dispatch_reset_options(&mut self) -> Result<(), Status>

Resets all DHCP options to have no value.

source

fn dispatch_reset_parameters( &mut self, defaults: &ServerParameters ) -> Result<(), Status>

Resets all DHCP server parameters to their default values in defaults.

source

fn dispatch_clear_leases(&mut self) -> Result<(), Status>

Clears all leases from the store maintained by the ServerDispatcher.

Implementors§