MINOR: htx: Add the start-line offset for the HTX message in the HTX structure
If there is no start-line, this offset is set to -1. Otherwise, it is the
relative address where the start-line is stored in the data block. When the
start-line is added, replaced or removed, this offset is updated accordingly. On
remove, if the start-line is no set and if the next block is a start-line, the
offset is updated. Finally, when an HTX structure is defragmented, the offset is
also updated accordingly.
diff --git a/include/proto/htx.h b/include/proto/htx.h
index e618a20..296ff4d 100644
--- a/include/proto/htx.h
+++ b/include/proto/htx.h
@@ -138,6 +138,17 @@
return htx_sl_p3(sl);
}
+/* Returns the HTX start-line if set, otherwise it returns NULL. */
+static inline struct htx_sl *htx_get_stline(struct htx *htx)
+{
+ struct htx_sl *sl = NULL;
+
+ if (htx->sl_off != -1)
+ sl = ((void *)htx->blocks + htx->sl_off);
+
+ return sl;
+}
+
/* Returns the array index of a block given its position <pos> */
static inline uint32_t htx_pos_to_idx(const struct htx *htx, uint32_t pos)
{
@@ -421,6 +432,7 @@
return ret;
}
+
/* Returns the value of the block <blk>, depending on its type. If there is no
* value, an empty one is retruned.
*/
@@ -512,6 +524,7 @@
htx->data = htx->used = htx->tail = htx->wrap = htx->front = 0;
htx->extra = 0;
htx->flags = HTX_FL_NONE;
+ htx->sl_off = -1;
}
/* Returns an HTX message using the buffer <buf>. */