Ejemplo n.º 1
0
/* Creates and returns a new ofpbuf that initially contains 'headroom' bytes of
 * headroom followed by a copy of the 'size' bytes of data starting at
 * 'data'. */
struct ofpbuf *
ofpbuf_clone_data_with_headroom(const void *data, size_t size, size_t headroom)
{
    struct ofpbuf *b = ofpbuf_new_with_headroom(size, headroom);
    ofpbuf_put(b, data, size);
    return b;
}
Ejemplo n.º 2
0
/* Creates and returns a new ofpbuf whose data are copied from 'buffer'.   The
 * returned ofpbuf will additionally have 'headroom' bytes of headroom. */
struct ofpbuf *
ofpbuf_clone_with_headroom(const struct ofpbuf *buffer, size_t headroom)
{
    struct ofpbuf *b = ofpbuf_new_with_headroom(buffer->size, headroom);
    ofpbuf_put(b, buffer->data, buffer->size);
    return b;
}