97 ((unsigned int) (sizeof(opt_profiles) / sizeof(opt_profiles[0])))
140 if ((
NULL == name_or_idx) || (0 == name_or_idx[0]))
147 if ((
'0' <= name_or_idx[0]) && (
'9' >= name_or_idx[0]))
152 v = strtoul (name_or_idx, &end, 10);
170 if (0 == strcmp (s,
"external"))
172 else if (0 == strcmp (s,
"internal"))
174 else if ((0 == strcmp (s,
"per-connection")) ||
175 (0 == strcmp (s,
"tpc")))
177 else if (0 == strcmp (s,
"pool"))
195 if (0 == strcmp (s,
"select"))
197 else if (0 == strcmp (s,
"poll"))
199 else if (0 == strcmp (s,
"epoll"))
214_MHD_NORETURN
static void
218 "Invalid value '%s' for the environment variable %s.\n",
219 (
NULL != value) ? value :
"(null)",
229 const char *prof_env;
231 const char *discp_env;
232 const char *strict_env;
234 const char *poll_env;
246 if ((
NULL == prof_env) && (
NULL == mem_env) && (
NULL == discp_env) &&
247 (
NULL == strict_env) && (
NULL == thr_env) && (
NULL == poll_env))
250 if (
NULL != prof_env)
269 if (0 == strcmp (mem_env,
"default"))
276 v = strtoul (mem_env, &end, 10);
277 if ((
NULL == end) || (0 != *end))
282 if (
NULL != discp_env)
287 v = strtol (discp_env, &end, 10);
288 if ((
NULL == end) || (0 != *end) || (-3 > v) || (3 < v))
293 if (
NULL != strict_env)
298 v = strtol (strict_env, &end, 10);
299 if ((
NULL == end) || (0 != *end))
312 if (
NULL != poll_env)
371 static const char *
const thr_names[] = {
372 "external polling",
"internal thread",
"thread-per-connection",
375 static const char *
const poll_names[] = {
"select()",
"poll()",
"epoll" };
382 snprintf (buf, buf_size,
"(built-in defaults of the test)");
386 snprintf (mem,
sizeof(mem),
"default");
388 snprintf (mem,
sizeof(mem),
"%lu", (
unsigned long) prof->
mem_limit);
396 snprintf (discp,
sizeof(discp),
"strict_for_client=%d -> discipline_lvl=%d",
400 snprintf (discp,
sizeof(discp),
"discipline_lvl=%d", prof->
discipline_lvl);
401 snprintf (buf, buf_size,
402 "'%s' (mem_limit=%s, %s, %s%s, %s)",
406 thr_names[(
unsigned int) prof->
threading],
416 unsigned int max_ops)
459 unsigned int base_flags,
462 unsigned int flags = base_flags;
511 if ((
NULL == prof) || (0 == min_limit) || (0 == prof->
mem_limit))
524 const char *
name = (
NULL != test_name) ? test_name :
"test";
528 printf (
"%s: option matrix profile %s\n",
_MHD_EXTERN enum MHD_Result MHD_is_feature_supported(enum MHD_FEATURE feature)
static struct MHD_OptMatrixProfile env_profile
unsigned int mhd_opt_matrix_num_profiles(void)
const struct MHD_OptMatrixProfile * mhd_opt_matrix_lookup(const char *name_or_idx)
const struct MHD_OptMatrixProfile * mhd_opt_matrix_profile(unsigned int idx)
const struct MHD_OptMatrixProfile * mhd_opt_matrix_from_env(void)
int mhd_opt_matrix_profile_supported(const struct MHD_OptMatrixProfile *prof)
unsigned int mhd_opt_matrix_fill_options(const struct MHD_OptMatrixProfile *prof, struct MHD_OptionItem *ops, unsigned int max_ops)
int mhd_opt_matrix_effective_discipline(const struct MHD_OptMatrixProfile *prof)
static _MHD_NORETURN void env_error(const char *name, const char *value)
static int parse_threading(const char *s, enum MHD_OptMatrixThreading *out)
const char * mhd_opt_matrix_describe(const struct MHD_OptMatrixProfile *prof, char *buf, size_t buf_size)
static const struct MHD_OptMatrixProfile opt_profiles[]
void mhd_opt_matrix_print_notice(const char *test_name)
int mhd_opt_matrix_raise_mem_limit(struct MHD_OptMatrixProfile *prof, size_t min_limit)
static int parse_poll(const char *s, enum MHD_OptMatrixPoll *out)
int mhd_opt_matrix_is_external(const struct MHD_OptMatrixProfile *prof)
unsigned int mhd_opt_matrix_daemon_flags(const struct MHD_OptMatrixProfile *prof, unsigned int base_flags, int allow_external)
static char env_profile_name[64]
The environment-driven daemon option matrix shared by the tests.
@ MHD_OPT_MATRIX_THR_EXTERNAL
@ MHD_OPT_MATRIX_THR_POOL
@ MHD_OPT_MATRIX_THR_INTERNAL
@ MHD_OPT_MATRIX_THR_PER_CONNECTION
#define MHD_OPT_MATRIX_THREADING_ENV
#define MHD_OPT_MATRIX_STRICT_ENV
#define MHD_OPT_MATRIX_DISCP_ENV
#define MHD_OPT_MATRIX_MEM_ENV
#define MHD_OPT_MATRIX_PROFILE_ENV
@ MHD_OPT_MATRIX_POLL_POLL
@ MHD_OPT_MATRIX_POLL_EPOLL
@ MHD_OPT_MATRIX_POLL_SELECT
#define MHD_OPT_MATRIX_POLL_ENV
public interface to libmicrohttpd
@ MHD_OPTION_CLIENT_DISCIPLINE_LVL
@ MHD_OPTION_THREAD_POOL_SIZE
@ MHD_OPTION_CONNECTION_MEMORY_LIMIT
@ MHD_OPTION_STRICT_FOR_CLIENT
@ MHD_USE_THREAD_PER_CONNECTION
@ MHD_USE_INTERNAL_POLLING_THREAD
enum MHD_OptMatrixThreading threading
enum MHD_OptMatrixPoll poll_backend
unsigned int thread_pool_size