blob: 22fe965be95c03cb2c8afef539005ecb0a1cfee6 [file] [log] [blame]
Jonathan Hart7804bea2014-01-07 10:50:52 -08001package net.onrc.onos.ofcontroller.proxyarp;
2
Naoki Shiota78e403c2014-02-20 17:13:36 -08003import java.net.InetAddress;
4
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -07005// TODO This class is too generic to be handled by ProxyArpService.
6// TODO The generic broadcast packet shouldn't contain an IP address which is
7// only for ARP packets.
Jonathan Hart7804bea2014-01-07 10:50:52 -08008/**
9 * Notification to all ONOS instances to broadcast this packet out the edge of
10 * the network. The edge is defined as any port that doesn't have a link to
11 * another switch. The one exception is the port that the packet was received
12 * on.
13 *
14 */
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070015public class BroadcastPacketOutNotification extends PacketOutNotification {
Jonathan Hart7804bea2014-01-07 10:50:52 -080016
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070017 private static final long serialVersionUID = 1L;
Jonathan Hart7804bea2014-01-07 10:50:52 -080018
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070019 private final InetAddress address;
20 private final long inSwitch;
21 private final short inPort;
Jonathan Hart7804bea2014-01-07 10:50:52 -080022
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070023 /**
24 * Class constructor.
25 *
26 * @param packet
27 * packet data to send in the packet-out
28 * @param address
29 * target IP address if the packet is an ARP packet
30 * @param inSwitch
31 * dpid of the switch the packet was received on
32 * @param inPort
33 * port number of the receiving port
34 */
35 public BroadcastPacketOutNotification(byte[] packet, InetAddress address,
36 long inSwitch, short inPort) {
37 super(packet);
Jonathan Hart7804bea2014-01-07 10:50:52 -080038
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070039 this.address = address;
40 this.inSwitch = inSwitch;
41 this.inPort = inPort;
42 }
43
44 /**
45 * Get the dpid of the switch the packet was received on.
46 *
47 * @return receiving switch dpid
48 */
49 public long getInSwitch() {
50 return inSwitch;
51 }
52
53 /**
54 * Get the port number of the port the packet was received on.
55 *
56 * @return receiving port number
57 */
58 public short getInPort() {
59 return inPort;
60 }
61
62 /**
63 * Get the target IP address if the packet is an ARP packet.
64 *
65 * @return the target IP address for ARP packets, or null if the packet is
66 * not an ARP packet
67 */
68 public InetAddress getTargetAddress() {
69 return address;
70 }
Jonathan Hart7804bea2014-01-07 10:50:52 -080071}