X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fofp-util.h;h=187be8cd312d1944b873242cc0e210ffa9097406;hb=ca7e7bee86b4ee821d61b58bf15c89a9d8a3cb30;hp=19bfc4b4037df2ac85ccc7a0c7c7e507ef544da8;hpb=95022b47358676771e7b8050542fd4b2edfe18b9;p=cascardo%2Fovs.git diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 19bfc4b40..187be8cd3 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -31,6 +31,7 @@ #include "openflow/nicira-ext.h" #include "openvswitch/types.h" #include "type-props.h" +#include "uuid.h" struct ofpbuf; union ofp_action; @@ -427,7 +428,7 @@ struct ofputil_packet_in { * the original packet. ofputil_decode_packet_in() reports the full * original length of the packet using its 'total_len' output parameter. */ void *packet; /* The packet. */ - size_t len; /* Length of 'packet' in bytes. */ + size_t packet_len; /* Length of 'packet' in bytes. */ /* Input port and other metadata for packet. */ struct match flow_metadata; @@ -441,16 +442,22 @@ struct ofputil_packet_in { * that case, 'cookie' is UINT64_MAX. */ uint8_t table_id; /* OpenFlow table ID. */ ovs_be64 cookie; /* Flow's cookie. */ + + /* Arbitrary user-provided data. */ + uint8_t *userdata; + size_t userdata_len; }; -struct ofpbuf *ofputil_encode_packet_in(const struct ofputil_packet_in *, - enum ofputil_protocol protocol, - enum nx_packet_in_format, - uint16_t max_len, struct pktbuf *); +void ofputil_packet_in_destroy(struct ofputil_packet_in *); -enum ofperr ofputil_decode_packet_in(const struct ofp_header *, +enum ofperr ofputil_decode_packet_in(const struct ofp_header *, bool loose, struct ofputil_packet_in *, - size_t *total_len, uint32_t *buffer_id); + size_t *total_len, uint32_t *buffer_id, + struct ofpbuf *continuation); + +struct ofpbuf *ofputil_encode_resume(const struct ofputil_packet_in *pin, + const struct ofpbuf *continuation, + enum ofputil_protocol); enum { OFPUTIL_PACKET_IN_REASON_BUFSIZE = INT_STRLEN(int) + 1 }; const char *ofputil_packet_in_reason_to_string(enum ofp_packet_in_reason, @@ -459,6 +466,48 @@ const char *ofputil_packet_in_reason_to_string(enum ofp_packet_in_reason, bool ofputil_packet_in_reason_from_string(const char *, enum ofp_packet_in_reason *); +/* A packet-in message, including continuation data. The format of + * continuation data is subject to change and thus it is supposed to be opaque + * to any process other than ovs-vswitchd. Therefore, only ovs-vswitchd should + * use ofputil_packet_in_private and the functions that operate on it. */ +struct ofputil_packet_in_private { + struct ofputil_packet_in public; + + /* NXCPT_BRIDGE. */ + struct uuid bridge; + + /* NXCPT_STACK. */ + union mf_subvalue *stack; + size_t n_stack; + + /* NXCPT_MIRRORS. */ + uint32_t mirrors; + + /* NXCPT_CONNTRACKED. */ + bool conntracked; + + /* NXCPT_ACTIONS. */ + struct ofpact *actions; + size_t actions_len; + + /* NXCPT_ACTION_SET. */ + struct ofpact *action_set; + size_t action_set_len; +}; + +struct ofpbuf *ofputil_encode_packet_in_private( + const struct ofputil_packet_in_private *, + enum ofputil_protocol protocol, + enum nx_packet_in_format, + uint16_t max_len, struct pktbuf *); + +enum ofperr ofputil_decode_packet_in_private( + const struct ofp_header *, bool loose, + struct ofputil_packet_in_private *, + size_t *total_len, uint32_t *buffer_id); + +void ofputil_packet_in_private_destroy(struct ofputil_packet_in_private *); + /* Abstract packet-out message. * * ofputil_decode_packet_out() will ensure that 'in_port' is a physical port