CLEANUP: spoe: Uniformize function definitions

SPOE functions definitions were splitted on 2 or more lines, with the return
type alone on the first line. It is unusual in the HAProxy code.

The related issue is #2502.
This commit is contained in:
Christopher Faulet 2024-07-04 15:33:41 +02:00
parent cab98784d8
commit a492e08e62
2 changed files with 75 additions and 134 deletions

View File

@ -36,8 +36,7 @@ struct spoe_agent *spoe_appctx_agent(struct appctx *appctx);
* error is triggered. * error is triggered.
* On success, it returns <len> and <*buf> is moved after the encoded value. If * On success, it returns <len> and <*buf> is moved after the encoded value. If
* an error occurred, it returns -1. */ * an error occurred, it returns -1. */
static inline int static inline int spoe_encode_buffer(const char *str, size_t len, char **buf, char *end)
spoe_encode_buffer(const char *str, size_t len, char **buf, char *end)
{ {
char *p = *buf; char *p = *buf;
int ret; int ret;
@ -64,8 +63,7 @@ spoe_encode_buffer(const char *str, size_t len, char **buf, char *end)
* points on the first byte of the buffer. * points on the first byte of the buffer.
* On success, it returns the buffer length and <*buf> is moved after the * On success, it returns the buffer length and <*buf> is moved after the
* encoded buffer. Otherwise, it returns -1. */ * encoded buffer. Otherwise, it returns -1. */
static inline int static inline int spoe_decode_buffer(char **buf, char *end, char **str, uint64_t *len)
spoe_decode_buffer(char **buf, char *end, char **str, uint64_t *len)
{ {
char *p = *buf; char *p = *buf;
uint64_t sz; uint64_t sz;
@ -91,8 +89,7 @@ spoe_decode_buffer(char **buf, char *end, char **str, uint64_t *len)
* If the value is too big to be encoded, depending on its type, then encoding * If the value is too big to be encoded, depending on its type, then encoding
* failed or the value is partially encoded. Only strings and binaries can be * failed or the value is partially encoded. Only strings and binaries can be
* partially encoded. */ * partially encoded. */
static inline int static inline int spoe_encode_data(struct sample *smp, char **buf, char *end)
spoe_encode_data(struct sample *smp, char **buf, char *end)
{ {
char *p = *buf; char *p = *buf;
int ret; int ret;
@ -189,8 +186,7 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
* - ipv6: 16 bytes * - ipv6: 16 bytes
* - binary and string: a buffer prefixed by its size, a variable-length * - binary and string: a buffer prefixed by its size, a variable-length
* integer (see spoe_decode_buffer) */ * integer (see spoe_decode_buffer) */
static inline int static inline int spoe_skip_data(char **buf, char *end)
spoe_skip_data(char **buf, char *end)
{ {
char *str, *p = *buf; char *str, *p = *buf;
int type, ret; int type, ret;
@ -236,8 +232,7 @@ spoe_skip_data(char **buf, char *end)
/* Decode a typed data and fill <smp>. If an error occurred, -1 is returned, /* Decode a typed data and fill <smp>. If an error occurred, -1 is returned,
* otherwise the number of read bytes is returned and <*buf> is moved after the * otherwise the number of read bytes is returned and <*buf> is moved after the
* decoded data. See spoe_skip_data for details. */ * decoded data. See spoe_skip_data for details. */
static inline int static inline int spoe_decode_data(char **buf, char *end, struct sample *smp)
spoe_decode_data(char **buf, char *end, struct sample *smp)
{ {
char *str, *p = *buf; char *str, *p = *buf;
int type, r = 0; int type, r = 0;

View File

@ -271,8 +271,7 @@ static struct appctx *spoe_create_appctx(struct spoe_config *conf);
/******************************************************************** /********************************************************************
* helper functions/globals * helper functions/globals
********************************************************************/ ********************************************************************/
static void static void spoe_release_placeholder(struct spoe_placeholder *ph)
spoe_release_placeholder(struct spoe_placeholder *ph)
{ {
if (!ph) if (!ph)
return; return;
@ -280,8 +279,7 @@ spoe_release_placeholder(struct spoe_placeholder *ph)
free(ph); free(ph);
} }
static void static void spoe_release_message(struct spoe_message *msg)
spoe_release_message(struct spoe_message *msg)
{ {
struct spoe_arg *arg, *argback; struct spoe_arg *arg, *argback;
struct acl *acl, *aclback; struct acl *acl, *aclback;
@ -305,8 +303,7 @@ spoe_release_message(struct spoe_message *msg)
free(msg); free(msg);
} }
static void static void spoe_release_group(struct spoe_group *grp)
spoe_release_group(struct spoe_group *grp)
{ {
if (!grp) if (!grp)
return; return;
@ -315,8 +312,7 @@ spoe_release_group(struct spoe_group *grp)
free(grp); free(grp);
} }
static void static void spoe_release_agent(struct spoe_agent *agent)
spoe_release_agent(struct spoe_agent *agent)
{ {
struct spoe_message *msg, *msgback; struct spoe_message *msg, *msgback;
struct spoe_group *grp, *grpback; struct spoe_group *grp, *grpback;
@ -358,16 +354,14 @@ static const char *spoe_event_str[SPOE_EV_EVENTS] = {
/* Used to generates a unique id for an engine. On success, it returns a /* Used to generates a unique id for an engine. On success, it returns a
* allocated string. So it is the caller's responsibility to release it. If the * allocated string. So it is the caller's responsibility to release it. If the
* allocation failed, it returns NULL. */ * allocation failed, it returns NULL. */
static char * static char *generate_pseudo_uuid()
generate_pseudo_uuid()
{ {
ha_generate_uuid_v4(&trash); ha_generate_uuid_v4(&trash);
return my_strndup(trash.area, trash.data); return my_strndup(trash.area, trash.data);
} }
/* set/add to <t> the elapsed time since <since> and now */ /* set/add to <t> the elapsed time since <since> and now */
static inline void static inline void spoe_update_stat_time(ullong *since, long *t)
spoe_update_stat_time(ullong *since, long *t)
{ {
if (*t == -1) if (*t == -1)
*t = ns_to_ms(now_ns - *since); *t = ns_to_ms(now_ns - *since);
@ -383,8 +377,7 @@ spoe_update_stat_time(ullong *since, long *t)
/* Encode the NOTIFY frame sent by HAProxy to an agent. It returns the number of /* Encode the NOTIFY frame sent by HAProxy to an agent. It returns the number of
* encoded bytes in the frame on success, 0 if an encoding error occurred and -1 * encoded bytes in the frame on success, 0 if an encoding error occurred and -1
* if a fatal error occurred. */ * if a fatal error occurred. */
static int static int spoe_prepare_hanotify_frame(struct appctx *appctx, char *frame, size_t size)
spoe_prepare_hanotify_frame(struct appctx *appctx, char *frame, size_t size)
{ {
char *p, *end; char *p, *end;
size_t sz; size_t sz;
@ -412,8 +405,7 @@ spoe_prepare_hanotify_frame(struct appctx *appctx, char *frame, size_t size)
/* Decode ACK frame sent by an agent. It returns the number of read bytes on /* Decode ACK frame sent by an agent. It returns the number of read bytes on
* success, 0 if the frame can be ignored and -1 if an error occurred. */ * success, 0 if the frame can be ignored and -1 if an error occurred. */
static int static int spoe_handle_agentack_frame(struct appctx *appctx, char *frame, size_t size)
spoe_handle_agentack_frame(struct appctx *appctx, char *frame, size_t size)
{ {
char *p, *end; char *p, *end;
int len; int len;
@ -439,8 +431,7 @@ spoe_handle_agentack_frame(struct appctx *appctx, char *frame, size_t size)
/* Send a SPOE frame to an agent. It returns -1 when an error occurred, 0 when /* Send a SPOE frame to an agent. It returns -1 when an error occurred, 0 when
* the frame can be ignored, 1 to retry later, and the frame length on * the frame can be ignored, 1 to retry later, and the frame length on
* success. */ * success. */
static int static int spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
{ {
int ret; int ret;
@ -453,8 +444,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
/* Receive a SPOE frame from an agent. It return -1 when an error occurred, 0 /* Receive a SPOE frame from an agent. It return -1 when an error occurred, 0
* when the frame can be ignored, 1 to retry later and the frame length on * when the frame can be ignored, 1 to retry later and the frame length on
* success. */ * success. */
static int static int spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
{ {
struct stconn *sc = appctx_sc(appctx); struct stconn *sc = appctx_sc(appctx);
int ret; int ret;
@ -489,8 +479,7 @@ struct spoe_agent *spoe_appctx_agent(struct appctx *appctx)
return spoe_appctx->agent; return spoe_appctx->agent;
} }
static int static int spoe_wakeup_appctx(struct appctx *appctx)
spoe_wakeup_appctx(struct appctx *appctx)
{ {
applet_will_consume(appctx); applet_will_consume(appctx);
applet_have_more_data(appctx); applet_have_more_data(appctx);
@ -498,8 +487,7 @@ spoe_wakeup_appctx(struct appctx *appctx)
return 1; return 1;
} }
static int static int spoe_init_appctx(struct appctx *appctx)
spoe_init_appctx(struct appctx *appctx)
{ {
struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx); struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx);
struct spoe_agent *agent = spoe_appctx->agent; struct spoe_agent *agent = spoe_appctx->agent;
@ -544,8 +532,7 @@ static void spoe_shut_appctx(struct appctx *appctx, enum se_shut_mode mode, stru
/* Callback function that releases a SPOE applet. This happens when the /* Callback function that releases a SPOE applet. This happens when the
* connection with the agent is closed. */ * connection with the agent is closed. */
static void static void spoe_release_appctx(struct appctx *appctx)
spoe_release_appctx(struct appctx *appctx)
{ {
struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx); struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx);
@ -577,8 +564,7 @@ spoe_release_appctx(struct appctx *appctx)
} }
static int static int spoe_handle_sending_frame_appctx(struct appctx *appctx)
spoe_handle_sending_frame_appctx(struct appctx *appctx)
{ {
char *frame, *buf; char *frame, *buf;
int ret; int ret;
@ -622,8 +608,7 @@ spoe_handle_sending_frame_appctx(struct appctx *appctx)
return ret; return ret;
} }
static int static int spoe_handle_receiving_frame_appctx(struct appctx *appctx)
spoe_handle_receiving_frame_appctx(struct appctx *appctx)
{ {
char *frame; char *frame;
int ret; int ret;
@ -669,8 +654,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx)
return ret; return ret;
} }
static int static int spoe_handle_processing_appctx(struct appctx *appctx)
spoe_handle_processing_appctx(struct appctx *appctx)
{ {
int ret; int ret;
@ -715,8 +699,7 @@ spoe_handle_processing_appctx(struct appctx *appctx)
} }
/* I/O Handler processing messages exchanged with the agent */ /* I/O Handler processing messages exchanged with the agent */
static void static void spoe_handle_appctx(struct appctx *appctx)
spoe_handle_appctx(struct appctx *appctx)
{ {
struct stconn *sc = appctx_sc(appctx); struct stconn *sc = appctx_sc(appctx);
@ -766,8 +749,7 @@ struct applet spoe_applet = {
/* Create a SPOE applet. On success, the created applet is returned, else /* Create a SPOE applet. On success, the created applet is returned, else
* NULL. */ * NULL. */
static struct appctx * static struct appctx *spoe_create_appctx(struct spoe_config *conf)
spoe_create_appctx(struct spoe_config *conf)
{ {
struct spoe_agent *agent = conf->agent; struct spoe_agent *agent = conf->agent;
struct spoe_appctx *spoe_appctx; struct spoe_appctx *spoe_appctx;
@ -812,8 +794,7 @@ spoe_create_appctx(struct spoe_config *conf)
**************************************************************************/ **************************************************************************/
/* Encode a SPOE message. If the next message can be processed, it returns 0. If /* Encode a SPOE message. If the next message can be processed, it returns 0. If
* the message is too big, it returns -1.*/ * the message is too big, it returns -1.*/
static int static int spoe_encode_message(struct stream *s, struct spoe_context *ctx,
spoe_encode_message(struct stream *s, struct spoe_context *ctx,
struct spoe_message *msg, int dir, struct spoe_message *msg, int dir,
char **buf, char *end) char **buf, char *end)
{ {
@ -868,8 +849,7 @@ spoe_encode_message(struct stream *s, struct spoe_context *ctx,
/* Encode list of SPOE messages. On success it returns 1. If an error occurred, -1 /* Encode list of SPOE messages. On success it returns 1. If an error occurred, -1
* is returned. If nothing has been encoded, it returns 0. */ * is returned. If nothing has been encoded, it returns 0. */
static int static int spoe_encode_messages(struct stream *s, struct spoe_context *ctx,
spoe_encode_messages(struct stream *s, struct spoe_context *ctx,
struct list *messages, int dir, int type) struct list *messages, int dir, int type)
{ {
struct spoe_config *conf = FLT_CONF(ctx->filter); struct spoe_config *conf = FLT_CONF(ctx->filter);
@ -918,8 +898,7 @@ spoe_encode_messages(struct stream *s, struct spoe_context *ctx,
* Functions that handle SPOE actions * Functions that handle SPOE actions
**************************************************************************/ **************************************************************************/
/* Helper function to set a variable */ /* Helper function to set a variable */
static void static void spoe_set_var(struct spoe_context *ctx, char *scope, char *name, int len,
spoe_set_var(struct spoe_context *ctx, char *scope, char *name, int len,
struct sample *smp) struct sample *smp)
{ {
struct spoe_config *conf = FLT_CONF(ctx->filter); struct spoe_config *conf = FLT_CONF(ctx->filter);
@ -936,8 +915,7 @@ spoe_set_var(struct spoe_context *ctx, char *scope, char *name, int len,
} }
/* Helper function to unset a variable */ /* Helper function to unset a variable */
static void static void spoe_unset_var(struct spoe_context *ctx, char *scope, char *name, int len,
spoe_unset_var(struct spoe_context *ctx, char *scope, char *name, int len,
struct sample *smp) struct sample *smp)
{ {
struct spoe_config *conf = FLT_CONF(ctx->filter); struct spoe_config *conf = FLT_CONF(ctx->filter);
@ -951,8 +929,7 @@ spoe_unset_var(struct spoe_context *ctx, char *scope, char *name, int len,
} }
static inline int static inline int spoe_decode_action_set_var(struct stream *s, struct spoe_context *ctx,
spoe_decode_action_set_var(struct stream *s, struct spoe_context *ctx,
char **buf, char *end, int dir) char **buf, char *end, int dir)
{ {
char *str, *scope, *p = *buf; char *str, *scope, *p = *buf;
@ -996,8 +973,7 @@ spoe_decode_action_set_var(struct stream *s, struct spoe_context *ctx,
return 0; return 0;
} }
static inline int static inline int spoe_decode_action_unset_var(struct stream *s, struct spoe_context *ctx,
spoe_decode_action_unset_var(struct stream *s, struct spoe_context *ctx,
char **buf, char *end, int dir) char **buf, char *end, int dir)
{ {
char *str, *scope, *p = *buf; char *str, *scope, *p = *buf;
@ -1037,8 +1013,7 @@ spoe_decode_action_unset_var(struct stream *s, struct spoe_context *ctx,
/* Process SPOE actions for a specific event. It returns 1 on success. If an /* Process SPOE actions for a specific event. It returns 1 on success. If an
* error occurred, 0 is returned. */ * error occurred, 0 is returned. */
static int static int spoe_process_actions(struct stream *s, struct spoe_context *ctx, int dir)
spoe_process_actions(struct stream *s, struct spoe_context *ctx, int dir)
{ {
char *p, *end; char *p, *end;
int ret; int ret;
@ -1076,8 +1051,7 @@ spoe_process_actions(struct stream *s, struct spoe_context *ctx, int dir)
/*************************************************************************** /***************************************************************************
* Functions that process SPOE events * Functions that process SPOE events
**************************************************************************/ **************************************************************************/
static void static void spoe_update_stats(struct stream *s, struct spoe_agent *agent,
spoe_update_stats(struct stream *s, struct spoe_agent *agent,
struct spoe_context *ctx, int dir) struct spoe_context *ctx, int dir)
{ {
if (ctx->stats.start_ts != 0) { if (ctx->stats.start_ts != 0) {
@ -1110,8 +1084,7 @@ spoe_update_stats(struct stream *s, struct spoe_agent *agent,
} }
} }
static void static void spoe_handle_processing_error(struct stream *s, struct spoe_agent *agent,
spoe_handle_processing_error(struct stream *s, struct spoe_agent *agent,
struct spoe_context *ctx, int dir) struct spoe_context *ctx, int dir)
{ {
if (agent->var_on_error) { if (agent->var_on_error) {
@ -1131,8 +1104,7 @@ spoe_handle_processing_error(struct stream *s, struct spoe_agent *agent,
: SPOE_CTX_ST_NONE); : SPOE_CTX_ST_NONE);
} }
static inline int static inline int spoe_start_processing(struct spoe_agent *agent, struct spoe_context *ctx, int dir)
spoe_start_processing(struct spoe_agent *agent, struct spoe_context *ctx, int dir)
{ {
/* If a process is already started for this SPOE context, retry /* If a process is already started for this SPOE context, retry
* later. */ * later. */
@ -1152,8 +1124,7 @@ spoe_start_processing(struct spoe_agent *agent, struct spoe_context *ctx, int di
return 1; return 1;
} }
static inline void static inline void spoe_stop_processing(struct spoe_agent *agent, struct spoe_context *ctx)
spoe_stop_processing(struct spoe_agent *agent, struct spoe_context *ctx)
{ {
struct spoe_appctx *sa = ctx->spoe_appctx; struct spoe_appctx *sa = ctx->spoe_appctx;
@ -1183,8 +1154,7 @@ spoe_stop_processing(struct spoe_agent *agent, struct spoe_context *ctx)
* to process corresponding actions. During all the processing, it returns 0 * to process corresponding actions. During all the processing, it returns 0
* and it returns 1 when the processing is finished. If an error occurred, -1 * and it returns 1 when the processing is finished. If an error occurred, -1
* is returned. */ * is returned. */
static int static int spoe_process_messages(struct stream *s, struct spoe_context *ctx,
spoe_process_messages(struct stream *s, struct spoe_context *ctx,
struct list *messages, int dir, int type) struct list *messages, int dir, int type)
{ {
struct spoe_config *conf = FLT_CONF(ctx->filter); struct spoe_config *conf = FLT_CONF(ctx->filter);
@ -1277,8 +1247,7 @@ spoe_process_messages(struct stream *s, struct spoe_context *ctx,
/* Process a SPOE group, ie the list of messages attached to the group <grp>. /* Process a SPOE group, ie the list of messages attached to the group <grp>.
* See spoe_process_message for details. */ * See spoe_process_message for details. */
static int static int spoe_process_group(struct stream *s, struct spoe_context *ctx,
spoe_process_group(struct stream *s, struct spoe_context *ctx,
struct spoe_group *group, int dir) struct spoe_group *group, int dir)
{ {
struct spoe_config *conf = FLT_CONF(ctx->filter); struct spoe_config *conf = FLT_CONF(ctx->filter);
@ -1301,8 +1270,7 @@ spoe_process_group(struct stream *s, struct spoe_context *ctx,
/* Process a SPOE event, ie the list of messages attached to the event <ev>. /* Process a SPOE event, ie the list of messages attached to the event <ev>.
* See spoe_process_message for details. */ * See spoe_process_message for details. */
static int static int spoe_process_event(struct stream *s, struct spoe_context *ctx,
spoe_process_event(struct stream *s, struct spoe_context *ctx,
enum spoe_event ev) enum spoe_event ev)
{ {
struct spoe_config *conf = FLT_CONF(ctx->filter); struct spoe_config *conf = FLT_CONF(ctx->filter);
@ -1328,8 +1296,7 @@ spoe_process_event(struct stream *s, struct spoe_context *ctx,
/*************************************************************************** /***************************************************************************
* Functions that create/destroy SPOE contexts * Functions that create/destroy SPOE contexts
**************************************************************************/ **************************************************************************/
static int static int spoe_acquire_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
spoe_acquire_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
{ {
if (buf->size) if (buf->size)
return 1; return 1;
@ -1343,8 +1310,7 @@ spoe_acquire_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
return 0; return 0;
} }
static void static void spoe_release_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
spoe_release_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
{ {
b_dequeue(buffer_wait); b_dequeue(buffer_wait);
@ -1355,15 +1321,13 @@ spoe_release_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
} }
} }
static int static int spoe_wakeup_context(struct spoe_context *ctx)
spoe_wakeup_context(struct spoe_context *ctx)
{ {
task_wakeup(ctx->strm->task, TASK_WOKEN_MSG); task_wakeup(ctx->strm->task, TASK_WOKEN_MSG);
return 1; return 1;
} }
static struct spoe_context * static struct spoe_context *spoe_create_context(struct stream *s, struct filter *filter)
spoe_create_context(struct stream *s, struct filter *filter)
{ {
struct spoe_config *conf = FLT_CONF(filter); struct spoe_config *conf = FLT_CONF(filter);
struct spoe_context *ctx; struct spoe_context *ctx;
@ -1398,8 +1362,7 @@ spoe_create_context(struct stream *s, struct filter *filter)
return ctx; return ctx;
} }
static void static void spoe_destroy_context(struct filter *filter)
spoe_destroy_context(struct filter *filter)
{ {
struct spoe_config *conf = FLT_CONF(filter); struct spoe_config *conf = FLT_CONF(filter);
struct spoe_context *ctx = filter->ctx; struct spoe_context *ctx = filter->ctx;
@ -1412,8 +1375,7 @@ spoe_destroy_context(struct filter *filter)
filter->ctx = NULL; filter->ctx = NULL;
} }
static void static void spoe_reset_context(struct spoe_context *ctx)
spoe_reset_context(struct spoe_context *ctx)
{ {
ctx->state = SPOE_CTX_ST_READY; ctx->state = SPOE_CTX_ST_READY;
ctx->flags &= ~SPOE_CTX_FL_PROCESS; ctx->flags &= ~SPOE_CTX_FL_PROCESS;
@ -1428,8 +1390,7 @@ spoe_reset_context(struct spoe_context *ctx)
* Hooks that manage the filter lifecycle (init/check/deinit) * Hooks that manage the filter lifecycle (init/check/deinit)
**************************************************************************/ **************************************************************************/
/* Initialize the SPOE filter. Returns -1 on error, else 0. */ /* Initialize the SPOE filter. Returns -1 on error, else 0. */
static int static int spoe_init(struct proxy *px, struct flt_conf *fconf)
spoe_init(struct proxy *px, struct flt_conf *fconf)
{ {
struct spoe_config *conf = fconf->conf; struct spoe_config *conf = fconf->conf;
@ -1455,8 +1416,7 @@ spoe_init(struct proxy *px, struct flt_conf *fconf)
} }
/* Free resources allocated by the SPOE filter. */ /* Free resources allocated by the SPOE filter. */
static void static void spoe_deinit(struct proxy *px, struct flt_conf *fconf)
spoe_deinit(struct proxy *px, struct flt_conf *fconf)
{ {
struct spoe_config *conf = fconf->conf; struct spoe_config *conf = fconf->conf;
@ -1472,8 +1432,7 @@ spoe_deinit(struct proxy *px, struct flt_conf *fconf)
/* Check configuration of a SPOE filter for a specified proxy. /* Check configuration of a SPOE filter for a specified proxy.
* Return 1 on error, else 0. */ * Return 1 on error, else 0. */
static int static int spoe_check(struct proxy *px, struct flt_conf *fconf)
spoe_check(struct proxy *px, struct flt_conf *fconf)
{ {
struct flt_conf *f; struct flt_conf *f;
struct spoe_config *conf = fconf->conf; struct spoe_config *conf = fconf->conf;
@ -1532,8 +1491,7 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
*************************************************************************/ *************************************************************************/
/* Called when a filter instance is created and attach to a stream. It creates /* Called when a filter instance is created and attach to a stream. It creates
* the context that will be used to process this stream. */ * the context that will be used to process this stream. */
static int static int spoe_start(struct stream *s, struct filter *filter)
spoe_start(struct stream *s, struct filter *filter)
{ {
struct spoe_config *conf = FLT_CONF(filter); struct spoe_config *conf = FLT_CONF(filter);
struct spoe_agent *agent = conf->agent; struct spoe_agent *agent = conf->agent;
@ -1569,8 +1527,7 @@ spoe_start(struct stream *s, struct filter *filter)
/* Called when a filter instance is detached from a stream. It release the /* Called when a filter instance is detached from a stream. It release the
* attached SPOE context. */ * attached SPOE context. */
static void static void spoe_stop(struct stream *s, struct filter *filter)
spoe_stop(struct stream *s, struct filter *filter)
{ {
spoe_destroy_context(filter); spoe_destroy_context(filter);
} }
@ -1579,8 +1536,7 @@ spoe_stop(struct stream *s, struct filter *filter)
/* /*
* Called when the stream is woken up because of expired timer. * Called when the stream is woken up because of expired timer.
*/ */
static void static void spoe_check_timeouts(struct stream *s, struct filter *filter)
spoe_check_timeouts(struct stream *s, struct filter *filter)
{ {
struct spoe_context *ctx = filter->ctx; struct spoe_context *ctx = filter->ctx;
@ -1589,8 +1545,7 @@ spoe_check_timeouts(struct stream *s, struct filter *filter)
} }
/* Called when we are ready to filter data on a channel */ /* Called when we are ready to filter data on a channel */
static int static int spoe_start_analyze(struct stream *s, struct filter *filter, struct channel *chn)
spoe_start_analyze(struct stream *s, struct filter *filter, struct channel *chn)
{ {
struct spoe_context *ctx = filter->ctx; struct spoe_context *ctx = filter->ctx;
int ret = 1; int ret = 1;
@ -1634,8 +1589,7 @@ spoe_start_analyze(struct stream *s, struct filter *filter, struct channel *chn)
} }
/* Called before a processing happens on a given channel */ /* Called before a processing happens on a given channel */
static int static int spoe_chn_pre_analyze(struct stream *s, struct filter *filter,
spoe_chn_pre_analyze(struct stream *s, struct filter *filter,
struct channel *chn, unsigned an_bit) struct channel *chn, unsigned an_bit)
{ {
struct spoe_context *ctx = filter->ctx; struct spoe_context *ctx = filter->ctx;
@ -1674,8 +1628,7 @@ spoe_chn_pre_analyze(struct stream *s, struct filter *filter,
} }
/* Called when the filtering on the channel ends. */ /* Called when the filtering on the channel ends. */
static int static int spoe_end_analyze(struct stream *s, struct filter *filter, struct channel *chn)
spoe_end_analyze(struct stream *s, struct filter *filter, struct channel *chn)
{ {
struct spoe_context *ctx = filter->ctx; struct spoe_context *ctx = filter->ctx;
@ -1707,8 +1660,7 @@ struct flt_ops spoe_ops = {
}; };
static int static int cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
{ {
const char *err; const char *err;
int i, err_code = 0; int i, err_code = 0;
@ -2144,8 +2096,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
out: out:
return err_code; return err_code;
} }
static int static int cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
{ {
struct spoe_group *grp; struct spoe_group *grp;
const char *err; const char *err;
@ -2233,8 +2184,7 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
return err_code; return err_code;
} }
static int static int cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
{ {
struct spoe_message *msg; struct spoe_message *msg;
struct spoe_arg *arg; struct spoe_arg *arg;
@ -2429,8 +2379,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
} }
/* Return -1 on error, else 0 */ /* Return -1 on error, else 0 */
static int static int parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
struct flt_conf *fconf, char **err, void *private) struct flt_conf *fconf, char **err, void *private)
{ {
struct list backup_sections; struct list backup_sections;
@ -2854,8 +2803,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
* *
* It returns ACT_RET_CONT if processing is finished (with error or not), it returns * It returns ACT_RET_CONT if processing is finished (with error or not), it returns
* ACT_RET_YIELD if the action is in progress. */ * ACT_RET_YIELD if the action is in progress. */
static enum act_return static enum act_return spoe_send_group(struct act_rule *rule, struct proxy *px,
spoe_send_group(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags) struct session *sess, struct stream *s, int flags)
{ {
struct filter *filter; struct filter *filter;
@ -2919,8 +2867,7 @@ spoe_send_group(struct act_rule *rule, struct proxy *px,
* The function returns 1 in success case, otherwise, it returns 0 and err is * The function returns 1 in success case, otherwise, it returns 0 and err is
* filled. * filled.
*/ */
static int static int check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err)
check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err)
{ {
struct flt_conf *fconf; struct flt_conf *fconf;
struct spoe_config *conf; struct spoe_config *conf;
@ -3017,8 +2964,7 @@ check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err)
* message. Otherwise, it returns ACT_RET_PRS_OK and parsing engine and group * message. Otherwise, it returns ACT_RET_PRS_OK and parsing engine and group
* ids are saved and used later, when the rule will be checked. * ids are saved and used later, when the rule will be checked.
*/ */
static enum act_parse_ret static enum act_parse_ret parse_send_spoe_group(const char **args, int *orig_arg, struct proxy *px,
parse_send_spoe_group(const char **args, int *orig_arg, struct proxy *px,
struct act_rule *rule, char **err) struct act_rule *rule, char **err)
{ {
if (!*args[*orig_arg] || !*args[*orig_arg+1] || if (!*args[*orig_arg] || !*args[*orig_arg+1] ||