view 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
line wrap: on
line source

/*
 * This header file holds miscellaneous definitions for f-demime,
 * including various limits.
 */

enum msg_state {
	MSG_STATE_UNDEF,	/* before From line */
	MSG_STATE_HEADER,	/* message or body part header */
	MSG_STATE_BODY_PASS,	/* body pass-through state */
	MSG_STATE_PTEXT_B64,	/* text/plain decoding from base64 */
	MSG_STATE_PTEXT_QP,	/* text/plain decoding from quoted-printable */
	MSG_STATE_BLOB_B64,	/* blob extraction from base64 */
	MSG_STATE_B64_TO_QP,	/* base64 to quoted-printable conversion */
};

enum msg_hdr_state {
	HDR_STATE_BEGIN,	/* beginning of entity header */
	HDR_STATE_GOTSOME,	/* got some header line(s), regular */
	HDR_STATE_CONT_TYPE,	/* after Content-Type: header */
	HDR_STATE_CONT_TE,	/* after Content-Transfer-Encoding: header */
	HDR_STATE_ERROR		/* errored state */
};

#define	LINE_BUF_SIZE	1024
#define	HDR_BUF_SIZE	2048

#define	MAX_MP_BOUNDARY	70	/* not counting the hyphens */
#define	MAX_MP_NESTING	8

#define	OUTPUT_LINE_MAX	320
#define	QP_MAX_LINE	76