]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: qpack: move encoded macros to qpack-t.h to avoid duplication 20260527-fle-ia-review flx04/20260527-fle-ia-review
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 27 May 2026 16:38:32 +0000 (18:38 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 27 May 2026 16:40:53 +0000 (18:40 +0200)
QPACK_LFL_WLN_BIT and related encoded field line bitmasks were defined
in both qpack-enc.c and qpack-dec.c. Moved them to qpack-t.h where
they are shared between encoder and decoder, eliminating the duplicate
definitions.

Should be backported to ease any further commit to come.

include/haproxy/qpack-t.h
src/qpack-dec.c
src/qpack-enc.c

index 1cc6dabaa9d88a0069eb692c3ac4f34e4e511207..495ef5bc5b8e020c37fc37e57f985b8d2347e183 100644 (file)
 #define QPACK_DEC_INST_SCCL     0x40 // Stream Cancellation
 #define QPACK_DEC_INST_SACK     0x80 // Section Acknowledgment
 
+/* Encoded field line bitmasks (shared between encoder and decoder) */
+#define QPACK_EFL_BITMASK   0xf0
+#define QPACK_LFL_WPBNM     0x00 // Literal field line with post-base name reference
+#define QPACK_IFL_WPBI      0x10 // Indexed field line with post-based index
+#define QPACK_LFL_WLN_BIT   0x20 // Literal field line with literal name
+#define QPACK_LFL_WNR_BIT   0x40 // Literal field line with name reference
+#define QPACK_IFL_BIT       0x80 // Indexed field line
+
 /* RFC 9204 6. Error Handling */
 enum qpack_err {
        QPACK_ERR_DECOMPRESSION_FAILED = 0x200,
index f70206f4ac57017eabb62a4f6f23f1404cb3c741..7016553f1ae5b06a09b8269e135566ffec51e0df 100644 (file)
 #define qpack_debug_hexdump(...) do { } while (0)
 #endif
 
-/* Encoded field line bitmask */
-#define QPACK_EFL_BITMASK  0xf0
-#define QPACK_LFL_WPBNM    0x00 // Literal field line with post-base name reference
-#define QPACK_IFL_WPBI     0x10 // Indexed field line with post-based index
-#define QPACK_LFL_WLN_BIT  0x20 // Literal field line with literal name
-#define QPACK_LFL_WNR_BIT  0x40 // Literal field line with name reference
-#define QPACK_IFL_BIT      0x80 // Indexed field line
-
 /* reads a varint from <raw>'s lowest <b> bits and <len> bytes max (raw included).
  * returns the 64-bit value on success after updating buf and len_in. Forces
  * len_in to (uint64_t)-1 on truncated input.
index 3877b7b945f78846cdcef1d38690cb353500854a..75244c0b5e41d4241f8af1b5ca78858682228ab1 100644 (file)
@@ -1,6 +1,7 @@
 #include <haproxy/qpack-enc.h>
 
 #include <haproxy/buf.h>
+#include <haproxy/qpack-t.h>
 #include <haproxy/intops.h>
 
 /* Returns the byte size required to encode <i> as a <prefix_size>-prefix
@@ -265,8 +266,6 @@ int qpack_encode_field_section_line(struct buffer *out)
        return 0;
 }
 
-#define QPACK_LFL_WLN_BIT  0x20 // Literal field line with literal name
-
 /* Encode a header in literal field line with literal name.
  * Returns 0 on success else non-zero.
  */