[ovs-dev] [PATCH 3/6 RFC] lib/ofp-util: add support for encoding OFPTYPE_ROLE_STATUS messages

Ben Pfaff blp at nicira.com
Tue Oct 8 21:10:11 UTC 2013


On Tue, Oct 08, 2013 at 12:26:20PM +0300, Alexandru Copot wrote:
> Signed-off-by: Alexandru Copot <alex.mihai.c at gmail.com>
> Cc: Daniel Baluta <dbaluta at ixiacom.com>

Looks good, thanks.

> ---
>  lib/ofp-util.c | 17 +++++++++++++++++
>  lib/ofp-util.h | 10 ++++++++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index 173b534..9bc30a7 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -3906,6 +3906,23 @@ ofputil_encode_role_reply(const struct ofp_header *request,
>      return buf;
>  }
>  
> +struct ofpbuf *
> +ofputil_encode_role_status(const struct ofputil_role_status *status,
> +                           enum ofputil_protocol protocol)
> +{
> +    struct ofpbuf *buf;
> +    enum ofp_version version;
> +    struct ofp14_role_status *rstatus;
> +
> +    version = ofputil_protocol_to_ofp_version(protocol);
> +    buf = ofpraw_alloc_xid(OFPRAW_OFPT14_ROLE_STATUS, version, htonl(0), 0);
> +    rstatus = ofpbuf_put_zeros(buf, sizeof *rstatus);
> +    rstatus->role = status->role;
> +    rstatus->reason = status->reason;
> +    rstatus->generation_id = status->generation_id;
> +
> +    return buf;
> +}
>  /* Table stats. */
>  
>  static void
> diff --git a/lib/ofp-util.h b/lib/ofp-util.h
> index d5f34d7..c3a35a7 100644
> --- a/lib/ofp-util.h
> +++ b/lib/ofp-util.h
> @@ -678,11 +678,21 @@ struct ofputil_role_request {
>      uint64_t generation_id;
>  };
>  
> +struct ofputil_role_status {
> +    enum ofp12_controller_role role;
> +    enum ofp14_controller_role_reason reason;
> +    uint64_t generation_id;
> +};
> +
>  enum ofperr ofputil_decode_role_message(const struct ofp_header *,
>                                          struct ofputil_role_request *);
>  struct ofpbuf *ofputil_encode_role_reply(const struct ofp_header *,
>                                           const struct ofputil_role_request *);
>  
> +struct ofpbuf *ofputil_encode_role_status(
> +                                const struct ofputil_role_status *status,
> +                                enum ofputil_protocol protocol);
> +
>  /* Abstract table stats.
>   *
>   * For now we use ofp12_table_stats as a superset of the other protocol
> -- 
> 1.8.4
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list