#include <stdlib.h>
#include <types/channel.h>
-#include <types/connection.h>
+#include <haproxy/connection-t.h>
#include <types/http_ana.h>
#include <types/stream.h>
#include <types/stream_interface.h>
#endif
#endif
+/* Max number of file descriptors we send in one sendmsg(). Linux seems to be
+ * able to send 253 fds per sendmsg(), not sure about the other OSes.
+ */
+#define MAX_SEND_FD 253
+
#endif /* _HAPROXY_COMPAT_H */
/*
/*
- * include/types/connection.h
+ * include/haproxy/connection-t.h
* This file describes the connection struct and associated constants.
*
* Copyright (C) 2000-2014 Willy Tarreau - w@1wt.eu
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _TYPES_CONNECTION_H
-#define _TYPES_CONNECTION_H
+#ifndef _HAPROXY_CONNECTION_T_H
+#define _HAPROXY_CONNECTION_T_H
#include <stdlib.h>
#include <sys/socket.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip6.h>
-#include <haproxy/api-t.h>
#include <import/ist.h>
-#include <haproxy/obj_type-t.h>
+#include <haproxy/list-t.h>
#include <haproxy/listener-t.h>
+#include <haproxy/obj_type-t.h>
#include <haproxy/port_range-t.h>
#include <haproxy/protocol-t.h>
-
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip6.h>
+#include <haproxy/api-t.h>
/* referenced below */
struct connection;
struct session;
struct pipe;
-/* socks4 upstream proxy definitions */
-struct socks4_request {
- uint8_t version; /* SOCKS version number, 1 byte, must be 0x04 for this version */
- uint8_t command; /* 0x01 = establish a TCP/IP stream connection */
- uint16_t port; /* port number, 2 bytes (in network byte order) */
- uint32_t ip; /* IP address, 4 bytes (in network byte order) */
- char user_id[8]; /* the user ID string, variable length, terminated with a null (0x00); Using "HAProxy\0" */
-};
-
/* Note: subscribing to these events is only valid after the caller has really
* attempted to perform the operation, and failed to proceed or complete.
*/
SUB_RETRY_SEND = 0x00000002, /* Schedule the tasklet when we can attempt to send again */
};
-/* Describes a set of subscriptions. Multiple events may be registered at the
- * same time. The callee should assume everything not pending for completion is
- * implicitly possible. It's illegal to change the tasklet if events are still
- * registered.
- */
-struct wait_event {
- struct tasklet *tasklet;
- int events; /* set of enum sub_event_type above */
-};
-
-/* A connection handle is how we differentiate two connections on the lower
- * layers. It usually is a file descriptor but can be a connection id.
- */
-union conn_handle {
- int fd; /* file descriptor, for regular sockets */
-};
-
/* conn_stream flags */
enum {
CS_FL_NONE = 0x00000000, /* Just for initialization purposes */
MX_FL_HTX = 0x00000002, /* set if it is an HTX multiplexer */
};
+/* PROTO token registration */
+enum proto_proxy_mode {
+ PROTO_MODE_NONE = 0,
+ PROTO_MODE_TCP = 1 << 0, // must not be changed!
+ PROTO_MODE_HTTP = 1 << 1, // must not be changed!
+ PROTO_MODE_ANY = PROTO_MODE_TCP | PROTO_MODE_HTTP,
+};
+
+enum proto_proxy_side {
+ PROTO_SIDE_NONE = 0,
+ PROTO_SIDE_FE = 1, // same as PR_CAP_FE
+ PROTO_SIDE_BE = 2, // same as PR_CAP_BE
+ PROTO_SIDE_BOTH = PROTO_SIDE_FE | PROTO_SIDE_BE,
+};
+
+/* ctl command used by mux->ctl() */
+enum mux_ctl_type {
+ MUX_STATUS, /* Expects an int as output, sets it to a combinaison of MUX_STATUS flags */
+};
+
+/* response for ctl MUX_STATUS */
+#define MUX_STATUS_READY (1 << 0)
+
+/* socks4 response length */
+#define SOCKS4_HS_RSP_LEN 8
+
+/* socks4 upstream proxy definitions */
+struct socks4_request {
+ uint8_t version; /* SOCKS version number, 1 byte, must be 0x04 for this version */
+ uint8_t command; /* 0x01 = establish a TCP/IP stream connection */
+ uint16_t port; /* port number, 2 bytes (in network byte order) */
+ uint32_t ip; /* IP address, 4 bytes (in network byte order) */
+ char user_id[8]; /* the user ID string, variable length, terminated with a null (0x00); Using "HAProxy\0" */
+};
+
+/* Describes a set of subscriptions. Multiple events may be registered at the
+ * same time. The callee should assume everything not pending for completion is
+ * implicitly possible. It's illegal to change the tasklet if events are still
+ * registered.
+ */
+struct wait_event {
+ struct tasklet *tasklet;
+ int events; /* set of enum sub_event_type above */
+};
+
+/* A connection handle is how we differentiate two connections on the lower
+ * layers. It usually is a file descriptor but can be a connection id.
+ */
+union conn_handle {
+ int fd; /* file descriptor, for regular sockets */
+};
+
/* xprt_ops describes transport-layer operations for a connection. They
* generally run over a socket-based control layer, but not always. Some
* of them are used for data transfer with the upper layer (rcv_*, snd_*)
int (*add_xprt)(struct connection *conn, void *xprt_ctx, void *toadd_ctx, const struct xprt_ops *toadd_ops, void **oldxprt_ctx, const struct xprt_ops **oldxprt_ops); /* Add a new XPRT as the new xprt, and return the old one */
};
-enum mux_ctl_type {
- MUX_STATUS, /* Expects an int as output, sets it to a combinaison of MUX_STATUS flags */
-};
-
-#define MUX_STATUS_READY (1 << 0)
-
/* mux_ops describes the mux operations, which are to be performed at the
* connection level after data are exchanged with the transport layer in order
* to propagate them to streams. The <init> function will automatically be
/* a connection source profile defines all the parameters needed to properly
* bind an outgoing connection for a server or proxy.
*/
-
struct conn_src {
unsigned int opts; /* CO_SRC_* */
int iface_len; /* bind interface name length */
struct ist proxy_unique_id; /* Value of the unique ID TLV received via PROXYv2 */
};
-/* PROTO token registration */
-enum proto_proxy_mode {
- PROTO_MODE_NONE = 0,
- PROTO_MODE_TCP = 1 << 0, // must not be changed!
- PROTO_MODE_HTTP = 1 << 1, // must not be changed!
- PROTO_MODE_ANY = PROTO_MODE_TCP | PROTO_MODE_HTTP,
-};
-
-enum proto_proxy_side {
- PROTO_SIDE_NONE = 0,
- PROTO_SIDE_FE = 1, // same as PR_CAP_FE
- PROTO_SIDE_BE = 2, // same as PR_CAP_BE
- PROTO_SIDE_BOTH = PROTO_SIDE_FE | PROTO_SIDE_BE,
-};
-
struct mux_proto_list {
const struct ist token; /* token name and length. Empty is catch-all */
enum proto_proxy_mode mode;
struct list list;
};
+/* proxy protocol stuff below */
+
/* proxy protocol v2 definitions */
#define PP2_SIGNATURE "\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A"
#define PP2_SIGNATURE_LEN 12
#define PP2_HDR_LEN_INET6 (PP2_HEADER_LEN + PP2_ADDR_LEN_INET6)
#define PP2_HDR_LEN_UNIX (PP2_HEADER_LEN + PP2_ADDR_LEN_UNIX)
+#define PP2_TYPE_ALPN 0x01
+#define PP2_TYPE_AUTHORITY 0x02
+#define PP2_TYPE_CRC32C 0x03
+#define PP2_TYPE_NOOP 0x04
+#define PP2_TYPE_UNIQUE_ID 0x05
+#define PP2_TYPE_SSL 0x20
+#define PP2_SUBTYPE_SSL_VERSION 0x21
+#define PP2_SUBTYPE_SSL_CN 0x22
+#define PP2_SUBTYPE_SSL_CIPHER 0x23
+#define PP2_SUBTYPE_SSL_SIG_ALG 0x24
+#define PP2_SUBTYPE_SSL_KEY_ALG 0x25
+#define PP2_TYPE_NETNS 0x30
+
+#define PP2_CLIENT_SSL 0x01
+#define PP2_CLIENT_CERT_CONN 0x02
+#define PP2_CLIENT_CERT_SESS 0x04
+
+/* Max length of the authority TLV */
+#define PP2_AUTHORITY_MAX 255
+
+#define TLV_HEADER_SIZE 3
+
struct proxy_hdr_v2 {
uint8_t sig[12]; /* hex 0D 0A 0D 0A 00 0D 0A 51 55 49 54 0A */
uint8_t ver_cmd; /* protocol version and command */
} addr;
};
-#define PP2_TYPE_ALPN 0x01
-#define PP2_TYPE_AUTHORITY 0x02
-#define PP2_TYPE_CRC32C 0x03
-#define PP2_TYPE_NOOP 0x04
-#define PP2_TYPE_UNIQUE_ID 0x05
-#define PP2_TYPE_SSL 0x20
-#define PP2_SUBTYPE_SSL_VERSION 0x21
-#define PP2_SUBTYPE_SSL_CN 0x22
-#define PP2_SUBTYPE_SSL_CIPHER 0x23
-#define PP2_SUBTYPE_SSL_SIG_ALG 0x24
-#define PP2_SUBTYPE_SSL_KEY_ALG 0x25
-#define PP2_TYPE_NETNS 0x30
-
-#define TLV_HEADER_SIZE 3
struct tlv {
uint8_t type;
uint8_t length_hi;
uint8_t sub_tlv[0];
}__attribute__((packed));
-#define PP2_CLIENT_SSL 0x01
-#define PP2_CLIENT_CERT_CONN 0x02
-#define PP2_CLIENT_CERT_SESS 0x04
-
-/* Max length of the authority TLV */
-#define PP2_AUTHORITY_MAX 255
-
-/*
- * Linux seems to be able to send 253 fds per sendmsg(), not sure
- * about the other OSes.
- */
-/* Max number of file descriptors we send in one sendmsg() */
-#define MAX_SEND_FD 253
-
-#define SOCKS4_HS_RSP_LEN 8
-#endif /* _TYPES_CONNECTION_H */
+#endif /* _HAPROXY_CONNECTION_T_H */
/*
* Local variables:
/*
- * include/proto/connection.h
+ * include/haproxy/connection.h
* This file contains connection function prototypes
*
- * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-2002 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _PROTO_CONNECTION_H
-#define _PROTO_CONNECTION_H
+#ifndef _HAPROXY_CONNECTION_H
+#define _HAPROXY_CONNECTION_H
#include <import/ist.h>
+
#include <haproxy/api.h>
+#include <haproxy/connection-t.h>
+#include <haproxy/fd.h>
#include <haproxy/listener-t.h>
#include <haproxy/obj_type.h>
#include <haproxy/pool.h>
-#include <types/connection.h>
-#include <haproxy/fd.h>
+#include <haproxy/task-t.h>
+
#include <proto/session.h>
-#include <haproxy/task.h>
extern struct pool_head *pool_head_connection;
extern struct pool_head *pool_head_connstream;
return 0;
}
-#endif /* _PROTO_CONNECTION_H */
+#endif /* _HAPROXY_CONNECTION_H */
/*
* Local variables:
#include <import/eb32tree.h>
+#include <haproxy/connection-t.h>
#include <haproxy/obj_type-t.h>
#include <haproxy/list-t.h>
#include <haproxy/thread.h>
-#include <types/connection.h>
#include <haproxy/proto_udp-t.h>
#include <haproxy/task-t.h>
#define _HAPROXY_OBJ_TYPE_H
#include <haproxy/api.h>
+#include <haproxy/connection-t.h>
#include <haproxy/listener-t.h>
#include <haproxy/obj_type-t.h>
#include <haproxy/pool.h>
#include <types/applet.h>
-#include <types/connection.h>
#include <types/proxy.h>
#include <types/server.h>
#include <types/stream.h>
#include <haproxy/arg-t.h>
#include <haproxy/api.h>
+#include <haproxy/connection-t.h>
#include <haproxy/listener-t.h>
#include <haproxy/sample-t.h>
-#include <types/connection.h>
int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote);
int tcp_pause_listener(struct listener *l);
#define _PROTO_PEERS_H
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/ticks.h>
#include <haproxy/time.h>
-#include <proto/connection.h>
#include <types/stream.h>
#include <types/peers.h>
#define _PROTO_SSL_SOCK_H
#ifdef USE_OPENSSL
+#include <haproxy/connection.h>
#include <haproxy/openssl-compat.h>
-#include <types/connection.h>
#include <types/proxy.h>
#include <types/ssl_sock.h>
#include <types/stream_interface.h>
-#include <proto/connection.h>
extern int sslconns;
extern int totalsslconns;
#include <stdlib.h>
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <types/stream.h>
#include <types/stream_interface.h>
#include <proto/applet.h>
#include <proto/channel.h>
-#include <proto/connection.h>
extern struct si_ops si_embedded_ops;
#include <import/ebpttree.h>
#include <import/ist.h>
+#include <haproxy/connection-t.h>
#include <haproxy/list-t.h>
#include <haproxy/obj_type-t.h>
#include <haproxy/regex-t.h>
#include <haproxy/buf-t.h>
-#include <types/connection.h>
#include <haproxy/sample-t.h>
#include <types/session.h>
#include <haproxy/task-t.h>
#include <import/eb32tree.h>
-#include <types/connection.h>
+#include <haproxy/connection-t.h>
#include <haproxy/freq_ctr-t.h>
#include <types/queue.h>
#include <types/ssl_sock.h>
#include <import/ebmbtree.h>
#include <import/eb64tree.h>
-#include <types/connection.h> /* struct wait_event */
+#include <haproxy/connection-t.h> /* struct wait_event */
#include <haproxy/buf-t.h>
#include <haproxy/thread.h>
#include <haproxy/capture-t.h>
#include <haproxy/compression-t.h>
+#include <haproxy/connection.h>
#include <haproxy/http_htx.h>
#include <haproxy/http_rules.h>
#include <haproxy/listener.h>
#include <proto/acl.h>
#include <proto/checks.h>
-#include <proto/connection.h>
#include <haproxy/protocol.h>
#include <proto/proxy.h>
#include <proto/server.h>
#include <haproxy/capture.h>
#include <common/cfgparse.h>
#include <haproxy/chunk.h>
+#include <haproxy/connection.h>
#include <haproxy/dns.h>
#include <haproxy/errors.h>
#include <haproxy/frontend.h>
#include <proto/stream.h>
#include <proto/stick_table.h>
#include <haproxy/tcp_rules.h>
-#include <proto/connection.h>
/* Used to chain configuration sections definitions. This list
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/frontend.h>
#include <haproxy/namespace.h>
#include <haproxy/hash.h>
#include <haproxy/net_helper.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <haproxy/proto_tcp.h>
#include <proto/stream_interface.h>
#include <haproxy/base64.h>
#include <common/cfgparse.h>
#include <haproxy/chunk.h>
+#include <haproxy/connection.h>
#include <haproxy/dns.h>
#include <haproxy/dynbuf.h>
#include <haproxy/errors.h>
#include <proto/backend.h>
#include <proto/channel.h>
#include <proto/cli.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <proto/filters.h>
#include <proto/log.h>
#include <import/ebpttree.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/http_htx.h>
#include <haproxy/thread.h>
#include <haproxy/regex.h>
#include <proto/applet.h>
#include <proto/channel.h>
#include <proto/cli.h>
-#include <proto/connection.h>
#include <proto/stats.h>
#include <proto/http_fetch.h>
#include <proto/queue.h>
#include <haproxy/action-t.h>
#include <haproxy/api.h>
#include <haproxy/base64.h>
+#include <haproxy/connection.h>
#include <haproxy/http.h>
#include <haproxy/http_htx.h>
#include <haproxy/htx.h>
#include <proto/acl.h>
#include <proto/channel.h>
#include <proto/checks.h>
-#include <proto/connection.h>
#include <proto/filters.h>
#include <proto/log.h>
#include <proto/http_ana.h>
#include <haproxy/api.h>
#include <haproxy/base64.h>
#include <haproxy/chunk.h>
+#include <haproxy/connection.h>
#include <haproxy/global.h>
#include <haproxy/h1.h>
#include <haproxy/h1_htx.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
-#include <proto/connection.h>
#include <proto/http_fetch.h>
#include <proto/log.h>
#include <proto/http_ana.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/errors.h>
#include <haproxy/global.h>
#include <haproxy/list.h>
#include <haproxy/protocol-t.h>
#include <proto/acl.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/fcgi.h>
#include <haproxy/h1.h>
#include <haproxy/h1_htx.h>
#include <types/proxy.h>
#include <types/session.h>
-#include <proto/connection.h>
#include <proto/fcgi-app.h>
#include <proto/log.h>
#include <proto/session.h>
#include <haproxy/api.h>
#include <haproxy/istbuf.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/h1.h>
#include <haproxy/h1_htx.h>
#include <haproxy/h2.h>
#include <types/proxy.h>
#include <types/session.h>
-#include <proto/connection.h>
#include <haproxy/http_htx.h>
#include <proto/log.h>
#include <proto/session.h>
#include <haproxy/api.h>
#include <haproxy/istbuf.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/h1.h>
#include <haproxy/h2.h>
#include <haproxy/hpack-dec.h>
#include <haproxy/http_htx.h>
#include <haproxy/htx.h>
#include <haproxy/net_helper.h>
-#include <proto/connection.h>
#include <proto/trace.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <haproxy/api.h>
#include <haproxy/buf.h>
+#include <haproxy/connection.h>
#include <haproxy/task.h>
-#include <proto/connection.h>
#include <proto/stream.h>
struct mux_pt_ctx {
#include <string.h>
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/net_helper.h>
#include <haproxy/payload.h>
#include <haproxy/pattern.h>
#include <proto/acl.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
-#include <proto/connection.h>
#include <haproxy/sample.h>
#include <proto/http_ana.h>
#include <sys/un.h>
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/errors.h>
#include <haproxy/global.h>
#include <haproxy/list.h>
#include <haproxy/time.h>
#include <haproxy/version.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>
#include <haproxy/action-t.h>
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/errors.h>
#include <haproxy/global.h>
#include <haproxy/http_rules.h>
#include <haproxy/tools.h>
#include <haproxy/namespace.h>
-#include <types/connection.h>
#include <types/stream.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <proto/log.h>
#include <haproxy/port_range.h>
#include <sys/un.h>
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/errors.h>
#include <haproxy/global.h>
#include <haproxy/list.h>
#include <haproxy/time.h>
#include <haproxy/version.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <proto/log.h>
#include <haproxy/protocol.h>
#include <haproxy/api.h>
#include <haproxy/buf.h>
+#include <haproxy/connection.h>
#include <haproxy/global.h>
#include <haproxy/tools.h>
#include <haproxy/ticks.h>
#include <haproxy/time.h>
-#include <proto/connection.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>
#include <import/xxhash.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/dict-t.h>
#include <haproxy/dns.h>
#include <haproxy/errors.h>
#include <proto/applet.h>
#include <proto/cli.h>
#include <proto/checks.h>
-#include <proto/connection.h>
#include <haproxy/port_range.h>
#include <haproxy/protocol.h>
#include <proto/queue.h>
*/
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/global.h>
#include <haproxy/http.h>
#include <haproxy/listener.h>
#include <types/session.h>
-#include <proto/connection.h>
#include <proto/log.h>
#include <proto/proxy.h>
#include <proto/session.h>
#include <haproxy/dynbuf.h>
#include <haproxy/chunk.h>
+#include <haproxy/connection.h>
#include <haproxy/errors.h>
#include <haproxy/frontend.h>
#include <haproxy/global.h>
#include <proto/acl.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
-#include <proto/connection.h>
#include <proto/cli.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <haproxy/api.h>
#include <haproxy/capture.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/dict.h>
#include <haproxy/dns.h>
#include <haproxy/dynbuf.h>
#include <proto/channel.h>
#include <proto/checks.h>
#include <proto/cli.h>
-#include <proto/connection.h>
#include <proto/stats.h>
#include <haproxy/fd.h>
#include <proto/filters.h>
#include <sys/types.h>
#include <haproxy/api.h>
+#include <haproxy/connection.h>
#include <haproxy/dynbuf.h>
#include <haproxy/http_htx.h>
#include <haproxy/tools.h>
#include <proto/applet.h>
#include <proto/channel.h>
-#include <proto/connection.h>
#include <haproxy/pipe.h>
#include <proto/proxy.h>
#include <proto/stream.h>
#include <haproxy/api.h>
#include <haproxy/capture-t.h>
#include <common/cfgparse.h>
+#include <haproxy/connection.h>
#include <haproxy/global.h>
#include <haproxy/list.h>
#include <haproxy/sample.h>
#include <haproxy/time.h>
#include <haproxy/arg-t.h>
-#include <types/connection.h>
#include <proto/acl.h>
#include <proto/channel.h>
-#include <proto/connection.h>
#include <proto/log.h>
#include <proto/proxy.h>
#include <proto/stick_table.h>
*
*/
-#include <proto/connection.h>
+#include <haproxy/connection.h>
#include <proto/stream_interface.h>
struct xprt_handshake_ctx {