X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsamples%2Fsimpleforwarding%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsamples%2Fsimpleforwarding%2FIBroadcastHandler.java;fp=opendaylight%2Fsamples%2Fsimpleforwarding%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsamples%2Fsimpleforwarding%2FIBroadcastHandler.java;h=8140019622341187c0b392dd123a2a28cdf87764;hp=0000000000000000000000000000000000000000;hb=867026efeb7046076e7e0cf34b5ac2d18c54618b;hpb=a3dbf5335c352c7463674e31314ce2b5285cb6fe diff --git a/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/IBroadcastHandler.java b/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/IBroadcastHandler.java new file mode 100644 index 0000000000..8140019622 --- /dev/null +++ b/opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/IBroadcastHandler.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2013 IBM and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.samples.simpleforwarding; + +import org.opendaylight.controller.sal.core.NodeConnector; +import org.opendaylight.controller.sal.packet.RawPacket; +import org.opendaylight.controller.topologymanager.ITopologyManager; + +/** + * Provides support for flooding/broadcasting of packets. + */ +public interface IBroadcastHandler { + + /** + * The mode to select which ports to broadcast a given packet. See the + * individual modes for the expected behavior. + */ + static enum BroadcastMode { + /** + * Turn off broadcast handling and ignore all received data packets. + */ + DISABLED, + + /** + * sends broadcast packets out ports where there are known hosts as + * discovered by {@link ITopologyManager#getNodeConnectorWithHost}. + */ + BROADCAST_TO_HOSTS, + + /** + * sends broadcast packets out all non-internal links as discovered by + * {@link ITopologyManager#isInternal}. Also ignores ports which have + * {@link NodeConnector#getType} of "SW" indicating OFPP_LOCAL. + */ + BROADCAST_TO_NONINTERNAL, + + /** + * sends broadcast packets out the ports specified by an external + * implementation of {@link IBroadcastPortSelector}. + */ + EXTERNAL_QUERY + }; + + /** + * Set the {@link BroadcastMode} for this {@link IBroadcastHandler}. + * @param m + */ + void setMode(BroadcastMode m); + + /** + * Safely flood/broadcast a {@link RawPacket} received on a given + * {@link NodeConnector}. + * + * @param pkt + * The packet to flood/broadcast + * @return true if the broadcast is successful, false + * otherwise + */ + boolean broadcastPacket(RawPacket pkt); +}