xref: /netbsd-src/usr.bin/mail/mime_codecs.h (revision ba2b5111fb00c84327d206476c903e46045b42f9)
1*ba2b5111Schristos /*	$NetBSD: mime_codecs.h,v 1.5 2013/02/14 18:23:45 christos Exp $	*/
28207b28aSchristos 
38207b28aSchristos /*-
48207b28aSchristos  * Copyright (c) 2006 The NetBSD Foundation, Inc.
58207b28aSchristos  * All rights reserved.
68207b28aSchristos  *
78207b28aSchristos  * This code is derived from software contributed to The NetBSD Foundation
88207b28aSchristos  * by Anon Ymous.
98207b28aSchristos  *
108207b28aSchristos  * Redistribution and use in source and binary forms, with or without
118207b28aSchristos  * modification, are permitted provided that the following conditions
128207b28aSchristos  * are met:
138207b28aSchristos  * 1. Redistributions of source code must retain the above copyright
148207b28aSchristos  *    notice, this list of conditions and the following disclaimer.
158207b28aSchristos  * 2. Redistributions in binary form must reproduce the above copyright
168207b28aSchristos  *    notice, this list of conditions and the following disclaimer in the
178207b28aSchristos  *    documentation and/or other materials provided with the distribution.
188207b28aSchristos  *
198207b28aSchristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
208207b28aSchristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
218207b28aSchristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
228207b28aSchristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
238207b28aSchristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
248207b28aSchristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
258207b28aSchristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
268207b28aSchristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
278207b28aSchristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
288207b28aSchristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
298207b28aSchristos  * POSSIBILITY OF SUCH DAMAGE.
308207b28aSchristos  */
318207b28aSchristos 
328207b28aSchristos 
338207b28aSchristos #ifdef MIME_SUPPORT
348207b28aSchristos 
358207b28aSchristos #ifndef __MIME_CODECS_H__
368207b28aSchristos #define __MIME_CODECS_H__
378207b28aSchristos 
388207b28aSchristos #include <iconv.h>
398207b28aSchristos 
408207b28aSchristos size_t mime_iconv(iconv_t, const char **, size_t *, char **, size_t *);
418207b28aSchristos void   mime_ficonv(FILE *, FILE *, void *);
428207b28aSchristos 
438207b28aSchristos ssize_t mime_b64tobin(char *, const char *, size_t);
448207b28aSchristos void    mime_bintob64(char *, const char *, size_t);
458207b28aSchristos 
468207b28aSchristos typedef void(*mime_codec_t)(FILE *, FILE *, void *);
478207b28aSchristos 
488207b28aSchristos mime_codec_t mime_fio_encoder(const char *);
498207b28aSchristos mime_codec_t mime_fio_decoder(const char *);
508207b28aSchristos 
518207b28aSchristos void mime_fio_copy(FILE *, FILE *, void *);
528207b28aSchristos 
53*ba2b5111Schristos ssize_t mime_rfc2047_decode(char, char *, size_t, const char *, size_t);
54*ba2b5111Schristos 
558207b28aSchristos #include "mime.h"
568207b28aSchristos 
578207b28aSchristos /* This is also declared in mime.h for export to complete.c. */
588207b28aSchristos const char *mime_next_encoding_name(const void **);
598207b28aSchristos 
608207b28aSchristos /*
618207b28aSchristos  * valid transfer encoding names
628207b28aSchristos  */
638207b28aSchristos #define MIME_TRANSFER_7BIT	"7bit"
648207b28aSchristos #define MIME_TRANSFER_8BIT	"8bit"
658207b28aSchristos #define MIME_TRANSFER_BINARY	"binary"
668207b28aSchristos #define MIME_TRANSFER_QUOTED	"quoted-printable"
678207b28aSchristos #define MIME_TRANSFER_BASE64	"base64"
688207b28aSchristos 
698207b28aSchristos #endif /* __MIME_CODECS_H__ */
708207b28aSchristos #endif /* MIME_SUPPORT */
71