Postfix3.3.1
mime_state.h
[詳解]
1 #ifndef _MIME_STATE_H_INCLUDED_
2 #define _MIME_STATE_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* mime_state 3h
7 /* SUMMARY
8 /* MIME parser state engine
9 /* SYNOPSIS
10 /* #include "mime_state.h"
11  DESCRIPTION
12  .nf
13 
14  /*
15  * Utility library.
16  */
17 #include <vstring.h>
18 
19  /*
20  * Global library.
21  */
22 #include <header_opts.h>
23 
24  /*
25  * External interface. All MIME_STATE structure members are private.
26  */
27 typedef struct MIME_STATE MIME_STATE;
28 typedef void (*MIME_STATE_HEAD_OUT) (void *, int, const HEADER_OPTS *, VSTRING *, off_t);
29 typedef void (*MIME_STATE_BODY_OUT) (void *, int, const char *, ssize_t, off_t);
30 typedef void (*MIME_STATE_ANY_END) (void *);
31 typedef void (*MIME_STATE_ERR_PRINT) (void *, int, const char *, ssize_t);
32 
34 extern int mime_state_update(MIME_STATE *, int, const char *, ssize_t);
36 
37  /*
38  * Processing options.
39  */
40 #define MIME_OPT_NONE (0)
41 #define MIME_OPT_DOWNGRADE (1<<0)
42 #define MIME_OPT_REPORT_8BIT_IN_7BIT_BODY (1<<1)
43 #define MIME_OPT_REPORT_8BIT_IN_HEADER (1<<2)
44 #define MIME_OPT_REPORT_ENCODING_DOMAIN (1<<3)
45 #define MIME_OPT_RECURSE_ALL_MESSAGE (1<<4)
46 #define MIME_OPT_REPORT_TRUNC_HEADER (1<<5)
47 #define MIME_OPT_DISABLE_MIME (1<<6)
48 #define MIME_OPT_REPORT_NESTING (1<<7)
49 
50  /*
51  * Body encoding domains.
52  */
53 #define MIME_ENC_7BIT (7)
54 #define MIME_ENC_8BIT (8)
55 #define MIME_ENC_BINARY (9)
56 
57  /*
58  * Processing errors, not necessarily lethal.
59  */
60 typedef struct {
61  const int code; /* internal error code */
62  const char *dsn; /* RFC 3463 */
63  const char *text; /* descriptive text */
65 
66 #define MIME_ERR_NESTING (1<<0)
67 #define MIME_ERR_TRUNC_HEADER (1<<1)
68 #define MIME_ERR_8BIT_IN_HEADER (1<<2)
69 #define MIME_ERR_8BIT_IN_7BIT_BODY (1<<3)
70 #define MIME_ERR_ENCODING_DOMAIN (1<<4)
71 
72 extern const MIME_STATE_DETAIL *mime_state_detail(int);
73 extern const char *mime_state_error(int);
74 
75  /*
76  * With header classes, look at the header_opts argument to recognize MIME
77  * headers in primary or nested sections.
78  */
79 #define MIME_HDR_FIRST (1) /* first class */
80 #define MIME_HDR_PRIMARY (1) /* initial headers */
81 #define MIME_HDR_MULTIPART (2) /* headers after multipart boundary */
82 #define MIME_HDR_NESTED (3) /* attached message initial headers */
83 #define MIME_HDR_LAST (3) /* last class */
84 
85 /* LICENSE
86 /* .ad
87 /* .fi
88 /* The Secure Mailer license must be distributed with this software.
89 /* AUTHOR(S)
90 /* Wietse Venema
91 /* IBM T.J. Watson Research
92 /* P.O. Box 704
93 /* Yorktown Heights, NY 10598, USA
94 /*--*/
95 
96 #endif
void(* MIME_STATE_BODY_OUT)(void *, int, const char *, ssize_t, off_t)
Definition: mime_state.h:29
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 *)
Definition: mime_state.c:493
void(* MIME_STATE_ANY_END)(void *)
Definition: mime_state.h:30
void(* MIME_STATE_HEAD_OUT)(void *, int, const HEADER_OPTS *, VSTRING *, off_t)
Definition: mime_state.h:28
MIME_STATE * mime_state_free(MIME_STATE *)
Definition: mime_state.c:530
const char * dsn
Definition: mime_state.h:62
const int code
Definition: mime_state.h:61
int int
Definition: smtpd_proxy.h:21
const MIME_STATE_DETAIL * mime_state_detail(int)
Definition: mime_state.c:1163
const char * mime_state_error(int)
Definition: mime_state.c:1149
const char * text
Definition: mime_state.h:63
void(* MIME_STATE_ERR_PRINT)(void *, int, const char *, ssize_t)
Definition: mime_state.h:31
int mime_state_update(MIME_STATE *, int, const char *, ssize_t)
Definition: mime_state.c:755