Commit 2a065fef authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

add switch_fatures to controller13

parent fec3d6cb
......@@ -30,6 +30,24 @@ impl ControllerFrame13 for Controller13 {
/**
* Start here for handle packetIn message.
*/
fn switch_features_handler(
&self,
xid: u32,
features_reply: ofp13::FeaturesReplyEvent,
stream: &mut TcpStream,
) {
let matchs = MatchFields::match_all();
let actions = vec![Action::Oputput(ofp13::PseudoPort::Controller(!0))];
self.add_flow(
xid,
0,
matchs,
&actions,
features_reply.n_tables,
Some(features_reply.n_buffers),
stream,
)
}
fn packet_in_handler(&mut self, xid: u32, packetin: PacketInEvent, stream: &mut TcpStream) {
let pkt = match packetin.ether_parse() {
Ok(pkt) => pkt,
......
use std::io::{Cursor, Error};
use std::io::{BufRead, Cursor, Error};
use byteorder::{BigEndian, ReadBytesExt};
......@@ -19,6 +19,7 @@ impl FeaturesReplyEvent {
let n_buffers = bytes.read_u32::<BigEndian>()?;
let n_tables = bytes.read_u8()?;
let auxiliary = bytes.read_u8()?;
bytes.consume(2);
let capabilities: Capabilities = bytes.read_u32::<BigEndian>()?.into();
let reserved = bytes.read_u32::<BigEndian>()?;
Ok(Self {
......
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