|
GNU Mailutils |
General-Purpose Mail Package |
Official GNU Software |
| GNU Mailutils Manual (split by node): | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
? |
This is an opaque data type representing a pointer to an instance of
sieve machine. The sieve_machine_t keeps all information necessary
for compiling and executing the script.
It is created by sieve_machine_create() and destroyed by
sieve_machine_destroy(). The functions for manipulating this data
type are described in Manipulating the Sieve Machine.
This enumeration keeps the possible types of sieve data. These are:
SVT_VOIDNo datatype.
SVT_NUMBERNumeric type.
SVT_STRINGCharacter string.
SVT_STRING_LISTA mu_list_t. Each item in this list represents a character string.
SVT_TAGA sieve tag. See mu_sieve_runtime_tag_t below.
SVT_IDENTA character string representing an identifier.
SVT_VALUE_LISTA mu_list_t. Each item in this list is of mu_sieve_value_t type.
SVT_POINTERAn opaque pointer.
The mu_sieve_value_t keeps an instance of sieve data. It is defined
as follows:
typedef struct
{
mu_sieve_data_type type; /* Type of the data */
union {
char *string; /* String value or identifier */
size_t number; /* Numeric value */
mu_list_t list; /* List value */
mu_sieve_runtime_tag_t *tag; /* Tag value */
void *ptr; /* Pointer value */
} v;
}
mu_sieve_value_t;
|
Depending on the value of type member, following members of the
union v keep the actual value:
SVT_VOIDNever appears.
SVT_NUMBERThe numeric value is kept in number member.
SVT_STRINGThe string is kept in string member.
SVT_STRING_LISTSVT_VALUE_LISTThe list itself is pointed to by list member
SVT_TAGThe tag value is pointed to by tag member.
SVT_IDENTThe string member points to the identifier name.
SVT_POINTERThe data are pointed to by ptr member.
This structure represents a definition of a tagged (optional) argument to a sieve action or test. It is defined as follows:
typedef struct
{
char *name; /* Tag name */
mu_sieve_data_type argtype; /* Type of tag argument. */
}
mu_sieve_tag_def_t;
|
The name member points to the tag's name without leading
colon. The argtype is set to SVT_VOID if the tag does
not take argument, or to the type of the argument otherwise.
This structure represents the tagged (optional) argument at a runtime. It is defined as:
struct mu_sieve_runtime_tag
{
char *tag; /* Tag name */
mu_sieve_value_t *arg; /* Tag argument (if any) */
};
|
The arg member is NULL if the tag does not take an argument.
Objects of this type represent a location in the Sieve source file:
typedef struct
{
const char *source_file;
size_t source_line;
}
mu_sieve_locus_t;
|
This is a pointer to function handler for a sieve action or test. It is defined as follows:
typedef int (*mu_sieve_handler_t) (mu_sieve_machine_t mach,
mu_list_t args,
mu_list_t tags);
|
The arguments to the handler have the following meaning:
Sieve machine being processed.
A list of required arguments to the handler
A list of optional arguments (tags).
A pointer to a diagnostic output function. It is defined as follows:
typedef int (*mu_sieve_printf_t) (void *data,
const char *fmt, va_list ap);
|
A pointer to application specific data. These data are passed as
second argument to mu_sieve_machine_init().
Printf-like format string.
Other arguments.
This data type is declared as follows:
typedef int (*mu_sieve_parse_error_t) (void *data,
const char *filename,
int lineno,
const char *fmt,
va_list ap);
|
It is used to declare error handlers for parsing errors. The application-specific data are passed in the data argument. Arguments filename and line indicate the location of the error in the source text, while fmt and ap give verbose description of the error.
A pointer to the application-specific logging function:
typedef void (*mu_sieve_action_log_t) (void *data,
const mu_sieve_locus_t *locus,
size_t msgno,
mu_message_t msg,
const char *action,
const char *fmt,
va_list ap);
|
Application-specific data.
Location in the Sieve source file.
Name of the sieve script being executed.
Ordinal number of the message in mailbox, if appropriate. When execution
is started using sieve_message(), this argument is zero.
The message this action is executed upon.
The name of the action.
These two arguments give the detailed description of the action.
typedef int (*mu_sieve_relcmp_t) (int, int); typedef int (*mu_sieve_relcmpn_t) (size_t, size_t); |
typedef int (*mu_sieve_comparator_t) (const char *, const char *); |
A pointer to the comparator handler function. The function compares
its two operands and returns 1 if they are equal, and 0 otherwise.
Notice, that the sense of the return value is inverted
in comparison with most standard libc functions like stcmp(), etc.
typedef int (*mu_sieve_retrieve_t) (void *item, void *data, int idx,
char **pval);
|
A pointer to generic retriever function. See description of
mu_sieve_vlist_compare() for details of its usage.
typedef void (*mu_sieve_destructor_t) (void *data); |
A pointer to destructor function. The function frees any resources
associated with data. See the description of
mu_sieve_machine_add_destructor() for more information.
typedef int (*mu_sieve_tag_checker_t) (const char *name,
mu_list_t tags,
mu_list_t args)
|
A pointer to tag checker function. The purpose of the function is to perform compilation-time consistency test on tags. Its arguments are:
Name of the test or action whose tags are being checked.
A list of mu_sieve_runtime_tag_t representing tags.
A list of mu_sieve_value_t representing required arguments to
name.
The function is allowed to make any changes in tags and args. It should return 0 if the syntax is correct and non-zero otherwise. It is responsible for issuing the diagnostics in the latter case. [FIXME: describe how to do that]
| GNU Mailutils Manual (split by node): | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.