diff --git a/include/haproxy/ring.h b/include/haproxy/ring.h index 81440f538..f8401d8b8 100644 --- a/include/haproxy/ring.h +++ b/include/haproxy/ring.h @@ -45,6 +45,12 @@ size_t ring_max_payload(const struct ring *ring); int ring_dispatch_messages(struct ring *ring, void *ctx, size_t *ofs_ptr, size_t *last_ofs_ptr, uint flags, ssize_t (*msg_handler)(void *ctx, const struct buffer *buf, size_t ofs, size_t len)); +/* returns the ring storage's area */ +static inline void *ring_area(const struct ring *ring) +{ + return b_orig(&ring->buf); +} + /* returns the number of bytes in the ring */ static inline size_t ring_data(const struct ring *ring) { @@ -57,6 +63,18 @@ static inline size_t ring_size(const struct ring *ring) return b_size(&ring->buf); } +/* returns the head offset of the ring */ +static inline size_t ring_head(const struct ring *ring) +{ + return b_head_ofs(&ring->buf); +} + +/* returns the tail offset of the ring */ +static inline size_t ring_tail(const struct ring *ring) +{ + return b_tail_ofs(&ring->buf); +} + /* duplicates ring over ring for no more than bytes or no * more than the amount of data present in . It's assumed that the * destination ring is always large enough for . The number of bytes