Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
26
lib/openflow/get_config/reply.ex
Normal file
26
lib/openflow/get_config/reply.ex
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
defmodule Openflow.GetConfig.Reply do
|
||||
defstruct(
|
||||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: "",
|
||||
aux_id: 0,
|
||||
flags: [], # default = "normal" is no special handling
|
||||
miss_send_len: 128
|
||||
)
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
def ofp_type, do: 8
|
||||
|
||||
def read(<<flags_int::16, miss_send_len0::16>>) do
|
||||
flags = Openflow.Enums.int_to_flags(flags_int, :config_flags)
|
||||
miss_send_len = Openflow.Utils.get_enum(miss_send_len0, :controller_max_len)
|
||||
%Reply{flags: flags, miss_send_len: miss_send_len}
|
||||
end
|
||||
|
||||
def to_binary(%Reply{flags: flags, miss_send_len: miss_send_len0}) do
|
||||
flags_int = Openflow.Enums.flags_to_int(flags, :config_flags)
|
||||
miss_send_len = Openflow.Utils.get_enum(miss_send_len0, :controller_max_len)
|
||||
<<flags_int::16, miss_send_len::16>>
|
||||
end
|
||||
end
|
||||
24
lib/openflow/get_config/request.ex
Normal file
24
lib/openflow/get_config/request.ex
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
defmodule Openflow.GetConfig.Request do
|
||||
defstruct(
|
||||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: nil, # virtual field
|
||||
aux_id: 0 # virtual field
|
||||
)
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
def ofp_type, do: 7
|
||||
|
||||
def new do
|
||||
%Request{}
|
||||
end
|
||||
|
||||
def read(_) do
|
||||
%Request{}
|
||||
end
|
||||
|
||||
def to_binary(%Request{}) do
|
||||
<<>>
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue