home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libmime / mimehdrs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.2 KB  |  99 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. /* mimehdrs.h --- external interface to the MIME header parser, version 2.
  20.    Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
  21.  */
  22.  
  23.  
  24. #ifndef _MIMEHDRS_H_
  25. #define _MIMEHDRS_H_
  26.  
  27. #include "libmime.h"
  28.  
  29. /* This file defines the interface to message-header parsing and formatting
  30.    code, including conversion to HTML.
  31.  */
  32.  
  33.  
  34.  
  35. /* Other structs defined later in this file.
  36.  */
  37.  
  38. /* Creation and destruction.
  39.  */
  40. extern MimeHeaders *MimeHeaders_new (void);
  41. extern void MimeHeaders_free (MimeHeaders *);
  42. extern MimeHeaders *MimeHeaders_copy (MimeHeaders *);
  43.  
  44.  
  45. /* Feed this method the raw data from which you would like a header
  46.    block to be parsed, one line at a time.  Feed it a blank line when
  47.    you're done.  Returns negative on allocation-related failure.
  48.  */
  49. extern int MimeHeaders_parse_line (const char *buffer, int32 size,
  50.                                    MimeHeaders *hdrs);
  51.  
  52.  
  53. /* Converts a MimeHeaders object into HTML, by writing to the provided
  54.    output function.
  55.  */
  56. extern int MimeHeaders_write_headers_html (MimeHeaders *hdrs,
  57.                                            MimeDisplayOptions *opt);
  58.  
  59. /* Writes the headers as text/plain.
  60.    This writes out a blank line after the headers, unless
  61.    dont_write_content_type is true, in which case the header-block
  62.    is not closed off, and none of the Content- headers are written.
  63.  */
  64. extern int MimeHeaders_write_raw_headers (MimeHeaders *hdrs,
  65.                                           MimeDisplayOptions *opt,
  66.                                           XP_Bool dont_write_content_type);
  67.  
  68.  
  69. /* For drawing the tables that represent objects that can't be displayed
  70.    inline. */
  71. extern int MimeHeaders_write_attachment_box(MimeHeaders *hdrs,
  72.                                             MimeDisplayOptions *opt,
  73.                                             const char *content_type,
  74.                                             const char *encoding,
  75.                                             const char *name,
  76.                                             const char *name_url,
  77.                                             const char *body);
  78.  
  79. /* Some crypto-related HTML-generated utility routines.
  80.  */
  81. extern char *MimeHeaders_open_crypto_stamp(void);
  82. extern char *MimeHeaders_finish_open_crypto_stamp(void);
  83. extern char *MimeHeaders_close_crypto_stamp(void);
  84. extern char *MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p,
  85.                                            XP_Bool signed_p,
  86.                                            XP_Bool good_p,
  87.                                            XP_Bool close_parent_stamp_p,
  88.                                            const char *stamp_url);
  89.  
  90.  
  91. /* Does all the heuristic silliness to find the filename in the given headers.
  92.  */
  93. extern char *MimeHeaders_get_name(MimeHeaders *hdrs);
  94.  
  95. extern char *mime_decode_filename(char *name);
  96.  
  97.  
  98. #endif /* _MIMEHDRS_H_ */
  99.