Implement Openflow Protocol and Callback system
This commit is contained in:
parent
fc02a678de
commit
e52fe31b79
48 changed files with 937 additions and 244 deletions
|
|
@ -3,6 +3,7 @@ defmodule Openflow.Multipart.PortStats.Reply do
|
|||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: nil, # virtual field
|
||||
aux_id: nil,
|
||||
flags: [],
|
||||
ports: []
|
||||
)
|
||||
|
|
@ -19,6 +20,16 @@ defmodule Openflow.Multipart.PortStats.Reply do
|
|||
ports = Openflow.Multipart.PortStats.read(ports_bin)
|
||||
%Reply{ports: ports}
|
||||
end
|
||||
|
||||
def append_body(%Reply{ports: ports} = message, %Reply{flags: [:more], ports: continue}) do
|
||||
%{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}
|
||||
end
|
||||
end
|
||||
|
||||
defmodule Openflow.Multipart.PortStats do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue