Commit 04ef7b62 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

change msg_usize: remove unneeded code

parent f2d84128
......@@ -55,7 +55,7 @@ pub trait ControllerFrame10 {
let mut body_bytes: Vec<u8> = Vec::new();
msg.marshal(&mut body_bytes);
let ofp_header = ofp.header(msg.msg_usize(&ofp) as u8, body_bytes.len() as u16, xid);
let ofp_header = ofp.header(msg.msg_usize() as u8, body_bytes.len() as u16, xid);
ofp_header.marshal(&mut header_bytes);
header_bytes.append(&mut body_bytes);
let _ = stream.write_all(&header_bytes);
......
......@@ -21,7 +21,7 @@ impl MessageMarshal for EchoReplyEvent {
ofp10::Msg::EchoReply
}
fn msg_usize<OFP: ofp10::OfpMsgEvent>(&self, ofp: &OFP) -> usize {
fn msg_usize(&self) -> usize {
ofp10::Msg::EchoReply as usize
}
......
......@@ -21,7 +21,7 @@ impl MessageMarshal for EchoRequestEvent {
Msg::EchoRequest
}
fn msg_usize<OFP: ofp10::OfpMsgEvent>(&self, _: &OFP) -> usize {
fn msg_usize(&self) -> usize {
Msg::EchoRequest as usize
}
......
......@@ -4,7 +4,7 @@ use std::{
};
use super::error_type::ErrorType;
use crate::openflow::ofp10::{MessageMarshal, Msg, OfpMsgEvent};
use crate::openflow::ofp10::{MessageMarshal, Msg};
use byteorder::{BigEndian, ReadBytesExt};
pub struct ErrorEvent {
......@@ -36,8 +36,8 @@ impl MessageMarshal for ErrorEvent {
Msg::Error
}
fn msg_usize<OFP: OfpMsgEvent>(&self, ofp: &OFP) -> usize {
ofp.msg_usize(Msg::Error)
fn msg_usize(&self) -> usize {
Msg::Error as usize
}
fn size_of(&self) -> usize {
......
use crate::openflow::ofp10::{MessageMarshal, Msg, OfpMsgEvent};
use crate::openflow::ofp10::{MessageMarshal, Msg};
pub struct FeaturesReqEvent {}
......@@ -19,7 +19,7 @@ impl MessageMarshal for FeaturesReqEvent {
0
}
fn msg_usize<OFP: OfpMsgEvent>(&self, ofp: &OFP) -> usize {
ofp.msg_usize(Msg::FeaturesRequest)
fn msg_usize(&self) -> usize {
Msg::FeaturesRequest as usize
}
}
......@@ -5,7 +5,7 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use crate::openflow::ofp10::{
events::{actions::SizeCheck, Action},
ofp_port::OfpPort,
MessageMarshal, Msg, OfpMsgEvent, PseudoPort,
MessageMarshal, Msg, PseudoPort,
};
use super::{FlowModCommand, FlowModFlags, MatchFields};
......@@ -96,8 +96,8 @@ impl FlowModEvent {
}
impl MessageMarshal for FlowModEvent {
fn msg_usize<OFP: OfpMsgEvent>(&self, ofp: &OFP) -> usize {
ofp.msg_usize(Msg::FlowMod)
fn msg_usize(&self) -> usize {
Msg::FlowMod as usize
}
fn size_of(&self) -> usize {
24
......
use crate::openflow::ofp10::{MessageMarshal, Msg, OfpMsgEvent};
use crate::openflow::ofp10::{MessageMarshal, Msg};
pub struct HelloEvent {}
......@@ -19,7 +19,7 @@ impl MessageMarshal for HelloEvent {
0
}
fn msg_usize<OFP: OfpMsgEvent>(&self, ofp: &OFP) -> usize {
ofp.msg_usize(Msg::Hello)
fn msg_usize(&self) -> usize {
Msg::Hello as usize
}
}
......@@ -4,7 +4,7 @@ use std::{
};
use crate::openflow::ofp10::PseudoPort;
use crate::openflow::ofp10::{ofp_port::OfpPort, MessageMarshal, Msg, OfpMsgEvent};
use crate::openflow::ofp10::{ofp_port::OfpPort, MessageMarshal, Msg};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use super::{actions::SizeCheck, Action, Payload};
......@@ -40,8 +40,8 @@ impl MessageMarshal for PacketOutEvent {
Msg::PacketOut
}
fn msg_usize<OFP: OfpMsgEvent>(&self, ofp: &OFP) -> usize {
ofp.msg_usize(Msg::PacketOut)
fn msg_usize(&self) -> usize {
Msg::PacketOut as usize
}
fn size_of(&self) -> usize {
......
......@@ -11,7 +11,7 @@ use crate::openflow::ofp10::{
pub trait MessageMarshal {
fn marshal(&self, bytes: &mut Vec<u8>);
fn msg_code(&self) -> Msg;
fn msg_usize<OFP: OfpMsgEvent>(&self, ofp: &OFP) -> usize;
fn msg_usize(&self) -> usize;
fn size_of(&self) -> usize;
}
......
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