| package net.onrc.onos.api.packet; |
| |
| import java.util.List; |
| |
| import net.floodlightcontroller.core.module.IFloodlightService; |
| import net.onrc.onos.core.packet.Ethernet; |
| import net.onrc.onos.core.util.SwitchPort; |
| |
| /** |
| * Provides packet services to ONOS applications. This includes both the |
| * ability to receive packets from the network, and to send packets out |
| * ports in the network. The packet service provides a global context for |
| * packet operations; an application can send/receive packets to/from any |
| * port in the network. |
| * <p/> |
| * NOTE: Global packet-ins are currently not implemented. An application can |
| * subscribe to local packet-ins only at the moment. |
| */ |
| public interface IPacketService extends IFloodlightService { |
| /** |
| * Register to listen for packet-in events. |
| * |
| * @param listener the function to call when a packet-in event is received |
| */ |
| public void registerPacketListener(IPacketListener listener); |
| |
| // TODO investigate using Port objects again when Ports can be safely |
| // passed around. |
| /** |
| * Send a packet out a specific port in the network. |
| * |
| * @param switchPort the port to send the packet out |
| * @param eth the packet to send |
| */ |
| public void sendPacket(SwitchPort switchPort, Ethernet eth); |
| |
| /** |
| * Send a packet out multiple ports in the network. |
| * |
| * @param switchPorts a list of ports to send the packet out |
| * @param eth the packet to send |
| */ |
| public void sendPacket(List<SwitchPort> switchPorts, Ethernet eth); |
| |
| /** |
| * Broadcast the packet out all edge ports in the network. An edge port is |
| * defined as any port that doesn't have a link to another switch. |
| * |
| * @param eth the packet to broadcast |
| */ |
| public void broadcastPacket(Ethernet eth); |
| |
| /** |
| * Broadcast the packet out all edge ports in the network, except for the |
| * specified excluded port. An edge port is defined as any port that |
| * doesn't have a link to another switch. |
| * <p/> |
| * This is useful for packets that are received from a host in the |
| * dataplane, where we want to broadcast the packet to everyone apart from |
| * the host that sent it. |
| * |
| * @param eth the packet to broadcast |
| * @param inSwitchPort the exception port that the packet is not |
| * broadcast out |
| */ |
| public void broadcastPacket(Ethernet eth, SwitchPort inSwitchPort); |
| } |