Commit 490eb6e7 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

move traiter into ofp10

parent 3c3c717f
......@@ -4,14 +4,11 @@ use std::{collections::HashMap, net::TcpStream};
use crate::{
etherparser::ether_type::EtherType,
openflow::{
ofp10::{
openflow::ofp10::{
self,
events::{flow_mod::MatchFields, Action},
ofp_manager::Openflow10,
ControllerFrame10, FlowModEvent, PacketInEvent,
},
traiter::OfpMsgEvent,
ControllerFrame10, FlowModEvent, OfpMsgEvent, PacketInEvent,
},
};
/**
......
pub mod ofp10;
\ No newline at end of file
pub mod traiter;
\ No newline at end of file
use crate::openflow::{
ofp10::{ErrorEvent, Msg, PacketInEvent},
traiter::{MessageMarshal, OfpMsgEvent},
};
use crate::openflow::ofp10::{ErrorEvent, Msg, PacketInEvent};
use std::{
io::{Read, Write},
net::TcpStream,
};
use super::tcp_listener_handler;
use super::{tcp_listener_handler, MessageMarshal, OfpMsgEvent};
pub trait ControllerFrame10 {
fn get_ofp(&self) -> &impl OfpMsgEvent;
......
......@@ -4,10 +4,7 @@ use std::{
};
use super::error_type::ErrorType;
use crate::openflow::{
ofp10::Msg,
traiter::{MessageMarshal, OfpMsgEvent},
};
use crate::openflow::ofp10::{MessageMarshal, Msg, OfpMsgEvent};
use byteorder::{BigEndian, ReadBytesExt};
pub struct ErrorEvent {
......
use crate::openflow::{
ofp10::Msg,
traiter::{MessageMarshal, OfpMsgEvent},
};
use crate::openflow::ofp10::{MessageMarshal, Msg, OfpMsgEvent};
pub struct FeaturesReqEvent {}
......
......@@ -2,13 +2,10 @@ use std::io::Cursor;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use crate::openflow::{
ofp10::{
use crate::openflow::ofp10::{
events::{actions::SizeCheck, Action},
ofp_port::OfpPort,
Msg, PseudoPort,
},
traiter::{MessageMarshal, OfpMsgEvent},
MessageMarshal, Msg, OfpMsgEvent, PseudoPort,
};
use super::{FlowModCommand, MatchFields};
......
use crate::openflow::{
ofp10::Msg,
traiter::{MessageMarshal, OfpMsgEvent},
};
use crate::openflow::ofp10::{MessageMarshal, Msg, OfpMsgEvent};
pub struct HelloEvent {}
......
......@@ -3,11 +3,8 @@ use std::{
mem::size_of,
};
use crate::openflow::ofp10::{ofp_port::OfpPort, Msg};
use crate::openflow::{
ofp10::PseudoPort,
traiter::{MessageMarshal, OfpMsgEvent},
};
use crate::openflow::ofp10::PseudoPort;
use crate::openflow::ofp10::{ofp_port::OfpPort, MessageMarshal, Msg, OfpMsgEvent};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use super::{actions::SizeCheck, Action, Payload};
......
......@@ -15,3 +15,6 @@ pub use controller_frame::ControllerFrame10;
pub mod tcp_listener;
pub use tcp_listener::tcp_listener_handler;
pub mod traiter;
pub use traiter::{MessageMarshal, OfpMsgEvent, OpenflowHeader};
use crate::openflow::traiter::header_trait::OpenflowHeader;
use crate::openflow::ofp10::OpenflowHeader;
pub struct OfpHeader<OFH: OpenflowHeader> {
ofp_header: OFH,
......
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::{io::Cursor, mem::size_of};
use crate::openflow::traiter::header_trait::OpenflowHeader;
use crate::openflow::ofp10::OpenflowHeader;
pub struct OfpHeader10 {
pub version: u8,
......
use super::{
events::{Action, FeaturesReqEvent, Payload},
ofp_header::{OfpHeader, OfpHeader10},
HelloEvent, Msg, PacketOutEvent,
HelloEvent, Msg, OfpMsgEvent, OpenflowHeader, PacketOutEvent,
};
use crate::openflow::traiter::{event_trait::OfpMsgEvent, header_trait::OpenflowHeader};
pub struct Openflow10 {}
......
use crate::{openflow::traiter::OfpMsgEvent, Controller};
use crate::Controller;
use std::{io::Read, net::TcpListener, thread};
use crate::openflow::ofp10::HelloEvent;
use super::ControllerFrame10;
use super::{ControllerFrame10, OfpMsgEvent};
pub fn tcp_listener_handler(address: &str) {
let listener = TcpListener::bind(address).unwrap();
......
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