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.
This commit is contained in:
Willy Tarreau 2020-06-04 20:19:54 +02:00
parent 2eec9b5f95
commit 83487a833c
27 changed files with 52 additions and 71 deletions

View File

@ -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 @@ enum {
};
#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 */

View File

@ -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 @@ static inline int cli_dynerr(struct appctx *appctx, char *err)
}
#endif /* _PROTO_CLI_H */
#endif /* _HAPROXY_CLI_H */

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>