Esempio n. 1
0
ret_t
cherokee_rule_extensions_new (cherokee_rule_extensions_t **rule)
{
	CHEROKEE_NEW_STRUCT (n, rule_extensions);

	/* Parent class constructor
	 */
	cherokee_rule_init_base (RULE(n), PLUGIN_INFO_PTR(extensions));

	/* Virtual methods
	 */
	RULE(n)->match     = (rule_func_match_t) match;
	RULE(n)->configure = (rule_func_configure_t) configure;
	MODULE(n)->free    = (module_func_free_t) _free;

	/* Properties
	 */
	n->check_local_file = false;
	n->use_iocache      = true;

	cherokee_avl_init (&n->extensions);

	*rule = n;
 	return ret_ok;
}
Esempio n. 2
0
ret_t
cherokee_rule_header_new (cherokee_rule_header_t **rule)
{
	CHEROKEE_NEW_STRUCT (n, rule_header);

	/* Parent class constructor
	 */
	cherokee_rule_init_base (RULE(n), PLUGIN_INFO_PTR(header));

	/* Virtual methods
	 */
	RULE(n)->match     = (rule_func_match_t) match;
	RULE(n)->configure = (rule_func_configure_t) configure;
	MODULE(n)->free    = (module_func_free_t) _free;

	/* Properties
	 */
	n->pcre = NULL;
	n->type = rule_header_type_regex;

	cherokee_buffer_init (&n->match);

	*rule = n;
 	return ret_ok;
}
Esempio n. 3
0
ret_t
cherokee_rule_geoip_new (cherokee_rule_t **rule)
{
	CHEROKEE_NEW_STRUCT (n, rule_geoip);

	/* Parent class constructor
	 */
	cherokee_rule_init_base (RULE(n), PLUGIN_INFO_PTR(geoip));

	/* Virtual methods
	 */
	RULE(n)->match     = (rule_func_match_t) match;
	RULE(n)->configure = (rule_func_configure_t) configure;
	MODULE(n)->free    = (module_func_free_t) _free;

	/* Properties
	 */
	n->geoip = geoip_get();
	if (n->geoip == NULL)
		return ret_error;

	cherokee_avl_init (&n->countries);

	*rule = RULE(n);
	return ret_ok;
}
Esempio n. 4
0
ret_t
cherokee_rule_not_new (cherokee_rule_t **rule)
{
	CHEROKEE_NEW_STRUCT (n, rule_not);

	/* Parent class constructor
	 */
	cherokee_rule_init_base (RULE(n), PLUGIN_INFO_PTR(not));

	/* Virtual methods
	 */
	RULE(n)->match     = (rule_func_match_t) match;
	RULE(n)->configure = (rule_func_configure_t) configure;
	MODULE(n)->free    = (module_func_free_t) _free;

	/* Properties
	 */
	n->right = NULL;

	*rule = RULE(n);
	return ret_ok;
}
Esempio n. 5
0
ret_t
cherokee_rule_directory_new (cherokee_rule_directory_t **rule)
{
	CHEROKEE_NEW_STRUCT (n, rule_directory);

	/* Parent class constructor
	 */
	cherokee_rule_init_base (RULE(n), PLUGIN_INFO_PTR(directory));

	/* Virtual methods
	 */
	RULE(n)->match     = (rule_func_match_t) match;
	RULE(n)->configure = (rule_func_configure_t) configure;
	MODULE(n)->free    = (module_func_free_t) _free;

	/* Properties
	 */
	cherokee_buffer_init (&n->directory);

	*rule = n;
 	return ret_ok;
}