Created a packet service which presents a global-context API to
applications for packet events.
The API will provide both packet-ins and packet-outs. Packet-ins have been
implemented, packet-outs are left for a future commit.
Change-Id: Ia1666412ebc68912c6c84e43a7cbc327fcd0e8f8
diff --git a/src/main/java/net/onrc/onos/api/packet/IPacketListener.java b/src/main/java/net/onrc/onos/api/packet/IPacketListener.java
new file mode 100644
index 0000000..000ed7a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/packet/IPacketListener.java
@@ -0,0 +1,9 @@
+package net.onrc.onos.api.packet;
+
+import net.onrc.onos.core.packet.Ethernet;
+import net.onrc.onos.core.topology.Port;
+import net.onrc.onos.core.topology.Switch;
+
+public interface IPacketListener {
+ public void receive(Switch sw, Port inPort, Ethernet payload);
+}
diff --git a/src/main/java/net/onrc/onos/api/packet/IPacketService.java b/src/main/java/net/onrc/onos/api/packet/IPacketService.java
new file mode 100644
index 0000000..eaa372d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/packet/IPacketService.java
@@ -0,0 +1,21 @@
+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.topology.Port;
+
+public interface IPacketService extends IFloodlightService {
+ // packet ins
+ public void registerPacketListener(IPacketListener listener);
+
+ // packet outs
+ public void sendPacket(Port port, Ethernet eth);
+
+ public void sendPacket(List<Port> ports, Ethernet eth);
+
+ public void broadcastPacket(Ethernet eth);
+
+ public void broadcastPacket(Ethernet eth, Port inPort);
+}