From: Amaury Denoyelle Date: Tue, 14 Oct 2025 09:35:21 +0000 (+0200) Subject: MINOR: ncbuf: extract common types X-Git-Tag: v3.3-dev11~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59f0bafef28259f4bceebb00bbce4c48e5dd5791;p=thirdparty%2Fhaproxy.git MINOR: ncbuf: extract common types ncbuf is a module which provide a non-contiguous buffer type implementation. This patch extracts some basic types related to it into a new file ncbuf_common.h. This patch will be useful to provide a new non-contiguous buffer alternative implementation based on a bitmap. This patch is not a bug fix. However, it is necessary for ncbmbuf implementation which will be required to fix a QUIC issue on CRYPTO frames parsing. This, it will be necessary to backport the current patch prior to the fix to come. --- diff --git a/include/haproxy/ncbuf-t.h b/include/haproxy/ncbuf-t.h index 0dd958fbc..90bddf199 100644 --- a/include/haproxy/ncbuf-t.h +++ b/include/haproxy/ncbuf-t.h @@ -1,6 +1,8 @@ #ifndef _HAPROXY_NCBUF_T_H #define _HAPROXY_NCBUF_T_H +#include + /* **** public documentation **** * * stands for non-contiguous circular buffer. This type can be used to @@ -62,15 +64,6 @@ * */ -#include - -/* ncb_sz_t is the basic type used in ncbuf to represent data and gap sizes. - * Use a bigger type to extend the maximum data size supported in the buffer. - * On the other hand, this also increases the minimal gap size which can - * cause more rejection for add/delete operations. - */ -typedef uint32_t ncb_sz_t; - /* reserved size before head used to store first data block size */ #define NCB_RESERVED_SZ (sizeof(ncb_sz_t)) @@ -87,18 +80,4 @@ struct ncbuf { ncb_sz_t head; }; -enum ncb_ret { - NCB_RET_OK = 0, /* no error */ - - NCB_RET_GAP_SIZE, /* operation would create a too small gap */ - NCB_RET_DATA_REJ, /* operation would overwrite data with different one */ -}; - -/* Define how insert is conducted in regards with already stored data. */ -enum ncb_add_mode { - NCB_ADD_PRESERVE, /* keep the already stored data and only insert in gaps */ - NCB_ADD_OVERWRT, /* overwrite old data with new ones */ - NCB_ADD_COMPARE, /* compare before insert : if new data are different do not proceed */ -}; - #endif /* _HAPROXY_NCBUF_T_H */ diff --git a/include/haproxy/ncbuf_common-t.h b/include/haproxy/ncbuf_common-t.h new file mode 100644 index 000000000..0df31a0e6 --- /dev/null +++ b/include/haproxy/ncbuf_common-t.h @@ -0,0 +1,27 @@ +#ifndef _HAPROXY_NCBUF_COMMON_T_H +#define _HAPROXY_NCBUF_COMMON_T_H + +#include + +/* ncb_sz_t is the basic type used in ncbuf to represent data and gap sizes. + * Use a bigger type to extend the maximum data size supported in the buffer. + * On the other hand, this also increases the minimal gap size which can + * cause more rejection for add/delete operations. + */ +typedef uint32_t ncb_sz_t; + +enum ncb_ret { + NCB_RET_OK = 0, /* no error */ + + NCB_RET_GAP_SIZE, /* operation would create a too small gap */ + NCB_RET_DATA_REJ, /* operation would overwrite data with different one */ +}; + +/* Define how insert is conducted in regards with already stored data. */ +enum ncb_add_mode { + NCB_ADD_PRESERVE, /* keep the already stored data and only insert in gaps */ + NCB_ADD_OVERWRT, /* overwrite old data with new ones */ + NCB_ADD_COMPARE, /* compare before insert : if new data are different do not proceed */ +}; + +#endif /* _HAPROXY_NCBUF_COMMON_T_H */