Commit 289482a9 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

rename pcket_in: port -> in_port

parent 19be69bc
...@@ -31,7 +31,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> { ...@@ -31,7 +31,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> {
*/ */
fn packet_in_handler(&mut self, xid: u32, packetin: PacketInEvent, stream: &mut TcpStream) { fn packet_in_handler(&mut self, xid: u32, packetin: PacketInEvent, stream: &mut TcpStream) {
let pkt = packetin.ether_parse(); let pkt = packetin.ether_parse();
self.mac_to_port.insert(pkt.mac_src, packetin.port); self.mac_to_port.insert(pkt.mac_src, packetin.in_port);
let mac_dst = pkt.mac_des; let mac_dst = pkt.mac_des;
let mac_src = pkt.mac_src; let mac_src = pkt.mac_src;
...@@ -49,7 +49,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> { ...@@ -49,7 +49,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> {
if let PseudoPort::PhysicalPort(_) = out_port { if let PseudoPort::PhysicalPort(_) = out_port {
let mut match_fields = MatchFields::match_all(); let mut match_fields = MatchFields::match_all();
match_fields.in_port = Some(packetin.port); match_fields.in_port = Some(packetin.in_port);
match_fields.mac_dest = Some(mac_dst); match_fields.mac_dest = Some(mac_dst);
match_fields.mac_src = Some(mac_src); match_fields.mac_src = Some(mac_src);
if let Some(buf_id) = packetin.buf_id { if let Some(buf_id) = packetin.buf_id {
...@@ -61,7 +61,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> { ...@@ -61,7 +61,7 @@ impl<OME: OfpMsgEvent> ControllerFrame<OME> for Controller<OME> {
} }
let packet_out = self let packet_out = self
.ofp .ofp
.packet_out(Some(packetin.port), packetin.payload, actions); .packet_out(Some(packetin.in_port), packetin.payload, actions);
self.send_msg(packet_out, xid, stream); self.send_msg(packet_out, xid, stream);
} }
} }
......
...@@ -13,7 +13,7 @@ pub enum PacketInReason { ...@@ -13,7 +13,7 @@ pub enum PacketInReason {
pub struct PacketInEvent { pub struct PacketInEvent {
pub buf_id: Option<u32>, pub buf_id: Option<u32>,
pub total_len: u16, pub total_len: u16,
pub port: u16, pub in_port: u16,
pub reason: PacketInReason, pub reason: PacketInReason,
pub table_id: u8, pub table_id: u8,
pub payload: Payload, pub payload: Payload,
...@@ -32,7 +32,7 @@ impl PacketInEvent { ...@@ -32,7 +32,7 @@ impl PacketInEvent {
n => Some(n as u32), n => Some(n as u32),
}; };
let total_len = bytes.read_u16::<BigEndian>().unwrap(); let total_len = bytes.read_u16::<BigEndian>().unwrap();
let port = bytes.read_u16::<BigEndian>().unwrap(); let in_port = bytes.read_u16::<BigEndian>().unwrap();
let reason = match bytes.read_u8().unwrap() { let reason = match bytes.read_u8().unwrap() {
1 => PacketInReason::NoMatch, 1 => PacketInReason::NoMatch,
2 => PacketInReason::Action, 2 => PacketInReason::Action,
...@@ -47,7 +47,7 @@ impl PacketInEvent { ...@@ -47,7 +47,7 @@ impl PacketInEvent {
PacketInEvent { PacketInEvent {
buf_id, buf_id,
total_len, total_len,
port, in_port,
reason, reason,
table_id, table_id,
payload, payload,
......
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