blob: a6fe57a0d0ffc543a51995aa7e0c7630b1dbf0f8 [file] [log] [blame]
William Lallemand9ed62032016-11-21 17:49:11 +01001/*
2 * include/types/cli.h
3 * This file provides structures and types for CLI.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation, version 2.1
8 * exclusively.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef _TYPES_CLI_H
21#define _TYPES_CLI_H
22
23#include <common/mini-clist.h>
24#include <types/applet.h>
25
26struct cli_kw {
27 const char *str_kw[5]; /* keywords ended by NULL, limited to 5
28 separated keywords combination */
29 const char *usage; /* usage message */
30 int (*parse)(char **args, struct appctx *appctx, void *private);
31 int (*io_handler)(struct appctx *appctx);
32 void (*io_release)(struct appctx *appctx);
33 void *private;
34};
35
36struct cli_kw_list {
37 struct list list;
38 struct cli_kw kw[VAR_ARRAY];
39};
40
41/* Show Info fields for CLI output. For any field added here, please add the text
42 * representation in the info_field_names array below. Please only append at the end,
43 * before the INF_TOTAL_FIELDS entry, and never insert anything in the middle
44 * nor at the beginning.
45 */
46enum info_field {
47 INF_NAME,
48 INF_VERSION,
49 INF_RELEASE_DATE,
50 INF_NBPROC,
51 INF_PROCESS_NUM,
52 INF_PID,
53 INF_UPTIME,
54 INF_UPTIME_SEC,
55 INF_MEMMAX_MB,
56 INF_POOL_ALLOC_MB,
57 INF_POOL_USED_MB,
58 INF_POOL_FAILED,
59 INF_ULIMIT_N,
60 INF_MAXSOCK,
61 INF_MAXCONN,
62 INF_HARD_MAXCONN,
63 INF_CURR_CONN,
64 INF_CUM_CONN,
65 INF_CUM_REQ,
66 INF_MAX_SSL_CONNS,
67 INF_CURR_SSL_CONNS,
68 INF_CUM_SSL_CONNS,
69 INF_MAXPIPES,
70 INF_PIPES_USED,
71 INF_PIPES_FREE,
72 INF_CONN_RATE,
73 INF_CONN_RATE_LIMIT,
74 INF_MAX_CONN_RATE,
75 INF_SESS_RATE,
76 INF_SESS_RATE_LIMIT,
77 INF_MAX_SESS_RATE,
78 INF_SSL_RATE,
79 INF_SSL_RATE_LIMIT,
80 INF_MAX_SSL_RATE,
81 INF_SSL_FRONTEND_KEY_RATE,
82 INF_SSL_FRONTEND_MAX_KEY_RATE,
83 INF_SSL_FRONTEND_SESSION_REUSE_PCT,
84 INF_SSL_BACKEND_KEY_RATE,
85 INF_SSL_BACKEND_MAX_KEY_RATE,
86 INF_SSL_CACHE_LOOKUPS,
87 INF_SSL_CACHE_MISSES,
88 INF_COMPRESS_BPS_IN,
89 INF_COMPRESS_BPS_OUT,
90 INF_COMPRESS_BPS_RATE_LIM,
91 INF_ZLIB_MEM_USAGE,
92 INF_MAX_ZLIB_MEM_USAGE,
93 INF_TASKS,
94 INF_RUN_QUEUE,
95 INF_IDLE_PCT,
96 INF_NODE,
97 INF_DESCRIPTION,
98
99 /* must always be the last one */
100 INF_TOTAL_FIELDS
101};
102
103
104/* stats socket states */
105enum {
106 STAT_CLI_INIT = 0, /* initial state, must leave to zero ! */
107 STAT_CLI_END, /* final state, let's close */
108 STAT_CLI_GETREQ, /* wait for a request */
109 STAT_CLI_OUTPUT, /* all states after this one are responses */
110 STAT_CLI_PROMPT, /* display the prompt (first output, same code) */
111 STAT_CLI_PRINT, /* display message in cli->msg */
112 STAT_CLI_PRINT_FREE, /* display message in cli->msg. After the display, free the pointer */
113 STAT_CLI_O_INFO, /* dump info */
114 STAT_CLI_O_SESS, /* dump streams */
115 STAT_CLI_O_ERR, /* dump errors */
116 STAT_CLI_O_TAB, /* dump tables */
117 STAT_CLI_O_CLR, /* clear tables */
118 STAT_CLI_O_SET, /* set entries in tables */
119 STAT_CLI_O_STAT, /* dump stats */
William Lallemand9ed62032016-11-21 17:49:11 +0100120 STAT_CLI_O_SERVERS_STATE, /* dump server state and changing information */
121 STAT_CLI_O_BACKEND, /* dump backend list */
122 STAT_CLI_O_ENV, /* dump environment */
123 STAT_CLI_O_CUSTOM, /* custom callback pointer */
124};
125
126
127#endif /* _TYPES_CLI_H */