Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
19
lib/openflow/actions/push_vlan.ex
Normal file
19
lib/openflow/actions/push_vlan.ex
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
defmodule Openflow.Action.PushVlan do
|
||||
defstruct(ethertype: 0x8100)
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
def ofpat, do: 17
|
||||
|
||||
def new(ethertype) 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue