REORG: include: move cli.h to haproxy/cli{,-t}.h
Almost no change except moving the cli_kw struct definition after the
defines. Almost all users had both types&proto included, which is not
surprizing since this code is old and it used to be the norm a decade
ago. These places were cleaned.
diff --git a/include/types/cli.h b/include/haproxy/cli-t.h
similarity index 94%
rename from include/types/cli.h
rename to include/haproxy/cli-t.h
index 710e014..bfa3a34 100644
--- a/include/types/cli.h
+++ b/include/haproxy/cli-t.h
@@ -1,7 +1,9 @@
/*
- * include/types/cli.h
+ * include/haproxy/cli-t.h
* This file provides structures and types for CLI.
*
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
@@ -17,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _TYPES_CLI_H
-#define _TYPES_CLI_H
+#ifndef _HAPROXY_CLI_T_H
+#define _HAPROXY_CLI_T_H
#include <haproxy/applet-t.h>
#include <haproxy/list-t.h>
@@ -41,22 +43,6 @@
#define APPCTX_CLI_ST1_PAYLOAD (1 << 1)
#define APPCTX_CLI_ST1_NOLF (1 << 2)
-struct cli_kw {
- const char *str_kw[5]; /* keywords ended by NULL, limited to 5
- separated keywords combination */
- const char *usage; /* usage message */
- int (*parse)(char **args, char *payload, struct appctx *appctx, void *private);
- int (*io_handler)(struct appctx *appctx);
- void (*io_release)(struct appctx *appctx);
- void *private;
- int level; /* this is the level needed to show the keyword usage and to use it */
-};
-
-struct cli_kw_list {
- struct list list;
- struct cli_kw kw[VAR_ARRAY];
-};
-
/* CLI states */
enum {
CLI_ST_INIT = 0, /* initial state, must leave to zero ! */
@@ -80,4 +66,20 @@
};
-#endif /* _TYPES_CLI_H */
+struct cli_kw {
+ const char *str_kw[5]; /* keywords ended by NULL, limited to 5
+ separated keywords combination */
+ const char *usage; /* usage message */
+ int (*parse)(char **args, char *payload, struct appctx *appctx, void *private);
+ int (*io_handler)(struct appctx *appctx);
+ void (*io_release)(struct appctx *appctx);
+ void *private;
+ int level; /* this is the level needed to show the keyword usage and to use it */
+};
+
+struct cli_kw_list {
+ struct list list;
+ struct cli_kw kw[VAR_ARRAY];
+};
+
+#endif /* _HAPROXY_CLI_T_H */
diff --git a/include/proto/cli.h b/include/haproxy/cli.h
similarity index 95%
rename from include/proto/cli.h
rename to include/haproxy/cli.h
index cbd3cd9..36bcb2b 100644
--- a/include/proto/cli.h
+++ b/include/haproxy/cli.h
@@ -1,5 +1,5 @@
/*
- * include/proto/cli.h
+ * include/haproxy/cli.h
* This file contains definitions of some primitives to dedicated to
* statistics output.
*
@@ -20,13 +20,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _PROTO_CLI_H
-#define _PROTO_CLI_H
+#ifndef _HAPROXY_CLI_H
+#define _HAPROXY_CLI_H
#include <haproxy/applet-t.h>
+#include <haproxy/cli-t.h>
#include <haproxy/global.h>
#include <types/channel.h>
-#include <types/cli.h>
#include <types/stream.h>
@@ -96,5 +96,5 @@
}
-#endif /* _PROTO_CLI_H */
+#endif /* _HAPROXY_CLI_H */
diff --git a/include/haproxy/listener.h b/include/haproxy/listener.h
index 3d3d118..c2ac75e 100644
--- a/include/haproxy/listener.h
+++ b/include/haproxy/listener.h
@@ -26,9 +26,9 @@
#include <string.h>
#include <haproxy/api.h>
+#include <haproxy/cli-t.h>
#include <haproxy/list.h>
#include <haproxy/listener-t.h>
-#include <types/cli.h>
/* This function tries to temporarily disable a listener, depending on the OS
* capabilities. Linux unbinds the listen socket after a SHUT_RD, and ignores
diff --git a/src/activity.c b/src/activity.c
index 59ae4fa..1f2ab48 100644
--- a/src/activity.c
+++ b/src/activity.c
@@ -12,11 +12,11 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/cli.h>
#include <haproxy/tools.h>
#include <haproxy/thread-t.h>
#include <haproxy/activity-t.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/freq_ctr.h>
#include <proto/stream_interface.h>
diff --git a/src/cache.c b/src/cache.c
index 707a011..138ae52 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -12,18 +12,17 @@
#include <haproxy/action-t.h>
#include <haproxy/api.h>
+#include <haproxy/cli.h>
#include <haproxy/http_htx.h>
#include <haproxy/http_rules.h>
#include <haproxy/shctx.h>
#include <import/eb32tree.h>
#include <import/sha1.h>
-#include <types/cli.h>
#include <types/filters.h>
#include <types/proxy.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <proto/proxy.h>
#include <proto/filters.h>
#include <proto/http_ana.h>
diff --git a/src/cli.c b/src/cli.c
index 2a0f423..2b54dc1 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -30,6 +30,7 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/check.h>
+#include <haproxy/cli.h>
#include <haproxy/dns-t.h>
#include <haproxy/frontend.h>
#include <haproxy/list.h>
@@ -52,7 +53,6 @@
#include <haproxy/activity.h>
#include <proto/backend.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/compression.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
diff --git a/src/debug.c b/src/debug.c
index 0726d7d..51c84cb 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -21,6 +21,7 @@
#include <haproxy/api.h>
#include <haproxy/buf.h>
+#include <haproxy/cli.h>
#include <haproxy/debug.h>
#include <haproxy/hlua.h>
#include <haproxy/task.h>
@@ -31,7 +32,6 @@
#include <haproxy/global.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/stream_interface.h>
diff --git a/src/dns.c b/src/dns.c
index 036d4af..e54205b 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -23,6 +23,7 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/check.h>
+#include <haproxy/cli.h>
#include <haproxy/dns.h>
#include <haproxy/errors.h>
#include <haproxy/http_rules.h>
@@ -35,11 +36,9 @@
#include <haproxy/net_helper.h>
#include <haproxy/vars.h>
-#include <types/cli.h>
#include <haproxy/global.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/http_ana.h>
#include <proto/log.h>
diff --git a/src/haproxy.c b/src/haproxy.c
index 26702a9..c717577 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -86,6 +86,7 @@
#include <haproxy/base64.h>
#include <common/cfgparse.h>
#include <haproxy/chunk.h>
+#include <haproxy/cli.h>
#include <haproxy/connection.h>
#include <haproxy/dns.h>
#include <haproxy/dynbuf.h>
@@ -114,7 +115,6 @@
#include <haproxy/vars.h>
#include <haproxy/capture-t.h>
-#include <types/cli.h>
#include <types/filters.h>
#include <haproxy/global.h>
@@ -122,7 +122,6 @@
#include <haproxy/arg.h>
#include <proto/backend.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/filters.h>
#include <proto/log.h>
diff --git a/src/hlua.c b/src/hlua.c
index 04319bc..1538739 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -26,6 +26,7 @@
#include <import/ebpttree.h>
#include <common/cfgparse.h>
+#include <haproxy/cli.h>
#include <haproxy/connection.h>
#include <haproxy/http_htx.h>
#include <haproxy/thread.h>
@@ -48,12 +49,10 @@
#include <haproxy/tools.h>
#include <haproxy/vars.h>
-#include <types/cli.h>
#include <types/proxy.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <proto/queue.h>
#include <proto/http_ana.h>
#include <proto/server.h>
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index c9ef840..c14c885 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -18,6 +18,7 @@
#include <lua.h>
#include <lualib.h>
+#include <haproxy/cli-t.h>
#include <haproxy/hlua-t.h>
#include <haproxy/http.h>
#include <haproxy/net_helper.h>
@@ -25,7 +26,6 @@
#include <haproxy/stats.h>
#include <haproxy/time.h>
-#include <types/cli.h>
#include <types/proxy.h>
#include <proto/proxy.h>
diff --git a/src/log.c b/src/log.c
index 7b5a357..fcf61b1 100644
--- a/src/log.c
+++ b/src/log.c
@@ -26,17 +26,16 @@
#include <haproxy/applet-t.h>
#include <haproxy/api.h>
+#include <haproxy/cli.h>
#include <haproxy/frontend.h>
#include <haproxy/http.h>
#include <haproxy/tools.h>
#include <haproxy/time.h>
#include <haproxy/version.h>
-#include <types/cli.h>
#include <haproxy/global.h>
#include <types/log.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/log.h>
#include <haproxy/ring.h>
diff --git a/src/map.c b/src/map.c
index 65fd1ed..8b7cc51 100644
--- a/src/map.c
+++ b/src/map.c
@@ -14,16 +14,14 @@
#include <haproxy/applet-t.h>
#include <haproxy/api.h>
+#include <haproxy/cli.h>
#include <haproxy/map.h>
#include <haproxy/pattern.h>
#include <haproxy/regex.h>
#include <haproxy/stats-t.h>
#include <haproxy/tools.h>
-#include <types/cli.h>
-
#include <haproxy/arg.h>
-#include <proto/cli.h>
#include <proto/log.h>
#include <proto/stream_interface.h>
#include <haproxy/sample.h>
diff --git a/src/mworker.c b/src/mworker.c
index 091a6df..3481c19 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -19,6 +19,7 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/cli.h>
#include <haproxy/list.h>
#include <haproxy/listener.h>
#include <haproxy/mworker.h>
@@ -26,10 +27,8 @@
#include <haproxy/signal.h>
#include <haproxy/version.h>
-#include <types/cli.h>
#include <haproxy/global.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/log.h>
#include <proto/proxy.h>
diff --git a/src/peers.c b/src/peers.c
index c9d5735..030a082 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -22,6 +22,7 @@
#include <haproxy/applet.h>
#include <haproxy/api.h>
+#include <haproxy/cli.h>
#include <haproxy/dict.h>
#include <haproxy/frontend.h>
#include <haproxy/net_helper.h>
@@ -36,7 +37,6 @@
#include <haproxy/thread.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/log.h>
#include <proto/proxy.h>
diff --git a/src/pool.c b/src/pool.c
index e8b96a0..1e87b75 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -13,7 +13,7 @@
#include <haproxy/applet-t.h>
#include <haproxy/api.h>
-#include <types/cli.h>
+#include <haproxy/cli.h>
#include <haproxy/global.h>
#include <common/cfgparse.h>
@@ -25,7 +25,6 @@
#include <haproxy/activity-t.h>
-#include <proto/cli.h>
#include <proto/channel.h>
#include <proto/log.h>
#include <proto/stream_interface.h>
diff --git a/src/proxy.c b/src/proxy.c
index 8e0f03a..94bce71 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -20,6 +20,7 @@
#include <haproxy/applet-t.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/cli.h>
#include <haproxy/errors.h>
#include <haproxy/global.h>
#include <haproxy/listener.h>
@@ -34,9 +35,7 @@
#include <import/ebistree.h>
#include <haproxy/capture-t.h>
-#include <types/cli.h>
-#include <proto/cli.h>
#include <proto/backend.h>
#include <haproxy/fd.h>
#include <proto/filters.h>
diff --git a/src/ring.c b/src/ring.c
index 323249d..cdf9185 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -22,8 +22,8 @@
#include <haproxy/applet.h>
#include <haproxy/api.h>
#include <haproxy/buf.h>
+#include <haproxy/cli.h>
#include <haproxy/thread.h>
-#include <proto/cli.h>
#include <haproxy/ring.h>
#include <proto/stream_interface.h>
diff --git a/src/server.c b/src/server.c
index c4a453b..e8ed5a9 100644
--- a/src/server.c
+++ b/src/server.c
@@ -20,6 +20,7 @@
#include <common/cfgparse.h>
#include <haproxy/check.h>
+#include <haproxy/cli.h>
#include <haproxy/connection.h>
#include <haproxy/dict-t.h>
#include <haproxy/dns.h>
@@ -31,10 +32,6 @@
#include <haproxy/task.h>
#include <haproxy/time.h>
-#include <types/cli.h>
-#include <types/cli.h>
-
-#include <proto/cli.h>
#include <haproxy/port_range.h>
#include <haproxy/protocol.h>
#include <proto/queue.h>
diff --git a/src/sink.c b/src/sink.c
index c4a452d..8408be7 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -20,10 +20,10 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/cli.h>
#include <import/ist.h>
#include <haproxy/list.h>
#include <haproxy/time.h>
-#include <proto/cli.h>
#include <proto/log.h>
#include <haproxy/ring.h>
#include <haproxy/signal.h>
diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c
index 5b1b4e1..1125961 100644
--- a/src/ssl_ckch.c
+++ b/src/ssl_ckch.c
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include <haproxy/base64.h>
+#include <haproxy/cli.h>
#include <haproxy/errors.h>
#include <haproxy/ssl_ckch.h>
#include <haproxy/ssl_utils.h>
@@ -29,10 +30,8 @@
#include <import/ebsttree.h>
-#include <types/cli.h>
#include <types/ssl_sock.h>
-#include <proto/cli.h>
#include <proto/channel.h>
#include <proto/ssl_sock.h>
#include <proto/stream_interface.h>
diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c
index 9d0e1e7..ab88dcb 100644
--- a/src/ssl_crtlist.c
+++ b/src/ssl_crtlist.c
@@ -15,6 +15,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <haproxy/cli.h>
#include <haproxy/errors.h>
#include <haproxy/ssl_ckch.h>
#include <haproxy/ssl_crtlist.h>
@@ -24,11 +25,9 @@
#include <import/ebpttree.h>
#include <import/ebsttree.h>
-#include <types/cli.h>
#include <types/ssl_sock.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <proto/stream_interface.h>
#include <proto/ssl_sock.h>
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index aa983bd..35c03a8 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -46,6 +46,7 @@
#include <haproxy/dynbuf.h>
#include <haproxy/chunk.h>
+#include <haproxy/cli.h>
#include <haproxy/connection.h>
#include <haproxy/errors.h>
#include <haproxy/frontend.h>
@@ -68,12 +69,10 @@
#include <import/ebpttree.h>
#include <import/ebsttree.h>
-#include <types/cli.h>
#include <types/ssl_sock.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <haproxy/proto_tcp.h>
diff --git a/src/stats.c b/src/stats.c
index bc59066..e62f0e4 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -28,6 +28,7 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/check.h>
+#include <haproxy/cli.h>
#include <haproxy/compression.h>
#include <haproxy/debug.h>
#include <haproxy/dns.h>
@@ -51,11 +52,8 @@
#include <haproxy/version.h>
#include <haproxy/base64.h>
-#include <types/cli.h>
-
#include <proto/backend.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>
diff --git a/src/stick_table.c b/src/stick_table.c
index a79defc..736c809 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -16,6 +16,7 @@
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/cli.h>
#include <haproxy/global.h>
#include <haproxy/http_rules.h>
#include <haproxy/pool.h>
@@ -31,10 +32,7 @@
#include <import/ebmbtree.h>
#include <import/ebsttree.h>
-#include <types/cli.h>
-
#include <haproxy/arg.h>
-#include <proto/cli.h>
#include <proto/log.h>
#include <proto/http_ana.h>
#include <haproxy/proto_tcp.h>
diff --git a/src/stream.c b/src/stream.c
index e6058c5..5eced5b 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -21,6 +21,7 @@
#include <haproxy/capture.h>
#include <common/cfgparse.h>
#include <haproxy/check.h>
+#include <haproxy/cli.h>
#include <haproxy/connection.h>
#include <haproxy/dict.h>
#include <haproxy/dns.h>
@@ -39,14 +40,12 @@
#include <haproxy/tcp_rules.h>
#include <haproxy/vars.h>
-#include <types/cli.h>
#include <types/filters.h>
#include <haproxy/activity.h>
#include <haproxy/arg.h>
#include <proto/backend.h>
#include <proto/channel.h>
-#include <proto/cli.h>
#include <haproxy/fd.h>
#include <proto/filters.h>
#include <haproxy/freq_ctr.h>
diff --git a/src/trace.c b/src/trace.c
index 2c7bbb6..bb9db08 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -21,9 +21,9 @@
#include <import/ist.h>
#include <haproxy/api.h>
#include <haproxy/buf.h>
+#include <haproxy/cli.h>
#include <haproxy/istbuf.h>
#include <haproxy/list.h>
-#include <proto/cli.h>
#include <proto/log.h>
#include <haproxy/sink.h>
#include <haproxy/trace.h>