+static inline struct ofpbuf *ofpbuf_from_list(const struct ovs_list *);
+void ofpbuf_list_delete(struct ovs_list *);
+static inline bool ofpbuf_equal(const struct ofpbuf *, const struct ofpbuf *);
+
+\f
+/* Frees memory that 'b' points to, as well as 'b' itself. */
+static inline void ofpbuf_delete(struct ofpbuf *b)
+{
+ if (b) {
+ ofpbuf_uninit(b);
+ free(b);
+ }
+}
+
+/* If 'b' contains at least 'offset + size' bytes of data, returns a pointer to
+ * byte 'offset'. Otherwise, returns a null pointer. */
+static inline void *ofpbuf_at(const struct ofpbuf *b, size_t offset,
+ size_t size)
+{
+ return offset + size <= b->size ? (char *) b->data + offset : NULL;
+}
+
+/* Returns a pointer to byte 'offset' in 'b', which must contain at least
+ * 'offset + size' bytes of data. */
+static inline void *ofpbuf_at_assert(const struct ofpbuf *b, size_t offset,
+ size_t size)
+{
+ ovs_assert(offset + size <= b->size);
+ return ((char *) b->data) + offset;
+}
+
+/* Returns a pointer to byte following the last byte of data in use in 'b'. */
+static inline void *ofpbuf_tail(const struct ofpbuf *b)
+{
+ return (char *) b->data + b->size;
+}
+
+/* Returns a pointer to byte following the last byte allocated for use (but
+ * not necessarily in use) in 'b'. */
+static inline void *ofpbuf_end(const struct ofpbuf *b)
+{
+ return (char *) b->base + b->allocated;
+}
+
+/* Returns the number of bytes of headroom in 'b', that is, the number of bytes
+ * of unused space in ofpbuf 'b' before the data that is in use. (Most
+ * commonly, the data in a ofpbuf is at its beginning, and thus the ofpbuf's
+ * headroom is 0.) */
+static inline size_t ofpbuf_headroom(const struct ofpbuf *b)
+{
+ return (char*)b->data - (char*)b->base;
+}
+
+/* Returns the number of bytes that may be appended to the tail end of ofpbuf
+ * 'b' before the ofpbuf must be reallocated. */
+static inline size_t ofpbuf_tailroom(const struct ofpbuf *b)
+{
+ return (char*)ofpbuf_end(b) - (char*)ofpbuf_tail(b);
+}
+
+/* Returns the number of bytes from 'b->header' to 'b->msg', that is, the
+ * length of 'b''s header. */
+static inline size_t
+ofpbuf_headersize(const struct ofpbuf *b)
+{
+ return (char *)b->msg - (char *)b->header;
+}
+
+/* Returns the number of bytes from 'b->msg' to 'b->data + b->size', that is,
+ * the length of the used space in 'b' starting from 'msg'. */
+static inline size_t
+ofpbuf_msgsize(const struct ofpbuf *b)
+{
+ return (char *)ofpbuf_tail(b) - (char *)b->msg;
+}
+
+/* Clears any data from 'b'. */
+static inline void ofpbuf_clear(struct ofpbuf *b)
+{
+ b->data = b->base;
+ b->size = 0;
+}
+
+/* Removes 'size' bytes from the head end of 'b', which must contain at least
+ * 'size' bytes of data. Returns the first byte of data removed. */
+static inline void *ofpbuf_pull(struct ofpbuf *b, size_t size)
+{
+ void *data = b->data;
+ b->data = (char*)b->data + size;
+ b->size = b->size - size;
+ return data;
+}
+
+/* If 'b' has at least 'size' bytes of data, removes that many bytes from the
+ * head end of 'b' and returns the first byte removed. Otherwise, returns a
+ * null pointer without modifying 'b'. */
+static inline void *ofpbuf_try_pull(struct ofpbuf *b, size_t size)
+{
+ return b->size >= size ? ofpbuf_pull(b, size) : NULL;
+}