mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-03 20:13:55 +00:00
MINOR: flags/mux-h1: decode H1C and H1S flags
The new functions h1c_show_flags() and h1s_show_flags() decode the flags state into a string, and are used by dev/flags: $ /dev/flags/flags h1c 0x2200 h1c->flags = H1C_F_ST_READY | H1C_F_ST_ATTACHED ./dev/flags/flags h1s 0x190 h1s->flags = H1S_F_BODYLESS_RESP | H1S_F_NOT_FIRST | H1S_F_WANT_KAL
This commit is contained in:
parent
18ad15f5c4
commit
7c4b2ec09d
@ -7,6 +7,7 @@
|
||||
#include <haproxy/http_ana-t.h>
|
||||
#include <haproxy/htx-t.h>
|
||||
#include <haproxy/mux_h2-t.h>
|
||||
#include <haproxy/mux_h1-t.h>
|
||||
#include <haproxy/stconn-t.h>
|
||||
#include <haproxy/stream-t.h>
|
||||
#include <haproxy/task-t.h>
|
||||
@ -27,10 +28,12 @@
|
||||
#define SHOW_AS_FD 0x00001000
|
||||
#define SHOW_AS_H2C 0x00002000
|
||||
#define SHOW_AS_H2S 0x00004000
|
||||
#define SHOW_AS_H1C 0x00008000
|
||||
#define SHOW_AS_H1S 0x00010000
|
||||
|
||||
// command line names, must be in exact same order as the SHOW_AS_* flags above
|
||||
// so that show_as_words[i] matches flag 1U<<i.
|
||||
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", "hsl", "htx", "hmsg", "fd", "h2c", "h2s", };
|
||||
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", "hsl", "htx", "hmsg", "fd", "h2c", "h2s", "h1c", "h1s", };
|
||||
|
||||
/* will be sufficient for even largest flag names */
|
||||
static char buf[4096];
|
||||
@ -139,6 +142,8 @@ int main(int argc, char **argv)
|
||||
if (show_as & SHOW_AS_FD) printf("fd->flags = %s\n", (fd_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_H2C) printf("h2c->flags = %s\n", (h2c_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_H2S) printf("h2s->flags = %s\n", (h2s_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_H1C) printf("h1c->flags = %s\n", (h1c_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_H1S) printf("h1s->flags = %s\n", (h1s_show_flags (buf, bsz, " | ", flags), buf));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define _HAPROXY_MUX_H1_T_H
|
||||
|
||||
#include <haproxy/api-t.h>
|
||||
#include <haproxy/show_flags-t.h>
|
||||
|
||||
/**** Connection flags (32 bit), in h1c->flags ****/
|
||||
#define H1C_F_NONE 0x00000000
|
||||
@ -61,6 +62,30 @@
|
||||
#define H1C_F_IS_BACK 0x80000000 /* Set on outgoing connection */
|
||||
|
||||
|
||||
/* 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 *h1c_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 */
|
||||
_(H1C_F_OUT_ALLOC, _(H1C_F_OUT_FULL,
|
||||
_(H1C_F_IN_ALLOC, _(H1C_F_IN_FULL, _(H1C_F_IN_SALLOC,
|
||||
_(H1C_F_ST_EMBRYONIC, _(H1C_F_ST_ATTACHED, _(H1C_F_ST_IDLE,
|
||||
_(H1C_F_ST_ERROR, _(H1C_F_ST_SHUTDOWN, _(H1C_F_ST_READY,
|
||||
_(H1C_F_ST_SILENT_SHUT, _(H1C_F_WANT_SPLICE, _(H1C_F_ERR_PENDING,
|
||||
_(H1C_F_WAIT_NEXT_REQ, _(H1C_F_UPG_H2C, _(H1C_F_CO_MSG_MORE,
|
||||
_(H1C_F_CO_STREAMER, _(H1C_F_IS_BACK)))))))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
|
||||
/**** H1 stream flags (32 bit), in h1s->flags ****/
|
||||
#define H1S_F_NONE 0x00000000
|
||||
|
||||
@ -85,5 +110,26 @@
|
||||
#define H1S_F_HAVE_SRV_NAME 0x00002000 /* Set during output process if the server name header was added to the request */
|
||||
#define H1S_F_HAVE_O_CONN 0x00004000 /* Set during output process to know connection mode was processed */
|
||||
|
||||
/* 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 *h1s_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 */
|
||||
_(H1S_F_RX_BLK, _(H1S_F_TX_BLK, _(H1S_F_RX_CONGESTED,
|
||||
_(H1S_F_REOS, _(H1S_F_WANT_KAL, _(H1S_F_WANT_TUN, _(H1S_F_WANT_CLO,
|
||||
_(H1S_F_NOT_FIRST, _(H1S_F_BODYLESS_RESP,
|
||||
_(H1S_F_NOT_IMPL_ERROR, _(H1S_F_PARSING_ERROR, _(H1S_F_PROCESSING_ERROR,
|
||||
_(H1S_F_HAVE_SRV_NAME, _(H1S_F_HAVE_O_CONN))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
|
||||
#endif /* _HAPROXY_MUX_H1_T_H */
|
||||
|
Loading…
Reference in New Issue
Block a user