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

create struct for openflow1.0

parent 0b80948b
use std::io::Read; use std::io::Read;
use std::net::TcpListener; use std::net::TcpListener;
use tenjin::openflow::events::packet_in::PacketInEvent; use tenjin::openflow::events::packet_in::PacketInEvent;
use tenjin::openflow::{Controller, OfpMsg, OfpHeader}; use tenjin::openflow::message::Openflow10;
use tenjin::openflow::{Controller, OfpHeader, OfpMsg};
extern crate byteorder; extern crate byteorder;
fn main() -> Result<(), std::io::Error> { fn main() -> Result<(), std::io::Error> {
let mut controller = Controller::new(Controller::OFP_1_0); let mut controller = Controller::new(Openflow10::new());
let listener = TcpListener::bind(("127.0.0.1", 6633)).unwrap(); let listener = TcpListener::bind(("127.0.0.1", 6633)).unwrap();
let mut buf = vec![0u8; 8]; let mut buf = vec![0u8; 8];
......
...@@ -14,7 +14,15 @@ pub enum OfpMsg { ...@@ -14,7 +14,15 @@ pub enum OfpMsg {
NotFound = -1, NotFound = -1,
} }
impl OfpMsgEvent for OfpMsg { pub struct Openflow10 {}
impl Openflow10 {
pub fn new() -> Self {
Openflow10 {}
}
}
impl OfpMsgEvent for Openflow10 {
fn hello_event(&self) -> HelloEvent { fn hello_event(&self) -> HelloEvent {
HelloEvent::new() HelloEvent::new()
} }
......
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