From: Thomas Holmes Date: Tue, 12 May 2015 14:50:47 +0000 (+0100) Subject: MINOR: config: add 51Degrees config parsing. X-Git-Tag: v1.6-dev2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0809f26869a136ddff81b93d70b61441d6cebe7d;p=thirdparty%2Fhaproxy.git MINOR: config: add 51Degrees config parsing. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 7ffc0377f2..44b1c2ca33 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1749,6 +1749,48 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; #endif } +#ifdef USE_51DEGREES + else if (strcmp(args[0], "51degrees-data-file") == 0) { + if(!*(args[1])) { + Alert("parsing [%s:%d]: '%s' expects a filepath to a 51Degrees data file.\n", file, linenum, args[0]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + global._51d_data_file_path = strdup(args[1]); + } + else if (strcmp(args[0], "51degrees-property-seperator") == 0) { + if(!*(args[1])) { + Alert("parsing [%s:%d]: '%s' expects a ingle character.\n", file, linenum, args[0]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + if (strlen(args[1]) > 1) { + Alert("parsing [%s:%d]: '%s' expects a ingle character, got '%s'.\n", file, linenum, args[0], args[1]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + global._51d_property_seperator = *args[1]; + } + else if (strcmp(args[0], "51degrees-property-name-list") == 0) { + int arg; + struct _51d_property_names *name; + + arg = 1; + if (!*args[arg]) { + Alert("parsing [%s:%d]: '%s' expects at least one 51Degrees property name.\n", file, linenum, args[0]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + + LIST_INIT(&global._51d_property_names); + while (*args[arg]) { + name = calloc(1, sizeof(struct _51d_property_names)); + name->name = strdup(args[arg]); + LIST_ADDQ(&global._51d_property_names, &name->list); + ++arg; + } + } +#endif else { struct cfg_kw_list *kwl; int index;