Commit 53c50a2e authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

change variable name des to dst

parent 94958e03
......@@ -39,7 +39,7 @@ impl ControllerFrame10 for Controller {
let pkt = packetin.ether_parse();
self.mac_to_port.insert(pkt.mac_src, packetin.in_port);
let mac_dst = pkt.mac_des;
let mac_dst = pkt.mac_dst;
let mac_src = pkt.mac_src;
if let EtherType::LLDP = pkt.ether_type {
......
......@@ -10,7 +10,7 @@ use super::{
pub struct EthernetFrame {
pub ether_type: EtherType,
pub mac_des: u64,
pub mac_dst: u64,
pub mac_src: u64,
pub vlan_pcp: u8,
pub vlan_dei: bool,
......@@ -21,10 +21,10 @@ pub struct EthernetFrame {
impl EthernetFrame {
pub fn parse(payload: &Vec<u8>) -> EthernetFrame {
let mut bytes = Cursor::new(payload.to_vec());
let mut mac_des = [0u8; 6];
let mut mac_dst = [0u8; 6];
let mut mac_src = [0u8; 6];
for i in 0..6 {
mac_des[i] = bytes.read_u8().unwrap();
mac_dst[i] = bytes.read_u8().unwrap();
}
for i in 0..6 {
mac_src[i] = bytes.read_u8().unwrap();
......@@ -62,7 +62,7 @@ impl EthernetFrame {
};
EthernetFrame {
ether_type: EtherType::parse(typ),
mac_des: mac_to_bytes(mac_des),
mac_dst: mac_to_bytes(mac_dst),
mac_src: mac_to_bytes(mac_src),
vlan_pcp,
vlan_dei,
......
......@@ -27,7 +27,7 @@ pub struct IP {
pub protocol: u8,
pub checksum: u16,
pub src: u32,
pub des: u32,
pub dst: u32,
pub options: Vec<u8>,
pub ptcol: EtherData,
}
......@@ -55,7 +55,7 @@ impl IP {
let protocol = bytes.read_u8().unwrap();
let checksum = bytes.read_u16::<BigEndian>().unwrap();
let src = bytes.read_u32::<BigEndian>().unwrap();
let des = bytes.read_u32::<BigEndian>().unwrap();
let dst = bytes.read_u32::<BigEndian>().unwrap();
let option_len = (ihl * 4) as usize - 20;
let mut options = vec![0u8; option_len];
bytes.read_exact(&mut options).unwrap();
......@@ -98,7 +98,7 @@ impl IP {
ttl,
checksum,
src,
des,
dst,
options,
ptcol,
})
......
......@@ -5,7 +5,7 @@ use std::io::{BufRead, Cursor};
#[derive(Clone)]
pub struct TCP {
pub src_port: u16,
pub des_port: u16,
pub dst_port: u16,
pub seq: u32,
pub ack: u32,
pub offset: u8,
......@@ -25,7 +25,7 @@ impl TCP {
return None;
}
let src_port = bytes.read_u16::<BigEndian>().unwrap();
let des_port = bytes.read_u16::<BigEndian>().unwrap();
let dst_port = bytes.read_u16::<BigEndian>().unwrap();
let seq = bytes.read_u32::<BigEndian>().unwrap();
let ack = bytes.read_u32::<BigEndian>().unwrap();
let dataoff_reserv_flags = bytes.read_u16::<BigEndian>().unwrap();
......@@ -37,7 +37,7 @@ impl TCP {
let payload = bytes.fill_buf().unwrap().to_vec();
Some(TCP {
src_port,
des_port,
dst_port,
seq,
ack,
offset,
......@@ -50,7 +50,6 @@ impl TCP {
}
}
#[derive(Clone)]
pub struct TcpFlags {
pub ns: bool,
......
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