## MbimTlv MbimTlv — A variable-sized data structure specified in Microsoft MBIM extension v3.0. |

## Functions

MbimTlv * | mbim_tlv_new ()
MbimTlv * | mbim_tlv_dup ()
MbimTlv * | mbim_tlv_ref ()
void | mbim_tlv_unref ()
const guint8 * | mbim_tlv_get_raw ()
MbimTlvType | mbim_tlv_get_tlv_type ()
const guint8 * | mbim_tlv_get_tlv_data ()
const gchar * | mbim_tlv_type_get_string ()
MbimTlv * | mbim_tlv_string_new ()
gchar * | mbim_tlv_string_get ()
gboolean | mbim_tlv_guint16_array_get ()
gboolean | mbim_tlv_wake_command_get ()
gboolean | mbim_tlv_wake_packet_get ()

## Types and Values

| MbimTlv
enum | MbimTlvType

## Object Hierarchy

        GBoxed
        ╰── MbimTlv
        GEnum
        ╰── MbimTlvType

## Description

The MbimTlv structure is capable of exchanging a wide range of information between an MBIM host and an MBIM device.

CID payloads for requests, responses, and/or notifications may contain zero or more unnamed and optional Information Elements (IE) encoded as MbimTlv fields.

## Functions

### mbim_tlv_new ()

    MbimTlv *
    mbim_tlv_new (MbimTlvType type,
                  const guint8 *data,
                  guint32 data_length);

Create a MbimTlv with the given contents.

#### Parameters

type | a MbimTlvType. |
data | contents of the TLV. |
data_length | length of the message. |

#### Returns

a newly created MbimTlv, which should be freed with `mbim_tlv_unref()`.

[transfer full]

Since: 1.28

### mbim_tlv_dup ()

    MbimTlv *
    mbim_tlv_dup (const MbimTlv *self);

Create a MbimTlv with the same contents as `self` .

#### Parameters

self | a MbimTlv to duplicate. |

#### Returns

a newly created MbimTlv, which should be freed with `mbim_tlv_unref()`.

[transfer full]

Since: 1.28

### mbim_tlv_ref ()

    MbimTlv *
    mbim_tlv_ref (MbimTlv *self);

Atomically increments the reference count of `self` by one.

#### Parameters

self | a MbimTlv. |

#### Returns

the new reference to `self` .

[transfer full]

Since: 1.28

### mbim_tlv_unref ()

    void
    mbim_tlv_unref (MbimTlv *self);

Atomically decrements the reference count of `self` by one. If the reference count drops to 0, `self` is completely disposed.

#### Parameters

self | a MbimTlv. |

Since: 1.28

### mbim_tlv_get_raw ()

    const guint8 *
    mbim_tlv_get_raw (const MbimTlv *self,
                      guint32 *length,
                      GError **error);

Gets the whole raw data buffer of the MbimTlv.

#### Parameters

self | a MbimTlv. |
length | return location for the size of the output buffer. | [out]
error | return location for error or `NULL`. |

#### Returns

The raw data buffer, or NULL if `error` is set.

Since: 1.28

### mbim_tlv_get_tlv_type ()

    MbimTlvType
    mbim_tlv_get_tlv_type (const MbimTlv *self);

Gets the message type.

#### Parameters

self | a MbimTlv. |

#### Returns

a MbimTlvType.

Since: 1.28

### mbim_tlv_get_tlv_data ()

    const guint8 *
    mbim_tlv_get_tlv_data (const MbimTlv *self,
                           guint32 *out_length);

Gets the TLV raw data.

#### Parameters

self | a MbimTlv. |
out_length | return location for the size of the output buffer. | [out]

#### Returns

The raw data buffer, or NULL if empty.

[transfer none]

Since: 1.28

### mbim_tlv_type_get_string ()

    const gchar *
    mbim_tlv_type_get_string (MbimTlvType val);

Gets the nickname string for the MbimTlvType specified at `val` .

#### Parameters

val | a MbimTlvType. |

#### Returns

a string with the nickname, or `NULL` if not found. Do not free the returned value.

[transfer none]

Since: 1.28

### mbim_tlv_string_new ()

    MbimTlv *
    mbim_tlv_string_new (const gchar *str,
                         GError **error);

Create a MbimTlv of type `MBIM_TLV_TYPE_WCHAR_STR` with the given contents.

#### Parameters

str | a string. |
error | return location for error or `NULL`. |

#### Returns

a newly created MbimTlv which should be freed with `mbim_tlv_unref()`, or `NULL` if `error` is set.

[transfer full]

Since: 1.28

### mbim_tlv_string_get ()

    gchar *
    mbim_tlv_string_get (const MbimTlv *self,
                         GError **error);

Get a string with the contents in the MbimTlv.

#### Parameters

self | a MbimTlv of type `MBIM_TLV_TYPE_WCHAR_STR`. |
error | return location for error or `NULL`. |

#### Returns

a newly created string, which should be freed with `g_free()`, or `NULL` if `error` is set.

