NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mime.h File Reference

Constants and macros for managing MIME encoding. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MUTT_MIME_MAX_DEPTH   50
 Maximum nesting depth for MIME parts to prevent stack overflow.
#define MUTT_MIME_MAX_PARTS   500
 Maximum number of MIME parts to process to prevent DoS.
#define hexval(ch)
 Convert hexadecimal character to its integer value.
#define is_multipart(body)
 Check if a body part is multipart or a message container.
#define BODY_TYPE(body)
 Get the type name of a body part.
#define ENCODING(x)
 Get the encoding name for an encoding type.

Enumerations

enum  ContentType {
  TYPE_OTHER , TYPE_AUDIO , TYPE_APPLICATION , TYPE_IMAGE ,
  TYPE_MESSAGE , TYPE_MODEL , TYPE_MULTIPART , TYPE_TEXT ,
  TYPE_VIDEO , TYPE_ANY
}
 Content-Type. More...
enum  ContentEncoding {
  ENC_OTHER , ENC_7BIT , ENC_8BIT , ENC_QUOTED_PRINTABLE ,
  ENC_BASE64 , ENC_BINARY , ENC_UUENCODED
}
 Content-Transfer-Encoding. More...
enum  ContentDisposition { DISP_INLINE , DISP_ATTACH , DISP_FORM_DATA , DISP_NONE }
 Content-Disposition values. More...

Variables

const int IndexHex [128]
 Lookup table for ASCII hex digits.
const char *const BodyTypes []
 Common MIME body types.
const char *const BodyEncodings []
 Common MIME body encodings.
const char MimeSpecials []
 Characters that need special treatment in MIME.

Detailed Description

Constants and macros for managing MIME encoding.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file mime.h.

Macro Definition Documentation

◆ MUTT_MIME_MAX_DEPTH

#define MUTT_MIME_MAX_DEPTH   50

Maximum nesting depth for MIME parts to prevent stack overflow.

Definition at line 69 of file mime.h.

◆ MUTT_MIME_MAX_PARTS

#define MUTT_MIME_MAX_PARTS   500

Maximum number of MIME parts to process to prevent DoS.

Definition at line 71 of file mime.h.

◆ hexval

#define hexval ( ch)
Value:
IndexHex[(unsigned int) (ch)]
const int IndexHex[128]
Lookup table for ASCII hex digits.
Definition mime.c:35

Convert hexadecimal character to its integer value.

Definition at line 81 of file mime.h.

◆ is_multipart

#define is_multipart ( body)
Value:
(((body)->type == TYPE_MULTIPART) || \
(((body)->type == TYPE_MESSAGE) && ((body)->subtype) && \
((strcasecmp((body)->subtype, "rfc822") == 0) || \
(strcasecmp((body)->subtype, "news") == 0) || \
(strcasecmp((body)->subtype, "global") == 0))))
@ TYPE_MESSAGE
Type: 'message/*'.
Definition mime.h:35
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition mime.h:37

Check if a body part is multipart or a message container.

Definition at line 84 of file mime.h.

84#define is_multipart(body) \
85 (((body)->type == TYPE_MULTIPART) || \
86 (((body)->type == TYPE_MESSAGE) && ((body)->subtype) && \
87 ((strcasecmp((body)->subtype, "rfc822") == 0) || \
88 (strcasecmp((body)->subtype, "news") == 0) || \
89 (strcasecmp((body)->subtype, "global") == 0))))

◆ BODY_TYPE

#define BODY_TYPE ( body)
Value:
(((body)->type == TYPE_OTHER) && (body)->xtype ? (body)->xtype : \
BodyTypes[((body)->type)])
const char *const BodyTypes[]
Common MIME body types.
Definition mime.c:51
@ TYPE_OTHER
Unknown Content-Type.
Definition mime.h:31

Get the type name of a body part.

Definition at line 92 of file mime.h.

92#define BODY_TYPE(body) \
93 (((body)->type == TYPE_OTHER) && (body)->xtype ? (body)->xtype : \
94 BodyTypes[((body)->type)])

◆ ENCODING

#define ENCODING ( x)
Value:
const char *const BodyEncodings[]
Common MIME body encodings.
Definition mime.c:59

