vintage_net v0.2.1 VintageNet.Interface
Manage a network interface at a very high level
This module handles configuring network interfaces, making sure that configuration failures get retried, and then cleaning up after it's not needed.
The actual code that supplies the configuration implements the VintageNet.Technology
behaviour.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Configure an interface the low level way with a "raw_config"
Set a configuration on an interface
Return the current configuration
Run an I/O command on the specified interface
Start up an interface
Stop the interface
Convert a configuration to a raw one
Unconfigure the interface
Wait for the interface to be configured
Link to this section Functions
callback_mode()
child_spec(arg)
Returns a specification to start this module under a supervisor.
See Supervisor
in Elixir v1.6+.
configure(raw_config)
configure(VintageNet.Interface.RawConfig.t()) :: :ok
configure(VintageNet.Interface.RawConfig.t()) :: :ok
Configure an interface the low level way with a "raw_config"
configure(ifname, config)
configure(VintageNet.ifname(), map()) :: :ok | {:error, any()}
configure(VintageNet.ifname(), map()) :: :ok | {:error, any()}
Set a configuration on an interface
get_configuration(ifname)
get_configuration(VintageNet.ifname()) :: map()
get_configuration(VintageNet.ifname()) :: map()
Return the current configuration
ioctl(ifname, command, args)
ioctl(VintageNet.ifname(), atom(), any()) ::
:ok | {:ok, any()} | {:error, any()}
ioctl(VintageNet.ifname(), atom(), any()) :: :ok | {:ok, any()} | {:error, any()}
Run an I/O command on the specified interface
start_link(ifname)
start_link(VintageNet.ifname()) :: GenServer.on_start()
start_link(VintageNet.ifname()) :: GenServer.on_start()
Start up an interface
Parameters:
ifname
- which interface
stop(ifname)
Stop the interface
Note that this doesn't unconfigure it.
to_raw_config(ifname, config)
to_raw_config(VintageNet.ifname(), map()) ::
{:ok, VintageNet.Interface.RawConfig.t()} | {:error, any()}
to_raw_config(VintageNet.ifname(), map()) :: {:ok, VintageNet.Interface.RawConfig.t()} | {:error, any()}
Convert a configuration to a raw one
This can be used to validate a configuration without applying it.
unconfigure(ifname)
unconfigure(VintageNet.ifname()) :: :ok
unconfigure(VintageNet.ifname()) :: :ok
Unconfigure the interface
This doesn't exit this GenServer, but the interface won't be usable in any real way until it's configured again.
This function is not normally called.
wait_until_configured(ifname)
wait_until_configured(VintageNet.ifname()) :: :ok
wait_until_configured(VintageNet.ifname()) :: :ok
Wait for the interface to be configured