### Method

# Qmi Device add_link

since: 1.28

#### Declaration [src]

    void
    qmi_device_add_link (
      QmiDevice* self,
      guint mux_id,
      const gchar* base_ifname,
      const gchar* ifname_prefix,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description [src]

Asynchronously creates a new virtual network device node with a custom prefix on top of `base_ifname`. This allows having multiple net interfaces running on top of another using multiplexing.

If the kernel driver doesn’t allow this functionality, a `QMI_CORE_ERROR_UNSUPPORTED` error will be returned.

The operation may fail if the given interface name is not associated to the QMI control port managed by the `QmiDevice`.

Depending on the kernel driver in use and the multiplexing method, the given `ifname_prefix` may be ignored. The user should not assume that the returned link interface name is prefixed with `ifname_prefix` as it may not be the case.

When the operation is finished `callback` will be called. You can then call `qmi_device_add_link_finish()` to get the result of the operation.

<note><para> When using the qmi_wwan kernel driver, the configured expected kernel data format will be used to select the type of multiplexing method. If the format is `QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP` the qmi_wwan specific add_mux/del_mux operations will be used. If the format is `QMI_DEVICE_EXPECTED_DATA_FORMAT_QMAP_PASS_THROUGH`, the generic rmnet netlink operations will be used. No multiplexing support exists when the format is `QMI_DEVICE_EXPECTED_DATA_FORMAT_802_3`. </para><para> For every other kernel driver (e.g. ipa), rmnet netlink operations are assumed to be supported. </para></note>

<note><para> When using the qmi_wwan driver from a kernel older than v5.12, some of the multiplexing features like using `QMI_DEVICE_MUX_ID_AUTOMATIC` may not be fully available for programs that use ephimeral `QmiDevice` objects for single operations. </para></note>.

Available since: 1.28

This method completes asynchronously. Use `qmi_device_add_link_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`mux_id`

  Type: `guint`

  The mux id for the link, in the [`QMI_DEVICE_MUX_ID_MIN`,`QMI_DEVICE_MUX_ID_MAX`] range, or `QMI_DEVICE_MUX_ID_AUTOMATIC` to find the first available mux id.

`base_ifname`

  Type: `const gchar*`

  The interface which the new link will be created on.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`ifname_prefix`

  Type: `const gchar*`

  The prefix suggested to be used for the name of the new link created.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the operation is finished.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  The data to pass to callback function.

  The argument can be `NULL`.
  The data is owned by the caller of the method.