annotate f-demime/defs.h @ 2:1857d0d5a7bd

f-demime: fix parsing of Content-* headers
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 06 May 2023 06:33:26 +0000
parents 7e0d08176f32
children 612c4d0df768
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This header file holds miscellaneous definitions for f-demime,
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * including various limits.
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 enum msg_state {
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 MSG_STATE_UNDEF, /* before From line */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 MSG_STATE_HEADER, /* message or body part header */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 MSG_STATE_BODY_PASS, /* body pass-through state */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 MSG_STATE_PTEXT_B64, /* text/plain decoding from base64 */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 MSG_STATE_PTEXT_QP, /* text/plain decoding from quoted-printable */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 MSG_STATE_BLOB_B64, /* blob extraction from base64 */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 MSG_STATE_B64_TO_QP, /* base64 to quoted-printable conversion */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 };
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 enum msg_hdr_state {
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 HDR_STATE_BEGIN, /* beginning of entity header */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 HDR_STATE_GOTSOME, /* got some header line(s), regular */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 HDR_STATE_CONT_TYPE, /* after Content-Type: header */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 HDR_STATE_CONT_TE, /* after Content-Transfer-Encoding: header */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 HDR_STATE_ERROR /* errored state */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 };
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #define LINE_BUF_SIZE 1024
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #define HDR_BUF_SIZE 2048
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #define MAX_MP_BOUNDARY 70 /* not counting the hyphens */
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #define MAX_MP_NESTING 8
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #define OUTPUT_LINE_MAX 320
7e0d08176f32 f-demime starting code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #define QP_MAX_LINE 76