Commit 46111381 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

declare one point for ofp version

parent 6c4a5497
......@@ -6,6 +6,8 @@ use std::{
use crate::openflow::ofp13::OpenflowHeader;
use super::{OfpMsgEvent, Openflow13};
pub struct OfpHeader {
pub version: u8,
pub message: u8,
......@@ -16,14 +18,14 @@ pub struct OfpHeader {
impl OpenflowHeader for OfpHeader {
fn new(message: u8, length: usize, xid: usize) -> Self {
Self {
version: 4,
version: Openflow13::ofp_version() as u8,
message,
length: (size_of::<OfpHeader>() + length) as u16,
xid: xid as u32,
}
}
fn version(&self) -> usize {
4
Openflow13::ofp_version()
}
fn message(&self) -> u8 {
self.message
......
......@@ -35,10 +35,10 @@ impl OfpMsgEvent for Openflow13 {
PacketOutEvent::new(port_id, payload, actions)
}
fn ofp_version() -> usize {
4
0x04
}
fn version(&self) -> usize {
4
Self::ofp_version()
}
fn header(&self, message: u8, length: u16, xid: u32) -> OfpHeader {
......
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