3 #ifndef _MIME_STATE_H_INCLUDED_
4 #define _MIME_STATE_H_INCLUDED_
10 /* MIME parser state engine
12 /* #include "mime_state.h"
24 #include <header_opts.h>
27 * External interface. All MIME_STATE structure members are private.
29 typedef struct MIME_STATE MIME_STATE
;
30 typedef void (*MIME_STATE_HEAD_OUT
) (void *, int, const HEADER_OPTS
*, VSTRING
*, off_t
);
31 typedef void (*MIME_STATE_BODY_OUT
) (void *, int, const char *, ssize_t
, off_t
);
32 typedef void (*MIME_STATE_ANY_END
) (void *);
33 typedef void (*MIME_STATE_ERR_PRINT
) (void *, int, const char *, ssize_t
);
35 extern MIME_STATE
*mime_state_alloc(int, MIME_STATE_HEAD_OUT
, MIME_STATE_ANY_END
, MIME_STATE_BODY_OUT
, MIME_STATE_ANY_END
, MIME_STATE_ERR_PRINT
, void *);
36 extern int mime_state_update(MIME_STATE
*, int, const char *, ssize_t
);
37 extern MIME_STATE
*mime_state_free(MIME_STATE
*);
42 #define MIME_OPT_NONE (0)
43 #define MIME_OPT_DOWNGRADE (1<<0)
44 #define MIME_OPT_REPORT_8BIT_IN_7BIT_BODY (1<<1)
45 #define MIME_OPT_REPORT_8BIT_IN_HEADER (1<<2)
46 #define MIME_OPT_REPORT_ENCODING_DOMAIN (1<<3)
47 #define MIME_OPT_RECURSE_ALL_MESSAGE (1<<4)
48 #define MIME_OPT_REPORT_TRUNC_HEADER (1<<5)
49 #define MIME_OPT_DISABLE_MIME (1<<6)
50 #define MIME_OPT_REPORT_NESTING (1<<7)
53 * Body encoding domains.
55 #define MIME_ENC_7BIT (7)
56 #define MIME_ENC_8BIT (8)
57 #define MIME_ENC_BINARY (9)
60 * Processing errors, not necessarily lethal.
63 const int code
; /* internal error code */
64 const char *dsn
; /* RFC 3463 */
65 const char *text
; /* descriptive text */
68 #define MIME_ERR_NESTING (1<<0)
69 #define MIME_ERR_TRUNC_HEADER (1<<1)
70 #define MIME_ERR_8BIT_IN_HEADER (1<<2)
71 #define MIME_ERR_8BIT_IN_7BIT_BODY (1<<3)
72 #define MIME_ERR_ENCODING_DOMAIN (1<<4)
74 extern const MIME_STATE_DETAIL
*mime_state_detail(int);
75 extern const char *mime_state_error(int);
78 * With header classes, look at the header_opts argument to recognize MIME
79 * headers in primary or nested sections.
81 #define MIME_HDR_FIRST (1) /* first class */
82 #define MIME_HDR_PRIMARY (1) /* initial headers */
83 #define MIME_HDR_MULTIPART (2) /* headers after multipart boundary */
84 #define MIME_HDR_NESTED (3) /* attached message initial headers */
85 #define MIME_HDR_LAST (3) /* last class */
90 /* The Secure Mailer license must be distributed with this software.
93 /* IBM T.J. Watson Research
95 /* Yorktown Heights, NY 10598, USA