int fd; /* file descriptor, for regular sockets (CO_FL_FDLESS=0) */
};
+enum xprt_capabilities {
+ XPRT_CAN_SPLICE,
+};
+
+enum xprt_splice_cap {
+ XPRT_CONN_CAN_NOT_SPLICE, /* This connection can't, and won't ever be able to splice */
+ XPRT_CONN_COULD_SPLICE, /* This connection can't splice, but may later */
+ XPRT_CONN_CAN_SPLICE /* This connection can splice */
+};
+
/* 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_*)
struct ssl_sock_ctx *(*get_ssl_sock_ctx)(struct connection *); /* retrieve the ssl_sock_ctx in use, or NULL if none */
int (*show_fd)(struct buffer *, const struct connection *, const void *ctx); /* append some data about xprt for "show fd"; returns non-zero if suspicious */
void (*dump_info)(struct buffer *, const struct connection *);
+ /*
+ * Returns the value for various capabilities.
+ * Returns 0 if the capability is known, iwth the actual value in arg,
+ * or -1 otherwise
+ */
+ int (*get_capability)(struct connection *connection, void *xprt_ctx, enum xprt_capabilities, void *arg);
};
/* mux_ops describes the mux operations, which are to be performed at the
return -1;
}
+static int raw_sock_get_capability(struct connection *conn, void *xprt_ctx, enum xprt_capabilities cap, void *arg)
+{
+ int *ret;
+
+ switch (cap) {
+ case XPRT_CAN_SPLICE:
+ ret = arg;
+ *ret = XPRT_CONN_CAN_SPLICE;
+ return 0;
+ }
+ return -1;
+}
+
/* transport-layer operations for RAW sockets */
static struct xprt_ops raw_sock = {
.snd_buf = raw_sock_from_buf,
.rcv_pipe = raw_sock_to_pipe,
.snd_pipe = raw_sock_from_pipe,
#endif
+ .get_capability = raw_sock_get_capability,
.shutr = NULL,
.shutw = NULL,
.close = raw_sock_close,
}
#endif
+static int ssl_sock_get_capability(struct connection *conn, void *xprt_ctx, enum xprt_capabilities cap, void *arg)
+{
+ int *ret;
+
+ switch (cap) {
+ case XPRT_CAN_SPLICE:
+ ret = arg;
+ *ret = XPRT_CONN_CAN_NOT_SPLICE;
+ return 0;
+ }
+ return -1;
+}
/* register cli keywords */
static struct cli_kw_list cli_kws = {{ },{
.close = ssl_sock_close,
.init = ssl_sock_init,
.start = ssl_sock_start,
+ .get_capability = ssl_sock_get_capability,
.prepare_bind_conf = ssl_sock_prepare_bind_conf,
.destroy_bind_conf = ssl_sock_destroy_bind_conf,
.prepare_srv = ssl_sock_prepare_srv_ctx,