include/mm.h

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

FUNCTIONS

This source file includes following functions.

   1 /***************************************
   2   $Revision: 1.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: NOT REVUED 
   9 
  10   Design and implementation by: Daniele Arena
  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 
  34 /* Included headers: */
  35 
  36 /* These come from c-client */
  37 #include "mail.h"
  38 #include "osdep.h"
  39 #include "misc.h"
  40 /*#include "rfc822.h"*/
  41 /*#include "smtp.h"*/
  42 /*#include "nntp.h"*/
  43 
  44 
  45 
  46 /* String sizes */
  47 #define STR_S   63
  48 #define STR_M   255
  49 #define STR_L   1023
  50 #define STR_XL  4095
  51 #define STR_XXL 16383
  52 
  53 
  54 /* Local #defines */
  55 
  56 #define NO_DEBUG 0
  57 #define DO_DEBUG 1
  58 #define DEFAULT_DEBUG DO_DEBUG
  59 #define TEMPDIR "/tmp"
  60 #define FILENAMELEN STR_L
  61 #define GLOBALPREFIX "mime"
  62 
  63 
  64 /* Structure definition */
  65 
  66 typedef struct MM_body_section *sectptr;
  67 
  68 typedef struct MM_body_section {
  69   char *number;
  70   char *type;
  71   unsigned long size;
  72   char *mime_headers;
  73   char *contents;
  74   short supported;
  75   sectptr next;
  76 } MM_b_section;
  77 
  78 typedef struct MM_body_section_list {
  79   int size;
  80   MM_b_section *head;
  81   MM_b_section *tail;
  82 } MM_bs_list;
  83 
  84 
  85 typedef struct MM_extracted_mimepart *partptr;
  86 
  87 typedef struct MM_extracted_mimepart {
  88   char *number;
  89   char *type;
  90   char *file;
  91   short supported;
  92   partptr next;
  93 } MM_xmp;
  94 
  95 typedef struct MM_extracted_mimepart_list {
  96   int size;
  97   MM_xmp *head;
  98   MM_xmp *tail;
  99 } MM_xmp_list;
 100 
 101 
 102 typedef struct MM_mail_header {
 103   char *from;
 104   char *subject;
 105   char *date;
 106   char *message_id;
 107   char *reply_to;
 108   char *cc;
 109   char *content_type;
 110 } MM_header;
 111 
 112 
 113 /* Needed for dbupdate, written in C++ */
 114 
 115 #ifdef __cplusplus
 116 extern "C" {
 117 #endif
 118 
 119 
 120 /* Function definition */
 121 
 122 /* API functions */
 123 int MM_decode (char *mail_file, MM_header *mail_header, MM_xmp_list *part_list, long mesgno, long debug);
 124 int MM_store (char *source_file, char *destination_file, long debug);
 125 void MM_cleanup (MM_xmp_list *part_list, long debug);
 126 
 127 /* Internal support functions */
 128 int mm (MAILSTREAM *stream, MM_header *hdr, MM_xmp_list *part_list, long mesgno, long debug);
 129 void get_body_info (BODY *body,char *pfx,long i, MM_bs_list *sect_list, long debug);
 130 void status (MAILSTREAM *stream);
 131 void MM_bs_list_init (MM_bs_list *section_list);
 132 void MM_bs_list_ins_last (MM_bs_list *section_list, MM_b_section *newsection);
 133 void MM_bs_list_cleanup (MM_bs_list *section_list, long debug);
 134 void MM_xmp_list_init (MM_xmp_list *part_list);
 135 void MM_xmp_list_ins_last (MM_xmp_list *part_list, MM_xmp *newpart);
 136 char *get_header_line (MAILSTREAM *stream, long mesgno, STRINGLIST *cur, char *hdr_title);
 137 void write_file (char *filename, char *text, size_t text_size);
 138 void read_file (char *filename);
 139 void put_in_file (char *fileprefix, char *extension, char *text, size_t text_size);
 140 int do_regex_test(const char *pattern, char *string);
 141 
 142 
 143 /* Needed for dbupdate, written in C++ */
 144 
 145 #ifdef __cplusplus
 146 }
 147 #endif
 148 
 149 

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