#include "classifier.h"
#include "compiler.h"
#include "flow.h"
+#include "match.h"
#include "netdev.h"
#include "openflow/nicira-ext.h"
#include "openvswitch/types.h"
-struct cls_rule;
struct ofpbuf;
/* Port numbers. */
ovs_be32 ofputil_port_to_ofp11(uint16_t ofp10_port);
enum ofperr ofputil_check_output_port(uint16_t ofp_port, int max_ports);
-bool ofputil_port_from_string(const char *, uint16_t *port);
+uint16_t ofputil_port_from_string(const char *);
void ofputil_format_port(uint16_t port, struct ds *);
/* Converting OFPFW10_NW_SRC_MASK and OFPFW10_NW_DST_MASK wildcard bit counts
const char *ofputil_protocol_to_string(enum ofputil_protocol);
char *ofputil_protocols_to_string(enum ofputil_protocol);
enum ofputil_protocol ofputil_protocols_from_string(const char *);
-enum ofputil_protocol ofputil_usable_protocols(const struct cls_rule *);
+enum ofputil_protocol ofputil_usable_protocols(const struct match *);
struct ofpbuf *ofputil_encode_set_protocol(enum ofputil_protocol current,
enum ofputil_protocol want,
/* Work with ofp10_match. */
void ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct flow_wildcards *);
-void ofputil_cls_rule_from_ofp10_match(const struct ofp10_match *,
- unsigned int priority,
- struct cls_rule *);
-void ofputil_normalize_rule(struct cls_rule *);
-void ofputil_normalize_rule_quiet(struct cls_rule *);
-void ofputil_cls_rule_to_ofp10_match(const struct cls_rule *,
- struct ofp10_match *);
+void ofputil_match_from_ofp10_match(const struct ofp10_match *,
+ struct match *);
+void ofputil_normalize_match(struct match *);
+void ofputil_normalize_match_quiet(struct match *);
+void ofputil_match_to_ofp10_match(const struct match *, struct ofp10_match *);
/* Work with ofp11_match. */
-enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, unsigned int priority,
- struct cls_rule *,
+enum ofperr ofputil_pull_ofp11_match(struct ofpbuf *, struct match *,
uint16_t *padded_match_len);
-enum ofperr ofputil_cls_rule_from_ofp11_match(const struct ofp11_match *,
- unsigned int priority,
- struct cls_rule *);
-void ofputil_cls_rule_to_ofp11_match(const struct cls_rule *,
- struct ofp11_match *);
+enum ofperr ofputil_match_from_ofp11_match(const struct ofp11_match *,
+ struct match *);
+void ofputil_match_to_ofp11_match(const struct match *, struct ofp11_match *);
/* dl_type translation between OpenFlow and 'struct flow' format. */
ovs_be16 ofputil_dl_type_to_openflow(ovs_be16 flow_dl_type);
* NXM Delete <used> <used> -
*/
struct ofputil_flow_mod {
- struct cls_rule cr;
+ struct match match;
+ unsigned int priority;
ovs_be64 cookie; /* Cookie bits to match. */
ovs_be64 cookie_mask; /* 1-bit in each 'cookie' bit to match. */
ovs_be64 new_cookie; /* New cookie to install or -1. */
/* Flow stats or aggregate stats request, independent of protocol. */
struct ofputil_flow_stats_request {
bool aggregate; /* Aggregate results? */
- struct cls_rule match;
+ struct match match;
ovs_be64 cookie;
ovs_be64 cookie_mask;
uint16_t out_port;
/* Flow stats reply, independent of protocol. */
struct ofputil_flow_stats {
- struct cls_rule rule;
+ struct match match;
ovs_be64 cookie;
uint8_t table_id;
uint32_t duration_sec;
uint32_t duration_nsec;
+ uint16_t priority;
uint16_t idle_timeout;
uint16_t hard_timeout;
int idle_age; /* Seconds since last packet, -1 if unknown. */
/* Flow removed message, independent of protocol. */
struct ofputil_flow_removed {
- struct cls_rule rule;
+ struct match match;
+ uint16_t priority;
ovs_be64 cookie;
uint8_t reason; /* One of OFPRR_*. */
uint32_t duration_sec;
uint32_t duration_nsec;
uint16_t idle_timeout;
+ uint16_t hard_timeout;
uint64_t packet_count; /* Packet count, UINT64_MAX if unknown. */
uint64_t byte_count; /* Byte count, UINT64_MAX if unknown. */
};
enum ofperr ofputil_decode_packet_in(struct ofputil_packet_in *,
const struct ofp_header *);
struct ofpbuf *ofputil_encode_packet_in(const struct ofputil_packet_in *,
+ enum ofputil_protocol protocol,
enum nx_packet_in_format);
const char *ofputil_packet_in_reason_to_string(enum ofp_packet_in_reason);
enum ofperr ofputil_decode_packet_out(struct ofputil_packet_out *,
const struct ofp_header *,
struct ofpbuf *ofpacts);
-struct ofpbuf *ofputil_encode_packet_out(const struct ofputil_packet_out *);
+struct ofpbuf *ofputil_encode_packet_out(const struct ofputil_packet_out *,
+ enum ofputil_protocol protocol);
enum ofputil_port_config {
/* OpenFlow 1.0 and 1.1 share these values for these port config bits. */
OFPUTIL_A_GROUP = 1 << 24,
OFPUTIL_A_SET_NW_TTL = 1 << 25,
OFPUTIL_A_DEC_NW_TTL = 1 << 26,
+ OFPUTIL_A_SET_FIELD = 1 << 27,
};
/* Abstract ofp_switch_features. */
struct ofpbuf *ofputil_encode_port_mod(const struct ofputil_port_mod *,
enum ofputil_protocol);
+/* Abstract table stats.
+ *
+ * For now we use ofp12_table_stats as a superset of the other protocol
+ * versions' table stats. */
+
+struct ofpbuf *ofputil_encode_table_stats_reply(
+ const struct ofp12_table_stats[], int n,
+ const struct ofp_header *request);
+
/* Abstract nx_flow_monitor_request. */
struct ofputil_flow_monitor_request {
uint32_t id;
enum nx_flow_monitor_flags flags;
uint16_t out_port;
uint8_t table_id;
- struct cls_rule match;
+ struct match match;
};
int ofputil_decode_flow_monitor_request(struct ofputil_flow_monitor_request *,
uint16_t hard_timeout;
uint8_t table_id;
ovs_be64 cookie;
- struct cls_rule *match;
+ struct match *match;
+ uint16_t priority;
struct ofpact *ofpacts;
size_t ofpacts_len;