2015-12-20 22:21:57 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2020-06-04 19:07:02 +00:00
|
|
|
#include <haproxy/channel-t.h>
|
2020-06-04 16:02:10 +00:00
|
|
|
#include <haproxy/connection-t.h>
|
2022-05-27 07:47:12 +00:00
|
|
|
#include <haproxy/stconn-t.h>
|
2020-06-04 19:21:03 +00:00
|
|
|
#include <haproxy/http_ana-t.h>
|
2020-06-04 21:46:14 +00:00
|
|
|
#include <haproxy/stream-t.h>
|
2020-06-04 15:25:40 +00:00
|
|
|
#include <haproxy/task-t.h>
|
2015-12-20 22:21:57 +00:00
|
|
|
|
2020-02-06 07:33:08 +00:00
|
|
|
// 1 bit per flag, no hole permitted here
|
|
|
|
#define SHOW_AS_ANA 0x00000001
|
|
|
|
#define SHOW_AS_CHN 0x00000002
|
|
|
|
#define SHOW_AS_CONN 0x00000004
|
2022-05-27 07:57:31 +00:00
|
|
|
#define SHOW_AS_SC 0x00000008
|
2022-04-04 09:28:27 +00:00
|
|
|
#define SHOW_AS_SET 0x00000010
|
|
|
|
#define SHOW_AS_STRM 0x00000020
|
|
|
|
#define SHOW_AS_TASK 0x00000040
|
|
|
|
#define SHOW_AS_TXN 0x00000080
|
2022-05-27 14:29:30 +00:00
|
|
|
#define SHOW_AS_SD 0x00000100
|
2020-02-06 07:33:08 +00:00
|
|
|
|
|
|
|
// 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.
|
2022-05-27 14:29:30 +00:00
|
|
|
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", };
|
2020-02-06 07:33:08 +00:00
|
|
|
|
2015-12-20 22:21:57 +00:00
|
|
|
#define SHOW_FLAG(f,n) \
|
|
|
|
do { \
|
|
|
|
if (!((f) & (n))) break; \
|
|
|
|
(f) &= ~(n); \
|
|
|
|
printf(#n"%s", (f) ? " | " : ""); \
|
|
|
|
} while (0)
|
|
|
|
|
2020-02-06 07:33:08 +00:00
|
|
|
unsigned int get_show_as(const char *word)
|
|
|
|
{
|
|
|
|
int w = 0;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
if (w == sizeof(show_as_words) / sizeof(*show_as_words))
|
|
|
|
return 0;
|
|
|
|
if (strcmp(word, show_as_words[w]) == 0)
|
|
|
|
return 1U << w;
|
|
|
|
w++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-20 22:21:57 +00:00
|
|
|
void show_chn_ana(unsigned int f)
|
|
|
|
{
|
|
|
|
printf("chn->ana = ");
|
|
|
|
|
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_FLT_START_FE);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_INSPECT_FE);
|
|
|
|
SHOW_FLAG(f, AN_REQ_WAIT_HTTP);
|
|
|
|
SHOW_FLAG(f, AN_REQ_HTTP_BODY);
|
|
|
|
SHOW_FLAG(f, AN_REQ_HTTP_PROCESS_FE);
|
|
|
|
SHOW_FLAG(f, AN_REQ_SWITCHING_RULES);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_FLT_START_BE);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_INSPECT_BE);
|
|
|
|
SHOW_FLAG(f, AN_REQ_HTTP_PROCESS_BE);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_HTTP_TARPIT);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_SRV_RULES);
|
|
|
|
SHOW_FLAG(f, AN_REQ_HTTP_INNER);
|
|
|
|
SHOW_FLAG(f, AN_REQ_PRST_RDP_COOKIE);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_STICKING_RULES);
|
|
|
|
SHOW_FLAG(f, AN_REQ_FLT_HTTP_HDRS);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_HTTP_XFER_BODY);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_WAIT_CLI);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_REQ_FLT_XFER_DATA);
|
|
|
|
SHOW_FLAG(f, AN_REQ_FLT_END);
|
|
|
|
|
2018-01-15 17:59:16 +00:00
|
|
|
SHOW_FLAG(f, AN_RES_FLT_START_FE);
|
|
|
|
SHOW_FLAG(f, AN_RES_FLT_START_BE);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, AN_RES_INSPECT);
|
|
|
|
SHOW_FLAG(f, AN_RES_WAIT_HTTP);
|
|
|
|
SHOW_FLAG(f, AN_RES_STORE_RULES);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_RES_HTTP_PROCESS_FE);
|
|
|
|
SHOW_FLAG(f, AN_RES_HTTP_PROCESS_BE);
|
|
|
|
SHOW_FLAG(f, AN_RES_FLT_HTTP_HDRS);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, AN_RES_HTTP_XFER_BODY);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, AN_RES_WAIT_CLI);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, AN_RES_FLT_XFER_DATA);
|
|
|
|
SHOW_FLAG(f, AN_RES_FLT_END);
|
2015-12-20 22:21:57 +00:00
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_chn_flags(unsigned int f)
|
|
|
|
{
|
|
|
|
printf("chn->flags = ");
|
|
|
|
|
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SHOW_FLAG(f, CF_ISRESP);
|
2019-03-25 17:34:28 +00:00
|
|
|
SHOW_FLAG(f, CF_EOI);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, CF_FLT_ANALYZE);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, CF_WAKE_ONCE);
|
|
|
|
SHOW_FLAG(f, CF_NEVER_WAIT);
|
|
|
|
SHOW_FLAG(f, CF_SEND_DONTWAIT);
|
|
|
|
SHOW_FLAG(f, CF_EXPECT_MORE);
|
|
|
|
SHOW_FLAG(f, CF_DONT_READ);
|
|
|
|
SHOW_FLAG(f, CF_AUTO_CONNECT);
|
|
|
|
SHOW_FLAG(f, CF_READ_DONTWAIT);
|
|
|
|
SHOW_FLAG(f, CF_KERN_SPLICING);
|
|
|
|
SHOW_FLAG(f, CF_READ_ATTACHED);
|
|
|
|
SHOW_FLAG(f, CF_ANA_TIMEOUT);
|
|
|
|
SHOW_FLAG(f, CF_WROTE_DATA);
|
|
|
|
SHOW_FLAG(f, CF_STREAMER_FAST);
|
|
|
|
SHOW_FLAG(f, CF_STREAMER);
|
|
|
|
SHOW_FLAG(f, CF_AUTO_CLOSE);
|
|
|
|
SHOW_FLAG(f, CF_SHUTW_NOW);
|
|
|
|
SHOW_FLAG(f, CF_SHUTW);
|
|
|
|
SHOW_FLAG(f, CF_WAKE_WRITE);
|
|
|
|
SHOW_FLAG(f, CF_WRITE_ERROR);
|
|
|
|
SHOW_FLAG(f, CF_WRITE_TIMEOUT);
|
|
|
|
SHOW_FLAG(f, CF_WRITE_PARTIAL);
|
|
|
|
SHOW_FLAG(f, CF_WRITE_NULL);
|
|
|
|
SHOW_FLAG(f, CF_READ_NOEXP);
|
|
|
|
SHOW_FLAG(f, CF_SHUTR_NOW);
|
|
|
|
SHOW_FLAG(f, CF_SHUTR);
|
|
|
|
SHOW_FLAG(f, CF_READ_ERROR);
|
|
|
|
SHOW_FLAG(f, CF_READ_TIMEOUT);
|
|
|
|
SHOW_FLAG(f, CF_READ_PARTIAL);
|
|
|
|
SHOW_FLAG(f, CF_READ_NULL);
|
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_conn_flags(unsigned int f)
|
|
|
|
{
|
|
|
|
printf("conn->flags = ");
|
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SHOW_FLAG(f, CO_FL_XPRT_TRACKED);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_SESS_IDLE);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_RCVD_PROXY);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_PRIVATE);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_SSL_WAIT_HS);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_ACCEPT_CIP);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_ACCEPT_PROXY);
|
|
|
|
SHOW_FLAG(f, CO_FL_SEND_PROXY);
|
|
|
|
SHOW_FLAG(f, CO_FL_WAIT_L6_CONN);
|
|
|
|
SHOW_FLAG(f, CO_FL_WAIT_L4_CONN);
|
2022-09-09 12:46:15 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_FDLESS);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_ERROR);
|
|
|
|
SHOW_FLAG(f, CO_FL_SOCK_WR_SH);
|
|
|
|
SHOW_FLAG(f, CO_FL_SOCK_RD_SH);
|
2019-06-03 12:26:54 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_SOCKS4_RECV);
|
|
|
|
SHOW_FLAG(f, CO_FL_SOCKS4_SEND);
|
2017-11-10 13:10:35 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_EARLY_DATA);
|
|
|
|
SHOW_FLAG(f, CO_FL_EARLY_SSL_HS);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_WAIT_ROOM);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_WANT_DRAIN);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_XPRT_READY);
|
|
|
|
SHOW_FLAG(f, CO_FL_CTRL_READY);
|
2020-06-19 06:47:30 +00:00
|
|
|
SHOW_FLAG(f, CO_FL_IDLE_LIST);
|
|
|
|
SHOW_FLAG(f, CO_FL_SAFE_LIST);
|
2015-12-20 22:21:57 +00:00
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
2022-03-22 15:06:25 +00:00
|
|
|
|
2022-05-27 14:29:30 +00:00
|
|
|
void show_sd_flags(unsigned int f)
|
2022-03-22 15:06:25 +00:00
|
|
|
{
|
2022-05-27 14:29:30 +00:00
|
|
|
printf("sd->flags = ");
|
2022-03-22 15:06:25 +00:00
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
2022-04-04 05:51:21 +00:00
|
|
|
|
2022-05-24 14:49:03 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_APPLET_NEED_CONN);
|
2022-05-25 14:01:38 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_HAVE_NO_DATA);
|
2022-05-27 14:43:52 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_WONT_CONSUME);
|
2022-05-17 15:04:55 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_WAIT_DATA);
|
|
|
|
SHOW_FLAG(f, SE_FL_KILL_CONN);
|
|
|
|
SHOW_FLAG(f, SE_FL_WAIT_FOR_HS);
|
|
|
|
SHOW_FLAG(f, SE_FL_WANT_ROOM);
|
2022-05-27 14:35:20 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_RCV_MORE);
|
|
|
|
SHOW_FLAG(f, SE_FL_MAY_SPLICE);
|
2022-05-17 15:04:55 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_ERR_PENDING);
|
2022-05-27 14:35:20 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_ERROR);
|
2022-05-17 15:04:55 +00:00
|
|
|
SHOW_FLAG(f, SE_FL_EOS);
|
|
|
|
SHOW_FLAG(f, SE_FL_EOI);
|
|
|
|
SHOW_FLAG(f, SE_FL_WEBSOCKET);
|
|
|
|
SHOW_FLAG(f, SE_FL_NOT_FIRST);
|
|
|
|
SHOW_FLAG(f, SE_FL_SHWS);
|
|
|
|
SHOW_FLAG(f, SE_FL_SHWN);
|
|
|
|
SHOW_FLAG(f, SE_FL_SHRR);
|
|
|
|
SHOW_FLAG(f, SE_FL_SHRD);
|
|
|
|
SHOW_FLAG(f, SE_FL_ORPHAN);
|
|
|
|
SHOW_FLAG(f, SE_FL_DETACHED);
|
|
|
|
SHOW_FLAG(f, SE_FL_T_APPLET);
|
|
|
|
SHOW_FLAG(f, SE_FL_T_MUX);
|
2022-03-22 15:06:25 +00:00
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
2022-05-27 07:57:31 +00:00
|
|
|
void show_sc_flags(unsigned int f)
|
2018-03-01 07:55:21 +00:00
|
|
|
{
|
2022-05-27 07:57:31 +00:00
|
|
|
printf("sc->flags = ");
|
2018-03-01 07:55:21 +00:00
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
2022-05-25 14:36:21 +00:00
|
|
|
SHOW_FLAG(f, SC_FL_NEED_ROOM);
|
|
|
|
SHOW_FLAG(f, SC_FL_NEED_BUFF);
|
|
|
|
SHOW_FLAG(f, SC_FL_WONT_READ);
|
2022-05-17 17:44:42 +00:00
|
|
|
SHOW_FLAG(f, SC_FL_INDEP_STR);
|
|
|
|
SHOW_FLAG(f, SC_FL_DONT_WAKE);
|
|
|
|
SHOW_FLAG(f, SC_FL_NOHALF);
|
2022-05-27 14:35:20 +00:00
|
|
|
SHOW_FLAG(f, SC_FL_NOLINGER);
|
2022-05-17 17:44:42 +00:00
|
|
|
SHOW_FLAG(f, SC_FL_ISBACK);
|
2018-03-01 07:55:21 +00:00
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
2015-12-20 22:21:57 +00:00
|
|
|
|
2022-03-30 17:39:30 +00:00
|
|
|
void show_strm_et(unsigned int f)
|
2015-12-20 22:21:57 +00:00
|
|
|
{
|
2022-03-30 17:39:30 +00:00
|
|
|
printf("strm->et = ");
|
2015-12-20 22:21:57 +00:00
|
|
|
if (!f) {
|
2022-03-30 17:39:30 +00:00
|
|
|
printf("STRM_ET_NONE\n");
|
2015-12-20 22:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-30 17:39:30 +00:00
|
|
|
SHOW_FLAG(f, STRM_ET_QUEUE_TO);
|
|
|
|
SHOW_FLAG(f, STRM_ET_QUEUE_ERR);
|
|
|
|
SHOW_FLAG(f, STRM_ET_QUEUE_ABRT);
|
|
|
|
SHOW_FLAG(f, STRM_ET_CONN_TO);
|
|
|
|
SHOW_FLAG(f, STRM_ET_CONN_ERR);
|
|
|
|
SHOW_FLAG(f, STRM_ET_CONN_ABRT);
|
|
|
|
SHOW_FLAG(f, STRM_ET_CONN_RES);
|
|
|
|
SHOW_FLAG(f, STRM_ET_CONN_OTHER);
|
|
|
|
SHOW_FLAG(f, STRM_ET_DATA_TO);
|
|
|
|
SHOW_FLAG(f, STRM_ET_DATA_ERR);
|
|
|
|
SHOW_FLAG(f, STRM_ET_DATA_ABRT);
|
2015-12-20 22:21:57 +00:00
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_task_state(unsigned int f)
|
|
|
|
{
|
|
|
|
printf("task->state = ");
|
|
|
|
|
|
|
|
if (!f) {
|
|
|
|
printf("TASK_SLEEPING\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, TASK_F_USR1);
|
|
|
|
SHOW_FLAG(f, TASK_F_TASKLET);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, TASK_WOKEN_OTHER);
|
|
|
|
SHOW_FLAG(f, TASK_WOKEN_RES);
|
|
|
|
SHOW_FLAG(f, TASK_WOKEN_MSG);
|
|
|
|
SHOW_FLAG(f, TASK_WOKEN_SIGNAL);
|
|
|
|
SHOW_FLAG(f, TASK_WOKEN_IO);
|
|
|
|
SHOW_FLAG(f, TASK_WOKEN_TIMER);
|
|
|
|
SHOW_FLAG(f, TASK_WOKEN_INIT);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, TASK_HEAVY);
|
|
|
|
SHOW_FLAG(f, TASK_IN_LIST);
|
|
|
|
SHOW_FLAG(f, TASK_KILLED);
|
|
|
|
SHOW_FLAG(f, TASK_SELF_WAKING);
|
|
|
|
SHOW_FLAG(f, TASK_QUEUED);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, TASK_RUNNING);
|
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_txn_flags(unsigned int f)
|
|
|
|
{
|
|
|
|
printf("txn->flags = ");
|
|
|
|
|
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-29 13:23:40 +00:00
|
|
|
SHOW_FLAG(f, TX_L7_RETRY);
|
|
|
|
SHOW_FLAG(f, TX_D_L7_RETRY);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, TX_NOT_FIRST);
|
|
|
|
SHOW_FLAG(f, TX_USE_PX_CONN);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, TX_CACHE_HAS_SEC_KEY);
|
2019-07-16 12:32:23 +00:00
|
|
|
SHOW_FLAG(f, TX_CON_WANT_TUN);
|
2015-12-20 22:21:57 +00:00
|
|
|
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, TX_CACHE_IGNORE);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, TX_CACHE_COOK);
|
|
|
|
SHOW_FLAG(f, TX_CACHEABLE);
|
|
|
|
SHOW_FLAG(f, TX_SCK_PRESENT);
|
|
|
|
|
|
|
|
//printf("%s", f ? "" : " | ");
|
|
|
|
switch (f & TX_SCK_MASK) {
|
|
|
|
case TX_SCK_NONE: f &= ~TX_SCK_MASK ; /*printf("TX_SCK_NONE%s", f ? " | " : "");*/ break;
|
|
|
|
case TX_SCK_FOUND: f &= ~TX_SCK_MASK ; printf("TX_SCK_FOUND%s", f ? " | " : ""); break;
|
|
|
|
case TX_SCK_DELETED: f &= ~TX_SCK_MASK ; printf("TX_SCK_DELETED%s", f ? " | " : ""); break;
|
|
|
|
case TX_SCK_INSERTED: f &= ~TX_SCK_MASK ; printf("TX_SCK_INSERTED%s", f ? " | " : ""); break;
|
|
|
|
case TX_SCK_REPLACED: f &= ~TX_SCK_MASK ; printf("TX_SCK_REPLACED%s", f ? " | " : ""); break;
|
|
|
|
case TX_SCK_UPDATED: f &= ~TX_SCK_MASK ; printf("TX_SCK_UPDATED%s", f ? " | " : ""); break;
|
|
|
|
default: printf("TX_SCK_MASK(%02x)", f); f &= ~TX_SCK_MASK ; printf("%s", f ? " | " : ""); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//printf("%s", f ? "" : " | ");
|
|
|
|
switch (f & TX_CK_MASK) {
|
|
|
|
case TX_CK_NONE: f &= ~TX_CK_MASK ; /*printf("TX_CK_NONE%s", f ? " | " : "");*/ break;
|
|
|
|
case TX_CK_INVALID: f &= ~TX_CK_MASK ; printf("TX_CK_INVALID%s", f ? " | " : ""); break;
|
|
|
|
case TX_CK_DOWN: f &= ~TX_CK_MASK ; printf("TX_CK_DOWN%s", f ? " | " : ""); break;
|
|
|
|
case TX_CK_VALID: f &= ~TX_CK_MASK ; printf("TX_CK_VALID%s", f ? " | " : ""); break;
|
|
|
|
case TX_CK_EXPIRED: f &= ~TX_CK_MASK ; printf("TX_CK_EXPIRED%s", f ? " | " : ""); break;
|
|
|
|
case TX_CK_OLD: f &= ~TX_CK_MASK ; printf("TX_CK_OLD%s", f ? " | " : ""); break;
|
|
|
|
case TX_CK_UNUSED: f &= ~TX_CK_MASK ; printf("TX_CK_UNUSED%s", f ? " | " : ""); break;
|
|
|
|
default: printf("TX_CK_MASK(%02x)", f); f &= ~TX_CK_MASK ; printf("%s", f ? " | " : ""); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SHOW_FLAG(f, TX_CLTARPIT);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, TX_CONST_REPLY);
|
2015-12-20 22:21:57 +00:00
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_strm_flags(unsigned int f)
|
|
|
|
{
|
|
|
|
printf("strm->flags = ");
|
|
|
|
|
|
|
|
if (!f) {
|
|
|
|
printf("0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-30 14:26:39 +00:00
|
|
|
SHOW_FLAG(f, SF_SRC_ADDR);
|
2022-01-18 09:46:10 +00:00
|
|
|
SHOW_FLAG(f, SF_WEBSOCKET);
|
|
|
|
SHOW_FLAG(f, SF_SRV_REUSED_ANTICIPATED);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, SF_SRV_REUSED);
|
|
|
|
SHOW_FLAG(f, SF_IGNORE_PRST);
|
|
|
|
|
|
|
|
//printf("%s", f ? "" : " | ");
|
|
|
|
switch (f & SF_FINST_MASK) {
|
|
|
|
case SF_FINST_R: f &= ~SF_FINST_MASK ; printf("SF_FINST_R%s", f ? " | " : ""); break;
|
|
|
|
case SF_FINST_C: f &= ~SF_FINST_MASK ; printf("SF_FINST_C%s", f ? " | " : ""); break;
|
|
|
|
case SF_FINST_H: f &= ~SF_FINST_MASK ; printf("SF_FINST_H%s", f ? " | " : ""); break;
|
|
|
|
case SF_FINST_D: f &= ~SF_FINST_MASK ; printf("SF_FINST_D%s", f ? " | " : ""); break;
|
|
|
|
case SF_FINST_L: f &= ~SF_FINST_MASK ; printf("SF_FINST_L%s", f ? " | " : ""); break;
|
|
|
|
case SF_FINST_Q: f &= ~SF_FINST_MASK ; printf("SF_FINST_Q%s", f ? " | " : ""); break;
|
|
|
|
case SF_FINST_T: f &= ~SF_FINST_MASK ; printf("SF_FINST_T%s", f ? " | " : ""); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (f & SF_ERR_MASK) {
|
|
|
|
case SF_ERR_LOCAL: f &= ~SF_ERR_MASK ; printf("SF_ERR_LOCAL%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_CLITO: f &= ~SF_ERR_MASK ; printf("SF_ERR_CLITO%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_CLICL: f &= ~SF_ERR_MASK ; printf("SF_ERR_CLICL%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_SRVTO: f &= ~SF_ERR_MASK ; printf("SF_ERR_SRVTO%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_SRVCL: f &= ~SF_ERR_MASK ; printf("SF_ERR_SRVCL%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_PRXCOND: f &= ~SF_ERR_MASK ; printf("SF_ERR_PRXCOND%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_RESOURCE: f &= ~SF_ERR_MASK ; printf("SF_ERR_RESOURCE%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_INTERNAL: f &= ~SF_ERR_MASK ; printf("SF_ERR_INTERNAL%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_DOWN: f &= ~SF_ERR_MASK ; printf("SF_ERR_DOWN%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_KILLED: f &= ~SF_ERR_MASK ; printf("SF_ERR_KILLED%s", f ? " | " : ""); break;
|
|
|
|
case SF_ERR_UP: f &= ~SF_ERR_MASK ; printf("SF_ERR_UP%s", f ? " | " : ""); break;
|
2016-11-11 07:05:34 +00:00
|
|
|
case SF_ERR_CHK_PORT: f &= ~SF_ERR_MASK ; printf("SF_ERR_CHK_PORT%s", f ? " | " : ""); break;
|
2015-12-20 22:21:57 +00:00
|
|
|
}
|
|
|
|
|
2020-02-06 06:57:36 +00:00
|
|
|
SHOW_FLAG(f, SF_HTX);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, SF_REDIRECTABLE);
|
2020-02-06 06:57:36 +00:00
|
|
|
SHOW_FLAG(f, SF_IGNORE);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, SF_REDISP);
|
2022-03-29 17:02:31 +00:00
|
|
|
SHOW_FLAG(f, SF_CONN_EXP);
|
2015-12-20 22:21:57 +00:00
|
|
|
SHOW_FLAG(f, SF_CURR_SESS);
|
|
|
|
SHOW_FLAG(f, SF_MONITOR);
|
|
|
|
SHOW_FLAG(f, SF_FORCE_PRST);
|
|
|
|
SHOW_FLAG(f, SF_BE_ASSIGNED);
|
|
|
|
SHOW_FLAG(f, SF_ASSIGNED);
|
|
|
|
SHOW_FLAG(f, SF_DIRECT);
|
|
|
|
|
|
|
|
if (f) {
|
|
|
|
printf("EXTRA(0x%08x)", f);
|
|
|
|
}
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
|
2020-02-06 07:33:08 +00:00
|
|
|
void usage_exit(const char *name)
|
|
|
|
{
|
2022-09-09 12:16:49 +00:00
|
|
|
int word, nbword;
|
|
|
|
|
|
|
|
fprintf(stderr, "Usage: %s [", name);
|
|
|
|
|
|
|
|
nbword = sizeof(show_as_words) / sizeof(*show_as_words);
|
|
|
|
for (word = 0; word < nbword; word++)
|
|
|
|
fprintf(stderr, "%s%s", word ? "|" : "", show_as_words[word]);
|
|
|
|
fprintf(stderr, "]* { [+-][0x]value* | - }\n");
|
2020-02-06 07:33:08 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2015-12-20 22:21:57 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
unsigned int flags;
|
2020-02-06 07:33:08 +00:00
|
|
|
unsigned int show_as = 0;
|
|
|
|
unsigned int f;
|
|
|
|
const char *name = argv[0];
|
2020-02-06 17:17:50 +00:00
|
|
|
char line[20];
|
|
|
|
char *value;
|
2020-02-06 07:48:16 +00:00
|
|
|
int multi = 0;
|
2020-02-06 17:17:50 +00:00
|
|
|
int use_stdin = 0;
|
2020-02-06 07:33:08 +00:00
|
|
|
char *err;
|
|
|
|
|
|
|
|
while (argc > 0) {
|
|
|
|
argv++; argc--;
|
|
|
|
if (argc < 1)
|
|
|
|
usage_exit(name);
|
|
|
|
|
|
|
|
f = get_show_as(argv[0]);
|
2020-02-06 07:48:16 +00:00
|
|
|
if (!f)
|
|
|
|
break;
|
2020-02-06 07:33:08 +00:00
|
|
|
show_as |= f;
|
2015-12-20 22:21:57 +00:00
|
|
|
}
|
|
|
|
|
2020-02-06 07:33:08 +00:00
|
|
|
if (!show_as)
|
|
|
|
show_as = ~0U;
|
|
|
|
|
2020-02-06 07:48:16 +00:00
|
|
|
if (argc > 1)
|
|
|
|
multi = 1;
|
2015-12-20 22:21:57 +00:00
|
|
|
|
2020-02-06 17:17:50 +00:00
|
|
|
if (strcmp(argv[0], "-") == 0)
|
|
|
|
use_stdin = 1;
|
|
|
|
|
2020-02-06 07:48:16 +00:00
|
|
|
while (argc > 0) {
|
2020-02-06 17:17:50 +00:00
|
|
|
if (use_stdin) {
|
|
|
|
value = fgets(line, sizeof(line), stdin);
|
|
|
|
if (!value)
|
|
|
|
break;
|
|
|
|
|
2020-04-02 10:25:26 +00:00
|
|
|
/* skip common leading delimiters that slip from copy-paste */
|
2020-02-06 17:17:50 +00:00
|
|
|
while (*value == ' ' || *value == '\t' || *value == ':' || *value == '=')
|
|
|
|
value++;
|
|
|
|
|
|
|
|
/* stop at the end of the number and trim any C suffix like "UL" */
|
|
|
|
err = value;
|
|
|
|
while (*err == '-' || *err == '+' ||
|
2021-04-02 15:47:21 +00:00
|
|
|
(isalnum((unsigned char)*err) && toupper((unsigned char)*err) != 'U' && toupper((unsigned char)*err) != 'L'))
|
2020-02-06 17:17:50 +00:00
|
|
|
err++;
|
2021-04-03 13:26:56 +00:00
|
|
|
*err = 0;
|
2020-02-06 17:17:50 +00:00
|
|
|
} else {
|
|
|
|
value = argv[0];
|
|
|
|
argv++; argc--;
|
|
|
|
}
|
|
|
|
|
|
|
|
flags = strtoul(value, &err, 0);
|
|
|
|
if (!*value || *err) {
|
|
|
|
fprintf(stderr, "Unparsable value: <%s>\n", value);
|
2020-02-06 07:48:16 +00:00
|
|
|
usage_exit(name);
|
|
|
|
}
|
|
|
|
|
2020-02-06 17:17:50 +00:00
|
|
|
if (multi || use_stdin)
|
2020-02-06 07:48:16 +00:00
|
|
|
printf("### 0x%08x:\n", flags);
|
|
|
|
|
|
|
|
if (show_as & SHOW_AS_ANA) show_chn_ana(flags);
|
|
|
|
if (show_as & SHOW_AS_CHN) show_chn_flags(flags);
|
|
|
|
if (show_as & SHOW_AS_CONN) show_conn_flags(flags);
|
2022-05-27 07:57:31 +00:00
|
|
|
if (show_as & SHOW_AS_SC) show_sc_flags(flags);
|
2022-05-27 14:29:30 +00:00
|
|
|
if (show_as & SHOW_AS_SD) show_sd_flags(flags);
|
2022-03-30 17:39:30 +00:00
|
|
|
if (show_as & SHOW_AS_SET) show_strm_et(flags);
|
2020-02-06 07:48:16 +00:00
|
|
|
if (show_as & SHOW_AS_STRM) show_strm_flags(flags);
|
|
|
|
if (show_as & SHOW_AS_TASK) show_task_state(flags);
|
|
|
|
if (show_as & SHOW_AS_TXN) show_txn_flags(flags);
|
|
|
|
}
|
2015-12-20 22:21:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|