3 #ifndef _BOUNCE_TEMPLATE_H_INCLUDED_
4 #define _BOUNCE_TEMPLATE_H_INCLUDED_
10 /* bounce template support
12 /* #include <bounce_template.h>
22 * Structure of a single bounce template. Each template is manipulated by
23 * itself, without any external markers and delimiters. Applications are not
24 * supposed to access BOUNCE_TEMPLATE attributes directly.
26 typedef struct BOUNCE_TEMPLATE
{
28 const char *class; /* for diagnostics (fixed) */
29 const char *origin
; /* built-in or pathname */
30 const char *mime_charset
; /* character set (configurable) */
31 const char *mime_encoding
; /* 7bit or 8bit (derived) */
32 const char *from
; /* originator (configurable) */
33 const char *subject
; /* general subject (configurable) */
34 const char *postmaster_subject
; /* postmaster subject (configurable) */
35 const char **message_text
; /* message text (configurable) */
36 const struct BOUNCE_TEMPLATE
*prototype
; /* defaults */
37 char *buffer
; /* ripped text */
40 #define BOUNCE_TMPL_FLAG_NEW_BUFFER (1<<0)
42 #define BOUNCE_TMPL_CLASS_FAILURE "failure"
43 #define BOUNCE_TMPL_CLASS_DELAY "delay"
44 #define BOUNCE_TMPL_CLASS_SUCCESS "success"
45 #define BOUNCE_TMPL_CLASS_VERIFY "verify"
47 #define IS_FAILURE_TEMPLATE(t) ((t)->class[0] == BOUNCE_TMPL_CLASS_FAILURE[0])
48 #define IS_DELAY_TEMPLATE(t) ((t)->class[0] == BOUNCE_TMPL_CLASS_DELAY[0])
49 #define IS_SUCCESS_TEMPLATE(t) ((t)->class[0] == BOUNCE_TMPL_CLASS_SUCCESS[0])
50 #define IS_VERIFY_TEMPLATE(t) ((t)->class[0] == BOUNCE_TMPL_CLASS_verify[0])
52 #define bounce_template_encoding(t) ((t)->mime_encoding)
53 #define bounce_template_charset(t) ((t)->mime_charset)
55 typedef int (*BOUNCE_XP_PRN_FN
) (VSTREAM
*, const char *, ...);
56 typedef int (*BOUNCE_XP_PUT_FN
) (VSTREAM
*, const char *);
58 extern BOUNCE_TEMPLATE
*bounce_template_create(const BOUNCE_TEMPLATE
*);
59 extern void bounce_template_free(BOUNCE_TEMPLATE
*);
60 extern void bounce_template_load(BOUNCE_TEMPLATE
*, const char *, const char *);
61 extern void bounce_template_headers(BOUNCE_XP_PRN_FN
, VSTREAM
*, BOUNCE_TEMPLATE
*, const char *, int);
62 extern void bounce_template_expand(BOUNCE_XP_PUT_FN
, VSTREAM
*, BOUNCE_TEMPLATE
*);
63 extern void bounce_template_dump(VSTREAM
*, BOUNCE_TEMPLATE
*);
65 #define POSTMASTER_COPY 1 /* postmaster copy */
66 #define NO_POSTMASTER_COPY 0 /* not postmaster copy */
69 * Structure of a bounce template collection. These templates are read and
70 * written in their external representation, with markers and delimiters.
73 BOUNCE_TEMPLATE
*failure
;
74 BOUNCE_TEMPLATE
*delay
;
75 BOUNCE_TEMPLATE
*success
;
76 BOUNCE_TEMPLATE
*verify
;
79 BOUNCE_TEMPLATES
*bounce_templates_create(void);
80 void bounce_templates_free(BOUNCE_TEMPLATES
*);
81 void bounce_templates_load(VSTREAM
*, BOUNCE_TEMPLATES
*);
82 void bounce_templates_expand(VSTREAM
*, BOUNCE_TEMPLATES
*);
83 void bounce_templates_dump(VSTREAM
*, BOUNCE_TEMPLATES
*);
88 /* The Secure Mailer license must be distributed with this software.
91 /* IBM T.J. Watson Research
93 /* Yorktown Heights, NY 10598, USA