Linux Layer 2 Ethernet (AF_PACKET / SOCK_RAW) transport for GOOSE (0x88B8) and Sampled Values (0x88BA).
Uses Erlang/OTP's :socket module (no C NIF required).
Summary
Functions
Closes the raw Ethernet socket.
Decodes an Ethernet frame (with or without 802.1Q VLAN tag).
Encodes an IEEE 802.3 / 802.1Q Ethernet frame for GOOSE or SV.
Reads the Linux interface index from /sys/class/net/<interface>/ifindex.
Reads the 6-byte MAC address from /sys/class/net/<interface>/address.
Opens a Linux AF_PACKET raw socket bound to interface_name (requires CAP_NET_RAW / root).
Sends a raw Ethernet frame on an open :socket.socket().
Functions
@spec close_socket(:socket.socket()) :: :ok
Closes the raw Ethernet socket.
Decodes an Ethernet frame (with or without 802.1Q VLAN tag).
Encodes an IEEE 802.3 / 802.1Q Ethernet frame for GOOSE or SV.
@spec get_interface_index(String.t()) :: {:ok, non_neg_integer()} | {:error, term()}
Reads the Linux interface index from /sys/class/net/<interface>/ifindex.
Reads the 6-byte MAC address from /sys/class/net/<interface>/address.
@spec open_socket(String.t(), non_neg_integer()) :: {:ok, :socket.socket()} | {:error, term()}
Opens a Linux AF_PACKET raw socket bound to interface_name (requires CAP_NET_RAW / root).
@spec send_frame(:socket.socket(), binary()) :: :ok | {:error, term()}
Sends a raw Ethernet frame on an open :socket.socket().