From: Willy Tarreau Date: Tue, 2 Oct 2012 22:41:04 +0000 (+0200) Subject: REORG: connection: rename app_cb "data" X-Git-Tag: v1.5-dev13~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74beec32a5f206c2234837626d96e05a45e723d5;p=thirdparty%2Fhaproxy.git REORG: connection: rename app_cb "data" Now conn->data will designate the data layer which is the client for the transport layer. In practice it's the stream interface and will soon also be the health checks. --- diff --git a/include/proto/connection.h b/include/proto/connection.h index 17bef9bd95..f43525fb29 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -412,14 +412,14 @@ static inline void conn_get_to_addr(struct connection *conn) conn->flags |= CO_FL_ADDR_TO_SET; } -/* prepares a connection with the appropriate app_cb, ctrl and transport layers. +/* prepares a connection with the appropriate data, ctrl and transport layers. * The data state and context are set to 0, and the connection's owner is set. */ -static inline void conn_prepare(struct connection *conn, const struct app_cb *app, +static inline void conn_prepare(struct connection *conn, const struct data_cb *data, const struct protocol *ctrl, const struct xprt_ops *xprt, void *owner) { - conn->app_cb = app; + conn->data = data; conn->ctrl = ctrl; conn->xprt = xprt; conn->owner = owner; diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index cbaa966fe5..3472b990a0 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -46,7 +46,7 @@ void stream_sock_read0(struct stream_interface *si); extern struct si_ops si_embedded_ops; extern struct si_ops si_task_ops; extern struct si_ops si_conn_ops; -extern struct app_cb si_conn_cb; +extern struct data_cb si_conn_cb; struct task *stream_int_register_handler(struct stream_interface *si, struct si_applet *app); diff --git a/include/types/connection.h b/include/types/connection.h index 9215fa8fdf..c289efa9a7 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -169,14 +169,14 @@ struct xprt_ops { int (*init)(struct connection *conn); /* initialize the transport layer */ }; -/* app_cb describes the data layer's recv and send callbacks which are called +/* data_cb describes the data layer's recv and send callbacks which are called * when I/O activity was detected after the transport layer is ready. These * callbacks are supposed to make use of the xprt_ops above to exchange data * from/to buffers and pipes. */ -struct app_cb { - void (*recv)(struct connection *conn); /* application-layer recv callback */ - void (*send)(struct connection *conn); /* application-layer send callback */ +struct data_cb { + void (*recv)(struct connection *conn); /* data-layer recv callback */ + void (*send)(struct connection *conn); /* data-layer send callback */ }; /* a target describes what is on the remote side of the connection. */ @@ -202,7 +202,7 @@ struct target { struct connection { const struct xprt_ops *xprt; /* operations at the transport layer */ const struct protocol *ctrl; /* operations at the socket layer */ - const struct app_cb *app_cb; /* application layer callbacks */ + const struct data_cb *data; /* data layer callbacks */ void *owner; /* pointer to upper layer's entity (eg: stream interface) */ union { /* definitions which depend on connection type */ struct { /*** information used by socket-based connections ***/ diff --git a/src/connection.c b/src/connection.c index 8966bf70f6..07225e9d3b 100644 --- a/src/connection.c +++ b/src/connection.c @@ -78,11 +78,11 @@ int conn_fd_handler(int fd) /* The data transfer starts here and stops on error and handshakes */ if ((fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR)) && !(conn->flags & (CO_FL_WAIT_RD|CO_FL_WAIT_ROOM|CO_FL_ERROR|CO_FL_HANDSHAKE))) - conn->app_cb->recv(conn); + conn->data->recv(conn); if ((fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR)) && !(conn->flags & (CO_FL_WAIT_WR|CO_FL_WAIT_DATA|CO_FL_ERROR|CO_FL_HANDSHAKE))) - conn->app_cb->send(conn); + conn->data->send(conn); if (unlikely(conn->flags & CO_FL_ERROR)) goto leave; diff --git a/src/stream_interface.c b/src/stream_interface.c index 625ca73bb2..faedddedfb 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -66,7 +66,7 @@ struct si_ops si_conn_ops = { .chk_snd = stream_int_chk_snd_conn, }; -struct app_cb si_conn_cb = { +struct data_cb si_conn_cb = { .recv = si_conn_recv_cb, .send = si_conn_send_cb, };