diff options
Diffstat (limited to 'src/mailfromd.h')
-rw-r--r-- | src/mailfromd.h | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/src/mailfromd.h b/src/mailfromd.h index 54449c43..d3531f5c 100644 --- a/src/mailfromd.h +++ b/src/mailfromd.h @@ -79,26 +79,36 @@ typedef enum mf_status_code { mf_success, mf_not_found, mf_failure, - mf_temp_failure, - - mf_ston_conv, - mf_divzero, - mf_regcomp, - mf_invip, - mf_invcidr, - mf_invtime, - mf_dbfailure, - mf_range, - mf_url, - mf_noresolve, - mf_ioerr, - mf_macroundef, - - mf_status_count + mf_temp_failure } mf_status; #define mf_resolved(c) ((c) == mf_success || (c) == mf_not_found) +/* Exception codes. */ +typedef enum mf_exception_code { + mfe_success, + mfe_not_found, + mfe_failure, + mfe_temp_failure, + + mfe_ston_conv, + mfe_divzero, + mfe_regcomp, + mfe_invip, + mfe_invcidr, + mfe_invtime, + mfe_dbfailure, + mfe_range, + mfe_url, + mfe_noresolve, + mfe_io, + mfe_macroundef, + + mf_exception_count +} mf_exception; + +#define mf_status_to_exception(s) ((mf_exception)(s)) + #define EXMASK(n) ((unsigned)1<<(n)) /* SMTP (libmilter) states */ @@ -690,9 +700,10 @@ void parse_pragma(char *text); const struct locus *get_locus(void); const char *header_command_str(enum header_opcode opcode); const char *sfsistat_str(sfsistat stat); -const char *mf_status_str(mf_status stat); +const char *mf_exception_str(mf_exception ex); +#define mf_status_str(s) mf_exception_str(mf_status_to_exception(s)) +int string_to_exception(const char *str, mf_exception *status); const char *storage_class_str(storage_class_t sc); -int string_to_stat(const char *str, mf_status *status); enum smtp_state string_to_state(const char *name); const char *state_to_string(enum smtp_state state); void parse_error(char *fmt, ...); @@ -762,11 +773,12 @@ void env_save_catches(eval_environ_t env); # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # endif -void env_throw(eval_environ_t env, mf_status status, +void env_throw(eval_environ_t env, mf_exception exception, const char *fmt, ...) ATTRIBUTE_NORETURN; -void env_throw_bi(eval_environ_t env, mf_status status, const char *biname, +void env_throw_bi(eval_environ_t env, mf_exception exception, + const char *biname, const char *fmt, ...) ATTRIBUTE_NORETURN; -void env_throw_0(eval_environ_t env, mf_status status, +void env_throw_0(eval_environ_t env, mf_exception exception, size_t text_off) ATTRIBUTE_NORETURN; void env_push_string(eval_environ_t env, char *arg); |