Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
30
lib/openflow/nx_packet_in_format.ex
Normal file
30
lib/openflow/nx_packet_in_format.ex
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
defmodule Openflow.NxSetPacketInFormat do
|
||||
defstruct(
|
||||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: "",
|
||||
aux_id: 0,
|
||||
format: :standard
|
||||
)
|
||||
|
||||
@experimenter 0x00002320
|
||||
@nx_type 16
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
def ofp_type, do: 4
|
||||
|
||||
def new(format \\ :standard) do
|
||||
%NxSetPacketInFormat{format: format}
|
||||
end
|
||||
|
||||
def read(<<@experimenter::32, @nx_type::32, format_int::32>>) do
|
||||
format = Openflow.Enums.to_atom(format_int, :packet_in_format)
|
||||
%NxSetPacketInFormat{format: format}
|
||||
end
|
||||
|
||||
def to_binary(%NxSetPacketInFormat{format: format}) do
|
||||
format_int = Openflow.Enums.to_int(format, :packet_in_format)
|
||||
<<@experimenter::32, @nx_type::32, format_int::32>>
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue