Back to index

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