X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflowj_netty%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2Faction%2FOFActionType.java;fp=third-party%2Fopenflowj_netty%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2Faction%2FOFActionType.java;h=0000000000000000000000000000000000000000;hb=64fe0fbca1a6c2b77ad25f568d73a7eb64236d16;hp=18229170b77dc1a01984cfc9f156272f5ad858c5;hpb=8b9a3ff2bbc83941254b46b818cbbae5cc1a3a5b;p=openflowjava.git diff --git a/third-party/openflowj_netty/src/main/java/org/openflow/protocol/action/OFActionType.java b/third-party/openflowj_netty/src/main/java/org/openflow/protocol/action/OFActionType.java deleted file mode 100644 index 18229170..00000000 --- a/third-party/openflowj_netty/src/main/java/org/openflow/protocol/action/OFActionType.java +++ /dev/null @@ -1,203 +0,0 @@ -/** -* Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior -* University -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. You may obtain -* a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations -* under the License. -**/ - -/** - * - */ -package org.openflow.protocol.action; - -import java.lang.reflect.Constructor; - -import org.openflow.protocol.Instantiable; - -/** - * List of OpenFlow Action types and mappings to wire protocol value and - * derived classes - * - * @author David Erickson (daviderickson@cs.stanford.edu) - */ -public enum OFActionType { - OUTPUT (0, OFActionOutput.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionOutput(); - }}), - SET_VLAN_ID (1, OFActionVirtualLanIdentifier.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionVirtualLanIdentifier(); - }}), - SET_VLAN_PCP (2, OFActionVirtualLanPriorityCodePoint.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionVirtualLanPriorityCodePoint(); - }}), - STRIP_VLAN (3, OFActionStripVirtualLan.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionStripVirtualLan(); - }}), - SET_DL_SRC (4, OFActionDataLayerSource.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionDataLayerSource(); - }}), - SET_DL_DST (5, OFActionDataLayerDestination.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionDataLayerDestination(); - }}), - SET_NW_SRC (6, OFActionNetworkLayerSource.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionNetworkLayerSource(); - }}), - SET_NW_DST (7, OFActionNetworkLayerDestination.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionNetworkLayerDestination(); - }}), - SET_NW_TOS (8, OFActionNetworkTypeOfService.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionNetworkTypeOfService(); - }}), - SET_TP_SRC (9, OFActionTransportLayerSource.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionTransportLayerSource(); - }}), - SET_TP_DST (10, OFActionTransportLayerDestination.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionTransportLayerDestination(); - }}), - OPAQUE_ENQUEUE (11, OFActionEnqueue.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionEnqueue(); - }}), - VENDOR (0xffff, OFActionVendor.class, new Instantiable() { - @Override - public OFAction instantiate() { - return new OFActionVendorGeneric(); - }}); - - protected static OFActionType[] mapping; - - protected Class clazz; - protected Constructor constructor; - protected Instantiable instantiable; - protected int minLen; - protected short type; - - /** - * Store some information about the OpenFlow Action type, including wire - * protocol type number, length, and derrived class - * - * @param type Wire protocol number associated with this OFType - * @param clazz The Java class corresponding to this type of OpenFlow Action - * @param instantiable the instantiable for the OFAction this type represents - */ - OFActionType(int type, Class clazz, Instantiable instantiable) { - this.type = (short) type; - this.clazz = clazz; - this.instantiable = instantiable; - try { - this.constructor = clazz.getConstructor(new Class[]{}); - } catch (Exception e) { - throw new RuntimeException( - "Failure getting constructor for class: " + clazz, e); - } - OFActionType.addMapping(this.type, this); - } - - /** - * Adds a mapping from type value to OFActionType enum - * - * @param i OpenFlow wire protocol Action type value - * @param t type - */ - static public void addMapping(short i, OFActionType t) { - if (mapping == null) - mapping = new OFActionType[16]; - // bring higher mappings down to the edge of our array - if (i < 0) - i = (short) (16 + i); - OFActionType.mapping[i] = t; - } - - /** - * Given a wire protocol OpenFlow type number, return the OFType associated - * with it - * - * @param i wire protocol number - * @return OFType enum type - */ - - static public OFActionType valueOf(short i) { - if (i < 0) - i = (short) (16+i); - return OFActionType.mapping[i]; - } - - /** - * @return Returns the wire protocol value corresponding to this - * OFActionType - */ - public short getTypeValue() { - return this.type; - } - - /** - * @return return the OFAction subclass corresponding to this OFActionType - */ - public Class toClass() { - return clazz; - } - - /** - * Returns the no-argument Constructor of the implementation class for - * this OFActionType - * @return the constructor - */ - public Constructor getConstructor() { - return constructor; - } - - /** - * Returns a new instance of the OFAction represented by this OFActionType - * @return the new object - */ - public OFAction newInstance() { - return instantiable.instantiate(); - } - - /** - * @return the instantiable - */ - public Instantiable getInstantiable() { - return instantiable; - } - - /** - * @param instantiable the instantiable to set - */ - public void setInstantiable(Instantiable instantiable) { - this.instantiable = instantiable; - } -}