Jonathan Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.packet; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 6 | import net.onrc.onos.core.packet.Ethernet; |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 7 | import net.onrc.onos.core.util.SwitchPort; |
Jonathan Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 8 | |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 9 | /** |
| 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 Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 19 | public interface IPacketService extends IFloodlightService { |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 20 | /** |
| 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 Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 25 | public void registerPacketListener(IPacketListener listener); |
| 26 | |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 27 | // 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 Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 31 | * @param eth the packet to send |
Jonathan Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 32 | * @param switchPort the port to send the packet out |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 33 | */ |
Jonathan Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 34 | public void sendPacket(Ethernet eth, SwitchPort switchPort); |
Jonathan Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 35 | |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Send a packet out multiple ports in the network. |
Jonathan Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 38 | * <p/> |
| 39 | * NOTE: currently unimplemented. |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 40 | * |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 41 | * @param eth the packet to send |
Jonathan Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 42 | * @param switchPorts a list of ports to send the packet out |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 43 | */ |
Jonathan Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 44 | public void sendPacket(Ethernet eth, List<SwitchPort> switchPorts); |
Jonathan Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 45 | |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 46 | /** |
| 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 Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 49 | * <p/> |
| 50 | * NOTE: currently unimplemented. |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 51 | * |
| 52 | * @param eth the packet to broadcast |
| 53 | */ |
Jonathan Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 54 | public void broadcastPacketOutEdge(Ethernet eth); |
Jonathan Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 55 | |
Jonathan Hart | e6e6373 | 2014-04-16 14:29:49 -0700 | [diff] [blame] | 56 | /** |
| 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 Hart | e3702f2 | 2014-04-29 02:56:56 -0700 | [diff] [blame] | 69 | public void broadcastPacketOutEdge(Ethernet eth, SwitchPort inSwitchPort); |
Jonathan Hart | 1f75cae | 2014-04-09 17:24:09 -0700 | [diff] [blame] | 70 | } |