REORG: stats: move the stats socket states to dumpstats.c

There is no more usage of these values outside of dumpstats.c, and
they're easier to maintain there. Also replace the #defines with an
enum.
This commit is contained in:
Willy Tarreau 2014-01-28 16:27:17 +01:00
parent e43d5323c6
commit 91b843d0d2
2 changed files with 20 additions and 20 deletions

View File

@ -38,26 +38,6 @@
#define STATS_TYPE_SV 2 #define STATS_TYPE_SV 2
#define STATS_TYPE_SO 3 #define STATS_TYPE_SO 3
/* unix stats socket states */
#define STAT_CLI_INIT 0 /* initial state, must leave to zero ! */
#define STAT_CLI_END 1 /* final state, let's close */
#define STAT_CLI_GETREQ 2 /* wait for a request */
#define STAT_CLI_OUTPUT 3 /* all states after this one are responses */
#define STAT_CLI_PROMPT 3 /* display the prompt (first output, same code) */
#define STAT_CLI_PRINT 4 /* display message in cli->msg */
#define STAT_CLI_O_INFO 5 /* dump info */
#define STAT_CLI_O_SESS 6 /* dump sessions */
#define STAT_CLI_O_ERR 7 /* dump errors */
#define STAT_CLI_O_TAB 8 /* dump tables */
#define STAT_CLI_O_CLR 9 /* clear tables */
#define STAT_CLI_O_SET 10 /* set entries in tables */
#define STAT_CLI_O_STAT 11 /* dump stats */
#define STAT_CLI_O_MAPS 12 /* list all maps */
#define STAT_CLI_O_MAP 13 /* list all map entries of a map */
#define STAT_CLI_O_MLOOK 14 /* lookup a map entry */
/* HTTP stats : applet.st0 */ /* HTTP stats : applet.st0 */
enum { enum {
STAT_HTTP_DONE = 0, /* finished */ STAT_HTTP_DONE = 0, /* finished */

View File

@ -63,6 +63,26 @@
#include <proto/ssl_sock.h> #include <proto/ssl_sock.h>
#endif #endif
/* stats socket states */
enum {
STAT_CLI_INIT = 0, /* initial state, must leave to zero ! */
STAT_CLI_END, /* final state, let's close */
STAT_CLI_GETREQ, /* wait for a request */
STAT_CLI_OUTPUT, /* all states after this one are responses */
STAT_CLI_PROMPT, /* display the prompt (first output, same code) */
STAT_CLI_PRINT, /* display message in cli->msg */
STAT_CLI_O_INFO, /* dump info */
STAT_CLI_O_SESS, /* dump sessions */
STAT_CLI_O_ERR, /* dump errors */
STAT_CLI_O_TAB, /* dump tables */
STAT_CLI_O_CLR, /* clear tables */
STAT_CLI_O_SET, /* set entries in tables */
STAT_CLI_O_STAT, /* dump stats */
STAT_CLI_O_MAPS, /* list all maps */
STAT_CLI_O_MAP, /* list all map entries of a map */
STAT_CLI_O_MLOOK, /* lookup a map entry */
};
static int stats_dump_info_to_buffer(struct stream_interface *si); static int stats_dump_info_to_buffer(struct stream_interface *si);
static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct session *sess); static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct session *sess);
static int stats_dump_sess_to_buffer(struct stream_interface *si); static int stats_dump_sess_to_buffer(struct stream_interface *si);