Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
22
lib/openflow/meter_band/drop.ex
Normal file
22
lib/openflow/meter_band/drop.ex
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
defmodule Openflow.MeterBand.Drop do
|
||||
defstruct(
|
||||
rate: 0,
|
||||
burst_size: 0
|
||||
)
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
def new(options) do
|
||||
rate = Keyword.get(options, :rate, 0)
|
||||
burst_size = Keyword.get(options, :burst_size, 0)
|
||||
%Drop{rate: rate, burst_size: burst_size}
|
||||
end
|
||||
|
||||
def read(<<1::16, 16::16, rate::32, burst_size::32, _::size(4)-unit(8)>>) do
|
||||
%Drop{rate: rate, burst_size: burst_size}
|
||||
end
|
||||
|
||||
def to_binary(%Drop{rate: rate, burst_size: burst_size}) do
|
||||
<<1::16, 16::16, rate::32, burst_size::32, 0::size(4)-unit(8)>>
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue