#include <stdbool.h>
#include <stdint.h>
#include <string.h>
+#include "openflow/openflow.h"
#include "hash.h"
#include "util.h"
sizeof *flow / sizeof(uint32_t), basis);
}
+/* Information on wildcards for a flow, as a supplement to flow_t. */
+struct flow_wildcards {
+ uint32_t wildcards; /* enum ofp_flow_wildcards (in host order). */
+ uint32_t nw_src_mask; /* 1-bit in each significant nw_src bit. */
+ uint32_t nw_dst_mask; /* 1-bit in each significant nw_dst bit. */
+};
+
/* Given the wildcard bit count in bits 'shift' through 'shift + 5' (inclusive)
* of 'wildcards', returns a 32-bit bit mask with a 1 in each bit that must
* match and a 0 in each bit that is wildcarded.
return wildcards < 32 ? htonl(~((1u << wildcards) - 1)) : 0;
}
+static inline void
+flow_wildcards_init(struct flow_wildcards *wc, uint32_t wildcards)
+{
+ wc->wildcards = wildcards & OFPFW_ALL;
+ wc->nw_src_mask = flow_nw_bits_to_mask(wc->wildcards, OFPFW_NW_SRC_SHIFT);
+ wc->nw_dst_mask = flow_nw_bits_to_mask(wc->wildcards, OFPFW_NW_DST_SHIFT);
+}
+
#endif /* flow.h */