blob: d5d939d6d4c3ca84962c17e2a3574eae0de4c1e3 [file] [log] [blame]
Willy Tarreau53a47662017-08-28 10:53:00 +02001/*
2 * Pass-through mux-demux for connections
3 *
4 * Copyright 2017 Willy Tarreau <w@1wt.eu>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <common/config.h>
Willy Tarreau0108d902018-11-25 19:14:37 +010014#include <common/initcall.h>
Willy Tarreau53a47662017-08-28 10:53:00 +020015#include <proto/connection.h>
16#include <proto/stream.h>
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010017#include <proto/task.h>
18
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010019struct mux_pt_ctx {
20 struct conn_stream *cs;
21 struct connection *conn;
22 struct wait_event wait_event;
23};
24
Willy Tarreau8ceae722018-11-26 11:58:30 +010025DECLARE_STATIC_POOL(pool_head_pt_ctx, "mux_pt", sizeof(struct mux_pt_ctx));
26
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010027static void mux_pt_destroy(struct mux_pt_ctx *ctx)
28{
Christopher Faulet61840e72019-04-15 09:33:32 +020029 /* The connection must be aattached to this mux to be released */
30 if (ctx && ctx->conn && ctx->conn->ctx == ctx) {
31 struct connection *conn = ctx->conn;
Christopher Faulet39a96ee2019-04-08 10:52:21 +020032
Christopher Faulet39a96ee2019-04-08 10:52:21 +020033 conn_stop_tracking(conn);
34 conn_full_close(conn);
Willy Tarreau3c39a7d2019-06-14 14:42:29 +020035 tasklet_free(ctx->wait_event.tasklet);
Christopher Faulet39a96ee2019-04-08 10:52:21 +020036 conn->mux = NULL;
37 conn->ctx = NULL;
38 if (conn->destroy_cb)
39 conn->destroy_cb(conn);
40 /* We don't bother unsubscribing here, as we're about to destroy
41 * both the connection and the mux_pt_ctx
42 */
43 conn_free(conn);
44 }
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010045 pool_free(pool_head_pt_ctx, ctx);
46}
47
48/* Callback, used when we get I/Os while in idle mode */
49static struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned short status)
50{
51 struct mux_pt_ctx *ctx = tctx;
52
Olivier Houcharda5115f22019-10-18 13:56:40 +020053 if (ctx->cs) {
54 /* There's a small race condition.
55 * mux_pt_io_cb() is only supposed to be called if we have no
56 * stream attached. However, maybe the tasklet got woken up,
57 * and this connection was then attached to a new stream.
58 * If this happened, just call the wake method. It is probably
59 * not needed, because the stream probably subscribed to
60 * receive events, but that way we'll be sure the event got
61 * noticed, and if we had any error on the connection, we will
62 * let the stream call the detach method to destroy it.
63 */
64 if (ctx->cs->data_cb->wake)
65 ctx->cs->data_cb->wake(ctx->cs);
66 return NULL;
67 }
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010068 conn_sock_drain(ctx->conn);
Olivier Houchard6d206de2019-10-18 10:59:30 +020069 if (ctx->conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH))
70 mux_pt_destroy(ctx);
71 else
Olivier Houcharde179d0e2019-03-21 18:27:17 +010072 ctx->conn->xprt->subscribe(ctx->conn, ctx->conn->xprt_ctx, SUB_RETRY_RECV,
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010073 &ctx->wait_event);
74
75 return NULL;
76}
Willy Tarreau53a47662017-08-28 10:53:00 +020077
Willy Tarreau3d2ee552018-12-19 14:12:10 +010078/* Initialize the mux once it's attached. It is expected that conn->ctx
Olivier Houchard9aaf7782017-09-13 18:30:23 +020079 * points to the existing conn_stream (for outgoing connections) or NULL (for
80 * incoming ones, in which case one will be allocated and a new stream will be
81 * instanciated). Returns < 0 on error.
Willy Tarreau53a47662017-08-28 10:53:00 +020082 */
Christopher Faulet51f73eb2019-04-08 11:22:47 +020083static int mux_pt_init(struct connection *conn, struct proxy *prx, struct session *sess,
84 struct buffer *input)
Willy Tarreau53a47662017-08-28 10:53:00 +020085{
Willy Tarreau3d2ee552018-12-19 14:12:10 +010086 struct conn_stream *cs = conn->ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010087 struct mux_pt_ctx *ctx = pool_alloc(pool_head_pt_ctx);
88
89 if (!ctx)
90 goto fail;
91
Willy Tarreau3c39a7d2019-06-14 14:42:29 +020092 ctx->wait_event.tasklet = tasklet_new();
93 if (!ctx->wait_event.tasklet)
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010094 goto fail_free_ctx;
Willy Tarreau3c39a7d2019-06-14 14:42:29 +020095 ctx->wait_event.tasklet->context = ctx;
96 ctx->wait_event.tasklet->process = mux_pt_io_cb;
Willy Tarreau4f6516d2018-12-19 13:59:17 +010097 ctx->wait_event.events = 0;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010098 ctx->conn = conn;
Olivier Houchard9aaf7782017-09-13 18:30:23 +020099
100 if (!cs) {
101 cs = cs_new(conn);
102 if (!cs)
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100103 goto fail_free_ctx;
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200104
105 if (stream_create_from_cs(cs) < 0)
106 goto fail_free;
107
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200108 }
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100109 conn->ctx = ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100110 ctx->cs = cs;
Olivier Houchard8706c812018-12-04 19:17:25 +0100111 cs->flags |= CS_FL_RCV_MORE;
Willy Tarreau53a47662017-08-28 10:53:00 +0200112 return 0;
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200113
114 fail_free:
115 cs_free(cs);
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100116fail_free_ctx:
Willy Tarreau3c39a7d2019-06-14 14:42:29 +0200117 if (ctx->wait_event.tasklet)
118 tasklet_free(ctx->wait_event.tasklet);
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100119 pool_free(pool_head_pt_ctx, ctx);
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200120 fail:
121 return -1;
Willy Tarreau53a47662017-08-28 10:53:00 +0200122}
123
124/* callback to be used by default for the pass-through mux. It calls the data
125 * layer wake() callback if it is set otherwise returns 0.
126 */
127static int mux_pt_wake(struct connection *conn)
128{
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100129 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100130 struct conn_stream *cs = ctx->cs;
131 int ret = 0;
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200132
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100133 if (cs) {
134 ret = cs->data_cb->wake ? cs->data_cb->wake(cs) : 0;
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200135
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100136 if (ret < 0)
137 return ret;
138 } else {
139 conn_sock_drain(conn);
140 if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH)) {
141 mux_pt_destroy(ctx);
142 return -1;
143 }
144 }
Willy Tarreauad7f0ad2018-08-24 15:48:59 +0200145
Olivier Houchard7fc96d52017-11-23 18:25:47 +0100146 /* If we had early data, and we're done with the handshake
147 * then whe know the data are safe, and we can remove the flag.
148 */
149 if ((conn->flags & (CO_FL_EARLY_DATA | CO_FL_EARLY_SSL_HS | CO_FL_HANDSHAKE)) ==
150 CO_FL_EARLY_DATA)
151 conn->flags &= ~CO_FL_EARLY_DATA;
Willy Tarreaued339a32017-11-03 15:55:24 +0100152 return ret;
Willy Tarreau53a47662017-08-28 10:53:00 +0200153}
154
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200155/*
156 * Attach a new stream to a connection
157 * (Used for outgoing connections)
158 */
Olivier Houchardf502aca2018-12-14 19:42:40 +0100159static struct conn_stream *mux_pt_attach(struct connection *conn, struct session *sess)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200160{
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100161 struct conn_stream *cs;
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100162 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100163
Olivier Houcharda24832f2019-08-10 23:56:16 +0200164 if (ctx->wait_event.events)
165 conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100166 cs = cs_new(conn);
167 if (!cs)
168 goto fail;
169
170 ctx->cs = cs;
Olivier Houchard8706c812018-12-04 19:17:25 +0100171 cs->flags |= CS_FL_RCV_MORE;
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100172 return (cs);
173fail:
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200174 return NULL;
175}
176
Willy Tarreaufafd3982018-11-18 21:29:20 +0100177/* Retrieves a valid conn_stream from this connection, or returns NULL. For
178 * this mux, it's easy as we can only store a single conn_stream.
179 */
180static const struct conn_stream *mux_pt_get_first_cs(const struct connection *conn)
181{
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100182 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100183 struct conn_stream *cs = ctx->cs;
Willy Tarreaufafd3982018-11-18 21:29:20 +0100184
185 return cs;
186}
187
Christopher Faulet73c12072019-04-08 11:23:22 +0200188/* Destroy the mux and the associated connection if still attached to this mux
189 * and no longer used */
190static void mux_pt_destroy_meth(void *ctx)
Olivier Houchard060ed432018-11-06 16:32:42 +0100191{
Christopher Faulet73c12072019-04-08 11:23:22 +0200192 struct mux_pt_ctx *pt = ctx;
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100193
Christopher Faulet39a96ee2019-04-08 10:52:21 +0200194 if (!(pt->cs) || !(pt->conn) || pt->conn->ctx != pt)
Christopher Faulet73c12072019-04-08 11:23:22 +0200195 mux_pt_destroy(pt);
Olivier Houchard060ed432018-11-06 16:32:42 +0100196}
197
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200198/*
Willy Tarreau2c52a2b2017-10-08 11:00:17 +0200199 * Detach the stream from the connection and possibly release the connection.
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200200 */
201static void mux_pt_detach(struct conn_stream *cs)
202{
Willy Tarreau2c52a2b2017-10-08 11:00:17 +0200203 struct connection *conn = cs->conn;
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100204 struct mux_pt_ctx *ctx = cs->conn->ctx;
Willy Tarreau2c52a2b2017-10-08 11:00:17 +0200205
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100206 /* Subscribe, to know if we got disconnected */
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100207 if (conn->owner != NULL &&
208 !(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH))) {
209 ctx->cs = NULL;
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100210 conn->xprt->subscribe(conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
Olivier Houchard6d206de2019-10-18 10:59:30 +0200211 } else
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100212 /* There's no session attached to that connection, destroy it */
213 mux_pt_destroy(ctx);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200214}
215
Willy Tarreau00f18a32019-01-26 12:19:01 +0100216/* returns the number of streams in use on a connection */
217static int mux_pt_used_streams(struct connection *conn)
Olivier Houchardd540b362018-11-05 18:37:53 +0100218{
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100219 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchardd540b362018-11-05 18:37:53 +0100220
Willy Tarreau00f18a32019-01-26 12:19:01 +0100221 return ctx->cs ? 1 : 0;
Olivier Houchardd540b362018-11-05 18:37:53 +0100222}
223
Willy Tarreau00f18a32019-01-26 12:19:01 +0100224/* returns the number of streams still available on a connection */
225static int mux_pt_avail_streams(struct connection *conn)
Olivier Houchard8defe4b2018-12-02 01:31:17 +0100226{
Willy Tarreau00f18a32019-01-26 12:19:01 +0100227 return 1 - mux_pt_used_streams(conn);
Olivier Houchard8defe4b2018-12-02 01:31:17 +0100228}
229
Willy Tarreauecdb3fe2017-10-05 15:25:48 +0200230static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200231{
Willy Tarreau4b795242017-10-05 18:47:38 +0200232 if (cs->flags & CS_FL_SHR)
233 return;
Christopher Fauletd94f8772018-12-17 13:21:02 +0100234 cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200235 if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutr)
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100236 cs->conn->xprt->shutr(cs->conn, cs->conn->xprt_ctx,
237 (mode == CS_SHR_DRAIN));
Willy Tarreau4b795242017-10-05 18:47:38 +0200238 if (cs->flags & CS_FL_SHW)
239 conn_full_close(cs->conn);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100240 /* Maybe we've been put in the list of available idle connections,
241 * get ouf of here
242 */
243 LIST_DEL(&cs->conn->list);
244 LIST_INIT(&cs->conn->list);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200245}
246
Willy Tarreauecdb3fe2017-10-05 15:25:48 +0200247static void mux_pt_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200248{
Willy Tarreau4b795242017-10-05 18:47:38 +0200249 if (cs->flags & CS_FL_SHW)
250 return;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200251 if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutw)
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100252 cs->conn->xprt->shutw(cs->conn, cs->conn->xprt_ctx,
253 (mode == CS_SHW_NORMAL));
Willy Tarreau4b795242017-10-05 18:47:38 +0200254 if (!(cs->flags & CS_FL_SHR))
Willy Tarreaua48c1412017-12-22 18:46:33 +0100255 conn_sock_shutw(cs->conn, (mode == CS_SHW_NORMAL));
Willy Tarreau4b795242017-10-05 18:47:38 +0200256 else
257 conn_full_close(cs->conn);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100258 /* Maybe we've been put in the list of available idle connections,
259 * get ouf of here
260 */
261 LIST_DEL(&cs->conn->list);
262 LIST_INIT(&cs->conn->list);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200263}
264
265/*
266 * Called from the upper layer, to get more data
267 */
Willy Tarreau7f3225f2018-06-19 06:15:17 +0200268static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200269{
Willy Tarreaud9cf5402018-07-18 11:29:06 +0200270 size_t ret;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200271
Christopher Faulet4eb7d742018-10-11 15:29:21 +0200272 if (!count) {
Christopher Fauletd94f8772018-12-17 13:21:02 +0100273 cs->flags |= (CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Christopher Faulet4eb7d742018-10-11 15:29:21 +0200274 return 0;
275 }
Willy Tarreaue0f24ee2018-12-14 10:51:23 +0100276 b_realign_if_empty(buf);
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100277 ret = cs->conn->xprt->rcv_buf(cs->conn, cs->conn->xprt_ctx, buf, count, flags);
Olivier Houchard8706c812018-12-04 19:17:25 +0100278 if (conn_xprt_read0_pending(cs->conn)) {
Willy Tarreaua9559572019-07-15 06:47:54 +0200279 cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Christopher Faulet87a8f352019-03-22 14:51:36 +0100280 cs->flags |= CS_FL_EOS;
Olivier Houchard8706c812018-12-04 19:17:25 +0100281 }
282 if (cs->conn->flags & CO_FL_ERROR) {
Willy Tarreaua9559572019-07-15 06:47:54 +0200283 cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Willy Tarreau4ff3b892017-10-16 15:17:17 +0200284 cs->flags |= CS_FL_ERROR;
Olivier Houchard8706c812018-12-04 19:17:25 +0100285 }
Willy Tarreaud9cf5402018-07-18 11:29:06 +0200286 return ret;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200287}
288
289/* Called from the upper layer, to send data */
Christopher Fauletd44a9b32018-07-27 11:59:41 +0200290static size_t mux_pt_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200291{
Olivier Houchardb72d98a2018-11-30 13:17:48 +0100292 size_t ret;
293
294 if (cs->conn->flags & CO_FL_HANDSHAKE)
295 return 0;
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100296 ret = cs->conn->xprt->snd_buf(cs->conn, cs->conn->xprt_ctx, buf, count, flags);
Christopher Fauletd44a9b32018-07-27 11:59:41 +0200297
298 if (ret > 0)
299 b_del(buf, ret);
300 return ret;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200301}
302
Olivier Houchard6ff20392018-07-17 18:46:31 +0200303/* Called from the upper layer, to subscribe to events */
304static int mux_pt_subscribe(struct conn_stream *cs, int event_type, void *param)
305{
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100306 return (cs->conn->xprt->subscribe(cs->conn, cs->conn->xprt_ctx, event_type, param));
Olivier Houchard6ff20392018-07-17 18:46:31 +0200307}
308
Olivier Houchard83a0cd82018-09-28 17:57:58 +0200309static int mux_pt_unsubscribe(struct conn_stream *cs, int event_type, void *param)
310{
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100311 return (cs->conn->xprt->unsubscribe(cs->conn, cs->conn->xprt_ctx, event_type, param));
Olivier Houchard83a0cd82018-09-28 17:57:58 +0200312}
313
Willy Tarreaue5733232019-05-22 19:24:06 +0200314#if defined(USE_LINUX_SPLICE)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200315/* Send and get, using splicing */
316static int mux_pt_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int count)
317{
318 int ret;
319
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100320 ret = cs->conn->xprt->rcv_pipe(cs->conn, cs->conn->xprt_ctx, pipe, count);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200321 if (conn_xprt_read0_pending(cs->conn))
Christopher Faulet87a8f352019-03-22 14:51:36 +0100322 cs->flags |= CS_FL_EOS;
Willy Tarreau4ff3b892017-10-16 15:17:17 +0200323 if (cs->conn->flags & CO_FL_ERROR)
324 cs->flags |= CS_FL_ERROR;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200325 return (ret);
326}
327
328static int mux_pt_snd_pipe(struct conn_stream *cs, struct pipe *pipe)
329{
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100330 return (cs->conn->xprt->snd_pipe(cs->conn, cs->conn->xprt_ctx, pipe));
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200331}
Olivier Houchard7da120b2017-11-01 13:55:10 +0100332#endif
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200333
Willy Tarreau53a47662017-08-28 10:53:00 +0200334/* The mux operations */
335const struct mux_ops mux_pt_ops = {
336 .init = mux_pt_init,
Willy Tarreau53a47662017-08-28 10:53:00 +0200337 .wake = mux_pt_wake,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200338 .rcv_buf = mux_pt_rcv_buf,
339 .snd_buf = mux_pt_snd_buf,
Olivier Houchard6ff20392018-07-17 18:46:31 +0200340 .subscribe = mux_pt_subscribe,
Olivier Houchard83a0cd82018-09-28 17:57:58 +0200341 .unsubscribe = mux_pt_unsubscribe,
Willy Tarreaue5733232019-05-22 19:24:06 +0200342#if defined(USE_LINUX_SPLICE)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200343 .rcv_pipe = mux_pt_rcv_pipe,
344 .snd_pipe = mux_pt_snd_pipe,
345#endif
346 .attach = mux_pt_attach,
Willy Tarreaufafd3982018-11-18 21:29:20 +0100347 .get_first_cs = mux_pt_get_first_cs,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200348 .detach = mux_pt_detach,
Olivier Houchardd540b362018-11-05 18:37:53 +0100349 .avail_streams = mux_pt_avail_streams,
Willy Tarreau00f18a32019-01-26 12:19:01 +0100350 .used_streams = mux_pt_used_streams,
Olivier Houchard060ed432018-11-06 16:32:42 +0100351 .destroy = mux_pt_destroy_meth,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200352 .shutr = mux_pt_shutr,
353 .shutw = mux_pt_shutw,
Willy Tarreau28f1cb92017-12-20 16:14:44 +0100354 .flags = MX_FL_NONE,
Willy Tarreau53a47662017-08-28 10:53:00 +0200355 .name = "PASS",
356};
Willy Tarreauf6490822017-09-21 19:43:21 +0200357
Christopher Faulet32f61c02018-04-10 14:33:41 +0200358/* PROT selection : default mux has empty name */
359static struct mux_proto_list mux_proto_pt =
360 { .token = IST(""), .mode = PROTO_MODE_ANY, .side = PROTO_SIDE_BOTH, .mux = &mux_pt_ops };
Willy Tarreauf6490822017-09-21 19:43:21 +0200361
Willy Tarreau0108d902018-11-25 19:14:37 +0100362INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_pt);