/************************************************************************/
/* set temp integer to the number of enabled servers on the proxy.
- * Accepts either 0 or 1 argument. Argument is a backend, other types will lead to
+ * Accepts exactly 1 argument. Argument is a backend, other types will lead to
* undefined behaviour.
*/
static int
struct acl_expr *expr, struct acl_test *test)
{
test->flags = ACL_TEST_F_VOL_TEST;
- if (expr->args)
- px = expr->args->data.prx;
+ px = expr->args->data.prx;
if (px->srv_act)
temp_pattern.data.integer = px->srv_act;
}
/* set temp integer to the number of enabled servers on the proxy.
- * Accepts either 0 or 1 argument. Argument is a backend, other types will lead to
+ * Accepts exactly 1 argument. Argument is a backend, other types will lead to
* undefined behaviour.
*/
static int
struct server *iterator;
test->flags = ACL_TEST_F_VOL_TEST;
- if (expr->args)
- px = expr->args->data.prx;
-
temp_pattern.data.integer = 0;
- iterator = px->srv;
- while (iterator) {
- if ((iterator->state & SRV_RUNNING) == 0) {
- iterator = iterator->next;
+
+ for (iterator = expr->args->data.prx->srv; iterator; iterator = iterator->next) {
+ if ((iterator->state & SRV_RUNNING) == 0)
continue;
- }
+
if (iterator->maxconn == 0 || iterator->maxqueue == 0) {
/* configuration is stupid */
temp_pattern.data.integer = -1;
temp_pattern.data.integer += (iterator->maxconn - iterator->cur_sess)
+ (iterator->maxqueue - iterator->nbpend);
- iterator = iterator->next;
}
return 1;
}
/* set temp integer to the number of connections per second reaching the backend.
- * Accepts either 0 or 1 argument. Argument is a backend, other types will lead to
+ * Accepts exactly 1 argument. Argument is a backend, other types will lead to
* undefined behaviour.
*/
static int
struct acl_expr *expr, struct acl_test *test)
{
test->flags = ACL_TEST_F_VOL_TEST;
- if (expr->args)
- px = expr->args->data.prx;
-
- temp_pattern.data.integer = read_freq_ctr(&px->be_sess_per_sec);
+ temp_pattern.data.integer = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
return 1;
}
/* set temp integer to the number of concurrent connections on the backend.
- * Accepts either 0 or 1 argument. Argument is a backend, other types will lead to
+ * Accepts exactly 1 argument. Argument is a backend, other types will lead to
* undefined behaviour.
*/
static int
struct acl_expr *expr, struct acl_test *test)
{
test->flags = ACL_TEST_F_VOL_TEST;
- if (expr->args)
- px = expr->args->data.prx;
-
- temp_pattern.data.integer = px->beconn;
+ temp_pattern.data.integer = expr->args->data.prx->beconn;
return 1;
}
/* set temp integer to the total number of queued connections on the backend.
- * Accepts either 0 or 1 argument. Argument is a backend, other types will lead to
+ * Accepts exactly 1 argument. Argument is a backend, other types will lead to
* undefined behaviour.
*/
static int
struct acl_expr *expr, struct acl_test *test)
{
test->flags = ACL_TEST_F_VOL_TEST;
- if (expr->args)
- px = expr->args->data.prx;
-
- temp_pattern.data.integer = px->totpend;
+ temp_pattern.data.integer = expr->args->data.prx->totpend;
return 1;
}
* server, we return twice the total, just as if we had half a running server.
* This is more or less correct anyway, since we expect the last server to come
* back soon.
- * Accepts either 0 or 1 argument. Argument is a backend, other types will lead to
+ * Accepts exactly 1 argument. Argument is a backend, other types will lead to
* undefined behaviour.
*/
static int
int nbsrv;
test->flags = ACL_TEST_F_VOL_TEST;
- if (expr->args)
- px = expr->args->data.prx;
+ px = expr->args->data.prx;
if (px->srv_act)
nbsrv = px->srv_act;
acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
- struct server *srv = expr->args->data.srv;
-
- temp_pattern.data.integer = srv->cur_sess;
+ temp_pattern.data.integer = expr->args->data.srv->cur_sess;
return 1;
}
/* set temp integer to the General Purpose Counter 0 value from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_get_gpc0(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* Increment the General Purpose Counter 0 value from the session's source
* address in the table pointed to by expr, and return it into temp integer.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_inc_gpc0(&px->table, test, stktable_update_key(&px->table, key));
}
/* Clear the General Purpose Counter 0 value from the session's source address
* in the table pointed to by expr, and return its previous value into temp integer.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_clr_gpc0(&px->table, test, stktable_update_key(&px->table, key));
}
/* set temp integer to the cumulated number of connections from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_conn_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the connection rate from the session's source address in the
* table pointed to by expr, over the configured period.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_conn_rate(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the number of connections from the session's source address
* in the table pointed to by expr, after updating it.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
+ px = expr->args->data.prx;
if ((ts = stktable_update_key(&px->table, key)) == NULL)
/* entry does not exist and could not be created */
/* set temp integer to the number of concurrent connections from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_conn_cur(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the cumulated number of session from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_sess_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the session rate from the session's source address in the
* table pointed to by expr, over the configured period.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_sess_rate(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the cumulated number of session from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_http_req_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the session rate from the session's source address in the
* table pointed to by expr, over the configured period.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_http_req_rate(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the cumulated number of session from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_http_err_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the session rate from the session's source address in the
* table pointed to by expr, over the configured period.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_http_err_rate(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the number of kbytes received from the session's source
* address in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_kbytes_in(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the bytes rate from clients from the session's source address
* in the table pointed to by expr, over the configured period.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_bytes_in_rate(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the number of kbytes sent to the session's source address in
* the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_kbytes_out(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the bytes rate to client from the session's source address in
* the table pointed to by expr, over the configured period.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
if (!key)
return 0;
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
return acl_fetch_bytes_out_rate(&px->table, test, stktable_lookup_key(&px->table, key));
}
/* set temp integer to the number of used entries in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
- if (expr->args)
- px = expr->args->data.prx;
-
test->flags = ACL_TEST_F_VOL_TEST;
- temp_pattern.data.integer = px->table.current;
+ temp_pattern.data.integer = expr->args->data.prx->table.current;
return 1;
}
/* set temp integer to the number of free entries in the table pointed to by expr.
- * Accepts 0 or 1 argument of type table.
+ * Accepts exactly 1 argument of type table.
*/
static int
acl_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
- if (expr->args)
- px = expr->args->data.prx;
-
+ px = expr->args->data.prx;
test->flags = ACL_TEST_F_VOL_TEST;
temp_pattern.data.integer = px->table.size - px->table.current;
return 1;