diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c index f0b1adf63..d64d8ae72 100644 --- a/contrib/prometheus-exporter/service-prometheus.c +++ b/contrib/prometheus-exporter/service-prometheus.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/types/stats.h b/include/haproxy/stats-t.h similarity index 98% rename from include/types/stats.h rename to include/haproxy/stats-t.h index bc25a5c24..657300851 100644 --- a/include/types/stats.h +++ b/include/haproxy/stats-t.h @@ -1,7 +1,9 @@ /* - * include/types/stats.h + * include/haproxy/stats-t.h * This file provides structures and types for stats. * + * 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,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _TYPES_STATS_H -#define _TYPES_STATS_H +#ifndef _HAPROXY_STATS_T_H +#define _HAPROXY_STATS_T_H + +#include /* Flags for applet.ctx.stats.flags */ #define STAT_FMT_HTML 0x00000001 /* dump the stats in HTML format */ @@ -242,22 +246,6 @@ enum field_scope { FS_MASK = 0xFF000000, }; -/* Please consider updating stats_dump_fields_*(), - * stats_dump_.*_info_fields() and stats_*_schema() - * when modifying struct field or related enums. - */ -struct field { - uint32_t type; - union { - int32_t s32; /* FF_S32 */ - uint32_t u32; /* FF_U32 */ - int64_t s64; /* FF_S64 */ - uint64_t u64; /* FF_U64 */ - double flt; /* FF_FLT */ - const char *str; /* FF_STR */ - } u; -}; - /* Show Info fields for CLI output. For any field added here, please add the text * representation in the info_field_names array below. Please only append at the end, * before the INF_TOTAL_FIELDS entry, and never insert anything in the middle @@ -440,5 +428,21 @@ enum stat_field { ST_F_TOTAL_FIELDS }; +/* Please consider updating stats_dump_fields_*(), + * stats_dump_.*_info_fields() and stats_*_schema() + * when modifying struct field or related enums. + */ +struct field { + uint32_t type; + union { + int32_t s32; /* FF_S32 */ + uint32_t u32; /* FF_U32 */ + int64_t s64; /* FF_S64 */ + uint64_t u64; /* FF_U64 */ + double flt; /* FF_FLT */ + const char *str; /* FF_STR */ + } u; +}; -#endif /* _TYPES_STATS_H */ + +#endif /* _HAPROXY_STATS_T_H */ diff --git a/include/proto/stats.h b/include/haproxy/stats.h similarity index 94% rename from include/proto/stats.h rename to include/haproxy/stats.h index 84c64d03e..7fb57754c 100644 --- a/include/proto/stats.h +++ b/include/haproxy/stats.h @@ -1,9 +1,9 @@ /* - * include/proto/stats.h + * include/haproxy/stats.h * This file contains definitions of some primitives to dedicated to * statistics output. * - * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu + * 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 @@ -20,14 +20,38 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _PROTO_STATS_H -#define _PROTO_STATS_H +#ifndef _HAPROXY_STATS_H +#define _HAPROXY_STATS_H #include -#include #include +#include +#include #include -#include + + +/* These two structs contains all field names and descriptions according to + * the the number of entries in "enum stat_field" and "enum info_field" + */ +extern const struct name_desc stat_fields[]; +extern const struct name_desc info_fields[]; +extern const char *stat_status_codes[]; +extern struct applet http_stats_applet; + + +int stats_fill_info(struct field *info, int len); +int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len); +int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, + struct field *stats, int len); +int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, + struct field *stats, int len); +int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len); + +void stats_io_handler(struct stream_interface *si); +int stats_emit_raw_data_field(struct buffer *out, const struct field *f); +int stats_emit_typed_data_field(struct buffer *out, const struct field *f); +int stats_emit_field_tags(struct buffer *out, const struct field *f, + char delim); static inline enum field_format field_format(const struct field *f, int e) @@ -91,31 +115,7 @@ static inline struct field mkf_flt(uint32_t type, double value) return f; } -extern const char *stat_status_codes[]; - -/* These two structs contains all field names and descriptions according to - * the the number of entries in "enum stat_field" and "enum info_field" - */ -extern const struct name_desc stat_fields[]; -extern const struct name_desc info_fields[]; - -int stats_fill_info(struct field *info, int len); -int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len); -int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, - struct field *stats, int len); -int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, - struct field *stats, int len); -int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len); - -extern struct applet http_stats_applet; - -void stats_io_handler(struct stream_interface *si); -int stats_emit_raw_data_field(struct buffer *out, const struct field *f); -int stats_emit_typed_data_field(struct buffer *out, const struct field *f); -int stats_emit_field_tags(struct buffer *out, const struct field *f, - char delim); - -#endif /* _PROTO_STATS_H */ +#endif /* _HAPROXY_STATS_H */ /* * Local variables: diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 44474fde2..9ec25a3c5 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/cfgparse.c b/src/cfgparse.c index 5f2787792..e3d33edb1 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -65,11 +66,9 @@ #include #include -#include #include #include -#include #include #include #include diff --git a/src/check.c b/src/check.c index dfa30988d..6e8e2383c 100644 --- a/src/check.c +++ b/src/check.c @@ -47,15 +47,14 @@ #include #include #include +#include #include #include #include -#include #include #include -#include #include #include #include diff --git a/src/cli.c b/src/cli.c index e3b914dde..2a0f423b8 100644 --- a/src/cli.c +++ b/src/cli.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -47,14 +48,12 @@ #include #include -#include #include #include #include #include #include -#include #include #include #include diff --git a/src/dns.c b/src/dns.c index 9fc767d06..036d4af3d 100644 --- a/src/dns.c +++ b/src/dns.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include #include -#include #include #include diff --git a/src/hlua.c b/src/hlua.c index 0d3a3e9ce..04319bc78 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -49,12 +50,10 @@ #include #include -#include #include #include #include -#include #include #include #include diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index f4ac3d5d2..c9ef840e4 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -22,15 +22,14 @@ #include #include #include +#include #include #include #include -#include #include #include -#include #include /* Contains the class reference of the concat object. */ diff --git a/src/http_ana.c b/src/http_ana.c index 37ae6481c..690640fb0 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -34,7 +35,6 @@ #include #include #include -#include #define TRACE_SOURCE &trace_strm diff --git a/src/map.c b/src/map.c index 77d687bb8..65fd1edb0 100644 --- a/src/map.c +++ b/src/map.c @@ -17,10 +17,10 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/src/peers.c b/src/peers.c index 1d60e3f53..c9d57355b 100644 --- a/src/peers.c +++ b/src/peers.c @@ -30,12 +30,11 @@ #include #include #include +#include #include #include #include -#include - #include #include #include diff --git a/src/pool.c b/src/pool.c index 1e8e2f863..e8b96a0e3 100644 --- a/src/pool.c +++ b/src/pool.c @@ -15,12 +15,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include @@ -29,7 +29,6 @@ #include #include #include -#include #ifdef CONFIG_HAP_LOCAL_POOLS /* These are the most common pools, expected to be initialized first. These diff --git a/src/proxy.c b/src/proxy.c index b00ea01b0..8e0f03a10 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -34,7 +35,6 @@ #include #include -#include #include #include diff --git a/src/server.c b/src/server.c index 2e2ada887..c4a453bf9 100644 --- a/src/server.c +++ b/src/server.c @@ -27,12 +27,12 @@ #include #include #include +#include #include #include #include #include -#include #include #include @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 308dbfacd..aa983bd03 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,6 @@ #include #include -#include #include #include diff --git a/src/stats.c b/src/stats.c index b527eafda..bc590660a 100644 --- a/src/stats.c +++ b/src/stats.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -51,12 +52,10 @@ #include #include -#include #include #include #include -#include #include #include #include diff --git a/src/stick_table.c b/src/stick_table.c index ebb903371..a79defc79 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include -#include #include #include diff --git a/src/stream.c b/src/stream.c index 0dd4745b9..e6058c5cf 100644 --- a/src/stream.c +++ b/src/stream.c @@ -34,20 +34,19 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include #include #include -#include #include #include #include diff --git a/src/uri_auth.c b/src/uri_auth.c index 236f57872..2005bc812 100644 --- a/src/uri_auth.c +++ b/src/uri_auth.c @@ -15,9 +15,9 @@ #include #include +#include #include -#include #include /*