## modules/mm/mm.h

/* [<][>][^][v][top][bottom][index][help] */

## FUNCTIONS

This source file includes following functions.

1. MM_get_headers
2. parse_application_pgp
3. parse_unknown_unknown
4. parse_multipart_mixed
5. parse_multipart_digest

       1 /***************************************
       2   $Revision: 2.13 $
       3
       4   mm - MIME Parser module. Functions to parse a mail message,
       5   find if it is MIME-encapsulated, and return the parts of
       6   the message which are supported by the UP module.
       7
       8   Status: COMPLETE, NOT REVUED, TESTED
       9
      10   Design and implementation by: daniele@ripe.net
      11
      12   ******************/ /******************
      13   Copyright (c) 2000                              RIPE NCC
      14
      15   All Rights Reserved
      16
      17   Permission to use, copy, modify, and distribute this software and its
      18   documentation for any purpose and without fee is hereby granted,
      19   provided that the above copyright notice appear in all copies and that
      20   both that copyright notice and this permission notice appear in
      21   supporting documentation, and that the name of the author not be
      22   used in advertising or publicity pertaining to distribution of the
      23   software without specific, written prior permission.
      24
      25   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
      26   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
      27   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
      28   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
      29   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      30   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      31   ***************************************/
      32
      33 #ifndef MM_H
      34 #define MM_H
      35
      36
      37 /* Included headers: */
      38
      39 /* These come from c-client */
      40 #include "mail.h"
      41 #include "osdep.h"
      42 #include "misc.h"
      43 /*#include "rfc822.h"*/
      44 /*#include "smtp.h"*/
      45 /*#include "nntp.h"*/
      46
      47 /* Other RIP headers */
      48 #include "gpg.h"
      49 #include "mail_parser.h"
      50
      51 /* GLib */
      52 #include "glib.h"
      53
      54
      55
      56 /* String sizes */
      57 #define STR_S   63
      58 #define STR_M   255
      59 #define STR_L   1023
      60 #define STR_XL  4095
      61 #define STR_XXL 16383
      62
      63 #define LINELENGTH 80
      64
      65 /* Set this as the max buffer size when you want to
      66    avoid buffer overflows */
      67 #define MAXBUFSIZE 102400
      68
      69 /* Local #defines */
      70
      71 #define NO_DEBUG 0
      72 #define DO_DEBUG 1
      73 #define DEFAULT_DEBUG NO_DEBUG
      74 #define TEMPDIR "/tmp"
      75 #define FILENAMELEN STR_L
      76 #define GLOBALPREFIX "mime"
      77 #define MAXSUPPTYPES 50
      78
      79
      80 /* Structure definition */
      81
      82
      83
      84
      85 typedef struct MM_mail_header {
      86   char *from;
      87   char *subject;
      88   char *date;
      89   char *message_id;
      90   char *reply_to;
      91   char *cc;
      92   char *content_type;
      93 } MM_header;
      94
      95
      96 /* Needed for dbupdate, written in C++ */
      97
      98 #ifdef __cplusplus
      99 extern "C" {
     100 #endif
     101
     102
     103 /* Function definition */
     104
     105 /* API functions */
     106 int MM_store (char *source_file, char *destination_file, long custom_debug);
     107 int MM_get_msg_headers(const char *mail_file, EP_Mail_Descr *mail_descr, long mesgno, long custom_debug);
     108 #define MM_get_headers(mail_file, mail_descr, custom_debug) MM_get_msg_headers(mail_file, mail_descr, (long) 1, custom_debug)
         /* [<][>][^][v][top][bottom][index][help] */
     109 int MM_extract_mime (const char *sourcefile, char *pfx, EP_mail_node *mailnode, long custom_debug);
     110
     111 /* Internal support functions */
     112 void status (MAILSTREAM *stream);
     113 Mail_Header_Field *get_mail_hdr_field (MAILSTREAM *stream, long mesgno, STRINGLIST *cur, const char *hdr_title);
     114 char *get_header_line (MAILSTREAM *stream, long mesgno, STRINGLIST *cur, const char *hdr_title);
     115 void write_file (char *filename, char *text, size_t text_size);
     116 void read_file (const char *filename);
     117 void put_in_file (char *fileprefix, char *extension, char *text, size_t text_size);
     118 int do_regex_test(const char *pattern, char *string);
     119 t_MM_type is_supported_MIMEtype (BODY *body);
     120 void dispatch_to_driver(MAILSTREAM *stream, BODY *body, char *pfx, EP_mail_node *mailnode);
     121
     122
     123 /* The drivers */
     124 void parse_text_plain(MAILSTREAM *stream, BODY *body, char *pfx, EP_mail_node *mailnode);
     125 void parse_multipart_alternative (MAILSTREAM *stream, BODY *body, char *pfx, EP_mail_node *mailnode);
     126 void parse_multipart_signed (MAILSTREAM *stream, BODY *body, char *pfx, EP_mail_node *mailnode);
     127 void parse_message_rfc822 (MAILSTREAM *stream, BODY *body, char *pfx, EP_mail_node *mailnode);
     128 #define parse_application_pgp(stream, body, part_number, mailnode) parse_text_plain(stream, body, part_number, mailnode)
         /* [<][>][^][v][top][bottom][index][help] */
     129 #define parse_unknown_unknown(stream, body, part_number, mailnode) parse_text_plain(stream, body, part_number, mailnode) /* We give a chance to the unsupported MIMEtypes to contain plain text updates... */
         /* [<][>][^][v][top][bottom][index][help] */
     130 #define parse_multipart_mixed(stream, body, part_number, mailnode) parse_multipart_alternative(stream, body, part_number, mailnode)
         /* [<][>][^][v][top][bottom][index][help] */
     131 #define parse_multipart_digest(stream, body, part_number, mailnode) parse_multipart_alternative(stream, body, part_number, mailnode)
         /* [<][>][^][v][top][bottom][index][help] */
     132
     133 /* Needed for dbupdate, written in C++ */
     134
     135 #ifdef __cplusplus
     136 }
     137 #endif
     138
     139
     140 #endif

/* [<][>][^][v][top][bottom][index][help] */