Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | |
| 4 | #include <types/channel.h> |
| 5 | #include <types/connection.h> |
| 6 | #include <types/proto_http.h> |
| 7 | #include <types/stream.h> |
| 8 | #include <types/stream_interface.h> |
| 9 | #include <types/task.h> |
| 10 | |
| 11 | #define SHOW_FLAG(f,n) \ |
| 12 | do { \ |
| 13 | if (!((f) & (n))) break; \ |
| 14 | (f) &= ~(n); \ |
| 15 | printf(#n"%s", (f) ? " | " : ""); \ |
| 16 | } while (0) |
| 17 | |
| 18 | void show_chn_ana(unsigned int f) |
| 19 | { |
| 20 | printf("chn->ana = "); |
| 21 | |
| 22 | if (!f) { |
| 23 | printf("0\n"); |
| 24 | return; |
| 25 | } |
| 26 | |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 27 | SHOW_FLAG(f, AN_REQ_FLT_START_FE); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 28 | SHOW_FLAG(f, AN_REQ_INSPECT_FE); |
| 29 | SHOW_FLAG(f, AN_REQ_WAIT_HTTP); |
| 30 | SHOW_FLAG(f, AN_REQ_HTTP_BODY); |
| 31 | SHOW_FLAG(f, AN_REQ_HTTP_PROCESS_FE); |
| 32 | SHOW_FLAG(f, AN_REQ_SWITCHING_RULES); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 33 | SHOW_FLAG(f, AN_REQ_FLT_START_BE); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 34 | SHOW_FLAG(f, AN_REQ_INSPECT_BE); |
| 35 | SHOW_FLAG(f, AN_REQ_HTTP_PROCESS_BE); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 36 | SHOW_FLAG(f, AN_REQ_HTTP_TARPIT); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 37 | SHOW_FLAG(f, AN_REQ_SRV_RULES); |
| 38 | SHOW_FLAG(f, AN_REQ_HTTP_INNER); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 39 | SHOW_FLAG(f, AN_REQ_PRST_RDP_COOKIE); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 40 | SHOW_FLAG(f, AN_REQ_STICKING_RULES); |
| 41 | SHOW_FLAG(f, AN_REQ_FLT_HTTP_HDRS); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 42 | SHOW_FLAG(f, AN_REQ_HTTP_XFER_BODY); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 43 | SHOW_FLAG(f, AN_REQ_FLT_XFER_DATA); |
| 44 | SHOW_FLAG(f, AN_REQ_FLT_END); |
| 45 | |
Willy Tarreau | 260bf5c | 2018-01-15 18:59:16 +0100 | [diff] [blame] | 46 | SHOW_FLAG(f, AN_RES_FLT_START_FE); |
| 47 | SHOW_FLAG(f, AN_RES_FLT_START_BE); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 48 | SHOW_FLAG(f, AN_RES_INSPECT); |
| 49 | SHOW_FLAG(f, AN_RES_WAIT_HTTP); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 50 | SHOW_FLAG(f, AN_RES_STORE_RULES); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 51 | SHOW_FLAG(f, AN_RES_HTTP_PROCESS_FE); |
| 52 | SHOW_FLAG(f, AN_RES_HTTP_PROCESS_BE); |
| 53 | SHOW_FLAG(f, AN_RES_FLT_HTTP_HDRS); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 54 | SHOW_FLAG(f, AN_RES_HTTP_XFER_BODY); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 55 | SHOW_FLAG(f, AN_RES_FLT_XFER_DATA); |
| 56 | SHOW_FLAG(f, AN_RES_FLT_END); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 57 | |
| 58 | if (f) { |
| 59 | printf("EXTRA(0x%08x)", f); |
| 60 | } |
| 61 | putchar('\n'); |
| 62 | } |
| 63 | |
| 64 | void show_chn_flags(unsigned int f) |
| 65 | { |
| 66 | printf("chn->flags = "); |
| 67 | |
| 68 | if (!f) { |
| 69 | printf("0\n"); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | SHOW_FLAG(f, CF_ISRESP); |
Willy Tarreau | f882a85 | 2019-03-25 18:34:28 +0100 | [diff] [blame] | 74 | SHOW_FLAG(f, CF_EOI); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 75 | SHOW_FLAG(f, CF_FLT_ANALYZE); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 76 | SHOW_FLAG(f, CF_WAKE_ONCE); |
| 77 | SHOW_FLAG(f, CF_NEVER_WAIT); |
| 78 | SHOW_FLAG(f, CF_SEND_DONTWAIT); |
| 79 | SHOW_FLAG(f, CF_EXPECT_MORE); |
| 80 | SHOW_FLAG(f, CF_DONT_READ); |
| 81 | SHOW_FLAG(f, CF_AUTO_CONNECT); |
| 82 | SHOW_FLAG(f, CF_READ_DONTWAIT); |
| 83 | SHOW_FLAG(f, CF_KERN_SPLICING); |
| 84 | SHOW_FLAG(f, CF_READ_ATTACHED); |
| 85 | SHOW_FLAG(f, CF_ANA_TIMEOUT); |
| 86 | SHOW_FLAG(f, CF_WROTE_DATA); |
| 87 | SHOW_FLAG(f, CF_STREAMER_FAST); |
| 88 | SHOW_FLAG(f, CF_STREAMER); |
| 89 | SHOW_FLAG(f, CF_AUTO_CLOSE); |
| 90 | SHOW_FLAG(f, CF_SHUTW_NOW); |
| 91 | SHOW_FLAG(f, CF_SHUTW); |
| 92 | SHOW_FLAG(f, CF_WAKE_WRITE); |
| 93 | SHOW_FLAG(f, CF_WRITE_ERROR); |
| 94 | SHOW_FLAG(f, CF_WRITE_TIMEOUT); |
| 95 | SHOW_FLAG(f, CF_WRITE_PARTIAL); |
| 96 | SHOW_FLAG(f, CF_WRITE_NULL); |
| 97 | SHOW_FLAG(f, CF_READ_NOEXP); |
| 98 | SHOW_FLAG(f, CF_SHUTR_NOW); |
| 99 | SHOW_FLAG(f, CF_SHUTR); |
| 100 | SHOW_FLAG(f, CF_WAKE_CONNECT); |
| 101 | SHOW_FLAG(f, CF_READ_ERROR); |
| 102 | SHOW_FLAG(f, CF_READ_TIMEOUT); |
| 103 | SHOW_FLAG(f, CF_READ_PARTIAL); |
| 104 | SHOW_FLAG(f, CF_READ_NULL); |
| 105 | |
| 106 | if (f) { |
| 107 | printf("EXTRA(0x%08x)", f); |
| 108 | } |
| 109 | putchar('\n'); |
| 110 | } |
| 111 | |
| 112 | void show_conn_flags(unsigned int f) |
| 113 | { |
| 114 | printf("conn->flags = "); |
| 115 | if (!f) { |
| 116 | printf("0\n"); |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | SHOW_FLAG(f, CO_FL_XPRT_TRACKED); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 121 | SHOW_FLAG(f, CO_FL_RCVD_PROXY); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 122 | SHOW_FLAG(f, CO_FL_PRIVATE); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 123 | SHOW_FLAG(f, CO_FL_ACCEPT_CIP); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 124 | SHOW_FLAG(f, CO_FL_ACCEPT_PROXY); |
| 125 | SHOW_FLAG(f, CO_FL_SSL_WAIT_HS); |
| 126 | SHOW_FLAG(f, CO_FL_SEND_PROXY); |
| 127 | SHOW_FLAG(f, CO_FL_WAIT_L6_CONN); |
| 128 | SHOW_FLAG(f, CO_FL_WAIT_L4_CONN); |
| 129 | SHOW_FLAG(f, CO_FL_CONNECTED); |
| 130 | SHOW_FLAG(f, CO_FL_ERROR); |
| 131 | SHOW_FLAG(f, CO_FL_SOCK_WR_SH); |
| 132 | SHOW_FLAG(f, CO_FL_SOCK_RD_SH); |
Willy Tarreau | db20750 | 2019-06-03 14:26:54 +0200 | [diff] [blame] | 133 | SHOW_FLAG(f, CO_FL_SOCKS4_RECV); |
| 134 | SHOW_FLAG(f, CO_FL_SOCKS4_SEND); |
Christopher Faulet | f4cfcf9 | 2017-11-10 14:10:35 +0100 | [diff] [blame] | 135 | SHOW_FLAG(f, CO_FL_EARLY_DATA); |
| 136 | SHOW_FLAG(f, CO_FL_EARLY_SSL_HS); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 137 | SHOW_FLAG(f, CO_FL_ADDR_TO_SET); |
| 138 | SHOW_FLAG(f, CO_FL_ADDR_FROM_SET); |
| 139 | SHOW_FLAG(f, CO_FL_WAIT_ROOM); |
Christopher Faulet | aff9328 | 2018-02-27 15:41:10 +0100 | [diff] [blame] | 140 | SHOW_FLAG(f, CO_FL_WILL_UPDATE); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 141 | SHOW_FLAG(f, CO_FL_XPRT_READY); |
| 142 | SHOW_FLAG(f, CO_FL_CTRL_READY); |
| 143 | SHOW_FLAG(f, CO_FL_CURR_WR_ENA); |
Olivier Houchard | 1a0545f | 2017-09-13 18:30:23 +0200 | [diff] [blame] | 144 | SHOW_FLAG(f, CO_FL_XPRT_WR_ENA); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 145 | SHOW_FLAG(f, CO_FL_SOCK_WR_ENA); |
| 146 | SHOW_FLAG(f, CO_FL_CURR_RD_ENA); |
Olivier Houchard | 1a0545f | 2017-09-13 18:30:23 +0200 | [diff] [blame] | 147 | SHOW_FLAG(f, CO_FL_XPRT_RD_ENA); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 148 | SHOW_FLAG(f, CO_FL_SOCK_RD_ENA); |
| 149 | |
| 150 | if (f) { |
| 151 | printf("EXTRA(0x%08x)", f); |
| 152 | } |
| 153 | putchar('\n'); |
| 154 | } |
Christopher Faulet | 5f8ef13 | 2018-03-01 08:55:21 +0100 | [diff] [blame] | 155 | void show_cs_flags(unsigned int f) |
| 156 | { |
| 157 | printf("cs->flags = "); |
| 158 | if (!f) { |
| 159 | printf("0\n"); |
| 160 | return; |
| 161 | } |
Willy Tarreau | db20750 | 2019-06-03 14:26:54 +0200 | [diff] [blame] | 162 | SHOW_FLAG(f, CS_FL_READ_PARTIAL); |
Willy Tarreau | d501646 | 2018-11-16 10:37:20 +0100 | [diff] [blame] | 163 | SHOW_FLAG(f, CS_FL_NOT_FIRST); |
Willy Tarreau | db20750 | 2019-06-03 14:26:54 +0200 | [diff] [blame] | 164 | SHOW_FLAG(f, CS_FL_KILL_CONN); |
Christopher Faulet | 5f8ef13 | 2018-03-01 08:55:21 +0100 | [diff] [blame] | 165 | SHOW_FLAG(f, CS_FL_WAIT_FOR_HS); |
Willy Tarreau | f882a85 | 2019-03-25 18:34:28 +0100 | [diff] [blame] | 166 | SHOW_FLAG(f, CS_FL_EOI); |
Christopher Faulet | 5f8ef13 | 2018-03-01 08:55:21 +0100 | [diff] [blame] | 167 | SHOW_FLAG(f, CS_FL_EOS); |
Willy Tarreau | 121c4e0 | 2018-12-17 21:58:03 +0100 | [diff] [blame] | 168 | SHOW_FLAG(f, CS_FL_ERR_PENDING); |
| 169 | SHOW_FLAG(f, CS_FL_WANT_ROOM); |
Christopher Faulet | 5f8ef13 | 2018-03-01 08:55:21 +0100 | [diff] [blame] | 170 | SHOW_FLAG(f, CS_FL_RCV_MORE); |
| 171 | SHOW_FLAG(f, CS_FL_ERROR); |
| 172 | SHOW_FLAG(f, CS_FL_SHWS); |
| 173 | SHOW_FLAG(f, CS_FL_SHWN); |
| 174 | SHOW_FLAG(f, CS_FL_SHRR); |
| 175 | SHOW_FLAG(f, CS_FL_SHRD); |
Christopher Faulet | 5f8ef13 | 2018-03-01 08:55:21 +0100 | [diff] [blame] | 176 | |
| 177 | if (f) { |
| 178 | printf("EXTRA(0x%08x)", f); |
| 179 | } |
| 180 | putchar('\n'); |
| 181 | } |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 182 | |
| 183 | void show_si_et(unsigned int f) |
| 184 | { |
| 185 | printf("si->et = "); |
| 186 | if (!f) { |
| 187 | printf("SI_ET_NONE\n"); |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | SHOW_FLAG(f, SI_ET_QUEUE_TO); |
| 192 | SHOW_FLAG(f, SI_ET_QUEUE_ERR); |
| 193 | SHOW_FLAG(f, SI_ET_QUEUE_ABRT); |
| 194 | SHOW_FLAG(f, SI_ET_CONN_TO); |
| 195 | SHOW_FLAG(f, SI_ET_CONN_ERR); |
| 196 | SHOW_FLAG(f, SI_ET_CONN_ABRT); |
| 197 | SHOW_FLAG(f, SI_ET_CONN_RES); |
| 198 | SHOW_FLAG(f, SI_ET_CONN_OTHER); |
| 199 | SHOW_FLAG(f, SI_ET_DATA_TO); |
| 200 | SHOW_FLAG(f, SI_ET_DATA_ERR); |
| 201 | SHOW_FLAG(f, SI_ET_DATA_ABRT); |
| 202 | |
| 203 | if (f) { |
| 204 | printf("EXTRA(0x%08x)", f); |
| 205 | } |
| 206 | putchar('\n'); |
| 207 | } |
| 208 | |
| 209 | void show_si_flags(unsigned int f) |
| 210 | { |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 211 | printf("si->flags = "); |
| 212 | if (!f) { |
| 213 | printf("SI_FL_NONE\n"); |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | SHOW_FLAG(f, SI_FL_EXP); |
| 218 | SHOW_FLAG(f, SI_FL_ERR); |
Willy Tarreau | d0f5bbc | 2018-11-14 11:10:26 +0100 | [diff] [blame] | 219 | SHOW_FLAG(f, SI_FL_RXBLK_ROOM); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 220 | SHOW_FLAG(f, SI_FL_WAIT_DATA); |
| 221 | SHOW_FLAG(f, SI_FL_ISBACK); |
| 222 | SHOW_FLAG(f, SI_FL_DONT_WAKE); |
| 223 | SHOW_FLAG(f, SI_FL_INDEP_STR); |
| 224 | SHOW_FLAG(f, SI_FL_NOLINGER); |
| 225 | SHOW_FLAG(f, SI_FL_NOHALF); |
| 226 | SHOW_FLAG(f, SI_FL_SRC_ADDR); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 227 | SHOW_FLAG(f, SI_FL_WANT_GET); |
Willy Tarreau | f2ddd87 | 2018-12-18 09:54:22 +0100 | [diff] [blame] | 228 | SHOW_FLAG(f, SI_FL_CLEAN_ABRT); |
Willy Tarreau | 94f7907 | 2018-11-14 11:24:08 +0100 | [diff] [blame] | 229 | SHOW_FLAG(f, SI_FL_RXBLK_CHAN); |
| 230 | SHOW_FLAG(f, SI_FL_RXBLK_BUFF); |
| 231 | SHOW_FLAG(f, SI_FL_RXBLK_ROOM); |
| 232 | SHOW_FLAG(f, SI_FL_RXBLK_SHUT); |
| 233 | SHOW_FLAG(f, SI_FL_RX_WAIT_EP); |
| 234 | |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 235 | if (f) { |
Willy Tarreau | 94f7907 | 2018-11-14 11:24:08 +0100 | [diff] [blame] | 236 | printf("EXTRA(0x%08x)", f); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 237 | } |
| 238 | putchar('\n'); |
| 239 | } |
| 240 | |
| 241 | void show_task_state(unsigned int f) |
| 242 | { |
| 243 | printf("task->state = "); |
| 244 | |
| 245 | if (!f) { |
| 246 | printf("TASK_SLEEPING\n"); |
| 247 | return; |
| 248 | } |
| 249 | |
| 250 | SHOW_FLAG(f, TASK_WOKEN_OTHER); |
| 251 | SHOW_FLAG(f, TASK_WOKEN_RES); |
| 252 | SHOW_FLAG(f, TASK_WOKEN_MSG); |
| 253 | SHOW_FLAG(f, TASK_WOKEN_SIGNAL); |
| 254 | SHOW_FLAG(f, TASK_WOKEN_IO); |
| 255 | SHOW_FLAG(f, TASK_WOKEN_TIMER); |
| 256 | SHOW_FLAG(f, TASK_WOKEN_INIT); |
| 257 | SHOW_FLAG(f, TASK_RUNNING); |
| 258 | |
| 259 | if (f) { |
| 260 | printf("EXTRA(0x%08x)", f); |
| 261 | } |
| 262 | putchar('\n'); |
| 263 | } |
| 264 | |
| 265 | void show_txn_flags(unsigned int f) |
| 266 | { |
| 267 | printf("txn->flags = "); |
| 268 | |
| 269 | if (!f) { |
| 270 | printf("0\n"); |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | SHOW_FLAG(f, TX_NOT_FIRST); |
| 275 | SHOW_FLAG(f, TX_USE_PX_CONN); |
| 276 | SHOW_FLAG(f, TX_HDR_CONN_KAL); |
| 277 | SHOW_FLAG(f, TX_HDR_CONN_CLO); |
| 278 | SHOW_FLAG(f, TX_HDR_CONN_PRS); |
| 279 | SHOW_FLAG(f, TX_WAIT_NEXT_RQ); |
| 280 | SHOW_FLAG(f, TX_HDR_CONN_UPG); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 281 | SHOW_FLAG(f, TX_CON_KAL_SET); |
| 282 | SHOW_FLAG(f, TX_CON_CLO_SET); |
| 283 | |
| 284 | //printf("%s", f ? "" : " | "); |
| 285 | switch (f & TX_CON_WANT_MSK) { |
| 286 | case TX_CON_WANT_KAL: /*f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_KAL%s", f ? " | " : "");*/ break; |
| 287 | case TX_CON_WANT_TUN: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_TUN%s", f ? " | " : ""); break; |
| 288 | case TX_CON_WANT_SCL: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_SCL%s", f ? " | " : ""); break; |
| 289 | case TX_CON_WANT_CLO: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_CLO%s", f ? " | " : ""); break; |
| 290 | } |
| 291 | |
| 292 | SHOW_FLAG(f, TX_CACHE_COOK); |
| 293 | SHOW_FLAG(f, TX_CACHEABLE); |
| 294 | SHOW_FLAG(f, TX_SCK_PRESENT); |
| 295 | |
| 296 | //printf("%s", f ? "" : " | "); |
| 297 | switch (f & TX_SCK_MASK) { |
| 298 | case TX_SCK_NONE: f &= ~TX_SCK_MASK ; /*printf("TX_SCK_NONE%s", f ? " | " : "");*/ break; |
| 299 | case TX_SCK_FOUND: f &= ~TX_SCK_MASK ; printf("TX_SCK_FOUND%s", f ? " | " : ""); break; |
| 300 | case TX_SCK_DELETED: f &= ~TX_SCK_MASK ; printf("TX_SCK_DELETED%s", f ? " | " : ""); break; |
| 301 | case TX_SCK_INSERTED: f &= ~TX_SCK_MASK ; printf("TX_SCK_INSERTED%s", f ? " | " : ""); break; |
| 302 | case TX_SCK_REPLACED: f &= ~TX_SCK_MASK ; printf("TX_SCK_REPLACED%s", f ? " | " : ""); break; |
| 303 | case TX_SCK_UPDATED: f &= ~TX_SCK_MASK ; printf("TX_SCK_UPDATED%s", f ? " | " : ""); break; |
| 304 | default: printf("TX_SCK_MASK(%02x)", f); f &= ~TX_SCK_MASK ; printf("%s", f ? " | " : ""); break; |
| 305 | } |
| 306 | |
| 307 | //printf("%s", f ? "" : " | "); |
| 308 | switch (f & TX_CK_MASK) { |
| 309 | case TX_CK_NONE: f &= ~TX_CK_MASK ; /*printf("TX_CK_NONE%s", f ? " | " : "");*/ break; |
| 310 | case TX_CK_INVALID: f &= ~TX_CK_MASK ; printf("TX_CK_INVALID%s", f ? " | " : ""); break; |
| 311 | case TX_CK_DOWN: f &= ~TX_CK_MASK ; printf("TX_CK_DOWN%s", f ? " | " : ""); break; |
| 312 | case TX_CK_VALID: f &= ~TX_CK_MASK ; printf("TX_CK_VALID%s", f ? " | " : ""); break; |
| 313 | case TX_CK_EXPIRED: f &= ~TX_CK_MASK ; printf("TX_CK_EXPIRED%s", f ? " | " : ""); break; |
| 314 | case TX_CK_OLD: f &= ~TX_CK_MASK ; printf("TX_CK_OLD%s", f ? " | " : ""); break; |
| 315 | case TX_CK_UNUSED: f &= ~TX_CK_MASK ; printf("TX_CK_UNUSED%s", f ? " | " : ""); break; |
| 316 | default: printf("TX_CK_MASK(%02x)", f); f &= ~TX_CK_MASK ; printf("%s", f ? " | " : ""); break; |
| 317 | } |
| 318 | |
| 319 | SHOW_FLAG(f, TX_CLTARPIT); |
| 320 | SHOW_FLAG(f, TX_SVALLOW); |
| 321 | SHOW_FLAG(f, TX_SVDENY); |
| 322 | SHOW_FLAG(f, TX_CLALLOW); |
| 323 | SHOW_FLAG(f, TX_CLDENY); |
| 324 | |
| 325 | if (f) { |
| 326 | printf("EXTRA(0x%08x)", f); |
| 327 | } |
| 328 | putchar('\n'); |
| 329 | } |
| 330 | |
| 331 | void show_strm_flags(unsigned int f) |
| 332 | { |
| 333 | printf("strm->flags = "); |
| 334 | |
| 335 | if (!f) { |
| 336 | printf("0\n"); |
| 337 | return; |
| 338 | } |
| 339 | |
| 340 | SHOW_FLAG(f, SF_SRV_REUSED); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 341 | SHOW_FLAG(f, SF_IGNORE_PRST); |
| 342 | |
| 343 | //printf("%s", f ? "" : " | "); |
| 344 | switch (f & SF_FINST_MASK) { |
| 345 | case SF_FINST_R: f &= ~SF_FINST_MASK ; printf("SF_FINST_R%s", f ? " | " : ""); break; |
| 346 | case SF_FINST_C: f &= ~SF_FINST_MASK ; printf("SF_FINST_C%s", f ? " | " : ""); break; |
| 347 | case SF_FINST_H: f &= ~SF_FINST_MASK ; printf("SF_FINST_H%s", f ? " | " : ""); break; |
| 348 | case SF_FINST_D: f &= ~SF_FINST_MASK ; printf("SF_FINST_D%s", f ? " | " : ""); break; |
| 349 | case SF_FINST_L: f &= ~SF_FINST_MASK ; printf("SF_FINST_L%s", f ? " | " : ""); break; |
| 350 | case SF_FINST_Q: f &= ~SF_FINST_MASK ; printf("SF_FINST_Q%s", f ? " | " : ""); break; |
| 351 | case SF_FINST_T: f &= ~SF_FINST_MASK ; printf("SF_FINST_T%s", f ? " | " : ""); break; |
| 352 | } |
| 353 | |
| 354 | switch (f & SF_ERR_MASK) { |
| 355 | case SF_ERR_LOCAL: f &= ~SF_ERR_MASK ; printf("SF_ERR_LOCAL%s", f ? " | " : ""); break; |
| 356 | case SF_ERR_CLITO: f &= ~SF_ERR_MASK ; printf("SF_ERR_CLITO%s", f ? " | " : ""); break; |
| 357 | case SF_ERR_CLICL: f &= ~SF_ERR_MASK ; printf("SF_ERR_CLICL%s", f ? " | " : ""); break; |
| 358 | case SF_ERR_SRVTO: f &= ~SF_ERR_MASK ; printf("SF_ERR_SRVTO%s", f ? " | " : ""); break; |
| 359 | case SF_ERR_SRVCL: f &= ~SF_ERR_MASK ; printf("SF_ERR_SRVCL%s", f ? " | " : ""); break; |
| 360 | case SF_ERR_PRXCOND: f &= ~SF_ERR_MASK ; printf("SF_ERR_PRXCOND%s", f ? " | " : ""); break; |
| 361 | case SF_ERR_RESOURCE: f &= ~SF_ERR_MASK ; printf("SF_ERR_RESOURCE%s", f ? " | " : ""); break; |
| 362 | case SF_ERR_INTERNAL: f &= ~SF_ERR_MASK ; printf("SF_ERR_INTERNAL%s", f ? " | " : ""); break; |
| 363 | case SF_ERR_DOWN: f &= ~SF_ERR_MASK ; printf("SF_ERR_DOWN%s", f ? " | " : ""); break; |
| 364 | case SF_ERR_KILLED: f &= ~SF_ERR_MASK ; printf("SF_ERR_KILLED%s", f ? " | " : ""); break; |
| 365 | case SF_ERR_UP: f &= ~SF_ERR_MASK ; printf("SF_ERR_UP%s", f ? " | " : ""); break; |
Willy Tarreau | a7da4d2 | 2016-11-11 08:05:34 +0100 | [diff] [blame] | 366 | case SF_ERR_CHK_PORT: f &= ~SF_ERR_MASK ; printf("SF_ERR_CHK_PORT%s", f ? " | " : ""); break; |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 367 | } |
| 368 | |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 369 | SHOW_FLAG(f, SF_REDIRECTABLE); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 370 | SHOW_FLAG(f, SF_REDISP); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 371 | SHOW_FLAG(f, SF_CURR_SESS); |
| 372 | SHOW_FLAG(f, SF_MONITOR); |
| 373 | SHOW_FLAG(f, SF_FORCE_PRST); |
| 374 | SHOW_FLAG(f, SF_BE_ASSIGNED); |
| 375 | SHOW_FLAG(f, SF_ADDR_SET); |
| 376 | SHOW_FLAG(f, SF_ASSIGNED); |
| 377 | SHOW_FLAG(f, SF_DIRECT); |
| 378 | |
| 379 | if (f) { |
| 380 | printf("EXTRA(0x%08x)", f); |
| 381 | } |
| 382 | putchar('\n'); |
| 383 | } |
| 384 | |
| 385 | int main(int argc, char **argv) |
| 386 | { |
| 387 | unsigned int flags; |
| 388 | |
| 389 | if (argc < 2) { |
| 390 | fprintf(stderr, "Usage: %s 0x<flags|state>\n", argv[0]); |
| 391 | exit(1); |
| 392 | } |
| 393 | |
| 394 | flags = strtoul(argv[1], NULL, 0); |
| 395 | |
| 396 | show_task_state(flags); |
| 397 | show_txn_flags(flags); |
| 398 | show_strm_flags(flags); |
| 399 | show_si_et(flags); |
| 400 | show_si_flags(flags); |
Christopher Faulet | 5f8ef13 | 2018-03-01 08:55:21 +0100 | [diff] [blame] | 401 | show_cs_flags(flags); |
Willy Tarreau | 074d65b | 2015-12-20 23:21:57 +0100 | [diff] [blame] | 402 | show_conn_flags(flags); |
| 403 | show_chn_flags(flags); |
| 404 | show_chn_ana(flags); |
| 405 | |
| 406 | return 0; |
| 407 | } |