From: Willy Tarreau Date: Wed, 3 Jun 2020 13:26:55 +0000 (+0200) Subject: REORG: include: move protocol.h to haproxy/protocol{,-t}.h X-Git-Tag: v2.2-dev9~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dd7c35052ea7577ca1341724633b5d029fe87fc;p=thirdparty%2Fhaproxy.git REORG: include: move protocol.h to haproxy/protocol{,-t}.h The protocol.h files are pretty low in the dependency and (sadly) used by some files from common/. Almost nothing was changed except lifting a few comments. --- diff --git a/include/common/standard.h b/include/common/standard.h index fdaa2a8ae8..ab8c075784 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include /* size used for max length of decimal representation of long long int. */ #define NB_LLMAX_STR (sizeof("-9223372036854775807")-1) diff --git a/include/types/protocol.h b/include/haproxy/protocol-t.h similarity index 95% rename from include/types/protocol.h rename to include/haproxy/protocol-t.h index 0c490682ac..cc762aefa6 100644 --- a/include/types/protocol.h +++ b/include/haproxy/protocol-t.h @@ -1,8 +1,8 @@ /* - * include/types/protocol.h + * include/haproxy/protocol-t.h * This file defines the structures used by generic network protocols. * - * Copyright (C) 2000-2012 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 @@ -19,15 +19,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _TYPES_PROTOCOL_H -#define _TYPES_PROTOCOL_H +#ifndef _HAPROXY_PROTOCOL_T_H +#define _HAPROXY_PROTOCOL_T_H #include #include +#include #include #include -#include /* some pointer types referenced below */ struct listener; @@ -37,7 +37,6 @@ struct connection; * Custom network family for str2sa parsing. Should be ok to do this since * sa_family_t is standardized as an unsigned integer */ - #define AF_CUST_SOCKPAIR (AF_MAX + 1) #define AF_CUST_MAX (AF_MAX + 2) @@ -48,11 +47,15 @@ struct connection; # error "Can't build on the target system, AF_CUST_MAX overflow" #endif - - /* max length of a protocol name, including trailing zero */ #define PROTO_NAME_LEN 16 +/* flags for ->connect() */ +#define CONNECT_HAS_DATA 0x00000001 /* There's data available to be sent */ +#define CONNECT_DELACK_SMART_CONNECT 0x00000002 /* Use a delayed ACK if the backend has tcp-smart-connect */ +#define CONNECT_DELACK_ALWAYS 0x00000004 /* Use a delayed ACK */ +#define CONNECT_CAN_USE_TFO 0x00000008 /* We can use TFO for this connection */ + /* This structure contains all information needed to easily handle a protocol. * Its primary goal is to ease listeners maintenance. Specifically, the * bind_all() primitive must be used before any fork(), and the enable_all() @@ -85,11 +88,7 @@ struct protocol { struct list list; /* list of registered protocols (under proto_lock) */ }; -#define CONNECT_HAS_DATA 0x00000001 /* There's data available to be sent */ -#define CONNECT_DELACK_SMART_CONNECT 0x00000002 /* Use a delayed ACK if the backend has tcp-smart-connect */ -#define CONNECT_DELACK_ALWAYS 0x00000004 /* Use a delayed ACK */ -#define CONNECT_CAN_USE_TFO 0x00000008 /* We can use TFO for this connection */ -#endif /* _TYPES_PROTOCOL_H */ +#endif /* _HAPROXY_PROTOCOL_T_H */ /* * Local variables: diff --git a/include/proto/protocol.h b/include/haproxy/protocol.h similarity index 91% rename from include/proto/protocol.h rename to include/haproxy/protocol.h index 36162a04b9..44d7b0334a 100644 --- a/include/proto/protocol.h +++ b/include/haproxy/protocol.h @@ -1,8 +1,8 @@ /* - * include/proto/protocol.h + * include/haproxy/protocol.h * This file declares generic protocol management primitives. * - * Copyright (C) 2000-2012 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 @@ -19,12 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _PROTO_PROTOCOL_H -#define _PROTO_PROTOCOL_H +#ifndef _HAPROXY_PROTOCOL_H +#define _HAPROXY_PROTOCOL_H #include +#include #include -#include extern struct protocol *__protocol_by_family[AF_CUST_MAX]; __decl_thread(extern HA_SPINLOCK_T proto_lock); @@ -63,7 +63,7 @@ static inline struct protocol *protocol_by_family(int family) return NULL; } -#endif /* _PROTO_PROTOCOL_H */ +#endif /* _HAPROXY_PROTOCOL_H */ /* * Local variables: diff --git a/include/types/connection.h b/include/types/connection.h index 601e5056c5..3f72855d5f 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/backend.c b/src/backend.c index e5ceda9eb5..a78aad8aa3 100644 --- a/src/backend.c +++ b/src/backend.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 438accc8ca..bd3e61e741 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cfgparse.c b/src/cfgparse.c index 8cdfb15a4b..b3a66b829a 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -71,7 +71,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/checks.c b/src/checks.c index 2b7aa8c792..4a1b87fda2 100644 --- a/src/checks.c +++ b/src/checks.c @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cli.c b/src/cli.c index 00cf507780..932af30389 100644 --- a/src/cli.c +++ b/src/cli.c @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/haproxy.c b/src/haproxy.c index 684ee2217a..4bf229cd9f 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -121,7 +121,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/listener.c b/src/listener.c index 04ce4e33f1..2f9c800b5f 100644 --- a/src/listener.c +++ b/src/listener.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index 446d8dee33..dfba155558 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include static void sockpair_add_listener(struct listener *listener, int port); diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 973a4d3138..42c034e031 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 99e4eff058..1dce1a93d1 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen); diff --git a/src/protocol.c b/src/protocol.c index 4909ee14a3..defb19721f 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -18,7 +18,7 @@ #include #include -#include +#include /* List head of all registered protocols */ static struct list protocols = LIST_HEAD_INIT(protocols); diff --git a/src/server.c b/src/server.c index 29919ee415..6f14e5af6e 100644 --- a/src/server.c +++ b/src/server.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include