Class Rethtool::InterfaceSettings
In: lib/rethtool/interface_settings.rb
Parent: Object

All of the settings of a network interface. Ridiculous amounts of info is available; we only support a subset of them at present.

Create an instance of this class with the interface name as the only parameter, then use the available instance methods to get the info you seek:

   if = Rethtool::InterfaceSettings.new("eth0")
   puts "Current link mode is #{if.current_mode}"

Methods

Classes and Modules

Class Rethtool::InterfaceSettings::Mode

Constants

Mode = Struct.new(:speed, :duplex, :media)
PossibleModes = { 1 << 0 => Mode.new(10, :half, 'T'), 1 << 1 => Mode.new(10, :full, 'T'), 1 << 2 => Mode.new(100, :half, 'T'), 1 << 3 => Mode.new(100, :full, 'T'), 1 << 4 => Mode.new(1000, :half, 'T'), 1 << 5 => Mode.new(1000, :full, 'T'), 1 << 12 => Mode.new(10000, :full, 'T'), 1 << 15 => Mode.new(2500, :full, 'X'), 1 << 17 => Mode.new(1000, :full, 'KX'), 1 << 18 => Mode.new(10000, :full, 'KX4'), 1 << 19 => Mode.new(10000, :full, 'KR'), 1 << 20 => Mode.new(10000, :fec, 'R')

Public Class methods

Create a new InterfaceSettings object. Simply pass it the name of the interface you want to get the settings for.

Public Instance methods

Return an array of the modes advertised by the interface. Returns an array of Mode objects. If you know the difference between ‘supported’ and ‘advertised’, you‘re one up on me.

Return the "best" possible mode supported by this interface. This is the highest speed mode with the "best" duplex (fec > full > half).

Return a Mode object representing the current detected mode of the interface.

Return an array of the modes supported by the interface. Returns an array of Mode objects.

[Validate]