@@ -3846,6 +3846,10 @@ module TableFeatureProp = struct
3846
3846
3847
3847
type t = tableFeatureProp
3848
3848
3849
+ let length_func (buf : Cstruct.t ) : int option =
3850
+ if Cstruct. len buf < sizeof_ofp_table_feature_prop_header then None
3851
+ else Some (pad_to_64bits (get_ofp_table_feature_prop_header_length buf))
3852
+
3849
3853
let sizeof tfp : int =
3850
3854
let size = sizeof_ofp_table_feature_prop_header + (match tfp with
3851
3855
| TfpInstruction ins ->
@@ -4083,7 +4087,7 @@ module TableFeature = struct
4083
4087
4084
4088
let sizeof (tf : tableFeatures ) =
4085
4089
(* should be equal to tf.length *)
4086
- pad_to_64bits (sizeof_ofp_table_features + ( TableFeatureProp. sizeof tf.feature_prop))
4090
+ pad_to_64bits (sizeof_ofp_table_features + sum (map TableFeatureProp. sizeof tf.feature_prop))
4087
4091
4088
4092
let marshal (buf : Cstruct.t ) (tf : tableFeatures ) : int =
4089
4093
set_ofp_table_features_length buf tf.length;
@@ -4095,7 +4099,7 @@ module TableFeature = struct
4095
4099
set_ofp_table_features_config buf (TableConfig. marshal tf.config);
4096
4100
set_ofp_table_features_max_entries buf tf.max_entries;
4097
4101
sizeof_ofp_table_features + (
4098
- TableFeatureProp. marshal (Cstruct. shift buf sizeof_ofp_table_features) tf.feature_prop)
4102
+ marshal_fields (Cstruct. shift buf sizeof_ofp_table_features) tf.feature_prop TableFeatureProp. marshal )
4099
4103
4100
4104
let parse (bits : Cstruct.t ) : tableFeatures*Cstruct.t =
4101
4105
let length = get_ofp_table_features_length bits in
@@ -4105,7 +4109,7 @@ module TableFeature = struct
4105
4109
let metadataWrite = get_ofp_table_features_metadata_write bits in
4106
4110
let config = TableConfig. parse (get_ofp_table_features_config bits) in
4107
4111
let maxEntries = get_ofp_table_features_max_entries bits in
4108
- let featureProp = TableFeatureProp. parse (Cstruct. sub bits sizeof_ofp_table_features (length- sizeof_ofp_table_features)) in
4112
+ let featureProp = parse_fields (Cstruct. sub bits sizeof_ofp_table_features (length- sizeof_ofp_table_features)) TableFeatureProp. parse TableFeatureProp. length_func in
4109
4113
{ length = length;
4110
4114
table_id = tableId;
4111
4115
name = name;
@@ -4125,7 +4129,7 @@ module TableFeature = struct
4125
4129
tf.metadata_write
4126
4130
(TableConfig. to_string tf.config)
4127
4131
tf.max_entries
4128
- (TableFeatureProp. to_string tf.feature_prop)
4132
+ (" [ " ^ ( String. concat " ; " (map TableFeatureProp. to_string tf.feature_prop)) ^ " ] " )
4129
4133
4130
4134
end
4131
4135
0 commit comments