blob: 8ed7737bca268db53b61e295fe85a1e7a654e7ee [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/>
pingping-lin0426dee2014-08-27 15:03:17 -070050 * By default, this function does not broadcast to external networks.
51 * <p/>
Jonathan Harte3702f22014-04-29 02:56:56 -070052 * NOTE: currently unimplemented.
Jonathan Harte6e63732014-04-16 14:29:49 -070053 *
54 * @param eth the packet to broadcast
55 */
pingping-lin0426dee2014-08-27 15:03:17 -070056 public void broadcastPacketOutInternalEdge(Ethernet eth);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070057
Jonathan Harte6e63732014-04-16 14:29:49 -070058 /**
59 * Broadcast the packet out all edge ports in the network, except for the
60 * specified excluded port. An edge port is defined as any port that
61 * doesn't have a link to another switch.
62 * <p/>
63 * This is useful for packets that are received from a host in the
64 * dataplane, where we want to broadcast the packet to everyone apart from
65 * the host that sent it.
pingping-lin0426dee2014-08-27 15:03:17 -070066 * <p/>
67 * By default, this function does not broadcast to external networks.
Jonathan Harte6e63732014-04-16 14:29:49 -070068 *
69 * @param eth the packet to broadcast
70 * @param inSwitchPort the exception port that the packet is not
71 * broadcast out
72 */
pingping-lin0426dee2014-08-27 15:03:17 -070073 public void broadcastPacketOutInternalEdge(Ethernet eth, SwitchPort inSwitchPort);
Jonathan Hart1f75cae2014-04-09 17:24:09 -070074}