Openflow parser

This commit is contained in:
Eishun Kondoh 2017-11-13 22:52:53 +09:00
parent 70b0d8919e
commit fc02a678de
338 changed files with 9081 additions and 0 deletions

View 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