diff --git a/dev/flags/flags.c b/dev/flags/flags.c index 4d1bc2c4f..195fdc344 100644 --- a/dev/flags/flags.c +++ b/dev/flags/flags.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -44,11 +45,13 @@ #define SHOW_AS_QC 0x00200000 #define SHOW_AS_SPOPC 0x00400000 #define SHOW_AS_SPOPS 0x00800000 +#define SHOW_AS_QCC 0x01000000 +#define SHOW_AS_QCS 0x02000000 // command line names, must be in exact same order as the SHOW_AS_* flags above // so that show_as_words[i] matches flag 1U<flags = %s\n", (qc_show_flags (buf, bsz, " | ", flags), buf)); if (show_as & SHOW_AS_SPOPC) printf("spopc->flags = %s\n",(spop_conn_show_flags(buf, bsz, " | ", flags), buf)); if (show_as & SHOW_AS_SPOPS) printf("spops->flags = %s\n",(spop_strm_show_flags(buf, bsz, " | ", flags), buf)); + if (show_as & SHOW_AS_QCC) printf("qcc->flags = %s\n", (qcc_show_flags (buf, bsz, " | ", flags), buf)); + if (show_as & SHOW_AS_QCS) printf("qcs->flags = %s\n", (qcs_show_flags (buf, bsz, " | ", flags), buf)); } return 0; } diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h index 02f8a72fe..daf39f1e8 100644 --- a/include/haproxy/mux_quic-t.h +++ b/include/haproxy/mux_quic-t.h @@ -29,13 +29,6 @@ enum qcs_type { QCS_MAX_TYPES }; -#define QC_CF_ERRL 0x00000001 /* fatal error detected locally, connection should be closed soon */ -#define QC_CF_ERRL_DONE 0x00000002 /* local error properly handled, connection can be released */ -/* unused 0x00000004 */ -#define QC_CF_CONN_FULL 0x00000008 /* no stream buffers available on connection */ -#define QC_CF_APP_SHUT 0x00000010 /* Application layer shutdown done. */ -#define QC_CF_ERR_CONN 0x00000020 /* fatal error reported by transport layer */ - struct qcc { struct connection *conn; uint64_t nb_sc; /* number of attached stream connectors */ @@ -103,20 +96,6 @@ struct qcc { void *ctx; /* Application layer context */ }; -#define QC_SF_NONE 0x00000000 -#define QC_SF_SIZE_KNOWN 0x00000001 /* last frame received for this stream */ -#define QC_SF_FIN_STREAM 0x00000002 /* FIN bit must be set for last frame of the stream */ -#define QC_SF_BLK_MROOM 0x00000004 /* app layer is blocked waiting for room in the qcs.tx.buf */ -#define QC_SF_DETACH 0x00000008 /* sc is detached but there is remaining data to send */ -/* unused 0x00000010 */ -#define QC_SF_DEM_FULL 0x00000020 /* demux blocked on request channel buffer full */ -#define QC_SF_READ_ABORTED 0x00000040 /* Rx closed using STOP_SENDING*/ -#define QC_SF_TO_RESET 0x00000080 /* a RESET_STREAM must be sent */ -#define QC_SF_HREQ_RECV 0x00000100 /* a full HTTP request has been received */ -#define QC_SF_TO_STOP_SENDING 0x00000200 /* a STOP_SENDING must be sent */ -#define QC_SF_UNKNOWN_PL_LENGTH 0x00000400 /* HTX EOM may be missing from the stream layer */ -#define QC_SF_RECV_RESET 0x00000800 /* a RESET_STREAM was received */ - /* Maximum size of stream Rx buffer. */ #define QC_S_RX_BUF_SZ (global.tune.bufsize - NCB_RESERVED_SZ) @@ -223,4 +202,73 @@ struct qcc_app_ops { #endif /* USE_QUIC */ +#define QC_CF_ERRL 0x00000001 /* fatal error detected locally, connection should be closed soon */ +#define QC_CF_ERRL_DONE 0x00000002 /* local error properly handled, connection can be released */ +/* unused 0x00000004 */ +#define QC_CF_CONN_FULL 0x00000008 /* no stream buffers available on connection */ +#define QC_CF_APP_SHUT 0x00000010 /* Application layer shutdown done. */ +#define QC_CF_ERR_CONN 0x00000020 /* fatal error reported by transport layer */ + +/* This function is used to report flags in debugging tools. Please reflect + * below any single-bit flag addition above in the same order via the + * __APPEND_FLAG macro. The new end of the buffer is returned. + */ +static forceinline char *qcc_show_flags(char *buf, size_t len, const char *delim, uint flg) +{ +#define _(f, ...) __APPEND_FLAG(buf, len, delim, flg, f, #f, __VA_ARGS__) + /* prologue */ + _(0); + /* flags */ + _(QC_CF_ERRL, + _(QC_CF_ERRL_DONE, + _(QC_CF_CONN_FULL, + _(QC_CF_APP_SHUT, + _(QC_CF_ERR_CONN))))); + /* epilogue */ + _(~0U); + return buf; +#undef _ +} + +#define QC_SF_NONE 0x00000000 +#define QC_SF_SIZE_KNOWN 0x00000001 /* last frame received for this stream */ +#define QC_SF_FIN_STREAM 0x00000002 /* FIN bit must be set for last frame of the stream */ +#define QC_SF_BLK_MROOM 0x00000004 /* app layer is blocked waiting for room in the qcs.tx.buf */ +#define QC_SF_DETACH 0x00000008 /* sc is detached but there is remaining data to send */ +/* unused 0x00000010 */ +#define QC_SF_DEM_FULL 0x00000020 /* demux blocked on request channel buffer full */ +#define QC_SF_READ_ABORTED 0x00000040 /* Rx closed using STOP_SENDING*/ +#define QC_SF_TO_RESET 0x00000080 /* a RESET_STREAM must be sent */ +#define QC_SF_HREQ_RECV 0x00000100 /* a full HTTP request has been received */ +#define QC_SF_TO_STOP_SENDING 0x00000200 /* a STOP_SENDING must be sent */ +#define QC_SF_UNKNOWN_PL_LENGTH 0x00000400 /* HTX EOM may be missing from the stream layer */ +#define QC_SF_RECV_RESET 0x00000800 /* a RESET_STREAM was received */ + +/* This function is used to report flags in debugging tools. Please reflect + * below any single-bit flag addition above in the same order via the + * __APPEND_FLAG macro. The new end of the buffer is returned. + */ +static forceinline char *qcs_show_flags(char *buf, size_t len, const char *delim, uint flg) +{ +#define _(f, ...) __APPEND_FLAG(buf, len, delim, flg, f, #f, __VA_ARGS__) + /* prologue */ + _(0); + /* flags */ + _(QC_SF_SIZE_KNOWN, + _(QC_SF_FIN_STREAM, + _(QC_SF_BLK_MROOM, + _(QC_SF_DETACH, + _(QC_SF_DEM_FULL, + _(QC_SF_READ_ABORTED, + _(QC_SF_TO_RESET, + _(QC_SF_HREQ_RECV, + _(QC_SF_TO_STOP_SENDING, + _(QC_SF_UNKNOWN_PL_LENGTH, + _(QC_SF_RECV_RESET))))))))))); + /* epilogue */ + _(~0U); + return buf; +#undef _ +} + #endif /* _HAPROXY_MUX_QUIC_T_H */