+/* Attempts to parse 'property' as a property containing a 16-bit value. If
+ * successful, stores the value into '*value' and returns 0; otherwise returns
+ * an OpenFlow error. */
+enum ofperr
+ofpprop_parse_be16(const struct ofpbuf *property, ovs_be16 *value)
+{
+ /* OpenFlow uses 8-byte properties for 16-bit values, which doesn't really
+ * make sense. Be forgiving by allowing any size payload as long as it's
+ * at least big enough. */
+ ovs_be16 *p = property->msg;
+ if (ofpbuf_msgsize(property) < sizeof *p) {
+ return OFPERR_OFPBPC_BAD_LEN;
+ }
+ *value = *p;
+ return 0;
+}
+
+/* Attempts to parse 'property' as a property containing a 32-bit value. If
+ * successful, stores the value into '*value' and returns 0; otherwise returns
+ * an OpenFlow error. */
+enum ofperr
+ofpprop_parse_be32(const struct ofpbuf *property, ovs_be32 *value)
+{
+ ovs_be32 *p = property->msg;
+ if (ofpbuf_msgsize(property) != sizeof *p) {
+ return OFPERR_OFPBPC_BAD_LEN;
+ }
+ *value = *p;
+ return 0;
+}
+
+/* Attempts to parse 'property' as a property containing a 16-bit value. If
+ * successful, stores the value into '*value' and returns 0; otherwise returns
+ * an OpenFlow error. */
+enum ofperr
+ofpprop_parse_u16(const struct ofpbuf *property, uint16_t *value)
+{
+ /* OpenFlow uses 8-byte properties for 16-bit values, which doesn't really
+ * make sense. Be forgiving by allowing any size payload as long as it's
+ * at least big enough. */
+ ovs_be16 *p = property->msg;
+ if (ofpbuf_msgsize(property) < sizeof *p) {
+ return OFPERR_OFPBPC_BAD_LEN;
+ }
+ *value = ntohs(*p);
+ return 0;
+}
+
+/* Attempts to parse 'property' as a property containing a 32-bit value. If
+ * successful, stores the value into '*value' and returns 0; otherwise returns
+ * an OpenFlow error. */
+enum ofperr
+ofpprop_parse_u32(const struct ofpbuf *property, uint32_t *value)
+{
+ ovs_be32 *p = property->msg;
+ if (ofpbuf_msgsize(property) != sizeof *p) {
+ return OFPERR_OFPBPC_BAD_LEN;
+ }
+ *value = ntohl(*p);
+ return 0;
+}
+