Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 25 variants Output(OutputPort), Drop, Controller { max_len: u16, }, SetEthSrc([u8; 6]), SetEthDst([u8; 6]), SetVlanVid(u16), PushVlan(u16), PopVlan, SetIpv4Src(Ipv4Addr), SetIpv4Dst(Ipv4Addr), SetTpSrc(u16), SetTpDst(u16), SetTtl(u8), DecTtl, GotoTable(u8), WriteMetadata { metadata: u64, mask: u64, }, Meter(u32), Group(u32), SetTunnelId(u64), NxResubmit { port: Option<u16>, table: Option<u8>, }, NxLearn(NxLearn), NxCt { flags: u16, zone: u16, table: Option<u8>, }, NxCtNat { flags: u16, zone: u16, table: Option<u8>, nat: NatConfig, }, NxMove { src_field: u32, dst_field: u32, n_bits: u16, src_ofs: u16, dst_ofs: u16, }, NxRegLoad { dst_field: u32, dst_ofs: u16, n_bits: u16, value: u64, },
}
Expand description

An OpenFlow action.

Variants§

§

Output(OutputPort)

Output to a port

§

Drop

Drop the packet (implicit, no action)

§

Controller

Send to controller

Fields

§max_len: u16
§

SetEthSrc([u8; 6])

Set source MAC

§

SetEthDst([u8; 6])

Set destination MAC

§

SetVlanVid(u16)

Set VLAN ID

§

PushVlan(u16)

Push VLAN tag

§

PopVlan

Pop VLAN tag

§

SetIpv4Src(Ipv4Addr)

Set IPv4 source

§

SetIpv4Dst(Ipv4Addr)

Set IPv4 destination

§

SetTpSrc(u16)

Set TCP/UDP source port

§

SetTpDst(u16)

Set TCP/UDP destination port

§

SetTtl(u8)

Set IP TTL

§

DecTtl

Decrement IP TTL

§

GotoTable(u8)

Go to table (OF 1.1+)

§

WriteMetadata

Write metadata

Fields

§metadata: u64
§mask: u64
§

Meter(u32)

Apply meter

§

Group(u32)

Output to group

§

SetTunnelId(u64)

Set tunnel ID

§

NxResubmit

Resubmit to table (Nicira extension)

Fields

§port: Option<u16>
§table: Option<u8>
§

NxLearn(NxLearn)

Learn action (Nicira extension)

§

NxCt

Conntrack action (Nicira extension)

Fields

§flags: u16
§zone: u16
§table: Option<u8>
§

NxCtNat

Conntrack with NAT action (Nicira extension)

Fields

§flags: u16
§zone: u16
§table: Option<u8>
§

NxMove

Move/copy bits between fields (Nicira extension)

Fields

§src_field: u32

Source NXM field header

§dst_field: u32

Destination NXM field header

§n_bits: u16

Number of bits to copy

§src_ofs: u16

Bit offset in source field

§dst_ofs: u16

Bit offset in destination field

§

NxRegLoad

Load immediate value into field (Nicira extension)

Fields

§dst_field: u32

Destination NXM field header

§dst_ofs: u16

Bit offset in destination field

§n_bits: u16

Number of bits to load

§value: u64

Value to load

Implementations§

Source§

impl Action

Source

pub fn encode(&self) -> Vec<u8>

Encode action to OpenFlow wire format.

Source

pub fn decode(data: &[u8]) -> Result<(Self, usize)>

Decode action from OpenFlow wire format.

Returns the decoded action and the number of bytes consumed.

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.