Fix to accept transaction_id to all message structs

This commit is contained in:
Eishun Kondoh 2018-03-22 23:49:03 +09:00
parent bb74f3d8c4
commit 4803c61061
29 changed files with 118 additions and 34 deletions

View file

@ -12,10 +12,17 @@ defmodule Openflow.Multipart.PortStats.Request do
def ofp_type, do: 18
def new(port_no \\ :any) do
def new(port_no) when is_integer(port_no) or is_atom(port_no) do
%Request{port_number: port_no}
end
def new(options) when is_list(options) do
%Request{
xid: options[:xid] || 0,
port_number: options[:port_no] || :any
}
end
def read(<<port_no_int::32, _::size(4)-unit(8)>>) do
port_no = Openflow.Utils.get_enum(port_no_int, :openflow13_port_no)
%Request{port_number: port_no}