+void ofpbuf_padto(struct ofpbuf *, size_t);
+void ofpbuf_shift(struct ofpbuf *, int);
+
+static inline void ofpbuf_clear(struct ofpbuf *);
+static inline void *ofpbuf_pull(struct ofpbuf *, size_t);
+static inline void *ofpbuf_try_pull(struct ofpbuf *, size_t);
+
+void *ofpbuf_steal_data(struct ofpbuf *);
+
+char *ofpbuf_to_string(const struct ofpbuf *, size_t maxbytes);
+static inline struct ofpbuf *ofpbuf_from_list(const struct list *);
+void ofpbuf_list_delete(struct list *);
+static inline bool ofpbuf_equal(const struct ofpbuf *, const struct ofpbuf *);
+
+\f
+/* Returns a pointer that may be passed to free() to accomplish the same thing
+ * as ofpbuf_uninit(b). The return value is a null pointer if ofpbuf_uninit()
+ * would not free any memory. */
+static inline void *ofpbuf_get_uninit_pointer(struct ofpbuf *b)
+{
+ /* XXX: If 'source' is OFPBUF_DPDK memory gets leaked! */
+ return b && b->source == OFPBUF_MALLOC ? ofpbuf_base(b) : NULL;
+}
+
+/* Frees memory that 'b' points to, as well as 'b' itself. */
+static inline void ofpbuf_delete(struct ofpbuf *b)
+{
+ if (b) {
+ if (b->source == OFPBUF_DPDK) {
+ free_dpdk_buf(b);
+ return;
+ }
+
+ 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 <= ofpbuf_size(b) ? (char *) ofpbuf_data(b) + 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 <= ofpbuf_size(b));
+ return ((char *) ofpbuf_data(b)) + offset;
+}
+
+/* Returns the byte following the last byte of data in use in 'b'. */
+static inline void *ofpbuf_tail(const struct ofpbuf *b)
+{
+ return (char *) ofpbuf_data(b) + ofpbuf_size(b);
+}
+
+/* Returns the byte following the last byte allocated for use (but not
+ * necessarily in use) by 'b'. */
+static inline void *ofpbuf_end(const struct ofpbuf *b)
+{
+ return (char *) ofpbuf_base(b) + 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*)ofpbuf_data(b) - (char*)ofpbuf_base(b);
+}
+
+/* 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);
+}
+
+/* Clears any data from 'b'. */
+static inline void ofpbuf_clear(struct ofpbuf *b)
+{
+ ofpbuf_set_data(b, ofpbuf_base(b));
+ ofpbuf_set_size(b, 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 = ofpbuf_data(b);
+ ovs_assert(ofpbuf_size(b) >= size);
+ ofpbuf_set_data(b, (char*)ofpbuf_data(b) + size);
+ ofpbuf_set_size(b, ofpbuf_size(b) - 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 ofpbuf_size(b) >= size ? ofpbuf_pull(b, size) : NULL;
+}
+
+static inline struct ofpbuf *ofpbuf_from_list(const struct list *list)
+{
+ return CONTAINER_OF(list, struct ofpbuf, list_node);
+}
+
+static inline bool ofpbuf_equal(const struct ofpbuf *a, const struct ofpbuf *b)
+{
+ return ofpbuf_size(a) == ofpbuf_size(b) &&
+ memcmp(ofpbuf_data(a), ofpbuf_data(b), ofpbuf_size(a)) == 0;
+}
+
+/* Get the start if the Ethernet frame. 'l3_ofs' marks the end of the l2
+ * headers, so return NULL if it is not set. */
+static inline void * ofpbuf_l2(const struct ofpbuf *b)
+{
+ return (b->l3_ofs != UINT16_MAX) ? b->frame : NULL;
+}