]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: stats: move the stats socket states to dumpstats.c
authorWilly Tarreau <w@1wt.eu>
Tue, 28 Jan 2014 15:27:17 +0000 (16:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 Jan 2014 15:28:21 +0000 (16:28 +0100)
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.

include/proto/dumpstats.h
src/dumpstats.c

index 0da3091c5e89f436879e1f45a848e7fd11a145da..78ff6f76cfb47c5d4a7ffe980918e0c7f0c8137f 100644 (file)
 #define STATS_TYPE_SV  2
 #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 */
 enum {
        STAT_HTTP_DONE = 0,  /* finished */
index 51b47ca9e9c2df0871c339fff0606a5fd7a46117..c2dfe1f9ad4859c6dc1ef1abf30ee7ca8ebffc15 100644 (file)
 #include <proto/ssl_sock.h>
 #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_full_sess_to_buffer(struct stream_interface *si, struct session *sess);
 static int stats_dump_sess_to_buffer(struct stream_interface *si);