Commit 937468b3 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

change folder name of message to ofp_manager

parent f34edd49
......@@ -5,11 +5,11 @@ use std::{
use super::{
events::PacketInEvent,
messages::{
ofp_manager::{
traiter::{MessageMarshal, OfpMsgEvent},
OfpMsg,
},
tcp_listener_handler, OfpHeader,
tcp_listener_handler,
};
pub trait ControllerFrame<OME: OfpMsgEvent> {
......@@ -23,7 +23,7 @@ pub trait ControllerFrame<OME: OfpMsgEvent> {
fn request_handler(&mut self, buf: &mut Vec<u8>, stream: &mut TcpStream) {
let ofp = self.get_ofp();
let ofp_header = OfpHeader::parse(&buf);
let ofp_header = ofp.header_parse(&buf);
let mut payload = vec![0u8; ofp_header.pkt_size()];
let _ = stream.read(&mut payload);
let message = ofp.msg_parse(ofp_header.message as u16);
......@@ -50,4 +50,3 @@ pub trait ControllerFrame<OME: OfpMsgEvent> {
let _ = stream.write_all(&header_bytes);
}
}
use crate::openflow::messages::{MessageMarshal, OfpMsg, OfpMsgEvent};
use crate::openflow::ofp_manager::{MessageMarshal, OfpMsg, OfpMsgEvent};
pub struct FeaturesReq {}
......
......@@ -3,7 +3,7 @@ use std::io::Cursor;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use crate::openflow::{
messages::{MessageMarshal, OfpMsg, OfpMsgEvent},
ofp_manager::{MessageMarshal, OfpMsg, OfpMsgEvent},
OfpPort, PseudoPort,
};
......
use crate::openflow::messages::{MessageMarshal, OfpMsg};
use crate::openflow::ofp_manager::{MessageMarshal, OfpMsg};
use crate::openflow::traiter::OfpMsgEvent;
pub struct HelloEvent {}
......
......@@ -8,8 +8,8 @@ pub mod events;
pub mod ofp_port;
pub use ofp_port::{OfpPort, PseudoPort};
pub mod messages;
pub use messages::{ofp_v1_0, traiter};
pub mod ofp_manager;
pub use ofp_manager::{ofp_v1_0, traiter};
pub mod tcp_listener;
pub use tcp_listener::tcp_listener_handler;
\ No newline at end of file
......@@ -15,6 +15,9 @@ impl Openflow10 {
}
impl OfpMsgEvent for Openflow10 {
fn header_parse(&self, bytes:&Vec<u8>) -> OfpHeader {
OfpHeader::parse(bytes)
}
fn header_size(&self) -> usize {
8
}
......
......@@ -24,6 +24,7 @@ pub trait OfpMsgEvent {
fn version(&self) -> usize;
fn ofp_version() -> usize;
fn header_size(&self) -> usize;
fn header_parse(&self, bytes:&Vec<u8>) -> OfpHeader;
fn msg_usize(&self, msg: OfpMsg) -> usize;
fn msg_parse(&self, msg: u16) -> OfpMsg;
......
use crate::openflow::{messages::Openflow10, traiter::OfpMsgEvent};
use crate::openflow::{ofp_manager::Openflow10, traiter::OfpMsgEvent};
use crate::{ofp_from_version, Controller};
use std::sync::{Arc, Mutex};
use std::{io::Read, net::TcpListener, thread};
......
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