Commit 6c677f99 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

add action oxm and others

parent 36bf05c2
use byteorder::WriteBytesExt;
#[derive(Clone)]
pub struct MacAddr {
mac: [u8; 6],
}
......
This diff is collapsed.
use crate::openflow::ofp13::Action;
#[repr(u16)]
pub enum InstructType {
GotoTable = 1,
WriteMetadata = 2,
WriteActions = 3,
ApplyActions = 4,
ClearActions = 5,
Meter = 6,
Experimenter = 0xffff,
}
impl From<InstructType> for u16 {
fn from(value: InstructType) -> Self {
value as u16
}
}
pub struct GotoTable {
typ: InstructType,
len: u16,
table_id: u8,
pad: [u8; 3],
}
pub struct WriteMetadata {
typ: InstructType,
len: u16,
pad: [u8; 4],
metadata: u64,
meta_mask: u64,
}
pub struct InstructActions {
typ: InstructType,
len: u16,
pad: [u8; 4],
action_header: Vec<Action>,
}
......@@ -76,7 +76,7 @@ pub struct OxmHeader {
}
impl OxmHeader {
fn new(field: OxmMatchFields, size: u8) -> Self {
pub fn new(field: OxmMatchFields, size: u8) -> Self {
Self {
class: OxmClass::OpenflowBasic,
field,
......@@ -85,7 +85,7 @@ impl OxmHeader {
experimenter: None,
}
}
fn marshal(&self, bytes: &mut Vec<u8>) {
pub fn marshal(&self, bytes: &mut Vec<u8>) {
bytes.write_u16::<BigEndian>(self.class.clone().into());
let field: u8 = self.field.clone().into();
bytes.write_u8(field << 1 | if self.hasmask { 1 } else { 0 });
......
......@@ -9,3 +9,5 @@ pub use match_fields::{Mask, MatchFields};
pub mod flow_mod_flags;
pub use flow_mod_flags::FlowModFlags;
pub mod instructions;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment