Renamed packages of generated code to org.projectfloodlight.openflow.*
And made LENGTH, MINIMUM_LENGTH, WIRE_VERSION constants package private instead of private to avoid 'unused' warnings.
diff --git a/java_gen/codegen.py b/java_gen/codegen.py
index 1e68acd..8606682 100644
--- a/java_gen/codegen.py
+++ b/java_gen/codegen.py
@@ -102,7 +102,7 @@
template='const.java', enum=enum, all_versions=self.java_model.versions)
for version in enum.versions:
- clazz = java_model.OFGenericClass(package="org.openflow.protocol.ver{}".format(version.of_version), name="{}SerializerVer{}".format(enum.name, version.of_version))
+ clazz = java_model.OFGenericClass(package="org.projectfloodlight.openflow.protocol.ver{}".format(version.of_version), name="{}SerializerVer{}".format(enum.name, version.of_version))
self.render_class(clazz=clazz, template="const_serializer.java", enum=enum, version=version)
def create_of_interfaces(self):
@@ -151,7 +151,7 @@
self.render_class(clazz=factory, template="of_factory_interface.java", factory=factory)
for factory_class in factory.factory_classes:
self.render_class(clazz=factory_class, template="of_factory_class.java", factory=factory_class, model=self.java_model)
- self.render_class(clazz=java_model.OFGenericClass(package="org.openflow.protocol", name="OFFactories"), template="of_factories.java", versions=self.java_model.versions)
+ self.render_class(clazz=java_model.OFGenericClass(package="org.projectfloodlight.openflow.protocol", name="OFFactories"), template="of_factories.java", versions=self.java_model.versions)
def copy_prewrite_tree(basedir):
""" Recursively copy the directory structure from ./java_gen/pre-write
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index d1adce0..65dac74 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -177,7 +177,7 @@
@property
@memoize
def of_factories(self):
- prefix = "org.openflow.protocol"
+ prefix = "org.projectfloodlight.openflow.protocol"
factories = OrderedDict()
@@ -237,7 +237,7 @@
@property
def factory_classes(self):
return [ OFFactoryClass(
- package="org.openflow.protocol.ver{}".format(version.of_version),
+ package="org.projectfloodlight.openflow.protocol.ver{}".format(version.of_version),
name="{}Ver{}".format(self.name, version.of_version),
interface=self,
version=version
@@ -325,7 +325,7 @@
self.constant_name = c_name.upper().replace("OF_", "")
pck_suffix, parent_interface, self.type_annotation = self.class_info()
- self.package = "org.openflow.protocol.%s" % pck_suffix if pck_suffix else "org.openflow.protocol"
+ self.package = "org.projectfloodlight.openflow.protocol.%s" % pck_suffix if pck_suffix else "org.projectfloodlight.openflow.protocol"
if self.name != parent_interface:
self.parent_interface = parent_interface
else:
@@ -510,7 +510,7 @@
self.c_name = self.ir_class.name
self.version = version
self.constant_name = self.c_name.upper().replace("OF_", "")
- self.package = "org.openflow.protocol.ver%s" % version.of_version
+ self.package = "org.projectfloodlight.openflow.protocol.ver%s" % version.of_version
self.generated = False
@property
@@ -938,7 +938,7 @@
for (name, version_value_map) in entry_name_version_value_map.items() ]
self.entries = [ e for e in self.entries if e.name not in model.enum_entry_blacklist[self.name] ]
- self.package = "org.openflow.protocol"
+ self.package = "org.projectfloodlight.openflow.protocol"
def wire_type(self, version):
ir_enum = self.version_enums[version]
diff --git a/java_gen/pre-written/src/main/java/org/openflow/annotations/Immutable.java b/java_gen/pre-written/src/main/java/org/openflow/annotations/Immutable.java
deleted file mode 100644
index 1d432c7..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/annotations/Immutable.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.openflow.annotations;
-
-/**
- * This annotation marks a class that is considered externally immutable. I.e.,
- * the externally visible state of the class will not change after its
- * construction. Such a class can be freely shared between threads and does not
- * require defensive copying (don't call clone).
- *
- * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
- */
-public @interface Immutable {
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/exceptions/NonExistantMessage.java b/java_gen/pre-written/src/main/java/org/openflow/exceptions/NonExistantMessage.java
deleted file mode 100644
index 2d82ba2..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/exceptions/NonExistantMessage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.openflow.exceptions;
-
-/**
- * Error: someone asked to create an OFMessage with wireformat type and version,
- * but that doesn't exist
- *
- * @author capveg
- */
-public class NonExistantMessage extends Exception {
-
- private static final long serialVersionUID = 1L;
- byte type;
- byte version;
-
- /**
- * Error: someone asked to create an OFMessage with wireformat type and
- * version, but that doesn't exist
- *
- * @param type
- * the wire format
- * @param version
- * the OpenFlow wireformat version number, e.g. 1 == v1.1, 2 =
- * v1.2, etc.
- */
- public NonExistantMessage(final byte type, final byte version) {
- this.type = type;
- this.version = version;
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFParseError.java b/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFParseError.java
deleted file mode 100644
index 76afc79..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFParseError.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.openflow.exceptions;
-
-public class OFParseError extends Exception {
- private static final long serialVersionUID = 1L;
-
- public OFParseError() {
- super();
- }
-
- public OFParseError(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public OFParseError(final String message) {
- super(message);
- }
-
- public OFParseError(final Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFShortRead.java b/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFShortRead.java
deleted file mode 100644
index 3007803..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFShortRead.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.openflow.exceptions;
-
-public class OFShortRead extends Exception {
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFShortWrite.java b/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFShortWrite.java
deleted file mode 100644
index fb0ddea..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFShortWrite.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openflow.exceptions;
-
-public class OFShortWrite extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFUnsupported.java b/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFUnsupported.java
deleted file mode 100644
index 14e96db..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/exceptions/OFUnsupported.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openflow.exceptions;
-
-public class OFUnsupported extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFBsnVportQInQT.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFBsnVportQInQT.java
deleted file mode 100644
index c5b884e..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFBsnVportQInQT.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.openflow.protocol;
-
-public class OFBsnVportQInQT {
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMatchBmap.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMatchBmap.java
deleted file mode 100644
index 6e4dc5b..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMatchBmap.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.openflow.protocol;
-
-public class OFMatchBmap {
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java
deleted file mode 100644
index 3f34d9b..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.openflow.protocol;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public interface OFMessageReader<T> {
- T readFrom(ChannelBuffer bb) throws OFParseError;
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageWriter.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageWriter.java
deleted file mode 100644
index bcca1fd..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageWriter.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.openflow.protocol;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public interface OFMessageWriter<T> {
- public void write(ChannelBuffer bb, T message) throws OFParseError;
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java
deleted file mode 100644
index aae6178..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.openflow.protocol;
-
-
-/**
- * Base interface of all OpenFlow objects (e.g., messages, actions, stats, etc.)
- */
-public interface OFObject extends Writeable {
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObjectFactory.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObjectFactory.java
deleted file mode 100644
index 86cafb1..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObjectFactory.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openflow.protocol;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-public interface OFObjectFactory<T extends OFObject> {
- T read(ChannelBuffer buffer);
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFOxmList.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFOxmList.java
deleted file mode 100644
index d9ede81..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFOxmList.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.openflow.protocol;
-
-import java.util.EnumMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.match.MatchField;
-import org.openflow.protocol.match.MatchFields;
-import org.openflow.protocol.oxm.OFOxm;
-import org.openflow.types.OFValueType;
-import org.openflow.util.ChannelUtils;
-
-import com.google.common.collect.ImmutableMap;
-
-public class OFOxmList implements Iterable<OFOxm<?>>, Writeable {
- private final Map<MatchFields, OFOxm<?>> oxmMap;
-
- public final static OFOxmList EMPTY = new OFOxmList(ImmutableMap.<MatchFields, OFOxm<?>>of());
-
- private OFOxmList(Map<MatchFields, OFOxm<?>> oxmMap) {
- this.oxmMap = oxmMap;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends OFValueType<T>> OFOxm<T> get(MatchField<T> matchField) {
- return (OFOxm<T>) oxmMap.get(matchField.id);
- }
-
- public static class Builder {
- private final Map<MatchFields, OFOxm<?>> oxmMap;
-
- public Builder() {
- oxmMap = new EnumMap<MatchFields, OFOxm<?>>(MatchFields.class);
- }
-
- public Builder(EnumMap<MatchFields, OFOxm<?>> oxmMap) {
- this.oxmMap = oxmMap;
- }
-
- public <T extends OFValueType<T>> void set(OFOxm<T> oxm) {
- oxmMap.put(oxm.getMatchField().id, oxm);
- }
-
- public <T extends OFValueType<T>> void unset(MatchField<T> matchField) {
- oxmMap.remove(matchField.id);
- }
-
- public OFOxmList build() {
- return new OFOxmList(oxmMap);
- }
- }
-
- @Override
- public Iterator<OFOxm<?>> iterator() {
- return oxmMap.values().iterator();
- }
-
- public static OFOxmList ofList(List<OFOxm<?>> oxmList) {
- Map<MatchFields, OFOxm<?>> map = new EnumMap<MatchFields, OFOxm<?>>(
- MatchFields.class);
- for (OFOxm<?> o : oxmList) {
- // TODO: if fully masked, ignore oxm.
- map.put(o.getMatchField().id, o);
- }
- return new OFOxmList(map);
- }
-
- public static OFOxmList of(OFOxm<?>... oxms) {
- Map<MatchFields, OFOxm<?>> map = new EnumMap<MatchFields, OFOxm<?>>(
- MatchFields.class);
- for (OFOxm<?> o : oxms) {
- // TODO: if fully masked, ignore oxm.
- map.put(o.getMatchField().id, o);
- }
- return new OFOxmList(map);
- }
-
- public static OFOxmList readFrom(ChannelBuffer bb, int length,
- OFMessageReader<OFOxm<?>> reader) throws OFParseError {
- return ofList(ChannelUtils.readList(bb, length, reader));
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- for (OFOxm<?> o : this) {
- o.writeTo(bb);
- }
- }
-
- public org.openflow.protocol.OFOxmList.Builder createBuilder() {
- return new OFOxmList.Builder(new EnumMap<MatchFields, OFOxm<?>>(oxmMap));
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((oxmMap == null) ? 0 : oxmMap.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- OFOxmList other = (OFOxmList) obj;
- if (oxmMap == null) {
- if (other.oxmMap != null)
- return false;
- } else if (!oxmMap.equals(other.oxmMap))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "OFOxmList" + oxmMap;
- }
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFTableFeature.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFTableFeature.java
deleted file mode 100644
index 114f638..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFTableFeature.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.openflow.protocol;
-
-public class OFTableFeature {
- // FIXME implement
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java
deleted file mode 100644
index 7241647..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.openflow.protocol;
-
-public enum OFVersion {
- OF_10(1), OF_11(2), OF_12(3), OF_13(4);
-
- public final int wireVersion;
-
- OFVersion(final int wireVersion) {
- this.wireVersion = wireVersion;
- }
-
- public int getWireVersion() {
- return wireVersion;
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/Wildcards.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/Wildcards.java
deleted file mode 100644
index 8c03b93..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/Wildcards.java
+++ /dev/null
@@ -1,656 +0,0 @@
-/**
- * Copyright 2013, Big Switch Networks, Inc.
- *
- * 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;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.base.Joiner;
-
-/**
- * a more user friendly representation of the wildcards bits in an OpenFlow
- * match. The Wildcards object is
- * <ul>
- * <li>immutable (i.e., threadsafe)</li>
- * <li>instance managed (don't instantiate it yourself), instead call "of"</li>
- * <ul>
- * <p>
- * You can construct a Wildcard object from either its integer representation
- * </p>
- * <code>
- * Wildcard.of(0x3820e0);
- * </code>
- * <p>
- * Or start with either an empty or full wildcard, and select/unselect foo.
- * </p>
- * <code>
- * Wildcard w = Wildcards.NONE
- * .set(Flag.DL_SRC, Flag. DL_DST, Flag.DL_VLAN_PCP)
- * .setNwDstMask(8)
- * .setNwSrcMask(8);
- * </code>
- * <p>
- * <b>Remember:</b> Wildcards objects are immutable. set... operations have
- * <b>NO EFFECT</b> on the current wildcard object. You HAVE to use the returned
- * changed object.
- * </p>
- *
- * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
- */
-public class Wildcards {
- public class OFWildcardFlags {
- final public static int OFPFW_ALL = ((1 << 22) - 1);
-
- final public static int OFPFW_IN_PORT = 1 << 0; /* Switch input port. */
- final public static int OFPFW_DL_VLAN = 1 << 1; /* VLAN id. */
- final public static int OFPFW_DL_SRC = 1 << 2; /* Ethernet source address. */
- final public static int OFPFW_DL_DST = 1 << 3; /*
- * Ethernet destination
- * address.
- */
- final public static int OFPFW_DL_TYPE = 1 << 4; /* Ethernet frame type. */
- final public static int OFPFW_NW_PROTO = 1 << 5; /* IP protocol. */
- final public static int OFPFW_TP_SRC = 1 << 6; /* TCP/UDP source port. */
- final public static int OFPFW_TP_DST = 1 << 7; /* TCP/UDP destination port. */
-
- /*
- * IP source address wildcard bit count. 0 is exact match, 1 ignores the
- * LSB, 2 ignores the 2 least-significant bits, ..., 32 and higher wildcard
- * the entire field. This is the *opposite* of the usual convention where
- * e.g. /24 indicates that 8 bits (not 24 bits) are wildcarded.
- */
- final public static int OFPFW_NW_SRC_SHIFT = 8;
- final public static int OFPFW_NW_SRC_BITS = 6;
- final public static int OFPFW_NW_SRC_MASK = ((1 << OFPFW_NW_SRC_BITS) - 1) << OFPFW_NW_SRC_SHIFT;
- final public static int OFPFW_NW_SRC_ALL = 32 << OFPFW_NW_SRC_SHIFT;
-
- /* IP destination address wildcard bit count. Same format as source. */
- final public static int OFPFW_NW_DST_SHIFT = 14;
- final public static int OFPFW_NW_DST_BITS = 6;
- final public static int OFPFW_NW_DST_MASK = ((1 << OFPFW_NW_DST_BITS) - 1) << OFPFW_NW_DST_SHIFT;
- final public static int OFPFW_NW_DST_ALL = 32 << OFPFW_NW_DST_SHIFT;
-
- final public static int OFPFW_DL_VLAN_PCP = 1 << 20; /* VLAN priority. */
- final public static int OFPFW_NW_TOS = 1 << 21; /*
- * IP ToS (DSCP field, 6
- * bits).
- */
-
- final public static int OFPFW_ALL_SANITIZED = (((1 << 22) - 1)
- & ~OFPFW_NW_SRC_MASK & ~OFPFW_NW_DST_MASK)
- | OFPFW_NW_SRC_ALL
- | OFPFW_NW_DST_ALL;
-
-
- }
-
- public final static Wildcards FULL = new Wildcards(OFWildcardFlags.OFPFW_ALL_SANITIZED);
- private static final int FULL_INT = FULL.getInt();
-
- public final static Wildcards EXACT = new Wildcards(0);
-
- // floodlight common case: matches on inport + l2
- public final static int INT_INPORT_L2_MATCH = 0x3820e0;
- public final static Wildcards INPORT_L2_MATCH = new Wildcards(
- INT_INPORT_L2_MATCH);
-
- /**
- * enum type for the binary flags that can be set in the wildcards field of
- * an OFWildcardFlags. Replaces the unwieldy c-ish int constants in OFWildcardFlags.
- */
- public static enum Flag {
- IN_PORT(OFWildcardFlags.OFPFW_IN_PORT), /* Switch input port. */
- DL_VLAN(OFWildcardFlags.OFPFW_DL_VLAN), /* VLAN id. */
- DL_SRC(OFWildcardFlags.OFPFW_DL_SRC), /* Ethernet source address. */
- DL_DST(OFWildcardFlags.OFPFW_DL_DST), /* Ethernet destination addr */
- DL_TYPE(OFWildcardFlags.OFPFW_DL_TYPE), /* Ethernet frame type. */
- NW_PROTO(OFWildcardFlags.OFPFW_NW_PROTO), /* IP protocol. */
- TP_SRC(OFWildcardFlags.OFPFW_TP_SRC), /* TCP/UDP source port. */
- TP_DST(OFWildcardFlags.OFPFW_TP_DST), /* TCP/UDP destination port. */
- DL_VLAN_PCP(OFWildcardFlags.OFPFW_DL_VLAN_PCP), /* VLAN priority. */
- NW_SRC(-1) { /*
- * virtual NW_SRC flag => translates to the strange 6 bits
- * in the header
- */
- @Override
- boolean isBolean() {
- return false;
- }
-
- @Override
- int getInt(int flags) {
- return ((flags & OFWildcardFlags.OFPFW_NW_SRC_MASK) >> OFWildcardFlags.OFPFW_NW_SRC_SHIFT);
- }
-
- @Override
- int setInt(int flags, int srcMask) {
- return (flags & ~OFWildcardFlags.OFPFW_NW_SRC_MASK) | (srcMask << OFWildcardFlags.OFPFW_NW_SRC_SHIFT);
- }
-
- @Override
- int wildcard(int flags) {
- return flags & ~OFWildcardFlags.OFPFW_NW_SRC_MASK;
- }
-
- @Override
- int matchOn(int flags) {
- return flags | OFWildcardFlags.OFPFW_NW_SRC_ALL;
- }
-
- @Override
- boolean isPartiallyOn(int flags) {
- int intValue = getInt(flags);
- return intValue > 0 && intValue < 32;
- }
-
- @Override
- boolean isFullyOn(int flags) {
- return getInt(flags) >= 32;
- }
-
- },
- NW_DST(-1) { /*
- * virtual NW_SRC flag => translates to the strange 6 bits
- * in the header
- */
- @Override
- boolean isBolean() {
- return false;
- }
-
- @Override
- int getInt(int flags) {
- return ((flags & OFWildcardFlags.OFPFW_NW_DST_MASK) >> OFWildcardFlags.OFPFW_NW_DST_SHIFT);
- }
-
- @Override
- int setInt(int flags, int srcMask) {
- return (flags & ~OFWildcardFlags.OFPFW_NW_DST_MASK) | (srcMask << OFWildcardFlags.OFPFW_NW_DST_SHIFT);
- }
-
- @Override
- int wildcard(int flags) {
- return flags & ~OFWildcardFlags.OFPFW_NW_DST_MASK;
- }
-
- @Override
- int matchOn(int flags) {
- return flags | OFWildcardFlags.OFPFW_NW_DST_ALL;
- }
-
- @Override
- boolean isFullyOn(int flags) {
- return getInt(flags) >= 32;
- }
- },
- NW_TOS(OFWildcardFlags.OFPFW_NW_TOS); /* IP ToS (DSCP field, 6 bits). */
-
- final int bitPosition;
-
- Flag(int bitPosition) {
- this.bitPosition = bitPosition;
- }
-
- /**
- * @return a modified OF-1.0 flags field with this flag cleared (match
- * on this field)
- */
- int matchOn(int flags) {
- return flags & ~this.bitPosition;
- }
-
- /**
- * @return a modified OF-1.0 flags field with this flag set (wildcard
- * this field)
- */
- int wildcard(int flags) {
- return flags | this.bitPosition;
- }
-
- /**
- * @return true iff this is a true boolean flag that can either be off
- * or on.True in OF-1.0 for all fields except NW_SRC and NW_DST
- */
- boolean isBolean() {
- return false;
- }
-
- /**
- * @return true iff this wildcard field is currently 'partially on'.
- * Always false for true Boolean Flags. Can be true in OF-1.0
- * for NW_SRC, NW_DST.
- */
- boolean isPartiallyOn(int flags) {
- return false;
- }
-
- /**
- * @return true iff this wildcard field currently fully on (fully
- * wildcarded). Equivalent to the boolean flag being set in the
- * bitmask for bit flags, and to the wildcarded bit length set
- * to >=32 for NW_SRC and NW_DST
- * @param flags
- * @return
- */
- boolean isFullyOn(int flags) {
- return (flags & this.bitPosition) != 0;
- }
-
- /**
- * set the integer representation of this flag. only for NW_SRC and
- * NW_DST
- */
- int setInt(int flags, int srcMask) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * set the integer representation of this flag. only for NW_SRC and
- * NW_DST
- */
- int getInt(int flags) {
- throw new UnsupportedOperationException();
- }
-
-
- }
-
- private final int flags;
-
- /** private constructor. use Wildcard.of() instead */
- private Wildcards(int flags) {
- this.flags = flags;
- }
-
- /**
- * return a wildcard object matching the given int flags. May reuse / cache
- * frequently used wildcard instances. Don't rely on it though (use equals
- * not ==).
- *
- * @param flags
- * @return
- */
- public static Wildcards of(int paramFlags) {
- int flags = paramFlags; //sanitizeInt(paramFlags);
- switch(flags) {
- case 0x0000:
- return EXACT;
- case OFWildcardFlags.OFPFW_ALL_SANITIZED:
- return FULL;
- case INT_INPORT_L2_MATCH:
- return INPORT_L2_MATCH;
- default:
- return new Wildcards(flags);
- }
- }
-
- /** convience method return a wildcard for exactly one set flag */
- public static Wildcards of(Wildcards.Flag setFlag) {
- return Wildcards.of(setFlag.wildcard(0));
- }
-
- /** convience method return a wildcard for exactly two set flags */
- public static Wildcards of(Wildcards.Flag setFlag, Wildcards.Flag setFlag2) {
- return Wildcards.of(setFlag.wildcard(setFlag2.wildcard(0)));
- }
-
- /** convience method return a wildcard for an arbitrary number of set flags */
- public static Wildcards of(Wildcards.Flag... setFlags) {
- int flags = 0;
- for (Wildcards.Flag flag : setFlags)
- flags = flag.wildcard(0);
- return Wildcards.of(flags);
- }
-
- /** convience method return a wildcards for ofmatches that match on one flag */
- public static Wildcards ofMatches(Wildcards.Flag setFlag) {
- return Wildcards.of(setFlag.matchOn(FULL_INT));
- }
-
- /**
- * convience method return a wildcard for for an ofmatch that match on two
- * flags
- */
- public static Wildcards ofMatches(Wildcards.Flag setFlag, Wildcards.Flag setFlag2) {
- return Wildcards.of(setFlag.matchOn(setFlag2.matchOn(FULL_INT)));
- }
-
- /**
- * convience method return a wildcard for an ofmatch that amtch on an
- * arbitrary number of set flags
- */
- public static Wildcards ofMatches(Wildcards.Flag... setFlags) {
- int flags = FULL_INT;
- for (Wildcards.Flag flag : setFlags)
- flags = flag.matchOn(flags);
- return Wildcards.of(flags);
- }
-
- public static Wildcards ofMatches(Set<Wildcards.Flag> wSet) {
- int flags = FULL_INT;
- for (Wildcards.Flag flag : wSet)
- flags = flag.matchOn(flags);
- return Wildcards.of(flags);
- }
-
- /**
- * return a Wildcards object that has the given flags set
- * <p>
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- */
- public Wildcards wildcard(Wildcards.Flag flag) {
- int flags = flag.wildcard(this.flags);
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcards object that has the given flags set
- * <p>
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- */
- public Wildcards wildcard(Wildcards.Flag flag, Wildcards.Flag flag2) {
- int flags = flag.wildcard(flag2.wildcard(this.flags));
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcards object that has the given flags wildcarded
- * <p>
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- */
- public Wildcards wildcard(Wildcards.Flag... setFlags) {
- int flags = this.flags;
- for (Wildcards.Flag flag : setFlags)
- flags = flag.wildcard(flags);
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcards object that matches on exactly the given flag
- * <p>
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- */
- public Wildcards matchOn(Wildcards.Flag flag) {
- int flags = flag.matchOn(this.flags);
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcards object that matches on exactly the given flags
- * <p>
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- */
- public Wildcards matchOn(Wildcards.Flag flag, Wildcards.Flag flag2) {
- int flags = flag.matchOn(flag2.matchOn(this.flags));
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcards object that matches on exactly the given flags
- * <p>
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- */
- public Wildcards matchOn(Wildcards.Flag... setFlags) {
- int flags = this.flags;
- for (Wildcards.Flag flag : setFlags)
- flags = flag.matchOn(flags);
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return the nw src mask in normal CIDR style, e.g., 8 means x.x.x.x/8
- * means 8 bits wildcarded
- */
- public int getNwSrcMask() {
- return Math.max(0, 32 - Flag.NW_SRC.getInt(flags));
- }
-
- /**
- * return the nw dst mask in normal CIDR style, e.g., 8 means x.x.x.x/8
- * means 8 bits wildcarded
- */
- public int getNwDstMask() {
- return Math.max(0, 32 - Flag.NW_DST.getInt(flags));
- }
-
- /**
- * return a Wildcard object that has the given nwSrcCidrMask set.
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- *
- * @param srcCidrMask
- * source mask to set in <b>normal CIDR notation</b>, i.e., 8
- * means x.x.x.x/8
- * @return a modified object
- */
- public Wildcards withNwSrcMask(int srcCidrMask) {
- int flags = Flag.NW_SRC.setInt(this.flags, Math.max(0, 32 - srcCidrMask));
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcard object that has the given nwDstCidrMask set.
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- *
- * @param dstCidrMask
- * dest mask to set in <b>normal CIDR notation</b>, i.e., 8 means
- * x.x.x.x/8
- * @return a modified object
- */
- public Wildcards withNwDstMask(int dstCidrMask) {
- int flags = Flag.NW_DST.setInt(this.flags, Math.max(0, 32 - dstCidrMask));
- if (flags == this.flags)
- return this;
- else
- return new Wildcards(flags);
- }
-
- /**
- * return a Wildcard object that is inverted to this wildcard object.
- * <b>NOTE:</b> NOT a mutator function. 'this' wildcard object stays
- * unmodified. </b>
- * @return a modified object
- */
- public Wildcards inverted() {
- return Wildcards.of(flags ^ OFWildcardFlags.OFPFW_ALL_SANITIZED);
- }
-
- public boolean isWildcarded(Flag flag) {
- return flag.isFullyOn(flags);
- }
-
- /**
- * return all wildcard flags that are fully wildcarded as an EnumSet. Do not
- * modify. Note: some flags (like NW_SRC and NW_DST) that are partially
- * wildcarded are not returned in this set.
- *
- * @return the EnumSet of wildcards
- */
- public EnumSet<Wildcards.Flag> getWildcardedFlags() {
- EnumSet<Wildcards.Flag> res = EnumSet.noneOf(Wildcards.Flag.class);
- for (Wildcards.Flag flag : Flag.values()) {
- if (flag.isFullyOn(flags)) {
- res.add(flag);
- }
- }
- return res;
- }
-
- /** return the OpenFlow 'wire' integer representation of these wildcards */
- public int getInt() {
- return flags;
- }
-
- /**
- * return the OpenFlow 'wire' integer representation of these wildcards.
- * Sanitize nw_src and nw_dst to be max. 32 (values > 32 are technically
- * possible, but don't make semantic sense)
- */
- public static int sanitizeInt(int flags) {
- if (((flags & OFWildcardFlags.OFPFW_NW_SRC_MASK) >> OFWildcardFlags.OFPFW_NW_SRC_SHIFT) > 32) {
- flags = (flags & ~OFWildcardFlags.OFPFW_NW_SRC_MASK) | OFWildcardFlags.OFPFW_NW_SRC_ALL;
- }
- if (((flags & OFWildcardFlags.OFPFW_NW_DST_MASK) >> OFWildcardFlags.OFPFW_NW_DST_SHIFT) > 32) {
- flags = (flags & ~OFWildcardFlags.OFPFW_NW_DST_MASK) | OFWildcardFlags.OFPFW_NW_DST_ALL;
- }
- return flags;
- }
-
- /**
- * is this a wildcard set that has all flags set + and full (/0) nw_src and
- * nw_dst wildcarding ?
- */
- public boolean isFull() {
- return flags == OFWildcardFlags.OFPFW_ALL || flags == OFWildcardFlags.OFPFW_ALL_SANITIZED;
- }
-
- /** is this a wildcard of an exact match */
- public boolean isExact() {
- return flags == 0;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + flags;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Wildcards other = (Wildcards) obj;
- if (flags != other.flags)
- return false;
- return true;
- }
-
- private final static Joiner pipeJoiner = Joiner.on("|");
-
- @Override
- public String toString() {
- List<String> res = new ArrayList<String>();
- for (Wildcards.Flag flag : Flag.values()) {
- if (flag.isFullyOn(flags)) {
- res.add(flag.name().toLowerCase());
- }
- }
-
- if (Flag.NW_SRC.isPartiallyOn(flags)) {
- res.add("nw_src(/" + getNwSrcMask() + ")");
- }
-
- if (Flag.NW_DST.isPartiallyOn(flags)) {
- res.add("nw_dst(/" + getNwDstMask() + ")");
- }
-
- return pipeJoiner.join(res);
- }
-
- private final static Joiner commaJoiner = Joiner.on(", ");
-
- /** a Java expression that constructs 'this' wildcards set */
- public String toJava() {
- if(isFull()) {
- return "Wildcards.FULL";
- } else if (isExact()){
- return "Wildcards.EXACT";
- }
-
- StringBuilder b = new StringBuilder();
-
- EnumSet<Flag> myFlags = getWildcardedFlags();
- if (myFlags.size() < 3) {
- // default to start with empty
- b.append("Wildcards.of("
- + commaJoiner.join(prefix("Flag.", myFlags.iterator())) + ")");
- } else {
- // too many - start with full
-
- EnumSet<Flag> invFlags = inverted().getWildcardedFlags();
- b.append("Wildcards.ofMatches("
- + commaJoiner.join(prefix("Flag.", invFlags.iterator())) + ")");
- }
- if (Flag.NW_SRC.isPartiallyOn(flags)) {
- b.append(".setNwSrcMask(" + getNwSrcMask() + ")");
- }
- if (Flag.NW_DST.isPartiallyOn(flags)) {
- b.append(".setNwDstMask(" + getNwDstMask() + ")");
- }
- return b.toString();
- }
-
- private Iterator<String> prefix(final String prefix, final Iterator<?> i) {
- return new Iterator<String>() {
-
- @Override
- public boolean hasNext() {
- return i.hasNext();
- }
-
- @Override
- public String next() {
- Object next = i.next();
- return next == null ? null : prefix + next.toString();
- }
-
- @Override
- public void remove() {
- i.remove();
- }
- };
- }
-
-
-}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/Writeable.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/Writeable.java
deleted file mode 100644
index 0ff7df6..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/Writeable.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openflow.protocol;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-public interface Writeable {
- void writeTo(ChannelBuffer bb);
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/XidGenerator.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/XidGenerator.java
deleted file mode 100644
index 0819ac2..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/XidGenerator.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.openflow.protocol;
-
-public interface XidGenerator {
- int nextXid();
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java
deleted file mode 100644
index 3fc5527..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.openflow.protocol.match;
-
-import org.openflow.protocol.OFObject;
-import org.openflow.types.Masked;
-import org.openflow.types.OFValueType;
-
-/**
- * Generic interface for version-agnostic immutable Match structure.
- * The Match structure is defined in the OpenFlow protocol, and it contains information on
- * the fields to be matched in a specific flow record.
- * This interface does not assume anything on the fields in the Match structure. If in
- * some version, the match structure cannot handle a certain field, it may return <code>false</code>
- * for <code>supports(...)</code> calls, and throw <code>UnsupportedOperationException</code> from all
- * other methods in such cases.
- * <br><br>
- * On wildcards and masks:<br>
- * This interface defines the following masking notations for fields:
- * <ul>
- * <li><b>Exact</b>: field is matched exactly against a single, fixed value (no mask, or mask is all ones).
- * <li><b>Wildcarded</b>: field is not being matched. It is fully masked (mask=0) and any value of it
- * will match the flow record having this match.
- * <li><b>Partially masked</b>: field is matched using a specified mask which is neither 0 nor all ones. Mask can
- * be either arbitrary or require some specific structure.
- * </ul>
- * Implementing classes may or may not support all types of these masking types. They may also support
- * them in part. For example, OF1.0 supports exact match and (full) wildcarding for all fields, but it
- * does only supports partial masking for IP source/destination fields, and this partial masking must be
- * in the CIDR prefix format. Thus, OF1.0 implementation may throw <code>UnsupportedOperationException</code> if given
- * in <code>setMaksed</code> an IP mask of, for example, 255.0.255.0, or if <code>setMasked</code> is called for any field
- * which is not IP source/destination address.
- * <br><br>
- * On prerequisites:<br>
- * From the OF1.1 spec, page 28, the OF1.0 spec failed to explicitly specify this, but it
- * is the behavior of OF1.0 switches:
- * "Protocol-specific fields within ofp_match will be ignored within a single table when
- * the corresponding protocol is not specified in the match. The MPLS match fields will
- * be ignored unless the Ethertype is specified as MPLS. Likewise, the IP header and
- * transport header fields will be ignored unless the Ethertype is specified as either
- * IPv4 or ARP. The tp_src and tp_dst fields will be ignored unless the network protocol
- * specified is as TCP, UDP or SCTP. Fields that are ignored don�t need to be wildcarded
- * and should be set to 0."
- * <br><br>
- * This interface uses generics to assure type safety in users code. However, implementing classes may have to suppress
- * 'unchecked cast' warnings while making sure they correctly cast base on their implementation details.
- *
- * @author Yotam Harchol (yotam.harchol@bigswitch.com)
- */
-public interface Match extends OFObject {
-
- /**
- * Returns a value for the given field if:
- * <ul>
- * <li>Field is supported
- * <li>Field is not fully wildcarded
- * <li>Prerequisites are ok
- * </ul>
- * If one of the above conditions does not hold, returns null. Value is returned masked if partially wildcarded.
- *
- * @param field Match field to retrieve
- * @return Value of match field (may be masked), or <code>null</code> if field is one of the conditions above does not hold.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException;
-
- /**
- * Returns the masked value for the given field from this match, along with the mask itself.
- * Prerequisite: field is partially masked.
- * If prerequisite is not met, a <code>null</code> is returned.
- *
- * @param field Match field to retrieve.
- * @return Masked value of match field or null if no mask is set.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException;
-
- /**
- * Returns true if and only if this match object supports the given match field.
- *
- * @param field Match field
- * @return true if field is supported, false otherwise.
- */
- public boolean supports(MatchField<?> field);
-
- /**
- * Returns true if and only if this match object supports partially bitmasking of the given field.
- * (note: not all possible values of this bitmask have to be acceptable)
- *
- * @param field Match field.
- * @return true if field can be partially masked, false otherwise.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public boolean supportsMasked(MatchField<?> field) throws UnsupportedOperationException;
-
- /**
- * Returns true if and only if this field is currently specified in the match with an exact value and
- * no mask. I.e., the specified match will only select packets that match the exact value of getValue(field).
- *
- * @param field Match field.
- * @return true if field has a specific exact value, false if not.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public boolean isExact(MatchField<?> field) throws UnsupportedOperationException;
-
- /**
- * True if and only if this field is currently logically unspecified in the match, i.e, the
- * value returned by getValue(f) has no impact on whether a packet will be selected
- * by the match or not.
- *
- * @param field Match field.
- * @return true if field is fully wildcarded, false if not.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public boolean isFullyWildcarded(MatchField<?> field) throws UnsupportedOperationException;
-
- /**
- * True if and only if this field is currently partially specified in the match, i.e, the
- * match will only select packets that match (p.value & getMask(field)) == getValue(field),
- * and getMask(field) != 0.
- *
- * @param field Match field.
- * @return true if field is partially masked, false if not.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public boolean isPartiallyMasked(MatchField<?> field) throws UnsupportedOperationException;
-
- /**
- * Returns a builder to build new instances of this type of match object.
- * @return Match builder
- */
- public Builder createBuilder();
-
- /**
- * Builder interface for Match objects.
- * Builder is used to create new Match objects and it creates the match according to the version it
- * corresponds to. The builder uses the same notation of wildcards and masks, and can also throw
- * <code>UnsupportedOperationException</code> if it is asked to create some matching that is not supported in
- * the version it represents.
- *
- * While used, MatchBuilder may not be consistent in terms of field prerequisites. However, user must
- * solve these before using the generated Match object as these prerequisites should be enforced in the
- * getters.
- *
- * @author Yotam Harchol (yotam.harchol@bigswitch.com)
- */
- interface Builder {
- public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException;
-
- public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException;
-
- public boolean supports(MatchField<?> field);
-
- public boolean supportsMasked(MatchField<?> field) throws UnsupportedOperationException;
-
- public boolean isExact(MatchField<?> field) throws UnsupportedOperationException;
-
- public boolean isFullyWildcarded(MatchField<?> field) throws UnsupportedOperationException;
-
- public boolean isPartiallyMasked(MatchField<?> field) throws UnsupportedOperationException;
-
- /**
- * Sets a specific exact value for a field.
- *
- * @param field Match field to set.
- * @param value Value of match field.
- * @return the Builder instance used.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public <F extends OFValueType<F>> Builder setExact(MatchField<F> field, F value) throws UnsupportedOperationException;
-
- /**
- * Sets a masked value for a field.
- *
- * @param field Match field to set.
- * @param value Value of field.
- * @param mask Mask value.
- * @return the Builder instance used.
- * @throws UnsupportedOperationException If field is not supported, if field is supported but does not support masking, or if mask structure is not supported.
- */
- public <F extends OFValueType<F>> Builder setMasked(MatchField<F> field, F value, F mask) throws UnsupportedOperationException;
-
- /**
- * Sets a masked value for a field.
- *
- * @param field Match field to set.
- * @param valueWithMask Compound Masked object contains the value and the mask.
- * @return the Builder instance used.
- * @throws UnsupportedOperationException If field is not supported, if field is supported but does not support masking, or if mask structure is not supported.
- */
- public <F extends OFValueType<F>> Builder setMasked(MatchField<F> field, Masked<F> valueWithMask) throws UnsupportedOperationException;
-
- /**
- * Unsets any value given for the field and wildcards it so that it matches any value.
- *
- * @param field Match field to unset.
- * @return the Builder instance used.
- * @throws UnsupportedOperationException If field is not supported.
- */
- public <F extends OFValueType<F>> Builder wildcard(MatchField<F> field) throws UnsupportedOperationException;
-
- /**
- * Returns the match created by this builder.
- *
- * @return a Match object.
- */
- public Match build();
- }
-}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchField.java
deleted file mode 100644
index cbd3b14..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchField.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.openflow.protocol.match;
-
-import org.openflow.types.ArpOpcode;
-import org.openflow.types.EthType;
-import org.openflow.types.ICMPv4Code;
-import org.openflow.types.ICMPv4Type;
-import org.openflow.types.IPv4;
-import org.openflow.types.IPv6;
-import org.openflow.types.IPv6FlowLabel;
-import org.openflow.types.IpDscp;
-import org.openflow.types.IpEcn;
-import org.openflow.types.IpProtocol;
-import org.openflow.types.MacAddress;
-import org.openflow.types.OFMetadata;
-import org.openflow.types.OFPort;
-import org.openflow.types.OFValueType;
-import org.openflow.types.TransportPort;
-import org.openflow.types.VlanPcp;
-import org.openflow.types.VlanVid;
-
-@SuppressWarnings("unchecked")
-public class MatchField<F extends OFValueType<F>> {
- private final String name;
- public final MatchFields id;
- private final Prerequisite<?>[] prerequisites;
-
- private MatchField(final String name, final MatchFields id, Prerequisite<?>... prerequisites) {
- this.name = name;
- this.id = id;
- this.prerequisites = prerequisites;
- }
-
- public final static MatchField<OFPort> IN_PORT =
- new MatchField<OFPort>("in_port", MatchFields.IN_PORT);
-
- public final static MatchField<OFPort> IN_PHY_PORT =
- new MatchField<OFPort>("in_phy_port", MatchFields.IN_PHY_PORT,
- new Prerequisite<OFPort>(MatchField.IN_PORT));
-
- public final static MatchField<OFMetadata> METADATA =
- new MatchField<OFMetadata>("metadata", MatchFields.METADATA);
-
- public final static MatchField<MacAddress> ETH_DST =
- new MatchField<MacAddress>("eth_dst", MatchFields.ETH_DST);
-
- public final static MatchField<MacAddress> ETH_SRC =
- new MatchField<MacAddress>("eth_src", MatchFields.ETH_SRC);
-
- public final static MatchField<EthType> ETH_TYPE =
- new MatchField<EthType>("eth_type", MatchFields.ETH_TYPE);
-
- public final static MatchField<VlanVid> VLAN_VID =
- new MatchField<VlanVid>("vlan_vid", MatchFields.VLAN_VID);
-
- public final static MatchField<VlanPcp> VLAN_PCP =
- new MatchField<VlanPcp>("vlan_pcp", MatchFields.VLAN_PCP,
- new Prerequisite<VlanVid>(MatchField.VLAN_VID));
-
- public final static MatchField<IpDscp> IP_DSCP =
- new MatchField<IpDscp>("ip_dscp", MatchFields.IP_DSCP,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4, EthType.ETH_TYPE_IPv6));
-
- public final static MatchField<IpEcn> IP_ECN =
- new MatchField<IpEcn>("ip_dscp", MatchFields.IP_ECN,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4, EthType.ETH_TYPE_IPv6));
-
- public final static MatchField<IpProtocol> IP_PROTO =
- new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4, EthType.ETH_TYPE_IPv6));
-
- public final static MatchField<IPv4> IPV4_SRC =
- new MatchField<IPv4>("ipv4_src", MatchFields.IPV4_SRC,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4));
-
- public final static MatchField<IPv4> IPV4_DST =
- new MatchField<IPv4>("ipv4_dst", MatchFields.IPV4_DST,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4));
-
- public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
- "tcp_src", MatchFields.TCP_SRC,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_TCP));
-
- public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>(
- "tcp_dst", MatchFields.TCP_DST,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_TCP));
-
- public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>(
- "udp_src", MatchFields.UDP_SRC,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_UDP));
-
- public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>(
- "udp_dst", MatchFields.UDP_DST,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_UDP));
-
- public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>(
- "sctp_src", MatchFields.SCTP_SRC,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_SCTP));
-
- public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>(
- "sctp_dst", MatchFields.SCTP_DST,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_SCTP));
-
- public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>(
- "icmpv4_src", MatchFields.ICMPV4_TYPE,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_ICMP));
-
- public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>(
- "icmpv4_dst", MatchFields.ICMPV4_CODE,
- new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_ICMP));
-
- public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>(
- "arp_op", MatchFields.ARP_OP,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
-
- public final static MatchField<IPv4> ARP_SPA =
- new MatchField<IPv4>("arp_spa", MatchFields.ARP_SPA,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
-
- public final static MatchField<IPv4> ARP_TPA =
- new MatchField<IPv4>("arp_tpa", MatchFields.ARP_TPA,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
-
- public final static MatchField<MacAddress> ARP_SHA =
- new MatchField<MacAddress>("arp_sha", MatchFields.ARP_SHA,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
-
- public final static MatchField<MacAddress> ARP_THA =
- new MatchField<MacAddress>("arp_tha", MatchFields.ARP_THA,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
-
- public final static MatchField<IPv6> IPV6_SRC =
- new MatchField<IPv6>("ipv6_src", MatchFields.IPV6_SRC,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv6));
-
- public final static MatchField<IPv6> IPV6_DST =
- new MatchField<IPv6>("ipv6_dst", MatchFields.IPV6_DST,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv6));
-
- public final static MatchField<IPv6FlowLabel> IPV6_FLABEL =
- new MatchField<IPv6FlowLabel>("ipv6_flabel", MatchFields.IPV6_FLABEL,
- new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv6));
-
- public String getName() {
- return name;
- }
-
- public boolean arePrerequisitesOK(Match match) {
- for (Prerequisite<?> p : this.prerequisites) {
- if (!p.isSatisfied(match)) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchFields.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchFields.java
deleted file mode 100644
index ed79237..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchFields.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.openflow.protocol.match;
-
-// MUST BE ORDERED BY THE ORDER OF OF SPEC!!!
-public enum MatchFields {
- IN_PORT,
- IN_PHY_PORT,
- METADATA,
- ETH_DST,
- ETH_SRC,
- ETH_TYPE,
- VLAN_VID,
- VLAN_PCP,
- IP_DSCP,
- IP_ECN,
- IP_PROTO,
- IPV4_SRC,
- IPV4_DST,
- TCP_SRC,
- TCP_DST,
- UDP_SRC,
- UDP_DST,
- SCTP_SRC,
- SCTP_DST,
- ICMPV4_TYPE,
- ICMPV4_CODE,
- ARP_OP,
- ARP_SPA,
- ARP_TPA,
- ARP_SHA,
- ARP_THA,
- IPV6_SRC,
- IPV6_DST,
- IPV6_FLABEL,
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Prerequisite.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Prerequisite.java
deleted file mode 100644
index f7afc8b..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Prerequisite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.openflow.protocol.match;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.openflow.types.OFValueType;
-
-public class Prerequisite<T extends OFValueType<T>> {
- private MatchField<T> field;
- private Set<OFValueType<T>> values;
- private boolean any;
-
- public Prerequisite(MatchField<T> field, OFValueType<T>... values) {
- this.values = new HashSet<OFValueType<T>>();
- this.field = field;
- if (values == null || values.length == 0) {
- this.any = true;
- } else {
- this.any = false;
- for (OFValueType<T> value : values) {
- this.values.add(value);
- }
- }
- }
-
- /**
- * Returns true if this prerequisite is satisfied by the given match object.
- *
- * @param match Match object
- * @return true iff prerequisite is satisfied.
- */
- public boolean isSatisfied(Match match) {
- OFValueType<T> res = match.get(this.field);
- if (res == null)
- return false;
- if (this.any)
- return true;
- if (this.values.contains(res)) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver10/ChannelUtilsVer10.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/ver10/ChannelUtilsVer10.java
deleted file mode 100644
index 50acc7f..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver10/ChannelUtilsVer10.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.openflow.protocol.ver10;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFBsnVportQInQ;
-import org.openflow.protocol.match.Match;
-
-/**
- * Collection of helper functions for reading and writing into ChannelBuffers
- *
- * @author capveg
- */
-
-public class ChannelUtilsVer10 {
- public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
- return OFMatchV1Ver10.READER.readFrom(bb);
- }
-
- // TODO these need to be figured out / removed
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
-
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver11/ChannelUtilsVer11.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/ver11/ChannelUtilsVer11.java
deleted file mode 100644
index 1322acd..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver11/ChannelUtilsVer11.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.openflow.protocol.ver11;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFBsnVportQInQ;
-import org.openflow.protocol.OFMatchBmap;
-import org.openflow.protocol.match.Match;
-
-
-/**
- * Collection of helper functions for reading and writing into ChannelBuffers
- *
- * @author capveg
- */
-
-public class ChannelUtilsVer11 {
- public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
- return OFMatchV2Ver11.READER.readFrom(bb);
- }
-
- // TODO these need to be figured out / removed
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
- }
-
-
- public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) {
- throw new UnsupportedOperationException("not implemented");
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver12/ChannelUtilsVer12.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/ver12/ChannelUtilsVer12.java
deleted file mode 100644
index c194fbc..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver12/ChannelUtilsVer12.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.openflow.protocol.ver12;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFBsnVportQInQ;
-import org.openflow.protocol.OFMatchBmap;
-import org.openflow.protocol.match.Match;
-
-
-/**
- * Collection of helper functions for reading and writing into ChannelBuffers
- *
- * @author capveg
- */
-
-public class ChannelUtilsVer12 {
- public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
- return OFMatchV3Ver12.READER.readFrom(bb);
- }
-
- // TODO these need to be figured out / removed
-
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
-
- }
-
- public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) {
- throw new UnsupportedOperationException("not implemented");
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver13/ChannelUtilsVer13.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/ver13/ChannelUtilsVer13.java
deleted file mode 100644
index bcfbdbc..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/ver13/ChannelUtilsVer13.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.openflow.protocol.ver13;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFBsnVportQInQ;
-import org.openflow.protocol.OFMatchBmap;
-import org.openflow.protocol.match.Match;
-
-/**
- * Collection of helper functions for reading and writing into ChannelBuffers
- *
- * @author capveg
- */
-
-public class ChannelUtilsVer13 {
- public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
- return OFMatchV3Ver13.READER.readFrom(bb);
- }
-
- // TODO these need to be figured out / removed
-
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) {
- throw new UnsupportedOperationException("not implemented");
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/ArpOpcode.java b/java_gen/pre-written/src/main/java/org/openflow/types/ArpOpcode.java
deleted file mode 100644
index 01e7bd8..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/ArpOpcode.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-public class ArpOpcode implements OFValueType<ArpOpcode> {
-
- final static int LENGTH = 2;
-
- private static final int ARP_OPCODE_VAL_REQUEST = 1;
- private static final int ARP_OPCODE_VAL_REPLY = 2;
- private static final int ARP_OPCODE_VAL_REQUEST_REVERSE = 3;
- private static final int ARP_OPCODE_VAL_REPLY_REVERSE = 4;
- private static final int ARP_OPCODE_VAL_DRARP_REQUEST = 5;
- private static final int ARP_OPCODE_VAL_DRARP_REPLY = 6;
- private static final int ARP_OPCODE_VAL_DRARP_ERROR = 7;
- private static final int ARP_OPCODE_VAL_INARP_REQUEST = 8;
- private static final int ARP_OPCODE_VAL_INARP_REPLY = 9;
- private static final int ARP_OPCODE_VAL_ARP_NAK = 10;
- private static final int ARP_OPCODE_VAL_MARS_REQUEST = 11;
- private static final int ARP_OPCODE_VAL_MARS_MULTI = 12;
- private static final int ARP_OPCODE_VAL_MARS_MSERV = 13;
- private static final int ARP_OPCODE_VAL_MARS_JOIN = 14;
- private static final int ARP_OPCODE_VAL_MARS_LEAVE = 15;
- private static final int ARP_OPCODE_VAL_MARS_NAK = 16;
- private static final int ARP_OPCODE_VAL_MARS_UNSERV = 17;
- private static final int ARP_OPCODE_VAL_MARS_SJOIN = 18;
- private static final int ARP_OPCODE_VAL_MARS_SLEAVE = 19;
- private static final int ARP_OPCODE_VAL_MARS_GROUPLIST_REQUEST = 20;
- private static final int ARP_OPCODE_VAL_MARS_GROUPLIST_REPLY = 21;
- private static final int ARP_OPCODE_VAL_MARS_REDIRECT_MAP = 22;
- private static final int ARP_OPCODE_VAL_MAPOS_UNARP = 23;
- private static final int ARP_OPCODE_VAL_OP_EXP1 = 24;
- private static final int ARP_OPCODE_VAL_OP_EXP2 = 25;
-
- public static final ArpOpcode ARP_OPCODE_REQUEST = new ArpOpcode(ARP_OPCODE_VAL_REQUEST);
- public static final ArpOpcode ARP_OPCODE_REPLY = new ArpOpcode(ARP_OPCODE_VAL_REPLY);
- public static final ArpOpcode ARP_OPCODE_REQUEST_REVERSE = new ArpOpcode(ARP_OPCODE_VAL_REQUEST_REVERSE);
- public static final ArpOpcode ARP_OPCODE_REPLY_REVERSE = new ArpOpcode(ARP_OPCODE_VAL_REPLY_REVERSE);
- public static final ArpOpcode ARP_OPCODE_DRARP_REQUEST = new ArpOpcode(ARP_OPCODE_VAL_DRARP_REQUEST);
- public static final ArpOpcode ARP_OPCODE_DRARP_REPLY = new ArpOpcode(ARP_OPCODE_VAL_DRARP_REPLY);
- public static final ArpOpcode ARP_OPCODE_DRARP_ERROR = new ArpOpcode(ARP_OPCODE_VAL_DRARP_ERROR);
- public static final ArpOpcode ARP_OPCODE_INARP_REQUEST = new ArpOpcode(ARP_OPCODE_VAL_INARP_REQUEST);
- public static final ArpOpcode ARP_OPCODE_INARP_REPLY = new ArpOpcode(ARP_OPCODE_VAL_INARP_REPLY);
- public static final ArpOpcode ARP_OPCODE_ARP_NAK = new ArpOpcode(ARP_OPCODE_VAL_ARP_NAK);
- public static final ArpOpcode ARP_OPCODE_MARS_REQUEST = new ArpOpcode(ARP_OPCODE_VAL_MARS_REQUEST);
- public static final ArpOpcode ARP_OPCODE_MARS_MULTI = new ArpOpcode(ARP_OPCODE_VAL_MARS_MULTI);
- public static final ArpOpcode ARP_OPCODE_MARS_MSERV = new ArpOpcode(ARP_OPCODE_VAL_MARS_MSERV);
- public static final ArpOpcode ARP_OPCODE_MARS_JOIN = new ArpOpcode(ARP_OPCODE_VAL_MARS_JOIN);
- public static final ArpOpcode ARP_OPCODE_MARS_LEAVE = new ArpOpcode(ARP_OPCODE_VAL_MARS_LEAVE);
- public static final ArpOpcode ARP_OPCODE_MARS_NAK = new ArpOpcode(ARP_OPCODE_VAL_MARS_NAK);
- public static final ArpOpcode ARP_OPCODE_MARS_UNSERV = new ArpOpcode(ARP_OPCODE_VAL_MARS_UNSERV);
- public static final ArpOpcode ARP_OPCODE_MARS_SJOIN = new ArpOpcode(ARP_OPCODE_VAL_MARS_SJOIN);
- public static final ArpOpcode ARP_OPCODE_MARS_SLEAVE = new ArpOpcode(ARP_OPCODE_VAL_MARS_SLEAVE);
- public static final ArpOpcode ARP_OPCODE_MARS_GROUPLIST_REQUEST = new ArpOpcode(ARP_OPCODE_VAL_MARS_GROUPLIST_REQUEST);
- public static final ArpOpcode ARP_OPCODE_MARS_GROUPLIST_REPLY = new ArpOpcode(ARP_OPCODE_VAL_MARS_GROUPLIST_REPLY);
- public static final ArpOpcode ARP_OPCODE_MARS_REDIRECT_MAP = new ArpOpcode(ARP_OPCODE_VAL_MARS_REDIRECT_MAP);
- public static final ArpOpcode ARP_OPCODE_MAPOS_UNARP = new ArpOpcode(ARP_OPCODE_VAL_MAPOS_UNARP);
- public static final ArpOpcode ARP_OPCODE_OP_EXP1 = new ArpOpcode(ARP_OPCODE_VAL_OP_EXP1);
- public static final ArpOpcode ARP_OPCODE_OP_EXP2 = new ArpOpcode(ARP_OPCODE_VAL_OP_EXP2);
-
- private static final int MIN_OPCODE = 0;
- private static final int MAX_OPCODE = 0xFFFF;
-
- public static final ArpOpcode NO_MASK = new ArpOpcode(0xFFFFFFFF);
- public static final ArpOpcode FULL_MASK = new ArpOpcode(0x00000000);
-
- private final int opcode;
-
- private ArpOpcode(int opcode) {
- this.opcode = opcode;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public int getOpcode() {
- return this.opcode;
- }
-
- public static ArpOpcode of(int opcode) {
- if (opcode < MIN_OPCODE || opcode > MAX_OPCODE)
- throw new IllegalArgumentException("Invalid ARP opcode: " + opcode);
- switch (opcode) {
- case ARP_OPCODE_VAL_REQUEST:
- return ARP_OPCODE_REQUEST;
- case ARP_OPCODE_VAL_REPLY:
- return ARP_OPCODE_REPLY;
- case ARP_OPCODE_VAL_REQUEST_REVERSE:
- return ARP_OPCODE_REQUEST_REVERSE;
- case ARP_OPCODE_VAL_REPLY_REVERSE:
- return ARP_OPCODE_REPLY_REVERSE;
- case ARP_OPCODE_VAL_DRARP_REQUEST:
- return ARP_OPCODE_DRARP_REQUEST;
- case ARP_OPCODE_VAL_DRARP_REPLY:
- return ARP_OPCODE_DRARP_REPLY;
- case ARP_OPCODE_VAL_DRARP_ERROR:
- return ARP_OPCODE_DRARP_ERROR;
- case ARP_OPCODE_VAL_INARP_REQUEST:
- return ARP_OPCODE_INARP_REQUEST;
- case ARP_OPCODE_VAL_INARP_REPLY:
- return ARP_OPCODE_INARP_REPLY;
- case ARP_OPCODE_VAL_ARP_NAK:
- return ARP_OPCODE_ARP_NAK;
- case ARP_OPCODE_VAL_MARS_REQUEST:
- return ARP_OPCODE_MARS_REQUEST;
- case ARP_OPCODE_VAL_MARS_MULTI:
- return ARP_OPCODE_MARS_MULTI;
- case ARP_OPCODE_VAL_MARS_MSERV:
- return ARP_OPCODE_MARS_MSERV;
- case ARP_OPCODE_VAL_MARS_JOIN:
- return ARP_OPCODE_MARS_JOIN;
- case ARP_OPCODE_VAL_MARS_LEAVE:
- return ARP_OPCODE_MARS_LEAVE;
- case ARP_OPCODE_VAL_MARS_NAK:
- return ARP_OPCODE_MARS_NAK;
- case ARP_OPCODE_VAL_MARS_UNSERV:
- return ARP_OPCODE_MARS_UNSERV;
- case ARP_OPCODE_VAL_MARS_SJOIN:
- return ARP_OPCODE_MARS_SJOIN;
- case ARP_OPCODE_VAL_MARS_SLEAVE:
- return ARP_OPCODE_MARS_SLEAVE;
- case ARP_OPCODE_VAL_MARS_GROUPLIST_REQUEST:
- return ARP_OPCODE_MARS_GROUPLIST_REQUEST;
- case ARP_OPCODE_VAL_MARS_GROUPLIST_REPLY:
- return ARP_OPCODE_MARS_GROUPLIST_REPLY;
- case ARP_OPCODE_VAL_MARS_REDIRECT_MAP:
- return ARP_OPCODE_MARS_REDIRECT_MAP;
- case ARP_OPCODE_VAL_MAPOS_UNARP:
- return ARP_OPCODE_MAPOS_UNARP;
- case ARP_OPCODE_VAL_OP_EXP1:
- return ARP_OPCODE_OP_EXP1;
- case ARP_OPCODE_VAL_OP_EXP2:
- return ARP_OPCODE_OP_EXP2;
- default:
- return new ArpOpcode(opcode);
- }
- }
-
- public void write2Bytes(ChannelBuffer c) {
- c.writeShort(this.opcode);
- }
-
- public static ArpOpcode read2Bytes(ChannelBuffer c) {
- return ArpOpcode.of(c.readUnsignedShort());
- }
-
- @Override
- public ArpOpcode applyMask(ArpOpcode mask) {
- return ArpOpcode.of(this.opcode & mask.opcode);
- }
-
- public int getOpCode() {
- return opcode;
- }
-
-}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/EthType.java b/java_gen/pre-written/src/main/java/org/openflow/types/EthType.java
deleted file mode 100644
index c451a99..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/EthType.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-
-/**
- * EtherType field representation.
- *
- * @author Yotam Harchol (yotam.harchol@bigswitch.com)
- */
-public class EthType implements OFValueType<EthType> {
- static final int LENGTH = 2;
-
- private final int rawValue;
-
- static final int ETH_TYPE_VAL_IPv4 = 0x0800; // Internet Protocol version 4 (IPv4)
- static final int ETH_TYPE_VAL_ARP = 0x0806; // Address Resolution Protocol (ARP)
- static final int ETH_TYPE_VAL_WAKE_ON_LAN = 0x0842; // Wake-on-LAN[3]
- static final int ETH_TYPE_VAL_TRILL = 0x22F3; // IETF TRILL Protocol
- static final int ETH_TYPE_VAL_DECNET_IV = 0x6003; // DECnet Phase IV
- static final int ETH_TYPE_VAL_REV_ARP = 0x8035; // Reverse Address Resolution Protocol
- static final int ETH_TYPE_VAL_APPLE_TALK = 0x809B; // AppleTalk (Ethertalk)
- static final int ETH_TYPE_VAL_APPLE_TALK_ARP = 0x80F3; // AppleTalk Address Resolution Protocol (AARP)
- static final int ETH_TYPE_VAL_VLAN_FRAME = 0x8100; // VLAN-tagged frame (IEEE 802.1Q) & Shortest Path Bridging IEEE 802.1aq[4]
- static final int ETH_TYPE_VAL_IPX_8137 = 0x8137; // IPX
- static final int ETH_TYPE_VAL_IPX_8138 = 0x8138; // IPX
- static final int ETH_TYPE_VAL_QNX = 0x8204; // QNX Qnet
- static final int ETH_TYPE_VAL_IPv6 = 0x86DD; // Internet Protocol Version 6 (IPv6)
- static final int ETH_TYPE_VAL_ETH_FLOW = 0x8808; // Ethernet flow control
- static final int ETH_TYPE_VAL_SLOW_PROTOCOLS = 0x8809; // Slow Protocols (IEEE 802.3)
- static final int ETH_TYPE_VAL_COBRANET = 0x8819; // CobraNet
- static final int ETH_TYPE_VAL_MPLS_UNICAST = 0x8847; // MPLS unicast
- static final int ETH_TYPE_VAL_MPLS_MULTICAST = 0x8848; // MPLS multicast
- static final int ETH_TYPE_VAL_PPPoE_DISCOVERY = 0x8863; // PPPoE Discovery Stage
- static final int ETH_TYPE_VAL_PPPoE_SESSION = 0x8864; // PPPoE Session Stage
- static final int ETH_TYPE_VAL_JUMBO_FRAMES = 0x8870; // Jumbo Frames
- static final int ETH_TYPE_VAL_HOMEPLUG_10 = 0x887B; // HomePlug 1.0 MME
- static final int ETH_TYPE_VAL_EAP_OVER_LAN = 0x888E; // EAP over LAN (IEEE 802.1X)
- static final int ETH_TYPE_VAL_PROFINET = 0x8892; // PROFINET Protocol
- static final int ETH_TYPE_VAL_HYPERSCSI = 0x889A; // HyperSCSI (SCSI over Ethernet)
- static final int ETH_TYPE_VAL_ATA_OVER_ETH = 0x88A2; // ATA over Ethernet
- static final int ETH_TYPE_VAL_ETHERCAT = 0x88A4; // EtherCAT Protocol
- static final int ETH_TYPE_VAL_BRIDGING = 0x88A8; // Provider Bridging (IEEE 802.1ad) & Shortest Path Bridging IEEE 802.1aq[5]
- static final int ETH_TYPE_VAL_POWERLINK = 0x88AB; // Ethernet Powerlink[citation needed]
- static final int ETH_TYPE_VAL_LLDP = 0x88CC; // Link Layer Discovery Protocol (LLDP)
- static final int ETH_TYPE_VAL_SERCOS = 0x88CD; // SERCOS III
- static final int ETH_TYPE_VAL_HOMEPLUG_AV = 0x88E1; // HomePlug AV MME[citation needed]
- static final int ETH_TYPE_VAL_MRP = 0x88E3; // Media Redundancy Protocol (IEC62439-2)
- static final int ETH_TYPE_VAL_MAC_SEC = 0x88E5; // MAC security (IEEE 802.1AE)
- static final int ETH_TYPE_VAL_PTP = 0x88F7; // Precision Time Protocol (IEEE 1588)
- static final int ETH_TYPE_VAL_CFM = 0x8902; // IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)
- static final int ETH_TYPE_VAL_FCoE = 0x8906; // Fibre Channel over Ethernet (FCoE)
- static final int ETH_TYPE_VAL_FCoE_INIT = 0x8914; // FCoE Initialization Protocol
- static final int ETH_TYPE_VAL_RoCE = 0x8915; // RDMA over Converged Ethernet (RoCE)
- static final int ETH_TYPE_VAL_HSR = 0x892F; // High-availability Seamless Redundancy (HSR)
- static final int ETH_TYPE_VAL_CONF_TEST = 0x9000; // Ethernet Configuration Testing Protocol[6]
- static final int ETH_TYPE_VAL_Q_IN_Q = 0x9100; // Q-in-Q
- static final int ETH_TYPE_VAL_LLT = 0xCAFE; // Veritas Low Latency Transport (LLT)[7] for Veritas Cluster Server
-
- public static final EthType ETH_TYPE_IPv4 = new EthType(ETH_TYPE_VAL_IPv4);
- public static final EthType ETH_TYPE_ARP = new EthType(ETH_TYPE_VAL_ARP);
- public static final EthType ETH_TYPE_WAKE_ON_LAN = new EthType(ETH_TYPE_VAL_WAKE_ON_LAN);
- public static final EthType ETH_TYPE_TRILL = new EthType(ETH_TYPE_VAL_TRILL);
- public static final EthType ETH_TYPE_DECNET_IV = new EthType(ETH_TYPE_VAL_DECNET_IV);
- public static final EthType ETH_TYPE_REV_ARP = new EthType(ETH_TYPE_VAL_REV_ARP );
- public static final EthType ETH_TYPE_APPLE_TALK = new EthType(ETH_TYPE_VAL_APPLE_TALK);
- public static final EthType ETH_TYPE_APPLE_TALK_ARP = new EthType(ETH_TYPE_VAL_APPLE_TALK_ARP);
- public static final EthType ETH_TYPE_VLAN_FRAME = new EthType(ETH_TYPE_VAL_VLAN_FRAME );
- public static final EthType ETH_TYPE_IPX_8137 = new EthType(ETH_TYPE_VAL_IPX_8137 );
- public static final EthType ETH_TYPE_IPX_8138 = new EthType(ETH_TYPE_VAL_IPX_8138 );
- public static final EthType ETH_TYPE_QNX = new EthType(ETH_TYPE_VAL_QNX );
- public static final EthType ETH_TYPE_IPv6 = new EthType(ETH_TYPE_VAL_IPv6 );
- public static final EthType ETH_TYPE_ETH_FLOW = new EthType(ETH_TYPE_VAL_ETH_FLOW);
- public static final EthType ETH_TYPE_SLOW_PROTOCOLS = new EthType(ETH_TYPE_VAL_SLOW_PROTOCOLS );
- public static final EthType ETH_TYPE_COBRANET = new EthType(ETH_TYPE_VAL_COBRANET );
- public static final EthType ETH_TYPE_MPLS_UNICAST = new EthType(ETH_TYPE_VAL_MPLS_UNICAST );
- public static final EthType ETH_TYPE_MPLS_MULTICAST = new EthType(ETH_TYPE_VAL_MPLS_MULTICAST );
- public static final EthType ETH_TYPE_PPPoE_DISCOVERY = new EthType(ETH_TYPE_VAL_PPPoE_DISCOVERY);
- public static final EthType ETH_TYPE_PPPoE_SESSION = new EthType(ETH_TYPE_VAL_PPPoE_SESSION );
- public static final EthType ETH_TYPE_JUMBO_FRAMES = new EthType(ETH_TYPE_VAL_JUMBO_FRAMES );
- public static final EthType ETH_TYPE_HOMEPLUG_10 = new EthType(ETH_TYPE_VAL_HOMEPLUG_10 );
- public static final EthType ETH_TYPE_EAP_OVER_LAN = new EthType(ETH_TYPE_VAL_EAP_OVER_LAN );
- public static final EthType ETH_TYPE_PROFINET = new EthType(ETH_TYPE_VAL_PROFINET );
- public static final EthType ETH_TYPE_HYPERSCSI = new EthType(ETH_TYPE_VAL_HYPERSCSI );
- public static final EthType ETH_TYPE_ATA_OVER_ETH = new EthType(ETH_TYPE_VAL_ATA_OVER_ETH);
- public static final EthType ETH_TYPE_ETHERCAT = new EthType(ETH_TYPE_VAL_ETHERCAT );
- public static final EthType ETH_TYPE_BRIDGING = new EthType(ETH_TYPE_VAL_BRIDGING );
- public static final EthType ETH_TYPE_POWERLINK = new EthType(ETH_TYPE_VAL_POWERLINK );
- public static final EthType ETH_TYPE_LLDP = new EthType(ETH_TYPE_VAL_LLDP );
- public static final EthType ETH_TYPE_SERCOS = new EthType(ETH_TYPE_VAL_SERCOS );
- public static final EthType ETH_TYPE_HOMEPLUG_AV = new EthType(ETH_TYPE_VAL_HOMEPLUG_AV );
- public static final EthType ETH_TYPE_MRP = new EthType(ETH_TYPE_VAL_MRP );
- public static final EthType ETH_TYPE_MAC_SEC = new EthType(ETH_TYPE_VAL_MAC_SEC);
- public static final EthType ETH_TYPE_PTP = new EthType(ETH_TYPE_VAL_PTP );
- public static final EthType ETH_TYPE_CFM = new EthType(ETH_TYPE_VAL_CFM );
- public static final EthType ETH_TYPE_FCoE = new EthType(ETH_TYPE_VAL_FCoE );
- public static final EthType ETH_TYPE_FCoE_INIT = new EthType(ETH_TYPE_VAL_FCoE_INIT );
- public static final EthType ETH_TYPE_RoCE = new EthType(ETH_TYPE_VAL_RoCE );
- public static final EthType ETH_TYPE_HSR = new EthType(ETH_TYPE_VAL_HSR );
- public static final EthType ETH_TYPE_CONF_TEST = new EthType(ETH_TYPE_VAL_CONF_TEST );
- public static final EthType ETH_TYPE_Q_IN_Q = new EthType(ETH_TYPE_VAL_Q_IN_Q );
- public static final EthType ETH_TYPE_LLT = new EthType(ETH_TYPE_VAL_LLT );
-
- public static final EthType NO_MASK = new EthType(0xFFFFFFFF);
- public static final EthType FULL_MASK = new EthType(0x00000000);
-
- private EthType(int type) {
- this.rawValue = type;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public static EthType of(int type) {
- switch (type) {
- case ETH_TYPE_VAL_IPv4:
- return ETH_TYPE_IPv4;
- case ETH_TYPE_VAL_ARP:
- return ETH_TYPE_ARP;
- case ETH_TYPE_VAL_WAKE_ON_LAN:
- return ETH_TYPE_WAKE_ON_LAN;
- case ETH_TYPE_VAL_TRILL:
- return ETH_TYPE_TRILL;
- case ETH_TYPE_VAL_DECNET_IV:
- return ETH_TYPE_DECNET_IV;
- case ETH_TYPE_VAL_REV_ARP:
- return ETH_TYPE_REV_ARP;
- case ETH_TYPE_VAL_APPLE_TALK:
- return ETH_TYPE_APPLE_TALK;
- case ETH_TYPE_VAL_APPLE_TALK_ARP:
- return ETH_TYPE_APPLE_TALK_ARP;
- case ETH_TYPE_VAL_VLAN_FRAME:
- return ETH_TYPE_VLAN_FRAME;
- case ETH_TYPE_VAL_IPX_8137:
- return ETH_TYPE_IPX_8137;
- case ETH_TYPE_VAL_IPX_8138:
- return ETH_TYPE_IPX_8138;
- case ETH_TYPE_VAL_QNX:
- return ETH_TYPE_QNX;
- case ETH_TYPE_VAL_IPv6:
- return ETH_TYPE_IPv6;
- case ETH_TYPE_VAL_ETH_FLOW:
- return ETH_TYPE_ETH_FLOW;
- case ETH_TYPE_VAL_SLOW_PROTOCOLS:
- return ETH_TYPE_SLOW_PROTOCOLS;
- case ETH_TYPE_VAL_COBRANET:
- return ETH_TYPE_COBRANET;
- case ETH_TYPE_VAL_MPLS_UNICAST:
- return ETH_TYPE_MPLS_UNICAST;
- case ETH_TYPE_VAL_MPLS_MULTICAST:
- return ETH_TYPE_MPLS_MULTICAST;
- case ETH_TYPE_VAL_PPPoE_DISCOVERY:
- return ETH_TYPE_PPPoE_DISCOVERY;
- case ETH_TYPE_VAL_PPPoE_SESSION:
- return ETH_TYPE_PPPoE_SESSION;
- case ETH_TYPE_VAL_JUMBO_FRAMES:
- return ETH_TYPE_JUMBO_FRAMES;
- case ETH_TYPE_VAL_HOMEPLUG_10:
- return ETH_TYPE_HOMEPLUG_10;
- case ETH_TYPE_VAL_EAP_OVER_LAN:
- return ETH_TYPE_EAP_OVER_LAN;
- case ETH_TYPE_VAL_PROFINET:
- return ETH_TYPE_PROFINET;
- case ETH_TYPE_VAL_HYPERSCSI:
- return ETH_TYPE_HYPERSCSI;
- case ETH_TYPE_VAL_ATA_OVER_ETH:
- return ETH_TYPE_ATA_OVER_ETH;
- case ETH_TYPE_VAL_ETHERCAT:
- return ETH_TYPE_ETHERCAT;
- case ETH_TYPE_VAL_BRIDGING:
- return ETH_TYPE_BRIDGING;
- case ETH_TYPE_VAL_POWERLINK:
- return ETH_TYPE_POWERLINK;
- case ETH_TYPE_VAL_LLDP:
- return ETH_TYPE_LLDP;
- case ETH_TYPE_VAL_SERCOS:
- return ETH_TYPE_SERCOS;
- case ETH_TYPE_VAL_HOMEPLUG_AV:
- return ETH_TYPE_HOMEPLUG_AV;
- case ETH_TYPE_VAL_MRP:
- return ETH_TYPE_MRP;
- case ETH_TYPE_VAL_MAC_SEC:
- return ETH_TYPE_MAC_SEC;
- case ETH_TYPE_VAL_PTP:
- return ETH_TYPE_PTP;
- case ETH_TYPE_VAL_CFM:
- return ETH_TYPE_CFM;
- case ETH_TYPE_VAL_FCoE:
- return ETH_TYPE_FCoE;
- case ETH_TYPE_VAL_FCoE_INIT:
- return ETH_TYPE_FCoE_INIT;
- case ETH_TYPE_VAL_RoCE:
- return ETH_TYPE_RoCE;
- case ETH_TYPE_VAL_HSR:
- return ETH_TYPE_HSR;
- case ETH_TYPE_VAL_CONF_TEST:
- return ETH_TYPE_CONF_TEST;
- case ETH_TYPE_VAL_Q_IN_Q:
- return ETH_TYPE_Q_IN_Q;
- case ETH_TYPE_VAL_LLT:
- return ETH_TYPE_LLT;
- default:
- // TODO: What's here?
- return new EthType(type);
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof EthType))
- return false;
- EthType o = (EthType)obj;
- if (o.rawValue != this.rawValue)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 37;
- int result = 1;
- result = prime * result + rawValue;
- return result;
- }
-
- @Override
- public String toString() {
- return Integer.toHexString(rawValue);
- }
-
- public void write2Bytes(ChannelBuffer c) {
- c.writeShort(this.rawValue);
- }
-
- public static EthType read2Bytes(ChannelBuffer c) {
- return EthType.of(c.readUnsignedShort());
- }
-
- @Override
- public EthType applyMask(EthType mask) {
- return EthType.of(this.rawValue & mask.rawValue);
- }
-
- public int getValue() {
- return rawValue;
- }
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/ICMPv4Code.java b/java_gen/pre-written/src/main/java/org/openflow/types/ICMPv4Code.java
deleted file mode 100644
index 724170e..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/ICMPv4Code.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-/**
- *
- * @author Yotam Harchol (yotam.harchol@bigswitch.com)
- *
- */
-public class ICMPv4Code implements OFValueType<ICMPv4Code> {
-
- final static int LENGTH = 1;
- final static short MAX_CODE = 0xFF;
-
- private final short code;
-
- public static final ICMPv4Code NO_MASK = new ICMPv4Code((short)0xFFFF);
- public static final ICMPv4Code FULL_MASK = new ICMPv4Code((short)0x0000);
-
- private ICMPv4Code(short code) {
- this.code = code;
- }
-
- public static ICMPv4Code of(short code) {
- if (code > MAX_CODE || code < 0)
- throw new IllegalArgumentException("Illegal ICMPv4 code: " + code);
- return new ICMPv4Code(code);
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public short getCode() {
- return code;
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeByte(this.code);
- }
-
- public static ICMPv4Code readByte(ChannelBuffer c) {
- return ICMPv4Code.of(c.readUnsignedByte());
- }
-
- @Override
- public ICMPv4Code applyMask(ICMPv4Code mask) {
- return ICMPv4Code.of((short)(this.code & mask.code));
- }
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/ICMPv4Type.java b/java_gen/pre-written/src/main/java/org/openflow/types/ICMPv4Type.java
deleted file mode 100644
index 7aa45d8..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/ICMPv4Type.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-public class ICMPv4Type implements OFValueType<ICMPv4Type> {
-
- final static int LENGTH = 1;
-
- private static final short ICMPV4_TYPE_VAL_ECHO_REPLY = 0;
- private static final short ICMPV4_TYPE_VAL_DESTINATION_UNREACHABLE = 3;
- private static final short ICMPV4_TYPE_VAL_SOURCE_QUENCH = 4;
- private static final short ICMPV4_TYPE_VAL_REDIRECT = 5;
- private static final short ICMPV4_TYPE_VAL_ALTERNATE_HOST_ADDRESS = 6;
- private static final short ICMPV4_TYPE_VAL_ECHO = 8;
- private static final short ICMPV4_TYPE_VAL_ROUTER_ADVERTISEMENT = 9;
- private static final short ICMPV4_TYPE_VAL_ROUTER_SOLICITATION = 10;
- private static final short ICMPV4_TYPE_VAL_TIME_EXCEEDED = 11;
- private static final short ICMPV4_TYPE_VAL_PARAMETER_PROBLEM = 12;
- private static final short ICMPV4_TYPE_VAL_TIMESTAMP = 13;
- private static final short ICMPV4_TYPE_VAL_TIMESTAMP_REPLY = 14;
- private static final short ICMPV4_TYPE_VAL_INFORMATION_REQUEST = 15;
- private static final short ICMPV4_TYPE_VAL_INFORMATION_REPLY = 16;
- private static final short ICMPV4_TYPE_VAL_ADDRESS_MASK_REQUEST = 17;
- private static final short ICMPV4_TYPE_VAL_ADDRESS_MASK_REPLY = 18;
- private static final short ICMPV4_TYPE_VAL_TRACEROUTE = 30;
- private static final short ICMPV4_TYPE_VAL_DATAGRAM_CONVERSION_ERROR = 31;
- private static final short ICMPV4_TYPE_VAL_MOBILE_HOST_REDIRECT = 32;
- private static final short ICMPV4_TYPE_VAL_IPV6_WHERE_ARE_YOU = 33;
- private static final short ICMPV4_TYPE_VAL_IPV6_I_AM_HERE = 34;
- private static final short ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REQUEST = 35;
- private static final short ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REPLY = 36;
- private static final short ICMPV4_TYPE_VAL_DOMAIN_NAME_REQUEST = 37;
- private static final short ICMPV4_TYPE_VAL_DOMAIN_NAME_REPLY = 38;
- private static final short ICMPV4_TYPE_VAL_SKIP = 39;
- private static final short ICMPV4_TYPE_VAL_PHOTURIS = 40;
- private static final short ICMPV4_TYPE_VAL_EXPERIMENTAL_MOBILITY = 41;
-
- public static final ICMPv4Type ICMPV4_TYPE_ECHO_REPLY = new ICMPv4Type(ICMPV4_TYPE_VAL_ECHO_REPLY);
- public static final ICMPv4Type ICMPV4_TYPE_DESTINATION_UNREACHABLE = new ICMPv4Type(ICMPV4_TYPE_VAL_DESTINATION_UNREACHABLE);
- public static final ICMPv4Type ICMPV4_TYPE_SOURCE_QUENCH = new ICMPv4Type(ICMPV4_TYPE_VAL_SOURCE_QUENCH);
- public static final ICMPv4Type ICMPV4_TYPE_REDIRECT = new ICMPv4Type(ICMPV4_TYPE_VAL_REDIRECT);
- public static final ICMPv4Type ICMPV4_TYPE_ALTERNATE_HOST_ADDRESS = new ICMPv4Type(ICMPV4_TYPE_VAL_ALTERNATE_HOST_ADDRESS);
- public static final ICMPv4Type ICMPV4_TYPE_ECHO = new ICMPv4Type(ICMPV4_TYPE_VAL_ECHO);
- public static final ICMPv4Type ICMPV4_TYPE_ROUTER_ADVERTISEMENT = new ICMPv4Type(ICMPV4_TYPE_VAL_ROUTER_ADVERTISEMENT);
- public static final ICMPv4Type ICMPV4_TYPE_ROUTER_SOLICITATION = new ICMPv4Type(ICMPV4_TYPE_VAL_ROUTER_SOLICITATION);
- public static final ICMPv4Type ICMPV4_TYPE_TIME_EXCEEDED = new ICMPv4Type(ICMPV4_TYPE_VAL_TIME_EXCEEDED);
- public static final ICMPv4Type ICMPV4_TYPE_PARAMETER_PROBLEM = new ICMPv4Type(ICMPV4_TYPE_VAL_PARAMETER_PROBLEM);
- public static final ICMPv4Type ICMPV4_TYPE_TIMESTAMP = new ICMPv4Type(ICMPV4_TYPE_VAL_TIMESTAMP);
- public static final ICMPv4Type ICMPV4_TYPE_TIMESTAMP_REPLY = new ICMPv4Type(ICMPV4_TYPE_VAL_TIMESTAMP_REPLY);
- public static final ICMPv4Type ICMPV4_TYPE_INFORMATION_REQUEST = new ICMPv4Type(ICMPV4_TYPE_VAL_INFORMATION_REQUEST);
- public static final ICMPv4Type ICMPV4_TYPE_INFORMATION_REPLY = new ICMPv4Type(ICMPV4_TYPE_VAL_INFORMATION_REPLY);
- public static final ICMPv4Type ICMPV4_TYPE_ADDRESS_MASK_REQUEST = new ICMPv4Type(ICMPV4_TYPE_VAL_ADDRESS_MASK_REQUEST);
- public static final ICMPv4Type ICMPV4_TYPE_ADDRESS_MASK_REPLY = new ICMPv4Type(ICMPV4_TYPE_VAL_ADDRESS_MASK_REPLY);
- public static final ICMPv4Type ICMPV4_TYPE_TRACEROUTE = new ICMPv4Type(ICMPV4_TYPE_VAL_TRACEROUTE);
- public static final ICMPv4Type ICMPV4_TYPE_DATAGRAM_CONVERSION_ERROR = new ICMPv4Type(ICMPV4_TYPE_VAL_DATAGRAM_CONVERSION_ERROR);
- public static final ICMPv4Type ICMPV4_TYPE_MOBILE_HOST_REDIRECT = new ICMPv4Type(ICMPV4_TYPE_VAL_MOBILE_HOST_REDIRECT);
- public static final ICMPv4Type ICMPV4_TYPE_IPV6_WHERE_ARE_YOU = new ICMPv4Type(ICMPV4_TYPE_VAL_IPV6_WHERE_ARE_YOU);
- public static final ICMPv4Type ICMPV4_TYPE_IPV6_I_AM_HERE = new ICMPv4Type(ICMPV4_TYPE_VAL_IPV6_I_AM_HERE);
- public static final ICMPv4Type ICMPV4_TYPE_MOBILE_REGISTRATION_REQUEST = new ICMPv4Type(ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REQUEST);
- public static final ICMPv4Type ICMPV4_TYPE_MOBILE_REGISTRATION_REPLY = new ICMPv4Type(ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REPLY);
- public static final ICMPv4Type ICMPV4_TYPE_DOMAIN_NAME_REQUEST = new ICMPv4Type(ICMPV4_TYPE_VAL_DOMAIN_NAME_REQUEST);
- public static final ICMPv4Type ICMPV4_TYPE_DOMAIN_NAME_REPLY = new ICMPv4Type(ICMPV4_TYPE_VAL_DOMAIN_NAME_REPLY);
- public static final ICMPv4Type ICMPV4_TYPE_SKIP = new ICMPv4Type(ICMPV4_TYPE_VAL_SKIP);
- public static final ICMPv4Type ICMPV4_TYPE_PHOTURIS = new ICMPv4Type(ICMPV4_TYPE_VAL_PHOTURIS);
- public static final ICMPv4Type ICMPV4_TYPE_EXPERIMENTAL_MOBILITY = new ICMPv4Type(ICMPV4_TYPE_VAL_EXPERIMENTAL_MOBILITY);
-
- public static final ICMPv4Type NO_MASK = new ICMPv4Type((short)0xFFFF);
- public static final ICMPv4Type FULL_MASK = new ICMPv4Type((short)0x0000);
-
- private final short type;
-
- private static final int MIN_TYPE = 0;
- private static final int MAX_TYPE = 0xFF;
-
- private ICMPv4Type(short type) {
- this.type = type;
- }
-
- public static ICMPv4Type of(short type) {
- if (type < MIN_TYPE || type > MAX_TYPE)
- throw new IllegalArgumentException("Invalid ICMPv4 type: " + type);
- switch (type) {
- case ICMPV4_TYPE_VAL_ECHO_REPLY:
- return ICMPV4_TYPE_ECHO_REPLY;
- case ICMPV4_TYPE_VAL_DESTINATION_UNREACHABLE:
- return ICMPV4_TYPE_DESTINATION_UNREACHABLE;
- case ICMPV4_TYPE_VAL_SOURCE_QUENCH:
- return ICMPV4_TYPE_SOURCE_QUENCH;
- case ICMPV4_TYPE_VAL_REDIRECT:
- return ICMPV4_TYPE_REDIRECT;
- case ICMPV4_TYPE_VAL_ALTERNATE_HOST_ADDRESS:
- return ICMPV4_TYPE_ALTERNATE_HOST_ADDRESS;
- case ICMPV4_TYPE_VAL_ECHO:
- return ICMPV4_TYPE_ECHO;
- case ICMPV4_TYPE_VAL_ROUTER_ADVERTISEMENT:
- return ICMPV4_TYPE_ROUTER_ADVERTISEMENT;
- case ICMPV4_TYPE_VAL_ROUTER_SOLICITATION:
- return ICMPV4_TYPE_ROUTER_SOLICITATION;
- case ICMPV4_TYPE_VAL_TIME_EXCEEDED:
- return ICMPV4_TYPE_TIME_EXCEEDED;
- case ICMPV4_TYPE_VAL_PARAMETER_PROBLEM:
- return ICMPV4_TYPE_PARAMETER_PROBLEM;
- case ICMPV4_TYPE_VAL_TIMESTAMP:
- return ICMPV4_TYPE_TIMESTAMP;
- case ICMPV4_TYPE_VAL_TIMESTAMP_REPLY:
- return ICMPV4_TYPE_TIMESTAMP_REPLY;
- case ICMPV4_TYPE_VAL_INFORMATION_REQUEST:
- return ICMPV4_TYPE_INFORMATION_REQUEST;
- case ICMPV4_TYPE_VAL_INFORMATION_REPLY:
- return ICMPV4_TYPE_INFORMATION_REPLY;
- case ICMPV4_TYPE_VAL_ADDRESS_MASK_REQUEST:
- return ICMPV4_TYPE_ADDRESS_MASK_REQUEST;
- case ICMPV4_TYPE_VAL_ADDRESS_MASK_REPLY:
- return ICMPV4_TYPE_ADDRESS_MASK_REPLY;
- case ICMPV4_TYPE_VAL_TRACEROUTE:
- return ICMPV4_TYPE_TRACEROUTE;
- case ICMPV4_TYPE_VAL_DATAGRAM_CONVERSION_ERROR:
- return ICMPV4_TYPE_DATAGRAM_CONVERSION_ERROR;
- case ICMPV4_TYPE_VAL_MOBILE_HOST_REDIRECT:
- return ICMPV4_TYPE_MOBILE_HOST_REDIRECT;
- case ICMPV4_TYPE_VAL_IPV6_WHERE_ARE_YOU:
- return ICMPV4_TYPE_IPV6_WHERE_ARE_YOU;
- case ICMPV4_TYPE_VAL_IPV6_I_AM_HERE:
- return ICMPV4_TYPE_IPV6_I_AM_HERE;
- case ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REQUEST:
- return ICMPV4_TYPE_MOBILE_REGISTRATION_REQUEST;
- case ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REPLY:
- return ICMPV4_TYPE_MOBILE_REGISTRATION_REPLY;
- case ICMPV4_TYPE_VAL_DOMAIN_NAME_REQUEST:
- return ICMPV4_TYPE_DOMAIN_NAME_REQUEST;
- case ICMPV4_TYPE_VAL_DOMAIN_NAME_REPLY:
- return ICMPV4_TYPE_DOMAIN_NAME_REPLY;
- case ICMPV4_TYPE_VAL_SKIP:
- return ICMPV4_TYPE_SKIP;
- case ICMPV4_TYPE_VAL_PHOTURIS:
- return ICMPV4_TYPE_PHOTURIS;
- case ICMPV4_TYPE_VAL_EXPERIMENTAL_MOBILITY:
- return ICMPV4_TYPE_EXPERIMENTAL_MOBILITY;
- default:
- return new ICMPv4Type(type);
- }
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public short getType() {
- return type;
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeByte(this.type);
- }
-
- public static ICMPv4Type readByte(ChannelBuffer c) {
- return ICMPv4Type.of(c.readUnsignedByte());
- }
-
- @Override
- public ICMPv4Type applyMask(ICMPv4Type mask) {
- return ICMPv4Type.of((short)(this.type & mask.type));
- }
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IPv4.java b/java_gen/pre-written/src/main/java/org/openflow/types/IPv4.java
deleted file mode 100644
index da6f126..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IPv4.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-
-
-/**
- * Wrapper around an IPv4 address
- *
- * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
- */
-public class IPv4 implements OFValueType<IPv4> {
- static final int LENGTH = 4;
- private final int rawValue;
-
- public static final IPv4 NO_MASK = IPv4.of(0xFFFFFFFF);
- public static final IPv4 FULL_MASK = IPv4.of(0x00000000);
-
- private IPv4(final int rawValue) {
- this.rawValue = rawValue;
- }
-
- public static IPv4 of(final byte[] address) {
- if (address.length != LENGTH) {
- throw new IllegalArgumentException(
- "Invalid byte array length for IPv4 address: " + address);
- }
-
- int raw =
- (address[0] & 0xFF) << 24 | (address[1] & 0xFF) << 16
- | (address[2] & 0xFF) << 8 | (address[3] & 0xFF) << 0;
- return IPv4.of(raw);
- }
-
- public static IPv4 of(final int raw) {
- return new IPv4(raw);
- }
-
- public static IPv4 of(final String string) {
- int start = 0;
- int shift = 24;
-
- int raw = 0;
- while (shift >= 0) {
- int end = string.indexOf('.', start);
- if (end == start || !((shift > 0) ^ (end < 0)))
- throw new IllegalArgumentException("IP Address not well formed: " + string);
-
- String substr =
- end > 0 ? string.substring(start, end) : string.substring(start);
- int val = Integer.parseInt(substr);
- if (val < 0 || val > 255)
- throw new IllegalArgumentException("IP Address not well formed: " + string);
-
- raw |= val << shift;
-
- shift -= 8;
- start = end + 1;
- }
- return IPv4.of(raw);
- }
-
- public int getInt() {
- return rawValue;
- }
-
- volatile byte[] bytesCache = null;
-
- public byte[] getBytes() {
- if (bytesCache == null) {
- synchronized (this) {
- if (bytesCache == null) {
- bytesCache =
- new byte[] { (byte) ((rawValue >>> 24) & 0xFF),
- (byte) ((rawValue >>> 16) & 0xFF),
- (byte) ((rawValue >>> 8) & 0xFF),
- (byte) ((rawValue >>> 0) & 0xFF) };
- }
- }
- }
- return bytesCache;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public String toString() {
- StringBuilder res = new StringBuilder();
- res.append((rawValue >> 24) & 0xFF).append('.');
- res.append((rawValue >> 16) & 0xFF).append('.');
- res.append((rawValue >> 8) & 0xFF).append('.');
- res.append((rawValue >> 0) & 0xFF);
- return res.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + rawValue;
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- IPv4 other = (IPv4) obj;
- if (rawValue != other.rawValue)
- return false;
- return true;
- }
-
- public void write4Bytes(ChannelBuffer c) {
- c.writeInt(rawValue);
- }
-
- public static IPv4 read4Bytes(ChannelBuffer c) {
- return IPv4.of(c.readInt());
- }
-
- @Override
- public IPv4 applyMask(IPv4 mask) {
- return IPv4.of(this.rawValue & mask.rawValue);
- }
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IPv4WithMask.java b/java_gen/pre-written/src/main/java/org/openflow/types/IPv4WithMask.java
deleted file mode 100644
index 6ea4aa1..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IPv4WithMask.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.openflow.types;
-
-public class IPv4WithMask extends Masked<IPv4> {
-
- private IPv4WithMask(int rawValue, int rawMask) {
- super(IPv4.of(rawValue), IPv4.of(rawMask));
- }
-
- private IPv4WithMask(IPv4 value, IPv4 mask) {
- super(value, mask);
- }
-
- public static IPv4WithMask of(int rawValue, int rawMask) {
- return new IPv4WithMask(rawValue, rawMask);
- }
-
- public static IPv4WithMask of(IPv4 value, IPv4 mask) {
- return new IPv4WithMask(value, mask);
- }
-
- @Override
- public String toString() {
- StringBuilder res = new StringBuilder();
- res.append(((IPv4)value).toString());
-
- int maskint = ((IPv4)mask).getInt();
- res.append('/');
- if (Integer.bitCount((~maskint) + 1) == 1) {
- // CIDR notation
- res.append(Integer.bitCount(maskint));
- } else {
- // Full address mask
- res.append(((IPv4)mask).toString());
- }
-
- return res.toString();
- }
-
- public static IPv4WithMask of(final String string) {
- int slashPos;
- String ip = string;
- int maskBits = 0;
- IPv4 maskAddress = null;
-
- // Read mask suffix
- if ((slashPos = string.indexOf('/')) != -1) {
- ip = string.substring(0, slashPos);
- try {
- String suffix = string.substring(slashPos + 1);
- if (suffix.length() == 0)
- throw new IllegalArgumentException("IP Address not well formed: " + string);
- if (suffix.indexOf('.') != -1) {
- // Full mask
- maskAddress = IPv4.of(suffix);
- } else {
- // CIDR Suffix
- maskBits = Integer.parseInt(suffix);
- }
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("IP Address not well formed: " + string);
- }
- if (maskBits < 0 || maskBits > 32) {
- throw new IllegalArgumentException("IP Address not well formed: " + string);
- }
- }
-
- // Read IP
- IPv4 ipv4 = IPv4.of(ip);
-
- if (maskAddress != null) {
- // Full address mask
- return IPv4WithMask.of(ipv4, maskAddress);
- } else if (maskBits == 0) {
- // No mask
- return IPv4WithMask.of(ipv4, IPv4.NO_MASK);
- } else {
- // With mask
- int mask = (-1) << (32 - maskBits);
- return IPv4WithMask.of(ipv4, IPv4.of(mask));
- }
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IPv6.java b/java_gen/pre-written/src/main/java/org/openflow/types/IPv6.java
deleted file mode 100644
index bf0f9b2..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IPv6.java
+++ /dev/null
@@ -1,289 +0,0 @@
-package org.openflow.types;
-
-import java.util.regex.Pattern;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-/**
- * IPv6 address object. Instance controlled, immutable. Internal representation:
- * two 64 bit longs (not that you'd have to know).
- *
- * @author Andreas Wundsam <andreas.wundsam@teleteach.de>
- */
-public class IPv6 implements OFValueType<IPv6> {
- static final int LENGTH = 16;
- private final long raw1;
- private final long raw2;
-
- public static final IPv6 NO_MASK = IPv6.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
- public static final IPv6 FULL_MASK = IPv6.of(0x0, 0x0);
-
- private IPv6(final long raw1, final long raw2) {
- this.raw1 = raw1;
- this.raw2 = raw2;
- }
-
- public static IPv6 of(final byte[] address) {
- if (address.length != LENGTH) {
- throw new IllegalArgumentException(
- "Invalid byte array length for IPv6 address: " + address);
- }
-
- long raw1 =
- (address[0] & 0xFFL) << 56 | (address[1] & 0xFFL) << 48
- | (address[2] & 0xFFL) << 40 | (address[3] & 0xFFL) << 32
- | (address[4] & 0xFFL) << 24 | (address[5] & 0xFFL) << 16
- | (address[6] & 0xFFL) << 8 | (address[7]);
-
- long raw2 =
- (address[8] & 0xFFL) << 56 | (address[9] & 0xFFL) << 48
- | (address[10] & 0xFFL) << 40 | (address[11] & 0xFFL) << 32
- | (address[12] & 0xFFL) << 24 | (address[13] & 0xFFL) << 16
- | (address[14] & 0xFFL) << 8 | (address[15]);
-
- return IPv6.of(raw1, raw2);
- }
-
- private static class IPv6Builder {
- private long raw1, raw2;
-
- public void setUnsignedShortWord(final int i, final int value) {
- int shift = 48 - (i % 4) * 16;
-
- if (value < 0 || value > 0xFFFF)
- throw new IllegalArgumentException("16 bit word must be in [0, 0xFFFF]");
-
- if (i >= 0 && i < 4)
- raw1 = raw1 & ~(0xFFFFL << shift) | (value & 0xFFFFL) << shift;
- else if (i >= 4 && i < 8)
- raw2 = raw2 & ~(0xFFFFL << shift) | (value & 0xFFFFL) << shift;
- else
- throw new IllegalArgumentException("16 bit word index must be in [0,7]");
- }
-
- public IPv6 getIPv6() {
- return IPv6.of(raw1, raw2);
- }
- }
-
- private final static Pattern colonPattern = Pattern.compile(":");
-
- public static IPv6 of(final String string) {
- IPv6Builder builder = new IPv6Builder();
- String[] parts = colonPattern.split(string, -1);
-
- int leftWord = 0;
- int leftIndex = 0;
-
- boolean hitZeroCompression = false;
-
- for (leftIndex = 0; leftIndex < parts.length; leftIndex++) {
- String part = parts[leftIndex];
- if (part.length() == 0) {
- // hit empty group of zero compression
- hitZeroCompression = true;
- break;
- }
- builder.setUnsignedShortWord(leftWord++, Integer.parseInt(part, 16));
- }
-
- if (hitZeroCompression) {
- if (leftIndex == 0) {
- // if colon is at the start, two columns must be at the start,
- // move to the second empty group
- leftIndex = 1;
- if (parts.length < 2 || parts[1].length() > 0)
- throw new IllegalArgumentException("Malformed IPv6 address: " + string);
- }
-
- int rightWord = 7;
- int rightIndex;
- for (rightIndex = parts.length - 1; rightIndex > leftIndex; rightIndex--) {
- String part = parts[rightIndex];
- if (part.length() == 0)
- break;
- builder.setUnsignedShortWord(rightWord--, Integer.parseInt(part, 16));
- }
- if (rightIndex == parts.length - 1) {
- // if colon is at the end, two columns must be at the end, move
- // to the second empty group
- if (rightIndex < 1 || parts[rightIndex - 1].length() > 0)
- throw new IllegalArgumentException("Malformed IPv6 address: " + string);
- rightIndex--;
- }
- if (leftIndex != rightIndex)
- throw new IllegalArgumentException("Malformed IPv6 address: " + string);
- } else {
- if (leftIndex != 8) {
- throw new IllegalArgumentException("Malformed IPv6 address: " + string);
- }
- }
- return builder.getIPv6();
- }
-
- public static IPv6 of(final long raw1, final long raw2) {
- return new IPv6(raw1, raw2);
- }
-
- volatile byte[] bytesCache = null;
-
- public byte[] getBytes() {
- if (bytesCache == null) {
- synchronized (this) {
- if (bytesCache == null) {
- bytesCache =
- new byte[] { (byte) ((raw1 >> 56) & 0xFF),
- (byte) ((raw1 >> 48) & 0xFF),
- (byte) ((raw1 >> 40) & 0xFF),
- (byte) ((raw1 >> 32) & 0xFF),
- (byte) ((raw1 >> 24) & 0xFF),
- (byte) ((raw1 >> 16) & 0xFF),
- (byte) ((raw1 >> 8) & 0xFF),
- (byte) ((raw1 >> 0) & 0xFF),
-
- (byte) ((raw2 >> 56) & 0xFF),
- (byte) ((raw2 >> 48) & 0xFF),
- (byte) ((raw2 >> 40) & 0xFF),
- (byte) ((raw2 >> 32) & 0xFF),
- (byte) ((raw2 >> 24) & 0xFF),
- (byte) ((raw2 >> 16) & 0xFF),
- (byte) ((raw2 >> 8) & 0xFF),
- (byte) ((raw2 >> 0) & 0xFF) };
- }
- }
- }
- return bytesCache;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public String toString() {
- return toString(true, false);
- }
-
- public int getUnsignedShortWord(final int i) {
- if (i >= 0 && i < 4)
- return (int) ((raw1 >>> (48 - i * 16)) & 0xFFFF);
- else if (i >= 4 && i < 8)
- return (int) ((raw2 >>> (48 - (i - 4) * 16)) & 0xFFFF);
- else
- throw new IllegalArgumentException("16 bit word index must be in [0,7]");
- }
-
- /** get the index of the first word where to apply IPv6 zero compression */
- public int getZeroCompressStart() {
- int start = Integer.MAX_VALUE;
- int maxLength = -1;
-
- int candidateStart = -1;
-
- for (int i = 0; i < 8; i++) {
- if (candidateStart >= 0) {
- // in a zero octect
- if (getUnsignedShortWord(i) != 0) {
- // end of this candidate word
- int candidateLength = i - candidateStart;
- if (candidateLength >= maxLength) {
- start = candidateStart;
- maxLength = candidateLength;
- }
- candidateStart = -1;
- }
- } else {
- // not in a zero octect
- if (getUnsignedShortWord(i) == 0) {
- candidateStart = i;
- }
- }
- }
-
- if (candidateStart >= 0) {
- int candidateLength = 8 - candidateStart;
- if (candidateLength >= maxLength) {
- start = candidateStart;
- maxLength = candidateLength;
- }
- }
-
- return start;
- }
-
- public String toString(final boolean zeroCompression, final boolean leadingZeros) {
- StringBuilder res = new StringBuilder();
-
- int compressionStart = zeroCompression ? getZeroCompressStart() : Integer.MAX_VALUE;
- boolean inCompression = false;
- boolean colonNeeded = false;
-
- for (int i = 0; i < 8; i++) {
- int word = getUnsignedShortWord(i);
-
- if (word == 0) {
- if (inCompression)
- continue;
- else if (i == compressionStart) {
- res.append(':').append(':');
- inCompression = true;
- colonNeeded = false;
- continue;
- }
- } else {
- inCompression = false;
- }
-
- if (colonNeeded) {
- res.append(':');
- colonNeeded = false;
- }
-
- res.append(leadingZeros ? String.format("%04x", word) : Integer.toString(word,
- 16));
- colonNeeded = true;
- }
- return res.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (raw1 ^ (raw1 >>> 32));
- result = prime * result + (int) (raw2 ^ (raw2 >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- IPv6 other = (IPv6) obj;
- if (raw1 != other.raw1)
- return false;
- if (raw2 != other.raw2)
- return false;
- return true;
- }
-
- public void write16Bytes(ChannelBuffer c) {
- c.writeLong(this.raw1);
- c.writeLong(this.raw2);
- }
-
- public static IPv6 read16Bytes(ChannelBuffer c) throws OFParseError {
- return IPv6.of(c.readLong(), c.readLong());
- }
-
- @Override
- public IPv6 applyMask(IPv6 mask) {
- return IPv6.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IPv6FlowLabel.java b/java_gen/pre-written/src/main/java/org/openflow/types/IPv6FlowLabel.java
deleted file mode 100644
index def5947..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IPv6FlowLabel.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public class IPv6FlowLabel implements OFValueType<IPv6FlowLabel> {
-
- static final int LENGTH = 4;
-
- private final int label;
-
- public static final IPv6FlowLabel NO_MASK = IPv6FlowLabel.of(0xFFFFFFFF);
- public static final IPv6FlowLabel FULL_MASK = IPv6FlowLabel.of(0x0);
-
- private IPv6FlowLabel(int label) {
- this.label = label;
- }
-
- public static IPv6FlowLabel of(int label) {
- return new IPv6FlowLabel(label);
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof IPv6FlowLabel))
- return false;
- IPv6FlowLabel other = (IPv6FlowLabel)obj;
- if (other.label != this.label)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 59;
- int result = 1;
- result = prime * result + label;
- return result;
- }
-
- @Override
- public String toString() {
- return Integer.toHexString(label);
- }
-
- public void write4Bytes(ChannelBuffer c) {
- c.writeInt(this.label);
- }
-
- public static IPv6FlowLabel read4Bytes(ChannelBuffer c) throws OFParseError {
- return IPv6FlowLabel.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
- }
-
- @Override
- public IPv6FlowLabel applyMask(IPv6FlowLabel mask) {
- return IPv6FlowLabel.of(this.label & mask.label);
- }
-
- public int getIPv6FlowLabelValue() {
- return label;
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IPv6WithMask.java b/java_gen/pre-written/src/main/java/org/openflow/types/IPv6WithMask.java
deleted file mode 100644
index dfebeba..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IPv6WithMask.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.openflow.types;
-
-import java.math.BigInteger;
-import java.util.Arrays;
-
-public class IPv6WithMask extends Masked<IPv6> {
-
- private IPv6WithMask(IPv6 value, IPv6 mask) {
- super(value, mask);
- }
-
- public static IPv6WithMask of(IPv6 value, IPv6 mask) {
- return new IPv6WithMask(value, mask);
- }
-
- @Override
- public String toString() {
- StringBuilder res = new StringBuilder();
- res.append(((IPv6)value).toString());
- res.append('/');
-
- BigInteger maskint = new BigInteger(((IPv6)mask).getBytes());
- if (maskint.not().add(BigInteger.ONE).bitCount() == 1) {
- // CIDR notation
- res.append(maskint.bitCount());
- } else {
- // Full address mask
- res.append(((IPv6)mask).toString());
- }
-
- return res.toString();
- }
-
- public static IPv6WithMask of(final String string) {
- int slashPos;
- String ip = string;
- int maskBits = 0;
- IPv6 maskAddress = null;
-
- // Read mask suffix
- if ((slashPos = string.indexOf('/')) != -1) {
- ip = string.substring(0, slashPos);
- try {
- String suffix = string.substring(slashPos + 1);
- if (suffix.length() == 0)
- throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
- if (suffix.indexOf(':') != -1) {
- // Full mask
- maskAddress = IPv6.of(suffix);
- } else {
- // CIDR Suffix
- maskBits = Integer.parseInt(suffix);
- }
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
- }
- if (maskBits < 0 || maskBits > 128) {
- throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
- }
- }
-
- // Read IP
- IPv6 ipv6 = IPv6.of(ip);
-
- if (maskAddress != null) {
- // Full address mask
- return IPv6WithMask.of(ipv6, maskAddress);
- } else if (maskBits == 0) {
- // No mask
- return IPv6WithMask.of(ipv6, IPv6.NO_MASK);
- } else {
- // With mask
- BigInteger mask = BigInteger.ONE.negate().shiftLeft(128 - maskBits);
- byte[] maskBytesTemp = mask.toByteArray();
- byte[] maskBytes;
- if (maskBytesTemp.length < 16) {
- maskBytes = new byte[16];
- System.arraycopy(maskBytesTemp, 0, maskBytes, 16 - maskBytesTemp.length, maskBytesTemp.length);
- Arrays.fill(maskBytes, 0, 16 - maskBytesTemp.length, (byte)(0xFF));
- } else if (maskBytesTemp.length > 16) {
- maskBytes = new byte[16];
- System.arraycopy(maskBytesTemp, 0, maskBytes, 0, maskBytes.length);
- } else {
- maskBytes = maskBytesTemp;
- }
- return IPv6WithMask.of(ipv6, IPv6.of(maskBytes));
- }
- }
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IpDscp.java b/java_gen/pre-written/src/main/java/org/openflow/types/IpDscp.java
deleted file mode 100644
index 52598cb..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IpDscp.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public enum IpDscp implements OFValueType<IpDscp> {
- DSCP_0((byte)0),
- DSCP_1((byte)1),
- DSCP_2((byte)2),
- DSCP_3((byte)3),
- DSCP_4((byte)4),
- DSCP_5((byte)5),
- DSCP_6((byte)6),
- DSCP_7((byte)7),
- DSCP_8((byte)8),
- DSCP_9((byte)9),
- DSCP_10((byte)10),
- DSCP_11((byte)11),
- DSCP_12((byte)12),
- DSCP_13((byte)13),
- DSCP_14((byte)14),
- DSCP_15((byte)15),
- DSCP_16((byte)16),
- DSCP_17((byte)17),
- DSCP_18((byte)18),
- DSCP_19((byte)19),
- DSCP_20((byte)20),
- DSCP_21((byte)21),
- DSCP_22((byte)22),
- DSCP_23((byte)23),
- DSCP_24((byte)24),
- DSCP_25((byte)25),
- DSCP_26((byte)26),
- DSCP_27((byte)27),
- DSCP_28((byte)28),
- DSCP_29((byte)29),
- DSCP_30((byte)30),
- DSCP_31((byte)31),
- DSCP_32((byte)32),
- DSCP_33((byte)33),
- DSCP_34((byte)34),
- DSCP_35((byte)35),
- DSCP_36((byte)36),
- DSCP_37((byte)37),
- DSCP_38((byte)38),
- DSCP_39((byte)39),
- DSCP_40((byte)40),
- DSCP_41((byte)41),
- DSCP_42((byte)42),
- DSCP_43((byte)43),
- DSCP_44((byte)44),
- DSCP_45((byte)45),
- DSCP_46((byte)46),
- DSCP_47((byte)47),
- DSCP_48((byte)48),
- DSCP_49((byte)49),
- DSCP_50((byte)50),
- DSCP_51((byte)51),
- DSCP_52((byte)52),
- DSCP_53((byte)53),
- DSCP_54((byte)54),
- DSCP_55((byte)55),
- DSCP_56((byte)56),
- DSCP_57((byte)57),
- DSCP_58((byte)58),
- DSCP_59((byte)59),
- DSCP_60((byte)60),
- DSCP_61((byte)61),
- DSCP_62((byte)62),
- DSCP_63((byte)63),
- DSCP_NO_MASK((byte)0xFF);
-
- static final int LENGTH = 1;
-
- public static final IpDscp NO_MASK = DSCP_NO_MASK;
- public static final IpDscp FULL_MASK = DSCP_0;
-
- private final byte dscp;
-
- private IpDscp(byte dscp) {
- this.dscp = dscp;
- }
-
- public static IpDscp of(byte dscp) {
- switch (dscp) {
- case 0:
- return DSCP_0;
- case 1:
- return DSCP_1;
- case 2:
- return DSCP_2;
- case 3:
- return DSCP_3;
- case 4:
- return DSCP_4;
- case 5:
- return DSCP_5;
- case 6:
- return DSCP_6;
- case 7:
- return DSCP_7;
- case 8:
- return DSCP_8;
- case 9:
- return DSCP_9;
- case 10:
- return DSCP_10;
- case 11:
- return DSCP_11;
- case 12:
- return DSCP_12;
- case 13:
- return DSCP_13;
- case 14:
- return DSCP_14;
- case 15:
- return DSCP_15;
- case 16:
- return DSCP_16;
- case 17:
- return DSCP_17;
- case 18:
- return DSCP_18;
- case 19:
- return DSCP_19;
- case 20:
- return DSCP_20;
- case 21:
- return DSCP_21;
- case 22:
- return DSCP_22;
- case 23:
- return DSCP_23;
- case 24:
- return DSCP_24;
- case 25:
- return DSCP_25;
- case 26:
- return DSCP_26;
- case 27:
- return DSCP_27;
- case 28:
- return DSCP_28;
- case 29:
- return DSCP_29;
- case 30:
- return DSCP_30;
- case 31:
- return DSCP_31;
- case 32:
- return DSCP_32;
- case 33:
- return DSCP_33;
- case 34:
- return DSCP_34;
- case 35:
- return DSCP_35;
- case 36:
- return DSCP_36;
- case 37:
- return DSCP_37;
- case 38:
- return DSCP_38;
- case 39:
- return DSCP_39;
- case 40:
- return DSCP_40;
- case 41:
- return DSCP_41;
- case 42:
- return DSCP_42;
- case 43:
- return DSCP_43;
- case 44:
- return DSCP_44;
- case 45:
- return DSCP_45;
- case 46:
- return DSCP_46;
- case 47:
- return DSCP_47;
- case 48:
- return DSCP_48;
- case 49:
- return DSCP_49;
- case 50:
- return DSCP_50;
- case 51:
- return DSCP_51;
- case 52:
- return DSCP_52;
- case 53:
- return DSCP_53;
- case 54:
- return DSCP_54;
- case 55:
- return DSCP_55;
- case 56:
- return DSCP_56;
- case 57:
- return DSCP_57;
- case 58:
- return DSCP_58;
- case 59:
- return DSCP_59;
- case 60:
- return DSCP_60;
- case 61:
- return DSCP_61;
- case 62:
- return DSCP_62;
- case 63:
- return DSCP_63;
- default:
- throw new IllegalArgumentException("Illegal IPv4 DSCP value: " + dscp);
- }
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public String toString() {
- return Integer.toHexString(dscp);
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeByte(this.dscp);
- }
-
- public static IpDscp readByte(ChannelBuffer c) throws OFParseError {
- return IpDscp.of((byte)(c.readUnsignedByte()));
- }
-
- @Override
- public IpDscp applyMask(IpDscp mask) {
- return IpDscp.of((byte)(this.dscp & mask.dscp));
- }
-
- public byte getDscpValue() {
- return dscp;
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IpEcn.java b/java_gen/pre-written/src/main/java/org/openflow/types/IpEcn.java
deleted file mode 100644
index 0d9721c..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IpEcn.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public enum IpEcn implements OFValueType<IpEcn> {
- ECN_00((byte)0),
- ECN_01((byte)1),
- ECN_10((byte)2),
- ECN_11((byte)3),
- ECN_NO_MASK((byte)0xFF);
-
- public static final IpEcn NO_MASK = ECN_NO_MASK;
- public static final IpEcn FULL_MASK = ECN_00;
-
- static final int LENGTH = 1;
-
- private final byte ecn;
-
- private IpEcn(byte ecn) {
- this.ecn = ecn;
- }
-
- public static IpEcn of(byte ecn) {
- switch (ecn) {
- case 0:
- return ECN_00;
- case 1:
- return ECN_01;
- case 2:
- return ECN_10;
- case 3:
- return ECN_11;
- default:
- throw new IllegalArgumentException("Illegal IP ECN value: " + ecn);
- }
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public String toString() {
- return (ecn < 3 ? "0" : "") + Integer.toBinaryString(ecn);
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeByte(this.ecn);
- }
-
- public static IpEcn readByte(ChannelBuffer c) throws OFParseError {
- return IpEcn.of((byte)(c.readUnsignedByte()));
- }
-
- @Override
- public IpEcn applyMask(IpEcn mask) {
- return IpEcn.of((byte)(this.ecn & mask.ecn));
- }
-
- public byte getEcnValue() {
- return ecn;
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/IpProtocol.java b/java_gen/pre-written/src/main/java/org/openflow/types/IpProtocol.java
deleted file mode 100644
index 6fc896f..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/IpProtocol.java
+++ /dev/null
@@ -1,648 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-/**
- * IP-Protocol field representation
- *
- * @author Yotam Harchol (yotam.harchol@bigswitch.com)
- */
-public class IpProtocol implements OFValueType<IpProtocol> {
-
- static final short MAX_PROTO = 0xFF;
- static final int LENGTH = 1;
-
- private final short proto;
-
- static final short IP_PROTO_NUM_HOPOPT = 0x00;
- static final short IP_PROTO_NUM_ICMP = 0x01;
- static final short IP_PROTO_NUM_IGMP = 0x02;
- static final short IP_PROTO_NUM_GGP = 0x03;
- static final short IP_PROTO_NUM_IPv4 = 0x04;
- static final short IP_PROTO_NUM_ST = 0x05;
- static final short IP_PROTO_NUM_TCP = 0x06;
- static final short IP_PROTO_NUM_CBT = 0x07;
- static final short IP_PROTO_NUM_EGP = 0x08;
- static final short IP_PROTO_NUM_IGP = 0x09;
- static final short IP_PROTO_NUM_BBN_RCC_MON = 0x0A;
- static final short IP_PROTO_NUM_NVP_II = 0x0B;
- static final short IP_PROTO_NUM_PUP = 0x0C;
- static final short IP_PROTO_NUM_ARGUS = 0x0D;
- static final short IP_PROTO_NUM_EMCON = 0x0E;
- static final short IP_PROTO_NUM_XNET = 0x0F;
- static final short IP_PROTO_NUM_CHAOS = 0x10;
- static final short IP_PROTO_NUM_UDP = 0x11;
- static final short IP_PROTO_NUM_MUX = 0x12;
- static final short IP_PROTO_NUM_DCN_MEAS = 0x13;
- static final short IP_PROTO_NUM_HMP = 0x14;
- static final short IP_PROTO_NUM_PRM = 0x15;
- static final short IP_PROTO_NUM_XNS_IDP = 0x16;
- static final short IP_PROTO_NUM_TRUNK_1 = 0x17;
- static final short IP_PROTO_NUM_TRUNK_2 = 0x18;
- static final short IP_PROTO_NUM_LEAF_1 = 0x19;
- static final short IP_PROTO_NUM_LEAF_2 = 0x1A;
- static final short IP_PROTO_NUM_RDP = 0x1B;
- static final short IP_PROTO_NUM_IRTP = 0x1C;
- static final short IP_PROTO_NUM_ISO_TP4 = 0x1D;
- static final short IP_PROTO_NUM_NETBLT = 0x1E;
- static final short IP_PROTO_NUM_MFE_NSP = 0x1F;
- static final short IP_PROTO_NUM_MERIT_INP = 0x20;
- static final short IP_PROTO_NUM_DCCP = 0x21;
- static final short IP_PROTO_NUM_3PC = 0x22;
- static final short IP_PROTO_NUM_IDPR = 0x23;
- static final short IP_PROTO_NUM_XTP = 0x24;
- static final short IP_PROTO_NUM_DDP = 0x25;
- static final short IP_PROTO_NUM_IDPR_CMTP = 0x26;
- static final short IP_PROTO_NUM_TP_PP = 0x27;
- static final short IP_PROTO_NUM_IL = 0x28;
- static final short IP_PROTO_NUM_IPv6 = 0x29;
- static final short IP_PROTO_NUM_SDRP = 0x2A;
- static final short IP_PROTO_NUM_IPv6_ROUTE = 0x2B;
- static final short IP_PROTO_NUM_IPv6_FRAG = 0x2C;
- static final short IP_PROTO_NUM_IDRP = 0x2D;
- static final short IP_PROTO_NUM_RSVP = 0x2E;
- static final short IP_PROTO_NUM_GRE = 0x2F;
- static final short IP_PROTO_NUM_MHRP = 0x30;
- static final short IP_PROTO_NUM_BNA = 0x31;
- static final short IP_PROTO_NUM_ESP = 0x32;
- static final short IP_PROTO_NUM_AH = 0x33;
- static final short IP_PROTO_NUM_I_NLSP = 0x34;
- static final short IP_PROTO_NUM_SWIPE = 0x35;
- static final short IP_PROTO_NUM_NARP = 0x36;
- static final short IP_PROTO_NUM_MOBILE = 0x37;
- static final short IP_PROTO_NUM_TLSP = 0x38;
- static final short IP_PROTO_NUM_SKIP = 0x39;
- static final short IP_PROTO_NUM_IPv6_ICMP = 0x3A;
- static final short IP_PROTO_NUM_IPv6_NO_NXT = 0x3B;
- static final short IP_PROTO_NUM_IPv6_OPTS = 0x3C;
- static final short IP_PROTO_NUM_HOST_INTERNAL = 0x3D;
- static final short IP_PROTO_NUM_CFTP = 0x3E;
- static final short IP_PROTO_NUM_LOCAL_NET = 0x3F;
- static final short IP_PROTO_NUM_SAT_EXPAK = 0x40;
- static final short IP_PROTO_NUM_KRYPTOLAN = 0x41;
- static final short IP_PROTO_NUM_RVD = 0x42;
- static final short IP_PROTO_NUM_IPPC = 0x43;
- static final short IP_PROTO_NUM_DIST_FS = 0x44;
- static final short IP_PROTO_NUM_SAT_MON = 0x45;
- static final short IP_PROTO_NUM_VISA = 0x46;
- static final short IP_PROTO_NUM_IPCV = 0x47;
- static final short IP_PROTO_NUM_CPNX = 0x48;
- static final short IP_PROTO_NUM_CPHB = 0x49;
- static final short IP_PROTO_NUM_WSN = 0x4A;
- static final short IP_PROTO_NUM_PVP = 0x4B;
- static final short IP_PROTO_NUM_BR_SAT_MON = 0x4C;
- static final short IP_PROTO_NUM_SUN_ND = 0x4D;
- static final short IP_PROTO_NUM_WB_MON = 0x4E;
- static final short IP_PROTO_NUM_WB_EXPAK = 0x4F;
- static final short IP_PROTO_NUM_ISO_IP = 0x50;
- static final short IP_PROTO_NUM_VMTP = 0x51;
- static final short IP_PROTO_NUM_SECURE_VMTP = 0x52;
- static final short IP_PROTO_NUM_VINES = 0x53;
- static final short IP_PROTO_NUM_TTP_IPTM = 0x54;
- static final short IP_PROTO_NUM_NSFNET_IGP = 0x55;
- static final short IP_PROTO_NUM_DGP = 0x56;
- static final short IP_PROTO_NUM_TCF = 0x57;
- static final short IP_PROTO_NUM_EIGRP = 0x58;
- static final short IP_PROTO_NUM_OSPF = 0x59;
- static final short IP_PROTO_NUM_Sprite_RPC = 0x5A;
- static final short IP_PROTO_NUM_LARP = 0x5B;
- static final short IP_PROTO_NUM_MTP = 0x5C;
- static final short IP_PROTO_NUM_AX_25 = 0x5D;
- static final short IP_PROTO_NUM_IPIP = 0x5E;
- static final short IP_PROTO_NUM_MICP = 0x5F;
- static final short IP_PROTO_NUM_SCC_SP = 0x60;
- static final short IP_PROTO_NUM_ETHERIP = 0x61;
- static final short IP_PROTO_NUM_ENCAP = 0x62;
- static final short IP_PROTO_NUM_PRIVATE_ENCRYPT = 0x63;
- static final short IP_PROTO_NUM_GMTP = 0x64;
- static final short IP_PROTO_NUM_IFMP = 0x65;
- static final short IP_PROTO_NUM_PNNI = 0x66;
- static final short IP_PROTO_NUM_PIM = 0x67;
- static final short IP_PROTO_NUM_ARIS = 0x68;
- static final short IP_PROTO_NUM_SCPS = 0x69;
- static final short IP_PROTO_NUM_QNX = 0x6A;
- static final short IP_PROTO_NUM_A_N = 0x6B;
- static final short IP_PROTO_NUM_IP_COMP = 0x6C;
- static final short IP_PROTO_NUM_SNP = 0x6D;
- static final short IP_PROTO_NUM_COMPAQ_PEER = 0x6E;
- static final short IP_PROTO_NUM_IPX_IN_IP = 0x6F;
- static final short IP_PROTO_NUM_VRRP = 0x70;
- static final short IP_PROTO_NUM_PGM = 0x71;
- static final short IP_PROTO_NUM_ZERO_HOP = 0x72;
- static final short IP_PROTO_NUM_L2TP = 0x73;
- static final short IP_PROTO_NUM_DDX = 0x74;
- static final short IP_PROTO_NUM_IATP = 0x75;
- static final short IP_PROTO_NUM_STP = 0x76;
- static final short IP_PROTO_NUM_SRP = 0x77;
- static final short IP_PROTO_NUM_UTI = 0x78;
- static final short IP_PROTO_NUM_SMP = 0x79;
- static final short IP_PROTO_NUM_SM = 0x7A;
- static final short IP_PROTO_NUM_PTP = 0x7B;
- static final short IP_PROTO_NUM_IS_IS_OVER_IPv4 = 0x7C;
- static final short IP_PROTO_NUM_FIRE = 0x7D;
- static final short IP_PROTO_NUM_CRTP = 0x7E;
- static final short IP_PROTO_NUM_CRUDP = 0x7F;
- static final short IP_PROTO_NUM_SSCOPMCE = 0x80;
- static final short IP_PROTO_NUM_IPLT = 0x81;
- static final short IP_PROTO_NUM_SPS = 0x82;
- static final short IP_PROTO_NUM_PIPE = 0x83;
- static final short IP_PROTO_NUM_SCTP = 0x84;
- static final short IP_PROTO_NUM_FC = 0x85;
- static final short IP_PROTO_NUM_RSVP_E2E_IGNORE = 0x86;
- static final short IP_PROTO_NUM_MOBILITY_HEADER = 0x87;
- static final short IP_PROTO_NUM_UDP_LITE = 0x88;
- static final short IP_PROTO_NUM_MPLS_IN_IP = 0x89;
- static final short IP_PROTO_NUM_MANET = 0x8A;
- static final short IP_PROTO_NUM_HIP = 0x8B;
- static final short IP_PROTO_NUM_SHIM6 = 0x8C;
-
- public static final IpProtocol IP_PROTO_HOPOPT = new IpProtocol(IP_PROTO_NUM_HOPOPT);
- public static final IpProtocol IP_PROTO_ICMP = new IpProtocol(IP_PROTO_NUM_ICMP);
- public static final IpProtocol IP_PROTO_IGMP = new IpProtocol(IP_PROTO_NUM_IGMP);
- public static final IpProtocol IP_PROTO_GGP = new IpProtocol(IP_PROTO_NUM_GGP);
- public static final IpProtocol IP_PROTO_IPv4 = new IpProtocol(IP_PROTO_NUM_IPv4);
- public static final IpProtocol IP_PROTO_ST = new IpProtocol(IP_PROTO_NUM_ST);
- public static final IpProtocol IP_PROTO_TCP = new IpProtocol(IP_PROTO_NUM_TCP);
- public static final IpProtocol IP_PROTO_CBT = new IpProtocol(IP_PROTO_NUM_CBT);
- public static final IpProtocol IP_PROTO_EGP = new IpProtocol(IP_PROTO_NUM_EGP);
- public static final IpProtocol IP_PROTO_IGP = new IpProtocol(IP_PROTO_NUM_IGP);
- public static final IpProtocol IP_PROTO_BBN_RCC_MON = new IpProtocol(IP_PROTO_NUM_BBN_RCC_MON);
- public static final IpProtocol IP_PROTO_NVP_II = new IpProtocol(IP_PROTO_NUM_NVP_II);
- public static final IpProtocol IP_PROTO_PUP = new IpProtocol(IP_PROTO_NUM_PUP);
- public static final IpProtocol IP_PROTO_ARGUS = new IpProtocol(IP_PROTO_NUM_ARGUS);
- public static final IpProtocol IP_PROTO_EMCON = new IpProtocol(IP_PROTO_NUM_EMCON);
- public static final IpProtocol IP_PROTO_XNET = new IpProtocol(IP_PROTO_NUM_XNET);
- public static final IpProtocol IP_PROTO_CHAOS = new IpProtocol(IP_PROTO_NUM_CHAOS);
- public static final IpProtocol IP_PROTO_UDP = new IpProtocol(IP_PROTO_NUM_UDP);
- public static final IpProtocol IP_PROTO_MUX = new IpProtocol(IP_PROTO_NUM_MUX);
- public static final IpProtocol IP_PROTO_DCN_MEAS = new IpProtocol(IP_PROTO_NUM_DCN_MEAS);
- public static final IpProtocol IP_PROTO_HMP = new IpProtocol(IP_PROTO_NUM_HMP);
- public static final IpProtocol IP_PROTO_PRM = new IpProtocol(IP_PROTO_NUM_PRM);
- public static final IpProtocol IP_PROTO_XNS_IDP = new IpProtocol(IP_PROTO_NUM_XNS_IDP);
- public static final IpProtocol IP_PROTO_TRUNK_1 = new IpProtocol(IP_PROTO_NUM_TRUNK_1);
- public static final IpProtocol IP_PROTO_TRUNK_2 = new IpProtocol(IP_PROTO_NUM_TRUNK_2);
- public static final IpProtocol IP_PROTO_LEAF_1 = new IpProtocol(IP_PROTO_NUM_LEAF_1);
- public static final IpProtocol IP_PROTO_LEAF_2 = new IpProtocol(IP_PROTO_NUM_LEAF_2);
- public static final IpProtocol IP_PROTO_RDP = new IpProtocol(IP_PROTO_NUM_RDP);
- public static final IpProtocol IP_PROTO_IRTP = new IpProtocol(IP_PROTO_NUM_IRTP);
- public static final IpProtocol IP_PROTO_ISO_TP4 = new IpProtocol(IP_PROTO_NUM_ISO_TP4);
- public static final IpProtocol IP_PROTO_NETBLT = new IpProtocol(IP_PROTO_NUM_NETBLT);
- public static final IpProtocol IP_PROTO_MFE_NSP = new IpProtocol(IP_PROTO_NUM_MFE_NSP);
- public static final IpProtocol IP_PROTO_MERIT_INP = new IpProtocol(IP_PROTO_NUM_MERIT_INP);
- public static final IpProtocol IP_PROTO_DCCP = new IpProtocol(IP_PROTO_NUM_DCCP);
- public static final IpProtocol IP_PROTO_3PC = new IpProtocol(IP_PROTO_NUM_3PC);
- public static final IpProtocol IP_PROTO_IDPR = new IpProtocol(IP_PROTO_NUM_IDPR);
- public static final IpProtocol IP_PROTO_XTP = new IpProtocol(IP_PROTO_NUM_XTP);
- public static final IpProtocol IP_PROTO_DDP = new IpProtocol(IP_PROTO_NUM_DDP);
- public static final IpProtocol IP_PROTO_IDPR_CMTP = new IpProtocol(IP_PROTO_NUM_IDPR_CMTP);
- public static final IpProtocol IP_PROTO_TP_PP = new IpProtocol(IP_PROTO_NUM_TP_PP);
- public static final IpProtocol IP_PROTO_IL = new IpProtocol(IP_PROTO_NUM_IL);
- public static final IpProtocol IP_PROTO_IPv6 = new IpProtocol(IP_PROTO_NUM_IPv6);
- public static final IpProtocol IP_PROTO_SDRP = new IpProtocol(IP_PROTO_NUM_SDRP);
- public static final IpProtocol IP_PROTO_IPv6_ROUTE = new IpProtocol(IP_PROTO_NUM_IPv6_ROUTE);
- public static final IpProtocol IP_PROTO_IPv6_FRAG = new IpProtocol(IP_PROTO_NUM_IPv6_FRAG);
- public static final IpProtocol IP_PROTO_IDRP = new IpProtocol(IP_PROTO_NUM_IDRP);
- public static final IpProtocol IP_PROTO_RSVP = new IpProtocol(IP_PROTO_NUM_RSVP);
- public static final IpProtocol IP_PROTO_GRE = new IpProtocol(IP_PROTO_NUM_GRE);
- public static final IpProtocol IP_PROTO_MHRP = new IpProtocol(IP_PROTO_NUM_MHRP);
- public static final IpProtocol IP_PROTO_BNA = new IpProtocol(IP_PROTO_NUM_BNA);
- public static final IpProtocol IP_PROTO_ESP = new IpProtocol(IP_PROTO_NUM_ESP);
- public static final IpProtocol IP_PROTO_AH = new IpProtocol(IP_PROTO_NUM_AH);
- public static final IpProtocol IP_PROTO_I_NLSP = new IpProtocol(IP_PROTO_NUM_I_NLSP);
- public static final IpProtocol IP_PROTO_SWIPE = new IpProtocol(IP_PROTO_NUM_SWIPE);
- public static final IpProtocol IP_PROTO_NARP = new IpProtocol(IP_PROTO_NUM_NARP);
- public static final IpProtocol IP_PROTO_MOBILE = new IpProtocol(IP_PROTO_NUM_MOBILE);
- public static final IpProtocol IP_PROTO_TLSP = new IpProtocol(IP_PROTO_NUM_TLSP);
- public static final IpProtocol IP_PROTO_SKIP = new IpProtocol(IP_PROTO_NUM_SKIP);
- public static final IpProtocol IP_PROTO_IPv6_ICMP = new IpProtocol(IP_PROTO_NUM_IPv6_ICMP);
- public static final IpProtocol IP_PROTO_IPv6_NO_NXT = new IpProtocol(IP_PROTO_NUM_IPv6_NO_NXT);
- public static final IpProtocol IP_PROTO_IPv6_OPTS = new IpProtocol(IP_PROTO_NUM_IPv6_OPTS);
- public static final IpProtocol IP_PROTO_HOST_INTERNAL = new IpProtocol(IP_PROTO_NUM_HOST_INTERNAL);
- public static final IpProtocol IP_PROTO_CFTP = new IpProtocol(IP_PROTO_NUM_CFTP);
- public static final IpProtocol IP_PROTO_LOCAL_NET = new IpProtocol(IP_PROTO_NUM_LOCAL_NET);
- public static final IpProtocol IP_PROTO_SAT_EXPAK = new IpProtocol(IP_PROTO_NUM_SAT_EXPAK);
- public static final IpProtocol IP_PROTO_KRYPTOLAN = new IpProtocol(IP_PROTO_NUM_KRYPTOLAN);
- public static final IpProtocol IP_PROTO_RVD = new IpProtocol(IP_PROTO_NUM_RVD);
- public static final IpProtocol IP_PROTO_IPPC = new IpProtocol(IP_PROTO_NUM_IPPC);
- public static final IpProtocol IP_PROTO_DIST_FS = new IpProtocol(IP_PROTO_NUM_DIST_FS);
- public static final IpProtocol IP_PROTO_SAT_MON = new IpProtocol(IP_PROTO_NUM_SAT_MON);
- public static final IpProtocol IP_PROTO_VISA = new IpProtocol(IP_PROTO_NUM_VISA);
- public static final IpProtocol IP_PROTO_IPCV = new IpProtocol(IP_PROTO_NUM_IPCV);
- public static final IpProtocol IP_PROTO_CPNX = new IpProtocol(IP_PROTO_NUM_CPNX);
- public static final IpProtocol IP_PROTO_CPHB = new IpProtocol(IP_PROTO_NUM_CPHB);
- public static final IpProtocol IP_PROTO_WSN = new IpProtocol(IP_PROTO_NUM_WSN);
- public static final IpProtocol IP_PROTO_PVP = new IpProtocol(IP_PROTO_NUM_PVP);
- public static final IpProtocol IP_PROTO_BR_SAT_MON = new IpProtocol(IP_PROTO_NUM_BR_SAT_MON);
- public static final IpProtocol IP_PROTO_SUN_ND = new IpProtocol(IP_PROTO_NUM_SUN_ND);
- public static final IpProtocol IP_PROTO_WB_MON = new IpProtocol(IP_PROTO_NUM_WB_MON);
- public static final IpProtocol IP_PROTO_WB_EXPAK = new IpProtocol(IP_PROTO_NUM_WB_EXPAK);
- public static final IpProtocol IP_PROTO_ISO_IP = new IpProtocol(IP_PROTO_NUM_ISO_IP);
- public static final IpProtocol IP_PROTO_VMTP = new IpProtocol(IP_PROTO_NUM_VMTP);
- public static final IpProtocol IP_PROTO_SECURE_VMTP = new IpProtocol(IP_PROTO_NUM_SECURE_VMTP);
- public static final IpProtocol IP_PROTO_VINES = new IpProtocol(IP_PROTO_NUM_VINES);
- public static final IpProtocol IP_PROTO_TTP_IPTM = new IpProtocol(IP_PROTO_NUM_TTP_IPTM);
- public static final IpProtocol IP_PROTO_NSFNET_IGP = new IpProtocol(IP_PROTO_NUM_NSFNET_IGP);
- public static final IpProtocol IP_PROTO_DGP = new IpProtocol(IP_PROTO_NUM_DGP);
- public static final IpProtocol IP_PROTO_TCF = new IpProtocol(IP_PROTO_NUM_TCF);
- public static final IpProtocol IP_PROTO_EIGRP = new IpProtocol(IP_PROTO_NUM_EIGRP);
- public static final IpProtocol IP_PROTO_OSPF = new IpProtocol(IP_PROTO_NUM_OSPF);
- public static final IpProtocol IP_PROTO_Sprite_RPC = new IpProtocol(IP_PROTO_NUM_Sprite_RPC);
- public static final IpProtocol IP_PROTO_LARP = new IpProtocol(IP_PROTO_NUM_LARP);
- public static final IpProtocol IP_PROTO_MTP = new IpProtocol(IP_PROTO_NUM_MTP);
- public static final IpProtocol IP_PROTO_AX_25 = new IpProtocol(IP_PROTO_NUM_AX_25);
- public static final IpProtocol IP_PROTO_IPIP = new IpProtocol(IP_PROTO_NUM_IPIP);
- public static final IpProtocol IP_PROTO_MICP = new IpProtocol(IP_PROTO_NUM_MICP);
- public static final IpProtocol IP_PROTO_SCC_SP = new IpProtocol(IP_PROTO_NUM_SCC_SP);
- public static final IpProtocol IP_PROTO_ETHERIP = new IpProtocol(IP_PROTO_NUM_ETHERIP);
- public static final IpProtocol IP_PROTO_ENCAP = new IpProtocol(IP_PROTO_NUM_ENCAP);
- public static final IpProtocol IP_PROTO_PRIVATE_ENCRYPT = new IpProtocol(IP_PROTO_NUM_PRIVATE_ENCRYPT);
- public static final IpProtocol IP_PROTO_GMTP = new IpProtocol(IP_PROTO_NUM_GMTP);
- public static final IpProtocol IP_PROTO_IFMP = new IpProtocol(IP_PROTO_NUM_IFMP);
- public static final IpProtocol IP_PROTO_PNNI = new IpProtocol(IP_PROTO_NUM_PNNI);
- public static final IpProtocol IP_PROTO_PIM = new IpProtocol(IP_PROTO_NUM_PIM);
- public static final IpProtocol IP_PROTO_ARIS = new IpProtocol(IP_PROTO_NUM_ARIS);
- public static final IpProtocol IP_PROTO_SCPS = new IpProtocol(IP_PROTO_NUM_SCPS);
- public static final IpProtocol IP_PROTO_QNX = new IpProtocol(IP_PROTO_NUM_QNX);
- public static final IpProtocol IP_PROTO_A_N = new IpProtocol(IP_PROTO_NUM_A_N);
- public static final IpProtocol IP_PROTO_IP_COMP = new IpProtocol(IP_PROTO_NUM_IP_COMP);
- public static final IpProtocol IP_PROTO_SNP = new IpProtocol(IP_PROTO_NUM_SNP);
- public static final IpProtocol IP_PROTO_COMPAQ_PEER = new IpProtocol(IP_PROTO_NUM_COMPAQ_PEER);
- public static final IpProtocol IP_PROTO_IPX_IN_IP = new IpProtocol(IP_PROTO_NUM_IPX_IN_IP);
- public static final IpProtocol IP_PROTO_VRRP = new IpProtocol(IP_PROTO_NUM_VRRP);
- public static final IpProtocol IP_PROTO_PGM = new IpProtocol(IP_PROTO_NUM_PGM);
- public static final IpProtocol IP_PROTO_ZERO_HOP = new IpProtocol(IP_PROTO_NUM_ZERO_HOP);
- public static final IpProtocol IP_PROTO_L2TP = new IpProtocol(IP_PROTO_NUM_L2TP);
- public static final IpProtocol IP_PROTO_DDX = new IpProtocol(IP_PROTO_NUM_DDX);
- public static final IpProtocol IP_PROTO_IATP = new IpProtocol(IP_PROTO_NUM_IATP);
- public static final IpProtocol IP_PROTO_STP = new IpProtocol(IP_PROTO_NUM_STP);
- public static final IpProtocol IP_PROTO_SRP = new IpProtocol(IP_PROTO_NUM_SRP);
- public static final IpProtocol IP_PROTO_UTI = new IpProtocol(IP_PROTO_NUM_UTI);
- public static final IpProtocol IP_PROTO_SMP = new IpProtocol(IP_PROTO_NUM_SMP);
- public static final IpProtocol IP_PROTO_SM = new IpProtocol(IP_PROTO_NUM_SM);
- public static final IpProtocol IP_PROTO_PTP = new IpProtocol(IP_PROTO_NUM_PTP);
- public static final IpProtocol IP_PROTO_IS_IS_OVER_IPv4 = new IpProtocol(IP_PROTO_NUM_IS_IS_OVER_IPv4);
- public static final IpProtocol IP_PROTO_FIRE = new IpProtocol(IP_PROTO_NUM_FIRE);
- public static final IpProtocol IP_PROTO_CRTP = new IpProtocol(IP_PROTO_NUM_CRTP);
- public static final IpProtocol IP_PROTO_CRUDP = new IpProtocol(IP_PROTO_NUM_CRUDP);
- public static final IpProtocol IP_PROTO_SSCOPMCE = new IpProtocol(IP_PROTO_NUM_SSCOPMCE);
- public static final IpProtocol IP_PROTO_IPLT = new IpProtocol(IP_PROTO_NUM_IPLT);
- public static final IpProtocol IP_PROTO_SPS = new IpProtocol(IP_PROTO_NUM_SPS);
- public static final IpProtocol IP_PROTO_PIPE = new IpProtocol(IP_PROTO_NUM_PIPE);
- public static final IpProtocol IP_PROTO_SCTP = new IpProtocol(IP_PROTO_NUM_SCTP);
- public static final IpProtocol IP_PROTO_FC = new IpProtocol(IP_PROTO_NUM_FC);
- public static final IpProtocol IP_PROTO_RSVP_E2E_IGNORE = new IpProtocol(IP_PROTO_NUM_RSVP_E2E_IGNORE);
- public static final IpProtocol IP_PROTO_MOBILITY_HEADER = new IpProtocol(IP_PROTO_NUM_MOBILITY_HEADER);
- public static final IpProtocol IP_PROTO_UDP_LITE = new IpProtocol(IP_PROTO_NUM_UDP_LITE);
- public static final IpProtocol IP_PROTO_MPLS_IN_IP = new IpProtocol(IP_PROTO_NUM_MPLS_IN_IP);
- public static final IpProtocol IP_PROTO_MANET = new IpProtocol(IP_PROTO_NUM_MANET);
- public static final IpProtocol IP_PROTO_HIP = new IpProtocol(IP_PROTO_NUM_HIP);
- public static final IpProtocol IP_PROTO_SHIM6 = new IpProtocol(IP_PROTO_NUM_SHIM6);
-
- public static final IpProtocol NO_MASK = IP_PROTO_HOPOPT;
- public static final IpProtocol FULL_MASK = new IpProtocol((short)0x0000);
-
- private IpProtocol(short version) {
- this.proto = version;
- }
-
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public static IpProtocol of(short proto) {
- switch (proto) {
- case IP_PROTO_NUM_HOPOPT:
- return IP_PROTO_HOPOPT;
- case IP_PROTO_NUM_ICMP:
- return IP_PROTO_ICMP;
- case IP_PROTO_NUM_IGMP:
- return IP_PROTO_IGMP;
- case IP_PROTO_NUM_GGP:
- return IP_PROTO_GGP;
- case IP_PROTO_NUM_IPv4:
- return IP_PROTO_IPv4;
- case IP_PROTO_NUM_ST:
- return IP_PROTO_ST;
- case IP_PROTO_NUM_TCP:
- return IP_PROTO_TCP;
- case IP_PROTO_NUM_CBT:
- return IP_PROTO_CBT;
- case IP_PROTO_NUM_EGP:
- return IP_PROTO_EGP;
- case IP_PROTO_NUM_IGP:
- return IP_PROTO_IGP;
- case IP_PROTO_NUM_BBN_RCC_MON:
- return IP_PROTO_BBN_RCC_MON;
- case IP_PROTO_NUM_NVP_II:
- return IP_PROTO_NVP_II;
- case IP_PROTO_NUM_PUP:
- return IP_PROTO_PUP;
- case IP_PROTO_NUM_ARGUS:
- return IP_PROTO_ARGUS;
- case IP_PROTO_NUM_EMCON:
- return IP_PROTO_EMCON;
- case IP_PROTO_NUM_XNET:
- return IP_PROTO_XNET;
- case IP_PROTO_NUM_CHAOS:
- return IP_PROTO_CHAOS;
- case IP_PROTO_NUM_UDP:
- return IP_PROTO_UDP;
- case IP_PROTO_NUM_MUX:
- return IP_PROTO_MUX;
- case IP_PROTO_NUM_DCN_MEAS:
- return IP_PROTO_DCN_MEAS;
- case IP_PROTO_NUM_HMP:
- return IP_PROTO_HMP;
- case IP_PROTO_NUM_PRM:
- return IP_PROTO_PRM;
- case IP_PROTO_NUM_XNS_IDP:
- return IP_PROTO_XNS_IDP;
- case IP_PROTO_NUM_TRUNK_1:
- return IP_PROTO_TRUNK_1;
- case IP_PROTO_NUM_TRUNK_2:
- return IP_PROTO_TRUNK_2;
- case IP_PROTO_NUM_LEAF_1:
- return IP_PROTO_LEAF_1;
- case IP_PROTO_NUM_LEAF_2:
- return IP_PROTO_LEAF_2;
- case IP_PROTO_NUM_RDP:
- return IP_PROTO_RDP;
- case IP_PROTO_NUM_IRTP:
- return IP_PROTO_IRTP;
- case IP_PROTO_NUM_ISO_TP4:
- return IP_PROTO_ISO_TP4;
- case IP_PROTO_NUM_NETBLT:
- return IP_PROTO_NETBLT;
- case IP_PROTO_NUM_MFE_NSP:
- return IP_PROTO_MFE_NSP;
- case IP_PROTO_NUM_MERIT_INP:
- return IP_PROTO_MERIT_INP;
- case IP_PROTO_NUM_DCCP:
- return IP_PROTO_DCCP;
- case IP_PROTO_NUM_3PC:
- return IP_PROTO_3PC;
- case IP_PROTO_NUM_IDPR:
- return IP_PROTO_IDPR;
- case IP_PROTO_NUM_XTP:
- return IP_PROTO_XTP;
- case IP_PROTO_NUM_DDP:
- return IP_PROTO_DDP;
- case IP_PROTO_NUM_IDPR_CMTP:
- return IP_PROTO_IDPR_CMTP;
- case IP_PROTO_NUM_TP_PP:
- return IP_PROTO_TP_PP;
- case IP_PROTO_NUM_IL:
- return IP_PROTO_IL;
- case IP_PROTO_NUM_IPv6:
- return IP_PROTO_IPv6;
- case IP_PROTO_NUM_SDRP:
- return IP_PROTO_SDRP;
- case IP_PROTO_NUM_IPv6_ROUTE:
- return IP_PROTO_IPv6_ROUTE;
- case IP_PROTO_NUM_IPv6_FRAG:
- return IP_PROTO_IPv6_FRAG;
- case IP_PROTO_NUM_IDRP:
- return IP_PROTO_IDRP;
- case IP_PROTO_NUM_RSVP:
- return IP_PROTO_RSVP;
- case IP_PROTO_NUM_GRE:
- return IP_PROTO_GRE;
- case IP_PROTO_NUM_MHRP:
- return IP_PROTO_MHRP;
- case IP_PROTO_NUM_BNA:
- return IP_PROTO_BNA;
- case IP_PROTO_NUM_ESP:
- return IP_PROTO_ESP;
- case IP_PROTO_NUM_AH:
- return IP_PROTO_AH;
- case IP_PROTO_NUM_I_NLSP:
- return IP_PROTO_I_NLSP;
- case IP_PROTO_NUM_SWIPE:
- return IP_PROTO_SWIPE;
- case IP_PROTO_NUM_NARP:
- return IP_PROTO_NARP;
- case IP_PROTO_NUM_MOBILE:
- return IP_PROTO_MOBILE;
- case IP_PROTO_NUM_TLSP:
- return IP_PROTO_TLSP;
- case IP_PROTO_NUM_SKIP:
- return IP_PROTO_SKIP;
- case IP_PROTO_NUM_IPv6_ICMP:
- return IP_PROTO_IPv6_ICMP;
- case IP_PROTO_NUM_IPv6_NO_NXT:
- return IP_PROTO_IPv6_NO_NXT;
- case IP_PROTO_NUM_IPv6_OPTS:
- return IP_PROTO_IPv6_OPTS;
- case IP_PROTO_NUM_HOST_INTERNAL:
- return IP_PROTO_HOST_INTERNAL;
- case IP_PROTO_NUM_CFTP:
- return IP_PROTO_CFTP;
- case IP_PROTO_NUM_LOCAL_NET:
- return IP_PROTO_LOCAL_NET;
- case IP_PROTO_NUM_SAT_EXPAK:
- return IP_PROTO_SAT_EXPAK;
- case IP_PROTO_NUM_KRYPTOLAN:
- return IP_PROTO_KRYPTOLAN;
- case IP_PROTO_NUM_RVD:
- return IP_PROTO_RVD;
- case IP_PROTO_NUM_IPPC:
- return IP_PROTO_IPPC;
- case IP_PROTO_NUM_DIST_FS:
- return IP_PROTO_DIST_FS;
- case IP_PROTO_NUM_SAT_MON:
- return IP_PROTO_SAT_MON;
- case IP_PROTO_NUM_VISA:
- return IP_PROTO_VISA;
- case IP_PROTO_NUM_IPCV:
- return IP_PROTO_IPCV;
- case IP_PROTO_NUM_CPNX:
- return IP_PROTO_CPNX;
- case IP_PROTO_NUM_CPHB:
- return IP_PROTO_CPHB;
- case IP_PROTO_NUM_WSN:
- return IP_PROTO_WSN;
- case IP_PROTO_NUM_PVP:
- return IP_PROTO_PVP;
- case IP_PROTO_NUM_BR_SAT_MON:
- return IP_PROTO_BR_SAT_MON;
- case IP_PROTO_NUM_SUN_ND:
- return IP_PROTO_SUN_ND;
- case IP_PROTO_NUM_WB_MON:
- return IP_PROTO_WB_MON;
- case IP_PROTO_NUM_WB_EXPAK:
- return IP_PROTO_WB_EXPAK;
- case IP_PROTO_NUM_ISO_IP:
- return IP_PROTO_ISO_IP;
- case IP_PROTO_NUM_VMTP:
- return IP_PROTO_VMTP;
- case IP_PROTO_NUM_SECURE_VMTP:
- return IP_PROTO_SECURE_VMTP;
- case IP_PROTO_NUM_VINES:
- return IP_PROTO_VINES;
- case IP_PROTO_NUM_TTP_IPTM:
- return IP_PROTO_TTP_IPTM;
- case IP_PROTO_NUM_NSFNET_IGP:
- return IP_PROTO_NSFNET_IGP;
- case IP_PROTO_NUM_DGP:
- return IP_PROTO_DGP;
- case IP_PROTO_NUM_TCF:
- return IP_PROTO_TCF;
- case IP_PROTO_NUM_EIGRP:
- return IP_PROTO_EIGRP;
- case IP_PROTO_NUM_OSPF:
- return IP_PROTO_OSPF;
- case IP_PROTO_NUM_Sprite_RPC:
- return IP_PROTO_Sprite_RPC;
- case IP_PROTO_NUM_LARP:
- return IP_PROTO_LARP;
- case IP_PROTO_NUM_MTP:
- return IP_PROTO_MTP;
- case IP_PROTO_NUM_AX_25:
- return IP_PROTO_AX_25;
- case IP_PROTO_NUM_IPIP:
- return IP_PROTO_IPIP;
- case IP_PROTO_NUM_MICP:
- return IP_PROTO_MICP;
- case IP_PROTO_NUM_SCC_SP:
- return IP_PROTO_SCC_SP;
- case IP_PROTO_NUM_ETHERIP:
- return IP_PROTO_ETHERIP;
- case IP_PROTO_NUM_ENCAP:
- return IP_PROTO_ENCAP;
- case IP_PROTO_NUM_PRIVATE_ENCRYPT:
- return IP_PROTO_PRIVATE_ENCRYPT;
- case IP_PROTO_NUM_GMTP:
- return IP_PROTO_GMTP;
- case IP_PROTO_NUM_IFMP:
- return IP_PROTO_IFMP;
- case IP_PROTO_NUM_PNNI:
- return IP_PROTO_PNNI;
- case IP_PROTO_NUM_PIM:
- return IP_PROTO_PIM;
- case IP_PROTO_NUM_ARIS:
- return IP_PROTO_ARIS;
- case IP_PROTO_NUM_SCPS:
- return IP_PROTO_SCPS;
- case IP_PROTO_NUM_QNX:
- return IP_PROTO_QNX;
- case IP_PROTO_NUM_A_N:
- return IP_PROTO_A_N;
- case IP_PROTO_NUM_IP_COMP:
- return IP_PROTO_IP_COMP;
- case IP_PROTO_NUM_SNP:
- return IP_PROTO_SNP;
- case IP_PROTO_NUM_COMPAQ_PEER:
- return IP_PROTO_COMPAQ_PEER;
- case IP_PROTO_NUM_IPX_IN_IP:
- return IP_PROTO_IPX_IN_IP;
- case IP_PROTO_NUM_VRRP:
- return IP_PROTO_VRRP;
- case IP_PROTO_NUM_PGM:
- return IP_PROTO_PGM;
- case IP_PROTO_NUM_ZERO_HOP:
- return IP_PROTO_ZERO_HOP;
- case IP_PROTO_NUM_L2TP:
- return IP_PROTO_L2TP;
- case IP_PROTO_NUM_DDX:
- return IP_PROTO_DDX;
- case IP_PROTO_NUM_IATP:
- return IP_PROTO_IATP;
- case IP_PROTO_NUM_STP:
- return IP_PROTO_STP;
- case IP_PROTO_NUM_SRP:
- return IP_PROTO_SRP;
- case IP_PROTO_NUM_UTI:
- return IP_PROTO_UTI;
- case IP_PROTO_NUM_SMP:
- return IP_PROTO_SMP;
- case IP_PROTO_NUM_SM:
- return IP_PROTO_SM;
- case IP_PROTO_NUM_PTP:
- return IP_PROTO_PTP;
- case IP_PROTO_NUM_IS_IS_OVER_IPv4:
- return IP_PROTO_IS_IS_OVER_IPv4;
- case IP_PROTO_NUM_FIRE:
- return IP_PROTO_FIRE;
- case IP_PROTO_NUM_CRTP:
- return IP_PROTO_CRTP;
- case IP_PROTO_NUM_CRUDP:
- return IP_PROTO_CRUDP;
- case IP_PROTO_NUM_SSCOPMCE:
- return IP_PROTO_SSCOPMCE;
- case IP_PROTO_NUM_IPLT:
- return IP_PROTO_IPLT;
- case IP_PROTO_NUM_SPS:
- return IP_PROTO_SPS;
- case IP_PROTO_NUM_PIPE:
- return IP_PROTO_PIPE;
- case IP_PROTO_NUM_SCTP:
- return IP_PROTO_SCTP;
- case IP_PROTO_NUM_FC:
- return IP_PROTO_FC;
- case IP_PROTO_NUM_RSVP_E2E_IGNORE:
- return IP_PROTO_RSVP_E2E_IGNORE;
- case IP_PROTO_NUM_MOBILITY_HEADER:
- return IP_PROTO_MOBILITY_HEADER;
- case IP_PROTO_NUM_UDP_LITE:
- return IP_PROTO_UDP_LITE;
- case IP_PROTO_NUM_MPLS_IN_IP:
- return IP_PROTO_MPLS_IN_IP;
- case IP_PROTO_NUM_MANET:
- return IP_PROTO_MANET;
- case IP_PROTO_NUM_HIP:
- return IP_PROTO_HIP;
- case IP_PROTO_NUM_SHIM6:
- return IP_PROTO_SHIM6;
- default:
- if (proto >= MAX_PROTO) {
- throw new IllegalArgumentException("Illegal IP protocol number: "
- + proto);
- } else {
- return new IpProtocol(proto);
- }
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof IpProtocol))
- return false;
- IpProtocol o = (IpProtocol)obj;
- if (o.proto != this.proto)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 37;
- int result = 1;
- result = prime * result + proto;
- return result;
- }
-
- @Override
- public String toString() {
- return Integer.toHexString(proto);
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeByte(this.proto);
- }
-
- public static IpProtocol readByte(ChannelBuffer c) {
- return IpProtocol.of(c.readUnsignedByte());
- }
-
- @Override
- public IpProtocol applyMask(IpProtocol mask) {
- return IpProtocol.of((short)(this.proto & mask.proto));
- }
-
- public short getIpProtocolNumber() {
- return proto;
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/MacAddress.java b/java_gen/pre-written/src/main/java/org/openflow/types/MacAddress.java
deleted file mode 100644
index 7723d6f..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/MacAddress.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.util.HexString;
-
-/**
- * Wrapper around a 6 byte mac address.
- *
- * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
- */
-
-public class MacAddress implements OFValueType<MacAddress> {
- static final int MacAddrLen = 6;
- private final long rawValue;
-
- public static final MacAddress NO_MASK = MacAddress.of(0xFFFFFFFFFFFFFFFFl);
- public static final MacAddress FULL_MASK = MacAddress.of(0x0);
-
- private MacAddress(final long rawValue) {
- this.rawValue = rawValue;
- }
-
- public static MacAddress of(final byte[] address) {
- long raw =
- (address[0] & 0xFFL) << 40 | (address[1] & 0xFFL) << 32
- | (address[2] & 0xFFL) << 24 | (address[3] & 0xFFL) << 16
- | (address[4] & 0xFFL) << 8 | (address[5] & 0xFFL);
- return MacAddress.of(raw);
- }
-
- public static MacAddress of(final long raw) {
- return new MacAddress(raw);
- }
-
- public static MacAddress of(final String string) {
- int index = 0;
- int shift = 40;
-
- long raw = 0;
- if (string.length() != 6 * 2 + 5)
- throw new IllegalArgumentException("Mac address not well formed: " + string);
-
- while (shift >= 0) {
- raw |=
- ((long) (Character.digit(string.charAt(index++), 16) << 4 | Character
- .digit(string.charAt(index++), 16))) << shift;
-
- if (shift == 0)
- break;
- if (string.charAt(index++) != ':')
- throw new IllegalArgumentException("Mac address not well formed: " + string);
- shift -= 8;
- }
- return MacAddress.of(raw);
- }
-
- volatile byte[] bytesCache = null;
-
- public byte[] getBytes() {
- if (bytesCache == null) {
- synchronized (this) {
- if (bytesCache == null) {
- bytesCache =
- new byte[] { (byte) ((rawValue >> 40) & 0xFF),
- (byte) ((rawValue >> 32) & 0xFF),
- (byte) ((rawValue >> 24) & 0xFF),
- (byte) ((rawValue >> 16) & 0xFF),
- (byte) ((rawValue >> 8) & 0xFF),
- (byte) ((rawValue >> 0) & 0xFF) };
- }
- }
- }
- return bytesCache;
- }
-
- @Override
- public int getLength() {
- return MacAddrLen;
- }
-
- @Override
- public String toString() {
- return HexString.toHexString(rawValue, 6);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (rawValue ^ (rawValue >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- MacAddress other = (MacAddress) obj;
- if (rawValue != other.rawValue)
- return false;
- return true;
- }
-
- public long getLong() {
- return rawValue;
- }
-
- public void write6Bytes(ChannelBuffer c) {
- c.writeInt((int) (this.rawValue >> 16));
- c.writeShort((int) this.rawValue & 0xFFFF);
- }
-
- public static MacAddress read6Bytes(ChannelBuffer c) throws OFParseError {
- long raw = c.readUnsignedInt() << 16 | c.readUnsignedShort();
- return MacAddress.of(raw);
- }
-
- @Override
- public MacAddress applyMask(MacAddress mask) {
- return MacAddress.of(this.rawValue & mask.rawValue);
- }
-
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/Masked.java b/java_gen/pre-written/src/main/java/org/openflow/types/Masked.java
deleted file mode 100644
index 433ca9d..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/Masked.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.openflow.types;
-
-
-
-public class Masked<T extends OFValueType<T>> implements OFValueType<Masked<T>> {
- protected T value;
- protected T mask;
-
- protected Masked(T value, T mask) {
- this.value = value.applyMask(mask);
- this.mask = mask;
- }
-
- public T getValue() {
- return value;
- }
-
- public T getMask() {
- return mask;
- }
-
- public static <T extends OFValueType<T>> Masked<T> of(T value, T mask) {
- return new Masked<T>(value, mask);
- }
-
- @Override
- public int getLength() {
- return this.value.getLength() + this.mask.getLength();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof Masked<?>))
- return false;
- Masked<?> mobj = (Masked<?>)obj;
- return this.value.equals(mobj.value) && this.mask.equals(mobj.mask);
- }
-
- @Override
- public int hashCode() {
- final int prime = 59;
- int result = 1;
- result = prime * result + this.value.hashCode();
- result = prime * result + this.mask.hashCode();
- return result;
- }
-
- @Override
- public String toString() {
- // General representation: value/mask
- StringBuilder sb = new StringBuilder();
- sb.append(value.toString()).append('/').append(mask.toString());
- return sb.toString();
- }
-
- @Override
- public Masked<T> applyMask(Masked<T> mask) {
- return this;
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/OFFlowModCmd.java b/java_gen/pre-written/src/main/java/org/openflow/types/OFFlowModCmd.java
deleted file mode 100644
index 6ca2c04..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/OFFlowModCmd.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.openflow.types;
-
-/**
- * Version agnostic view of commands to an OFFlowMod
- *
- * @author capveg
- */
-
-public enum OFFlowModCmd {
- ADD, MODIFY, MODIFY_STRICT, DELETE, DELETE_STRICT
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/OFHelloElement.java b/java_gen/pre-written/src/main/java/org/openflow/types/OFHelloElement.java
deleted file mode 100644
index 288e1b6..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/OFHelloElement.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.openflow.types;
-
-public interface OFHelloElement {
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/OFMetadata.java b/java_gen/pre-written/src/main/java/org/openflow/types/OFMetadata.java
deleted file mode 100644
index 86799eb..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/OFMetadata.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-public class OFMetadata implements OFValueType<OFMetadata> {
-
- private static int LENGTH = 8;
-
- private final U64 u64;
-
- public static final OFMetadata NO_MASK = OFMetadata.of(U64.ofRaw(0xFFFFFFFFFFFFFFFFl));
- public static final OFMetadata FULL_MASK = OFMetadata.of(U64.ofRaw(0x0));
-
- public OFMetadata(U64 ofRaw) {
- u64 = ofRaw;
- }
-
- public static OFMetadata of(U64 u64) {
- return new OFMetadata(u64);
- }
-
- public static OFMetadata ofRaw(long raw) {
- return new OFMetadata(U64.ofRaw(raw));
- }
-
- public static OFMetadata read8Bytes(ChannelBuffer cb) {
- return OFMetadata.ofRaw(cb.readLong());
- }
-
- public void write8Bytes(ChannelBuffer cb) {
- u64.writeTo(cb);
- }
-
- @Override
- public int getLength() {
- return u64.getLength();
- }
-
- @Override
- public OFMetadata applyMask(OFMetadata mask) {
- return OFMetadata.of(this.u64.applyMask(mask.u64));
- }
-
- @Override
- public boolean equals(Object arg0) {
- if (!(arg0 instanceof OFMetadata))
- return false;
- OFMetadata other = (OFMetadata)arg0;
-
- return this.u64.equals(other.u64);
- }
-
- @Override
- public int hashCode() {
- int prime = 53;
- return this.u64.hashCode() * prime;
- }
-
- @Override
- public String toString() {
- return "Metadata: " + u64.toString();
- }
-
-
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/OFPhysicalPort.java b/java_gen/pre-written/src/main/java/org/openflow/types/OFPhysicalPort.java
deleted file mode 100644
index d3b1c9f..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/OFPhysicalPort.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFMessageReader;
-import org.openflow.protocol.Writeable;
-
-/**
- * A wrapper around the OpenFlow physical port description. The interfaces to
- * this object are version agnostic.
- *
- * @author capveg
- */
-
-public class OFPhysicalPort implements OFValueType<OFPhysicalPort>, Writeable {
-
- static final int LENGTH = 4;
-
- private final int port;
-
- public static final OFPhysicalPort NO_MASK = OFPhysicalPort.of(0xFFFFFFFF);
- public static final OFPhysicalPort FULL_MASK = OFPhysicalPort.of(0x0);
-
- private OFPhysicalPort(int port) {
- this.port = port;
- }
-
- public static OFPhysicalPort of(int port) {
- return new OFPhysicalPort(port);
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof OFPhysicalPort))
- return false;
- OFPhysicalPort other = (OFPhysicalPort)obj;
- if (other.port != this.port)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 59;
- int result = 1;
- result = prime * result + port;
- return result;
- }
-
- @Override
- public String toString() {
- return Integer.toHexString(port);
- }
-
- public void write4Bytes(ChannelBuffer c) {
- c.writeInt(this.port);
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- write4Bytes(bb);
- }
-
- public static OFPhysicalPort read4Bytes(ChannelBuffer c) throws OFParseError {
- return OFPhysicalPort.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
- }
-
- @Override
- public OFPhysicalPort applyMask(OFPhysicalPort mask) {
- return OFPhysicalPort.of(this.port & mask.port);
- }
-
- public int getPortNumber() {
- return port;
- }
-
- public final static Reader READER = new Reader();
- private static class Reader implements OFMessageReader<OFPhysicalPort> {
- @Override
- public OFPhysicalPort readFrom(ChannelBuffer bb) throws OFParseError {
- return OFPhysicalPort.read4Bytes(bb);
- }
-
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/OFPort.java b/java_gen/pre-written/src/main/java/org/openflow/types/OFPort.java
deleted file mode 100644
index eaf96de..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/OFPort.java
+++ /dev/null
@@ -1,541 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.annotations.Immutable;
-import org.openflow.exceptions.OFParseError;
-
-/**
- * Abstraction of an logical / OpenFlow switch port (ofp_port_no) in OpenFlow.
- * Immutable. Note: Switch port numbers were changed in OpenFlow 1.1 from uint16
- * to uint32. This class uses a 32 bit representation internally. Port numbers
- * are converted from/to uint16 when constructed / getPortNumberasShort is
- * called. If this port is not representable in OpenFlow 1.0, an
- * IllegalStateException is raised.
- *
- * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
- */
-@Immutable
-public class OFPort implements OFValueType<OFPort> {
- static final int LENGTH = 4;
-
- // private int constants (OF1.1+) to avoid duplication in the code
- // should not have to use these outside this class
- private static final int OFPP_ANY_INT = 0xFFffFFff;
- private static final int OFPP_LOCAL_INT = 0xFFffFFfe;
- private static final int OFPP_CONTROLLER_INT = 0xFFffFFfd;
- private static final int OFPP_ALL_INT = 0xFFffFFfc;
- private static final int OFPP_FLOOD_INT = 0xFFffFFfb;
- private static final int OFPP_NORMAL_INT = 0xFFffFFfa;
- private static final int OFPP_TABLE_INT = 0xFFffFFf9;
- private static final int OFPP_MAX_INT = 0xFFffFF00;
- private static final int OFPP_IN_PORT_INT = 0xFFffFFf8;
-
- // private short constants (OF1.0) to avoid duplication in the code
- // should not have to use these outside this class
- private static final short OFPP_ANY_SHORT = (short) 0xFFff;
- private static final short OFPP_LOCAL_SHORT = (short) 0xFFfe;
- private static final short OFPP_CONTROLLER_SHORT = (short) 0xFFfd;
- private static final short OFPP_ALL_SHORT = (short) 0xFFfc;
- private static final short OFPP_FLOOD_SHORT = (short) 0xFFfb;
- private static final short OFPP_NORMAL_SHORT = (short) 0xFFfa;
- private static final short OFPP_TABLE_SHORT = (short) 0xFFf9;
- private static final short OFPP_IN_PORT_SHORT = (short) 0xFFf8;
- private static final short OFPP_MAX_SHORT = (short) 0xFF00;
- private static final int OFPP_MAX_SHORT_UNSIGNED = 0xFF00;
-
- // ////////////// public constants - use to access well known OpenFlow ports
-
- /** Maximum number of physical and logical switch ports. */
- public final static OFPort MAX = new NamedPort(OFPP_MAX_INT, "max");
-
- /**
- * Send the packet out the input port. This reserved port must be explicitly
- * used in order to send back out of the input port.
- */
- public final static OFPort IN_PORT = new NamedPort(OFPP_IN_PORT_INT, "in_port");
-
- /**
- * Submit the packet to the first flow table NB: This destination port can
- * only be used in packet-out messages.
- */
- public final static OFPort TABLE = new NamedPort(OFPP_TABLE_INT, "table");
-
- /** Process with normal L2/L3 switching. */
- public final static OFPort NORMAL = new NamedPort(OFPP_NORMAL_INT, "normal");
-
- /**
- * All physical ports in VLAN, except input port and those blocked or link
- * down
- */
- public final static OFPort FLOOD = new NamedPort(OFPP_FLOOD_INT, "flood");
-
- /** All physical ports except input port */
- public final static OFPort ALL = new NamedPort(OFPP_ALL_INT, "all");
-
- /** Send to controller */
- public final static OFPort CONTROLLER =
- new NamedPort(OFPP_CONTROLLER_INT, "controller");
-
- /** local openflow "port" */
- public final static OFPort LOCAL = new NamedPort(OFPP_LOCAL_INT, "local");
-
- /**
- * Wildcard port used only for flow mod (delete) and flow stats requests.
- * Selects all flows regardless of output port (including flows with no
- * output port). NOTE: OpenFlow 1.0 calls this 'NONE'
- */
- public final static OFPort ANY = new NamedPort(OFPP_ANY_INT, "any");
-
- public static final OFPort NO_MASK = OFPort.of(0xFFFFFFFF);
- public static final OFPort FULL_MASK = OFPort.of(0x0);
-
- /** cache of frequently used ports */
- private static class PrecachedPort {
- private final static OFPort p1 = new OFPort(1);
- private final static OFPort p2 = new OFPort(2);
- private final static OFPort p3 = new OFPort(3);
- private final static OFPort p4 = new OFPort(4);
- private final static OFPort p5 = new OFPort(5);
- private final static OFPort p6 = new OFPort(6);
- private final static OFPort p7 = new OFPort(7);
- private final static OFPort p8 = new OFPort(8);
- private final static OFPort p9 = new OFPort(9);
- private final static OFPort p10 = new OFPort(10);
- private final static OFPort p11 = new OFPort(11);
- private final static OFPort p12 = new OFPort(12);
- private final static OFPort p13 = new OFPort(13);
- private final static OFPort p14 = new OFPort(14);
- private final static OFPort p15 = new OFPort(15);
- private final static OFPort p16 = new OFPort(16);
- private final static OFPort p17 = new OFPort(17);
- private final static OFPort p18 = new OFPort(18);
- private final static OFPort p19 = new OFPort(19);
- private final static OFPort p20 = new OFPort(20);
- private final static OFPort p21 = new OFPort(21);
- private final static OFPort p22 = new OFPort(22);
- private final static OFPort p23 = new OFPort(23);
- private final static OFPort p24 = new OFPort(24);
- private final static OFPort p25 = new OFPort(25);
- private final static OFPort p26 = new OFPort(26);
- private final static OFPort p27 = new OFPort(27);
- private final static OFPort p28 = new OFPort(28);
- private final static OFPort p29 = new OFPort(29);
- private final static OFPort p31 = new OFPort(31);
- private final static OFPort p32 = new OFPort(32);
- private final static OFPort p33 = new OFPort(33);
- private final static OFPort p34 = new OFPort(34);
- private final static OFPort p35 = new OFPort(35);
- private final static OFPort p36 = new OFPort(36);
- private final static OFPort p37 = new OFPort(37);
- private final static OFPort p38 = new OFPort(38);
- private final static OFPort p39 = new OFPort(39);
- private final static OFPort p40 = new OFPort(40);
- private final static OFPort p41 = new OFPort(41);
- private final static OFPort p42 = new OFPort(42);
- private final static OFPort p43 = new OFPort(43);
- private final static OFPort p44 = new OFPort(44);
- private final static OFPort p45 = new OFPort(45);
- private final static OFPort p46 = new OFPort(46);
- private final static OFPort p47 = new OFPort(47);
- private final static OFPort p48 = new OFPort(48);
- }
-
- /** raw openflow port number as a signed 32 bit integer */
- private final int portNumber;
-
- /** private constructor. use of*-Factory methods instead */
- private OFPort(final int portNumber) {
- this.portNumber = portNumber;
- }
-
- /**
- * get an OFPort object corresponding to a raw 32-bit integer port number.
- * NOTE: The port object may either be newly allocated or cached. Do not
- * rely on either behavior.
- *
- * @param portNumber
- * @return a corresponding OFPort
- */
- public static OFPort ofInt(final int portNumber) {
- switch (portNumber) {
- case 1:
- return PrecachedPort.p1;
- case 2:
- return PrecachedPort.p2;
- case 3:
- return PrecachedPort.p3;
- case 4:
- return PrecachedPort.p4;
- case 5:
- return PrecachedPort.p5;
- case 6:
- return PrecachedPort.p6;
- case 7:
- return PrecachedPort.p7;
- case 8:
- return PrecachedPort.p8;
- case 9:
- return PrecachedPort.p9;
- case 10:
- return PrecachedPort.p10;
- case 11:
- return PrecachedPort.p11;
- case 12:
- return PrecachedPort.p12;
- case 13:
- return PrecachedPort.p13;
- case 14:
- return PrecachedPort.p14;
- case 15:
- return PrecachedPort.p15;
- case 16:
- return PrecachedPort.p16;
- case 17:
- return PrecachedPort.p17;
- case 18:
- return PrecachedPort.p18;
- case 19:
- return PrecachedPort.p19;
- case 20:
- return PrecachedPort.p20;
- case 21:
- return PrecachedPort.p21;
- case 22:
- return PrecachedPort.p22;
- case 23:
- return PrecachedPort.p23;
- case 24:
- return PrecachedPort.p24;
- case 25:
- return PrecachedPort.p25;
- case 26:
- return PrecachedPort.p26;
- case 27:
- return PrecachedPort.p27;
- case 28:
- return PrecachedPort.p28;
- case 29:
- return PrecachedPort.p29;
- case 31:
- return PrecachedPort.p31;
- case 32:
- return PrecachedPort.p32;
- case 33:
- return PrecachedPort.p33;
- case 34:
- return PrecachedPort.p34;
- case 35:
- return PrecachedPort.p35;
- case 36:
- return PrecachedPort.p36;
- case 37:
- return PrecachedPort.p37;
- case 38:
- return PrecachedPort.p38;
- case 39:
- return PrecachedPort.p39;
- case 40:
- return PrecachedPort.p40;
- case 41:
- return PrecachedPort.p41;
- case 42:
- return PrecachedPort.p42;
- case 43:
- return PrecachedPort.p43;
- case 44:
- return PrecachedPort.p44;
- case 45:
- return PrecachedPort.p45;
- case 46:
- return PrecachedPort.p46;
- case 47:
- return PrecachedPort.p47;
- case 48:
- return PrecachedPort.p48;
- case OFPP_MAX_INT:
- return MAX;
- case OFPP_IN_PORT_INT:
- return IN_PORT;
- case OFPP_TABLE_INT:
- return TABLE;
- case OFPP_NORMAL_INT:
- return NORMAL;
- case OFPP_FLOOD_INT:
- return FLOOD;
- case OFPP_ALL_INT:
- return ALL;
- case OFPP_CONTROLLER_INT:
- return CONTROLLER;
- case OFPP_LOCAL_INT:
- return LOCAL;
- case OFPP_ANY_INT:
- return ANY;
- default:
- // note: This means effectively : portNumber > OFPP_MAX_SHORT
- // accounting for
- // signedness of both portNumber and OFPP_MAX_INT(which is
- // -256).
- // Any unsigned integer value > OFPP_MAX_INT will be ]-256:0[
- // when read signed
- if (portNumber < 0 && portNumber > OFPP_MAX_INT)
- throw new IllegalArgumentException("Unknown special port number: "
- + portNumber);
- return new OFPort(portNumber);
- }
- }
-
- /** convenience function: delegates to ofInt */
- public static OFPort of(final int portNumber) {
- return ofInt(portNumber);
- }
-
- /**
- * get an OFPort object corresponding to a raw signed 16-bit integer port
- * number (OF1.0). Note that the port returned will have the corresponding
- * 32-bit integer value allocated as its port number. NOTE: The port object
- * may either be newly allocated or cached. Do not rely on either behavior.
- *
- * @param portNumber
- * @return a corresponding OFPort
- */
- public static OFPort ofShort(final short portNumber) {
- switch (portNumber) {
- case 1:
- return PrecachedPort.p1;
- case 2:
- return PrecachedPort.p2;
- case 3:
- return PrecachedPort.p3;
- case 4:
- return PrecachedPort.p4;
- case 5:
- return PrecachedPort.p5;
- case 6:
- return PrecachedPort.p6;
- case 7:
- return PrecachedPort.p7;
- case 8:
- return PrecachedPort.p8;
- case 9:
- return PrecachedPort.p9;
- case 10:
- return PrecachedPort.p10;
- case 11:
- return PrecachedPort.p11;
- case 12:
- return PrecachedPort.p12;
- case 13:
- return PrecachedPort.p13;
- case 14:
- return PrecachedPort.p14;
- case 15:
- return PrecachedPort.p15;
- case 16:
- return PrecachedPort.p16;
- case 17:
- return PrecachedPort.p17;
- case 18:
- return PrecachedPort.p18;
- case 19:
- return PrecachedPort.p19;
- case 20:
- return PrecachedPort.p20;
- case 21:
- return PrecachedPort.p21;
- case 22:
- return PrecachedPort.p22;
- case 23:
- return PrecachedPort.p23;
- case 24:
- return PrecachedPort.p24;
- case 25:
- return PrecachedPort.p25;
- case 26:
- return PrecachedPort.p26;
- case 27:
- return PrecachedPort.p27;
- case 28:
- return PrecachedPort.p28;
- case 29:
- return PrecachedPort.p29;
- case 31:
- return PrecachedPort.p31;
- case 32:
- return PrecachedPort.p32;
- case 33:
- return PrecachedPort.p33;
- case 34:
- return PrecachedPort.p34;
- case 35:
- return PrecachedPort.p35;
- case 36:
- return PrecachedPort.p36;
- case 37:
- return PrecachedPort.p37;
- case 38:
- return PrecachedPort.p38;
- case 39:
- return PrecachedPort.p39;
- case 40:
- return PrecachedPort.p40;
- case 41:
- return PrecachedPort.p41;
- case 42:
- return PrecachedPort.p42;
- case 43:
- return PrecachedPort.p43;
- case 44:
- return PrecachedPort.p44;
- case 45:
- return PrecachedPort.p45;
- case 46:
- return PrecachedPort.p46;
- case 47:
- return PrecachedPort.p47;
- case 48:
- return PrecachedPort.p48;
- case OFPP_MAX_SHORT:
- return MAX;
- case OFPP_IN_PORT_SHORT:
- return IN_PORT;
- case OFPP_TABLE_SHORT:
- return TABLE;
- case OFPP_NORMAL_SHORT:
- return NORMAL;
- case OFPP_FLOOD_SHORT:
- return FLOOD;
- case OFPP_ALL_SHORT:
- return ALL;
- case OFPP_CONTROLLER_SHORT:
- return CONTROLLER;
- case OFPP_LOCAL_SHORT:
- return LOCAL;
- case OFPP_ANY_SHORT:
- return ANY;
- default:
- // note: This means effectively : portNumber > OFPP_MAX_SHORT
- // accounting for
- // signedness of both portNumber and OFPP_MAX_SHORT (which is
- // -256).
- // Any unsigned integer value > OFPP_MAX_SHORT will be ]-256:0[
- // when read signed
- if (portNumber < 0 && portNumber > OFPP_MAX_SHORT)
- throw new IllegalArgumentException("Unknown special port number: "
- + portNumber);
- return new OFPort(portNumber);
- }
- }
-
- /** return the port number as a int32 */
- public int getPortNumber() {
- return portNumber;
- }
-
- /**
- * return the port number as int16. Special ports as defined by the OpenFlow
- * spec will be converted to their OpenFlow 1.0 equivalent. port numbers >=
- * FF00 will cause a IllegalArgumentException to be thrown
- *
- * @throws IllegalArgumentException
- * if a regular port number exceeds the maximum value in OF1.0
- **/
- public short getShortPortNumber() {
-
- switch (portNumber) {
- case OFPP_MAX_INT:
- return OFPP_MAX_SHORT;
- case OFPP_IN_PORT_INT:
- return OFPP_IN_PORT_SHORT;
- case OFPP_TABLE_INT:
- return OFPP_TABLE_SHORT;
- case OFPP_NORMAL_INT:
- return OFPP_NORMAL_SHORT;
- case OFPP_FLOOD_INT:
- return OFPP_FLOOD_SHORT;
- case OFPP_ALL_INT:
- return OFPP_ALL_SHORT;
- case OFPP_CONTROLLER_INT:
- return OFPP_CONTROLLER_SHORT;
- case OFPP_LOCAL_INT:
- return OFPP_LOCAL_SHORT;
- case OFPP_ANY_INT:
- return OFPP_ANY_SHORT;
-
- default:
- if (portNumber >= OFPP_MAX_SHORT_UNSIGNED || portNumber < 0)
- throw new IllegalArgumentException("32bit Port number "
- + U32.f(portNumber)
- + " cannot be represented as uint16 (OF1.0)");
-
- return (short) portNumber;
- }
- }
-
- @Override
- public String toString() {
- return Long.toString(U32.f(portNumber));
- }
-
- /** Extension of OFPort for named ports */
- static class NamedPort extends OFPort {
- private final String name;
-
- NamedPort(final int portNo, final String name) {
- super(portNo);
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- return name;
- }
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof OFPort))
- return false;
- OFPort other = (OFPort)obj;
- if (other.portNumber != this.portNumber)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 53;
- int result = 1;
- result = prime * result + portNumber;
- return result;
- }
-
- public void write2Bytes(ChannelBuffer c) {
- c.writeShort(this.portNumber);
- }
-
- public static OFPort read2Bytes(ChannelBuffer c) throws OFParseError {
- return OFPort.ofShort(c.readShort());
- }
-
- public void write4Bytes(ChannelBuffer c) {
- c.writeInt(this.portNumber);
- }
-
- public static OFPort read4Bytes(ChannelBuffer c) throws OFParseError {
- return OFPort.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
- }
-
- @Override
- public OFPort applyMask(OFPort mask) {
- return OFPort.of(this.portNumber & mask.portNumber);
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/OFValueType.java b/java_gen/pre-written/src/main/java/org/openflow/types/OFValueType.java
deleted file mode 100644
index 8e2f9ed..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/OFValueType.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.openflow.types;
-
-
-
-
-public interface OFValueType<T extends OFValueType<T>> {
-
- public int getLength();
-
- public T applyMask(T mask);
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/TransportPort.java b/java_gen/pre-written/src/main/java/org/openflow/types/TransportPort.java
deleted file mode 100644
index 1ebb807..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/TransportPort.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-/**
- * Represents L4 (Transport Layer) port (TCP, UDP, etc.)
- *
- * @author Yotam Harchol (yotam.harchol@bigswitch.com)
- */
-public class TransportPort implements OFValueType<TransportPort> {
-
- static final int LENGTH = 2;
- static final int MAX_PORT = 0xFFFF;
- static final int MIN_PORT = 0;
-
- public static final TransportPort NO_MASK = new TransportPort(0xFFFFFFFF);
- public static final TransportPort FULL_MASK = TransportPort.of(0x0);
-
- private final int port;
-
- private TransportPort(int port) {
- this.port = port;
- }
-
- public static TransportPort of(int port) {
- if (port < MIN_PORT || port > MAX_PORT) {
- throw new IllegalArgumentException("Illegal transport layer port number: " + port);
- }
- return new TransportPort(port);
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public int getPort() {
- return port;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof TransportPort))
- return false;
- TransportPort other = (TransportPort)obj;
- if (other.port != this.port)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 59;
- int result = 1;
- result = prime * result + port;
- return result;
- }
-
- @Override
- public String toString() {
- return Integer.toString(port);
- }
-
- public void write2Bytes(ChannelBuffer c) {
- c.writeShort(this.port);
- }
-
- public static TransportPort read2Bytes(ChannelBuffer c) throws OFParseError {
- return TransportPort.of((c.readUnsignedShort() & 0x0FFFF));
- }
-
- @Override
- public TransportPort applyMask(TransportPort mask) {
- return TransportPort.of(this.port & mask.port);
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/U16.java b/java_gen/pre-written/src/main/java/org/openflow/types/U16.java
deleted file mode 100644
index 54e72c1..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/U16.java
+++ /dev/null
@@ -1,108 +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.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFMessageReader;
-import org.openflow.protocol.Writeable;
-
-public class U16 implements Writeable, OFValueType<U16> {
- public static int f(final short i) {
- return i & 0xffff;
- }
-
- public static short t(final int l) {
- return (short) l;
- }
-
- private final short raw;
-
- private U16(short raw) {
- this.raw = raw;
- }
-
- public static final U16 of(int value) {
- return new U16(t(value));
- }
-
- public static final U16 ofRaw(short value) {
- return new U16(value);
- }
-
- public int getValue() {
- return f(raw);
- }
-
- public short getRaw() {
- return raw;
- }
-
- @Override
- public String toString() {
- return "" + f(raw);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + raw;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- U16 other = (U16) obj;
- if (raw != other.raw)
- return false;
- return true;
- }
-
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- bb.writeShort(raw);
- }
-
-
- public final static Reader READER = new Reader();
-
- private static class Reader implements OFMessageReader<U16> {
- @Override
- public U16 readFrom(ChannelBuffer bb) throws OFParseError {
- return ofRaw(bb.readShort());
- }
- }
-
- @Override
- public int getLength() {
- return 2;
- }
-
- @Override
- public U16 applyMask(U16 mask) {
- return ofRaw( (short) (raw & mask.raw));
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/U32.java b/java_gen/pre-written/src/main/java/org/openflow/types/U32.java
deleted file mode 100644
index 9cd181c..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/U32.java
+++ /dev/null
@@ -1,108 +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.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFMessageReader;
-import org.openflow.protocol.Writeable;
-
-public class U32 implements Writeable, OFValueType<U32> {
- private final int raw;
-
- private U32(int raw) {
- this.raw = raw;
- }
-
- public static U32 of(long value) {
- return new U32(U32.t(value));
- }
-
- public static U32 ofRaw(int value) {
- return new U32(value);
- }
-
- public long getValue() {
- return f(raw);
- }
-
- public int getRaw() {
- return raw;
- }
-
- @Override
- public String toString() {
- return "" + f(raw);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + raw;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- U32 other = (U32) obj;
- if (raw != other.raw)
- return false;
-
- return true;
- }
-
- public static long f(final int i) {
- return i & 0xffffffffL;
- }
-
- public static int t(final long l) {
- return (int) l;
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- bb.writeInt(raw);
- }
-
- public final static Reader READER = new Reader();
-
- private static class Reader implements OFMessageReader<U32> {
- @Override
- public U32 readFrom(ChannelBuffer bb) throws OFParseError {
- return new U32(bb.readInt());
- }
- }
-
- @Override
- public int getLength() {
- return 4;
- }
-
- @Override
- public U32 applyMask(U32 mask) {
- return ofRaw(raw & mask.raw);
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/U64.java b/java_gen/pre-written/src/main/java/org/openflow/types/U64.java
deleted file mode 100644
index 5c69a7c..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/U64.java
+++ /dev/null
@@ -1,112 +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.types;
-
-import java.math.BigInteger;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.protocol.Writeable;
-
-public class U64 implements Writeable, OFValueType<U64> {
- private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;
-
- private final long raw;
-
- protected U64(final long raw) {
- this.raw = raw;
- }
-
- public static U64 of(long raw) {
- return ofRaw(raw);
- }
-
- public static U64 ofRaw(final long raw) {
- return new U64(raw);
- }
-
- public static U64 parseHex(String hex) {
- return new U64(new BigInteger(hex, 16).longValue());
- }
-
- public long getValue() {
- return raw;
- }
-
- public BigInteger getBigInteger() {
- BigInteger bigInt = BigInteger.valueOf(raw & UNSIGNED_MASK);
- if (raw < 0) {
- bigInt = bigInt.setBit(Long.SIZE - 1);
- }
- return bigInt;
- }
-
- @Override
- public String toString() {
- return getBigInteger().toString();
- }
-
- public static BigInteger f(final long value) {
- BigInteger bigInt = BigInteger.valueOf(value & UNSIGNED_MASK);
- if (value < 0) {
- bigInt = bigInt.setBit(Long.SIZE - 1);
- }
- return bigInt;
- }
-
- public static long t(final BigInteger l) {
- return l.longValue();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (raw ^ (raw >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- U64 other = (U64) obj;
- if (raw != other.raw)
- return false;
- return true;
- }
-
- @Override
- public int getLength() {
- return 8;
- }
-
- @Override
- public U64 applyMask(U64 mask) {
- return ofRaw(raw & mask.raw);
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- bb.writeLong(raw);
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/U8.java b/java_gen/pre-written/src/main/java/org/openflow/types/U8.java
deleted file mode 100644
index c15be0e..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/U8.java
+++ /dev/null
@@ -1,109 +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.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFMessageReader;
-import org.openflow.protocol.Writeable;
-
-public class U8 implements Writeable, OFValueType<U8> {
- private final byte raw;
-
- private U8(byte raw) {
- this.raw = raw;
- }
-
- public static final U8 of(short value) {
- return new U8(t(value));
- }
-
- public static final U8 ofRaw(byte value) {
- return new U8(value);
- }
-
- public short getValue() {
- return f(raw);
- }
-
- public byte getRaw() {
- return raw;
- }
-
- @Override
- public String toString() {
- return "" + f(raw);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + raw;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- U8 other = (U8) obj;
- if (raw != other.raw)
- return false;
- return true;
- }
-
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- bb.writeByte(raw);
- }
-
- public static short f(final byte i) {
- return (short) (i & 0xff);
- }
-
- public static byte t(final short l) {
- return (byte) l;
- }
-
-
- public final static Reader READER = new Reader();
-
- private static class Reader implements OFMessageReader<U8> {
- @Override
- public U8 readFrom(ChannelBuffer bb) throws OFParseError {
- return new U8(bb.readByte());
- }
- }
-
- @Override
- public int getLength() {
- return 1;
- }
-
- @Override
- public U8 applyMask(U8 mask) {
- return ofRaw( (byte) (raw & mask.raw));
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java b/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java
deleted file mode 100644
index ccbaa63..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public class VlanPcp implements OFValueType<VlanPcp> {
-
- private static final byte VALIDATION_MASK = 0x07;
- static final int LENGTH = 1;
-
- private final byte pcp;
-
- public static final VlanPcp NO_MASK = VlanPcp.of((byte)0xFF);
- public static final VlanPcp FULL_MASK = VlanPcp.of((byte)0x0);
-
- private VlanPcp(byte pcp) {
- this.pcp = pcp;
- }
-
- public static VlanPcp of(byte pcp) {
- if ((pcp & VALIDATION_MASK) != pcp)
- throw new IllegalArgumentException("Illegal VLAN PCP value: " + pcp);
- return new VlanPcp(pcp);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof VlanPcp))
- return false;
- VlanPcp other = (VlanPcp)obj;
- if (other.pcp != this.pcp)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- int prime = 20173;
- return this.pcp * prime;
- }
-
- @Override
- public String toString() {
- return "0x" + Integer.toHexString(pcp);
- }
-
- public byte getValue() {
- return pcp;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeShort(this.pcp);
- }
-
- public static VlanPcp readByte(ChannelBuffer c) throws OFParseError {
- return VlanPcp.of((byte)(c.readUnsignedByte() & 0xFF));
- }
-
- @Override
- public VlanPcp applyMask(VlanPcp mask) {
- return VlanPcp.of((byte)(this.pcp & mask.pcp));
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/VlanVid.java b/java_gen/pre-written/src/main/java/org/openflow/types/VlanVid.java
deleted file mode 100644
index 6a40f43..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/types/VlanVid.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-
-public class VlanVid implements OFValueType<VlanVid> {
-
- private static final short VALIDATION_MASK = 0x0FFF;
- final static int LENGTH = 2;
-
- public static final VlanVid NO_MASK = VlanVid.of((short)0xFFFF);
- public static final VlanVid FULL_MASK = VlanVid.of((short)0x0);
-
- private final short vid;
-
- private VlanVid(short vid) {
- this.vid = vid;
- }
-
- public static VlanVid of(short vid) {
- if ((vid & VALIDATION_MASK) != vid)
- throw new IllegalArgumentException("Illegal VLAN VID value: " + vid);
- return new VlanVid(vid);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof VlanVid))
- return false;
- VlanVid other = (VlanVid)obj;
- if (other.vid != this.vid)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- int prime = 13873;
- return this.vid * prime;
- }
-
- @Override
- public String toString() {
- return "0x" + Integer.toHexString(vid);
- }
-
- public short getValue() {
- return vid;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
-
- volatile byte[] bytesCache = null;
-
- public byte[] getBytes() {
- if (bytesCache == null) {
- synchronized (this) {
- if (bytesCache == null) {
- bytesCache =
- new byte[] { (byte) ((vid >>> 8) & 0xFF),
- (byte) ((vid >>> 0) & 0xFF) };
- }
- }
- }
- return bytesCache;
- }
-
- public void write2Bytes(ChannelBuffer c) {
- c.writeShort(this.vid);
- }
-
- public static VlanVid read2Bytes(ChannelBuffer c) throws OFParseError {
- return VlanVid.of(c.readShort());
- }
-
- @Override
- public VlanVid applyMask(VlanVid mask) {
- return VlanVid.of((short)(this.vid & mask.vid));
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/util/ChannelUtils.java b/java_gen/pre-written/src/main/java/org/openflow/util/ChannelUtils.java
deleted file mode 100644
index e9a3356..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/util/ChannelUtils.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.openflow.util;
-
-import java.util.List;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFMessageReader;
-import org.openflow.protocol.Writeable;
-
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-
-/**
- * Collection of helper functions for reading and writing into ChannelBuffers
- *
- * @author capveg
- */
-
-public class ChannelUtils {
- public static String readFixedLengthString(ChannelBuffer bb, int length) {
- byte[] dst = new byte[length];
- bb.readBytes(dst, 0, length);
- return new String(dst, Charsets.US_ASCII);
- }
-
- public static void writeFixedLengthString(ChannelBuffer bb, String string,
- int length) {
- int l = string.length();
- if (l > length) {
- throw new IllegalArgumentException("Error writing string: length="
- + l + " > max Length=" + length);
- }
- bb.writeBytes(string.getBytes(Charsets.US_ASCII));
- if (l < length) {
- bb.writeZero(length - l);
- }
- }
-
- static public byte[] readBytes(final ChannelBuffer bb, final int length) {
- byte byteArray[] = new byte[length];
- bb.readBytes(byteArray);
- return byteArray;
- }
-
- static public void writeBytes(final ChannelBuffer bb,
- final byte byteArray[]) {
- bb.writeBytes(byteArray);
- }
-
- public static <T> List<T> readList(ChannelBuffer bb, int length, OFMessageReader<T> reader) throws OFParseError {
- int end = bb.readerIndex() + length;
- Builder<T> builder = ImmutableList.<T>builder();
- while(bb.readerIndex() < end) {
- builder.add(reader.readFrom(bb));
- }
- if(bb.readerIndex() != end) {
- throw new IllegalStateException("Overread length: length="+length + " overread by "+ (bb.readerIndex() - end) + " reader: "+reader);
- }
- return builder.build();
- }
-
- public static void writeList(ChannelBuffer bb, List<? extends Writeable> writeables) {
- for(Writeable w: writeables)
- w.writeTo(bb);
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/util/HexString.java b/java_gen/pre-written/src/main/java/org/openflow/util/HexString.java
deleted file mode 100644
index 8d17132..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/util/HexString.java
+++ /dev/null
@@ -1,98 +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.util;
-
-import java.math.BigInteger;
-
-import org.openflow.types.U8;
-
-public class HexString {
- /**
- * Convert a string of bytes to a ':' separated hex string
- *
- * @param bytes
- * @return "0f:ca:fe:de:ad:be:ef"
- */
- public static String toHexString(final byte[] bytes) {
- int i;
- String ret = "";
- String tmp;
- for (i = 0; i < bytes.length; i++) {
- if (i > 0)
- ret += ":";
- tmp = Integer.toHexString(U8.f(bytes[i]));
- if (tmp.length() == 1)
- ret += "0";
- ret += tmp;
- }
- return ret;
- }
-
- public static String toHexString(final long val, final int padTo) {
- char arr[] = Long.toHexString(val).toCharArray();
- String ret = "";
- // prepend the right number of leading zeros
- int i = 0;
- for (; i < (padTo * 2 - arr.length); i++) {
- ret += "0";
- if ((i % 2) == 1)
- ret += ":";
- }
- for (int j = 0; j < arr.length; j++) {
- ret += arr[j];
- if ((((i + j) % 2) == 1) && (j < (arr.length - 1)))
- ret += ":";
- }
- return ret;
- }
-
- public static String toHexString(final long val) {
- return toHexString(val, 8);
- }
-
- /**
- * Convert a string of hex values into a string of bytes
- *
- * @param values
- * "0f:ca:fe:de:ad:be:ef"
- * @return [15, 5 ,2, 5, 17]
- * @throws NumberFormatException
- * If the string can not be parsed
- */
- public static byte[] fromHexString(final String values) throws NumberFormatException {
- String[] octets = values.split(":");
- byte[] ret = new byte[octets.length];
-
- for (int i = 0; i < octets.length; i++) {
- if (octets[i].length() > 2)
- throw new NumberFormatException("Invalid octet length");
- ret[i] = Integer.valueOf(octets[i], 16).byteValue();
- }
- return ret;
- }
-
- public static long toLong(final String values) throws NumberFormatException {
- // Long.parseLong() can't handle HexStrings with MSB set. Sigh.
- BigInteger bi = new BigInteger(values.replaceAll(":", ""), 16);
- if (bi.bitLength() > 64)
- throw new NumberFormatException("Input string too big to fit in long: "
- + values);
- return bi.longValue();
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/util/LRULinkedHashMap.java b/java_gen/pre-written/src/main/java/org/openflow/util/LRULinkedHashMap.java
deleted file mode 100644
index 216319d..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/util/LRULinkedHashMap.java
+++ /dev/null
@@ -1,42 +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.util;
-
-import java.util.LinkedHashMap;
-
-public class LRULinkedHashMap<K, V> extends LinkedHashMap<K, V> {
- private static final long serialVersionUID = -2964986094089626647L;
- protected int maximumCapacity;
-
- public LRULinkedHashMap(final int initialCapacity, final int maximumCapacity) {
- super(initialCapacity, 0.75f, true);
- this.maximumCapacity = maximumCapacity;
- }
-
- public LRULinkedHashMap(final int maximumCapacity) {
- super(16, 0.75f, true);
- this.maximumCapacity = maximumCapacity;
- }
-
- @Override
- protected boolean removeEldestEntry(final java.util.Map.Entry<K, V> eldest) {
- if (this.size() > maximumCapacity)
- return true;
- return false;
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/util/LengthCountingPseudoChannelBuffer.java b/java_gen/pre-written/src/main/java/org/openflow/util/LengthCountingPseudoChannelBuffer.java
deleted file mode 100644
index bd0adce..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/util/LengthCountingPseudoChannelBuffer.java
+++ /dev/null
@@ -1,673 +0,0 @@
-package org.openflow.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.GatheringByteChannel;
-import java.nio.channels.ScatteringByteChannel;
-import java.nio.charset.Charset;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBufferFactory;
-import org.jboss.netty.buffer.ChannelBufferIndexFinder;
-
-public class LengthCountingPseudoChannelBuffer implements ChannelBuffer {
-
- int writerIndex = 0;
- private int markedWriterIndex;
-
- @Override
- public ChannelBufferFactory factory() {
- return null;
- }
-
- @Override
- public int capacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
- public ByteOrder order() {
- return ByteOrder.BIG_ENDIAN;
- }
-
- @Override
- public boolean isDirect() {
- return true;
- }
-
- @Override
- public int readerIndex() {
- return 0;
- }
-
- @Override
- public void readerIndex(int readerIndex) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int writerIndex() {
- return writerIndex;
- }
-
- @Override
- public void writerIndex(int writerIndex) {
- this.writerIndex = writerIndex;
- }
-
- @Override
- public void setIndex(int readerIndex, int writerIndex) {
- if(readerIndex != 0)
- throw new UnsupportedOperationException();
- this.writerIndex = writerIndex;
- }
-
- @Override
- public int readableBytes() {
- return writerIndex;
- }
-
- @Override
- public int writableBytes() {
- return Integer.MAX_VALUE - writerIndex;
- }
-
- @Override
- public boolean readable() {
- return writerIndex > 0;
- }
-
- @Override
- public boolean writable() {
- return writerIndex < Integer.MAX_VALUE;
- }
-
- @Override
- public void clear() {
- writerIndex = 0;
-
- }
-
- @Override
- public void markReaderIndex() {
- }
-
- @Override
- public void resetReaderIndex() {
- }
-
- @Override
- public void markWriterIndex() {
- markedWriterIndex = writerIndex;
- }
-
- @Override
- public void resetWriterIndex() {
- writerIndex = markedWriterIndex;
- }
-
- @Override
- public void discardReadBytes() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void ensureWritableBytes(int writableBytes) {
- if(!((Integer.MAX_VALUE - writableBytes) > writerIndex))
- throw new IllegalStateException();
- }
-
- @Override
- public byte getByte(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public short getUnsignedByte(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public short getShort(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getUnsignedShort(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getMedium(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getUnsignedMedium(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getInt(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long getUnsignedInt(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long getLong(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public char getChar(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public float getFloat(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public double getDouble(int index) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, ChannelBuffer dst) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, ChannelBuffer dst, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, byte[] dst) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, byte[] dst, int dstIndex, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, ByteBuffer dst) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void getBytes(int index, OutputStream out, int length)
- throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getBytes(int index, GatheringByteChannel out, int length)
- throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setByte(int index, int value) {
- }
-
- @Override
- public void setShort(int index, int value) {
- }
-
- @Override
- public void setMedium(int index, int value) {
- }
-
- @Override
- public void setInt(int index, int value) {
- }
-
- @Override
- public void setLong(int index, long value) {
- }
-
- @Override
- public void setChar(int index, int value) {
- }
-
- @Override
- public void setFloat(int index, float value) {
- }
-
- @Override
- public void setDouble(int index, double value) {
- }
-
- @Override
- public void setBytes(int index, ChannelBuffer src) {
- }
-
- @Override
- public void setBytes(int index, ChannelBuffer src, int length) {
- }
-
- @Override
- public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) {
- }
-
- @Override
- public void setBytes(int index, byte[] src) {
- }
-
- @Override
- public void setBytes(int index, byte[] src, int srcIndex, int length) {
- }
-
- @Override
- public void setBytes(int index, ByteBuffer src) {
-
- }
-
- @Override
- public int setBytes(int index, InputStream in, int length)
- throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int setBytes(int index, ScatteringByteChannel in, int length)
- throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setZero(int index, int length) {
- }
-
- @Override
- public byte readByte() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public short readUnsignedByte() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public short readShort() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int readUnsignedShort() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int readMedium() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int readUnsignedMedium() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int readInt() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long readUnsignedInt() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long readLong() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public char readChar() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public float readFloat() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public double readDouble() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer readBytes(int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- @Deprecated
- public ChannelBuffer readBytes(ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer readSlice(int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- @Deprecated
- public
- ChannelBuffer readSlice(ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(ChannelBuffer dst) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(ChannelBuffer dst, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(ChannelBuffer dst, int dstIndex, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(byte[] dst) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(byte[] dst, int dstIndex, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(ByteBuffer dst) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void readBytes(OutputStream out, int length) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int readBytes(GatheringByteChannel out, int length)
- throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void skipBytes(int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- @Deprecated
- public int skipBytes(ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void writeByte(int value) {
- writerIndex++;
- }
-
- @Override
- public void writeShort(int value) {
- writerIndex += 2;
-}
-
-@Override
-public void writeMedium(int value) {
- writerIndex += 3;
-}
-
-@Override
-public void writeInt(int value) {
- writerIndex += 4;
-}
-
-@Override
-public void writeLong(long value) {
- writerIndex += 8;
-}
-
-
- @Override
- public void writeChar(int value) {
- writeShort(value);
- }
-
- @Override
- public void writeFloat(float value) {
- writeInt(Float.floatToIntBits(value));
- }
-
- @Override
- public void writeDouble(double value) {
- writeLong(Double.doubleToLongBits(value));
-
- }
-
- @Override
- public void writeBytes(ChannelBuffer src) {
- writerIndex += src.readableBytes();
-
- }
-
- @Override
- public void writeBytes(ChannelBuffer src, int length) {
- writerIndex += src.readableBytes();
-
- }
-
- @Override
- public void writeBytes(ChannelBuffer src, int srcIndex, int length) {
- writerIndex += length;
- }
-
- @Override
- public void writeBytes(byte[] src) {
- writerIndex += src.length;
-
- }
-
- @Override
- public void writeBytes(byte[] src, int srcIndex, int length) {
- writerIndex += length;
- }
-
- @Override
- public void writeBytes(ByteBuffer src) {
- writerIndex += src.remaining();
-
- }
-
- @Override
- public int writeBytes(InputStream in, int length) throws IOException {
- writerIndex += length;
- return length;
- }
-
- @Override
- public int writeBytes(ScatteringByteChannel in, int length)
- throws IOException {
- writerIndex += length;
- return length;
- }
-
- @Override
- public void writeZero(int length) {
- writerIndex += length;
-
- }
-
- @Override
- public int indexOf(int fromIndex, int toIndex, byte value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int indexOf(int fromIndex, int toIndex,
- ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int bytesBefore(byte value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int bytesBefore(ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int bytesBefore(int length, byte value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int bytesBefore(int length, ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int bytesBefore(int index, int length, byte value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int bytesBefore(int index, int length,
- ChannelBufferIndexFinder indexFinder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer copy() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer copy(int index, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer slice() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer slice(int index, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ChannelBuffer duplicate() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ByteBuffer toByteBuffer() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ByteBuffer toByteBuffer(int index, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ByteBuffer[] toByteBuffers() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ByteBuffer[] toByteBuffers(int index, int length) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean hasArray() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public byte[] array() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int arrayOffset() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String toString(Charset charset) {
- return "LengthCountingPseudoChannelBuffer(length="+writerIndex+")";
- }
-
- @Override
- public String toString(int index, int length, Charset charset) {
- return toString();
- }
-
- @Override
- @Deprecated
- public String toString(String charsetName) {
- return toString();
- }
-
- @Override
- @Deprecated
- public String toString(String charsetName,
- ChannelBufferIndexFinder terminatorFinder) {
- return toString();
- }
-
- @Override
- @Deprecated
- public String toString(int index, int length, String charsetName) {
- return toString();
- }
-
- @Override
- @Deprecated
- public
- String toString(int index, int length, String charsetName,
- ChannelBufferIndexFinder terminatorFinder) {
- return toString();
- }
-
- @Override
- public int compareTo(ChannelBuffer buffer) {
- throw new UnsupportedOperationException();
-
- }
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/util/StringByteSerializer.java b/java_gen/pre-written/src/main/java/org/openflow/util/StringByteSerializer.java
deleted file mode 100644
index 72c1224..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/util/StringByteSerializer.java
+++ /dev/null
@@ -1,58 +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.util;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-public class StringByteSerializer {
- public static String readFrom(final ChannelBuffer data, final int length) {
- byte[] stringBytes = new byte[length];
- data.readBytes(stringBytes);
- // find the first index of 0
- int index = 0;
- for (byte b : stringBytes) {
- if (0 == b)
- break;
- ++index;
- }
- return new String(Arrays.copyOf(stringBytes, index), Charset.forName("ascii"));
- }
-
- public static void writeTo(final ChannelBuffer data, final int length,
- final String value) {
- try {
- byte[] name = value.getBytes("ASCII");
- if (name.length < length) {
- data.writeBytes(name);
- for (int i = name.length; i < length; ++i) {
- data.writeByte((byte) 0);
- }
- } else {
- data.writeBytes(name, 0, length - 1);
- data.writeByte((byte) 0);
- }
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
-
- }
-}
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java b/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java
deleted file mode 100644
index 8125b04..0000000
--- a/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.openflow.types;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.openflow.exceptions.OFParseError;
-
-public class IPv4Test {
- byte[][] testAddresses = new byte[][] {
- {0x01, 0x02, 0x03, 0x04 },
- {127, 0, 0, 1},
- {(byte) 192, (byte) 168, 0, 100 },
- {(byte) 255, (byte) 255, (byte) 255, (byte) 255 }
- };
-
- String[] testStrings = {
- "1.2.3.4",
- "127.0.0.1",
- "192.168.0.100",
- "255.255.255.255"
- };
-
- int[] testInts = {
- 0x01020304,
- 0x7f000001,
- (192 << 24) | (168 << 16) | 100,
- 0xffffffff
- };
-
- String[] invalidIPs = {
- "",
- ".",
- "1.2..3.4",
- "1.2.3.4.",
- "257.11.225.1",
- "-1.2.3.4",
- "1.2.3.4.5",
- "1.x.3.4",
- "1.2x.3.4"
- };
-
- String[] ipsWithMask = {
- "1.2.3.4/24",
- "192.168.130.140/255.255.192.0",
- "127.0.0.1/8",
- "8.8.8.8",
- };
-
- boolean[] hasMask = {
- true,
- true,
- true,
- false
- };
-
- byte[][][] ipsWithMaskValues = {
- new byte[][] { new byte[] { (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04 }, new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00 } },
- new byte[][] { new byte[] { (byte)0xC0, (byte)0xA8, (byte)0x82, (byte)0x8C }, new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xC0, (byte)0x00 } },
- new byte[][] { new byte[] { (byte)0x7F, (byte)0x00, (byte)0x00, (byte)0x01 }, new byte[] { (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00 } },
- new byte[][] { new byte[] { (byte)0x08, (byte)0x08, (byte)0x08, (byte)0x08 }, null }
- };
-
-
- @Test
- public void testOfString() {
- for(int i=0; i < testAddresses.length; i++ ) {
- IPv4 ip = IPv4.of(testStrings[i]);
- assertEquals(testInts[i], ip.getInt());
- assertArrayEquals(testAddresses[i], ip.getBytes());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
- @Test
- public void testOfByteArray() {
- for(int i=0; i < testAddresses.length; i++ ) {
- IPv4 ip = IPv4.of(testAddresses[i]);
- assertEquals(testInts[i], ip.getInt());
- assertArrayEquals(testAddresses[i], ip.getBytes());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
- @Test
- public void testReadFrom() throws OFParseError {
- for(int i=0; i < testAddresses.length; i++ ) {
- IPv4 ip = IPv4.read4Bytes(ChannelBuffers.copiedBuffer(testAddresses[i]));
- assertEquals(testInts[i], ip.getInt());
- assertArrayEquals(testAddresses[i], ip.getBytes());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
-
- @Test
- public void testInvalidIPs() throws OFParseError {
- for(String invalid : invalidIPs) {
- try {
- IPv4.of(invalid);
- fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
- } catch(IllegalArgumentException e) {
- // ok
- }
- }
- }
-
- @Test
- public void testOfMasked() throws OFParseError {
- for (int i = 0; i < ipsWithMask.length; i++) {
- IPv4WithMask value = IPv4WithMask.of(ipsWithMask[i]);
- if (!hasMask[i]) {
- IPv4 ip = value.getValue();
- assertArrayEquals(ipsWithMaskValues[i][0], ip.getBytes());
- } else if (hasMask[i]) {
- byte[] ipBytes = new byte[4];
- System.arraycopy(ipsWithMaskValues[i][0], 0, ipBytes, 0, 4);
- assertEquals(ipBytes.length, value.getValue().getBytes().length);
- for (int j = 0; j < ipBytes.length; j++) {
- ipBytes[j] &= ipsWithMaskValues[i][1][j];
- }
-
- assertArrayEquals(ipBytes, value.getValue().getBytes());
- assertArrayEquals(ipsWithMaskValues[i][1], value.getMask().getBytes());
- }
- }
- }
-}
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java b/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java
deleted file mode 100644
index 352b8bc..0000000
--- a/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.openflow.types;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.openflow.exceptions.OFParseError;
-
-public class IPv6Test {
-
- String[] testStrings = {
- "::",
- "::1",
- "ffe0::",
- "1:2:3:4:5:6:7:8"
- };
-
- String[] ipsWithMask = {
- "1::1/80",
- "1:2:3:4::/ffff:ffff:ffff:ff00::",
- "ffff:ffee:1::/ff00:ff00:ff00:ff00::",
- "8:8:8:8:8:8:8:8",
- };
-
- byte[][] masks = {
- new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
- (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
- (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
- new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
- (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
- new byte[] { (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00,
- (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
- new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }
- };
-
- boolean[] hasMask = {
- true,
- true,
- true,
- false
- };
-
- @Test
- public void testMasked() throws UnknownHostException {
- for(int i=0; i < ipsWithMask.length; i++ ) {
- IPv6WithMask value = IPv6WithMask.of(ipsWithMask[i]);
- if (!hasMask[i]) {
- IPv6 ip = value.getValue();
- InetAddress inetAddress = InetAddress.getByName(ipsWithMask[i]);
-
- assertArrayEquals(ip.getBytes(), inetAddress.getAddress());
- assertEquals(ipsWithMask[i], ip.toString());
- } else if (value instanceof IPv6WithMask && hasMask[i]) {
- InetAddress inetAddress = InetAddress.getByName(ipsWithMask[i].substring(0, ipsWithMask[i].indexOf('/')));
-
- byte[] address = inetAddress.getAddress();
- assertEquals(address.length, value.getValue().getBytes().length);
-
- for (int j = 0; j < address.length; j++) {
- address[j] &= masks[i][j];
- }
-
- assertArrayEquals(value.getValue().getBytes(), address);
- assertArrayEquals(masks[i], value.getMask().getBytes());
- }
- }
- }
-
-
- @Test
- public void testOfString() throws UnknownHostException {
- for(int i=0; i < testStrings.length; i++ ) {
- IPv6 ip = IPv6.of(testStrings[i]);
- InetAddress inetAddress = InetAddress.getByName(testStrings[i]);
-
- assertArrayEquals(ip.getBytes(), inetAddress.getAddress());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
- @Test
- public void testOfByteArray() throws UnknownHostException {
- for(int i=0; i < testStrings.length; i++ ) {
- byte[] bytes = Inet6Address.getByName(testStrings[i]).getAddress();
- IPv6 ip = IPv6.of(bytes);
- assertEquals(testStrings[i], ip.toString());
- assertArrayEquals(bytes, ip.getBytes());
- }
- }
-
- @Test
- public void testReadFrom() throws OFParseError, UnknownHostException {
- for(int i=0; i < testStrings.length; i++ ) {
- byte[] bytes = Inet6Address.getByName(testStrings[i]).getAddress();
- IPv6 ip = IPv6.read16Bytes(ChannelBuffers.copiedBuffer(bytes));
- assertEquals(testStrings[i], ip.toString());
- assertArrayEquals(bytes, ip.getBytes());
- }
- }
-
- String[] invalidIPs = {
- "",
- ":",
- "1:2:3:4:5:6:7:8:9",
- "1:2:3:4:5:6:7:8:",
- "1:2:3:4:5:6:7:8g",
- "1:2:3:",
- "12345::",
- "1::3::8",
- "::3::"
- };
-
- @Test
- public void testInvalidIPs() throws OFParseError {
- for(String invalid : invalidIPs) {
- try {
- IPv6.of(invalid);
- fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
- } catch(IllegalArgumentException e) {
- // ok
- }
- }
- }
-
- @Test
- public void testZeroCompression() throws OFParseError {
- assertEquals("::", IPv6.of("::").toString(true, false));
- assertEquals("0:0:0:0:0:0:0:0", IPv6.of("::").toString(false, false));
- assertEquals("0000:0000:0000:0000:0000:0000:0000:0000", IPv6.of("::").toString(false, true));
- assertEquals("1::4:5:6:0:8", IPv6.of("1:0:0:4:5:6:0:8").toString(true, false));
- assertEquals("1:0:0:4::8", IPv6.of("1:0:0:4:0:0:0:8").toString(true, false));
- }
-}
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java b/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java
deleted file mode 100644
index 2be3046..0000000
--- a/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.openflow.types;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.Arrays;
-
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.openflow.exceptions.OFParseError;
-
-public class MacAddressTest {
- byte[][] testAddresses = new byte[][] {
- {0x01, 0x02, 0x03, 0x04, 0x05, 0x06 },
- {(byte) 0x80, 0x0, 0x0, 0x0, 0x0, 0x01},
- {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255 }
- };
-
- String[] testStrings = {
- "01:02:03:04:05:06",
- "80:00:00:00:00:01",
- "ff:ff:ff:ff:ff:ff"
- };
-
- long[] testInts = {
- 0x00010203040506L,
- 0x00800000000001L,
- 0x00ffffffffffffL
- };
-
- String[] invalidMacs = {
- "",
- "1.2.3.4",
- "00:ff:ef:12:12:ff:",
- "00:fff:ef:12:12:ff",
- "01:02:03:04:05;06",
- "0:1:2:3:4:5:6",
- "01:02:03:04"
- };
-
-
- @Test
- public void testOfString() {
- for(int i=0; i < testAddresses.length; i++ ) {
- MacAddress ip = MacAddress.of(testStrings[i]);
- assertEquals(testInts[i], ip.getLong());
- assertArrayEquals(testAddresses[i], ip.getBytes());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
- @Test
- public void testOfByteArray() {
- for(int i=0; i < testAddresses.length; i++ ) {
- MacAddress ip = MacAddress.of(testAddresses[i]);
- assertEquals("error checking long representation of "+Arrays.toString(testAddresses[i]) + "(should be "+Long.toHexString(testInts[i]) +")", testInts[i], ip.getLong());
- assertArrayEquals(testAddresses[i], ip.getBytes());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
- @Test
- public void testReadFrom() throws OFParseError {
- for(int i=0; i < testAddresses.length; i++ ) {
- MacAddress ip = MacAddress.read6Bytes(ChannelBuffers.copiedBuffer(testAddresses[i]));
- assertEquals(testInts[i], ip.getLong());
- assertArrayEquals(testAddresses[i], ip.getBytes());
- assertEquals(testStrings[i], ip.toString());
- }
- }
-
-
- @Test
- public void testInvalidMacss() throws OFParseError {
- for(String invalid : invalidMacs) {
- try {
- MacAddress.of(invalid);
- fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
- } catch(IllegalArgumentException e) {
- // ok
- }
- }
- }
-}
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/U64Test.java b/java_gen/pre-written/src/test/java/org/openflow/types/U64Test.java
deleted file mode 100644
index aefd193..0000000
--- a/java_gen/pre-written/src/test/java/org/openflow/types/U64Test.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.openflow.types;
-
-import static org.junit.Assert.assertEquals;
-
-import java.math.BigInteger;
-
-import org.junit.Test;
-
-public class U64Test {
-
- @Test
- public void testPositiveRaws() {
- for(long positive: new long[] { 0, 1, 100, Long.MAX_VALUE }) {
- assertEquals(positive, U64.ofRaw(positive).getValue());
- assertEquals(BigInteger.valueOf(positive), U64.ofRaw(positive).getBigInteger());
- }
- }
-
- @Test
- public void testNegativeRaws() {
- long minus_1 = 0xFFffFFffFFffFFffL;
- assertEquals(minus_1, U64.ofRaw(minus_1).getValue());
- assertEquals(new BigInteger("FFffFFffFFffFFff", 16), U64.ofRaw(minus_1).getBigInteger());
- assertEquals(new BigInteger("18446744073709551615"), U64.ofRaw(minus_1).getBigInteger());
- }
-}
diff --git a/java_gen/templates/_imports.java b/java_gen/templates/_imports.java
index a4c564c..669db00 100644
--- a/java_gen/templates/_imports.java
+++ b/java_gen/templates/_imports.java
@@ -2,17 +2,16 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.openflow.protocol.*;
-import org.openflow.protocol.action.*;
-import org.openflow.protocol.meterband.*;
-import org.openflow.protocol.instruction.*;
-import org.openflow.protocol.match.*;
-import org.openflow.protocol.oxm.*;
-import org.openflow.protocol.queueprop.*;
-import org.openflow.types.*;
-import org.openflow.types.*;
-import org.openflow.util.*;
-import org.openflow.exceptions.*;
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import com.google.common.collect.ImmutableList;
diff --git a/java_gen/templates/const.java b/java_gen/templates/const.java
index 11c09ab..b5c7ed0 100644
--- a/java_gen/templates/const.java
+++ b/java_gen/templates/const.java
@@ -33,7 +33,7 @@
package ${package};
-import org.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.protocol.OFVersion;
public enum ${class_name} {
//:: for i, entry in enumerate(enum.entries):
diff --git a/java_gen/templates/const_serializer.java b/java_gen/templates/const_serializer.java
index 4e21070..5710f9c 100644
--- a/java_gen/templates/const_serializer.java
+++ b/java_gen/templates/const_serializer.java
@@ -33,10 +33,10 @@
package ${package};
-import org.openflow.types.*;
+import org.projectfloodlight.openflow.types.*;
import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFVersion;
import ${enum.package}.${enum.name};
public class ${class_name} {
diff --git a/java_gen/templates/of_class.java b/java_gen/templates/of_class.java
index ec398e7..2dc88fb 100644
--- a/java_gen/templates/of_class.java
+++ b/java_gen/templates/of_class.java
@@ -39,11 +39,11 @@
class ${impl_class} implements ${msg.interface.inherited_declaration()} {
// version: ${version}
- private final static byte WIRE_VERSION = ${version.int_version};
+ final static byte WIRE_VERSION = ${version.int_version};
//:: if msg.is_fixed_length:
- private final static int LENGTH = ${msg.length};
+ final static int LENGTH = ${msg.length};
//:: else:
- private final static int MINIMUM_LENGTH = ${msg.min_length};
+ final static int MINIMUM_LENGTH = ${msg.min_length};
//:: #endif
//:: for prop in msg.data_members:
diff --git a/java_gen/templates/of_factories.java b/java_gen/templates/of_factories.java
index 9225510..0044335 100644
--- a/java_gen/templates/of_factories.java
+++ b/java_gen/templates/of_factories.java
@@ -31,7 +31,7 @@
//:: include('_autogen.java')
-package org.openflow.protocol;
+package org.projectfloodlight.openflow.protocol;
//:: include("_imports.java")
@@ -40,7 +40,7 @@
switch(version) {
//:: for v in versions:
case ${v.constant_version}:
- return org.openflow.protocol.ver${v.of_version}.OFFactoryVer${v.of_version}.INSTANCE;
+ return org.projectfloodlight.openflow.protocol.ver${v.of_version}.OFFactoryVer${v.of_version}.INSTANCE;
//:: #endfor
default:
throw new IllegalArgumentException("Unknown version: "+version);
diff --git a/java_gen/templates/of_virtual_class.java b/java_gen/templates/of_virtual_class.java
index 33a6cd2..6237b8c 100644
--- a/java_gen/templates/of_virtual_class.java
+++ b/java_gen/templates/of_virtual_class.java
@@ -39,11 +39,11 @@
abstract class ${msg.name} {
// version: ${version}
- private final static byte WIRE_VERSION = ${version.int_version};
+ final static byte WIRE_VERSION = ${version.int_version};
//:: if msg.is_fixed_length:
- private final static int LENGTH = ${msg.length};
+ final static int LENGTH = ${msg.length};
//:: else:
- private final static int MINIMUM_LENGTH = ${msg.min_length};
+ final static int MINIMUM_LENGTH = ${msg.min_length};
//:: #endif