X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fofp-util.h;h=f7d3307f6cecfc6fb696d1be31fb073446c1acea;hb=5cc2c261d33f091ea45ff3de22737cf4deb724a2;hp=30e04c4bdc5feb0677817bd8d25421df7526b384;hpb=f25d0cf3c366d92042269a4f787f19c741c2530c;p=openvswitch diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 30e04c4b..f7d3307f 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -86,14 +86,19 @@ enum ofputil_msg_code { OFPUTIL_NXT_FLOW_AGE, OFPUTIL_NXT_SET_ASYNC_CONFIG, OFPUTIL_NXT_SET_CONTROLLER_ID, + OFPUTIL_NXT_FLOW_MONITOR_CANCEL, + OFPUTIL_NXT_FLOW_MONITOR_PAUSED, + OFPUTIL_NXT_FLOW_MONITOR_RESUMED, /* NXST_* stat requests. */ OFPUTIL_NXST_FLOW_REQUEST, OFPUTIL_NXST_AGGREGATE_REQUEST, + OFPUTIL_NXST_FLOW_MONITOR_REQUEST, /* NXST_* stat replies. */ OFPUTIL_NXST_FLOW_REPLY, - OFPUTIL_NXST_AGGREGATE_REPLY + OFPUTIL_NXST_AGGREGATE_REPLY, + OFPUTIL_NXST_FLOW_MONITOR_REPLY, }; struct ofputil_msg_type; @@ -506,6 +511,48 @@ enum ofperr ofputil_decode_port_mod(const struct ofp_header *, struct ofpbuf *ofputil_encode_port_mod(const struct ofputil_port_mod *, enum ofputil_protocol); +/* 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; +}; + +int ofputil_decode_flow_monitor_request(struct ofputil_flow_monitor_request *, + struct ofpbuf *msg); +void ofputil_append_flow_monitor_request( + const struct ofputil_flow_monitor_request *, struct ofpbuf *msg); + +/* Abstract nx_flow_update. */ +struct ofputil_flow_update { + enum nx_flow_update_event event; + + /* Used only for NXFME_ADDED, NXFME_DELETED, NXFME_MODIFIED. */ + enum ofp_flow_removed_reason reason; + uint16_t idle_timeout; + uint16_t hard_timeout; + uint8_t table_id; + ovs_be64 cookie; + struct cls_rule *match; + struct ofpact *ofpacts; + size_t ofpacts_len; + + /* Used only for NXFME_ABBREV. */ + ovs_be32 xid; +}; + +int ofputil_decode_flow_update(struct ofputil_flow_update *, + struct ofpbuf *msg, struct ofpbuf *ofpacts); +void ofputil_start_flow_update(struct list *replies); +void ofputil_append_flow_update(const struct ofputil_flow_update *, + struct list *replies); + +/* Abstract nx_flow_monitor_cancel. */ +uint32_t ofputil_decode_flow_monitor_cancel(const struct ofp_header *); +struct ofpbuf *ofputil_encode_flow_monitor_cancel(uint32_t id); + /* OpenFlow protocol utility functions. */ void *make_openflow(size_t openflow_len, uint8_t type, struct ofpbuf **); void *make_nxmsg(size_t openflow_len, uint32_t subtype, struct ofpbuf **); @@ -531,6 +578,10 @@ void *ofputil_make_stats_reply(size_t openflow_len, const struct ofp_stats_msg *request, struct ofpbuf **); +void ofputil_put_stats_header(ovs_be32 xid, uint8_t ofp_type, + ovs_be16 ofpst_type, ovs_be32 nxst_subtype, + struct ofpbuf *); + void ofputil_start_stats_reply(const struct ofp_stats_msg *request, struct list *); struct ofpbuf *ofputil_reserve_stats_reply(size_t len, struct list *); @@ -598,14 +649,16 @@ bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *); */ enum OVS_PACKED_ENUM ofputil_action_code { OFPUTIL_ACTION_INVALID, -#define OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM, +#define OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM, +#define OFPAT11_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM, #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM, #include "ofp-util.def" }; /* The number of values of "enum ofputil_action_code". */ enum { -#define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1 +#define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1 +#define OFPAT11_ACTION(ENUM, STRUCT, NAME) + 1 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1 OFPUTIL_N_ACTIONS = 1 #include "ofp-util.def" @@ -632,6 +685,9 @@ void *ofputil_put_action(enum ofputil_action_code, struct ofpbuf *buf); #define OFPAT10_ACTION(ENUM, STRUCT, NAME) \ void ofputil_init_##ENUM(struct STRUCT *); \ struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *); +#define OFPAT11_ACTION(ENUM, STRUCT, NAME) \ + void ofputil_init_##ENUM(struct STRUCT *); \ + struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *); #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \ void ofputil_init_##ENUM(struct STRUCT *); \ struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);