blob: 4321a11c7abe090287ddfc0f4a5c326c3813f63a [file] [log] [blame]
Jonathan Hart1f75cae2014-04-09 17:24:09 -07001package net.onrc.onos.api.packet;
2
3import java.util.List;
4
5import net.floodlightcontroller.core.module.IFloodlightService;
6import net.onrc.onos.core.packet.Ethernet;
Jonathan Harte6e63732014-04-16 14:29:49 -07007import net.onrc.onos.core.util.SwitchPort;
Jonathan Hart1f75cae2014-04-09 17:24:09 -07008
Jonathan Harte6e63732014-04-16 14:29:49 -07009/**
10 * Provides packet services to ONOS applications. This includes both the
11 * ability to receive packets from the network, and to send packets out
12 * ports in the network. The packet service provides a global context for
13 * packet operations; an application can send/receive packets to/from any
14 * port in the network.
15 * <p/>
16 * NOTE: Global packet-ins are currently not implemented. An application can
17 * subscribe to local packet-ins only at the moment.
18 */
Jonathan Hart1f75cae2014-04-09 17:24:09 -070019public interface IPacketService extends IFloodlightService {
Jonathan Harte6e63732014-04-16 14:29:49 -070020 /**
21 * Register to listen for packet-in events.
22 *
23 * @param listener the function to call when a packet-in event is received
24 */
Jonathan Hart1f75cae2014-04-09 17:24:09 -070025 public void registerPacketListener(IPacketListener listener);
26
Jonathan Harte6e63732014-04-16 14:29:49 -070027 // TODO investigate using Port objects again when Ports can be safely
28 // passed around.
29 /**
30 * Send a packet out a specific port in the network.
31 *
32 * @param switchPort the port to send the packet out
33 * @param eth the packet to send
34 */
35 public void sendPacket(SwitchPort switchPort, Ethernet eth);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070036
Jonathan Harte6e63732014-04-16 14:29:49 -070037 /**
38 * Send a packet out multiple ports in the network.
39 *
40 * @param switchPorts a list of ports to send the packet out
41 * @param eth the packet to send
42 */
43 public void sendPacket(List<SwitchPort> switchPorts, Ethernet eth);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070044
Jonathan Harte6e63732014-04-16 14:29:49 -070045 /**
46 * Broadcast the packet out all edge ports in the network. An edge port is
47 * defined as any port that doesn't have a link to another switch.
48 *
49 * @param eth the packet to broadcast
50 */
Jonathan Hart1f75cae2014-04-09 17:24:09 -070051 public void broadcastPacket(Ethernet eth);
52
Jonathan Harte6e63732014-04-16 14:29:49 -070053 /**
54 * Broadcast the packet out all edge ports in the network, except for the
55 * specified excluded port. An edge port is defined as any port that
56 * doesn't have a link to another switch.
57 * <p/>
58 * This is useful for packets that are received from a host in the
59 * dataplane, where we want to broadcast the packet to everyone apart from
60 * the host that sent it.
61 *
62 * @param eth the packet to broadcast
63 * @param inSwitchPort the exception port that the packet is not
64 * broadcast out
65 */
66 public void broadcastPacket(Ethernet eth, SwitchPort inSwitchPort);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070067}