MINOR: listener: add a scope field in the bind keyword lists

This scope is used to report what the keywords are used for (eg: TCP,
UNIX, ...). It is now reported by bind_dump_kws().
This commit is contained in:
Willy Tarreau 2012-09-18 18:24:39 +02:00
parent 8638f4850f
commit 51fb7651c4
5 changed files with 10 additions and 7 deletions

View File

@ -173,9 +173,10 @@ struct bind_kw {
* A keyword list. It is a NULL-terminated array of keywords. It embeds a
* struct list in order to be linked to other lists, allowing it to easily
* be declared where it is needed, and linked without duplicating data nor
* allocating memory.
* allocating memory. It is also possible to indicate a scope for the keywords.
*/
struct bind_kw_list {
const char *scope;
struct list list;
struct bind_kw kw[VAR_ARRAY];
};

View File

@ -469,9 +469,11 @@ void bind_dump_kws(char **out)
for (index = 0; kwl->kw[index].kw != NULL; index++) {
if (kwl->kw[index].parse ||
bind_find_kw(kwl->kw[index].kw) == &kwl->kw[index]) {
memprintf(out, "%s%s %s\n", *out ? *out : "",
memprintf(out, "%s[%4s] %s%s%s\n", *out ? *out : "",
kwl->scope,
kwl->kw[index].kw,
kwl->kw[index].parse ? "" : "(not supported)");
kwl->kw[index].skip ? " <arg>" : "",
kwl->kw[index].parse ? "" : " (not supported)");
}
}
}
@ -662,7 +664,7 @@ static struct acl_kw_list acl_kws = {{ },{
* the config parser can report an appropriate error when a known keyword was
* not enabled.
*/
static struct bind_kw_list bind_kws = {{ },{
static struct bind_kw_list bind_kws = { "ALL", { }, {
{ "accept-proxy", bind_parse_accept_proxy, 0 }, /* enable PROXY protocol */
{ "backlog", bind_parse_backlog, 1 }, /* set backlog of listening socket */
{ "id", bind_parse_id, 1 }, /* set id of listening socket */

View File

@ -1842,7 +1842,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {{ },{
* the config parser can report an appropriate error when a known keyword was
* not enabled.
*/
static struct bind_kw_list bind_kws = {{ },{
static struct bind_kw_list bind_kws = { "TCP", { }, {
#ifdef TCP_DEFER_ACCEPT
{ "defer-accept", bind_parse_defer_accept, 0 }, /* wait for some data for 1 second max before doing accept */
#endif

View File

@ -493,7 +493,7 @@ static int bind_parse_user(char **args, int cur_arg, struct proxy *px, struct li
* the config parser can report an appropriate error when a known keyword was
* not enabled.
*/
static struct bind_kw_list bind_kws = {{ },{
static struct bind_kw_list bind_kws = { "UNIX", { }, {
{ "gid", bind_parse_gid, 1 }, /* set the socket's gid */
{ "group", bind_parse_group, 1 }, /* set the socket's gid from the group name */
{ "mode", bind_parse_mode, 1 }, /* set the socket's mode (eg: 0644)*/

View File

@ -903,7 +903,7 @@ static struct acl_kw_list acl_kws = {{ },{
* the config parser can report an appropriate error when a known keyword was
* not enabled.
*/
static struct bind_kw_list bind_kws = {{ },{
static struct bind_kw_list bind_kws = { "SSL", { }, {
{ "ciphers", bind_parse_ciphers, 1 }, /* set SSL cipher suite */
{ "crt", bind_parse_crt, 1 }, /* load SSL certificates from this location */
{ "nosslv3", bind_parse_nosslv3, 0 }, /* disable SSLv3 */