Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
19
lib/openflow/instructions/goto_table.ex
Normal file
19
lib/openflow/instructions/goto_table.ex
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
defmodule Openflow.Instruction.GotoTable do
|
||||
defstruct(table_id: 0)
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
def new(table_id) do
|
||||
%GotoTable{table_id: table_id}
|
||||
end
|
||||
|
||||
def to_binary(%GotoTable{table_id: table_id}) do
|
||||
table_id_int = Openflow.Utils.get_enum(table_id, :table_id)
|
||||
<<1::16, 8::16, table_id_int::8, 0::size(3)-unit(8)>>
|
||||
end
|
||||
|
||||
def read(<<1::16, 8::16, table_id_int::8, _::size(3)-unit(8)>>) do
|
||||
table_id = Openflow.Utils.get_enum(table_id_int, :table_id)
|
||||
%GotoTable{table_id: table_id}
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue