static const char* config_address_slot(cmd_parms* cmd, void* _conf, \
                      const char* param1, const char* param2, const char* param3)
{
  const char* r;
  multicast_conf* conf = _conf;
  r = string_to_addr_in(conf->pool, param1, NULL, &(conf->multicast_interface));
  if(r==NULL) {
    r = string_to_addr_in(conf->pool, param2, param3, &(conf->multicast_address));
  }
  conf->enabled = (r==NULL)? TRUE: FALSE;

  return r;
}

static const command_rec config_cmds[] = {
  AP_INIT_TAKE3(CONFIG_MULTICAST, config_address_slot, NULL, OR_OPTIONS, "Multicast options."),
  { NULL },
};

static void multicast_index_register_hooks(apr_pool_t *p)
{
  ap_hook_handler(multicast_index_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

// Dispatch list for API hooks.
module AP_MODULE_DECLARE_DATA multicast_index_module = {
  STANDARD20_MODULE_STUFF, 
  config_create,    // create per-dir    config structures
  NULL,             // merge  per-dir    config structures
  NULL,             // create per-server config structures
  NULL,             // merge  per-server config structures
     * (RSRC_CONF) and the method define_filter is to be called. The directive
     * takes any number of arguments which get passed "raw" to the method.
     */
    AP_INIT_RAW_ARGS("ReplaceFilterDefine",
                     define_filter,
                     NULL,
                     RSRC_CONF,
                     "Define a replace filter"),
    /** Add a replacement pattern to the specified filter. The directive takes
     * three arguments: the name of the filter, the regular expression for the
     * pattern and the replacement string. This directive is also allowed
     * everywhere (RSRC_CONF) and add_pattern is called.
     */
    AP_INIT_TAKE3("ReplacePattern",
                  add_pattern,
                  NULL,
                  RSRC_CONF,
                  "usage: ReplacePattern filtername pattern replacement"),
    /** Add a header replacement pattern to the specified filter. This 
     * directive takes four arguments: the name of the filter, the name of the 
     * header field, the regular expression for the pattern and its replacement
     * string. 
     */
    AP_INIT_RAW_ARGS("HeaderReplacePattern",
		   add_header_pattern,
		   NULL,
		   RSRC_CONF,
		   "usage: HeaderReplacePattern filtername header pattern replacement"),
    /** Add a REQUEST header pattern. This pattern is processed in a different
     * way than the other patterns, since it has to be processed before the 
     * proxy module catches the request. This filter is independet from any 
示例#3
0
        }
    }
    else if (add->chain) {
        conf->chain = add->chain;
    }
    else {
        conf->chain = base->chain;
    }

    return conf;
}

static const command_rec filter_cmds[] = {
    AP_INIT_TAKE12("FilterDeclare", filter_declare, NULL, OR_OPTIONS,
        "filter-name [filter-type]"),
    AP_INIT_TAKE3("FilterProvider", filter_provider, NULL, OR_OPTIONS,
        "filter-name provider-name match-expression"),
    AP_INIT_ITERATE("FilterChain", filter_chain, NULL, OR_OPTIONS,
        "list of filter names with optional [+-=!@]"),
    AP_INIT_TAKE2("FilterTrace", filter_debug, NULL, RSRC_CONF | ACCESS_CONF,
        "filter-name debug-level"),
    AP_INIT_TAKE_ARGV("AddOutputFilterByType", filter_bytype, NULL, OR_FILEINFO,
        "output filter name followed by one or more content-types"),
#ifndef NO_PROTOCOL
    AP_INIT_TAKE23("FilterProtocol", filter_protocol, NULL, OR_OPTIONS,
        "filter-name [provider-name] protocol-args"),
#endif
    { NULL }
};

AP_DECLARE_MODULE(filter) = {
    STANDARD20_MODULE_STUFF,
    "AuthOpenIDCookieName <name of cookie to use>"),
    AP_INIT_TAKE1("AuthOpenIDCookiePath", (CMD_HAND_TYPE) set_modauthopenid_cookie_path, NULL, OR_AUTHCFG,
    "AuthOpenIDCookiePath <path of cookie to use>"),
    AP_INIT_FLAG("AuthOpenIDUseCookie", (CMD_HAND_TYPE) set_modauthopenid_usecookie, NULL, OR_AUTHCFG,
    "AuthOpenIDUseCookie <On | Off> - use session auth?"),
    AP_INIT_FLAG("AuthOpenIDSecureCookie", (CMD_HAND_TYPE) set_modauthopenid_secure_cookie, NULL, OR_AUTHCFG,
    "AuthOpenIDSecureCookie <On | Off> - restrict session cookie to HTTPS connections"),
    AP_INIT_ITERATE("AuthOpenIDTrusted", (CMD_HAND_TYPE) add_modauthopenid_trusted, NULL, OR_AUTHCFG,
    "AuthOpenIDTrusted <a list of trusted identity providers>"),
    AP_INIT_ITERATE("AuthOpenIDDistrusted", (CMD_HAND_TYPE) add_modauthopenid_distrusted, NULL, OR_AUTHCFG,
    "AuthOpenIDDistrusted <a blacklist list of identity providers>"),
    AP_INIT_TAKE1("AuthOpenIDServerName", (CMD_HAND_TYPE) set_modauthopenid_server_name, NULL, OR_AUTHCFG,
    "AuthOpenIDServerName <server name and port prefix>"),
    AP_INIT_TAKE1("AuthOpenIDUserProgram", (CMD_HAND_TYPE) set_modauthopenid_auth_program, NULL, OR_AUTHCFG,
    "AuthOpenIDUserProgram <full path to authentication program>"),
    AP_INIT_TAKE3("AuthOpenIDAXRequire", (CMD_HAND_TYPE) set_modauthopenid_ax_require, NULL, OR_AUTHCFG,
    "Add AuthOpenIDAXRequire <alias> <URI> <regex>"),
    AP_INIT_TAKE1("AuthOpenIDAXUsername", (CMD_HAND_TYPE) set_modauthopenid_ax_username, NULL, OR_AUTHCFG,
    "AuthOpenIDAXUsername <alias>"),
    AP_INIT_TAKE1("AuthOpenIDSingleIdP", (CMD_HAND_TYPE) set_modauthopenid_single_idp, NULL, OR_AUTHCFG,
    "AuthOpenIDSingleIdP <IdP URL>"),
    {NULL}
};

// Get the full URI of the request_rec's request location
// clean_params specifies whether or not all openid.* and modauthopenid.* params should be cleared
static void full_uri(request_rec *r, std::string& result, modauthopenid_config *s_cfg, bool clean_params=false) {
    std::string hostname(r->hostname);
    std::string uri(r->uri);
    apr_port_t i_port = ap_get_server_port(r);
    // Fetch the APR function for determining if we are looking at an https URL
    APR_OPTIONAL_FN_TYPE(ssl_is_https) *using_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https);
示例#5
0
static void
lisp_child_init (apr_pool_t * pool, server_rec * s)
{
  if (APR_SUCCESS == apr_pool_create ((&socket_pool), 0))
    {
      apr_pool_cleanup_register (pool, 0, destroy_socket_pool, destroy_socket_pool);
#if APR_HAS_THREADS
      apr_threadkey_private_create(&cfg_key, NULL, socket_pool);
#endif
    }
}

static const command_rec lisp_command_handlers [] =
{
  AP_INIT_TAKE3
    ("LispServer", lisp_set_server, 0, OR_ALL,
     "The Lisp server name, port and ID string."
     "  Example: LispServer 127.0.0.1 3000 \"apache\""),
  {0}
};

static void
register_hooks (apr_pool_t * pool)
{
  ap_hook_post_config (lisp_post_config, 0, 0, APR_HOOK_MIDDLE);
  ap_hook_child_init (lisp_child_init, 0, 0, APR_HOOK_MIDDLE);
  ap_hook_handler (lisp_handler, 0, 0, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA lisp_module =
{
  STANDARD20_MODULE_STUFF,
示例#6
0
文件: mod_wodan2.c 项目: wodan/wodan
 * The configuration directives and their setup functions.
 */
static const command_rec wodan2_commands[] = 
{
	AP_INIT_TAKE12("WodanPass", add_pass, NULL, RSRC_CONF, "A path and a URL"),
	AP_INIT_TAKE12("WodanPassReverse", add_pass_reverse, 
		NULL, RSRC_CONF, "A path and a URL"),
	AP_INIT_TAKE1("WodanCacheDir", add_cachedir, NULL, RSRC_CONF, "A path"),
	AP_INIT_TAKE1("WodanCacheDirLevels", add_cachedir_levels, NULL, RSRC_CONF, 
		"A Number (> 0)"),
	AP_INIT_TAKE2("WodanDefaultCacheTime", add_default_cachetime, NULL, RSRC_CONF,
		"A path and a time string"),
	AP_INIT_TAKE2("WodanDefaultCacheTimeMatch", add_default_cachetime_regex,
		NULL, RSRC_CONF, "A regex pattern and a time string"),
	AP_INIT_TAKE3("WodanDefaultCacheTimeHeaderMatch", 
		add_default_cachetime_header, NULL, RSRC_CONF, 
		"A header, a regex pattern and a time string"),
	AP_INIT_FLAG("WodanRunOnCache", add_run_on_cache, NULL, RSRC_CONF,
		"run completely on cache"),
	AP_INIT_FLAG("WodanCache404s", add_cache_404s, NULL, RSRC_CONF,
		"cache 404 pages"),
	AP_INIT_TAKE1("WodanBackendTimeout", add_backend_timeout, NULL, RSRC_CONF,
		"a number, which represents a time in miliseconds"),
	{NULL}
};
/* The module. Apache uses this information to initialise and hook up
 * the module into the webserver. */
module AP_MODULE_DECLARE_DATA wodan2_module = {
    STANDARD20_MODULE_STUFF, 
    wodan2_create_dir_config,   /* create per-dir    config structures */
    wodan2_merge_config,        /* merge  per-dir    config structures */
    return NULL;
}


/* Config file directives for this module */
static const command_rec authnz_external_cmds[] =
{
    AP_INIT_ITERATE("AuthExternal",
	append_array_slot,
	(void *)APR_OFFSETOF(authnz_external_dir_config_rec,auth_name),
	OR_AUTHCFG,
	"one (or more) keywords indicating which authenticators to use"),

    AP_INIT_TAKE3("DefineExternalAuth",
	def_extauth,
	NULL,
	RSRC_CONF,
	"a keyword followed by auth method and path to authentictor"),

    AP_INIT_TAKE2("AddExternalAuth",
	add_extauth,
	NULL,
	RSRC_CONF,
	"a keyword followed by a path to the authenticator program"),

    AP_INIT_TAKE2("SetExternalAuthMethod",
	set_authnz_external_method,
	NULL,
	RSRC_CONF,
	"a keyword followed by the method by which the data is passed"),
     }
    return NULL;
}

/* Set the verbosity flag
 */
static const char *dosblock_verbosityflag(cmd_parms *cmd, void *mconfig, int bool) {
    server_rec *s = cmd->server;
    dosblock_cfg *cfg = (dosblock_cfg *)ap_get_module_config(s->module_config, &mod_dosblock_module);
    cfg->verbosity = bool;
    return NULL;
}

static  command_rec mod_dosblock_cmds[] = {
     AP_INIT_TAKE2("DosBlockUrl", dosblock_url_config, NULL, RSRC_CONF, "Url pattern to look for" ),
     AP_INIT_TAKE3("DosBlockHeader", dosblock_header_config, NULL, RSRC_CONF, "Header pattern to look for" ),
     AP_INIT_TAKE3("DosBlockRule", dosblockrule_config, NULL, RSRC_CONF, "Actual dos rule" ),
     AP_INIT_FLAG("DosBlockVerbose", dosblock_verbosityflag, NULL, RSRC_CONF, "Sets the verbosity flag" ),

    { NULL }
};

/*
 * Clean up the shared memory blocks. This function is registered as
 * cleanup function for the configuration pool, which gets called
 * on restarts. It assures that the new children will not talk to a stale
 * shared memory segments.
 */
static apr_status_t shm_cleanup_wrapper() {
    int i;