#include <haproxy/stream-t.h>
+extern struct peers_kw_list peers_keywords;
extern struct peers *cfg_peers;
int peers_init_sync(struct peers *peers);
int peers_alloc_dcache(struct peers *peers);
int peers_register_table(struct peers *, struct stktable *table);
void peers_setup_frontend(struct proxy *fe);
+void peers_register_keywords(struct peers_kw_list *pkwl);
#if defined(USE_OPENSSL)
static inline enum obj_type *peer_session_target(struct peer *p, struct stream *s)
curpeers->disabled = 0;
}
else if (*args[0] != 0) {
+ struct peers_kw_list *pkwl;
+ int index;
+ int rc = -1;
+
+ list_for_each_entry(pkwl, &peers_keywords.list, list) {
+ for (index = 0; pkwl->kw[index].kw != NULL; index++) {
+ if (strcmp(pkwl->kw[index].kw, args[0]) == 0) {
+ rc = pkwl->kw[index].parse(args, curpeers, file, linenum, &errmsg);
+ if (rc < 0) {
+ ha_alert("parsing [%s:%d] : %s\n", file, linenum, errmsg);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+ else if (rc > 0) {
+ ha_warning("parsing [%s:%d] : %s\n", file, linenum, errmsg);
+ err_code |= ERR_WARN;
+ goto out;
+ }
+ goto out;
+ }
+ }
+ }
+
ha_alert("parsing [%s:%d] : unknown keyword '%s' in '%s' section\n", file, linenum, args[0], cursection);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
dump_act_rules(&http_res_keywords.list, "\thttp-response ");
dump_act_rules(&http_after_res_keywords.list, "\thttp-after-response ");
}
+ if (section == CFG_PEERS) {
+ struct peers_kw_list *pkwl;
+ const struct peers_keyword *pkwp, *pkwn;
+ for (pkwn = pkwp = NULL;; pkwp = pkwn) {
+ list_for_each_entry(pkwl, &peers_keywords.list, list) {
+ for (index = 0; pkwl->kw[index].kw != NULL; index++) {
+ if (strordered(pkwp ? pkwp->kw : NULL,
+ pkwl->kw[index].kw,
+ pkwn != pkwp ? pkwn->kw : NULL))
+ pkwn = &pkwl->kw[index];
+ }
+ }
+ if (pkwn == pkwp)
+ break;
+ printf("\t%s\n", pkwn->kw);
+ }
+ }
if (section == CFG_CRTLIST) {
/* displays the keyword available for the crt-lists */
extern struct ssl_crtlist_kw ssl_crtlist_kws[] __maybe_unused;
return ret;
}
+
+struct peers_kw_list peers_keywords = {
+ .list = LIST_HEAD_INIT(peers_keywords.list)
+};
+
+void peers_register_keywords(struct peers_kw_list *pkwl)
+{
+ LIST_APPEND(&peers_keywords.list, &pkwl->list);
+}
+
/* config parser for global "tune.peers.max-updates-at-once" */
static int cfg_parse_max_updt_at_once(char **args, int section_type, struct proxy *curpx,
const struct proxy *defpx, const char *file, int line,