Linx.Netlink.Rtnl.LinkInfo (Linx v0.1.0)

Copy Markdown View Source

IFLA_LINKINFO — a link's kind and kind-specific data.

A bare attribute set carrying IFLA_INFO_KIND (the kind string — "macvlan", "veth", "bridge", …) and IFLA_INFO_DATA (the kind- specific payload, decoded by the matching sub-module).

The :info_data field is dispatched on the :kind value — the codec DSL chooses the right sub-codec module at encode and decode time, so %LinkInfo{kind: "macvlan", info_data: %LinkInfo.Macvlan{mode: 4}} is the natural shape on both sides of the wire.

Kinds without per-kind data ("bridge", "dummy") simply leave :info_data nil — the DSL's nil-omission rule keeps the attribute off the wire.

Summary

Functions

Decodes a netlink message body into a t/0.

Encodes a t/0 into its netlink message body.

Types

t()

@type t() :: %Linx.Netlink.Rtnl.LinkInfo{info_data: term(), kind: term()}

Functions

decode(body)

@spec decode(binary()) :: t()

Decodes a netlink message body into a t/0.

encode(message)

@spec encode(t()) :: binary()

Encodes a t/0 into its netlink message body.