Jonathan Hart | 0961fe8 | 2014-04-03 09:56:25 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.proxyarp; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 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 | // TODO This class is too generic to be handled by ProxyArpService. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 5 | |
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. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 19 | * |
| 20 | * @param packet the packet data to send in the packet-out |
| 21 | * @param address target IP address if the packet is an ARP packet |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 22 | * @param outSwitch the dpid of the switch to send the packet on |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 23 | * @param outPort the port number of the port to send the packet out |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 24 | */ |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 25 | public SinglePacketOutNotification(byte[] packet, int address, |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 26 | long outSwitch, short outPort) { |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 27 | super(packet); |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 28 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 29 | this.address = address; |
| 30 | this.outSwitch = outSwitch; |
| 31 | this.outPort = outPort; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Get the dpid of the switch the packet will be sent out. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 36 | * |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 37 | * @return the switch's dpid |
| 38 | */ |
| 39 | public long getOutSwitch() { |
| 40 | return outSwitch; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get the port number of the port the packet will be sent out. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 45 | * |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 46 | * @return the port number |
| 47 | */ |
| 48 | public short getOutPort() { |
| 49 | return outPort; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get the target IP address if the packet is an ARP packet. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 54 | * |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 55 | * @return the target IP address for ARP packets, or null if the packet is |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 56 | * not an ARP packet |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 57 | */ |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 58 | public int getTargetAddress() { |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 59 | return address; |
| 60 | } |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 61 | } |