add documents
This commit is contained in:
parent
eda1fc5727
commit
4dddd1f5fe
14 changed files with 377 additions and 27 deletions
|
|
@ -1,18 +1,38 @@
|
|||
defmodule Openflow.Action.SetNwTtl do
|
||||
@moduledoc """
|
||||
Set IP TTL
|
||||
"""
|
||||
|
||||
defstruct(ttl: 0)
|
||||
|
||||
alias __MODULE__
|
||||
|
||||
@type t :: %SetNwTtl{ttl: 0..0xFF}
|
||||
|
||||
@spec ofpat() :: 23
|
||||
def ofpat, do: 23
|
||||
|
||||
@doc """
|
||||
Create a new set_nw_ttl action struct
|
||||
|
||||
## Options:
|
||||
- IP TTL
|
||||
|
||||
```elixir
|
||||
iex> %SetNwTtl{ttl: 64} = SetNwTtl.new(_ttl = 64)
|
||||
```
|
||||
"""
|
||||
@spec new(ttl :: 0..0xFF) :: t()
|
||||
def new(ttl) do
|
||||
%SetNwTtl{ttl: ttl}
|
||||
end
|
||||
|
||||
@spec to_binary(t()) :: <<_::16, _::_*8>>
|
||||
def to_binary(%SetNwTtl{ttl: ttl}) do
|
||||
<<23::16, 8::16, ttl::8, 0::size(3)-unit(8)>>
|
||||
end
|
||||
|
||||
@spec read(<<_::16, _::_*8>>) :: t()
|
||||
def read(<<23::16, 8::16, ttl::8, _::size(3)-unit(8)>>) do
|
||||
%SetNwTtl{ttl: ttl}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue