added VLANID construct
Change-Id: Ia58abb268d52639215f289052bbf8802992f98a6
diff --git a/utils/misc/src/main/java/org/onlab/packet/IPAddress.java b/utils/misc/src/main/java/org/onlab/packet/IPAddress.java
index 958b33f..f7b19dc 100644
--- a/utils/misc/src/main/java/org/onlab/packet/IPAddress.java
+++ b/utils/misc/src/main/java/org/onlab/packet/IPAddress.java
@@ -10,7 +10,7 @@
//IP Versions
public enum Version { INET, INET6 };
- //lengths of addresses, in bytes
+ //lengths of address, in bytes
public static final int INET_LEN = 4;
public static final int INET6_LEN = 6;
diff --git a/utils/misc/src/main/java/org/onlab/packet/VLANID.java b/utils/misc/src/main/java/org/onlab/packet/VLANID.java
new file mode 100644
index 0000000..68774e3
--- /dev/null
+++ b/utils/misc/src/main/java/org/onlab/packet/VLANID.java
@@ -0,0 +1,41 @@
+package org.onlab.packet;
+
+/**
+ * Representation of a VLAN ID.
+ */
+public class VLANID {
+ // A VLAN ID is 12 bits, short is close
+ private final short value;
+
+ public VLANID(short value) {
+ this.value = value;
+ }
+
+ public short toShort() {
+ return this.value;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj instanceof VLANID) {
+ return true;
+ }
+
+ VLANID other = (VLANID) obj;
+ if (this.value == other.value) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.value;
+ }
+}
+