add funnel support for new types
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 5e8bacc..fbdb330 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -446,6 +446,11 @@
.op(read='DatapathId.of(bb.readLong())',
write='bb.writeLong($name.getLong())',
default='DatapathId.NONE')
+action_type_set = JType("Set<OFActionType>") \
+ .op(read='ChannelUtilsVer10.readSupportedActions(bb)',
+ write='ChannelUtilsVer10.writeSupportedActions(bb, $name)',
+ default='ImmutableSet.<OFActionType>of()',
+ funnel='ChannelUtilsVer10.putSupportedActionsTo($name, sink)')
generic_t = JType("T")
@@ -599,10 +604,7 @@
elif field_name == 'datapath_id':
return datapath_id
elif field_name == 'actions' and obj_name == 'of_features_reply':
- return JType("Set<OFActionType>") \
- .op(read='ChannelUtilsVer10.readSupportedActions(bb)',
- write='ChannelUtilsVer10.writeSupportedActions(bb, $name)',
- default='ImmutableSet.<OFActionType>of()')
+ return action_type_set
elif c_type in default_mtype_to_jtype_convert_map:
return default_mtype_to_jtype_convert_map[c_type]
elif re.match(r'list\(of_([a-zA-Z_]+)_t\)', c_type):
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
index 3f2f23f..ed7c0c8 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
@@ -5,10 +5,11 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
-import org.projectfloodlight.openflow.protocol.match.Match;
-import org.projectfloodlight.openflow.protocol.ver10.OFMatchV1Ver10;
import org.projectfloodlight.openflow.protocol.OFActionType;
import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ;
+import org.projectfloodlight.openflow.protocol.match.Match;
+
+import com.google.common.hash.PrimitiveSink;
/**
* Collection of helper functions for reading and writing into ChannelBuffers
@@ -62,8 +63,7 @@
return supportedActions;
}
- public static void writeSupportedActions(ChannelBuffer bb,
- Set<OFActionType> supportedActions) {
+ public static int supportedActionsToWire(Set<OFActionType> supportedActions) {
int supportedActionsVal = 0;
if (supportedActions.contains(OFActionType.OUTPUT))
supportedActionsVal |= (1 << OFActionTypeSerializerVer10.OUTPUT_VAL);
@@ -89,6 +89,15 @@
supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL);
if (supportedActions.contains(OFActionType.ENQUEUE))
supportedActionsVal |= (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL);
- bb.writeInt(supportedActionsVal);
+ return supportedActionsVal;
}
+
+ public static void putSupportedActionsTo(Set<OFActionType> supportedActions, PrimitiveSink sink) {
+ sink.putInt(supportedActionsToWire(supportedActions));
+ }
+
+ public static void writeSupportedActions(ChannelBuffer bb, Set<OFActionType> supportedActions) {
+ bb.writeInt(supportedActionsToWire(supportedActions));
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
index aa7191a..4d64f83 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
@@ -2,13 +2,15 @@
import org.projectfloodlight.openflow.util.HexString;
+import com.google.common.hash.PrimitiveSink;
+
/**
* Abstraction of a datapath ID that can be set and/or accessed as either a
* long value or a colon-separated string.
- *
+ *
* @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
*/
-public class DatapathId {
+public class DatapathId implements PrimitiveSinkable {
public static final DatapathId NONE = new DatapathId(0);
@@ -60,4 +62,9 @@
return false;
return true;
}
+
+ @Override
+ public void putTo(PrimitiveSink sink) {
+ sink.putLong(rawValue);
+ }
}