blob: d182c579b9f61db8e5d79124aea827095976b60f [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.
Jonathan Harte6e63732014-04-16 14:29:49 -070031 * @param eth the packet to send
Jonathan Harte3702f22014-04-29 02:56:56 -070032 * @param switchPort the port to send the packet out
Jonathan Harte6e63732014-04-16 14:29:49 -070033 */
Jonathan Harte3702f22014-04-29 02:56:56 -070034 public void sendPacket(Ethernet eth, SwitchPort switchPort);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070035
Jonathan Harte6e63732014-04-16 14:29:49 -070036 /**
37 * Send a packet out multiple ports in the network.
Jonathan Harte3702f22014-04-29 02:56:56 -070038 * <p/>
39 * NOTE: currently unimplemented.
Jonathan Harte6e63732014-04-16 14:29:49 -070040 *
Jonathan Harte6e63732014-04-16 14:29:49 -070041 * @param eth the packet to send
Jonathan Harte3702f22014-04-29 02:56:56 -070042 * @param switchPorts a list of ports to send the packet out
Jonathan Harte6e63732014-04-16 14:29:49 -070043 */
Jonathan Harte3702f22014-04-29 02:56:56 -070044 public void sendPacket(Ethernet eth, List<SwitchPort> switchPorts);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070045
Jonathan Harte6e63732014-04-16 14:29:49 -070046 /**
47 * Broadcast the packet out all edge ports in the network. An edge port is
48 * defined as any port that doesn't have a link to another switch.
Jonathan Harte3702f22014-04-29 02:56:56 -070049 * <p/>
50 * NOTE: currently unimplemented.
Jonathan Harte6e63732014-04-16 14:29:49 -070051 *
52 * @param eth the packet to broadcast
53 */
Jonathan Harte3702f22014-04-29 02:56:56 -070054 public void broadcastPacketOutEdge(Ethernet eth);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070055
Jonathan Harte6e63732014-04-16 14:29:49 -070056 /**
57 * Broadcast the packet out all edge ports in the network, except for the
58 * specified excluded port. An edge port is defined as any port that
59 * doesn't have a link to another switch.
60 * <p/>
61 * This is useful for packets that are received from a host in the
62 * dataplane, where we want to broadcast the packet to everyone apart from
63 * the host that sent it.
64 *
65 * @param eth the packet to broadcast
66 * @param inSwitchPort the exception port that the packet is not
67 * broadcast out
68 */
Jonathan Harte3702f22014-04-29 02:56:56 -070069 public void broadcastPacketOutEdge(Ethernet eth, SwitchPort inSwitchPort);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070070}