add documents
This commit is contained in:
parent
eda1fc5727
commit
4dddd1f5fe
14 changed files with 377 additions and 27 deletions
|
|
@ -3,12 +3,6 @@ defmodule Openflow.Action.PopMpls do
|
|||
Pop the out MPLS label
|
||||
|
||||
note: The one of ETH__P_MPLS_* is needed to be specified to eth_type field
|
||||
|
||||
send_flow_mod_add(
|
||||
datapath_id,
|
||||
match: Match.new(0x8847),
|
||||
instructions: ApplyActions.new(PopMpls.new())
|
||||
)
|
||||
"""
|
||||
|
||||
defstruct(ethertype: 0x8847)
|
||||
|
|
@ -25,7 +19,11 @@ defmodule Openflow.Action.PopMpls do
|
|||
@doc """
|
||||
Create a new pop_mpls action struct
|
||||
|
||||
0x8847(ETH_P_MPLS_UC) as default value.
|
||||
note: 0x8847(ETH_P_MPLS_UC) as default value.
|
||||
|
||||
```elixir
|
||||
iex> %PopMpls{ethertype: 0x8847} = PopMpls.new()
|
||||
```
|
||||
"""
|
||||
@spec new() :: t()
|
||||
@spec new(ethertype :: 0..0xFFFF) :: t()
|
||||
|
|
@ -33,10 +31,12 @@ defmodule Openflow.Action.PopMpls do
|
|||
%PopMpls{ethertype: ethertype}
|
||||
end
|
||||
|
||||
@spec to_binary(t()) :: <<_::16, _::_*8>>
|
||||
def to_binary(%PopMpls{ethertype: ethertype}) do
|
||||
<<20::16, 8::16, ethertype::16, 0::size(2)-unit(8)>>
|
||||
end
|
||||
|
||||
@spec read(<<_::16, _::_*8>>) :: t()
|
||||
def read(<<20::16, 8::16, ethertype::16, 0::size(2)-unit(8)>>) do
|
||||
%PopMpls{ethertype: ethertype}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue