#include <stdio.h>
#include "sieve-common.h"
#include "sieve-code.h"
#include "sieve-extensions.h"
#include "sieve-commands.h"
#include "sieve-validator.h"
#include "sieve-generator.h"
#include "sieve-interpreter.h"
#include "sieve-result.h"
#include "testsuite-common.h"
#include "testsuite-arguments.h"
const struct sieve_operation_def *testsuite_operations[] = {
&test_operation,
&test_finish_operation,
&test_fail_operation,
&test_config_set_operation,
&test_config_unset_operation,
&test_config_reload_operation,
&test_set_operation,
&test_script_compile_operation,
&test_script_run_operation,
&test_multiscript_operation,
&test_error_operation,
&test_result_action_operation,
&test_result_execute_operation,
&test_result_reset_operation,
&test_result_print_operation,
&test_message_smtp_operation,
&test_message_mailbox_operation,
&test_mailbox_create_operation,
&test_mailbox_delete_operation,
&test_binary_load_operation,
&test_binary_save_operation
};
const struct sieve_operand_def *testsuite_operands[] = {
&testsuite_object_operand,
&testsuite_substitution_operand
};
static bool ext_testsuite_validator_load
(const struct sieve_extension *ext, struct sieve_validator *valdtr);
static bool ext_testsuite_generator_load
(const struct sieve_extension *ext, const struct sieve_codegen_env *cgenv);
static bool ext_testsuite_binary_load
(const struct sieve_extension *ext, struct sieve_binary *sbin);
const struct sieve_extension_def testsuite_extension = {
"vnd.dovecot.testsuite",
NULL, NULL,
ext_testsuite_validator_load,
ext_testsuite_generator_load,
NULL,
ext_testsuite_binary_load,
NULL, NULL,
SIEVE_EXT_DEFINE_OPERATIONS(testsuite_operations),
SIEVE_EXT_DEFINE_OPERANDS(testsuite_operands)
};
static bool ext_testsuite_validator_load
(const struct sieve_extension *ext, struct sieve_validator *valdtr)
{
sieve_validator_register_command(valdtr, ext, &cmd_test);
sieve_validator_register_command(valdtr, ext, &cmd_test_fail);
sieve_validator_register_command(valdtr, ext, &cmd_test_config_set);
sieve_validator_register_command(valdtr, ext, &cmd_test_config_unset);
sieve_validator_register_command(valdtr, ext, &cmd_test_config_reload);
sieve_validator_register_command(valdtr, ext, &cmd_test_set);
sieve_validator_register_command(valdtr, ext, &cmd_test_result_print);
sieve_validator_register_command(valdtr, ext, &cmd_test_result_reset);
sieve_validator_register_command(valdtr, ext, &cmd_test_message);
sieve_validator_register_command(valdtr, ext, &cmd_test_mailbox_create);
sieve_validator_register_command(valdtr, ext, &cmd_test_mailbox_delete);
sieve_validator_register_command(valdtr, ext, &cmd_test_binary_load);
sieve_validator_register_command(valdtr, ext, &cmd_test_binary_save);
sieve_validator_register_command(valdtr, ext, &tst_test_script_compile);
sieve_validator_register_command(valdtr, ext, &tst_test_script_run);
sieve_validator_register_command(valdtr, ext, &tst_test_multiscript);
sieve_validator_register_command(valdtr, ext, &tst_test_error);
sieve_validator_register_command(valdtr, ext, &tst_test_result_action);
sieve_validator_register_command(valdtr, ext, &tst_test_result_execute);
return testsuite_validator_context_initialize(valdtr);
}
static bool ext_testsuite_generator_load
(const struct sieve_extension *ext, const struct sieve_codegen_env *cgenv)
{
return testsuite_generator_context_initialize(cgenv->gentr, ext);
}
static bool ext_testsuite_binary_load
(const struct sieve_extension *ext ATTR_UNUSED,
struct sieve_binary *sbin ATTR_UNUSED)
{
return TRUE;
}