MINOR: stream-interface: move the applet context to its own struct

In preparation of making the applet context dynamically allocatable,
we create a "struct appctx". Nothing else was changed, it's the same
struct as the one which was in the stream interface.
This commit is contained in:
Willy Tarreau 2013-11-24 02:28:49 +01:00
parent f4acee332b
commit 452d3bb0c4

View File

@ -89,36 +89,8 @@ struct si_ops {
void (*shutw)(struct stream_interface *); /* shut write function */
};
/* A stream interface has 3 parts :
* - the buffer side, which interfaces to the buffers.
* - the remote side, which describes the state and address of the other side.
* - the functions, which are used by the buffer side to communicate with the
* remote side from the buffer side.
*/
/* Note that if an applet is registered, the update function will not be called
* by the session handler, so it may be used to resync flags at the end of the
* applet handler. See stream_int_update_embedded() for reference.
*/
struct stream_interface {
/* struct members used by the "buffer" side */
unsigned int state; /* SI_ST* */
unsigned int prev_state;/* SI_ST*, copy of previous state */
unsigned int flags; /* SI_FL_* */
struct channel *ib, *ob; /* input and output buffers */
unsigned int exp; /* wake up time for connect, queue, turn-around, ... */
void *owner; /* generally a (struct task*) */
unsigned int err_type; /* first error detected, one of SI_ET_* */
struct connection *conn; /* descriptor for a connection */
struct si_ops *ops; /* general operations at the stream interface layer */
void (*release)(struct stream_interface *); /* handler to call after the last close() */
/* struct members below are the "remote" part, as seen from the buffer side */
int conn_retries; /* number of connect retries left */
int send_proxy_ofs; /* <0 = offset to (re)send from the end, >0 = send all */
struct {
/* Context of a running applet. */
struct appctx {
unsigned int st0; /* CLI state for stats, session state for peers */
unsigned int st1; /* prompt for stats, session error for peers */
unsigned int st2; /* output state for stats, unused by peers */
@ -165,7 +137,38 @@ struct stream_interface {
void *ptr; /* multi-purpose pointer for peers */
} peers;
} ctx; /* used by stats I/O handlers to dump the stats */
} applet;
};
/* A stream interface has 3 parts :
* - the buffer side, which interfaces to the buffers.
* - the remote side, which describes the state and address of the other side.
* - the functions, which are used by the buffer side to communicate with the
* remote side from the buffer side.
*/
/* Note that if an applet is registered, the update function will not be called
* by the session handler, so it may be used to resync flags at the end of the
* applet handler. See stream_int_update_embedded() for reference.
*/
struct stream_interface {
/* struct members used by the "buffer" side */
unsigned int state; /* SI_ST* */
unsigned int prev_state;/* SI_ST*, copy of previous state */
unsigned int flags; /* SI_FL_* */
struct channel *ib, *ob; /* input and output buffers */
unsigned int exp; /* wake up time for connect, queue, turn-around, ... */
void *owner; /* generally a (struct task*) */
unsigned int err_type; /* first error detected, one of SI_ET_* */
struct connection *conn; /* descriptor for a connection */
struct si_ops *ops; /* general operations at the stream interface layer */
void (*release)(struct stream_interface *); /* handler to call after the last close() */
/* struct members below are the "remote" part, as seen from the buffer side */
int conn_retries; /* number of connect retries left */
int send_proxy_ofs; /* <0 = offset to (re)send from the end, >0 = send all */
struct appctx applet; /* context of the running applet if any */
};
/* An applet designed to run in a stream interface */