#[derive(Default, Debug, Clone, Eq, PartialEq)]
#[derive(Deserialize, Serialize)]
#[serde(default, deny_unknown_fields)]
pub struct GlobalNetworkConfiguration
{
pub queuing_discipline_algorithm: Option<QueuingDisciplineAlgorithm>,
pub receive_packet_steering: Option<GlobalReceivePacketSteeringAndReceiveFlowSteeringConfiguration>,
pub all_network_devices_configuration: Option<GlobalAllNetworkDevicesConfiguration>,
pub network_devices_configuration: HashMap<NetworkInterfaceName, GlobalNetworkDeviceConfiguration>,
pub socket_configuration: Option<GlobalSocketConfiguration>,
pub tcp_network_configuration: Option<GlobalTransmissionControlProtocolConfiguration>,
pub unix_domain_socket_maximum_datagram_queue_length: Option<MaximumUnixDomainSocketDatagramQueueLength>,
}
impl GlobalNetworkConfiguration
{
pub fn configure(&self, sys_path: &SysPath, proc_path: &ProcPath) -> Result<(), GlobalNetworkConfigurationError>
{
use self::GlobalNetworkConfigurationError::*;
instance_set_value(proc_path, QueuingDisciplineAlgorithm::set_global_default, self.queuing_discipline_algorithm.clone(), CouldNotChangeGlobalDefaultQueuingDisciplineAlgorithm)?;
if let Some(ref receive_packet_steering) = self.receive_packet_steering
{
receive_packet_steering.configure(proc_path)?;
}
if let Some(ref all_network_devices_configuration) = self.all_network_devices_configuration
{
all_network_devices_configuration.configure(proc_path)?;
}
for (network_interface_name, network_device_configuration) in self.network_devices_configuration.iter()
{
network_device_configuration.configure(sys_path, network_interface_name)?;
}
if let Some(ref socket_configuration) = self.socket_configuration
{
socket_configuration.configure(proc_path)?;
}
if let Some(ref tcp_network_configuration) = self.tcp_network_configuration
{
tcp_network_configuration.configure(proc_path)?;
}
instance_set_value(proc_path, MaximumUnixDomainSocketDatagramQueueLength::set_global_default, self.unix_domain_socket_maximum_datagram_queue_length, CouldNotChangeMaximumUnixDomainSocketDatagramQueueLength)?;
Ok(())
}
}