include/mm.h

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

FUNCTIONS

This source file includes following functions.

   1 /***************************************
   2   $Revision: 1.11 $
   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 COMPLETE, NOT REVUED, NOT TESTED 
   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 } MM_header;
 110 
 111 
 112 /* Needed for dbupdate, written in C++ */
 113 
 114 #ifdef __cplusplus
 115 extern "C" {
 116 #endif
 117 
 118 
 119 /* Function definition */
 120 
 121 /* API functions */
 122 int MM_decode (char *mail_file, MM_header *mail_header, MM_xmp_list *part_list, long mesgno, long debug);
 123 int MM_store (char *source_file, char *destination_file, long debug);
 124 void MM_cleanup (MM_xmp_list *part_list, long debug);
 125 
 126 /* Internal support functions */
 127 int mm (MAILSTREAM *stream, MM_header *hdr, MM_xmp_list *part_list, long mesgno, long debug);
 128 void get_body_info (BODY *body,char *pfx,long i, MM_bs_list *sect_list, long debug);
 129 void status (MAILSTREAM *stream);
 130 void MM_bs_list_init (MM_bs_list *section_list);
 131 void MM_bs_list_ins_last (MM_bs_list *section_list, MM_b_section *newsection);
 132 void MM_bs_list_cleanup (MM_bs_list *section_list, long debug);
 133 void MM_xmp_list_init (MM_xmp_list *part_list);
 134 void MM_xmp_list_ins_last (MM_xmp_list *part_list, MM_xmp *newpart);
 135 char *get_header_line (MAILSTREAM *stream, long mesgno, STRINGLIST *cur, char *hdr_title);
 136 void write_file (char *filename, char *text, size_t text_size);
 137 void read_file (char *filename);
 138 void put_in_file (char *fileprefix, char *extension, char *text, size_t text_size);
 139 int do_regex_test(const char *pattern, char *string);
 140 
 141 
 142 /* Needed for dbupdate, written in C++ */
 143 
 144 #ifdef __cplusplus
 145 }
 146 #endif
 147 
 148 

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