Kuroneko.Gadget.NCM (kuroneko_gadget v0.5.0)

Copy Markdown View Source

The kernel's NCM function: a USB network adapter the target computer sees, with a network interface on the device.

An instance has two MAC addresses: the device's, of its interface, and the target's, of the adapter the target sees. They are made from the gadget's serial number and the instance's name, so they stay the same across boots. The :network of Kuroneko.Gadget is an instance named "usb0", whose addresses Kuroneko.Gadget.network/1 tells and Kuroneko.Gadget.set_network_addresses/2 changes.

It takes no options.

Summary

Types

A MAC address, such as "02:12:34:56:78:9a".

Functions

The addresses of an instance: the one :name names, "usb0" by default. Takes the :gadget option.

The device's network interface of an instance, such as "usb0", nil before the gadget first connects. Takes :name and :gadget.

Types

address()

@type address() :: String.t()

A MAC address, such as "02:12:34:56:78:9a".

addresses()

@type addresses() :: %{device_address: address(), host_address: address()}

Functions

addresses(opts \\ [])

@spec addresses(keyword()) ::
  {:ok, addresses()} | {:error, Kuroneko.Gadget.configfs_error()}

The addresses of an instance: the one :name names, "usb0" by default. Takes the :gadget option.

interface(opts \\ [])

@spec interface(keyword()) :: String.t() | nil

The device's network interface of an instance, such as "usb0", nil before the gadget first connects. Takes :name and :gadget.