Back to index

lightning-sunbird  0.9+nobinonly
modmimee.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037  /* -*- Mode: C; tab-width: 4 -*-
00038    mimeenc.c --- MIME encoders and decoders, version 2 (see mimei.h)
00039    Copyright  1996 Netscape Communications Corporation, all rights reserved.
00040    Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
00041  */
00042 
00043 #ifndef _MIMEENC_H_
00044 #define _MIMEENC_H_
00045 
00046 #include "prtypes.h"
00047 #include "nsError.h"
00048 
00049 /* This file defines interfaces to generic implementations of Base64, 
00050    Quoted-Printable, and UU decoders; and of Base64 and Quoted-Printable
00051    encoders.
00052  */
00053 
00054 
00055 /* Opaque objects used by the encoder/decoder to store state. */
00056 typedef struct MimeDecoderData MimeDecoderData;
00057 typedef struct MimeEncoderData MimeEncoderData;
00058 
00059 struct MimeObject;
00060 
00061 
00062 /* functions for creating that opaque data.
00063  */
00064 MimeDecoderData *MimeB64DecoderInit(nsresult (*output_fn) (const char *buf,PRInt32 size, void *closure),
00065                                                                void *closure);
00066 
00067 MimeDecoderData *MimeQPDecoderInit (nsresult (*output_fn) (const char *buf, PRInt32 size, void *closure),
00068                                                                void *closure, MimeObject *object = nsnull);
00069 
00070 MimeDecoderData *MimeUUDecoderInit (nsresult (*output_fn) (const char *buf,
00071                                                                                              PRInt32 size,
00072                                                                                              void *closure),
00073                                                                void *closure);
00074 MimeDecoderData *MimeYDecoderInit (nsresult (*output_fn) (const char *buf,
00075                                                                                              PRInt32 size,
00076                                                                                              void *closure),
00077                                                                void *closure);
00078 
00079 MimeEncoderData *MimeB64EncoderInit(nsresult (*output_fn) (const char *buf,
00080                                                                                              PRInt32 size,
00081                                                                                              void *closure),
00082                                                                void *closure);
00083 MimeEncoderData *MimeQPEncoderInit (nsresult (*output_fn) (const char *buf,
00084                                                                                              PRInt32 size,
00085                                                                                              void *closure),
00086                                                                void *closure);
00087 MimeEncoderData *MimeUUEncoderInit (char *filename,
00088                                                                nsresult (*output_fn) (const char *buf,
00089                                                                                              PRInt32 size,
00090                                                                                              void *closure),
00091                                                                void *closure);
00092 
00093 /* Push data through the encoder/decoder, causing the above-provided write_fn
00094    to be called with encoded/decoded data. */
00095 int MimeDecoderWrite (MimeDecoderData *data, const char *buffer, PRInt32 size);
00096 int MimeEncoderWrite (MimeEncoderData *data, const char *buffer, PRInt32 size);
00097 
00098 /* When you're done encoding/decoding, call this to free the data.  If
00099    abort_p is PR_FALSE, then calling this may cause the write_fn to be called
00100    one last time (as the last buffered data is flushed out.)
00101  */
00102 int MimeDecoderDestroy(MimeDecoderData *data, PRBool abort_p);
00103 int MimeEncoderDestroy(MimeEncoderData *data, PRBool abort_p);
00104 
00105 #endif /* _MODMIMEE_H_ */