blob: 18bc96ee83bd65c16f9f438b49f462cfb16263d1 [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);
35 tasklet_free(ctx->wait_event.task);
36 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
53 conn_sock_drain(ctx->conn);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +010054 if (ctx->conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH))
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010055 mux_pt_destroy(ctx);
56 else
Olivier Houcharde179d0e2019-03-21 18:27:17 +010057 ctx->conn->xprt->subscribe(ctx->conn, ctx->conn->xprt_ctx, SUB_RETRY_RECV,
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010058 &ctx->wait_event);
59
60 return NULL;
61}
Willy Tarreau53a47662017-08-28 10:53:00 +020062
Willy Tarreau3d2ee552018-12-19 14:12:10 +010063/* Initialize the mux once it's attached. It is expected that conn->ctx
Olivier Houchard9aaf7782017-09-13 18:30:23 +020064 * points to the existing conn_stream (for outgoing connections) or NULL (for
65 * incoming ones, in which case one will be allocated and a new stream will be
66 * instanciated). Returns < 0 on error.
Willy Tarreau53a47662017-08-28 10:53:00 +020067 */
Christopher Faulet51f73eb2019-04-08 11:22:47 +020068static int mux_pt_init(struct connection *conn, struct proxy *prx, struct session *sess,
69 struct buffer *input)
Willy Tarreau53a47662017-08-28 10:53:00 +020070{
Willy Tarreau3d2ee552018-12-19 14:12:10 +010071 struct conn_stream *cs = conn->ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010072 struct mux_pt_ctx *ctx = pool_alloc(pool_head_pt_ctx);
73
74 if (!ctx)
75 goto fail;
76
77 ctx->wait_event.task = tasklet_new();
78 if (!ctx->wait_event.task)
79 goto fail_free_ctx;
80 ctx->wait_event.task->context = ctx;
81 ctx->wait_event.task->process = mux_pt_io_cb;
Willy Tarreau4f6516d2018-12-19 13:59:17 +010082 ctx->wait_event.events = 0;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010083 ctx->conn = conn;
Olivier Houchard9aaf7782017-09-13 18:30:23 +020084
85 if (!cs) {
86 cs = cs_new(conn);
87 if (!cs)
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010088 goto fail_free_ctx;
Olivier Houchard9aaf7782017-09-13 18:30:23 +020089
90 if (stream_create_from_cs(cs) < 0)
91 goto fail_free;
92
Olivier Houchard9aaf7782017-09-13 18:30:23 +020093 }
Willy Tarreau3d2ee552018-12-19 14:12:10 +010094 conn->ctx = ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +010095 ctx->cs = cs;
Olivier Houchard8706c812018-12-04 19:17:25 +010096 cs->flags |= CS_FL_RCV_MORE;
Willy Tarreau53a47662017-08-28 10:53:00 +020097 return 0;
Olivier Houchard9aaf7782017-09-13 18:30:23 +020098
99 fail_free:
100 cs_free(cs);
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100101fail_free_ctx:
102 if (ctx->wait_event.task)
103 tasklet_free(ctx->wait_event.task);
104 pool_free(pool_head_pt_ctx, ctx);
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200105 fail:
106 return -1;
Willy Tarreau53a47662017-08-28 10:53:00 +0200107}
108
109/* callback to be used by default for the pass-through mux. It calls the data
110 * layer wake() callback if it is set otherwise returns 0.
111 */
112static int mux_pt_wake(struct connection *conn)
113{
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100114 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100115 struct conn_stream *cs = ctx->cs;
116 int ret = 0;
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200117
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100118 if (cs) {
119 ret = cs->data_cb->wake ? cs->data_cb->wake(cs) : 0;
Olivier Houchard9aaf7782017-09-13 18:30:23 +0200120
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100121 if (ret < 0)
122 return ret;
123 } else {
124 conn_sock_drain(conn);
125 if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH)) {
126 mux_pt_destroy(ctx);
127 return -1;
128 }
129 }
Willy Tarreauad7f0ad2018-08-24 15:48:59 +0200130
Olivier Houchard7fc96d52017-11-23 18:25:47 +0100131 /* If we had early data, and we're done with the handshake
132 * then whe know the data are safe, and we can remove the flag.
133 */
134 if ((conn->flags & (CO_FL_EARLY_DATA | CO_FL_EARLY_SSL_HS | CO_FL_HANDSHAKE)) ==
135 CO_FL_EARLY_DATA)
136 conn->flags &= ~CO_FL_EARLY_DATA;
Willy Tarreaued339a32017-11-03 15:55:24 +0100137 return ret;
Willy Tarreau53a47662017-08-28 10:53:00 +0200138}
139
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200140/*
141 * Attach a new stream to a connection
142 * (Used for outgoing connections)
143 */
Olivier Houchardf502aca2018-12-14 19:42:40 +0100144static struct conn_stream *mux_pt_attach(struct connection *conn, struct session *sess)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200145{
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100146 struct conn_stream *cs;
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100147 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100148
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100149 conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100150 cs = cs_new(conn);
151 if (!cs)
152 goto fail;
153
154 ctx->cs = cs;
Olivier Houchard8706c812018-12-04 19:17:25 +0100155 cs->flags |= CS_FL_RCV_MORE;
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100156 return (cs);
157fail:
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200158 return NULL;
159}
160
Willy Tarreaufafd3982018-11-18 21:29:20 +0100161/* Retrieves a valid conn_stream from this connection, or returns NULL. For
162 * this mux, it's easy as we can only store a single conn_stream.
163 */
164static const struct conn_stream *mux_pt_get_first_cs(const struct connection *conn)
165{
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100166 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100167 struct conn_stream *cs = ctx->cs;
Willy Tarreaufafd3982018-11-18 21:29:20 +0100168
169 return cs;
170}
171
Christopher Faulet73c12072019-04-08 11:23:22 +0200172/* Destroy the mux and the associated connection if still attached to this mux
173 * and no longer used */
174static void mux_pt_destroy_meth(void *ctx)
Olivier Houchard060ed432018-11-06 16:32:42 +0100175{
Christopher Faulet73c12072019-04-08 11:23:22 +0200176 struct mux_pt_ctx *pt = ctx;
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100177
Christopher Faulet39a96ee2019-04-08 10:52:21 +0200178 if (!(pt->cs) || !(pt->conn) || pt->conn->ctx != pt)
Christopher Faulet73c12072019-04-08 11:23:22 +0200179 mux_pt_destroy(pt);
Olivier Houchard060ed432018-11-06 16:32:42 +0100180}
181
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200182/*
Willy Tarreau2c52a2b2017-10-08 11:00:17 +0200183 * Detach the stream from the connection and possibly release the connection.
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200184 */
185static void mux_pt_detach(struct conn_stream *cs)
186{
Willy Tarreau2c52a2b2017-10-08 11:00:17 +0200187 struct connection *conn = cs->conn;
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100188 struct mux_pt_ctx *ctx = cs->conn->ctx;
Willy Tarreau2c52a2b2017-10-08 11:00:17 +0200189
Olivier Houchardb6c32ee2018-11-05 18:28:43 +0100190 /* Subscribe, to know if we got disconnected */
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100191 if (conn->owner != NULL &&
192 !(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH))) {
193 ctx->cs = NULL;
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100194 conn->xprt->subscribe(conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100195 } else
196 /* There's no session attached to that connection, destroy it */
197 mux_pt_destroy(ctx);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200198}
199
Willy Tarreau00f18a32019-01-26 12:19:01 +0100200/* returns the number of streams in use on a connection */
201static int mux_pt_used_streams(struct connection *conn)
Olivier Houchardd540b362018-11-05 18:37:53 +0100202{
Willy Tarreau3d2ee552018-12-19 14:12:10 +0100203 struct mux_pt_ctx *ctx = conn->ctx;
Olivier Houchardd540b362018-11-05 18:37:53 +0100204
Willy Tarreau00f18a32019-01-26 12:19:01 +0100205 return ctx->cs ? 1 : 0;
Olivier Houchardd540b362018-11-05 18:37:53 +0100206}
207
Willy Tarreau00f18a32019-01-26 12:19:01 +0100208/* returns the number of streams still available on a connection */
209static int mux_pt_avail_streams(struct connection *conn)
Olivier Houchard8defe4b2018-12-02 01:31:17 +0100210{
Willy Tarreau00f18a32019-01-26 12:19:01 +0100211 return 1 - mux_pt_used_streams(conn);
Olivier Houchard8defe4b2018-12-02 01:31:17 +0100212}
213
Willy Tarreauecdb3fe2017-10-05 15:25:48 +0200214static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200215{
Willy Tarreau4b795242017-10-05 18:47:38 +0200216 if (cs->flags & CS_FL_SHR)
217 return;
Christopher Fauletd94f8772018-12-17 13:21:02 +0100218 cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200219 if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutr)
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100220 cs->conn->xprt->shutr(cs->conn, cs->conn->xprt_ctx,
221 (mode == CS_SHR_DRAIN));
Willy Tarreau4b795242017-10-05 18:47:38 +0200222 if (cs->flags & CS_FL_SHW)
223 conn_full_close(cs->conn);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100224 /* Maybe we've been put in the list of available idle connections,
225 * get ouf of here
226 */
227 LIST_DEL(&cs->conn->list);
228 LIST_INIT(&cs->conn->list);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200229}
230
Willy Tarreauecdb3fe2017-10-05 15:25:48 +0200231static void mux_pt_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200232{
Willy Tarreau4b795242017-10-05 18:47:38 +0200233 if (cs->flags & CS_FL_SHW)
234 return;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200235 if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutw)
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100236 cs->conn->xprt->shutw(cs->conn, cs->conn->xprt_ctx,
237 (mode == CS_SHW_NORMAL));
Willy Tarreau4b795242017-10-05 18:47:38 +0200238 if (!(cs->flags & CS_FL_SHR))
Willy Tarreaua48c1412017-12-22 18:46:33 +0100239 conn_sock_shutw(cs->conn, (mode == CS_SHW_NORMAL));
Willy Tarreau4b795242017-10-05 18:47:38 +0200240 else
241 conn_full_close(cs->conn);
Olivier Houchard7c6f8b12018-11-13 16:48:36 +0100242 /* Maybe we've been put in the list of available idle connections,
243 * get ouf of here
244 */
245 LIST_DEL(&cs->conn->list);
246 LIST_INIT(&cs->conn->list);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200247}
248
249/*
250 * Called from the upper layer, to get more data
251 */
Willy Tarreau7f3225f2018-06-19 06:15:17 +0200252static 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 +0200253{
Willy Tarreaud9cf5402018-07-18 11:29:06 +0200254 size_t ret;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200255
Christopher Faulet4eb7d742018-10-11 15:29:21 +0200256 if (!count) {
Christopher Fauletd94f8772018-12-17 13:21:02 +0100257 cs->flags |= (CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Christopher Faulet4eb7d742018-10-11 15:29:21 +0200258 return 0;
259 }
Willy Tarreaue0f24ee2018-12-14 10:51:23 +0100260 b_realign_if_empty(buf);
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100261 ret = cs->conn->xprt->rcv_buf(cs->conn, cs->conn->xprt_ctx, buf, count, flags);
Olivier Houchard8706c812018-12-04 19:17:25 +0100262 if (conn_xprt_read0_pending(cs->conn)) {
263 if (ret == 0)
Christopher Fauletd94f8772018-12-17 13:21:02 +0100264 cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Christopher Faulet87a8f352019-03-22 14:51:36 +0100265 cs->flags |= CS_FL_EOS;
Olivier Houchard8706c812018-12-04 19:17:25 +0100266 }
267 if (cs->conn->flags & CO_FL_ERROR) {
268 if (ret == 0)
Christopher Fauletd94f8772018-12-17 13:21:02 +0100269 cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
Willy Tarreau4ff3b892017-10-16 15:17:17 +0200270 cs->flags |= CS_FL_ERROR;
Olivier Houchard8706c812018-12-04 19:17:25 +0100271 }
Willy Tarreaud9cf5402018-07-18 11:29:06 +0200272 return ret;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200273}
274
275/* Called from the upper layer, to send data */
Christopher Fauletd44a9b32018-07-27 11:59:41 +0200276static 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 +0200277{
Olivier Houchardb72d98a2018-11-30 13:17:48 +0100278 size_t ret;
279
280 if (cs->conn->flags & CO_FL_HANDSHAKE)
281 return 0;
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100282 ret = cs->conn->xprt->snd_buf(cs->conn, cs->conn->xprt_ctx, buf, count, flags);
Christopher Fauletd44a9b32018-07-27 11:59:41 +0200283
284 if (ret > 0)
285 b_del(buf, ret);
286 return ret;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200287}
288
Olivier Houchard6ff20392018-07-17 18:46:31 +0200289/* Called from the upper layer, to subscribe to events */
290static int mux_pt_subscribe(struct conn_stream *cs, int event_type, void *param)
291{
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100292 return (cs->conn->xprt->subscribe(cs->conn, cs->conn->xprt_ctx, event_type, param));
Olivier Houchard6ff20392018-07-17 18:46:31 +0200293}
294
Olivier Houchard83a0cd82018-09-28 17:57:58 +0200295static int mux_pt_unsubscribe(struct conn_stream *cs, int event_type, void *param)
296{
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100297 return (cs->conn->xprt->unsubscribe(cs->conn, cs->conn->xprt_ctx, event_type, param));
Olivier Houchard83a0cd82018-09-28 17:57:58 +0200298}
299
Olivier Houchard7da120b2017-11-01 13:55:10 +0100300#if defined(CONFIG_HAP_LINUX_SPLICE)
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200301/* Send and get, using splicing */
302static int mux_pt_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int count)
303{
304 int ret;
305
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100306 ret = cs->conn->xprt->rcv_pipe(cs->conn, cs->conn->xprt_ctx, pipe, count);
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200307 if (conn_xprt_read0_pending(cs->conn))
Christopher Faulet87a8f352019-03-22 14:51:36 +0100308 cs->flags |= CS_FL_EOS;
Willy Tarreau4ff3b892017-10-16 15:17:17 +0200309 if (cs->conn->flags & CO_FL_ERROR)
310 cs->flags |= CS_FL_ERROR;
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200311 return (ret);
312}
313
314static int mux_pt_snd_pipe(struct conn_stream *cs, struct pipe *pipe)
315{
Olivier Houcharde179d0e2019-03-21 18:27:17 +0100316 return (cs->conn->xprt->snd_pipe(cs->conn, cs->conn->xprt_ctx, pipe));
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200317}
Olivier Houchard7da120b2017-11-01 13:55:10 +0100318#endif
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200319
Willy Tarreau53a47662017-08-28 10:53:00 +0200320/* The mux operations */
321const struct mux_ops mux_pt_ops = {
322 .init = mux_pt_init,
Willy Tarreau53a47662017-08-28 10:53:00 +0200323 .wake = mux_pt_wake,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200324 .rcv_buf = mux_pt_rcv_buf,
325 .snd_buf = mux_pt_snd_buf,
Olivier Houchard6ff20392018-07-17 18:46:31 +0200326 .subscribe = mux_pt_subscribe,
Olivier Houchard83a0cd82018-09-28 17:57:58 +0200327 .unsubscribe = mux_pt_unsubscribe,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200328#if defined(CONFIG_HAP_LINUX_SPLICE)
329 .rcv_pipe = mux_pt_rcv_pipe,
330 .snd_pipe = mux_pt_snd_pipe,
331#endif
332 .attach = mux_pt_attach,
Willy Tarreaufafd3982018-11-18 21:29:20 +0100333 .get_first_cs = mux_pt_get_first_cs,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200334 .detach = mux_pt_detach,
Olivier Houchardd540b362018-11-05 18:37:53 +0100335 .avail_streams = mux_pt_avail_streams,
Willy Tarreau00f18a32019-01-26 12:19:01 +0100336 .used_streams = mux_pt_used_streams,
Olivier Houchard060ed432018-11-06 16:32:42 +0100337 .destroy = mux_pt_destroy_meth,
Olivier Houchard7a3f0df2017-09-13 18:30:23 +0200338 .shutr = mux_pt_shutr,
339 .shutw = mux_pt_shutw,
Willy Tarreau28f1cb92017-12-20 16:14:44 +0100340 .flags = MX_FL_NONE,
Willy Tarreau53a47662017-08-28 10:53:00 +0200341 .name = "PASS",
342};
Willy Tarreauf6490822017-09-21 19:43:21 +0200343
Christopher Faulet32f61c02018-04-10 14:33:41 +0200344/* PROT selection : default mux has empty name */
345static struct mux_proto_list mux_proto_pt =
346 { .token = IST(""), .mode = PROTO_MODE_ANY, .side = PROTO_SIDE_BOTH, .mux = &mux_pt_ops };
Willy Tarreauf6490822017-09-21 19:43:21 +0200347
Willy Tarreau0108d902018-11-25 19:14:37 +0100348INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_pt);