[transfer full]

Since: 1.28

### mbim_tlv_guint16_array_get ()

    gboolean
    mbim_tlv_guint16_array_get (const MbimTlv *self,
                                guint32 *array_size,
                                guint16 **array,
                                GError **error);

Get an array of guint16 values with the contents in the MbimTlv.

The method may return a successful return even with on empty arrays (i.e. with `array_size` set to 0 and `array` set to `NULL`).

#### Parameters

self | a MbimTlv of type `MBIM_TLV_TYPE_UINT16_TBL`. |
array_size | return location for a guint32, or `NULL` if the field is not needed. | [out][optional][transfer none]
array | return location for a newly allocated array of guint16 values, or `NULL` if the field is not needed. Free the returned value with `g_free()`. | [out][optional][transfer full][type guint16]
error | return location for error or `NULL`. |

#### Returns

`TRUE` if on success, `FALSE` if `error` is set.

Since: 1.28

### mbim_tlv_wake_command_get ()

    gboolean
    mbim_tlv_wake_command_get (const MbimTlv *self,
                               const MbimUuid **service,
                               guint32 *cid,
                               guint32 *payload_size,
                               guint8 **payload,
                               GError **error);

Get the contents of a wake command TLV.

The method may return a successful return even with on empty payload (i.e. with `payload_size` set to 0 and `payload` set to `NULL`).

#### Parameters

self | a MbimTlv of type `MBIM_TLV_TYPE_WAKE_COMMAND`. |
service | return location for a MbimUuid specifying the service that triggered the wake. | [out][optional][transfer none]
cid | return location for the command id that triggered the wake. | [out][optional][transfer none]
payload_size | return location for a guint32, or `NULL` if the field is not needed. | [out][optional][transfer none]
payload | return location for a newly allocated array of guint8 values, or `NULL` if the field is not needed. Free the returned value with `g_free()`. | [out][optional][transfer full][type guint8]
error | return location for error or `NULL`. |

#### Returns

`TRUE` if on success, `FALSE` if `error` is set.

Since: 1.28

### mbim_tlv_wake_packet_get ()

    gboolean
    mbim_tlv_wake_packet_get (const MbimTlv *self,
                              guint32 *filter_id,
                              guint32 *original_packet_size,
                              guint32 *packet_size,
                              guint8 **packet,
                              GError **error);

Get the contents of a wake packet TLV.

#### Parameters

self | a MbimTlv of type `MBIM_TLV_TYPE_WAKE_PACKET`. |
filter_id | return location for a guint32 specifying the filter id. | [out][optional][transfer none]
original_packet_size | return location for a guint32, or `NULL` if the field is not needed. | [out][optional][transfer none]
packet_size | return location for a guint32, or `NULL` if the field is not needed. | [out][optional][transfer none]
packet | return location for a newly allocated array of guint8 values, or `NULL` if the field is not needed. Free the returned value with `g_free()`. | [out][optional][transfer full][type guint8]
error | return location for error or `NULL`. |

#### Returns

`TRUE` if on success, `FALSE` if `error` is set.

Since: 1.28

## Types and Values

### MbimTlv

    typedef struct {
    } MbimTlv;

An opaque type representing a MBIM TLV.

Since: 1.28

### enum MbimTlvType

Type of the MBIM TLV.

#### Members

MBIM_TLV_TYPE_INVALID | Invalid TLV type. |
MBIM_TLV_TYPE_UE_POLICITES | UE policies. |
MBIM_TLV_TYPE_SINGLE_NSSAI | Single NSSAI. |
MBIM_TLV_TYPE_ALLOWED_NSSAI | Allowed NSSAI. |
MBIM_TLV_TYPE_CFG_NSSAI | Configured NSSAI. |
MBIM_TLV_TYPE_DFLT_CFG_NSSAI | Default configured NSSAI. |
MBIM_TLV_TYPE_PRECFG_DFLT_CFG_NSSAI | Preconfigured default configured NSSAI. |
MBIM_TLV_TYPE_REJ_NSSAI | Rejected NSSAI. |
MBIM_TLV_TYPE_LADN | Local Area Data Network (LADN). |
MBIM_TLV_TYPE_TAI | Tracking Area Identity (TAI). |
MBIM_TLV_TYPE_WCHAR_STR | WCHAR string. |
MBIM_TLV_TYPE_UINT16_TBL | Array of 1 or more `guint16` entries. |
MBIM_TLV_TYPE_EAP_PACKET | Extensible Authentication Protocol packet. |
MBIM_TLV_TYPE_PCO | Protocol Configuration Option (PCO). |
MBIM_TLV_TYPE_ROUTE_SELECTION_DESCRIPTORS | One or more route selection descriptors. |
MBIM_TLV_TYPE_TRAFFIC_PARAMETERS | A traffic parameters record. |
MBIM_TLV_TYPE_WAKE_COMMAND | Wake command. |
MBIM_TLV_TYPE_WAKE_PACKET | Wake packet. |

Since: 1.28