ofp-util: New function ofputil_encode_barrier_request().
authorBen Pfaff <blp@nicira.com>
Thu, 26 Jan 2012 21:17:12 +0000 (13:17 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 9 Feb 2012 21:31:32 +0000 (13:31 -0800)
This new function will acquire a new user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-util.c
lib/ofp-util.h
lib/vconn.c

index 6f8b033..c377e3e 100644 (file)
@@ -2248,6 +2248,15 @@ make_echo_reply(const struct ofp_header *rq)
     return out;
 }
 
+struct ofpbuf *
+ofputil_encode_barrier_request(void)
+{
+    struct ofpbuf *msg;
+
+    make_openflow(sizeof(struct ofp_header), OFPT_BARRIER_REQUEST, &msg);
+    return msg;
+}
+
 const char *
 ofputil_frag_handling_to_string(enum ofp_config_flags flags)
 {
index e2b32dd..0b6970a 100644 (file)
@@ -313,6 +313,8 @@ struct ofpbuf *make_packet_in(uint32_t buffer_id, uint16_t in_port,
 struct ofpbuf *make_echo_request(void);
 struct ofpbuf *make_echo_reply(const struct ofp_header *rq);
 
+struct ofpbuf *ofputil_encode_barrier_request(void);
+
 const char *ofputil_frag_handling_to_string(enum ofp_config_flags);
 bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *);
 \f
index 8e6374e..5da5026 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -730,7 +730,7 @@ vconn_transact_noreply(struct vconn *vconn, struct ofpbuf *request,
     }
 
     /* Send barrier. */
-    make_openflow(sizeof(struct ofp_header), OFPT_BARRIER_REQUEST, &barrier);
+    barrier = ofputil_encode_barrier_request();
     barrier_xid = ((struct ofp_header *) barrier->data)->xid;
     error = vconn_send_block(vconn, barrier);
     if (error) {