tres/lib/openflow/actions/push_vlan.ex
2017-11-20 20:43:32 +09:00

19 lines
418 B
Elixir

defmodule Openflow.Action.PushVlan do
defstruct(ethertype: 0x8100)
alias __MODULE__
def ofpat, do: 17
def new(ethertype \\ 0x8100) do
%PushVlan{ethertype: ethertype}
end
def to_binary(%PushVlan{ethertype: ethertype}) do
<<17::16, 8::16, ethertype::16, 0::size(2)-unit(8)>>
end
def read(<<17::16, 8::16, ethertype::16, 0::size(2)-unit(8)>>) do
%PushVlan{ethertype: ethertype}
end
end