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.
This commit is contained in:
Willy Tarreau 2020-06-03 15:26:55 +02:00
parent fa2ef5b5eb
commit 2dd7c35052
16 changed files with 33 additions and 34 deletions

View File

@ -43,7 +43,7 @@
#include <haproxy/namespace-t.h>
#include <import/eb32tree.h>
#include <import/eb32sctree.h>
#include <types/protocol.h>
#include <haproxy/protocol-t.h>
/* size used for max length of decimal representation of long long int. */
#define NB_LLMAX_STR (sizeof("-9223372036854775807")-1)

View File

@ -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 <sys/types.h>
#include <sys/socket.h>
#include <import/eb32tree.h>
#include <haproxy/api-t.h>
#include <haproxy/list-t.h>
#include <import/eb32tree.h>
/* 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:

View File

@ -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 <sys/socket.h>
#include <haproxy/protocol-t.h>
#include <haproxy/thread.h>
#include <types/protocol.h>
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:

View File

@ -31,7 +31,7 @@
#include <types/listener.h>
#include <types/obj_type.h>
#include <types/port_range.h>
#include <types/protocol.h>
#include <haproxy/protocol-t.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>

View File

@ -45,7 +45,7 @@
#include <proto/mux_pt.h>
#include <proto/obj_type.h>
#include <proto/payload.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/http_ana.h>
#include <proto/proto_tcp.h>
#include <proto/proxy.h>

View File

@ -24,7 +24,7 @@
#include <proto/http_htx.h>
#include <proto/http_rules.h>
#include <proto/listener.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/proxy.h>
#include <proto/server.h>
#include <proto/stick_table.h>

View File

@ -71,7 +71,7 @@
#include <proto/lb_map.h>
#include <proto/listener.h>
#include <proto/log.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/http_ana.h>
#include <proto/proxy.h>
#include <proto/peers.h>

View File

@ -59,7 +59,7 @@
#include <proto/queue.h>
#include <proto/port_range.h>
#include <proto/proto_tcp.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/proxy.h>
#include <proto/server.h>
#include <proto/signal.h>

View File

@ -54,7 +54,7 @@
#include <proto/log.h>
#include <proto/pattern.h>
#include <proto/pipe.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/listener.h>
#include <proto/map.h>
#include <proto/proxy.h>

View File

@ -121,7 +121,7 @@
#include <proto/log.h>
#include <proto/mworker.h>
#include <proto/pattern.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/http_ana.h>
#include <proto/proxy.h>
#include <proto/queue.h>

View File

@ -26,7 +26,7 @@
#include <haproxy/time.h>
#include <types/global.h>
#include <types/protocol.h>
#include <haproxy/protocol-t.h>
#include <proto/acl.h>
#include <proto/connection.h>
@ -34,7 +34,7 @@
#include <haproxy/freq_ctr.h>
#include <proto/log.h>
#include <proto/listener.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/proto_sockpair.h>
#include <proto/sample.h>
#include <proto/stream.h>

View File

@ -40,7 +40,7 @@
#include <haproxy/freq_ctr.h>
#include <proto/listener.h>
#include <proto/log.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/task.h>
static void sockpair_add_listener(struct listener *listener, int port);

View File

@ -49,7 +49,7 @@
#include <proto/listener.h>
#include <proto/log.h>
#include <proto/port_range.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/http_ana.h>
#include <proto/proto_tcp.h>
#include <proto/proxy.h>

View File

@ -39,7 +39,7 @@
#include <proto/fd.h>
#include <proto/listener.h>
#include <proto/log.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/task.h>
static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen);

View File

@ -18,7 +18,7 @@
#include <haproxy/list.h>
#include <common/standard.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
/* List head of all registered protocols */
static struct list protocols = LIST_HEAD_INIT(protocols);

View File

@ -35,7 +35,7 @@
#include <proto/checks.h>
#include <proto/connection.h>
#include <proto/port_range.h>
#include <proto/protocol.h>
#include <haproxy/protocol.h>
#include <proto/queue.h>
#include <proto/sample.h>
#include <proto/server.h>