mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-06 05:22:10 +00:00
MINOR: flags/mux-h2: decode H2C and H2S flags
The new functions h2c_show_flags() and h2s_show_flags() decode the flags state into a string, and are used by dev/flags: $ ./dev/flags/flags h2c 0x0600 h2c->flags = H2_CF_DEM_IN_PROGRESS | H2_CF_DEM_SHORT_READ $ ./dev/flags/flags h2s 0x7003 h2s->flags = H2_SF_HEADERS_RCVD | H2_SF_OUTGOING_DATA | H2_SF_HEADERS_SENT \ | H2_SF_ES_SENT | H2_SF_ES_RCVD
This commit is contained in:
parent
6c0fadfb7d
commit
439be5838d
@ -6,6 +6,7 @@
|
||||
#include <haproxy/fd-t.h>
|
||||
#include <haproxy/http_ana-t.h>
|
||||
#include <haproxy/htx-t.h>
|
||||
#include <haproxy/mux_h2-t.h>
|
||||
#include <haproxy/stconn-t.h>
|
||||
#include <haproxy/stream-t.h>
|
||||
#include <haproxy/task-t.h>
|
||||
@ -24,10 +25,12 @@
|
||||
#define SHOW_AS_HTX 0x00000400
|
||||
#define SHOW_AS_HMSG 0x00000800
|
||||
#define SHOW_AS_FD 0x00001000
|
||||
#define SHOW_AS_H2C 0x00002000
|
||||
#define SHOW_AS_H2S 0x00004000
|
||||
|
||||
// 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", };
|
||||
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", "hsl", "htx", "hmsg", "fd", "h2c", "h2s", };
|
||||
|
||||
/* will be sufficient for even largest flag names */
|
||||
static char buf[4096];
|
||||
@ -134,6 +137,8 @@ int main(int argc, char **argv)
|
||||
if (show_as & SHOW_AS_HTX) printf("htx->flags = %s\n", (htx_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_HMSG) printf("hmsg->flags = %s\n", (hmsg_show_flags (buf, bsz, " | ", flags), buf));
|
||||
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));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define _HAPROXY_MUX_H2_T_H
|
||||
|
||||
#include <haproxy/api-t.h>
|
||||
#include <haproxy/show_flags-t.h>
|
||||
|
||||
/**** Connection flags (32 bit), in h2c->flags ****/
|
||||
|
||||
@ -65,6 +66,29 @@
|
||||
#define H2_CF_SHTS_UPDATED 0x00200000 // SETTINGS_HEADER_TABLE_SIZE updated
|
||||
#define H2_CF_DTSU_EMITTED 0x00400000 // HPACK Dynamic Table Size Update opcode emitted
|
||||
|
||||
/* 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 *h2c_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 */
|
||||
_(H2_CF_MUX_MALLOC, _(H2_CF_MUX_MFULL, _(H2_CF_DEM_DALLOC,
|
||||
_(H2_CF_DEM_DFULL, _(H2_CF_DEM_MBUSY, _(H2_CF_DEM_MROOM,
|
||||
_(H2_CF_DEM_SALLOC, _(H2_CF_DEM_SFULL, _(H2_CF_DEM_TOOMANY,
|
||||
_(H2_CF_DEM_SHORT_READ, _(H2_CF_DEM_IN_PROGRESS, _(H2_CF_GOAWAY_SENT,
|
||||
_(H2_CF_GOAWAY_FAILED, _(H2_CF_WAIT_FOR_HS, _(H2_CF_IS_BACK,
|
||||
_(H2_CF_WINDOW_OPENED, _(H2_CF_RCVD_SHUT, _(H2_CF_END_REACHED,
|
||||
_(H2_CF_RCVD_RFC8441, _(H2_CF_SHTS_UPDATED, _(H2_CF_DTSU_EMITTED)))))))))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
|
||||
/**** HTTP/2 stream flags (32 bit), in h2s->flags ****/
|
||||
|
||||
@ -102,6 +126,29 @@
|
||||
#define H2_SF_TUNNEL_ABRT 0x00100000 // A tunnel attempt was aborted
|
||||
#define H2_SF_MORE_HTX_DATA 0x00200000 // more data expected from HTX
|
||||
|
||||
/* 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 *h2s_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 */
|
||||
_(H2_SF_ES_RCVD, _(H2_SF_ES_SENT, _(H2_SF_RST_RCVD, _(H2_SF_RST_SENT,
|
||||
_(H2_SF_BLK_MBUSY, _(H2_SF_BLK_MROOM, _(H2_SF_BLK_MFCTL,
|
||||
_(H2_SF_BLK_SFCTL, _(H2_SF_DATA_CLEN, _(H2_SF_BODYLESS_RESP,
|
||||
_(H2_SF_BODY_TUNNEL, _(H2_SF_NOTIFIED, _(H2_SF_HEADERS_SENT,
|
||||
_(H2_SF_OUTGOING_DATA, _(H2_SF_HEADERS_RCVD, _(H2_SF_WANT_SHUTR,
|
||||
_(H2_SF_WANT_SHUTW, _(H2_SF_EXT_CONNECT_SENT, _(H2_SF_EXT_CONNECT_RCVD,
|
||||
_(H2_SF_TUNNEL_ABRT, _(H2_SF_MORE_HTX_DATA)))))))))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
#undef _
|
||||
}
|
||||
|
||||
|
||||
/* H2 connection state, in h2c->st0 */
|
||||
enum h2_cs {
|
||||
|
Loading…
Reference in New Issue
Block a user