View Source VintageNet.Interface (vintage_net v0.13.3)

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.

Set a configuration on an interface

Deconfigure the interface

Run an I/O command on the specified interface

Start up an interface

Stop the interface

Convert a configuration to a raw one

Wait for the interface to be configured

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

configure(ifname, config, options \\ [])

View Source
@spec configure(VintageNet.ifname(), map(), VintageNet.configure_options()) ::
  :ok | {:error, any()}

Set a configuration on an interface

Configurations with invalid parameters raise exceptions. It's still possible that network configurations won't work even if they don't raise, but it should be due to something in the environment. For example, a network cable isn't plugged in or a WiFi access point is out of range.

Link to this function

deconfigure(ifname, options \\ [])

View Source
@spec deconfigure(VintageNet.ifname(), VintageNet.configure_options()) ::
  :ok | {:error, any()}

Deconfigure 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.

Link to this function

ioctl(ifname, command, args)

View Source
@spec ioctl(VintageNet.ifname(), atom(), any()) ::
  :ok | {:ok, any()} | {:error, any()}

Run an I/O command on the specified interface

@spec start_link(VintageNet.ifname()) :: GenServer.on_start()

Start up an interface

Parameters:

  • ifname - which interface
@spec stop(VintageNet.ifname()) :: :ok

Stop the interface

Note that this doesn't deconfigure it.

Link to this function

to_raw_config(ifname, config)

View Source
@spec 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.

Link to this function

wait_until_configured(ifname)

View Source
@spec wait_until_configured(VintageNet.ifname()) :: :ok

Wait for the interface to be configured