mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-09 13:33:47 +02:00
MEDIUM: applet: Simplify a bit API to exchange data with applets
Default .rcv_buf and .snd_buf functions that applets can use are now specialized to manipulate raw buffers or HTX buffers. Thus a TCP applet should use appctx_raw_rcv_buf() and appctx_raw_snd_buf() while HTTP applet should use appctx_htx_rcv_buf() and appctx_htx_snd_buf(). Note that the appctx is now directly passed to these functions instead of the SC.
This commit is contained in:
@@ -61,8 +61,8 @@ struct applet {
|
||||
int (*init)(struct appctx *); /* callback to init resources, may be NULL.
|
||||
expect 0 if ok, -1 if an error occurs. */
|
||||
void (*fct)(struct appctx *); /* internal I/O handler, may never be NULL */
|
||||
size_t (*rcv_buf)(struct stconn *sc, struct buffer *buf, size_t count, unsigned int flags); /* called from the upper layer to get data */
|
||||
size_t (*snd_buf)(struct stconn *sc, struct buffer *buf, size_t count, unsigned int flags); /* Called from the upper layet to put data */
|
||||
size_t (*rcv_buf)(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags); /* called from the upper layer to get data */
|
||||
size_t (*snd_buf)(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags); /* Called from the upper layet to put data */
|
||||
size_t (*fastfwd)(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags); /* Callback to fast-forward data */
|
||||
void (*release)(struct appctx *); /* callback to release resources, may be NULL */
|
||||
unsigned int timeout; /* execution timeout. */
|
||||
|
||||
@@ -49,8 +49,14 @@ int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buff
|
||||
void appctx_free_on_early_error(struct appctx *appctx);
|
||||
void appctx_free(struct appctx *appctx);
|
||||
|
||||
size_t appctx_htx_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags);
|
||||
size_t appctx_raw_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags);
|
||||
size_t appctx_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, unsigned int flags);
|
||||
|
||||
size_t appctx_htx_snd_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags);
|
||||
size_t appctx_raw_snd_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags);
|
||||
size_t appctx_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, unsigned int flags);
|
||||
|
||||
int appctx_fastfwd(struct stconn *sc, unsigned int count, unsigned int flags);
|
||||
|
||||
static inline struct appctx *appctx_new_here(struct applet *applet, struct sedesc *sedesc)
|
||||
|
||||
Reference in New Issue
Block a user