Updated masked handling in Match interface and MatchBuilder
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
index 3ff65ab..99b7de4 100644
--- 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
@@ -1,6 +1,7 @@
package org.openflow.protocol.match;
import org.openflow.protocol.OFObject;
+import org.openflow.types.Masked;
import org.openflow.types.OFValueType;
public interface Match extends OFObject {
@@ -27,6 +28,15 @@
public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException;
/**
+ * Returns the masked value for the given field from this match.
+ * Precondition: field is partially wildcarded.
+ *
+ * @param field Match field to retrieve
+ * @return Masked value of match field or null if no mask
+ */
+ public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException;
+
+ /**
* Returns true if this match object supports the given match field.
*
* @param field Match field
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilder.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilder.java
index fc4c07a..4372e30 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilder.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilder.java
@@ -1,13 +1,16 @@
package org.openflow.protocol.match;
+import org.openflow.types.Masked;
import org.openflow.types.OFValueType;
public interface MatchBuilder extends Match {
- public <F extends OFValueType<F>> MatchBuilder set(MatchField<F> field, F value);
-
- public <F extends OFValueType<F>> MatchBuilder unset(MatchField<F> field);
+ public <F extends OFValueType<F>> MatchBuilder setExact(MatchField<F> field, F value);
- //public <M> void setMasked(MatchField<?, M> match, M value);
+ public <F extends OFValueType<F>> MatchBuilder setMasked(MatchField<F> field, F value, F mask);
+ public <F extends OFValueType<F>> MatchBuilder setMasked(MatchField<F> field, Masked<F> valueWithMask);
+
+ public <F extends OFValueType<F>> MatchBuilder wildcard(MatchField<F> field);
+
public Match getMatch();
}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java
index 1c91201..62c77e5 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java
@@ -6,6 +6,7 @@
import org.openflow.types.IpDscp;
import org.openflow.types.IpProtocol;
import org.openflow.types.MacAddress;
+import org.openflow.types.Masked;
import org.openflow.types.OFPort;
import org.openflow.types.OFValueType;
import org.openflow.types.U16;
@@ -51,7 +52,15 @@
}
@Override
- public <F extends OFValueType<F>> MatchBuilder set(final MatchField<F> match, final F value) {
+ public <F extends OFValueType<F>> Masked<F>
+ getMasked(MatchField<F> field)
+ throws UnsupportedOperationException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <F extends OFValueType<F>> MatchBuilder setExact(final MatchField<F> match, final F value) {
switch (match.id) {
case IN_PORT:
inputPort = (OFPort) value;
@@ -66,7 +75,21 @@
}
@Override
- public <F extends OFValueType<F>> MatchBuilder unset(final MatchField<F> match) {
+ public <F extends OFValueType<F>> MatchBuilder
+ setMasked(MatchField<F> field, Masked<F> valueWithMask) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <F extends OFValueType<F>> MatchBuilder
+ setMasked(MatchField<F> field, F value, F mask) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <F extends OFValueType<F>> MatchBuilder wildcard(final MatchField<F> match) {
// TODO Auto-generated method stub
return null;
}
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
index 071eaa0..4d4935c 100644
--- 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
@@ -11,7 +11,6 @@
import org.openflow.types.IpEcn;
import org.openflow.types.IpProtocol;
import org.openflow.types.MacAddress;
-import org.openflow.types.Masked;
import org.openflow.types.OFPort;
import org.openflow.types.OFValueType;
import org.openflow.types.TransportPort;
@@ -34,16 +33,16 @@
public final static MatchField<OFPort> METADATA =
new MatchField<OFPort>("metadata", MatchFields.METADATA);
- public final static MatchField<Masked<MacAddress>> ETH_DST =
- new MatchField<Masked<MacAddress>>("eth_dst", MatchFields.ETH_DST);
- public final static MatchField<Masked<MacAddress>> ETH_SRC =
- new MatchField<Masked<MacAddress>>("eth_src", MatchFields.ETH_SRC);
+ 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<Masked<VlanVid>> VLAN_VID =
- new MatchField<Masked<VlanVid>>("vlan_vid", MatchFields.VLAN_VID);
+ 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);
@@ -55,10 +54,10 @@
public final static MatchField<IpProtocol> IP_PROTO =
new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO);
- public final static MatchField<Masked<IPv4>> IPV4_SRC =
- new MatchField<Masked<IPv4>>("ipv4_src", MatchFields.IPV4_SRC);
- public final static MatchField<Masked<IPv4>> IPV4_DST =
- new MatchField<Masked<IPv4>>("ipv4_dst", MatchFields.IPV4_DST);
+ public final static MatchField<IPv4> IPV4_SRC =
+ new MatchField<IPv4>("ipv4_src", MatchFields.IPV4_SRC);
+ public final static MatchField<IPv4> IPV4_DST =
+ new MatchField<IPv4>("ipv4_dst", MatchFields.IPV4_DST);
public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
"tcp_src", MatchFields.TCP_SRC);
@@ -82,22 +81,22 @@
public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>(
"arp_op", MatchFields.ARP_OP);
- public final static MatchField<Masked<IPv4>> ARP_SPA =
- new MatchField<Masked<IPv4>>("arp_spa", MatchFields.ARP_SPA);
- public final static MatchField<Masked<IPv4>> ARP_TPA =
- new MatchField<Masked<IPv4>>("arp_tpa", MatchFields.ARP_TPA);
- public final static MatchField<Masked<MacAddress>> ARP_SHA =
- new MatchField<Masked<MacAddress>>("arp_sha", MatchFields.ARP_SHA);
- public final static MatchField<Masked<MacAddress>> ARP_THA =
- new MatchField<Masked<MacAddress>>("arp_tha", MatchFields.ARP_THA);
+ public final static MatchField<IPv4> ARP_SPA =
+ new MatchField<IPv4>("arp_spa", MatchFields.ARP_SPA);
+ public final static MatchField<IPv4> ARP_TPA =
+ new MatchField<IPv4>("arp_tpa", MatchFields.ARP_TPA);
+ public final static MatchField<MacAddress> ARP_SHA =
+ new MatchField<MacAddress>("arp_sha", MatchFields.ARP_SHA);
+ public final static MatchField<MacAddress> ARP_THA =
+ new MatchField<MacAddress>("arp_tha", MatchFields.ARP_THA);
- public final static MatchField<Masked<IPv6>> IPV6_SRC =
- new MatchField<Masked<IPv6>>("ipv6_src", MatchFields.IPV6_SRC);
- public final static MatchField<Masked<IPv6>> IPV6_DST =
- new MatchField<Masked<IPv6>>("ipv6_dst", MatchFields.IPV6_DST);
+ public final static MatchField<IPv6> IPV6_SRC =
+ new MatchField<IPv6>("ipv6_src", MatchFields.IPV6_SRC);
+ public final static MatchField<IPv6> IPV6_DST =
+ new MatchField<IPv6>("ipv6_dst", MatchFields.IPV6_DST);
- public final static MatchField<Masked<IPv6FlowLabel>> IPV6_FLABEL =
- new MatchField<Masked<IPv6FlowLabel>>("ipv6_flabel", MatchFields.IPV6_FLOWLABEL);
+ public final static MatchField<IPv6FlowLabel> IPV6_FLABEL =
+ new MatchField<IPv6FlowLabel>("ipv6_flabel", MatchFields.IPV6_FLOWLABEL);
public String getName() {
return name;
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
index 043c00a..433ca9d 100644
--- 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
@@ -18,6 +18,10 @@
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() {