#endif
};
-typedef int const unlang_action_table_t[UNLANG_GROUP_TYPE_MAX][RLM_MODULE_NUMCODES];
+typedef int const unlang_action_table_t[RLM_MODULE_NUMCODES];
typedef struct {
rlm_components_t component;
#else
#define dump_tree(a, b)
#endif
-
-/* These are the default actions. For each section , the group{} block
- * behaves like the code from the old module_*() function. redundant{}
- * are based on my guesses of what they will be used for. --Pac. */
static const int
-defaultactions[MOD_COUNT][UNLANG_GROUP_TYPE_MAX][RLM_MODULE_NUMCODES] =
+defaultactions[MOD_COUNT][RLM_MODULE_NUMCODES] =
{
/* authenticate */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 4, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 4, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
3 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
},
/* authorize */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 3, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 3, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
+ 4 /* updated */
},
/* preacct */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 2, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- 1, /* noop */
- 3 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 2, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ MOD_ACTION_RETURN, /* notfound */
+ 1, /* noop */
+ 3 /* updated */
},
/* accounting */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 2, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- 1, /* noop */
- 3 /* updated */
- },
- /* redundant */
- {
- 1, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- 1, /* invalid */
- 1, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 2, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ MOD_ACTION_RETURN, /* notfound */
+ 1, /* noop */
+ 3 /* updated */
},
/* pre-proxy */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 3, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 3, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
+ 4 /* updated */
},
/* post-proxy */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 3, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 3, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
+ 4 /* updated */
},
/* post-auth */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 3, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 3, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
+ 4 /* updated */
}
#ifdef WITH_COA
,
/* recv-coa */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 3, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 3, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
+ 4 /* updated */
},
/* send-coa */
{
- /* group */
- {
- MOD_ACTION_RETURN, /* reject */
- MOD_ACTION_RETURN, /* fail */
- 3, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- 1, /* notfound */
- 2, /* noop */
- 4 /* updated */
- },
- /* redundant */
- {
- MOD_ACTION_RETURN, /* reject */
- 1, /* fail */
- MOD_ACTION_RETURN, /* ok */
- MOD_ACTION_RETURN, /* handled */
- MOD_ACTION_RETURN, /* invalid */
- MOD_ACTION_RETURN, /* disallow */
- MOD_ACTION_RETURN, /* notfound */
- MOD_ACTION_RETURN, /* noop */
- MOD_ACTION_RETURN /* updated */
- }
- }
+ MOD_ACTION_RETURN, /* reject */
+ MOD_ACTION_RETURN, /* fail */
+ 3, /* ok */
+ MOD_ACTION_RETURN, /* handled */
+ MOD_ACTION_RETURN, /* invalid */
+ MOD_ACTION_RETURN, /* disallow */
+ 1, /* notfound */
+ 2, /* noop */
+ 4 /* updated */
+ },
#endif
};
}
-static unlang_group_t *group_allocate(unlang_t *parent, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_type_t mod_type)
+static unlang_group_t *group_allocate(unlang_t *parent, CONF_SECTION *cs, unlang_type_t mod_type)
{
unlang_group_t *g;
unlang_t *c;
g = talloc_zero(ctx, unlang_group_t);
if (!g) return NULL;
- g->group_type = group_type;
g->children = NULL;
g->cs = cs;
}
-static unlang_t *compile_action_defaults(unlang_t *c, unlang_compile_t *unlang_ctx, unlang_group_type_t parentgroup_type)
+static unlang_t *compile_action_defaults(unlang_t *c, unlang_compile_t *unlang_ctx)
{
int i;
+ /*
+ * Children of "redundant" and "redundant-load-balance"
+ * have RETURN for all actions except fail. But THEIR children are normal.
+ */
+ if (c->parent &&
+ ((c->parent->type == UNLANG_TYPE_REDUNDANT) || (c->parent->type == UNLANG_TYPE_REDUNDANT_LOAD_BALANCE))) {
+ for (i = 0; i < RLM_MODULE_NUMCODES; i++) {
+ if (i == RLM_MODULE_FAIL) {
+ if (!c->actions[i]) {
+ c->actions[i] = 1;
+ }
+
+ continue;
+ }
+
+ if (!c->actions[i]) {
+ c->actions[i] = MOD_ACTION_RETURN;
+ }
+ }
+
+ return c;
+ }
+
/*
* Set the default actions, if they haven't already been
* set.
*/
for (i = 0; i < RLM_MODULE_NUMCODES; i++) {
if (!c->actions[i]) {
- c->actions[i] = unlang_ctx->actions[0][parentgroup_type][i];
+ c->actions[i] = unlang_ctx->actions[0][i];
}
}
}
static unlang_t *compile_map(unlang_t *parent, unlang_compile_t *unlang_ctx,
- CONF_SECTION *cs, UNUSED unlang_group_type_t group_type,
- unlang_group_type_t parentgroup_type, UNUSED unlang_type_t mod_type)
+ CONF_SECTION *cs, UNUSED unlang_type_t mod_type)
{
int rcode;
unlang_group_t *g;
return NULL;
}
- g = group_allocate(parent, cs, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_MAP);
+ g = group_allocate(parent, cs, UNLANG_TYPE_MAP);
if (!g) return NULL;
/*
}
c = unlang_group_to_generic(g);
- (void) compile_action_defaults(c, unlang_ctx, parentgroup_type);
+ (void) compile_action_defaults(c, unlang_ctx);
g->map = talloc_steal(g, head);
if (vpt) g->vpt = talloc_steal(g, vpt);
}
static unlang_t *compile_update(unlang_t *parent, unlang_compile_t *unlang_ctx,
- CONF_SECTION *cs, unlang_group_type_t group_type,
- UNUSED unlang_group_type_t parentgroup_type, UNUSED unlang_type_t mod_type)
+ CONF_SECTION *cs, UNUSED unlang_type_t mod_type)
{
int rcode;
unlang_group_t *g;
return NULL;
}
- g = group_allocate(parent, cs, group_type, UNLANG_TYPE_UPDATE);
+ g = group_allocate(parent, cs, UNLANG_TYPE_UPDATE);
if (!g) return NULL;
c = unlang_group_to_generic(g);
c->debug_name = unlang_ops[c->type].name;
}
- (void) compile_action_defaults(c, unlang_ctx, UNLANG_GROUP_TYPE_SIMPLE);
+ (void) compile_action_defaults(c, unlang_ctx);
g->map = talloc_steal(g, head);
}
static unlang_t *compile_filter(unlang_t *parent, unlang_compile_t *unlang_ctx,
- CONF_SECTION *cs, unlang_group_type_t group_type,
- UNUSED unlang_group_type_t parentgroup_type, UNUSED unlang_type_t mod_type)
+ CONF_SECTION *cs, UNUSED unlang_type_t mod_type)
{
int rcode;
unlang_group_t *g;
return NULL;
}
- g = group_allocate(parent, cs, group_type, UNLANG_TYPE_FILTER);
+ g = group_allocate(parent, cs, UNLANG_TYPE_FILTER);
if (!g) return NULL;
c = unlang_group_to_generic(g);
c->debug_name = unlang_ops[c->type].name;
}
- (void) compile_action_defaults(c, unlang_ctx, UNLANG_GROUP_TYPE_SIMPLE);
+ (void) compile_action_defaults(c, unlang_ctx);
g->map = talloc_steal(g, head);
}
static unlang_t *compile_empty(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type,
- fr_cond_type_t cond_type)
+ unlang_type_t mod_type, fr_cond_type_t cond_type)
{
unlang_group_t *g;
unlang_t *c;
- g = group_allocate(parent, cs, group_type, mod_type);
+ g = group_allocate(parent, cs, mod_type);
if (!g) return NULL;
c = unlang_group_to_generic(g);
g->cond->type = cond_type;
}
- return compile_action_defaults(c, unlang_ctx, parentgroup_type);
+ return compile_action_defaults(c, unlang_ctx);
}
static unlang_t *compile_item(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci,
- unlang_group_type_t parent_group_type, char const **modname);
+ char const **modname);
/* unlang_group_ts are grown by adding a unlang_t to the end */
}
-static unlang_t *compile_children(unlang_group_t *g, unlang_t *parent, unlang_compile_t *unlang_ctx,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type)
+static unlang_t *compile_children(unlang_group_t *g, unlang_t *parent, unlang_compile_t *unlang_ctx)
{
CONF_ITEM *ci = NULL;
unlang_t *c;
/*
* Otherwise it's a real keyword.
*/
- single = compile_item(c, unlang_ctx, ci, group_type, &name1);
+ single = compile_item(c, unlang_ctx, ci, &name1);
if (!single) {
cf_log_err(ci, "Failed to parse \"%s\" subsection", cf_section_name1(subcs));
talloc_free(c);
unlang_t *single;
char const *name = NULL;
- single = compile_item(c, unlang_ctx, ci, group_type, &name);
+ single = compile_item(c, unlang_ctx, ci, &name);
if (!single) {
/*
* Skip optional modules, which start with '-'
}
}
- return compile_action_defaults(c, unlang_ctx, parentgroup_type);
+ return compile_action_defaults(c, unlang_ctx);
}
* Generic "compile a section with more unlang inside of it".
*/
static unlang_t *compile_group(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type,
- unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
unlang_group_t *g;
unlang_t *c;
- g = group_allocate(parent, cs, group_type, mod_type);
+ g = group_allocate(parent, cs, mod_type);
if (!g) return NULL;
c = unlang_group_to_generic(g);
c->name = talloc_typed_strdup(c, unlang_ops[c->type].name);
c->debug_name = talloc_typed_strdup(c, c->name);
- return compile_children(g, parent, unlang_ctx, group_type, parentgroup_type);
+ return compile_children(g, parent, unlang_ctx);
}
static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type,
- unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
CONF_ITEM *ci;
FR_TOKEN type;
return NULL;
}
- g = group_allocate(parent, cs, group_type, mod_type);
+ g = group_allocate(parent, cs, mod_type);
if (!g) return NULL;
/*
return NULL;
}
- return compile_children(g, parent, unlang_ctx, group_type, parentgroup_type);
+ return compile_children(g, parent, unlang_ctx);
}
static unlang_t *compile_case(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
int i;
char const *name2;
}
} /* else it's a default 'case' statement */
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
if (!c) {
talloc_free(vpt);
return NULL;
}
static unlang_t *compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
FR_TOKEN type;
char const *name2;
*/
vpt->tmpl_num = NUM_ALL;
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
if (!c) {
talloc_free(vpt);
return NULL;
return NULL;
}
- c = compile_empty(parent, unlang_ctx, NULL, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_GROUP_TYPE_SIMPLE,
+ c = compile_empty(parent, unlang_ctx, NULL,
UNLANG_TYPE_BREAK, COND_TYPE_INVALID);
if (!c) return NULL;
return NULL;
}
- return compile_empty(parent, unlang_ctx, NULL, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_GROUP_TYPE_SIMPLE,
+ return compile_empty(parent, unlang_ctx, NULL,
UNLANG_TYPE_DETACH, COND_TYPE_INVALID);
}
#endif
c->debug_name = c->name;
c->type = UNLANG_TYPE_XLAT_INLINE;
- (void) compile_action_defaults(c, unlang_ctx, UNLANG_GROUP_TYPE_SIMPLE);
+ (void) compile_action_defaults(c, unlang_ctx);
mx->xlat_name = talloc_typed_strdup(mx, cf_pair_attr(cp));
if (mx->xlat_name[0] == '%') {
}
static unlang_t *compile_if(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
unlang_t *c;
unlang_group_t *g;
if (cond->type == COND_TYPE_FALSE) {
cf_log_debug_prefix(cs, "Skipping contents of '%s' as it is always 'false'",
unlang_ops[mod_type].name);
- return compile_empty(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type, COND_TYPE_FALSE);
+ return compile_empty(parent, unlang_ctx, cs, mod_type, COND_TYPE_FALSE);
}
/*
*/
if (!fr_cond_walk(cond, pass2_cond_callback, unlang_ctx)) return NULL;
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
if (!c) return NULL;
c->name = unlang_ops[c->type].name;
}
static unlang_t *compile_elsif(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
int rcode;
rcode = previous_if(cs, parent, mod_type);
if (rcode < 0) return NULL;
- if (rcode == 0) return compile_empty(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type, COND_TYPE_TRUE);
+ if (rcode == 0) return compile_empty(parent, unlang_ctx, cs, mod_type, COND_TYPE_TRUE);
- return compile_if(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ return compile_if(parent, unlang_ctx, cs, mod_type);
}
-static unlang_t *compile_else(unlang_t *parent,
- unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+static unlang_t *compile_else(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
+ unlang_type_t mod_type)
{
int rcode;
unlang_t *c;
if (rcode < 0) return NULL;
if (rcode == 0) {
- c = compile_empty(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type, COND_TYPE_TRUE);
+ c = compile_empty(parent, unlang_ctx, cs, mod_type, COND_TYPE_TRUE);
} else {
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
}
if (!c) return c;
static unlang_t *compile_redundant(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
char const *name2;
unlang_t *c;
return NULL;
}
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
if (!c) return NULL;
/*
}
static unlang_t *compile_load_balance(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
char const *name2;
unlang_t *c;
return NULL;
}
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
if (!c) return NULL;
g = unlang_generic_to_group(c);
}
static unlang_t *compile_parallel(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
unlang_t *c;
char const *name2;
}
- c = compile_group(parent, unlang_ctx, cs, group_type, parentgroup_type, mod_type);
+ c = compile_group(parent, unlang_ctx, cs, mod_type);
if (!c) return NULL;
g = unlang_generic_to_group(c);
static unlang_t *compile_subrequest(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type)
+ unlang_type_t mod_type)
{
char const *name2;
unlang_t *c;
char buffer2[64];
char buffer3[64];
- g = group_allocate(parent, cs, group_type, mod_type);
+ g = group_allocate(parent, cs, mod_type);
if (!g) return NULL;
c = unlang_group_to_generic(g);
* of the dictionary && namespace that was given by the
* subrequest.
*/
- c = compile_children(g, parent, &unlang_ctx2, group_type, parentgroup_type);
+ c = compile_children(g, parent, &unlang_ctx2);
if (!c) return NULL;
g->dict = dict;
static unlang_t *compile_call(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type,
unlang_type_t mod_type)
{
unlang_group_t *g;
return NULL;
}
- g = group_allocate(parent, cs, group_type, mod_type);
+ g = group_allocate(parent, cs, mod_type);
if (!g) return NULL;
server_cs = virtual_server_find(server);
c->name = unlang_ops[c->type].name;
c->debug_name = talloc_typed_asprintf(c, "%s %s", c->name, server);
- return compile_children(g, parent, unlang_ctx, group_type, parentgroup_type);
+ return compile_children(g, parent, unlang_ctx);
}
static unlang_t *compile_module(unlang_t *parent, unlang_compile_t *unlang_ctx,
CONF_ITEM *ci, module_instance_t *inst, module_method_t method,
- unlang_group_type_t parentgroup_type, char const *realname)
+ char const *realname)
{
unlang_t *c;
unlang_module_t *single;
c->parent = parent;
c->next = NULL;
- (void) compile_action_defaults(c, unlang_ctx, parentgroup_type);
+ (void) compile_action_defaults(c, unlang_ctx);
c->name = realname;
c->debug_name = realname;
}
typedef unlang_t *(*modcall_compile_function_t)(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs,
- unlang_group_type_t group_type, unlang_group_type_t parentgroup_type, unlang_type_t mod_type);
+ unlang_type_t mod_type);
typedef struct {
char const *name;
modcall_compile_function_t compile;
- unlang_group_type_t group_type;
unlang_type_t mod_type;
bool require_children;
} modcall_compile_t;
#define REQUIRE_CHILDREN (true)
static modcall_compile_t compile_table[] = {
- { "group", compile_group, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_GROUP, REQUIRE_CHILDREN },
- { "redundant", compile_redundant, UNLANG_GROUP_TYPE_REDUNDANT, UNLANG_TYPE_GROUP, REQUIRE_CHILDREN },
- { "load-balance", compile_load_balance, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_LOAD_BALANCE, REQUIRE_CHILDREN },
- { "redundant-load-balance", compile_load_balance, UNLANG_GROUP_TYPE_REDUNDANT, UNLANG_TYPE_REDUNDANT_LOAD_BALANCE, REQUIRE_CHILDREN },
-
- { "case", compile_case, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_CASE, ALLOW_EMPTY_GROUP },
- { "foreach", compile_foreach, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_FOREACH, REQUIRE_CHILDREN },
- { "if", compile_if, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_IF, ALLOW_EMPTY_GROUP },
- { "elsif", compile_elsif, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_ELSIF, ALLOW_EMPTY_GROUP },
- { "else", compile_else, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_ELSE, REQUIRE_CHILDREN },
- { "filter", compile_filter, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_FILTER, REQUIRE_CHILDREN },
- { "update", compile_update, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_UPDATE, REQUIRE_CHILDREN },
- { "map", compile_map, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_MAP, REQUIRE_CHILDREN },
- { "switch", compile_switch, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_SWITCH, REQUIRE_CHILDREN },
- { "parallel", compile_parallel, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_PARALLEL, REQUIRE_CHILDREN },
- { "subrequest", compile_subrequest, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_SUBREQUEST, REQUIRE_CHILDREN },
- { "call", compile_call, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_CALL, ALLOW_EMPTY_GROUP },
-
- { NULL, NULL, 0, UNLANG_TYPE_NULL }
+ { "group", compile_group, UNLANG_TYPE_GROUP, REQUIRE_CHILDREN },
+ { "redundant", compile_redundant, UNLANG_TYPE_REDUNDANT, REQUIRE_CHILDREN },
+ { "load-balance", compile_load_balance, UNLANG_TYPE_LOAD_BALANCE, REQUIRE_CHILDREN },
+ { "redundant-load-balance", compile_load_balance, UNLANG_TYPE_REDUNDANT_LOAD_BALANCE, REQUIRE_CHILDREN },
+
+ { "case", compile_case, UNLANG_TYPE_CASE, ALLOW_EMPTY_GROUP },
+ { "foreach", compile_foreach, UNLANG_TYPE_FOREACH, REQUIRE_CHILDREN },
+ { "if", compile_if, UNLANG_TYPE_IF, ALLOW_EMPTY_GROUP },
+ { "elsif", compile_elsif, UNLANG_TYPE_ELSIF, ALLOW_EMPTY_GROUP },
+ { "else", compile_else, UNLANG_TYPE_ELSE, REQUIRE_CHILDREN },
+ { "filter", compile_filter, UNLANG_TYPE_FILTER, REQUIRE_CHILDREN },
+ { "update", compile_update, UNLANG_TYPE_UPDATE, REQUIRE_CHILDREN },
+ { "map", compile_map, UNLANG_TYPE_MAP, REQUIRE_CHILDREN },
+ { "switch", compile_switch, UNLANG_TYPE_SWITCH, REQUIRE_CHILDREN },
+ { "parallel", compile_parallel, UNLANG_TYPE_PARALLEL, REQUIRE_CHILDREN },
+ { "subrequest", compile_subrequest, UNLANG_TYPE_SUBREQUEST, REQUIRE_CHILDREN },
+ { "call", compile_call, UNLANG_TYPE_CALL, ALLOW_EMPTY_GROUP },
+
+ { NULL, NULL, UNLANG_TYPE_NULL, false }
};
/*
* Compile one entry of a module call.
*/
-static unlang_t *compile_item(unlang_t *parent,
- unlang_compile_t *unlang_ctx, CONF_ITEM *ci,
- unlang_group_type_t parent_group_type, char const **modname)
+static unlang_t *compile_item(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci,
+ char const **modname)
{
char const *modrefname, *p;
unlang_t *c;
}
return compile_table[i].compile(parent, unlang_ctx, cs,
- compile_table[i].group_type, parent_group_type,
compile_table[i].mod_type);
}
}
if (name2 && (virtual_server_section_component(&component, modrefname, name2) == 0)) {
UPDATE_CTX2;
- c = compile_group(parent, &unlang_ctx2, cs, UNLANG_GROUP_TYPE_SIMPLE, parent_group_type, UNLANG_TYPE_GROUP);
+ c = compile_group(parent, &unlang_ctx2, cs, UNLANG_TYPE_GROUP);
if (!c) return NULL;
c->name = modrefname;
}
if (strcmp(modrefname, "return") == 0) {
- c = compile_empty(parent, unlang_ctx, NULL, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_RETURN, COND_TYPE_INVALID);
+ c = compile_empty(parent, unlang_ctx, NULL, UNLANG_TYPE_RETURN, COND_TYPE_INVALID);
if (!c) return NULL;
/*
return NULL;
}
- c = compile_item(parent, &unlang_ctx2, cf_section_to_item(subcs), parent_group_type, modname);
+ c = compile_item(parent, &unlang_ctx2, cf_section_to_item(subcs), modname);
if (!c) return NULL;
} else {
*
* group foo { ...
*/
- c = compile_group(parent, &unlang_ctx2, subcs, UNLANG_GROUP_TYPE_SIMPLE, parent_group_type,
+ c = compile_group(parent, &unlang_ctx2, subcs,
policy ? UNLANG_TYPE_POLICY : UNLANG_TYPE_GROUP);
if (!c) return NULL;
realname);
if (inst) {
*modname = inst->module->name;
- return compile_module(parent, &unlang_ctx2, ci, inst, method, parent_group_type, realname);
+ return compile_module(parent, &unlang_ctx2, ci, inst, method, realname);
}
/*
.actions = &defaultactions[component],
.rules = rules
},
- cs, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_GROUP_TYPE_SIMPLE, UNLANG_TYPE_GROUP);
+ cs, UNLANG_TYPE_GROUP);
if (!c) return -1;
unlang_group_name_from_cs(unlang_generic_to_group(c), cs);