-/* Returns the "vendor" part of the OpenFlow error code 'error' (which must be
- * in the format explained above). This is normally one of the
- * OFPUTIL_VENDOR_* constants. Returns OFPUTIL_VENDOR_OPENFLOW (0) for a
- * standard OpenFlow error. */
-static inline uint8_t
-get_ofp_err_vendor(int error)
-{
- return (error >> 26) & 0xf;
-}
-
-/* Returns the "type" part of the OpenFlow error code 'error' (which must be in
- * the format explained above). */
-static inline uint16_t
-get_ofp_err_type(int error)
-{
- return (error >> 16) & 0x3ff;
-}
-
-/* Returns the "code" part of the OpenFlow error code 'error' (which must be in
- * the format explained above). */
-static inline uint16_t
-get_ofp_err_code(int error)
-{
- return error & 0xffff;
-}
-
-struct ofpbuf *ofputil_encode_error_msg(int error, const struct ofp_header *);
-int ofputil_decode_error_msg(const struct ofp_header *, size_t *payload_ofs);
-
-/* String versions of errors. */
-void ofputil_format_error(struct ds *, int error);
-char *ofputil_error_to_string(int error);
+/* This macro is careful to check for actions with bad lengths. */
+#define OFPUTIL_ACTION_FOR_EACH(ITER, LEFT, ACTIONS, N_ACTIONS) \
+ for ((ITER) = (ACTIONS), (LEFT) = (N_ACTIONS); \
+ (LEFT) > 0 && ofputil_action_is_valid(ITER, LEFT); \
+ ((LEFT) -= ntohs((ITER)->header.len) / sizeof(union ofp_action), \
+ (ITER) = ofputil_action_next(ITER)))
+
+/* This macro does not check for actions with bad lengths. It should only be
+ * used with actions from trusted sources or with actions that have already
+ * been validated (e.g. with OFPUTIL_ACTION_FOR_EACH). */
+#define OFPUTIL_ACTION_FOR_EACH_UNSAFE(ITER, LEFT, ACTIONS, N_ACTIONS) \
+ for ((ITER) = (ACTIONS), (LEFT) = (N_ACTIONS); \
+ (LEFT) > 0; \
+ ((LEFT) -= ntohs((ITER)->header.len) / sizeof(union ofp_action), \
+ (ITER) = ofputil_action_next(ITER)))
+
+enum ofperr validate_actions(const union ofp_action *, size_t n_actions,
+ const struct flow *, int max_ports);
+bool action_outputs_to_port(const union ofp_action *, ovs_be16 port);
+
+enum ofperr ofputil_pull_actions(struct ofpbuf *, unsigned int actions_len,
+ union ofp_action **, size_t *);
+
+bool ofputil_actions_equal(const union ofp_action *a, size_t n_a,
+ const union ofp_action *b, size_t n_b);
+union ofp_action *ofputil_actions_clone(const union ofp_action *, size_t n);
+
+/* Handy utility for parsing flows and actions. */
+bool ofputil_parse_key_value(char **stringp, char **keyp, char **valuep);