home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / mimeenc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.0 KB  |  86 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* mimeenc.c --- MIME encoders and decoders, version 2 (see mimei.h)
  20.    Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
  21.  */
  22.  
  23.  
  24. #ifndef _MIMEENC_H_
  25. #define _MIMEENC_H_
  26.  
  27. #include "xp.h"
  28.  
  29. /* This file defines interfaces to generic implementations of Base64, 
  30.    Quoted-Printable, and UU decoders; and of Base64 and Quoted-Printable
  31.    encoders.
  32.  */
  33.  
  34.  
  35. /* Opaque objects used by the encoder/decoder to store state. */
  36. typedef struct MimeDecoderData MimeDecoderData;
  37. typedef struct MimeEncoderData MimeEncoderData;
  38.  
  39.  
  40. XP_BEGIN_PROTOS
  41.  
  42. /* functions for creating that opaque data.
  43.  */
  44. MimeDecoderData *MimeB64DecoderInit(int (*output_fn) (const char *buf,
  45.                                                       int32 size,
  46.                                                       void *closure),
  47.                                     void *closure);
  48. MimeDecoderData *MimeQPDecoderInit (int (*output_fn) (const char *buf,
  49.                                                       int32 size,
  50.                                                       void *closure),
  51.                                     void *closure);
  52. MimeDecoderData *MimeUUDecoderInit (int (*output_fn) (const char *buf,
  53.                                                       int32 size,
  54.                                                       void *closure),
  55.                                     void *closure);
  56.  
  57. MimeEncoderData *MimeB64EncoderInit(int (*output_fn) (const char *buf,
  58.                                                       int32 size,
  59.                                                       void *closure),
  60.                                     void *closure);
  61. MimeEncoderData *MimeQPEncoderInit (int (*output_fn) (const char *buf,
  62.                                                       int32 size,
  63.                                                       void *closure),
  64.                                     void *closure);
  65. MimeEncoderData *MimeUUEncoderInit (char *filename,
  66.                                     int (*output_fn) (const char *buf,
  67.                                                       int32 size,
  68.                                                       void *closure),
  69.                                     void *closure);
  70.  
  71. /* Push data through the encoder/decoder, causing the above-provided write_fn
  72.    to be called with encoded/decoded data. */
  73. int MimeDecoderWrite (MimeDecoderData *data, const char *buffer, int32 size);
  74. int MimeEncoderWrite (MimeEncoderData *data, const char *buffer, int32 size);
  75.  
  76. /* When you're done encoding/decoding, call this to free the data.  If
  77.    abort_p is FALSE, then calling this may cause the write_fn to be called
  78.    one last time (as the last buffered data is flushed out.)
  79.  */
  80. int MimeDecoderDestroy(MimeDecoderData *data, XP_Bool abort_p);
  81. int MimeEncoderDestroy(MimeEncoderData *data, XP_Bool abort_p);
  82.  
  83. XP_END_PROTOS
  84.  
  85. #endif /* _MIMEENC_H_ */
  86.