Get the encoding name for an encoding type.

Definition at line 97 of file mime.h.

Enumeration Type Documentation

◆ ContentType

Content-Type.

Enumerator
TYPE_OTHER 

Unknown Content-Type.

TYPE_AUDIO 

Type: 'audio/*'.

TYPE_APPLICATION 

Type: 'application/*'.

TYPE_IMAGE 

Type: 'image/*'.

TYPE_MESSAGE 

Type: 'message/*'.

TYPE_MODEL 

Type: 'model/*'.

TYPE_MULTIPART 

Type: 'multipart/*'.

TYPE_TEXT 

Type: 'text/*'.

TYPE_VIDEO 

Type: 'video/*'.

TYPE_ANY 

Type: '' or '.'.

Definition at line 29 of file mime.h.

30{
38 TYPE_TEXT,
40 TYPE_ANY,
41};
@ TYPE_AUDIO
Type: 'audio/*'.
Definition mime.h:32
@ TYPE_IMAGE
Type: 'image/*'.
Definition mime.h:34
@ TYPE_MODEL
Type: 'model/*'.
Definition mime.h:36
@ TYPE_APPLICATION
Type: 'application/*'.
Definition mime.h:33
@ TYPE_TEXT
Type: 'text/*'.
Definition mime.h:38
@ TYPE_ANY
Type: '' or '.'.
Definition mime.h:40
@ TYPE_VIDEO
Type: 'video/*'.
Definition mime.h:39

◆ ContentEncoding

Content-Transfer-Encoding.

Enumerator
ENC_OTHER 

Encoding unknown.

ENC_7BIT 

7-bit text

ENC_8BIT 

8-bit text

ENC_QUOTED_PRINTABLE 

Quoted-printable text.

ENC_BASE64 

Base-64 encoded text.

ENC_BINARY 

Binary.

ENC_UUENCODED 

UUEncoded text.

Definition at line 46 of file mime.h.

47{
48 ENC_OTHER,
49 ENC_7BIT,
50 ENC_8BIT,
55};
@ ENC_7BIT
7-bit text
Definition mime.h:49
@ ENC_UUENCODED
UUEncoded text.
Definition mime.h:54
@ ENC_OTHER
Encoding unknown.
Definition mime.h:48
@ ENC_BINARY
Binary.
Definition mime.h:53
@ ENC_BASE64
Base-64 encoded text.
Definition mime.h:52
@ ENC_8BIT
8-bit text
Definition mime.h:50
@ ENC_QUOTED_PRINTABLE
Quoted-printable text.
Definition mime.h:51

◆ ContentDisposition

Content-Disposition values.

Enumerator
DISP_INLINE 

Content is inline.

DISP_ATTACH 

Content is attached.

DISP_FORM_DATA 

Content is form-data.

DISP_NONE 

No preferred disposition.

Definition at line 60 of file mime.h.

61{
65 DISP_NONE,
66};
@ DISP_ATTACH
Content is attached.
Definition mime.h:63
@ DISP_INLINE
Content is inline.
Definition mime.h:62
@ DISP_NONE
No preferred disposition.
Definition mime.h:65
@ DISP_FORM_DATA
Content is form-data.
Definition mime.h:64

Variable Documentation

◆ IndexHex

const int IndexHex[128]
extern

Lookup table for ASCII hex digits.

Definition at line 35 of file mime.c.

35 {
36 // clang-format off
37 -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
38 -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
39 -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
40 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1, -1,-1,-1,-1,
41 -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
42 -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
43 -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
44 -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
45 // clang-format on
46};

◆ BodyTypes

const char* const BodyTypes[]
extern

Common MIME body types.

Definition at line 51 of file mime.c.

51 {
52 "x-unknown", "audio", "application", "image", "message",
53 "model", "multipart", "text", "video", "*",
54};

◆ BodyEncodings

const char* const BodyEncodings[]
extern

Common MIME body encodings.

Definition at line 59 of file mime.c.

59 {
60 "x-unknown", "7bit", "8bit", "quoted-printable",
61 "base64", "binary", "x-uuencoded",
62};

◆ MimeSpecials

const char MimeSpecials[]
extern

Characters that need special treatment in MIME.

Definition at line 69 of file mime.c.