Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.proxyarp; |
| 2 | |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame^] | 3 | |
Naoki Shiota | 78e403c | 2014-02-20 17:13:36 -0800 | [diff] [blame] | 4 | |
| 5 | // TODO This class is too generic to be handled by ProxyArpService. |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 6 | /** |
| 7 | * Notification to another ONOS instance to send a packet out a single port. |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 8 | */ |
| 9 | public class SinglePacketOutNotification extends PacketOutNotification { |
| 10 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 11 | private static final long serialVersionUID = 1L; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 12 | |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame^] | 13 | private final int address; |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 14 | private final long outSwitch; |
| 15 | private final short outPort; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 16 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 17 | /** |
| 18 | * Class constructor. |
| 19 | * @param packet the packet data to send in the packet-out |
| 20 | * @param address target IP address if the packet is an ARP packet |
| 21 | * @param outSwitch the dpid of the switch to send the packet on |
| 22 | * @param outPort the port number of the port to send the packet out |
| 23 | */ |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame^] | 24 | public SinglePacketOutNotification(byte[] packet, int address, |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 25 | long outSwitch, short outPort) { |
| 26 | super(packet); |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 27 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 28 | this.address = address; |
| 29 | this.outSwitch = outSwitch; |
| 30 | this.outPort = outPort; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Get the dpid of the switch the packet will be sent out. |
| 35 | * @return the switch's dpid |
| 36 | */ |
| 37 | public long getOutSwitch() { |
| 38 | return outSwitch; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get the port number of the port the packet will be sent out. |
| 43 | * @return the port number |
| 44 | */ |
| 45 | public short getOutPort() { |
| 46 | return outPort; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get the target IP address if the packet is an ARP packet. |
| 51 | * @return the target IP address for ARP packets, or null if the packet is |
| 52 | * not an ARP packet |
| 53 | */ |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame^] | 54 | public int getTargetAddress() { |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 55 | return address; |
| 56 | } |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 57 | } |