Formatted
This commit is contained in:
parent
5fc01a9bec
commit
7635272fbd
150 changed files with 5055 additions and 4032 deletions
|
|
@ -1,11 +1,12 @@
|
|||
defmodule Openflow.Multipart.PortDesc.Reply do
|
||||
defstruct(
|
||||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: nil, # virtual field
|
||||
aux_id: nil,
|
||||
flags: [],
|
||||
ports: []
|
||||
version: 4,
|
||||
xid: 0,
|
||||
# virtual field
|
||||
datapath_id: nil,
|
||||
aux_id: nil,
|
||||
flags: [],
|
||||
ports: []
|
||||
)
|
||||
|
||||
alias __MODULE__
|
||||
|
|
@ -17,17 +18,20 @@ defmodule Openflow.Multipart.PortDesc.Reply do
|
|||
end
|
||||
|
||||
def read(<<ports_bin::bytes>>) do
|
||||
ports = for (<<port_bin::64-bytes <- ports_bin>>), do: Openflow.Port.read(port_bin)
|
||||
ports = for <<port_bin::64-bytes <- ports_bin>>, do: Openflow.Port.read(port_bin)
|
||||
%Reply{ports: Enum.reverse(ports)}
|
||||
end
|
||||
|
||||
def append_body(%Reply{ports: ports} = message, %Reply{flags: [:more], ports: continue}) do
|
||||
%{message|ports: [continue|ports]}
|
||||
%{message | ports: [continue | ports]}
|
||||
end
|
||||
|
||||
def append_body(%Reply{ports: ports} = message, %Reply{flags: [], ports: continue}) do
|
||||
new_ports = [continue|ports]
|
||||
|> Enum.reverse
|
||||
|> List.flatten
|
||||
%{message|ports: new_ports}
|
||||
new_ports =
|
||||
[continue | ports]
|
||||
|> Enum.reverse()
|
||||
|> List.flatten()
|
||||
|
||||
%{message | ports: new_ports}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
defmodule Openflow.Multipart.PortDesc.Request do
|
||||
defstruct(
|
||||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: nil, # virtual field
|
||||
version: 4,
|
||||
xid: 0,
|
||||
# virtual field
|
||||
datapath_id: nil,
|
||||
flags: []
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue